@everfur/sdk 1.4.0 → 1.5.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 (252) hide show
  1. package/README.md +2 -2
  2. package/dist/{Chat.d-BXuEjJsg.d.ts → Chat.d-BCfyvzX8.d.ts} +1 -1
  3. package/dist/{Chat.d-D9n8tSDD.d.cts → Chat.d-Od44h51D.d.cts} +1 -1
  4. package/dist/{DepthViews.d-PmjccZLr.d.cts → DepthViews.d-BGspxovy.d.cts} +1 -1
  5. package/dist/{DepthViews.d-aOChkwU2.d.ts → DepthViews.d-BIHVrf9r.d.ts} +1 -1
  6. package/dist/{DepthViews.d-ktxIIsnb.d.cts → DepthViews.d-BaLh7Lsi.d.cts} +1 -1
  7. package/dist/{DepthViews.d-CpF_Y_z9.d.ts → DepthViews.d-CEVk9poG.d.ts} +1 -1
  8. package/dist/ErrorPolicyPort.d-BIdmYQnk.d.cts +43 -0
  9. package/dist/ErrorPolicyPort.d-BnI5qWg4.d.ts +43 -0
  10. package/dist/{RecordsPage.d-BfMSOsg_.d.ts → RecordsPage.d-D10RIgdc.d.ts} +1 -1
  11. package/dist/{RecordsPage.d-DWjFpZs1.d.cts → RecordsPage.d-DbhYNSbq.d.cts} +1 -1
  12. package/dist/animations/index.cjs +1 -1
  13. package/dist/animations/index.d.cts +3 -3
  14. package/dist/animations/index.d.ts +3 -3
  15. package/dist/animations/index.js +1 -1
  16. package/dist/{attachments.d-DjWUR-h9.d.ts → attachments.d-BlukNfIf.d.ts} +2 -2
  17. package/dist/{attachments.d-Bsg6duaq.d.cts → attachments.d-CF4lLuGK.d.cts} +2 -2
  18. package/dist/{bookingCopy.d-ITpabqPr.d.ts → bookingCopy.d-BuDv16WP.d.ts} +12 -12
  19. package/dist/{bookingCopy.d-B39JAmIZ.d.cts → bookingCopy.d-rnBSqOSN.d.cts} +12 -12
  20. package/dist/{branding.d-Bzs4HJoN.d.cts → branding.d-CqDLKj1U.d.cts} +1 -1
  21. package/dist/{branding.d-CiC6xfGT.d.ts → branding.d-XrZYClN4.d.ts} +1 -1
  22. package/dist/{callCopy.d-Bw6oZT54.d.cts → callCopy.d-BQxpwXqT.d.cts} +3 -3
  23. package/dist/{callCopy.d-Bw6oZT54.d.ts → callCopy.d-BQxpwXqT.d.ts} +3 -3
  24. package/dist/{callRoom.d-B1DoYdJe.d.cts → callRoom.d-9Dm7XnUr.d.cts} +1 -1
  25. package/dist/{callRoom.d-Dqm1rUqT.d.ts → callRoom.d-t-khijDv.d.ts} +1 -1
  26. package/dist/{casesRepository.d-De4ZtgJ_.d.cts → casesRepository.d-CVuKTkJo.d.cts} +1 -1
  27. package/dist/{casesRepository.d-DsEeFd0F.d.ts → casesRepository.d-Dn1fK1b2.d.ts} +1 -1
  28. package/dist/chat/index.cjs +195 -195
  29. package/dist/chat/index.d.cts +14 -14
  30. package/dist/chat/index.d.ts +14 -14
  31. package/dist/chat/index.js +203 -203
  32. package/dist/chat/lite/index.cjs +206 -206
  33. package/dist/chat/lite/index.d.cts +14 -14
  34. package/dist/chat/lite/index.d.ts +14 -14
  35. package/dist/chat/lite/index.js +206 -206
  36. package/dist/{chatHandoffToken.d-sbumx0He.d.cts → chatHandoffToken.d-BjfmIxXk.d.cts} +7 -7
  37. package/dist/{chatHandoffToken.d-YJY6TZbj.d.ts → chatHandoffToken.d-CFiI6IMc.d.ts} +7 -7
  38. package/dist/{checkin.d-DxpoRutq.d.cts → checkin.d-BP3ZWBfX.d.cts} +19 -7
  39. package/dist/{checkin.d-C6vh9KVr.d.ts → checkin.d-CokpahFL.d.ts} +19 -7
  40. package/dist/{chunk-FZ6DAQFH.js → chunk-4KFFE42Z.js} +20 -20
  41. package/dist/{chunk-ZPIOCHKW.js → chunk-6IHY7HS7.js} +1 -1
  42. package/dist/{chunk-II4QDD6F.js → chunk-BMYNDBUR.js} +1 -1
  43. package/dist/{chunk-AJEELSFO.js → chunk-HHCGXQJR.js} +13 -13
  44. package/dist/client/index.cjs +31 -31
  45. package/dist/client/index.d.cts +24 -21
  46. package/dist/client/index.d.ts +24 -21
  47. package/dist/client/index.js +31 -31
  48. package/dist/{clinicBatch.d-B3YJc8IO.d.cts → clinicBatch.d-C0xx5L4j.d.cts} +3 -3
  49. package/dist/{clinicBatch.d-DhvQuPHV.d.ts → clinicBatch.d-DNi4UURs.d.ts} +3 -3
  50. package/dist/{config.d-DRoQ2lAx.d.ts → config.d-B7Z-KTGq.d.ts} +10 -2
  51. package/dist/{config.d-BiVy0fLx.d.cts → config.d-ClAI2RZ6.d.cts} +10 -2
  52. package/dist/consent/index.cjs +1 -1
  53. package/dist/consent/index.d.cts +6 -6
  54. package/dist/consent/index.d.ts +6 -6
  55. package/dist/consent/index.js +2 -2
  56. package/dist/{context.d-Cq2C4vdh.d.cts → context.d-Bj6-xYPA.d.cts} +13 -7
  57. package/dist/{context.d-D1l56nFr.d.ts → context.d-DS1GXUEY.d.ts} +13 -7
  58. package/dist/{copy.d-Ce_8KuZg.d.cts → copy.d--F5A9cXK.d.cts} +3 -3
  59. package/dist/{copy.d-BP36f_63.d.ts → copy.d-DmxuFJFe.d.ts} +3 -3
  60. package/dist/core/index.cjs +42 -41
  61. package/dist/core/index.d.cts +20 -20
  62. package/dist/core/index.d.ts +20 -20
  63. package/dist/core/index.js +42 -41
  64. package/dist/{depth.d-DzMMmRN4.d.ts → depth.d-CgzYE6_n.d.ts} +3 -3
  65. package/dist/{depth.d-BtlcIqPJ.d.cts → depth.d-DLaP0o8Y.d.cts} +3 -3
  66. package/dist/{entitlementRepository.d-x2YFdgYD.d.ts → entitlementRepository.d-CkUTlVAb.d.ts} +3 -3
  67. package/dist/{entitlementRepository.d-CEDU1gZE.d.cts → entitlementRepository.d-DVTp-BB9.d.cts} +3 -3
  68. package/dist/{focus.d-BX7oahFk.d.cts → focus.d-CLTjm6In.d.cts} +1 -1
  69. package/dist/{focus.d-armXecf0.d.ts → focus.d-u-HYvim0.d.ts} +1 -1
  70. package/dist/health-plan/index.cjs +1 -1
  71. package/dist/health-plan/index.d.cts +17 -17
  72. package/dist/health-plan/index.d.ts +17 -17
  73. package/dist/health-plan/index.js +1 -1
  74. package/dist/{healthPlanRepository.d-DBx7-NLE.d.cts → healthPlanRepository.d-B22kjrYa.d.cts} +3 -3
  75. package/dist/{healthPlanRepository.d-C7K9dJK5.d.ts → healthPlanRepository.d-CwRXeoM7.d.ts} +3 -3
  76. package/dist/{idempotency.d-Dak2-pON.d.cts → idempotency.d-CFVMhWcv.d.cts} +1 -1
  77. package/dist/{idempotency.d-symqJ8Tt.d.ts → idempotency.d-dOFfV91-.d.ts} +1 -1
  78. package/dist/{identity.d-DOKJFaiz.d.ts → identity.d-D4VtpqRr.d.ts} +1 -1
  79. package/dist/{identity.d-DIH9h3Le.d.cts → identity.d-DDpXOtas.d.cts} +1 -1
  80. package/dist/{inbox.d-AuGKeaZv.d.cts → inbox.d-CPcMMz-Y.d.cts} +2 -2
  81. package/dist/{inbox.d-B5b57OXc.d.ts → inbox.d-DJ9xgU1Z.d.ts} +2 -2
  82. package/dist/index.cjs +248 -247
  83. package/dist/index.d.cts +22 -22
  84. package/dist/index.d.ts +22 -22
  85. package/dist/index.js +247 -246
  86. package/dist/{introEvents.d-ehik7PEn.d.cts → introEvents.d-B7acmGwf.d.cts} +1 -1
  87. package/dist/{introEvents.d-S4Q4BOSt.d.ts → introEvents.d-DW3gLljE.d.ts} +1 -1
  88. package/dist/{layout.d-Bm2_1wa4.d.ts → layout.d-C8y_ki1V.d.ts} +1 -1
  89. package/dist/{layout.d-CFF-nBXf.d.cts → layout.d-DfaFM_lp.d.cts} +1 -1
  90. package/dist/{models.d-DOwpK1ZF.d.ts → models.d-BKmOfoqV.d.cts} +2 -2
  91. package/dist/{models.d-Su_BBBTW.d.cts → models.d-BULqCO2R.d.ts} +2 -2
  92. package/dist/notifications/inbox/index.cjs +9 -9
  93. package/dist/notifications/inbox/index.d.cts +7 -7
  94. package/dist/notifications/inbox/index.d.ts +7 -7
  95. package/dist/notifications/inbox/index.js +9 -9
  96. package/dist/notifications/index.cjs +3 -3
  97. package/dist/notifications/index.d.cts +8 -8
  98. package/dist/notifications/index.d.ts +8 -8
  99. package/dist/notifications/index.js +6 -6
  100. package/dist/{optInView.d-DbGx1A9R.d.cts → optInView.d-ByDJMrMv.d.cts} +13 -13
  101. package/dist/{optInView.d-xnIxCLlH.d.ts → optInView.d-DVshLxbD.d.ts} +13 -13
  102. package/dist/{parse.d-DtHmpAMT.d.cts → parse.d-BDZ7ffgj.d.cts} +4 -1
  103. package/dist/{parse.d-DtHmpAMT.d.ts → parse.d-BDZ7ffgj.d.ts} +4 -1
  104. package/dist/{pets.d-BEqKykpu.d.ts → pets.d-BpLObpfM.d.ts} +1 -1
  105. package/dist/{pets.d-BS6sLxY-.d.cts → pets.d-DXhzTNuI.d.cts} +1 -1
  106. package/dist/{petsRepository.d-iHrHkXM2.d.ts → petsRepository.d-_QfM7F6T.d.ts} +1 -1
  107. package/dist/{petsRepository.d-DB5CNKsK.d.cts → petsRepository.d-ai_tZ3lu.d.cts} +1 -1
  108. package/dist/photo/index.cjs +1 -1
  109. package/dist/photo/index.js +23 -23
  110. package/dist/{presentation.d-CWGjwq8Z.d.cts → presentation.d-BkIvMtIl.d.cts} +3 -3
  111. package/dist/{presentation.d-CWGjwq8Z.d.ts → presentation.d-BkIvMtIl.d.ts} +3 -3
  112. package/dist/records/depth/index.cjs +1 -1
  113. package/dist/records/depth/index.d.cts +10 -10
  114. package/dist/records/depth/index.d.ts +10 -10
  115. package/dist/records/depth/index.js +1 -1
  116. package/dist/records/index.cjs +2 -2
  117. package/dist/records/index.d.cts +13 -13
  118. package/dist/records/index.d.ts +13 -13
  119. package/dist/records/index.js +71 -71
  120. package/dist/{requestFunnel.d-SySe6xHp.d.cts → requestFunnel.d-BwZDfWVD.d.cts} +3 -3
  121. package/dist/{requestFunnel.d-CehftayS.d.ts → requestFunnel.d-DKBPTpsy.d.ts} +3 -3
  122. package/dist/{route.d-9wclfD-y.d.cts → route.d-DCzQh4ix.d.cts} +3 -3
  123. package/dist/{route.d-IP_gkOWL.d.ts → route.d-DSYEd2MR.d.ts} +3 -3
  124. package/dist/{runtimeTypes.d-BdUe3tYs.d.ts → runtimeTypes.d-BzUig75K.d.ts} +15 -11
  125. package/dist/{runtimeTypes.d-_UZ6rMUY.d.cts → runtimeTypes.d-CL4l7ta4.d.cts} +15 -11
  126. package/dist/{screenProps.d-Bd2yphad.d.cts → screenProps.d-6xmE1C-V.d.cts} +2 -2
  127. package/dist/{screenProps.d-D9Vi-Afl.d.ts → screenProps.d-fHBKArt_.d.ts} +2 -2
  128. package/dist/{sdkConfigStore.d-VPvsIL8E.d.ts → sdkConfigStore.d-BNCVVEWC.d.ts} +1 -1
  129. package/dist/{sdkConfigStore.d-BHrzkVpP.d.cts → sdkConfigStore.d-C2BAr9kI.d.cts} +1 -1
  130. package/dist/server/events/index.cjs +4 -4
  131. package/dist/server/events/index.d.cts +2 -2
  132. package/dist/server/events/index.d.ts +2 -2
  133. package/dist/server/events/index.js +4 -4
  134. package/dist/server/index.cjs +9 -9
  135. package/dist/server/index.d.cts +18 -4
  136. package/dist/server/index.d.ts +18 -4
  137. package/dist/server/index.js +9 -9
  138. package/dist/shop/index.d.cts +3 -3
  139. package/dist/shop/index.d.ts +3 -3
  140. package/dist/slots/index.cjs +1 -1
  141. package/dist/slots/index.d.cts +6 -6
  142. package/dist/slots/index.d.ts +6 -6
  143. package/dist/slots/index.js +1 -1
  144. package/dist/tabs/index.cjs +88 -85
  145. package/dist/tabs/index.d.cts +15 -15
  146. package/dist/tabs/index.d.ts +15 -15
  147. package/dist/tabs/index.js +87 -84
  148. package/dist/televet/booking/index.cjs +41 -41
  149. package/dist/televet/booking/index.d.cts +8 -8
  150. package/dist/televet/booking/index.d.ts +8 -8
  151. package/dist/televet/booking/index.js +4 -4
  152. package/dist/televet/call/index.d.cts +2 -2
  153. package/dist/televet/call/index.d.ts +2 -2
  154. package/dist/televet/index.cjs +1 -1
  155. package/dist/televet/index.js +1 -1
  156. package/dist/testing/index.cjs +1 -1
  157. package/dist/testing/index.d.cts +1 -1
  158. package/dist/testing/index.d.ts +1 -1
  159. package/dist/testing/index.js +1 -1
  160. package/dist/testing/rn/index.cjs +8 -8
  161. package/dist/testing/rn/index.d.cts +13 -13
  162. package/dist/testing/rn/index.d.ts +13 -13
  163. package/dist/testing/rn/index.js +9 -9
  164. package/dist/testing/web/index.cjs +3 -3
  165. package/dist/testing/web/index.d.cts +13 -13
  166. package/dist/testing/web/index.d.ts +13 -13
  167. package/dist/testing/web/index.js +1 -1
  168. package/dist/texting/index.cjs +1 -1
  169. package/dist/texting/index.d.cts +6 -6
  170. package/dist/texting/index.d.ts +6 -6
  171. package/dist/texting/index.js +26 -26
  172. package/dist/{threadOptions.d-bEAFkIsC.d.cts → threadOptions.d-Bqy5d5Fx.d.cts} +1 -1
  173. package/dist/{threadOptions.d-U5YBUKM-.d.ts → threadOptions.d-DOEIpk1t.d.ts} +1 -1
  174. package/dist/{threadOptions.d-BW0rePcs.d.cts → threadOptions.d-Dc57dm7h.d.cts} +7 -7
  175. package/dist/{threadOptions.d-CrAb71J2.d.ts → threadOptions.d-NSlFx-Lp.d.ts} +7 -7
  176. package/dist/{timelineRows.d-DXppCSCg.d.cts → timelineRows.d-7w8NsNi4.d.cts} +1 -1
  177. package/dist/{timelineRows.d-9Uhf4q5d.d.ts → timelineRows.d-CthNM5hV.d.ts} +1 -1
  178. package/dist/{typeStyle.d-rzVzCfLz.d.ts → typeStyle.d-8mcLhtbH.d.ts} +1 -1
  179. package/dist/{typeStyle.d-B-YgiWcS.d.cts → typeStyle.d-CLrQZW-r.d.cts} +1 -1
  180. package/dist/{unreadStore.d-gCsleb6l.d.ts → unreadStore.d-CLnChKca.d.ts} +17 -9
  181. package/dist/{unreadStore.d-w5x6lEpR.d.cts → unreadStore.d-Donv4bcF.d.cts} +17 -9
  182. package/dist/{useHealthPlanSubscription.d-CRBPMlsc.d.ts → useHealthPlanSubscription.d-CV7M21HS.d.ts} +3 -3
  183. package/dist/{useHealthPlanSubscription.d-DfjTYv1u.d.cts → useHealthPlanSubscription.d-SA9-SuKe.d.cts} +3 -3
  184. package/dist/{useInboxUnread.d-CP3KwSkn.d.ts → useInboxUnread.d-CXiaR3BZ.d.ts} +1 -1
  185. package/dist/{useInboxUnread.d-DiE_NbtS.d.cts → useInboxUnread.d-DERpMelw.d.cts} +1 -1
  186. package/dist/{usePresentation.d-DefUwatV.d.cts → usePresentation.d-BJzFicRQ.d.cts} +3 -3
  187. package/dist/{usePresentation.d-w5_oWKmh.d.ts → usePresentation.d-DgSGIWS-.d.ts} +3 -3
  188. package/dist/{useRecordsDepth.d-l6D0ZS4l.d.cts → useRecordsDepth.d-C9W45gwS.d.cts} +1 -1
  189. package/dist/{useRecordsDepth.d-DG2GiAyt.d.ts → useRecordsDepth.d-ZX2rhcUx.d.ts} +1 -1
  190. package/dist/{useUnread.d-xDOpYyqx.d.ts → useUnread.d-CedFK4k6.d.ts} +5 -5
  191. package/dist/{useUnread.d-DeRDFtTb.d.cts → useUnread.d-DST1GMmL.d.cts} +5 -5
  192. package/dist/video/index.cjs +1 -1
  193. package/dist/video/index.js +1 -1
  194. package/dist/{view.d-ufGX_MKK.d.cts → view.d-3lxzyJlL.d.cts} +6 -6
  195. package/dist/{view.d-iTInze7B.d.ts → view.d-DRiYNQJ8.d.ts} +6 -6
  196. package/dist/web/consent/index.cjs +3 -3
  197. package/dist/web/consent/index.d.cts +6 -6
  198. package/dist/web/consent/index.d.ts +6 -6
  199. package/dist/web/consent/index.js +5 -5
  200. package/dist/web/health-plan/index.cjs +2 -2
  201. package/dist/web/health-plan/index.d.cts +17 -17
  202. package/dist/web/health-plan/index.d.ts +17 -17
  203. package/dist/web/health-plan/index.js +1 -1
  204. package/dist/web/inbox/index.cjs +5 -5
  205. package/dist/web/inbox/index.d.cts +9 -8
  206. package/dist/web/inbox/index.d.ts +9 -8
  207. package/dist/web/inbox/index.js +5 -5
  208. package/dist/web/index.cjs +196 -195
  209. package/dist/web/index.d.cts +34 -34
  210. package/dist/web/index.d.ts +34 -34
  211. package/dist/web/index.js +196 -195
  212. package/dist/web/intro/index.cjs +10 -10
  213. package/dist/web/intro/index.d.cts +8 -8
  214. package/dist/web/intro/index.d.ts +8 -8
  215. package/dist/web/intro/index.js +6 -6
  216. package/dist/web/notifications/index.cjs +5 -5
  217. package/dist/web/notifications/index.d.cts +7 -7
  218. package/dist/web/notifications/index.d.ts +7 -7
  219. package/dist/web/notifications/index.js +1 -1
  220. package/dist/web/records/depth/index.cjs +1 -1
  221. package/dist/web/records/depth/index.d.cts +10 -10
  222. package/dist/web/records/depth/index.d.ts +10 -10
  223. package/dist/web/records/depth/index.js +1 -1
  224. package/dist/web/records/index.cjs +1 -1
  225. package/dist/web/records/index.d.cts +13 -13
  226. package/dist/web/records/index.d.ts +13 -13
  227. package/dist/web/records/index.js +1 -1
  228. package/dist/web/records-sheet/index.cjs +2 -2
  229. package/dist/web/records-sheet/index.js +2 -2
  230. package/dist/web/shop/index.cjs +1 -1
  231. package/dist/web/shop/index.d.cts +3 -3
  232. package/dist/web/shop/index.d.ts +3 -3
  233. package/dist/web/shop/index.js +15 -15
  234. package/dist/web/televet/booking/index.cjs +7 -7
  235. package/dist/web/televet/booking/index.d.cts +9 -9
  236. package/dist/web/televet/booking/index.d.ts +9 -9
  237. package/dist/web/televet/booking/index.js +69 -69
  238. package/dist/web/televet/call/index.cjs +1 -1
  239. package/dist/web/televet/call/index.d.cts +2 -2
  240. package/dist/web/televet/call/index.d.ts +2 -2
  241. package/dist/web/televet/call/index.js +1 -1
  242. package/dist/web/televet/index.cjs +6 -6
  243. package/dist/web/televet/index.js +1 -1
  244. package/dist/web/texting/index.cjs +1 -1
  245. package/dist/web/texting/index.d.cts +6 -6
  246. package/dist/web/texting/index.d.ts +6 -6
  247. package/dist/web/texting/index.js +1 -1
  248. package/dist/web/ui/index.cjs +1 -1
  249. package/dist/web/ui/index.js +32 -32
  250. package/package.json +1 -32
  251. package/dist/ErrorPolicyPort.d-68yrE3BE.d.ts +0 -23
  252. package/dist/ErrorPolicyPort.d-DirW9hgO.d.cts +0 -23
@@ -1,9 +1,9 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  "use strict";var e=require("react"),t=require("react/jsx-runtime"),r=require("@everfur/sdk/televet/booking"),n=require("react-native"),l=require("react-native-safe-area-context"),i=require("@everfur/sdk/texting");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:true,get:function(){return e[r]}})}})}t.default=e;return Object.freeze(t)}var a=/*#__PURE__*/o(r);var s=/*#__PURE__*/o(i);var u=e.createContext(null);function TelevetHostOutlet(){let r=e.useContext(u);return r===null?null:/* @__PURE__ */t.jsx(r,{})}var c=/* @__PURE__ */Symbol.for("@everfur/sdk/televet");function d(){let e=globalThis,t=e[c];if(t!==void 0)return t;let r={presenter:null,snapshot:/* @__PURE__ */Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:/* @__PURE__ */new Set,dailyRegistered:false};return e[c]=r,r}function p(e){let t=d();t.snapshot=/* @__PURE__ */Object.freeze({...t.snapshot,...e});for(let e of[...t.listeners])try{e()}catch{}}function f(e){let t=d().presenter;if(t===null)return"absent";try{return t(e)===!1?"declined":"presented"}catch(e){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",e),"threw"}}function h(e){let t=d();return t.listeners.add(e),()=>{t.listeners.delete(e)}}function b(){return d().snapshot}function g(){return d().hosts.length>0}function m(e){if(!g())return false;let t=/* @__PURE__ */Object.freeze({...e});return p({request:t,serial:d().snapshot.serial+1}),true}function y(){d().snapshot.request!==null&&p({request:null})}function v(){let e=d(),t=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,t],p({activeHost:e.hosts[0]??null}),t}function x(e){let t=d();t.hosts=t.hosts.filter(t=>t!==e);let r=t.hosts[0]??null;p(r===null?{activeHost:r,request:null}:{activeHost:r})}function w(e){let t=null;return()=>{if(t!==null)return t;let r=e();return t=r,r.then(void 0,()=>{t===r&&(t=null)}),r}}function k(t){let[r,n]=e.useState(null);e.useEffect(()=>{let e=v();return n(e),()=>{x(e)}},[]);let l=e.useSyncExternalStore(h,b,b),i=r!==null&&l.activeHost===r?l.request:null,[o,a]=e.useState(null),s=i!==null&&o===null;return e.useEffect(()=>{if(!s)return;let e=true;return t().then(t=>{e&&a(()=>t)},t=>{e&&(console.warn("[everfur] The in-app vet visit could not load its screens.",t),y())}),()=>{e=false}},[s,t]),i===null||o===null?null:{module:o,request:i,serial:l.serial,dismiss:y}}var S=w(()=>Promise.resolve(a));function EverfurTelevetHost({onAddToCalendar:e,onPickMedia:r,primaryVet:n,onFindEmergencyVet:l}={}){let i=k(S);if(i===null)return null;let{EverfurTelevetModal:o}=i.module;/* @__PURE__ */
3
3
  return t.jsx(o,{request:i.request,onClose:i.dismiss,...e?{onAddToCalendar:e}:{},...r?{onPickMedia:r}:{},...n?{primaryVet:n}:{},...l?{onFindEmergencyVet:l}:{}},i.serial)}var C=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[C[t]]}}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type;if(r===null&&n===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:n??e.type.weight[C[t]]};let l=face(e,t);return l.fontWeight===void 0||n===null?l:{fontFamily:l.fontFamily,fontWeight:n}}function j(e){return e<=450?"regular":e<=650?"medium":"bold"}var R={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=T.get(e);r===void 0&&(r=/* @__PURE__ */new Map,T.set(e,r));let n=r.get(t);if(n!==void 0)return n;let l=_(e,t);return r.set(t,l),l}var T=/* @__PURE__ */new WeakMap;function _(e,t){let r=e.type.roles[t],n=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,l=j(Number(n)),i=r.face==="mono"?face(e,R[l]):r.face==="heading"?headingFace(e,l):face(e,l),o=r.face==="heading"?e.type.headingWeight??n:n,a=i.fontWeight===void 0?i:{fontFamily:i.fontFamily,fontWeight:o},s=r.size,u={...a,fontSize:s,lineHeight:Math.round(s*r.lineHeight*100)/100};return r.letterSpacing!==0&&(u.letterSpacing=Math.round(s*r.letterSpacing*100)/100),r.uppercase&&(u.textTransform="uppercase"),/* @__PURE__ */Object.freeze(u)}var z=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var I=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){I(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var P=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var E={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},M={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},F={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},A={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},L={regular:"400",medium:"500",bold:"700"},O={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},V=0,D="System",B="monospace",H=["content","heading","control","compact","badge"];function W(e){let t={};for(let r of H)t[r]=e;return t}var N=[];function U(){return{family:D,mono:B,fontUrl:null,families:{regular:D,medium:D,bold:D,mono:B,monoMedium:B,monoBold:B},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:F,tierSizes:W(F),lineHeight:A,weight:L,letterSpacing:O,scale:1,maxScale:V,scaleCaps:P,headingFamily:null,headingWeight:null,fontSources:N,roles:z,typeScale:1}}var $={},q=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var G={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(q.standard),emphasized:cssCubicBezier(q.emphasized),exit:cssCubicBezier(q.exit)},reducedMotion:false},K={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},Y=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:K,space:E,radius:M,type:U(),motion:G,slots:$}),Q={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"},Z=deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Q,space:E,radius:M,type:U(),motion:G,slots:$});var J=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),X=globalThis,ee=X[J]??(X[J]=e.createContext(Y));ee.displayName??="EverfurThemeContext";function useEverfurTheme(){return e.useContext(ee)}function te(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:t,variant:r,...l}){let i=useEverfurTheme(),o=r===void 0?void 0:i.type.roles[r],a=te(i.type,t??o?.tier??"content"),s=r===void 0?l:{...l,style:[{...textRole(i,r),color:i.color.text.primary,flexShrink:1},l.style]};return e.createElement(n.Text,a===void 0?s:{maxFontSizeMultiplier:a,...s})}var re=e.forwardRef(function(t,r){return e.createElement(n.TextInput,{...t,...r===null?{}:{ref:r}})});var ne=/* @__PURE__ */Object.freeze({chatAnswerStyle:"cards",chatHistoryStyle:"sheet",chatTopCard:"focus",chatFollowUpCount:3,chatFollowUpsExcludeTelevet:false,chatComposerMic:true,chatComposerUpload:true,safetyDisclaimerPlacement:"composer",healthPlanLayout:"focus_plan",recordsTopRiskLine:true,recordsClearResultsFilter:true,chatComposerStyle:"compact",chatComposerPlaceholder:"pet_name",chatHistoryBar:"scroll",chatGeneralBanner:true,chatSendButton:"always_dark",chatTextingAsk:true,serverSlots:false}),le=/* @__PURE__ */Object.freeze({chatAnswerStyle:"chat_answer_style",chatHistoryStyle:"chat_history_style",chatTopCard:"chat_top_card",chatFollowUpCount:"chat_follow_up_count",chatFollowUpsExcludeTelevet:"chat_follow_ups_exclude_televet",chatComposerMic:"chat_composer_mic",chatComposerUpload:"chat_composer_upload",safetyDisclaimerPlacement:"safety_disclaimer_placement",healthPlanLayout:"health_plan_layout",recordsTopRiskLine:"records_top_risk_line",recordsClearResultsFilter:"records_clear_results_filter",chatComposerStyle:"chat_composer_style",chatComposerPlaceholder:"chat_composer_placeholder",chatHistoryBar:"chat_history_bar",chatGeneralBanner:"chat_general_banner",chatSendButton:"chat_send_button",chatTextingAsk:"chat_texting_ask",serverSlots:"server_slots"}),ie=Object.keys(le),oe="presentation",ae="presentation.";var se={chatAnswerStyle:["bubbles","cards"],chatHistoryStyle:["drawer","sheet"],chatTopCard:["none","focus"],safetyDisclaimerPlacement:["composer","answer_footer","none"],healthPlanLayout:["standard","focus_plan"],chatComposerStyle:["standard","compact"],chatComposerPlaceholder:["generic","pet_name"],chatHistoryBar:["pinned","scroll"],chatSendButton:["always_dark","dim_when_empty"]},ue=/* @__PURE__ */new Set(["chatFollowUpsExcludeTelevet","chatComposerMic","chatComposerUpload","recordsTopRiskLine","recordsClearResultsFilter","chatGeneralBanner","chatTextingAsk","serverSlots"]);function ce(e,t){if(t==null)return;let r=se[e];return r!==void 0?typeof t=="string"&&r.includes(t)?t:void 0:ue.has(e)?typeof t=="boolean"?t:void 0:typeof t=="number"&&Number.isInteger(t)&&t>=0&&t<=3?t:void 0}function parsePresentation(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let e of ie){let n=le[e],l=Object.prototype.hasOwnProperty.call(t,n)?t[n]:t[e],i=ce(e,l);i!==void 0&&(r[e]=i)}return Object.keys(r).length===0?null:/* @__PURE__ */Object.freeze(r)}function isPresentationFieldLocked(e,t){if(t==null)return false;let r=`${ae}${le[e]}`;for(let e of t)if(e===oe||e===r)return true;return false}function resolvePresentation(e){let t=parsePresentation(e?.server??null)??{},{safetyDisclaimerPlacement:r,...n}=t,l=r==="none"||r===void 0?n:{...n,safetyDisclaimerPlacement:r},i=parsePresentation(e?.client??null)??{},o=e?.locked?[...e.locked]:null,a={};for(let e of ie){let t=l[e],r=isPresentationFieldLocked(e,o)?void 0:i[e];a[e]=r??t??ne[e]}/* @__PURE__ */
4
- return Object.freeze(a)}var de="Go to the nearest emergency vet now.";var pe=/* @__PURE__ */Object.freeze({placeholder:"Ask anything about {petName}…",placeholderFollowUpWeb:"Ask a follow-up…",placeholderUrgentWeb:"Tell us what’s happening…",composerLabel:"Message",attachPhotoOrFileNative:"Add a photo or file",footnoteNative:"Educational, not a diagnosis. Emergency? Call a vet.",footnoteWeb:"Everfur’s assistant isn’t a vet and doesn’t diagnose. Your vet makes the calls. Not for emergencies: if {petName} is in distress, go to the nearest emergency animal hospital now.",suggestions:"Suggestions",reading:"Reading {petName}’s records…",answered:"Everfur answered.",assistantName:"Everfur",followUpsHeadingNative:"Follow-up questions",turnFailedTitleWeb:"Everfur couldn’t answer that just now.",send:"Send",stop:"Stop",retry:"Try again",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",loading:"Loading",empty:"No messages yet",transcript:"Chat with Everfur",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting…",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",sourcesHeading:"Sources",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",nearestEmergencyVet:"Nearest emergency vet",goToNearestEmergencyVet:de,poisonControlWeb:"ASPCA Poison Control",poisonControlNative:"ASPCA Animal Poison Control, (888) 426-4435",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openHistoryNative:"Chats and vet messages",openHistoryWeb:"Chats",showChatsWeb:"Show chats",hideChatsWeb:"Hide chats",newReplySuffix:", a new reply",yourPets:"Your pets",yourPet:"Your pet",switchActivePet:"{name}. Switch pet",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active · ",close:"Close",addAnotherPet:"Add a pet",addPet:"Add a pet",capReached:"You've used your {cap} free messages this month.",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function fe(e,t){return e.replace(/\{(\w+)\}/g,(e,r)=>{let n=t[r];return n===void 0?e:String(n)})}function he(e){return e?.trim()||pe.emptyTitlePetFallback}function be(e,t){return fe(e,{petName:he(t)})}var ge="tel:+18884264435";function ok(e,t){/* @__PURE__ */
4
+ return Object.freeze(a)}var de="Go to the nearest emergency vet now.";var pe=/* @__PURE__ */Object.freeze({placeholder:"Ask anything about {petName}…",placeholderFollowUpWeb:"Ask a follow-up…",placeholderUrgentWeb:"Tell us what’s happening…",composerLabel:"Message",attachPhotoOrFileNative:"Add a photo or file",suggestions:"Suggestions",reading:"Reading {petName}’s records…",answered:"Everfur answered.",assistantName:"Everfur",followUpsHeadingNative:"Follow-up questions",turnFailedTitleWeb:"Everfur couldn’t answer that just now.",send:"Send",stop:"Stop",retry:"Try again",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",loading:"Loading",empty:"No messages yet",transcript:"Chat with Everfur",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting…",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",sourcesHeading:"Sources",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",nearestEmergencyVet:"Nearest emergency vet",goToNearestEmergencyVet:de,poisonControlWeb:"ASPCA Poison Control",poisonControlNative:"ASPCA Animal Poison Control, (888) 426-4435",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openHistoryNative:"Chats and vet messages",openHistoryWeb:"Chats",showChatsWeb:"Show chats",hideChatsWeb:"Hide chats",newReplySuffix:", a new reply",yourPets:"Your pets",yourPet:"Your pet",switchActivePet:"{name}. Switch pet",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active · ",close:"Close",addAnotherPet:"Add a pet",addPet:"Add a pet",capReached:"You've used your {cap} free messages this month.",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function fe(e,t){return e.replace(/\{(\w+)\}/g,(e,r)=>{let n=t[r];return n===void 0?e:String(n)})}function he(e){return e?.trim()||pe.emptyTitlePetFallback}function be(e,t){return fe(e,{petName:he(t)})}var ge="tel:+18884264435";function ok(e,t){/* @__PURE__ */
5
5
  return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
6
- return Object.freeze({ok:false,error:e})}var me=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var ye=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),ve=globalThis,xe=ve[ye]??(ve[ye]=e.createContext(null));xe.displayName??="EverfurContext";function we(){let t=e.useContext(xe);if(t===null)throw new me("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var ke=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],Se=/* @__PURE__ */Object.freeze(ke.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Se.map(e=>e.wireCode));var Ce=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound"}),je=/* @__PURE__ */Object.freeze(Se.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Ce[e.wireCode]}))),Re=new Map(je.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Te=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(je.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...Te]){let t=Re.get(e+r);if(t)return t}}var _e=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return _e[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var ze=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return ze.has(e)}var Ie=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||Ie.has(e)}var Pe=500,Ee=8e3,Me=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Pe*2**r,Ee);return Math.floor(t()*n)}var Fe="This feature isn't available on your account right now.",Ae="Something in that request was not right. Check the details and try again.",Le=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:Fe,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:Ae,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:Fe,runtimeDisposed:Ae,unknown:"Something went wrong. Please try again."}),Oe="This session has ended. Please sign in again.",Ve="linked_account_read_only";function De(e,t,r){return e==="conflict"&&r===Ve?Fe:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?Oe:userFacingError(e)}function userFacingError(e){return Le[e]}function Be(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var He=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===Ve,l={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:De(e,t?.wireCode,n?Ve:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&He.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(l.retryAfterSeconds=Math.round(i)),r);return t?.wireMessage&&Be(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Be(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
6
+ return Object.freeze({ok:false,error:e})}var me=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var ye=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),ve=globalThis,xe=ve[ye]??(ve[ye]=e.createContext(null));xe.displayName??="EverfurContext";function we(){let t=e.useContext(xe);if(t===null)throw new me("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var ke=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],Se=/* @__PURE__ */Object.freeze(ke.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Se.map(e=>e.wireCode));var Ce=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),je=/* @__PURE__ */Object.freeze(Se.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Ce[e.wireCode]}))),Re=new Map(je.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Te=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(je.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...Te]){let t=Re.get(e+r);if(t)return t}}var _e=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return _e[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var ze=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return ze.has(e)}var Ie=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||Ie.has(e)}var Pe=500,Ee=8e3,Me=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Pe*2**r,Ee);return Math.floor(t()*n)}var Fe="This feature isn't available on your account right now.",Ae="Something in that request was not right. Check the details and try again.",Le=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:Fe,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:Ae,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:Fe,runtimeDisposed:Ae,unknown:"Something went wrong. Please try again."}),Oe="This session has ended. Please sign in again.",Ve="linked_account_read_only";function De(e,t,r){return e==="conflict"&&r===Ve?Fe:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?Oe:userFacingError(e)}function userFacingError(e){return Le[e]}function Be(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var He=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===Ve,l={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:De(e,t?.wireCode,n?Ve:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&He.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(l.retryAfterSeconds=Math.round(i)),r);return t?.wireMessage&&Be(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Be(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
7
7
  return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var We="x-everfur-anon-token",Ne="anonTokenInvalid";async function Ue(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function $e(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...r?{wireMessage:r}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[We]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...qe(e.headers),...authHeaders(t)}}}function qe(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let e=r.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===We||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await Ue(t),n=await t.transport.request(withAuthHeaders(e,Ge(t,r)));if(n.ok||Ye(n.error.raw)!==Ne||t.anonIdentity===void 0||t.userRef!==null)return n;let l=await t.anonIdentity.token({forceRefresh:true});return l===null||l===r?n:t.transport.request(withAuthHeaders(e,Ge(t,l)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err($e(e))}let n=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let l;try{l=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err($e(e,{wireCode:Ye(n.error.raw),requestId:n.error.requestId}))}let i=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:l,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!i.ok&&i.error.httpStatus===401?(t.identity.reportRejected?.(),err(Ke(i.error))):i}function Ge(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function Ke(e){let t=e.raw,r=Ye(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...r?{wireCode:r}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function Ye(e){if(typeof e!="object"||e===null)return null;let t=e,r=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof r=="string"&&r.length>0?r:null}var Qe="free_cap_reached";function Ze(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Je(e){if(typeof e!="object"||e===null)return null;let t=e,r=t.detail,n=typeof r=="object"&&r!==null?r:t;if(n.error!==Qe&&n.code!==Qe)return null;let l=Ze(n.limit),i=Ze(n.used);if(l===null||i===null)return null;let o=n.resets_at,a=n.emergency_guidance;/* @__PURE__ */
8
8
  return Object.freeze({limit:l,used:i,resetsAt:typeof o=="string"&&o.length>0?o:null,...typeof a=="string"&&a.trim().length>0?{emergencyGuidance:a}:{}})}function Xe(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t.freeCap;return typeof r=="object"&&r!==null?r:Je(t)}function et(e,t){let r=globalThis.URL;if(typeof r=="function"){let n;try{n=t===void 0?new r(e):new r(e,t)}catch{return null}try{if(n.protocol)return n}catch{}}return lt(e)}var tt=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,rt=/[\s\u0000-\u001f\u007f\\]/,nt={"http:":"80","https:":"443"};function lt(e,t){let r=e.trim();let n=rt.test(r)?null:tt.exec(r);if(n===null)return null;let[,l="",i="",o="",a="",s="",u="",c="",d=""]=n,p=`${l.toLowerCase()}:`,f=Number(s);if(f>65535)return null;let h=s===""||String(f)===nt[p]?"":String(f),b=nt[p]!==void 0,g=a.toLowerCase()+(h&&`:${h}`),m=u||(b?"/":""),y=i||o?`${i}${o&&`:${o}`}@`:"";return{href:`${p}//${y}${g}${m}${c}${d}`,protocol:p,username:i,password:o,hostname:a.toLowerCase(),port:h,origin:b?`${p}//${g}`:"null",pathname:m,search:c==="?"?"":c,hash:d==="#"?"":d}}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:it(e)})}function it(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var ot=3e4,at=Ee*2,st="idempotency-key",ut=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),ct=/* @__PURE__ */Object.freeze({onEvent(){}}),dt=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function pt(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??ct,r=e.timers??dt,n=e.rng??Math.random,l=e.sleep??((e,t)=>_t(e,r,t)),i=e.maxAttempts??Me,o=e.unaryTimeoutMs??ot,a=e.newIdempotencyKey??ht(),s=e=>{try{t.onEvent(e)}catch{}};async function u(t,u,c){let d=c?.maxAttempts,p=Math.max(1,d??i),f=c?.idempotent??ut.has(u.method),h=c?.idempotencyKey===void 0?null:pt(c.idempotencyKey),b=f?h??a():null,g=ft(u,b),m=0;for(;;){let i=e=>/* @__PURE__ */Object.freeze({call:t,method:u.method,path:u.path,attempt:m,...b?{idempotencyKey:b}:{},...e});s(i({phase:"attempt"}));let a=Rt(o,r),c=Tt(a.signal,u.signal),f;try{f=await authedSend({...g,signal:c.signal},e.auth)}catch(e){f=err(networkError(e))}finally{c.dispose(),a.cancel()}if(f.ok)return s(i({phase:"settled",ok:true,reason:"ok"})),f;let h=f.error,y=gt(h,m,{maxAttempts:p,rng:n,now:r.now(),aborted:u.signal?.aborted===true,...d!==void 0?{perCallMaxAttempts:d}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),v={ok:false,code:h.code,reason:y.reason,...h.httpStatus!==void 0?{httpStatus:h.httpStatus}:{},...h.requestId!==void 0?{requestId:h.requestId}:{}};if(!y.retry)return s(i({phase:"settled",...v})),err(h);if(s(i({phase:"retry",...v,delayMs:y.delayMs})),await l(y.delayMs,u.signal),u.signal?.aborted===true)return s(i({phase:"settled",...v,reason:"aborted"})),err(h);m+=1}}async function c(t){return withAuthHeaders(t,await jt(e.auth))}async function*d(t,r,n){s(
9
9
  /* @__PURE__ */Object.freeze({call:t,phase:"stream.open",method:r.method,path:r.path,attempt:0}));try{yield*e.auth.transport.stream(r,n)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
@@ -17,338 +17,338 @@ return Object.freeze(n)}var Qr=5;function Zr(e,t){if(e===void 0)return false;if(
17
17
  return Object.freeze(a)}function Xr(e){return e.sender?.displayName??pe.senderVet}function en(petRef,conversationId){let e={};return petRef!==void 0&&(e.petRef=petRef),conversationId!==void 0&&(e.conversationId=conversationId),e}var tn=new RegExp([String.raw`\b(book|booking|schedule|scheduling|arrange|set\s+up)\s+(an?\s+|the\s+|her\s+|his\s+|their\s+|my\s+|your\s+)?(next\s+)?((vet|veterinary|video|virtual|televet|follow-up|follow up)\s+)?(visit|appointment|appt|consult|consultation|call|vet|checkup|check-up|exam)\b`,String.raw`\bmake\s+(an?\s+|the\s+)?((vet|veterinary|video|virtual|follow-up|follow up)\s+)?(appointment|appt)\b`,String.raw`\bneed\s+(an?\s+)?((vet|veterinary|video|virtual)\s+)?(appointment|appt|visit|consult|consultation)\b`,String.raw`\b(video|virtual)\s+(visit|appointment|appt|consult|consultation|call)s?\b`,String.raw`\b(televet|telehealth|telemedicine)\b`,String.raw`\b(talk|speak|chat)\s+(to|with)\s+(an?|the|your|my)\s+vet\b`,String.raw`\bsee\s+(an?|the|your|my)\s+vet\b`].join("|"),"i"),NONE=()=>true;function rn(e,t){if(e===void 0)return false;if(typeof e=="function")try{return e(t)===!0}catch{return false}return e.lastIndex=0,e.test(t)}function nn(e,t,r){let n=t.chatFollowUpsExcludeTelevet,l=e?.count!==void 0&&!r?e.count:t.chatFollowUpCount;if(e===void 0&&l===Gr&&!n)return;if(l<=0)return{...e??{},count:1,exclude:NONE,fill:[]};let i=e?.exclude,o=n?e=>tn.test(e)||rn(i,e):i;return{...e??{},count:l,...o!==void 0?{exclude:o}:{}}}function ln(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let r=e.charCodeAt(t+1);if(!(r>=56320&&r<=57343))return true;t+=1}else if(r>=56320&&r<=57343)return true}return false}function on(e){return[...e].length}var an=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(an,t)?an[t]:null}var sn=50,un=128,cn=120,dn=120,pn=2e3,fn=120,hn=80,bn=/* @__PURE__ */new Set(["male","female","unknown"]),gn=/* @__PURE__ */new Set(["day","month","year"]),mn=/* @__PURE__ */new Set(["low","medium","high","athletic"]),yn=/* @__PURE__ */new Set(["indoor","outdoor","both"]),vn=/* @__PURE__ */new Set(["mild","moderate","severe"]),xn=/^(\d{4})-(\d{2})-(\d{2})$/,wn=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],kn=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...wn,...kn].map(([e])=>e));function Sn(e){let t=xn.exec(e);if(t===null)return false;let[r,n,l]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(r,n-1,l));return i.getUTCFullYear()===r&&i.getUTCMonth()===n-1&&i.getUTCDate()===l}var Cn=e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,jn=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Rn=(e,t)=>typeof t=="string"&&Sn(t)?null:`${e} must be a real date written YYYY-MM-DD`,Tn=(e,t={})=>(r,n)=>{if(typeof n!="string")return`${r} must be a string`;if(ln(n))return`${r} contains an unpaired surrogate and cannot be encoded`;let l=t.trimmed?n.trim():n;if(t.required&&l.length===0)return`${r} is required and must not be blank`;let i=on(l);return i<=e?null:`${r} is ${i} characters; the server accepts at most ${e}`},_n={sex:Cn(bn),spayedNeutered:jn,birthDate:Rn,birthDatePrecision:Cn(gn),activityLevel:Cn(mn),indoorOutdoor:Cn(yn),foodBrand:Tn(fn),foodType:Tn(fn),microchipId:Tn(hn)},zn=["ref","ref",false,Tn(un,{required:true,trimmed:true})],In=["notes","notes",false,Tn(pn,{trimmed:true})],Pn=[zn,["name","name",true,Tn(cn,{required:true,trimmed:true})],["dose","dose",false,Tn(dn,{trimmed:true})],["frequency","frequency",false,Tn(dn,{trimmed:true})],["startDate","start_date",false,Rn],["endDate","end_date",false,Rn],In],En={allergies:[zn,["allergen","allergen",true,Tn(cn,{required:true,trimmed:true})],["severity","severity",false,Cn(vn)],In],medications:Pn,supplements:Pn,conditions:[zn,["conditionName","condition_name",true,Tn(cn,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Rn],In]};function Mn(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return{error:`${n} must be an object`};let l=r,i={};for(let[t,r,o,a]of En[e]){let e=l[t];if(e==null){if(o)return{error:`${n}.${t} is required`};e===null&&(i[r]=null);continue}let s=a(`${n}.${t}`,e);if(s!==null)return{error:s};i[r]=e}let o=i.start_date,a=i.end_date;return typeof o=="string"&&typeof a=="string"&&a<o?{error:`${n}.endDate must not be before startDate`}:{item:i}}function Fn(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>sn)return{error:`${e} has ${t.length} items; the server accepts at most ${sn}`};let r=[],n=/* @__PURE__ */new Set;for(let l=0;l<t.length;l+=1){let i=Mn(e,l,t[l]);if("error"in i)return i;let o=i.item.ref;if(typeof o=="string"){let t=o.trim();if(n.has(t))return{error:`${e}: ref ${JSON.stringify(t)} is used twice; a ref names one item`};n.add(t)}r.push(i.item)}return{items:r}}function An(e,t){let r=e,n={};for(let[e,t]of wn){let l=r[e];if(l!==void 0){if(l!==null){let t=_n[e](e,l);if(t!==null)return{error:t}}n[t]=l}}let l=r.birthDate!==void 0,i=r.birthDatePrecision!==void 0;if(l!==i||l&&r.birthDate===null!=(r.birthDatePrecision===null))return{error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[e,t]of kn){let l=r[e];if(l===void 0)continue;let i=Fn(e,l);if("error"in i)return i;n[t]=i.items}return Object.keys(n).length>0&&t!==void 0&&canonicalPetSpecies(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}var Ln=e=>typeof e=="string"?e:null,On=(e,t)=>typeof t=="string"&&e.has(t)?t:null,Vn=e=>typeof e=="boolean"?e:null;function Dn(e,t){return Array.isArray(e)?/* @__PURE__ */Object.freeze(e.flatMap(e=>{if(typeof e!="object"||e===null||Array.isArray(e))return[];let r=t(e);return r===null?[]:[r]})):/* @__PURE__ */Object.freeze([])}function Bn(e){let t=Ln(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:Ln(e.ref),name:t,dose:Ln(e.dose),frequency:Ln(e.frequency),startDate:Ln(e.start_date),endDate:Ln(e.end_date),notes:Ln(e.notes)})}function Hn(e){let t=e.profile_version;/* @__PURE__ */
18
18
  return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:On(bn,e.sex),spayedNeutered:Vn(e.spayed_neutered),birthDate:Ln(e.birth_date),birthDatePrecision:On(gn,e.birth_date_precision),activityLevel:On(mn,e.activity_level),indoorOutdoor:On(yn,e.indoor_outdoor),foodBrand:Ln(e.food_brand),foodType:Ln(e.food_type),microchipId:Ln(e.microchip_id),allergies:Dn(e.allergies,e=>{let t=Ln(e.allergen);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:Ln(e.ref),allergen:t,severity:On(vn,e.severity),notes:Ln(e.notes)})}),medications:Dn(e.medications,Bn),supplements:Dn(e.supplements,Bn),conditions:Dn(e.conditions,e=>{let t=Ln(e.condition_name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:Ln(e.ref),conditionName:t,diagnosedDate:Ln(e.diagnosed_date),notes:Ln(e.notes)})})})}var Wn=100,Nn=50,Un=100,$n=50,qn=500,Gn=128,Kn=6e4;function Yn(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function Qn(e,t,r){if(typeof t!="string")return Yn(`${e} must be a string`);let n=on(t);return n<=r?null:Yn(`${e} is ${n} characters; the server accepts at most ${r}`)}function Zn(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Yn(`${e} must be a finite number between 0 and ${r}`)}function Jn(petRef,e){if(typeof petRef!="string")return Yn("pet_ref must be a string");if(petRef.trim().length===0)return Yn("pet_ref must not be blank");if(ln(petRef))return Yn("pet_ref contains an unpaired surrogate and cannot be encoded");if(e!=null&&typeof e!="object")return Yn("profile must be an object");let t=[Qn("pet_ref",petRef,Gn)];return e?.name!==void 0&&t.push(Qn("name",e.name,Wn)),e?.species!==void 0&&t.push(Qn("species",e.species,Nn)),e?.breed!==void 0&&t.push(Qn("breed",e.breed,Un)),e?.ageYears!==void 0&&t.push(Zn("age_years",e.ageYears,$n)),e?.weightKg!==void 0&&t.push(Zn("weight_kg",e.weightKg,qn)),t.find(e=>e!==null)??null}function Xn(e,t){let r=An(e,t);return"error"in r?{error:Yn(r.error)}:r}function el(e){if(typeof e!="object"||e===null)return{error:Yn("patch must be an object")};let t=e,r=[["name","name",e=>Qn("name",e,Wn)],["species","species",e=>Qn("species",e,Nn)],["breed","breed",e=>Qn("breed",e,Un)],["ageYears","age_years",e=>Zn("age_years",e,$n)],["weightKg","weight_kg",e=>Zn("weight_kg",e,qn)]],n={};for(let[e,l,i]of r){let r=t[e];if(r!==void 0){if(r!==null){let e=i(r);if(e!==null)return{error:e}}n[l]=r}}let l=Xn(t,t.species);return"error"in l?l:(Object.assign(n,l.body),Object.keys(n).length===0?{error:Yn("patch must change at least one field")}:{body:n})}function tl(e){if(e==null)return{body:{}};let t=Xn(e,e.species);return"error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}var rl=e=>typeof e=="string"?e:null,nl=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function ll(e,petRef){let t=typeof e=="object"&&e!==null?e:{};/* @__PURE__ */
19
19
  return Object.freeze({petRef:rl(t.pet_ref)??petRef,name:rl(t.name),species:rl(t.species),breed:rl(t.breed),ageYears:nl(t.age_years),weightKg:nl(t.weight_kg)})}function widgetPetFromWire(e){if(typeof e!="object"||e===null)return null;let t=e,petRef=rl(t.pet_ref);return petRef===null||petRef.length===0?null:/* @__PURE__ */Object.freeze({petId:rl(t.pet_id),petRef:petRef,name:rl(t.name),species:rl(t.species),breed:rl(t.breed),ageYears:nl(t.age_years),weightKg:nl(t.weight_kg),updatedAt:rl(t.updated_at)})}function il(e){let t=widgetPetFromWire(e);return t===null?null:/* @__PURE__ */Object.freeze({...t,...Hn(e)})}function ol(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];/* @__PURE__ */
20
- return Object.freeze(t.flatMap(e=>{let t=widgetPetFromWire(e);return t===null?[]:[t]}))}function createPetsRepository(e){return al(createRequestFunnel({auth:e}),createRequestFunnel({auth:e,unaryTimeoutMs:Kn}))}function al(e,t=e){let r=(e,t)=>t?{...e,signal:t}:e,n=petRef=>Jn(petRef,void 0)??`/widget/v1/pets/${encodeURIComponent(petRef)}`;return{async list(t){let n=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},t?.signal));return n.ok?ok(ol(n.value)):err(n.error)},async registerPet(petRef,t,r){let n=Jn(petRef,t);if(n!==null)return err(n);let l=tl(t);if("error"in l)return err(l.error);let i={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:l.body},o=await e.send("pets.registerPet",r?.signal?{...i,signal:r.signal}:i);return o.ok?ok(ll(o.value,petRef)):err(o.error)},async updatePet(petRef,t,l){let i=n(petRef);if(typeof i!="string")return err(i);let o=el(t);if("error"in o)return err(o.error);let a=await e.send("pets.updatePet",r({method:"PATCH",path:i,body:o.body},l?.signal));return a.ok?ok(ll(a.value,petRef)):err(a.error)},async getPetProfile(petRef,t){let l=n(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.getPetProfile",r({method:"GET",path:`${l}/profile`},t?.signal));if(!i.ok)return err(i.error);let o=il(i.value);return o===null?err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):ok(o)},async deletePet(petRef,t){let l=n(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.deletePet",r({method:"DELETE",path:l},t?.signal));return i.ok?ok(void 0):err(i.error)},async eraseUserData(e){let n=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},e?.signal),{maxAttempts:1});return n.ok?ok(void 0):err(n.error)}}}var sl=/* @__PURE__ */new WeakMap,ul=/* @__PURE__ */new Map;function cl(e,t,petRef,r){let n=sl.get(e);if(n===void 0)return null;let l;if(t.mode==="personalized"&&typeof t.userRef=="string")l=`u:${t.userRef}`;else if(t.mode==="anonymous"&&typeof t.sessionId=="string")l=`a:${t.sessionId}|${t.userRef??""}`;else return null;return`${n}|${l}|${petRef}|${pl(r)}`}function dl(e,t){if(e===null)return t();let r=ul.get(e);if(r!==void 0)return r;let n=t().finally(()=>{ul.get(e)===n&&ul.delete(e)});return ul.set(e,n),n}function pl(e){return e===null||typeof e!="object"?JSON.stringify(e)??"undefined":Array.isArray(e)?`[${e.map(pl).join(",")}]`:`{${Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e<t?-1:e>t?1:0).map(([e,t])=>`${JSON.stringify(e)}:${pl(t)}`).join(",")}}`}var fl="pet_not_registered";function hl(e){return e!=null&&e.reasonCode===fl}var bl=/* @__PURE__ */Object.freeze({status:"idle",error:null,registered:null,retry:()=>{}});function gl(petRef,t,r){let{runtime:n,userRef:userRef,scopeEpoch:l}=we(),i=e.useCallback((e,t)=>{let r=n.registry.services.authFor(userRef);return dl(cl(n,r,e,t),()=>createPetsRepository(r).registerPet(e,t))},[n,userRef,l]),o=e.useMemo(()=>t===void 0?null:pl(t),[t]),[a,s]=e.useState({key:null,status:"idle",error:null,registered:null}),u=e.useRef(0),c=e.useRef(r);c.current=r;let d=petRef===null||o===null?null:`${String(userRef)}|${l}|${petRef}|${o}`,p=e.useCallback(()=>{if(petRef===null||t===void 0||d===null)return;let e=++u.current;s({key:d,status:"registering",error:null,registered:null}),i(petRef,t).then(t=>{e===u.current&&(t.ok?(s({key:d,status:"registered",error:null,registered:t.value}),c.current?.()):s({key:d,status:"failed",error:t.error,registered:null}))})},[i,petRef,d]);e.useEffect(()=>{if(d===null){u.current+=1;return}return p(),()=>{u.current+=1}},[d,p]);let f=e.useCallback(()=>{a.status==="failed"&&p()},[a.status,p]);return e.useMemo(()=>d===null?bl:a.key!==d?{status:"registering",error:null,registered:null,retry:f}:{status:a.status,error:a.error,registered:a.registered,retry:f},[d,a,f])}var ml=/* @__PURE__ */Object.freeze({});function yl(t){let[r,n]=e.useState(ml),l=e.useRef(null),i=e.useRef([]);i.current=t.map(e=>e.id),e.useEffect(()=>{if(t.length===0){l.current=null,n(e=>e===ml?e:ml);return}let e=l.current;if(e===null)return;let r=t.find(t=>t.role==="user"&&!e.known.has(t.id));r!==void 0&&(l.current=null,n(t=>({...t,[r.id]:e.images})))},[t]);let o=e.useCallback(e=>{l.current=e.length===0?null:{images:e,known:new Set(i.current)}},[]);return e.useMemo(()=>({byMessage:r,stage:o}),[r,o])}var vl=/* @__PURE__ */new WeakSet;function xl(){let e=makeEverfurError("internalError",{retryable:true});return vl.add(e),err(e)}function wl(e){if(typeof e!="object"||e===null||e.ok!==false)return false;let t=e.error;return typeof t=="object"&&t!==null&&vl.has(t)}var kl=500;function Sl(e){if(!e)return null;let t=e.replace(/[\u0000-\u001F\u007F-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g," ").replace(/\s+/g," ").trim();return t?t.slice(0,kl):null}function Cl(t,r,n,l){let i=Sl(n),o=i===null?null:l!==void 0?`key:${String(l)}`:`prompt:${i}`,a=e.useRef(t);a.current=t;let s=e.useRef(null),u=e.useRef(null),c=e.useRef(o);c.current=o,e.useEffect(()=>{if(i===null||o===null||r||s.current===o||u.current===o)return;let e=a.current;if(e===void 0)return;u.current=o;let t=e=>{u.current===o&&(u.current=null),!wl(e)&&c.current===o&&(s.current=o)};Promise.resolve(e(i)).then(t,()=>t(void 0))},[i,o,r,t])}function jl(e,conversationId,t){if(e==="announced")return false;let r=t.lastRefresh;return r===null||r.conversationId!==conversationId?false:t.now-r.at<15e3}function Rl(e,t){let conversationId=t.activeConversationId===null||t.activeConversationId.length===0?null:t.activeConversationId;return conversationId===null&&t.refreshesBlankThread!==true?{action:"skip",reason:"no_thread"}:t.isTurnInFlight?{action:"defer",reason:"turn_in_flight"}:t.isOffline?{action:"defer",reason:"offline"}:jl(e,conversationId,t)?{action:"skip",reason:"coalesced"}:{action:"refresh",conversationId:conversationId}}var Tl=/* @__PURE__ */Object.freeze({openUnreadHead:true,reportLoadFailures:true}),_l=/* @__PURE__ */Object.freeze({reportLoadFailures:true}),zl=3e5;function Il(e){if(e===null||typeof e!="object"||e.ok!==false)return false;let t=e.error;if(t===null||typeof t!="object")return false;if(t.category==="rateLimit"||t.category==="server")return true;let r=t.httpStatus;return typeof r=="number"&&(r===429||r>=500)}function Pl(t,r,n){let l=e.useRef(r);l.current=r;let i=e.useRef(null),o=e.useRef(null),a=e.useRef(false),s=e.useRef(0),u=e.useRef(0),c=e.useRef(3e4),d=()=>t?.isOffline===void 0?false:vr(()=>t.isOffline?.()===!0)===true,p=d(),f=e.useRef(()=>{});f.current=e=>{let{conversationId:conversationId,isTurnInFlight:t,refresh:r,refreshesBlankThread:n}=l.current,p=Rl(e,{activeConversationId:conversationId,isTurnInFlight:t,refreshesBlankThread:n===true,isOffline:d(),lastRefresh:i.current,now:Date.now()});if(p.action==="skip")return;if(p.action==="defer"){o.current!=="announced"&&(o.current=e);return}if(a.current){if(e==="poll")return;o.current!=="announced"&&(o.current=e);return}if(o.current=null,i.current={conversationId:p.conversationId,at:Date.now()},r===void 0)return;a.current=true;let h=e=>{a.current=false,Il(e)?(s.current=Math.min(s.current===0?c.current*2:s.current*2,zl),u.current=Date.now()+s.current):(s.current=0,u.current=0);let t=o.current;t!==null&&f.current(t)};Promise.resolve(r()).then(h,()=>h({ok:false,error:{category:"server"}}))},e.useEffect(()=>{if(r.isTurnInFlight||p)return;let e=o.current;e!==null&&f.current(e)},[r.isTurnInFlight,p]),e.useEffect(()=>{if(t===void 0)return;let e=[],r=(t,r)=>{if(t===void 0)return;let n=vr(()=>t(()=>{f.current(r)}));typeof n=="function"&&e.push(n)};return r(t.onForeground?.bind(t),"foreground"),r(t.onOnline?.bind(t),"foreground"),r(t.onAnnounced?.bind(t),"announced"),()=>{for(let t of e)vr(t)}},[t]);let h=n?.intervalMs??null,b=n?.isVisibleFallback;e.useEffect(()=>{if(t===void 0||h===null||!Number.isFinite(h)||h<=0)return;c.current=h;let e=setInterval(()=>{if(Date.now()<u.current)return;let e=t.isVisible===void 0?b:t.isVisible.bind(t);(e===void 0||vr(()=>e()!==!1)===true)&&f.current("poll")},h);return()=>clearInterval(e)},[t,h,b])}var El=/^efch_[A-Za-z0-9_-]{43}$/,Ml="efch";function Fl(e){return typeof e=="string"&&El.test(e)}function chatHandoffTokenFromUrl(e){if(typeof e!="string")return null;let t=e.indexOf("#");if(t<0)return null;for(let r of e.slice(t+1).split("&")){if(!r.startsWith(`${Ml}=`))continue;let e=r.slice(Ml.length+1);return Fl(e)?e:null}return null}var Al=/* @__PURE__ */Object.freeze(["better","same","worse"]),Ll=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var Ol="checkin",Vl=/^\d{4}-\d{2}-\d{2}$/,Dl="watching";function isCheckinSettled(e){return e.status!=null&&e.status!==Dl}function Bl(e){if(typeof e!="string")return null;let t=e.split(":");if(t.length!==3)return null;let[r,n,l]=t;return r!==Ol||n===void 0||l===void 0||!Ll.test(n)||!Vl.test(l)?null:{caseId:n,dueDay:l}}function Hl(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}function Wl(e,t,r){return makeEverfurError(e,{retryable:t,...{}})}var Nl=128,Ul=/[\u0000-\u001f\u007f]/;function $l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function ql(e){return typeof e!="string"||e.length===0||e.length>Nl||Ul.test(e)||e.includes("://")?null:e}function Gl(e){if(e===null)return null;let conversationId=e.conversation_id,petRef=ql(e.pet_ref);return typeof conversationId!="string"||!Hl(conversationId)||petRef===null?null:{conversationId:conversationId,petRef:petRef}}function Kl(e,t,r){return Fl(t)?createRequestFunnel({auth:e,...r?{errorPolicy:r}:{}}).send("chat.redeemHandoff",{method:"POST",path:"/widget/v1/chat/handoffs/redeem",body:{token:t}},{maxAttempts:1}).then(e=>e.ok?ok(Gl($l(e.value))):e.error.httpStatus===404?ok(null):err(e.error),()=>err(Wl("internalError",false))):Promise.resolve(ok(null))}function Yl(t,r){let n=r?.runtime??null,userRef=r?.userRef??null,l=Fl(t)?t:null,i=l===null||userRef===null?null:`${String(userRef)}|${l}`,[o,a]=e.useState(null);return e.useEffect(()=>{if(i===null||l===null||userRef===null||n===null)return;let e=true,t=n.registry.services;return Kl(t.authFor(userRef),l,t.errorPolicy).then(t=>{!e||!t.ok||t.value===null||a({key:i,target:/* @__PURE__ */Object.freeze({kind:"chat",conversationId:t.value.conversationId,petRef:t.value.petRef})})}),()=>{e=false}},[i,n,l,userRef]),o!==null&&o.key===i?o.target:void 0}function Ql(e){if(e===void 0)return null;let conversationId=e.conversationId??"",petRef=e.petRef??"";return conversationId===""&&petRef===""?null:`${String(conversationId)}|${String(petRef)}`}function Zl(t,r,n){let l=Ql(r),i=r?.kind==="chat",o=r?.petRef??null,a=i&&!n.pinned&&o!==null&&n.petRef!==null&&o!==n.petRef,s=e.useRef({openCheckin:t,target:r,selectPet:n.selectPet});s.current={openCheckin:t,target:r,selectPet:n.selectPet};let u=e.useRef(null),c=e.useRef(null),petRef=n.petRef;e.useEffect(()=>{if(l===null||u.current===l)return;let{openCheckin:e,target:t,selectPet:r}=s.current;if(a&&o!==null){if(c.current?.key!==l){c.current={key:l,from:petRef},r(o);return}petRef!==c.current.from&&(u.current=l);return}i&&!n.ready||(u.current=l,!(e===void 0||t===void 0)&&Promise.resolve(e(t)).catch(()=>{}))},[l,i,a,o,petRef,n.ready])}var Jl=/* @__PURE__ */Object.freeze({heading:"Chats",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No chats match that.",loading:"Loading your chats…",loadFailed:"Couldn’t load your chats",loadingMore:"Loading more…",untitled:"New conversation",newChat:"New chat",searchPlaceholder:"Search chats…",search:"Search chats",countLabel:"Chats and vet messages",countSeparator:" · ",newReply:"New reply · {date}",retry:"Try again",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages…",openConversation:"Open conversation",unreadPrefix:"Unread. "});function Xl(e){let t=e?.replace(/\s+/g," ").trim();return t||Jl.untitled}function ei(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString([],{month:"short",day:"numeric"})}function ti(e){let t=ei(e.updatedAt);return t===null?null:e.unreadCount!==null&&e.unreadCount>0?Jl.newReply.replace("{date}",t):t}function ri(e,t){return t?`${Jl.countLabel}${Jl.countSeparator}${e}`:Jl.countLabel}function ni(e){return`${e.unreadCount!==null&&e.unreadCount>0?Jl.unreadPrefix:""}${Jl.openConversation} ${Xl(e.title)}`}function li(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').toLowerCase().trim().replace(/\s+/g," ")}function ii(e,t){let r=li(t);if(r.length===0)return e;let n=[[],[],[]];for(let t of e){let e=li(Xl(t.title)),l=e.indexOf(r);if(l<0)continue;let i=l===0?0:e.charAt(l-1)===" "?1:2;n[i]?.push(t)}return n.flat()}function oi(e){return{scope:e,rows:[],cursor:null,loading:false,loadingMore:false,error:null}}function ai(t){let[r,n]=e.useState(false),[l,i]=e.useState(""),o=t.listConversations,a=e.useRef(0),[s,u]=e.useState(()=>oi(o)),c=s.scope===o?s:oi(o);e.useEffect(()=>(a.current+=1,n(false),i(""),u(oi(o)),()=>{a.current+=1}),[o]);let d=e.useCallback(async e=>{let r=++a.current,n=e!==void 0;u(e=>({...e,scope:o,loading:!n,loadingMore:n,error:null}));let l=await t.listConversations(e?{cursor:e}:void 0);if(r===a.current){if(!l.ok){u(e=>({...e,loading:false,loadingMore:false,error:l.error.displayMessage}));return}u(t=>{let r=e&&t.scope===o?t.rows:[],n=new Set(r.map(e=>e.id));return{scope:o,loading:false,loadingMore:false,error:null,rows:[...r,...l.value.conversations.filter(e=>!n.has(e.id))],cursor:l.value.nextCursor===e?null:l.value.nextCursor}})}},[t.listConversations,o]),p=()=>{n(true),i(""),d()},f=()=>{a.current+=1,n(false)},h=async e=>{let r=++a.current;u(e=>({...e,loading:true,error:null}));let l=await t.resumeConversation(e);r===a.current&&(u(e=>({...e,loading:false,error:l.ok?null:l.error.displayMessage})),l.ok&&n(false))},b=async()=>{let e=a.current,r=await t.loadOlderMessages();e===a.current&&!r.ok&&u(e=>({...e,error:r.error.displayMessage}))},g=()=>{t.newConversation(),a.current+=1,n(false)},m=()=>{c.cursor===null||c.loading||c.loadingMore||l.trim().length>0||d(c.cursor)},y=e.useMemo(()=>ii(c.rows,l),[c.rows,l]),v=l.trim().length>0;return{...c,open:r,show:p,close:f,load:d,resume:h,earlier:b,newConversation:g,loadMore:m,query:l,setQuery:i,searching:v,filtered:y,emptyKind:c.rows.length===0?"empty":"noMatch"}}var si="#111111",ui="#FFFFFF",ci=/* @__PURE__ */Object.freeze({emergency:/* @__PURE__ */Object.freeze({level:"emergency",label:"Call a vet now",borderColor:"#FCA5A5",backgroundColor:"#FEF2F2",textColor:"#991B1B",reasonColor:si,pillColor:ui,showsVetAction:true}),schedule_soon:/* @__PURE__ */Object.freeze({level:"schedule_soon",label:"Vet care suggested soon",borderColor:"#FCD34D",backgroundColor:"#FFFBEB",textColor:"#92400E",reasonColor:si,pillColor:ui,showsVetAction:true}),home_care:/* @__PURE__ */Object.freeze({level:"home_care",label:"Monitor at home",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:si,pillColor:ui,showsVetAction:false}),general:/* @__PURE__ */Object.freeze({level:"general",label:"Good to know",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:si,pillColor:ui,showsVetAction:false})});function di(e){return`${e.messageId}:${e.level}:${e.reason??""}`}function pi(e){return fe(pe.urgencyGeneralReason,{petName:e?.trim()||pe.emptyTitlePetFallback})}function fi(e,t){for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(n?.role!=="assistant"||n.responseId===void 0)continue;let l=n.urgencyLevel;return l?{messageId:n.id,level:l,reason:hi(n.urgencyReason)}:n.urgencyProvided===true?{messageId:n.id,level:"general",reason:pi(t)}:null}return null}function hi(e){return typeof e=="string"&&e.trim().length>0?e:null}function bi(t){let r=t===null?null:di(t),[n,l]=e.useState(null),[i,o]=e.useState(false);e.useEffect(()=>o(false),[r]);let a=t!==null&&(i||!(n!==null&&n===r)),s=t===null?null:ci[t.level],u=t!==null&&!a&&t.level!=="general",c=e.useCallback(()=>{r!==null&&l(r),o(false)},[r]),d=e.useCallback(()=>o(true),[]);return e.useMemo(()=>({source:t,tier:s,signature:r,showBanner:a,showCompactIcon:u,showVetAction:a&&s!==null&&s.showsVetAction,dismissLabel:s===null?null:fe(pe.dismissBanner,{label:s.label}),dismiss:c,expand:d}),[t,s,r,a,u,c,d])}var gi=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:r,resetKey:n}){return e.createElement(gi,{fallback:r,resetKey:n,children:e.createElement(RenderHost,{render:t})})}var mi=48;function yi(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(r){let{capability:n,children:l,renderDisabled:i,renderPending:o,style:a}=r,s=useCapability(n),u=e.useMemo(()=>yi(s),[s]);switch(u){case"enabled":return l;case"pending":return o?/* @__PURE__ */t.jsx(HostRender,{render:o,fallback:/* @__PURE__ */t.jsx(PendingSkeleton,{capability:n,style:a})}):/* @__PURE__ */t.jsx(PendingSkeleton,{capability:n,style:a});case"disabled":return i?/* @__PURE__ */t.jsx(HostRender,{render:()=>i(s),fallback:/* @__PURE__ */t.jsx(OffState,{decision:s,style:a}),resetKey:s}):/* @__PURE__ */t.jsx(OffState,{decision:s,style:a});default:return assertNever(u)}}function PendingSkeleton({capability:r,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>vi(i),[i]);/* @__PURE__ */
21
- return t.jsx(n.View,{style:[o.offstate,l],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${r}`,children:/* @__PURE__ */t.jsx(n.View,{style:o.skeletonBar})})}function OffState({decision:r,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>vi(i),[i]),a=r.disabled?.reason??"";/* @__PURE__ */
22
- return t.jsx(n.View,{style:[o.offstate,l],accessible:true,accessibilityRole:"text",accessibilityLabel:a,children:a.length>0?/* @__PURE__ */t.jsx(Text,{style:o.offstateText,children:a}):null})}function vi(e){let{color:t,space:r,radius:l,type:i}=e;return n.StyleSheet.create({offstate:{minHeight:mi,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:l.md,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:l.xs,backgroundColor:t.brandSofter}})}var xi="everfur.com",wi=2048,ki=/^(\*\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;function Si(e){if(!Array.isArray(e))return[];let t=/* @__PURE__ */new Set;for(let r of e){if(typeof r!="string")continue;let e=r.trim().toLowerCase();e.length<=253&&ki.test(e)&&t.add(e)}/* @__PURE__ */
23
- return Object.freeze([...t])}function Ci(e,t){if(e===xi||e.endsWith(`.${xi}`))return true;for(let r of t)if(r.startsWith("*.")?e.endsWith(r.slice(1)):e===r)return true;return false}function ji(e,t){if(typeof e!="string"||e.length===0||e.length>wi||!/^https:\/\//i.test(e))return null;let r=et(e);return r===null||r.protocol!=="https:"||r.username!==""||r.password!==""||r.port!==""?null:Ci(r.hostname,t)?r.href:null}function Ri(e){try{Promise.resolve(n.Linking.openURL(e)).catch(()=>{})}catch{}}var Ti=e.createContext(null);function _i(){return e.useContext(Ti)??void 0}function MessageLinksScope({linkHosts:t,onOpenUrl:r,children:n}){let l=t===false?null:Array.isArray(t)?t.join(`\n`):"",i=e.useMemo(()=>{if(l===null)return null;let e=Si(l===""?[]:l.split(`\n`));/* @__PURE__ */
24
- return Object.freeze({hosts:e,open:r!==void 0?e=>{vr(r,e,"message")}:Ri})},[l,r]);return e.createElement(Ti.Provider,{value:i},n)}var zi={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function Ii(e){return{width:e,height:e,alignItems:"center",justifyContent:"center"}}function Pi(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}function MenuGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l),o={width:e*.82,height:i,borderRadius:i,backgroundColor:r};/* @__PURE__ */
25
- return t.jsxs(n.View,{style:[Ii(e),{gap:e*.22}],...zi,children:[
20
+ return Object.freeze(t.flatMap(e=>{let t=widgetPetFromWire(e);return t===null?[]:[t]}))}function createPetsRepository(e){return al(createRequestFunnel({auth:e}),createRequestFunnel({auth:e,unaryTimeoutMs:Kn}))}function al(e,t=e){let r=(e,t)=>t?{...e,signal:t}:e,n=petRef=>Jn(petRef,void 0)??`/widget/v1/pets/${encodeURIComponent(petRef)}`;return{async list(t){let n=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},t?.signal));return n.ok?ok(ol(n.value)):err(n.error)},async registerPet(petRef,t,r){let n=Jn(petRef,t);if(n!==null)return err(n);let l=tl(t);if("error"in l)return err(l.error);let i={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:l.body},o=await e.send("pets.registerPet",r?.signal?{...i,signal:r.signal}:i);return o.ok?ok(ll(o.value,petRef)):err(o.error)},async updatePet(petRef,t,l){let i=n(petRef);if(typeof i!="string")return err(i);let o=el(t);if("error"in o)return err(o.error);let a=await e.send("pets.updatePet",r({method:"PATCH",path:i,body:o.body},l?.signal));return a.ok?ok(ll(a.value,petRef)):err(a.error)},async getPetProfile(petRef,t){let l=n(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.getPetProfile",r({method:"GET",path:`${l}/profile`},t?.signal));if(!i.ok)return err(i.error);let o=il(i.value);return o===null?err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):ok(o)},async deletePet(petRef,t){let l=n(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.deletePet",r({method:"DELETE",path:l},t?.signal));return i.ok?ok(void 0):err(i.error)},async eraseUserData(e){let n=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},e?.signal),{maxAttempts:1});return n.ok?ok(void 0):err(n.error)}}}var sl=/* @__PURE__ */new WeakMap,ul=/* @__PURE__ */new Map;function cl(e,t,petRef,r){let n=sl.get(e);if(n===void 0)return null;let l;if(t.mode==="personalized"&&typeof t.userRef=="string")l=`u:${t.userRef}`;else if(t.mode==="anonymous"&&typeof t.sessionId=="string")l=`a:${t.sessionId}|${t.userRef??""}`;else return null;return`${n}|${l}|${petRef}|${pl(r)}`}function dl(e,t){if(e===null)return t();let r=ul.get(e);if(r!==void 0)return r;let n=t().finally(()=>{ul.get(e)===n&&ul.delete(e)});return ul.set(e,n),n}function pl(e){return e===null||typeof e!="object"?JSON.stringify(e)??"undefined":Array.isArray(e)?`[${e.map(pl).join(",")}]`:`{${Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e<t?-1:e>t?1:0).map(([e,t])=>`${JSON.stringify(e)}:${pl(t)}`).join(",")}}`}var fl="pet_not_registered";function hl(e){return e!=null&&e.reasonCode===fl}var bl=/* @__PURE__ */Object.freeze({status:"idle",error:null,registered:null,retry:()=>{}});function gl(petRef,t,r){let{runtime:n,userRef:userRef,scopeEpoch:l}=we(),i=e.useCallback((e,t)=>{let r=n.registry.services.authFor(userRef);return dl(cl(n,r,e,t),()=>createPetsRepository(r).registerPet(e,t))},[n,userRef,l]),o=e.useMemo(()=>t===void 0?null:pl(t),[t]),[a,s]=e.useState({key:null,status:"idle",error:null,registered:null}),u=e.useRef(0),c=e.useRef(r);c.current=r;let d=petRef===null||o===null?null:`${String(userRef)}|${l}|${petRef}|${o}`,p=e.useCallback(()=>{if(petRef===null||t===void 0||d===null)return;let e=++u.current;s({key:d,status:"registering",error:null,registered:null}),i(petRef,t).then(t=>{e===u.current&&(t.ok?(s({key:d,status:"registered",error:null,registered:t.value}),c.current?.()):s({key:d,status:"failed",error:t.error,registered:null}))})},[i,petRef,d]);e.useEffect(()=>{if(d===null){u.current+=1;return}return p(),()=>{u.current+=1}},[d,p]);let f=e.useCallback(()=>{a.status==="failed"&&p()},[a.status,p]);return e.useMemo(()=>d===null?bl:a.key!==d?{status:"registering",error:null,registered:null,retry:f}:{status:a.status,error:a.error,registered:a.registered,retry:f},[d,a,f])}var ml=/* @__PURE__ */Object.freeze({});function yl(t){let[r,n]=e.useState(ml),l=e.useRef(null),i=e.useRef([]);i.current=t.map(e=>e.id),e.useEffect(()=>{if(t.length===0){l.current=null,n(e=>e===ml?e:ml);return}let e=l.current;if(e===null)return;let r=t.find(t=>t.role==="user"&&!e.known.has(t.id));r!==void 0&&(l.current=null,n(t=>({...t,[r.id]:e.images})))},[t]);let o=e.useCallback(e=>{l.current=e.length===0?null:{images:e,known:new Set(i.current)}},[]);return e.useMemo(()=>({byMessage:r,stage:o}),[r,o])}var vl=/* @__PURE__ */new WeakSet;function xl(){let e=makeEverfurError("internalError",{retryable:true});return vl.add(e),err(e)}function wl(e){if(typeof e!="object"||e===null||e.ok!==false)return false;let t=e.error;return typeof t=="object"&&t!==null&&vl.has(t)}var kl=500;function Sl(e){if(!e)return null;let t=e.replace(/[\u0000-\u001F\u007F-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g," ").replace(/\s+/g," ").trim();return t?t.slice(0,kl):null}function Cl(t,r,n,l){let i=Sl(n),o=i===null?null:l!==void 0?`key:${String(l)}`:`prompt:${i}`,a=e.useRef(t);a.current=t;let s=e.useRef(null),u=e.useRef(null),c=e.useRef(o);c.current=o,e.useEffect(()=>{if(i===null||o===null||r||s.current===o||u.current===o)return;let e=a.current;if(e===void 0)return;u.current=o;let t=e=>{u.current===o&&(u.current=null),!wl(e)&&c.current===o&&(s.current=o)};Promise.resolve(e(i)).then(t,()=>t(void 0))},[i,o,r,t])}var jl=/* @__PURE__ */Object.freeze({openUnreadHead:true,reportLoadFailures:true}),Rl=/* @__PURE__ */Object.freeze({reportLoadFailures:true}),Tl=/* @__PURE__ */Object.freeze({...jl,markRead:true}),_l=/* @__PURE__ */Object.freeze({...Rl,markRead:true});function zl(e,t){return e?t?Tl:jl:t?_l:Rl}function Il(e,t){let r=e?.isVisible===void 0?t:e.isVisible.bind(e);return r===void 0?true:vr(()=>r()!==!1)===true}function Pl(t,r){let n=e.useRef({target:t,isVisible:r});n.current={target:t,isVisible:r};let l=e.useRef(t.isStreaming);e.useEffect(()=>{let e=l.current;if(l.current=t.isStreaming,!e||t.isStreaming)return;let{target:r,isVisible:i}=n.current;r.status!=="complete"||r.conversationId===null||r.unreadCount===null||!i()||r.markRead()},[t.isStreaming])}function El(e,conversationId,t){if(e==="announced")return false;let r=t.lastRefresh;return r===null||r.conversationId!==conversationId?false:t.now-r.at<15e3}function Ml(e,t){let conversationId=t.activeConversationId===null||t.activeConversationId.length===0?null:t.activeConversationId;return conversationId===null&&t.refreshesBlankThread!==true?{action:"skip",reason:"no_thread"}:t.isTurnInFlight?{action:"defer",reason:"turn_in_flight"}:t.isOffline?{action:"defer",reason:"offline"}:El(e,conversationId,t)?{action:"skip",reason:"coalesced"}:{action:"refresh",conversationId:conversationId}}var Fl=3e5;function Al(e){if(e===null||typeof e!="object"||e.ok!==false)return false;let t=e.error;if(t===null||typeof t!="object")return false;if(t.category==="rateLimit"||t.category==="server")return true;let r=t.httpStatus;return typeof r=="number"&&(r===429||r>=500)}function Ll(t,r,n){let l=e.useRef(r);l.current=r;let i=e.useRef(null),o=e.useRef(null),a=e.useRef(false),s=e.useRef(0),u=e.useRef(0),c=e.useRef(3e4),d=()=>t?.isOffline===void 0?false:vr(()=>t.isOffline?.()===!0)===true,p=d(),f=e.useRef(()=>{});f.current=e=>{let{conversationId:conversationId,isTurnInFlight:t,refresh:r,refreshesBlankThread:n}=l.current,p=Ml(e,{activeConversationId:conversationId,isTurnInFlight:t,refreshesBlankThread:n===true,isOffline:d(),lastRefresh:i.current,now:Date.now()});if(p.action==="skip")return;if(p.action==="defer"){o.current!=="announced"&&(o.current=e);return}if(a.current){if(e==="poll")return;o.current!=="announced"&&(o.current=e);return}if(o.current=null,i.current={conversationId:p.conversationId,at:Date.now()},r===void 0)return;a.current=true;let h=e=>{a.current=false,Al(e)?(s.current=Math.min(s.current===0?c.current*2:s.current*2,Fl),u.current=Date.now()+s.current):(s.current=0,u.current=0);let t=o.current;t!==null&&f.current(t)};Promise.resolve(r()).then(h,()=>h({ok:false,error:{category:"server"}}))},e.useEffect(()=>{if(r.isTurnInFlight||p)return;let e=o.current;e!==null&&f.current(e)},[r.isTurnInFlight,p]),e.useEffect(()=>{if(t===void 0)return;let e=[],r=(t,r)=>{if(t===void 0)return;let n=vr(()=>t(()=>{f.current(r)}));typeof n=="function"&&e.push(n)};return r(t.onForeground?.bind(t),"foreground"),r(t.onOnline?.bind(t),"foreground"),r(t.onAnnounced?.bind(t),"announced"),()=>{for(let t of e)vr(t)}},[t]);let h=n?.intervalMs??null,b=n?.isVisibleFallback;e.useEffect(()=>{if(t===void 0||h===null||!Number.isFinite(h)||h<=0)return;c.current=h;let e=setInterval(()=>{Date.now()<u.current||Il(t,b)&&f.current("poll")},h);return()=>clearInterval(e)},[t,h,b])}var Ol=/^efch_[A-Za-z0-9_-]{43}$/,Vl="efch";function Dl(e){return typeof e=="string"&&Ol.test(e)}function chatHandoffTokenFromUrl(e){if(typeof e!="string")return null;let t=e.indexOf("#");if(t<0)return null;for(let r of e.slice(t+1).split("&")){if(!r.startsWith(`${Vl}=`))continue;let e=r.slice(Vl.length+1);return Dl(e)?e:null}return null}var Bl=/* @__PURE__ */Object.freeze(["better","same","worse"]),Hl=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var Wl="checkin",Nl=/^\d{4}-\d{2}-\d{2}$/,Ul="watching";function isCheckinSettled(e){return e.status!=null&&e.status!==Ul}function $l(e){if(typeof e!="string")return null;let t=e.split(":");if(t.length!==3)return null;let[r,n,l]=t;return r!==Wl||n===void 0||l===void 0||!Hl.test(n)||!Nl.test(l)?null:{caseId:n,dueDay:l}}function ql(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}function Gl(e,t,r){return makeEverfurError(e,{retryable:t,...{}})}var Kl=128,Yl=/[\u0000-\u001f\u007f]/;function Ql(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function Zl(e){return typeof e!="string"||e.length===0||e.length>Kl||Yl.test(e)||e.includes("://")?null:e}function Jl(e){if(e===null)return null;let conversationId=e.conversation_id,petRef=Zl(e.pet_ref);return typeof conversationId!="string"||!ql(conversationId)||petRef===null?null:{conversationId:conversationId,petRef:petRef}}function Xl(e,t,r){return Dl(t)?createRequestFunnel({auth:e,...r?{errorPolicy:r}:{}}).send("chat.redeemHandoff",{method:"POST",path:"/widget/v1/chat/handoffs/redeem",body:{token:t}},{maxAttempts:1}).then(e=>e.ok?ok(Jl(Ql(e.value))):e.error.httpStatus===404?ok(null):err(e.error),()=>err(Gl("internalError",false))):Promise.resolve(ok(null))}function ei(t,r){let n=r?.runtime??null,userRef=r?.userRef??null,l=Dl(t)?t:null,i=l===null||userRef===null?null:`${String(userRef)}|${l}`,[o,a]=e.useState(null);return e.useEffect(()=>{if(i===null||l===null||userRef===null||n===null)return;let e=true,t=n.registry.services;return Xl(t.authFor(userRef),l,t.errorPolicy).then(t=>{!e||!t.ok||t.value===null||a({key:i,target:/* @__PURE__ */Object.freeze({kind:"chat",conversationId:t.value.conversationId,petRef:t.value.petRef})})}),()=>{e=false}},[i,n,l,userRef]),o!==null&&o.key===i?o.target:void 0}function ti(e){if(e===void 0)return null;let conversationId=e.conversationId??"",petRef=e.petRef??"";return conversationId===""&&petRef===""?null:`${String(conversationId)}|${String(petRef)}`}function ri(t,r,n){let l=ti(r),i=r?.kind==="chat",o=r?.petRef??null,a=i&&!n.pinned&&o!==null&&n.petRef!==null&&o!==n.petRef,s=e.useRef({openCheckin:t,target:r,selectPet:n.selectPet});s.current={openCheckin:t,target:r,selectPet:n.selectPet};let u=e.useRef(null),c=e.useRef(null),petRef=n.petRef;e.useEffect(()=>{if(l===null||u.current===l)return;let{openCheckin:e,target:t,selectPet:r}=s.current;if(a&&o!==null){if(c.current?.key!==l){c.current={key:l,from:petRef},r(o);return}petRef!==c.current.from&&(u.current=l);return}i&&!n.ready||(u.current=l,!(e===void 0||t===void 0)&&Promise.resolve(e(t)).catch(()=>{}))},[l,i,a,o,petRef,n.ready])}var ni=/* @__PURE__ */Object.freeze({heading:"Chats",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No chats match that.",loading:"Loading your chats…",loadFailed:"Couldn’t load your chats",loadingMore:"Loading more…",untitled:"New conversation",newChat:"New chat",searchPlaceholder:"Search chats…",search:"Search chats",countLabel:"Chats and vet messages",countSeparator:" · ",newReply:"New reply · {date}",retry:"Try again",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages…",openConversation:"Open conversation",unreadPrefix:"Unread. "});function li(e){let t=e?.replace(/\s+/g," ").trim();return t||ni.untitled}function ii(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString([],{month:"short",day:"numeric"})}function oi(e){let t=ii(e.updatedAt);return t===null?null:e.unreadCount!==null&&e.unreadCount>0?ni.newReply.replace("{date}",t):t}function ai(e,t){return t?`${ni.countLabel}${ni.countSeparator}${e}`:ni.countLabel}function si(e){return`${e.unreadCount!==null&&e.unreadCount>0?ni.unreadPrefix:""}${ni.openConversation} ${li(e.title)}`}function ui(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').toLowerCase().trim().replace(/\s+/g," ")}function ci(e,t){let r=ui(t);if(r.length===0)return e;let n=[[],[],[]];for(let t of e){let e=ui(li(t.title)),l=e.indexOf(r);if(l<0)continue;let i=l===0?0:e.charAt(l-1)===" "?1:2;n[i]?.push(t)}return n.flat()}function di(e){return{scope:e,rows:[],cursor:null,loading:false,loadingMore:false,error:null}}function pi(t){let[r,n]=e.useState(false),[l,i]=e.useState(""),o=t.listConversations,a=e.useRef(0),[s,u]=e.useState(()=>di(o)),c=s.scope===o?s:di(o);e.useEffect(()=>(a.current+=1,n(false),i(""),u(di(o)),()=>{a.current+=1}),[o]);let d=e.useCallback(async e=>{let r=++a.current,n=e!==void 0;u(e=>({...e,scope:o,loading:!n,loadingMore:n,error:null}));let l=await t.listConversations(e?{cursor:e}:void 0);if(r===a.current){if(!l.ok){u(e=>({...e,loading:false,loadingMore:false,error:l.error.displayMessage}));return}u(t=>{let r=e&&t.scope===o?t.rows:[],n=new Set(r.map(e=>e.id));return{scope:o,loading:false,loadingMore:false,error:null,rows:[...r,...l.value.conversations.filter(e=>!n.has(e.id))],cursor:l.value.nextCursor===e?null:l.value.nextCursor}})}},[t.listConversations,o]),p=()=>{n(true),i(""),d()},f=()=>{a.current+=1,n(false)},h=async e=>{let r=++a.current;u(e=>({...e,loading:true,error:null}));let l=await t.resumeConversation(e);r===a.current&&(u(e=>({...e,loading:false,error:l.ok?null:l.error.displayMessage})),l.ok&&n(false))},b=async()=>{let e=a.current,r=await t.loadOlderMessages();e===a.current&&!r.ok&&u(e=>({...e,error:r.error.displayMessage}))},g=()=>{t.newConversation(),a.current+=1,n(false)},m=()=>{c.cursor===null||c.loading||c.loadingMore||l.trim().length>0||d(c.cursor)},y=e.useMemo(()=>ci(c.rows,l),[c.rows,l]),v=l.trim().length>0;return{...c,open:r,show:p,close:f,load:d,resume:h,earlier:b,newConversation:g,loadMore:m,query:l,setQuery:i,searching:v,filtered:y,emptyKind:c.rows.length===0?"empty":"noMatch"}}var fi="#111111",hi="#FFFFFF",bi=/* @__PURE__ */Object.freeze({emergency:/* @__PURE__ */Object.freeze({level:"emergency",label:"Call a vet now",borderColor:"#FCA5A5",backgroundColor:"#FEF2F2",textColor:"#991B1B",reasonColor:fi,pillColor:hi,showsVetAction:true}),schedule_soon:/* @__PURE__ */Object.freeze({level:"schedule_soon",label:"Vet care suggested soon",borderColor:"#FCD34D",backgroundColor:"#FFFBEB",textColor:"#92400E",reasonColor:fi,pillColor:hi,showsVetAction:true}),home_care:/* @__PURE__ */Object.freeze({level:"home_care",label:"Monitor at home",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:fi,pillColor:hi,showsVetAction:false}),general:/* @__PURE__ */Object.freeze({level:"general",label:"Good to know",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:fi,pillColor:hi,showsVetAction:false})});function gi(e){return`${e.messageId}:${e.level}:${e.reason??""}`}function mi(e){return fe(pe.urgencyGeneralReason,{petName:e?.trim()||pe.emptyTitlePetFallback})}function yi(e,t){for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(n?.role!=="assistant"||n.responseId===void 0)continue;let l=n.urgencyLevel;return l?{messageId:n.id,level:l,reason:vi(n.urgencyReason)}:n.urgencyProvided===true?{messageId:n.id,level:"general",reason:mi(t)}:null}return null}function vi(e){return typeof e=="string"&&e.trim().length>0?e:null}function xi(t){let r=t===null?null:gi(t),[n,l]=e.useState(null),[i,o]=e.useState(false);e.useEffect(()=>o(false),[r]);let a=t!==null&&(i||!(n!==null&&n===r)),s=t===null?null:bi[t.level],u=t!==null&&!a&&t.level!=="general",c=e.useCallback(()=>{r!==null&&l(r),o(false)},[r]),d=e.useCallback(()=>o(true),[]);return e.useMemo(()=>({source:t,tier:s,signature:r,showBanner:a,showCompactIcon:u,showVetAction:a&&s!==null&&s.showsVetAction,dismissLabel:s===null?null:fe(pe.dismissBanner,{label:s.label}),dismiss:c,expand:d}),[t,s,r,a,u,c,d])}var wi=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:r,resetKey:n}){return e.createElement(wi,{fallback:r,resetKey:n,children:e.createElement(RenderHost,{render:t})})}var ki=48;function Si(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(r){let{capability:n,children:l,renderDisabled:i,renderPending:o,style:a}=r,s=useCapability(n),u=e.useMemo(()=>Si(s),[s]);switch(u){case"enabled":return l;case"pending":return o?/* @__PURE__ */t.jsx(HostRender,{render:o,fallback:/* @__PURE__ */t.jsx(PendingSkeleton,{capability:n,style:a})}):/* @__PURE__ */t.jsx(PendingSkeleton,{capability:n,style:a});case"disabled":return i?/* @__PURE__ */t.jsx(HostRender,{render:()=>i(s),fallback:/* @__PURE__ */t.jsx(OffState,{decision:s,style:a}),resetKey:s}):/* @__PURE__ */t.jsx(OffState,{decision:s,style:a});default:return assertNever(u)}}function PendingSkeleton({capability:r,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Ci(i),[i]);/* @__PURE__ */
21
+ return t.jsx(n.View,{style:[o.offstate,l],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${r}`,children:/* @__PURE__ */t.jsx(n.View,{style:o.skeletonBar})})}function OffState({decision:r,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Ci(i),[i]),a=r.disabled?.reason??"";/* @__PURE__ */
22
+ return t.jsx(n.View,{style:[o.offstate,l],accessible:true,accessibilityRole:"text",accessibilityLabel:a,children:a.length>0?/* @__PURE__ */t.jsx(Text,{style:o.offstateText,children:a}):null})}function Ci(e){let{color:t,space:r,radius:l,type:i}=e;return n.StyleSheet.create({offstate:{minHeight:ki,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:l.md,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:l.xs,backgroundColor:t.brandSofter}})}var ji="everfur.com",Ri=2048,Ti=/^(\*\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;function _i(e){if(!Array.isArray(e))return[];let t=/* @__PURE__ */new Set;for(let r of e){if(typeof r!="string")continue;let e=r.trim().toLowerCase();e.length<=253&&Ti.test(e)&&t.add(e)}/* @__PURE__ */
23
+ return Object.freeze([...t])}function zi(e,t){if(e===ji||e.endsWith(`.${ji}`))return true;for(let r of t)if(r.startsWith("*.")?e.endsWith(r.slice(1)):e===r)return true;return false}function Ii(e,t){if(typeof e!="string"||e.length===0||e.length>Ri||!/^https:\/\//i.test(e))return null;let r=et(e);return r===null||r.protocol!=="https:"||r.username!==""||r.password!==""||r.port!==""?null:zi(r.hostname,t)?r.href:null}function Pi(e){try{Promise.resolve(n.Linking.openURL(e)).catch(()=>{})}catch{}}var Ei=e.createContext(null);function Mi(){return e.useContext(Ei)??void 0}function MessageLinksScope({linkHosts:t,onOpenUrl:r,children:n}){let l=t===false?null:Array.isArray(t)?t.join(`\n`):"",i=e.useMemo(()=>{if(l===null)return null;let e=_i(l===""?[]:l.split(`\n`));/* @__PURE__ */
24
+ return Object.freeze({hosts:e,open:r!==void 0?e=>{vr(r,e,"message")}:Pi})},[l,r]);return e.createElement(Ei.Provider,{value:i},n)}var Fi={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function Ai(e){return{width:e,height:e,alignItems:"center",justifyContent:"center"}}function Li(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}function MenuGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l),o={width:e*.82,height:i,borderRadius:i,backgroundColor:r};/* @__PURE__ */
25
+ return t.jsxs(n.View,{style:[Ai(e),{gap:e*.22}],...Fi,children:[
26
26
  /* @__PURE__ */t.jsx(n.View,{style:o}),
27
27
  /* @__PURE__ */t.jsx(n.View,{style:o}),
28
- /* @__PURE__ */t.jsx(n.View,{style:o})]})}function Cross({size:e,color:r,strokeWidth:l,rotate:i}){let o=Pi(e,l),a=e*.78;/* @__PURE__ */
29
- return t.jsxs(n.View,{style:[Ii(e),{transform:[{rotate:i}]}],...zi,children:[
28
+ /* @__PURE__ */t.jsx(n.View,{style:o})]})}function Cross({size:e,color:r,strokeWidth:l,rotate:i}){let o=Li(e,l),a=e*.78;/* @__PURE__ */
29
+ return t.jsxs(n.View,{style:[Ai(e),{transform:[{rotate:i}]}],...Fi,children:[
30
30
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",width:a,height:o,borderRadius:o,backgroundColor:r}}),
31
31
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",width:o,height:a,borderRadius:o,backgroundColor:r}})]})}function PlusGlyph(e){/* @__PURE__ */
32
32
  return t.jsx(Cross,{...e,rotate:"0deg"})}function CloseGlyph(e){/* @__PURE__ */
33
- return t.jsx(Cross,{...e,rotate:"45deg"})}function CheckGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l);/* @__PURE__ */
34
- return t.jsx(n.View,{style:Ii(e),...zi,children:/* @__PURE__ */t.jsx(n.View,{style:{width:e*.36,height:e*.66,marginTop:-e*.14,borderBottomWidth:i,borderRightWidth:i,borderColor:r,transform:[{rotate:"45deg"}]}})})}var Ei={down:{rotate:"45deg",marginTop:-.4,marginLeft:0},up:{rotate:"225deg",marginTop:.4,marginLeft:0},right:{rotate:"-45deg",marginTop:0,marginLeft:-.4}};function ChevronGlyph({size:e,color:r,strokeWidth:l,direction:i}){let o=Pi(e,l),a=e*.46,s=Ei[i];/* @__PURE__ */
35
- return t.jsx(n.View,{style:Ii(e),...zi,children:/* @__PURE__ */t.jsx(n.View,{style:{width:a,height:a,borderRightWidth:o,borderBottomWidth:o,borderColor:r,marginTop:a*s.marginTop,marginLeft:a*s.marginLeft,transform:[{rotate:s.rotate}]}})})}function BookGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l),o={width:e*.42,height:e*.7,borderWidth:i,borderColor:r,borderRadius:i};/* @__PURE__ */
36
- return t.jsxs(n.View,{style:[Ii(e),{flexDirection:"row",gap:1}],...zi,children:[
33
+ return t.jsx(Cross,{...e,rotate:"45deg"})}function CheckGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l);/* @__PURE__ */
34
+ return t.jsx(n.View,{style:Ai(e),...Fi,children:/* @__PURE__ */t.jsx(n.View,{style:{width:e*.36,height:e*.66,marginTop:-e*.14,borderBottomWidth:i,borderRightWidth:i,borderColor:r,transform:[{rotate:"45deg"}]}})})}var Oi={down:{rotate:"45deg",marginTop:-.4,marginLeft:0},up:{rotate:"225deg",marginTop:.4,marginLeft:0},right:{rotate:"-45deg",marginTop:0,marginLeft:-.4}};function ChevronGlyph({size:e,color:r,strokeWidth:l,direction:i}){let o=Li(e,l),a=e*.46,s=Oi[i];/* @__PURE__ */
35
+ return t.jsx(n.View,{style:Ai(e),...Fi,children:/* @__PURE__ */t.jsx(n.View,{style:{width:a,height:a,borderRightWidth:o,borderBottomWidth:o,borderColor:r,marginTop:a*s.marginTop,marginLeft:a*s.marginLeft,transform:[{rotate:s.rotate}]}})})}function BookGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l),o={width:e*.42,height:e*.7,borderWidth:i,borderColor:r,borderRadius:i};/* @__PURE__ */
36
+ return t.jsxs(n.View,{style:[Ai(e),{flexDirection:"row",gap:1}],...Fi,children:[
37
37
  /* @__PURE__ */t.jsx(n.View,{style:[o,{borderTopLeftRadius:e*.2}]}),
38
- /* @__PURE__ */t.jsx(n.View,{style:[o,{borderTopRightRadius:e*.2}]})]})}function ArrowUpRightGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l),o=e*.5;/* @__PURE__ */
39
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
38
+ /* @__PURE__ */t.jsx(n.View,{style:[o,{borderTopRightRadius:e*.2}]})]})}function ArrowUpRightGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l),o=e*.5;/* @__PURE__ */
39
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
40
40
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",width:e*.78,height:i,borderRadius:i,backgroundColor:r,transform:[{rotate:"-45deg"}]}}),
41
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.16,right:e*.16,width:o,height:o,borderTopWidth:i,borderRightWidth:i,borderColor:r}})]})}function CopyGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l),o=e*.6,a={position:"absolute",width:o,height:o,borderWidth:i,borderColor:r,borderRadius:e*.14};/* @__PURE__ */
42
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
41
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.16,right:e*.16,width:o,height:o,borderTopWidth:i,borderRightWidth:i,borderColor:r}})]})}function CopyGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l),o=e*.6,a={position:"absolute",width:o,height:o,borderWidth:i,borderColor:r,borderRadius:e*.14};/* @__PURE__ */
42
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
43
43
  /* @__PURE__ */t.jsx(n.View,{style:[a,{top:0,left:0}]}),
44
- /* @__PURE__ */t.jsx(n.View,{style:[a,{bottom:0,right:0}]})]})}function ThumbGlyph({size:e,color:r,strokeWidth:l,active:i,rotate:o}){let a=Pi(e,l),s=i?r:"transparent";/* @__PURE__ */
45
- return t.jsxs(n.View,{style:[Ii(e),{transform:[{rotate:o}]}],...zi,children:[
44
+ /* @__PURE__ */t.jsx(n.View,{style:[a,{bottom:0,right:0}]})]})}function ThumbGlyph({size:e,color:r,strokeWidth:l,active:i,rotate:o}){let a=Li(e,l),s=i?r:"transparent";/* @__PURE__ */
45
+ return t.jsxs(n.View,{style:[Ai(e),{transform:[{rotate:o}]}],...Fi,children:[
46
46
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:e*.08,left:e*.12,width:e*.62,height:e*.5,borderWidth:a,borderColor:r,backgroundColor:s,borderRadius:e*.12,borderTopLeftRadius:e*.04}}),
47
47
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.04,left:e*.4,width:e*.3,height:e*.5,borderWidth:a,borderColor:r,backgroundColor:s,borderRadius:e*.15,transform:[{rotate:"-20deg"}]}}),
48
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:e*.08,left:0,width:e*.2,height:e*.5,borderWidth:a,borderColor:r,backgroundColor:s,borderRadius:e*.05}})]})}function InfoGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l);/* @__PURE__ */
49
- return t.jsxs(n.View,{style:[Ii(e),{borderRadius:e/2,borderWidth:i,borderColor:r}],...zi,children:[
48
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:e*.08,left:0,width:e*.2,height:e*.5,borderWidth:a,borderColor:r,backgroundColor:s,borderRadius:e*.05}})]})}function InfoGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l);/* @__PURE__ */
49
+ return t.jsxs(n.View,{style:[Ai(e),{borderRadius:e/2,borderWidth:i,borderColor:r}],...Fi,children:[
50
50
  /* @__PURE__ */t.jsx(n.View,{style:{width:i,height:i,borderRadius:i,backgroundColor:r,marginBottom:e*.1}}),
51
- /* @__PURE__ */t.jsx(n.View,{style:{width:i,height:e*.34,borderRadius:i,backgroundColor:r}})]})}function UploadGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l),o=e*.34;/* @__PURE__ */
52
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
51
+ /* @__PURE__ */t.jsx(n.View,{style:{width:i,height:e*.34,borderRadius:i,backgroundColor:r}})]})}function UploadGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l),o=e*.34;/* @__PURE__ */
52
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
53
53
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.06,width:o,height:o,borderTopWidth:i,borderLeftWidth:i,borderColor:r,transform:[{rotate:"45deg"}]}}),
54
54
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.1,width:i,height:e*.56,borderRadius:i,backgroundColor:r}}),
55
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:0,width:e*.84,height:e*.3,borderBottomWidth:i,borderLeftWidth:i,borderRightWidth:i,borderColor:r,borderBottomLeftRadius:i,borderBottomRightRadius:i}})]})}function PhotoGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l);/* @__PURE__ */
56
- return t.jsxs(n.View,{style:[Ii(e),{borderWidth:i,borderColor:r,borderRadius:e*.14,overflow:"hidden"}],...zi,children:[
55
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:0,width:e*.84,height:e*.3,borderBottomWidth:i,borderLeftWidth:i,borderRightWidth:i,borderColor:r,borderBottomLeftRadius:i,borderBottomRightRadius:i}})]})}function PhotoGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l);/* @__PURE__ */
56
+ return t.jsxs(n.View,{style:[Ai(e),{borderWidth:i,borderColor:r,borderRadius:e*.14,overflow:"hidden"}],...Fi,children:[
57
57
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.16,left:e*.18,width:e*.16,height:e*.16,borderRadius:e,backgroundColor:r}}),
58
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:-e*.3,right:-e*.1,width:e*.7,height:e*.7,borderTopWidth:i,borderLeftWidth:i,borderColor:r,transform:[{rotate:"45deg"}]}})]})}function CameraGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l);/* @__PURE__ */
59
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
58
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:-e*.3,right:-e*.1,width:e*.7,height:e*.7,borderTopWidth:i,borderLeftWidth:i,borderColor:r,transform:[{rotate:"45deg"}]}})]})}function CameraGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l);/* @__PURE__ */
59
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
60
60
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.08,width:e*.34,height:e*.2,borderTopWidth:i,borderLeftWidth:i,borderRightWidth:i,borderColor:r,borderTopLeftRadius:i,borderTopRightRadius:i}}),
61
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.22,width:e*.92,height:e*.66,borderWidth:i,borderColor:r,borderRadius:e*.16,alignItems:"center",justifyContent:"center"},children:/* @__PURE__ */t.jsx(n.View,{style:{width:e*.3,height:e*.3,borderRadius:e,borderWidth:i,borderColor:r}})})]})}function SearchGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l),o=e/24,a=16*o+i,s=11*o-a/2,u=11+8/Math.SQRT2,c=(21-u)*Math.SQRT2*o,d=(u+21)/2*o;/* @__PURE__ */
62
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
61
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.22,width:e*.92,height:e*.66,borderWidth:i,borderColor:r,borderRadius:e*.16,alignItems:"center",justifyContent:"center"},children:/* @__PURE__ */t.jsx(n.View,{style:{width:e*.3,height:e*.3,borderRadius:e,borderWidth:i,borderColor:r}})})]})}function SearchGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l),o=e/24,a=16*o+i,s=11*o-a/2,u=11+8/Math.SQRT2,c=(21-u)*Math.SQRT2*o,d=(u+21)/2*o;/* @__PURE__ */
62
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
63
63
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:s,left:s,width:a,height:a,borderRadius:a,borderWidth:i,borderColor:r}}),
64
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:d-i/2,left:d-(c+i)/2,width:c+i,height:i,borderRadius:i,backgroundColor:r,transform:[{rotate:"45deg"}]}})]})}function EditGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l);/* @__PURE__ */
65
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
64
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:d-i/2,left:d-(c+i)/2,width:c+i,height:i,borderRadius:i,backgroundColor:r,transform:[{rotate:"45deg"}]}})]})}function EditGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l);/* @__PURE__ */
65
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
66
66
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",width:e*.3,height:e*.82,borderWidth:i,borderColor:r,borderRadius:i,transform:[{rotate:"45deg"}]}}),
67
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:0,left:0,width:e*.4,height:i,borderRadius:i,backgroundColor:r}})]})}function MapPinGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l),o=e*.62;/* @__PURE__ */
68
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
67
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:0,left:0,width:e*.4,height:i,borderRadius:i,backgroundColor:r}})]})}function MapPinGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l),o=e*.62;/* @__PURE__ */
68
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
69
69
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:0,width:o,height:o,borderRadius:o,borderWidth:i,borderColor:r,alignItems:"center",justifyContent:"center"},children:/* @__PURE__ */t.jsx(n.View,{style:{width:i*1.4,height:i*1.4,borderRadius:i,backgroundColor:r}})}),
70
70
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:e*.04,width:o*.5,height:o*.5,borderRightWidth:i,borderBottomWidth:i,borderColor:r,transform:[{rotate:"45deg"}]}})]})}function SendGlyph({size:e,color:r,testID:l}){let i=e*.36;/* @__PURE__ */
71
- return t.jsx(n.View,{style:Ii(e),testID:l,...zi,children:/* @__PURE__ */t.jsx(n.View,{style:{width:0,height:0,marginLeft:e*.12,borderLeftWidth:e*.78,borderTopWidth:i,borderBottomWidth:i,borderLeftColor:r,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"-45deg"}]}})})}function StopGlyph({size:e,color:r,testID:l}){/* @__PURE__ */
72
- return t.jsx(n.View,{style:Ii(e),testID:l,...zi,children:/* @__PURE__ */t.jsx(n.View,{style:{width:e*.5,height:e*.5,backgroundColor:r}})})}function MicGlyph({size:e,color:r,strokeWidth:l,testID:i}){let o=Pi(e,l);/* @__PURE__ */
73
- return t.jsxs(n.View,{style:Ii(e),testID:i,...zi,children:[
71
+ return t.jsx(n.View,{style:Ai(e),testID:l,...Fi,children:/* @__PURE__ */t.jsx(n.View,{style:{width:0,height:0,marginLeft:e*.12,borderLeftWidth:e*.78,borderTopWidth:i,borderBottomWidth:i,borderLeftColor:r,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"-45deg"}]}})})}function StopGlyph({size:e,color:r,testID:l}){/* @__PURE__ */
72
+ return t.jsx(n.View,{style:Ai(e),testID:l,...Fi,children:/* @__PURE__ */t.jsx(n.View,{style:{width:e*.5,height:e*.5,backgroundColor:r}})})}function MicGlyph({size:e,color:r,strokeWidth:l,testID:i}){let o=Li(e,l);/* @__PURE__ */
73
+ return t.jsxs(n.View,{style:Ai(e),testID:i,...Fi,children:[
74
74
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.08,width:e*.26,height:e*.48,borderWidth:o,borderColor:r,borderRadius:e*.13}}),
75
75
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.38,width:e*.56,height:e*.36,borderBottomWidth:o,borderLeftWidth:o,borderRightWidth:o,borderColor:r,borderBottomLeftRadius:e*.28,borderBottomRightRadius:e*.28}}),
76
76
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.74,width:o,height:e*.18,backgroundColor:r}})]})}function Ring({size:e,strokeWidth:r,color:l,children:i}){/* @__PURE__ */
77
- return t.jsx(n.View,{style:[Ii(e),{borderRadius:e/2,borderWidth:r??n.StyleSheet.hairlineWidth,borderColor:l}],children:i})}function ArrowUpGlyph({size:e,color:r,strokeWidth:l,testID:i}){let o=Pi(e,l),a=e*.46;/* @__PURE__ */
78
- return t.jsxs(n.View,{style:Ii(e),testID:i,...zi,children:[
77
+ return t.jsx(n.View,{style:[Ai(e),{borderRadius:e/2,borderWidth:r??n.StyleSheet.hairlineWidth,borderColor:l}],children:i})}function ArrowUpGlyph({size:e,color:r,strokeWidth:l,testID:i}){let o=Li(e,l),a=e*.46;/* @__PURE__ */
78
+ return t.jsxs(n.View,{style:Ai(e),testID:i,...Fi,children:[
79
79
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.16,bottom:e*.12,width:o,borderRadius:o,backgroundColor:r}}),
80
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.16+o/2,width:a,height:a,borderLeftWidth:o,borderTopWidth:o,borderColor:r,transform:[{rotate:"45deg"}]}})]})}function ChatBubbleGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l);/* @__PURE__ */
81
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
80
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.16+o/2,width:a,height:a,borderLeftWidth:o,borderTopWidth:o,borderColor:r,transform:[{rotate:"45deg"}]}})]})}function ChatBubbleGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l);/* @__PURE__ */
81
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
82
82
  /* @__PURE__ */t.jsx(n.View,{style:{width:e*.8,height:e*.6,marginTop:-e*.12,borderWidth:i,borderColor:r,borderRadius:e*.14}}),
83
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:e*.1,left:e*.22,width:e*.2,height:e*.2,borderLeftWidth:i,borderBottomWidth:i,borderColor:r}})]})}function HistoryGlyph({size:e,color:r,strokeWidth:l}){let i=Pi(e,l),o=e*.72,a=e/2;/* @__PURE__ */
84
- return t.jsxs(n.View,{style:Ii(e),...zi,children:[
83
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",bottom:e*.1,left:e*.22,width:e*.2,height:e*.2,borderLeftWidth:i,borderBottomWidth:i,borderColor:r}})]})}function HistoryGlyph({size:e,color:r,strokeWidth:l}){let i=Li(e,l),o=e*.72,a=e/2;/* @__PURE__ */
84
+ return t.jsxs(n.View,{style:Ai(e),...Fi,children:[
85
85
  /* @__PURE__ */t.jsx(n.View,{style:{width:o,height:o,borderRadius:o/2,borderWidth:i,borderColor:r,borderLeftColor:"transparent",transform:[{rotate:"45deg"}]}}),
86
86
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:e*.16,left:e*.12,width:e*.2,height:e*.2,borderLeftWidth:i,borderBottomWidth:i,borderColor:r}}),
87
87
  /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:a-e*.2,left:a-i/2,width:i,height:e*.2+i/2,borderRadius:i,backgroundColor:r}}),
88
- /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:a-i/2,left:a-i/2,width:e*.15+i/2,height:i,borderRadius:i,backgroundColor:r}})]})}var Mi=/* @__PURE__ */Object.freeze({standard:q.standard,emphasized:q.emphasized,exit:q.exit,outQuad:/* @__PURE__ */Object.freeze([.25,.46,.45,.94]),out:/* @__PURE__ */Object.freeze([.23,1,.32,1])});var Fi=/* @__PURE__ */Object.freeze({layoutMs:220,messageInMs:200,bannerInMs:220,bannerOutMs:160,iconInMs:180,iconOutMs:120,followUpInMs:180,followUpStaggerMs:70,citationsInMs:220,citationsRisePx:6,drawerMs:220,pressScale:.97,pressMs:140,revealTickMs:24,revealDivisor:12,dotsCycleMs:520,dotsMinOpacity:.44,dotsLiftPx:3.5,dotsStagger:/* @__PURE__ */Object.freeze([0,.18,.36]),copiedMs:1500,uploadFlashMs:600,bubbleInMs:280,bubbleFromScale:.94,bubbleRisePx:6,promptRisePx:8,reduced:false}),Ai=/* @__PURE__ */Object.freeze({...Fi,layoutMs:0,messageInMs:0,bannerInMs:0,bannerOutMs:0,iconInMs:0,iconOutMs:0,followUpInMs:0,followUpStaggerMs:0,citationsInMs:0,citationsRisePx:0,drawerMs:0,pressScale:1,pressMs:0,revealTickMs:0,dotsCycleMs:0,dotsMinOpacity:1,dotsLiftPx:0,bubbleInMs:0,bubbleFromScale:1,bubbleRisePx:0,promptRisePx:0,reduced:true});function Li(e){return e.motion.reducedMotion?Ai:Fi}function Oi(e,t){return Math.max(0,t)*e.followUpStaggerMs}function Vi(e,t,r){if(e.reduced||t>=r)return r;let n=Math.max(1,Math.ceil((r-t)/e.revealDivisor));return Math.min(r,t+n)}function Di(){let e=useEverfurTheme();return Li(e)}var Bi=8;function Hi(e,t,r){return((1-3*r+3*t)*e+(3*r-6*t))*e*e+3*t*e}function Wi(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}function Ni(e){let[t,r,n,l]=e;return e=>{if(e<=0)return 0;if(e>=1)return 1;let i=e;for(let r=0;r<Bi;r+=1){let r=Wi(i,t,n);if(r===0)break;i-=(Hi(i,t,n)-e)/r}return Hi(Math.min(1,Math.max(0,i)),r,l)}}var Ui=Ni(Mi.standard),$i=Ni(Mi.outQuad),qi=Ni(Mi.out);function Gi(t){let r=e.useRef(null);return r.current===null&&(r.current=new n.Animated.Value(t)),r.current}function Ki(t,r={}){let l=r.risePx??0,i=r.delayMs??0,o=Gi(t>0?0:1);return e.useEffect(()=>{if(t<=0){o.setValue(1);return}let e=n.Animated.timing(o,{toValue:1,duration:t,easing:$i,useNativeDriver:true}),r=i>0?n.Animated.sequence([n.Animated.delay(i),e]):e;return r.start(),()=>r.stop()},[o,t,i]),e.useMemo(()=>({opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[l,0]})}]}),[o,l])}function FadePresence({visible:r,inMs:l,outMs:i,style:o,children:a}){let[s,u]=e.useState(r),c=Gi(r&&l<=0?1:0);return e.useEffect(()=>{if(r){u(true);let e=n.Animated.timing(c,{toValue:1,duration:Math.max(0,l),easing:Ui,useNativeDriver:true});return e.start(),()=>e.stop()}if(!s)return;if(i<=0){u(false);return}let e=n.Animated.timing(c,{toValue:0,duration:i,easing:Ui,useNativeDriver:true});return e.start(({finished:e})=>{e&&u(false)}),()=>e.stop()},[r,s,l,i,c]),!s&&!r?null:/* @__PURE__ */t.jsx(n.Animated.View,{style:[o,{opacity:c}],children:a})}var Yi=/* @__PURE__ */Object.freeze({opacity:1,transform:/* @__PURE__ */Object.freeze([{translateY:0},{scale:1}])});function Qi(t,r){let[l]=e.useState(()=>t?r.bubbleInMs:0),i=l>0,o=Gi(i?0:1);e.useEffect(()=>{if(l<=0)return;let e=n.Animated.timing(o,{toValue:1,duration:l,easing:qi,useNativeDriver:true});return e.start(),()=>e.stop()},[l,o]);let a=r.bubbleFromScale,s=r.bubbleRisePx;return e.useMemo(()=>i?{opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[s,0]})},{scale:o.interpolate({inputRange:[0,1],outputRange:[a,1]})}]}:Yi,[i,o,s,a])}function Zi(t){let r=e.useRef(null),n=e.useRef(null),l=t[0]?.id??null;if(r.current===null||n.current!==l){let e=r.current===null;r.current=new Map(t.map(t=>[t.id,e&&t.pending===true])),n.current=l}let i=r.current;for(let e of t)i.has(e.id)||i.set(e.id,true);return e.useCallback(e=>i.get(e)===true,[i])}var Ji=12;function PressScale({style:r,containerStyle:l,children:i,onPressIn:o,onPressOut:a,hitSlop:s,...u}){let c=Di(),d=Gi(1),p=e.useCallback(e=>{c.pressMs<=0||c.pressScale===1||n.Animated.timing(d,{toValue:e,duration:c.pressMs,easing:Ui,useNativeDriver:true}).start()},[d,c.pressMs,c.pressScale]);/* @__PURE__ */
89
- return t.jsx(n.Pressable,{...u,hitSlop:s??Ji,style:l,onPressIn:e=>{p(c.pressScale),o?.(e)},onPressOut:e=>{p(1),a?.(e)},children:/* @__PURE__ */t.jsx(n.Animated.View,{style:[r,{transform:[{scale:d}]}],children:i})})}function Xi(t,r,n){let l=r&&n.revealTickMs>0,[i,o]=e.useState(0),a=e.useRef(t);return a.current=t,e.useEffect(()=>{if(!l)return;let e=setInterval(()=>{o(e=>Vi(n,e,a.current.length))},n.revealTickMs);return()=>clearInterval(e)},[l,n]),l?t.slice(0,Math.min(i,t.length)):t}var eo=false;function to(e){e.layoutMs<=0||(eo||(eo=true,n.Platform.OS==="android"&&typeof n.UIManager.setLayoutAnimationEnabledExperimental=="function"&&n.UIManager.setLayoutAnimationEnabledExperimental(true)),n.LayoutAnimation.configureNext({duration:e.layoutMs,create:{type:"easeInEaseOut",property:"opacity"},update:{type:"easeInEaseOut"},delete:{type:"easeInEaseOut",property:"opacity"}}))}function ro(t,r){let n=e.useRef(t);n.current!==t&&(n.current=t,to(r))}var no=36,lo=22,io=12,oo=12,ao=16,so="#000",uo="rgba(0,0,0,0.45)";function AttachmentImageLightbox({uri:e,label:r,onClose:i}){let o=useEverfurTheme(),a=l.useSafeAreaInsets();return e===null?null:/* @__PURE__ */t.jsxs(n.Modal,{visible:true,animationType:o.motion.reducedMotion?"none":"fade",transparent:false,statusBarTranslucent:true,onRequestClose:i,children:[
90
- /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:pe.closePreview,style:co.backdrop,onPress:i,children:/* @__PURE__ */t.jsx(n.Image,{source:{uri:e},style:co.image,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:r,accessibilityIgnoresInvertColors:true})}),
91
- /* @__PURE__ */t.jsx(n.View,{pointerEvents:"box-none",style:[co.closeWrap,{top:a.top+oo}],children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.closePreview,hitSlop:io,style:co.closeButton,onPress:i,children:/* @__PURE__ */t.jsx(CloseGlyph,{size:lo,color:o.color.surface,strokeWidth:2})})})]})}var co=n.StyleSheet.create({backdrop:{flex:1,backgroundColor:so,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"},closeWrap:{position:"absolute",right:ao},closeButton:{width:no,height:no,borderRadius:no/2,backgroundColor:uo,alignItems:"center",justifyContent:"center"}});var po=()=>{};function fo(){try{return n.AppState.currentState==="active"}catch{return false}}function createAppStateLifecycle(){return{onForeground(e){let t;try{let r=n.AppState.currentState==="background";t=n.AppState.addEventListener("change",t=>{t==="background"?r=!0:t==="active"&&r&&(r=!1,e())})}catch{return po}return()=>t.remove()},isVisible:fo}}function ho(e,t){if(e===void 0)return{};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}function bo(e){return e===void 0||e.backgroundColor!==void 0?e:e.borderRadius===void 0?void 0:{borderRadius:e.borderRadius}}function go(e){return e?.textColor===void 0?{}:{color:e.textColor}}var mo=/* @__PURE__ */Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function yo(e){return e!==mo}var vo=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function xo(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let l={handle:void 0},i=()=>{r.clearTimeout(l.handle),t.removeEventListener("abort",i),n()};l.handle=r.setTimeout(i,e),t.addEventListener("abort",i,{once:true})})}var wo=4e3;var ko=4e3;var So=/* @__PURE__ */Object.freeze(["image/jpeg","image/jpg","image/png","image/heic","image/heif","image/webp"]);var Co=10*1024*1024,jo=5,Ro=120,To="/widget/v1/uploads/initiate";function isAttachmentMime(e){return typeof e=="string"&&So.includes(e.trim().toLowerCase())}function sanitizeFilename(e){if(!e)return"attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return"attachment";if(t.length<=Ro)return t;let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return t.slice(0,Ro);let n=t.slice(r);return n.length>=Ro?t.slice(0,Ro):`${t.slice(0,r).slice(0,Ro-n.length)}${n}`}function formatBytes(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var _o=e=>/* @__PURE__ */Object.freeze({ok:true,value:e}),zo=e=>/* @__PURE__ */Object.freeze({ok:false,error:e});function Io(e,t,r,n){/* @__PURE__ */
92
- return Object.freeze({code:e,retryable:t,filename:r,...n??{}})}function attachmentSize(e){if(typeof e.sizeBytes=="number"&&Number.isFinite(e.sizeBytes)&&e.sizeBytes>=0)return e.sizeBytes;let t=e.blob;return t!==void 0&&typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}function validateAttachment(e){let t=sanitizeFilename(e.name),r=typeof e.mimeType=="string"?e.mimeType.trim().toLowerCase():"";if(!isAttachmentMime(r))return zo(Io("unsupported_type",false,t));let n=attachmentSize(e);return n===null?zo(Io("unknown",false,t)):n>Co?zo(Io("too_large",false,t,{sizeBytes:n})):_o(/* @__PURE__ */Object.freeze({file:e,filename:t,contentType:r,sizeBytes:n}))}function Po(e){if(typeof e!="object"||e===null)return null;let t=e,r=e=>typeof e=="string"&&e.length>0?e:null,n=e=>typeof e=="number"&&Number.isFinite(e)?e:null,l=r(t.upload_id),i=r(t.upload_url),o=r(t.s3_key);if(l===null||i===null||o===null)return null;let a={},s=t.upload_fields;if(typeof s=="object"&&s!==null)for(let[e,t]of Object.entries(s))typeof t=="string"&&(a[e]=t);/* @__PURE__ */
93
- return Object.freeze({upload_id:l,upload_url:i,upload_fields:/* @__PURE__ */Object.freeze(a),expires_in_seconds:n(t.expires_in_seconds)??0,max_content_length:n(t.max_content_length)??Co,s3_key:o,purpose:r(t.purpose)})}function Eo(e,t){let r=e.httpStatus;switch(e.code){case"quotaExceeded":return Io("quota_exceeded",false,t,{cause:e});case"rateLimited":return Io("rate_limited",true,t,{cause:e});case"idempotencyConflict":case"idempotencyInFlight":return Io("idempotency_conflict",true,t,{cause:e});case"validationFailed":return Io("unsupported_type",false,t,{cause:e});case"serviceUnavailable":case"streamTimeout":return Io("network",true,t,{cause:e});default:return r===429?Io("rate_limited",true,t,{cause:e}):r===503?Io("network",true,t,{cause:e}):r===void 0?Io("network",true,t,{cause:e}):Io("server",e.retryable,t,{httpStatus:r,cause:e})}}async function initiateAttachmentUpload(e,t,r){let n=await e.send("chat.attachments.initiate",{method:"POST",path:To,body:{filename:t.filename,content_type:t.contentType,file_size:t.sizeBytes},...r?.signal?{signal:r.signal}:{}});if(!n.ok)return zo(Eo(n.error,t.filename));let l=Po(n.value);return l===null?zo(Io("server",false,t.filename)):_o(l)}async function uploadAttachmentBytes(e,t,r,n){let l=()=>n?.signal?.aborted===true;if(l())return zo(Io("cancelled",true,r.filename));try{return await e.postMultipart(t,r.file,{...n?.signal?{signal:n.signal}:{},...n?.onProgress?{onProgress:n.onProgress}:{}}),_o(void 0)}catch{return l()?zo(Io("cancelled",true,r.filename)):zo(Io("server",true,r.filename))}}var Mo=2,Fo=3,Ao=/* @__PURE__ */Object.freeze([1e3,2e3,4e3]),Lo=0;function Oo(){return Lo+=1,`attachment-${Lo}`}function createAttachmentQueue(e){let t=Math.max(1,e.concurrency??Mo),r=Math.max(1,e.maxAttempts??Fo),n=e.backoffMs??Ao,l=Math.max(1,e.maxPerMessage??jo),i=e.timers??vo,o=e.newId??Oo,a=yo(e.transport),s=/* @__PURE__ */new Map,u=[],c=[],d=/* @__PURE__ */new Set,p=/* @__PURE__ */new Set,f=/* @__PURE__ */Object.freeze({attachments:/* @__PURE__ */Object.freeze([])}),h=false,b=()=>{f=/* @__PURE__ */Object.freeze({attachments:/* @__PURE__ */Object.freeze(u.flatMap(e=>{let t=s.get(e);return t===void 0?[]:[t.state]}))});for(let e of p)e()},g=(e,t)=>{e.state=/* @__PURE__ */Object.freeze({...e.state,...t}),b()},m=()=>{for(;!h&&d.size<t&&c.length>0;){let e=c.shift(),t=s.get(e);t!==void 0&&(d.add(e),y(t).finally(()=>{d.delete(e),m()}))}},y=async t=>{let{attachment:l}=t;for(;t.attempts<r;){if(h||t.controller.signal.aborted)return;t.attempts+=1;let o=t.controller.signal;g(t,{status:"uploading",error:null,progress:0});let a=await initiateAttachmentUpload(e.funnel,l,{signal:o});if(h||o.aborted)return;let s;if(!a.ok)s=zo(a.error);else{let r=await uploadAttachmentBytes(e.transport,a.value,l,{signal:o,onProgress:e=>{!o.aborted&&t.state.status==="uploading"&&g(t,{progress:Vo(e)})}});if(h||o.aborted)return;s=r.ok?_o(a.value.s3_key):zo(r.error)}if(s.ok){g(t,{status:"uploaded",s3Key:s.value,error:null,progress:1});return}let u=s.error,c=u.retryable&&t.attempts<r;if(g(t,{status:c?"uploading":"failed",error:u,progress:0}),!c)return;let d=n[Math.min(t.attempts-1,n.length-1)]??0;await xo(d,o,i)}},v=e=>{c.push(e.state.id),m()},x={available:a,subscribe(e){return p.add(e),()=>{p.delete(e)}},getSnapshot:()=>f,get uploading(){return f.attachments.some(e=>e.status==="uploading")},get s3Keys(){return f.attachments.flatMap(e=>e.status==="uploaded"&&e.s3Key!==null?[e.s3Key]:[])},add(e){let t=validateAttachment(e);if(!t.ok)return t;if(h||u.length>=l)return zo(Io("too_many",false,t.value.filename));let r=o(),n={attachment:t.value,controller:new AbortController,attempts:0,state:/* @__PURE__ */Object.freeze({id:r,filename:t.value.filename,previewUri:e.uri,contentType:t.value.contentType,sizeBytes:t.value.sizeBytes,status:"uploading",s3Key:null,error:null,progress:0})};return s.set(r,n),u.push(r),b(),v(n),_o(n.state)},retry(e){let t=s.get(e);t===void 0||h||t.state.status!=="failed"||(t.controller=new AbortController,t.attempts=0,g(t,{status:"uploading",error:null,progress:0,s3Key:null}),v(t))},remove(e){let t=s.get(e);if(t===void 0)return;t.controller.abort(),s.delete(e);let r=u.indexOf(e);r>=0&&u.splice(r,1);let n=c.indexOf(e);n>=0&&c.splice(n,1),b()},clear(){for(let e of[...u])x.remove(e)},dispose(){h=true;for(let e of s.values())e.controller.abort();s.clear(),u.length=0,c.length=0,p.clear(),f=/* @__PURE__ */Object.freeze({attachments:/* @__PURE__ */Object.freeze([])})}};return x}function Vo(e){return Number.isNaN(e)||e<0?0:e>1?1:e}function Do(e){switch(e.code){case"too_large":return fe(pe.attachmentTooLarge,{max:formatBytes(Co),filename:e.filename,size:formatBytes(e.sizeBytes??0)});case"too_many":return fe(pe.attachmentTooMany,{max:jo});case"unsupported_type":return fe(pe.attachmentUnsupported,{filename:e.filename});case"network":return pe.attachmentNetwork;case"server":return fe(pe.attachmentServer,{status:e.httpStatus?` (${e.httpStatus})`:""});case"cancelled":return pe.attachmentCancelled;case"rate_limited":return pe.attachmentRateLimited;case"quota_exceeded":return pe.attachmentQuota;case"idempotency_conflict":return pe.attachmentConflict;case"unknown":return pe.attachmentUnknown}}function Bo(e,t){return fe(e>=t?pe.attachmentsFull:pe.addAttachment,{used:e,total:t})}var Ho=/* @__PURE__ */Object.freeze({attachments:/* @__PURE__ */Object.freeze([])});function useChatAttachments(t={}){let{runtime:r,userRef:userRef,scopeEpoch:n}=we(),l=t.maxPerMessage??jo,i=e.useCallback(()=>{let{services:e}=r.registry;return createAttachmentQueue({funnel:createRequestFunnel({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),transport:t.transport??e.uploadTransport,maxPerMessage:l})},[r,userRef,n,l,t.transport]),o=e.useMemo(()=>t.queue??i(),[t.queue,i]),a=e.useRef(/* @__PURE__ */new WeakSet),[s,u]=e.useState(null),c=s!==null&&s.of===o?s.queue:o;e.useEffect(()=>{if(c!==t.queue){if(a.current.has(c)){u({of:o,queue:i()});return}return()=>{c.dispose(),a.current.add(c)}}},[c,o,i,t.queue]);let d=e.useSyncExternalStore(c.subscribe,c.getSnapshot,()=>Ho),[p,f]=e.useState(null),h=e.useCallback(e=>{let t=(Array.isArray(e)?e:[e]).map(e=>c.add(e)),r=t.find(e=>!e.ok);return r!==void 0&&!r.ok&&f(r.error),t},[c,f]),b=e.useCallback(e=>c.retry(e),[c]),g=e.useCallback(e=>c.remove(e),[c]),m=e.useCallback(()=>c.clear(),[c]),y=e.useCallback(()=>f(null),[f]),v=d.attachments.some(e=>e.status==="uploading"),x=d.attachments.some(e=>e.status==="failed");return e.useMemo(()=>({available:c.available,attachments:d.attachments,maxPerMessage:l,uploading:v,failed:x,blocked:v||x,s3Keys:d.attachments.flatMap(e=>e.status==="uploaded"&&e.s3Key!==null?[e.s3Key]:[]),rejected:p,add:h,retry:b,remove:g,clear:m,dismissRejected:y}),[c.available,d,l,v,x,p,h,b,g,m,y])}var Wo=6e3;function No(e,t,r){let n=t.trim();if(!n)return e;let l=e===""||/\s$/.test(e)?"":" ",i=`${e}${l}${n}`;return typeof r=="number"&&r>0?i.slice(0,r):i}function Uo(e){let t=Math.max(0,Math.floor(e/1e3)),r=Math.floor(t/60),n=t%60;return`${r}:${n.toString().padStart(2,"0")}`}function $o(e){switch(e){case"permissionDenied":return pe.micBlocked;case"noSpeech":return pe.noSpeech;case"unavailable":return pe.dictationUnavailable}}function qo(e,t,r){if(e)try{e.track(t,{...r})}catch{}}var Go=["Apoquel","Cytopoint","Bravecto","NexGard","Simparica Trio","Credelio","Revolution","Heartgard","Interceptor","Sentinel","ProHeart","Rimadyl","carprofen","meloxicam","Metacam","Galliprant","gabapentin","trazodone","Librela","Solensia","Zenrelia","prednisone","prednisolone","amoxicillin","Clavamox","cephalexin","Convenia","metronidazole","doxycycline","Cerenia","maropitant","famotidine","omeprazole","Proin","Vetmedin","pimobendan","enalapril","furosemide","levothyroxine","methimazole","Vetsulin","fluoxetine","Sileo","tramadol","buprenorphine","Denamarin","Dasuquin","Cosequin","parvovirus","distemper","Bordetella","leptospirosis","heartworm","giardia","coccidia","pancreatitis","hypothyroidism","Cushing's disease","Addison's disease","IVDD","cruciate ligament","luxating patella","hip dysplasia","pyometra","kennel cough","otitis","FIV","FeLV","DHPP","FVRCP","Labrador Retriever","Golden Retriever","French Bulldog","German Shepherd","Dachshund","Cavalier King Charles Spaniel","Shih Tzu","Pomeranian","Chihuahua","Yorkshire Terrier","Bichon Frise","Havanese","Cockapoo","Goldendoodle","Labradoodle","Weimaraner","Vizsla","Shiba Inu","Springer Spaniel","Miniature Schnauzer","Corgi","Australian Shepherd","Border Collie","Siberian Husky","Beagle","Maine Coon","Ragdoll","Sphynx","Bengal cat","British Shorthair"];function Ko(e={}){let t=/* @__PURE__ */new Set,r=[];for(let n of[e.name,e.breed,...Go]){let e=(n??"").trim();if(!e)continue;let l=e.toLowerCase();if(!t.has(l)&&(t.add(l),r.push(e),r.length>=100))break}return r}function Yo(t,conversationId,r){let[n,l]=e.useState({send:t,conversationId:conversationId,text:r??"",seeded:r??null}),i=n.send===t&&(n.conversationId===null||n.conversationId===conversationId);e.useEffect(()=>{l(e=>{let n=e.send===t&&(e.conversationId===null||e.conversationId===conversationId),l=n?e.text:"",i=n?e.seeded:null,o=r!=null&&r!==i&&l.length===0;return{send:t,conversationId:conversationId,text:o?r:l,seeded:o?r:i}})},[t,conversationId,r]);let o=e.useCallback(e=>l(r=>({send:t,conversationId:conversationId,text:e,seeded:r.seeded})),[t,conversationId]);return[i?n.text:"",o]}function Qo(t,conversationId,r,n,l=false){let i=e.useRef({draft:r,setDraft:n});i.current={draft:r,setDraft:n};let o=e.useRef(null),[a,s]=e.useState(null);e.useEffect(()=>{if(t===void 0)return;let e=`${conversationId??""}`;if(o.current===e)return;o.current=e;let r=true;return(async()=>{let n=await kr(()=>t.read(conversationId));if(!r)return;let l=n.ok&&typeof n.value=="string"?n.value:"";l.length>0&&i.current.draft.length===0&&i.current.setDraft(l),s(e)})(),()=>{r=false}},[t,conversationId]),e.useEffect(()=>{t===void 0||l||a!==`${conversationId??""}`||vr(()=>t.write(conversationId,r))},[t,conversationId,r,a,l])}function Zo(e){if(!(n.Platform.OS!=="ios"||e===""))try{let t=n.AccessibilityInfo?.announceForAccessibility;typeof t=="function"&&t.call(n.AccessibilityInfo,e)}catch{}}function AnnounceLine({line:t}){return e.useEffect(()=>{Zo(t)},[t]),null}var Jo=12,Xo=80,ea=44,ta=22,ra=.14,na=18,la=8,ia=/* @__PURE__ */Object.freeze({photo:pe.attachmentPhoto,camera:pe.attachmentCamera});function AttachmentPickerPopover({sources:r,full:l,onPick:i,onClose:o}){let a=useEverfurTheme(),s=e.useMemo(()=>oa(a),[a]);/* @__PURE__ */
88
+ /* @__PURE__ */t.jsx(n.View,{style:{position:"absolute",top:a-i/2,left:a-i/2,width:e*.15+i/2,height:i,borderRadius:i,backgroundColor:r}})]})}var Vi=/* @__PURE__ */Object.freeze({standard:q.standard,emphasized:q.emphasized,exit:q.exit,outQuad:/* @__PURE__ */Object.freeze([.25,.46,.45,.94]),out:/* @__PURE__ */Object.freeze([.23,1,.32,1])});var Di=/* @__PURE__ */Object.freeze({layoutMs:220,messageInMs:200,bannerInMs:220,bannerOutMs:160,iconInMs:180,iconOutMs:120,followUpInMs:180,followUpStaggerMs:70,citationsInMs:220,citationsRisePx:6,drawerMs:220,pressScale:.97,pressMs:140,revealTickMs:24,revealDivisor:12,dotsCycleMs:520,dotsMinOpacity:.44,dotsLiftPx:3.5,dotsStagger:/* @__PURE__ */Object.freeze([0,.18,.36]),copiedMs:1500,uploadFlashMs:600,bubbleInMs:280,bubbleFromScale:.94,bubbleRisePx:6,promptRisePx:8,reduced:false}),Bi=/* @__PURE__ */Object.freeze({...Di,layoutMs:0,messageInMs:0,bannerInMs:0,bannerOutMs:0,iconInMs:0,iconOutMs:0,followUpInMs:0,followUpStaggerMs:0,citationsInMs:0,citationsRisePx:0,drawerMs:0,pressScale:1,pressMs:0,revealTickMs:0,dotsCycleMs:0,dotsMinOpacity:1,dotsLiftPx:0,bubbleInMs:0,bubbleFromScale:1,bubbleRisePx:0,promptRisePx:0,reduced:true});function Hi(e){return e.motion.reducedMotion?Bi:Di}function Wi(e,t){return Math.max(0,t)*e.followUpStaggerMs}function Ni(e,t,r){if(e.reduced||t>=r)return r;let n=Math.max(1,Math.ceil((r-t)/e.revealDivisor));return Math.min(r,t+n)}function Ui(){let e=useEverfurTheme();return Hi(e)}var $i=8;function qi(e,t,r){return((1-3*r+3*t)*e+(3*r-6*t))*e*e+3*t*e}function Gi(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}function Ki(e){let[t,r,n,l]=e;return e=>{if(e<=0)return 0;if(e>=1)return 1;let i=e;for(let r=0;r<$i;r+=1){let r=Gi(i,t,n);if(r===0)break;i-=(qi(i,t,n)-e)/r}return qi(Math.min(1,Math.max(0,i)),r,l)}}var Yi=Ki(Vi.standard),Qi=Ki(Vi.outQuad),Zi=Ki(Vi.out);function Ji(t){let r=e.useRef(null);return r.current===null&&(r.current=new n.Animated.Value(t)),r.current}function Xi(t,r={}){let l=r.risePx??0,i=r.delayMs??0,o=Ji(t>0?0:1);return e.useEffect(()=>{if(t<=0){o.setValue(1);return}let e=n.Animated.timing(o,{toValue:1,duration:t,easing:Qi,useNativeDriver:true}),r=i>0?n.Animated.sequence([n.Animated.delay(i),e]):e;return r.start(),()=>r.stop()},[o,t,i]),e.useMemo(()=>({opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[l,0]})}]}),[o,l])}function FadePresence({visible:r,inMs:l,outMs:i,style:o,children:a}){let[s,u]=e.useState(r),c=Ji(r&&l<=0?1:0);return e.useEffect(()=>{if(r){u(true);let e=n.Animated.timing(c,{toValue:1,duration:Math.max(0,l),easing:Yi,useNativeDriver:true});return e.start(),()=>e.stop()}if(!s)return;if(i<=0){u(false);return}let e=n.Animated.timing(c,{toValue:0,duration:i,easing:Yi,useNativeDriver:true});return e.start(({finished:e})=>{e&&u(false)}),()=>e.stop()},[r,s,l,i,c]),!s&&!r?null:/* @__PURE__ */t.jsx(n.Animated.View,{style:[o,{opacity:c}],children:a})}var eo=/* @__PURE__ */Object.freeze({opacity:1,transform:/* @__PURE__ */Object.freeze([{translateY:0},{scale:1}])});function to(t,r){let[l]=e.useState(()=>t?r.bubbleInMs:0),i=l>0,o=Ji(i?0:1);e.useEffect(()=>{if(l<=0)return;let e=n.Animated.timing(o,{toValue:1,duration:l,easing:Zi,useNativeDriver:true});return e.start(),()=>e.stop()},[l,o]);let a=r.bubbleFromScale,s=r.bubbleRisePx;return e.useMemo(()=>i?{opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[s,0]})},{scale:o.interpolate({inputRange:[0,1],outputRange:[a,1]})}]}:eo,[i,o,s,a])}function ro(t){let r=e.useRef(null),n=e.useRef(null),l=t[0]?.id??null;if(r.current===null||n.current!==l){let e=r.current===null;r.current=new Map(t.map(t=>[t.id,e&&t.pending===true])),n.current=l}let i=r.current;for(let e of t)i.has(e.id)||i.set(e.id,true);return e.useCallback(e=>i.get(e)===true,[i])}var no=12;function PressScale({style:r,containerStyle:l,children:i,onPressIn:o,onPressOut:a,hitSlop:s,...u}){let c=Ui(),d=Ji(1),p=e.useCallback(e=>{c.pressMs<=0||c.pressScale===1||n.Animated.timing(d,{toValue:e,duration:c.pressMs,easing:Yi,useNativeDriver:true}).start()},[d,c.pressMs,c.pressScale]);/* @__PURE__ */
89
+ return t.jsx(n.Pressable,{...u,hitSlop:s??no,style:l,onPressIn:e=>{p(c.pressScale),o?.(e)},onPressOut:e=>{p(1),a?.(e)},children:/* @__PURE__ */t.jsx(n.Animated.View,{style:[r,{transform:[{scale:d}]}],children:i})})}function lo(t,r,n){let l=r&&n.revealTickMs>0,[i,o]=e.useState(0),a=e.useRef(t);return a.current=t,e.useEffect(()=>{if(!l)return;let e=setInterval(()=>{o(e=>Ni(n,e,a.current.length))},n.revealTickMs);return()=>clearInterval(e)},[l,n]),l?t.slice(0,Math.min(i,t.length)):t}var io=false;function oo(e){e.layoutMs<=0||(io||(io=true,n.Platform.OS==="android"&&typeof n.UIManager.setLayoutAnimationEnabledExperimental=="function"&&n.UIManager.setLayoutAnimationEnabledExperimental(true)),n.LayoutAnimation.configureNext({duration:e.layoutMs,create:{type:"easeInEaseOut",property:"opacity"},update:{type:"easeInEaseOut"},delete:{type:"easeInEaseOut",property:"opacity"}}))}function ao(t,r){let n=e.useRef(t);n.current!==t&&(n.current=t,oo(r))}var so=36,uo=22,co=12,po=12,fo=16,ho="#000",bo="rgba(0,0,0,0.45)";function AttachmentImageLightbox({uri:e,label:r,onClose:i}){let o=useEverfurTheme(),a=l.useSafeAreaInsets();return e===null?null:/* @__PURE__ */t.jsxs(n.Modal,{visible:true,animationType:o.motion.reducedMotion?"none":"fade",transparent:false,statusBarTranslucent:true,onRequestClose:i,children:[
90
+ /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:pe.closePreview,style:go.backdrop,onPress:i,children:/* @__PURE__ */t.jsx(n.Image,{source:{uri:e},style:go.image,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:r,accessibilityIgnoresInvertColors:true})}),
91
+ /* @__PURE__ */t.jsx(n.View,{pointerEvents:"box-none",style:[go.closeWrap,{top:a.top+po}],children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.closePreview,hitSlop:co,style:go.closeButton,onPress:i,children:/* @__PURE__ */t.jsx(CloseGlyph,{size:uo,color:o.color.surface,strokeWidth:2})})})]})}var go=n.StyleSheet.create({backdrop:{flex:1,backgroundColor:ho,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"},closeWrap:{position:"absolute",right:fo},closeButton:{width:so,height:so,borderRadius:so/2,backgroundColor:bo,alignItems:"center",justifyContent:"center"}});var mo=()=>{};function yo(){try{return n.AppState.currentState==="active"}catch{return false}}function createAppStateLifecycle(){return{onForeground(e){let t;try{let r=n.AppState.currentState==="background";t=n.AppState.addEventListener("change",t=>{t==="background"?r=!0:t==="active"&&r&&(r=!1,e())})}catch{return mo}return()=>t.remove()},isVisible:yo}}function vo(e,t){if(e===void 0)return{};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}function xo(e){return e===void 0||e.backgroundColor!==void 0?e:e.borderRadius===void 0?void 0:{borderRadius:e.borderRadius}}function wo(e){return e?.textColor===void 0?{}:{color:e.textColor}}var ko=/* @__PURE__ */Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function So(e){return e!==ko}var Co=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function jo(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let l={handle:void 0},i=()=>{r.clearTimeout(l.handle),t.removeEventListener("abort",i),n()};l.handle=r.setTimeout(i,e),t.addEventListener("abort",i,{once:true})})}var Ro=4e3;var To=4e3;var _o=/* @__PURE__ */Object.freeze(["image/jpeg","image/jpg","image/png","image/heic","image/heif","image/webp"]);var zo=10*1024*1024,Io=5,Po=120,Eo="/widget/v1/uploads/initiate";function isAttachmentMime(e){return typeof e=="string"&&_o.includes(e.trim().toLowerCase())}function sanitizeFilename(e){if(!e)return"attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return"attachment";if(t.length<=Po)return t;let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return t.slice(0,Po);let n=t.slice(r);return n.length>=Po?t.slice(0,Po):`${t.slice(0,r).slice(0,Po-n.length)}${n}`}function formatBytes(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Mo=e=>/* @__PURE__ */Object.freeze({ok:true,value:e}),Fo=e=>/* @__PURE__ */Object.freeze({ok:false,error:e});function Ao(e,t,r,n){/* @__PURE__ */
92
+ return Object.freeze({code:e,retryable:t,filename:r,...n??{}})}function attachmentSize(e){if(typeof e.sizeBytes=="number"&&Number.isFinite(e.sizeBytes)&&e.sizeBytes>=0)return e.sizeBytes;let t=e.blob;return t!==void 0&&typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}function validateAttachment(e){let t=sanitizeFilename(e.name),r=typeof e.mimeType=="string"?e.mimeType.trim().toLowerCase():"";if(!isAttachmentMime(r))return Fo(Ao("unsupported_type",false,t));let n=attachmentSize(e);return n===null?Fo(Ao("unknown",false,t)):n>zo?Fo(Ao("too_large",false,t,{sizeBytes:n})):Mo(/* @__PURE__ */Object.freeze({file:e,filename:t,contentType:r,sizeBytes:n}))}function Lo(e){if(typeof e!="object"||e===null)return null;let t=e,r=e=>typeof e=="string"&&e.length>0?e:null,n=e=>typeof e=="number"&&Number.isFinite(e)?e:null,l=r(t.upload_id),i=r(t.upload_url),o=r(t.s3_key);if(l===null||i===null||o===null)return null;let a={},s=t.upload_fields;if(typeof s=="object"&&s!==null)for(let[e,t]of Object.entries(s))typeof t=="string"&&(a[e]=t);/* @__PURE__ */
93
+ return Object.freeze({upload_id:l,upload_url:i,upload_fields:/* @__PURE__ */Object.freeze(a),expires_in_seconds:n(t.expires_in_seconds)??0,max_content_length:n(t.max_content_length)??zo,s3_key:o,purpose:r(t.purpose)})}function Oo(e,t){let r=e.httpStatus;switch(e.code){case"quotaExceeded":return Ao("quota_exceeded",false,t,{cause:e});case"rateLimited":return Ao("rate_limited",true,t,{cause:e});case"idempotencyConflict":case"idempotencyInFlight":return Ao("idempotency_conflict",true,t,{cause:e});case"validationFailed":return Ao("unsupported_type",false,t,{cause:e});case"serviceUnavailable":case"streamTimeout":return Ao("network",true,t,{cause:e});default:return r===429?Ao("rate_limited",true,t,{cause:e}):r===503?Ao("network",true,t,{cause:e}):r===void 0?Ao("network",true,t,{cause:e}):Ao("server",e.retryable,t,{httpStatus:r,cause:e})}}async function initiateAttachmentUpload(e,t,r){let n=await e.send("chat.attachments.initiate",{method:"POST",path:Eo,body:{filename:t.filename,content_type:t.contentType,file_size:t.sizeBytes},...r?.signal?{signal:r.signal}:{}});if(!n.ok)return Fo(Oo(n.error,t.filename));let l=Lo(n.value);return l===null?Fo(Ao("server",false,t.filename)):Mo(l)}async function uploadAttachmentBytes(e,t,r,n){let l=()=>n?.signal?.aborted===true;if(l())return Fo(Ao("cancelled",true,r.filename));try{return await e.postMultipart(t,r.file,{...n?.signal?{signal:n.signal}:{},...n?.onProgress?{onProgress:n.onProgress}:{}}),Mo(void 0)}catch{return l()?Fo(Ao("cancelled",true,r.filename)):Fo(Ao("server",true,r.filename))}}var Vo=2,Do=3,Bo=/* @__PURE__ */Object.freeze([1e3,2e3,4e3]),Ho=0;function Wo(){return Ho+=1,`attachment-${Ho}`}function createAttachmentQueue(e){let t=Math.max(1,e.concurrency??Vo),r=Math.max(1,e.maxAttempts??Do),n=e.backoffMs??Bo,l=Math.max(1,e.maxPerMessage??Io),i=e.timers??Co,o=e.newId??Wo,a=So(e.transport),s=/* @__PURE__ */new Map,u=[],c=[],d=/* @__PURE__ */new Set,p=/* @__PURE__ */new Set,f=/* @__PURE__ */Object.freeze({attachments:/* @__PURE__ */Object.freeze([])}),h=false,b=()=>{f=/* @__PURE__ */Object.freeze({attachments:/* @__PURE__ */Object.freeze(u.flatMap(e=>{let t=s.get(e);return t===void 0?[]:[t.state]}))});for(let e of p)e()},g=(e,t)=>{e.state=/* @__PURE__ */Object.freeze({...e.state,...t}),b()},m=()=>{for(;!h&&d.size<t&&c.length>0;){let e=c.shift(),t=s.get(e);t!==void 0&&(d.add(e),y(t).finally(()=>{d.delete(e),m()}))}},y=async t=>{let{attachment:l}=t;for(;t.attempts<r;){if(h||t.controller.signal.aborted)return;t.attempts+=1;let o=t.controller.signal;g(t,{status:"uploading",error:null,progress:0});let a=await initiateAttachmentUpload(e.funnel,l,{signal:o});if(h||o.aborted)return;let s;if(!a.ok)s=Fo(a.error);else{let r=await uploadAttachmentBytes(e.transport,a.value,l,{signal:o,onProgress:e=>{!o.aborted&&t.state.status==="uploading"&&g(t,{progress:No(e)})}});if(h||o.aborted)return;s=r.ok?Mo(a.value.s3_key):Fo(r.error)}if(s.ok){g(t,{status:"uploaded",s3Key:s.value,error:null,progress:1});return}let u=s.error,c=u.retryable&&t.attempts<r;if(g(t,{status:c?"uploading":"failed",error:u,progress:0}),!c)return;let d=n[Math.min(t.attempts-1,n.length-1)]??0;await jo(d,o,i)}},v=e=>{c.push(e.state.id),m()},x={available:a,subscribe(e){return p.add(e),()=>{p.delete(e)}},getSnapshot:()=>f,get uploading(){return f.attachments.some(e=>e.status==="uploading")},get s3Keys(){return f.attachments.flatMap(e=>e.status==="uploaded"&&e.s3Key!==null?[e.s3Key]:[])},add(e){let t=validateAttachment(e);if(!t.ok)return t;if(h||u.length>=l)return Fo(Ao("too_many",false,t.value.filename));let r=o(),n={attachment:t.value,controller:new AbortController,attempts:0,state:/* @__PURE__ */Object.freeze({id:r,filename:t.value.filename,previewUri:e.uri,contentType:t.value.contentType,sizeBytes:t.value.sizeBytes,status:"uploading",s3Key:null,error:null,progress:0})};return s.set(r,n),u.push(r),b(),v(n),Mo(n.state)},retry(e){let t=s.get(e);t===void 0||h||t.state.status!=="failed"||(t.controller=new AbortController,t.attempts=0,g(t,{status:"uploading",error:null,progress:0,s3Key:null}),v(t))},remove(e){let t=s.get(e);if(t===void 0)return;t.controller.abort(),s.delete(e);let r=u.indexOf(e);r>=0&&u.splice(r,1);let n=c.indexOf(e);n>=0&&c.splice(n,1),b()},clear(){for(let e of[...u])x.remove(e)},dispose(){h=true;for(let e of s.values())e.controller.abort();s.clear(),u.length=0,c.length=0,p.clear(),f=/* @__PURE__ */Object.freeze({attachments:/* @__PURE__ */Object.freeze([])})}};return x}function No(e){return Number.isNaN(e)||e<0?0:e>1?1:e}function Uo(e){switch(e.code){case"too_large":return fe(pe.attachmentTooLarge,{max:formatBytes(zo),filename:e.filename,size:formatBytes(e.sizeBytes??0)});case"too_many":return fe(pe.attachmentTooMany,{max:Io});case"unsupported_type":return fe(pe.attachmentUnsupported,{filename:e.filename});case"network":return pe.attachmentNetwork;case"server":return fe(pe.attachmentServer,{status:e.httpStatus?` (${e.httpStatus})`:""});case"cancelled":return pe.attachmentCancelled;case"rate_limited":return pe.attachmentRateLimited;case"quota_exceeded":return pe.attachmentQuota;case"idempotency_conflict":return pe.attachmentConflict;case"unknown":return pe.attachmentUnknown}}function $o(e,t){return fe(e>=t?pe.attachmentsFull:pe.addAttachment,{used:e,total:t})}var qo=/* @__PURE__ */Object.freeze({attachments:/* @__PURE__ */Object.freeze([])});function useChatAttachments(t={}){let{runtime:r,userRef:userRef,scopeEpoch:n}=we(),l=t.maxPerMessage??Io,i=e.useCallback(()=>{let{services:e}=r.registry;return createAttachmentQueue({funnel:createRequestFunnel({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),transport:t.transport??e.uploadTransport,maxPerMessage:l})},[r,userRef,n,l,t.transport]),o=e.useMemo(()=>t.queue??i(),[t.queue,i]),a=e.useRef(/* @__PURE__ */new WeakSet),[s,u]=e.useState(null),c=s!==null&&s.of===o?s.queue:o;e.useEffect(()=>{if(c!==t.queue){if(a.current.has(c)){u({of:o,queue:i()});return}return()=>{c.dispose(),a.current.add(c)}}},[c,o,i,t.queue]);let d=e.useSyncExternalStore(c.subscribe,c.getSnapshot,()=>qo),[p,f]=e.useState(null),h=e.useCallback(e=>{let t=(Array.isArray(e)?e:[e]).map(e=>c.add(e)),r=t.find(e=>!e.ok);return r!==void 0&&!r.ok&&f(r.error),t},[c,f]),b=e.useCallback(e=>c.retry(e),[c]),g=e.useCallback(e=>c.remove(e),[c]),m=e.useCallback(()=>c.clear(),[c]),y=e.useCallback(()=>f(null),[f]),v=d.attachments.some(e=>e.status==="uploading"),x=d.attachments.some(e=>e.status==="failed");return e.useMemo(()=>({available:c.available,attachments:d.attachments,maxPerMessage:l,uploading:v,failed:x,blocked:v||x,s3Keys:d.attachments.flatMap(e=>e.status==="uploaded"&&e.s3Key!==null?[e.s3Key]:[]),rejected:p,add:h,retry:b,remove:g,clear:m,dismissRejected:y}),[c.available,d,l,v,x,p,h,b,g,m,y])}var Go=6e3;function Ko(e,t,r){let n=t.trim();if(!n)return e;let l=e===""||/\s$/.test(e)?"":" ",i=`${e}${l}${n}`;return typeof r=="number"&&r>0?i.slice(0,r):i}function Yo(e){let t=Math.max(0,Math.floor(e/1e3)),r=Math.floor(t/60),n=t%60;return`${r}:${n.toString().padStart(2,"0")}`}function Qo(e){switch(e){case"permissionDenied":return pe.micBlocked;case"noSpeech":return pe.noSpeech;case"unavailable":return pe.dictationUnavailable}}function Zo(e,t,r){if(e)try{e.track(t,{...r})}catch{}}var Jo=["Apoquel","Cytopoint","Bravecto","NexGard","Simparica Trio","Credelio","Revolution","Heartgard","Interceptor","Sentinel","ProHeart","Rimadyl","carprofen","meloxicam","Metacam","Galliprant","gabapentin","trazodone","Librela","Solensia","Zenrelia","prednisone","prednisolone","amoxicillin","Clavamox","cephalexin","Convenia","metronidazole","doxycycline","Cerenia","maropitant","famotidine","omeprazole","Proin","Vetmedin","pimobendan","enalapril","furosemide","levothyroxine","methimazole","Vetsulin","fluoxetine","Sileo","tramadol","buprenorphine","Denamarin","Dasuquin","Cosequin","parvovirus","distemper","Bordetella","leptospirosis","heartworm","giardia","coccidia","pancreatitis","hypothyroidism","Cushing's disease","Addison's disease","IVDD","cruciate ligament","luxating patella","hip dysplasia","pyometra","kennel cough","otitis","FIV","FeLV","DHPP","FVRCP","Labrador Retriever","Golden Retriever","French Bulldog","German Shepherd","Dachshund","Cavalier King Charles Spaniel","Shih Tzu","Pomeranian","Chihuahua","Yorkshire Terrier","Bichon Frise","Havanese","Cockapoo","Goldendoodle","Labradoodle","Weimaraner","Vizsla","Shiba Inu","Springer Spaniel","Miniature Schnauzer","Corgi","Australian Shepherd","Border Collie","Siberian Husky","Beagle","Maine Coon","Ragdoll","Sphynx","Bengal cat","British Shorthair"];function Xo(e={}){let t=/* @__PURE__ */new Set,r=[];for(let n of[e.name,e.breed,...Jo]){let e=(n??"").trim();if(!e)continue;let l=e.toLowerCase();if(!t.has(l)&&(t.add(l),r.push(e),r.length>=100))break}return r}function ea(t,conversationId,r){let[n,l]=e.useState({send:t,conversationId:conversationId,text:r??"",seeded:r??null}),i=n.send===t&&(n.conversationId===null||n.conversationId===conversationId);e.useEffect(()=>{l(e=>{let n=e.send===t&&(e.conversationId===null||e.conversationId===conversationId),l=n?e.text:"",i=n?e.seeded:null,o=r!=null&&r!==i&&l.length===0;return{send:t,conversationId:conversationId,text:o?r:l,seeded:o?r:i}})},[t,conversationId,r]);let o=e.useCallback(e=>l(r=>({send:t,conversationId:conversationId,text:e,seeded:r.seeded})),[t,conversationId]);return[i?n.text:"",o]}function ta(t,conversationId,r,n,l=false){let i=e.useRef({draft:r,setDraft:n});i.current={draft:r,setDraft:n};let o=e.useRef(null),[a,s]=e.useState(null);e.useEffect(()=>{if(t===void 0)return;let e=`${conversationId??""}`;if(o.current===e)return;o.current=e;let r=true;return(async()=>{let n=await kr(()=>t.read(conversationId));if(!r)return;let l=n.ok&&typeof n.value=="string"?n.value:"";l.length>0&&i.current.draft.length===0&&i.current.setDraft(l),s(e)})(),()=>{r=false}},[t,conversationId]),e.useEffect(()=>{t===void 0||l||a!==`${conversationId??""}`||vr(()=>t.write(conversationId,r))},[t,conversationId,r,a,l])}function ra(e){if(!(n.Platform.OS!=="ios"||e===""))try{let t=n.AccessibilityInfo?.announceForAccessibility;typeof t=="function"&&t.call(n.AccessibilityInfo,e)}catch{}}function AnnounceLine({line:t}){return e.useEffect(()=>{ra(t)},[t]),null}var na=12,la=80,ia=44,oa=22,aa=.14,sa=18,ua=8,ca=/* @__PURE__ */Object.freeze({photo:pe.attachmentPhoto,camera:pe.attachmentCamera});function AttachmentPickerPopover({sources:r,full:l,onPick:i,onClose:o}){let a=useEverfurTheme(),s=e.useMemo(()=>da(a),[a]);/* @__PURE__ */
94
94
  return t.jsxs(n.View,{style:s.anchor,pointerEvents:"box-none",children:[
95
95
  /* @__PURE__ */t.jsx(n.Pressable,{style:s.dismissLayer,accessibilityRole:"button",accessibilityLabel:pe.closeAttachmentPicker,onPress:o}),
96
96
  /* @__PURE__ */t.jsxs(n.View,{style:s.bubble,children:[
97
- /* @__PURE__ */t.jsx(n.View,{style:s.tilesRow,children:r.map(e=>/* @__PURE__ */t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:ia[e],accessibilityState:{disabled:l},disabled:l,containerStyle:s.tile,style:s.tileInner,onPress:()=>i(e),children:[
98
- /* @__PURE__ */t.jsx(n.View,{style:s.tileIconWrap,children:e==="photo"?/* @__PURE__ */t.jsx(PhotoGlyph,{size:ta,color:a.color.brandInk,strokeWidth:1.5}):/* @__PURE__ */t.jsx(CameraGlyph,{size:ta,color:a.color.brandInk,strokeWidth:1.5})}),
99
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:s.tileLabel,children:ia[e]})]},e))}),
97
+ /* @__PURE__ */t.jsx(n.View,{style:s.tilesRow,children:r.map(e=>/* @__PURE__ */t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:ca[e],accessibilityState:{disabled:l},disabled:l,containerStyle:s.tile,style:s.tileInner,onPress:()=>i(e),children:[
98
+ /* @__PURE__ */t.jsx(n.View,{style:s.tileIconWrap,children:e==="photo"?/* @__PURE__ */t.jsx(PhotoGlyph,{size:oa,color:a.color.brandInk,strokeWidth:1.5}):/* @__PURE__ */t.jsx(CameraGlyph,{size:oa,color:a.color.brandInk,strokeWidth:1.5})}),
99
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:s.tileLabel,children:ca[e]})]},e))}),
100
100
  /* @__PURE__ */t.jsx(n.View,{style:s.tail}),
101
- /* @__PURE__ */t.jsx(n.View,{style:s.tailFill})]})]})}function oa(e){let t=e.color,r=e.radius;return n.StyleSheet.create({anchor:{position:"absolute",left:0,right:0,bottom:"100%",paddingHorizontal:8,paddingBottom:10,alignItems:"flex-start"},dismissLayer:{position:"absolute",left:-1e3,right:-1e3,top:-2e3,bottom:0},bubble:{backgroundColor:t.surfaceCream,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:6,paddingVertical:8,shadowColor:t.shadow,shadowOpacity:ra,shadowRadius:na,shadowOffset:{width:0,height:la},elevation:8},tilesRow:{flexDirection:"row",alignItems:"stretch"},tile:{minWidth:Xo,borderRadius:r.md},tileInner:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:10,paddingVertical:8,gap:6},tileIconWrap:{width:ea,height:ea,borderRadius:ea/2,backgroundColor:t.brandSoft,alignItems:"center",justifyContent:"center"},tileLabel:{...face(e,"medium"),fontSize:12,lineHeight:14,color:t.text.primary},tail:{position:"absolute",left:24,bottom:-Jo/2,width:Jo,height:Jo,backgroundColor:t.surfaceCream,borderRightWidth:1,borderBottomWidth:1,borderColor:t.brandBorderStrong,transform:[{rotate:"45deg"}]},tailFill:{position:"absolute",left:22,bottom:0,width:Jo+4,height:2,backgroundColor:t.surfaceCream}})}function parseColor(e){let t=aa(e);return t===null?null:ha(t)}function aa(e){if(typeof e=="number")return ca(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return sa(t.slice(1));if(t.toLowerCase().startsWith("0x"))return sa(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return ua(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=sa(t);if(e!==null)return e}return/^\d+$/.test(t)?ca(Number.parseInt(t,10)):null}function sa(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:pa(t[0]),g:pa(t[1]),b:pa(t[2]),a:1};if(t.length===6)return{r:da(t,0),g:da(t,2),b:da(t,4),a:1};if(t.length===8){let e=da(t,0);return{r:da(t,2),g:da(t,4),b:da(t,6),a:e/255}}return null}function ua(e){let t=e.indexOf("("),r=e.indexOf(")");if(t<0||r<0||r<t)return null;let n=e.slice(t+1,r).split(",").map(e=>e.trim());if(n.length<3)return null;let l=fa(Number(n[0])),i=fa(Number(n[1])),o=fa(Number(n[2]));if(l===null||i===null||o===null)return null;let a=1;if(n.length>=4){let e=Number(n[3]);if(!Number.isFinite(e))return null;a=Math.min(1,Math.max(0,e))}return{r:l,g:i,b:o,a:a}}function ca(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,r=t>>>24&255;return{r:t>>>16&255,g:t>>>8&255,b:t&255,a:r===0?1:r/255}}function da(e,t){return Number.parseInt(e.slice(t,t+2),16)}function pa(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function fa(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function ha(e){if(e.a>=1)return ba(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function ba(e,t,r){return`#${ga(e)}${ga(t)}${ga(r)}`.toUpperCase()}function ga(e){return e.toString(16).padStart(2,"0")}var ma="#111111",ya="#FFFFFF",va="#000000";function readableOn(e){let t=aa(e);if(t===null)return ya;let r=ka(t),n=ka({r:17,g:17,b:17}),l=ka({r:255,g:255,b:255});return Ca(r,l)>=Ca(r,n)?ya:ma}function xa(e,t){let r=readableOn(e);return contrastRatio(r,e)>=t?r:contrastRatio(ya,e)>=contrastRatio(va,e)?ya:va}function wa(e){let t=t=>e.reduce((e,r)=>Math.min(e,contrastRatio(t,r)),Number.POSITIVE_INFINITY);return t(ya)>=t(va)?ya:va}function ka(e){let t=Sa(e.r/255),r=Sa(e.g/255),n=Sa(e.b/255);return.2126*t+.7152*r+.0722*n}function Sa(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ca(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}function contrastRatio(e,t){let r=aa(e),n=aa(t);if(r===null||n===null)return 1;let l=n.a>=1?n:{...n},i=r.a>=1?r:ja(r,l);return Ca(ka(i),ka(l))}function ja(e,t){let r=e.a,n=(e,t)=>Math.round(e*r+t*(1-r));return{r:n(e.r,t.r),g:n(e.g,t.g),b:n(e.b,t.b),a:1}}function Ra(e,t){let r=aa(e),n=aa(t);if(r===null||n===null)return null;let l=r.a>=1?r:ja(r,{...n});return ba(l.r,l.g,l.b)}function Ta(e,t){let r=aa(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return`rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}var _a=.05;function za(e,t,r,n){let l=t[0];if(l===void 0)return r;let i=e=>t.every(t=>contrastRatio(e,t)>=n);if(aa(e)===null)return r;if(i(e))return e;let o=Ra(e,l),a=o===null?null:aa(o),s=aa(r);if(a===null||s===null)return r;for(let e=1;e<1/_a;e+=1){let t=e*_a,r=(e,r)=>Math.round(e+(r-e)*t),n=ba(r(a.r,s.r),r(a.g,s.g),r(a.b,s.b));if(i(n))return n}return r}var Ia=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});var Pa=56,Ea=12,Ma=14,Fa=10,Aa=.45,La="rgba(7,193,104,0.55)",Oa="rgba(185,28,28,0.55)",Va=200,Da=300,Ba=20,Ha=22,Wa=12,Na="rgba(0,0,0,0.78)",Ua=220,$a=100,qa="rgba(255,255,255,0.15)";function AttachmentStrip({attachments:r,rejected:l,uploadFailed:i=false,onRetry:o,onRemove:a,onPreview:s,style:u}){let c=useEverfurTheme(),d=e.useMemo(()=>Ga(c),[c]);return r.length===0&&l===null?null:/* @__PURE__ */t.jsxs(n.View,{style:[d.strip,u],children:[r.length>0?/* @__PURE__ */t.jsx(n.View,{style:d.cards,children:r.map(e=>/* @__PURE__ */t.jsx(PreviewCard,{row:e,styles:d,onRetry:o,onRemove:a,onPreview:s},e.id))}):null,i?/* @__PURE__ */t.jsx(Text,{style:d.rejected,accessibilityRole:"alert",children:pe.attachmentsFailedBlocked}):null,l!==null?/* @__PURE__ */t.jsx(Text,{style:d.rejected,accessibilityRole:"alert",children:Do(l)}):null]})}function PreviewCard({row:r,styles:l,onRetry:i,onRemove:o,onPreview:a}){let s=useEverfurTheme(),u=r.status==="uploading",c=r.status==="failed",d=r.status==="uploaded",p=e.useRef(r.status),[f,h]=e.useState(false);return e.useEffect(()=>{let e=p.current;p.current=r.status,r.status==="uploaded"&&e==="uploading"&&h(true)},[r.status]),/* @__PURE__ */t.jsxs(n.View,{style:l.card,children:[
101
+ /* @__PURE__ */t.jsx(n.View,{style:s.tailFill})]})]})}function da(e){let t=e.color,r=e.radius;return n.StyleSheet.create({anchor:{position:"absolute",left:0,right:0,bottom:"100%",paddingHorizontal:8,paddingBottom:10,alignItems:"flex-start"},dismissLayer:{position:"absolute",left:-1e3,right:-1e3,top:-2e3,bottom:0},bubble:{backgroundColor:t.surfaceCream,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:6,paddingVertical:8,shadowColor:t.shadow,shadowOpacity:aa,shadowRadius:sa,shadowOffset:{width:0,height:ua},elevation:8},tilesRow:{flexDirection:"row",alignItems:"stretch"},tile:{minWidth:la,borderRadius:r.md},tileInner:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:10,paddingVertical:8,gap:6},tileIconWrap:{width:ia,height:ia,borderRadius:ia/2,backgroundColor:t.brandSoft,alignItems:"center",justifyContent:"center"},tileLabel:{...face(e,"medium"),fontSize:12,lineHeight:14,color:t.text.primary},tail:{position:"absolute",left:24,bottom:-na/2,width:na,height:na,backgroundColor:t.surfaceCream,borderRightWidth:1,borderBottomWidth:1,borderColor:t.brandBorderStrong,transform:[{rotate:"45deg"}]},tailFill:{position:"absolute",left:22,bottom:0,width:na+4,height:2,backgroundColor:t.surfaceCream}})}function parseColor(e){let t=pa(e);return t===null?null:va(t)}function pa(e){if(typeof e=="number")return ba(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return fa(t.slice(1));if(t.toLowerCase().startsWith("0x"))return fa(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return ha(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=fa(t);if(e!==null)return e}return/^\d+$/.test(t)?ba(Number.parseInt(t,10)):null}function fa(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:ma(t[0]),g:ma(t[1]),b:ma(t[2]),a:1};if(t.length===6)return{r:ga(t,0),g:ga(t,2),b:ga(t,4),a:1};if(t.length===8){let e=ga(t,0);return{r:ga(t,2),g:ga(t,4),b:ga(t,6),a:e/255}}return null}function ha(e){let t=e.indexOf("("),r=e.indexOf(")");if(t<0||r<0||r<t)return null;let n=e.slice(t+1,r).split(",").map(e=>e.trim());if(n.length<3)return null;let l=ya(Number(n[0])),i=ya(Number(n[1])),o=ya(Number(n[2]));if(l===null||i===null||o===null)return null;let a=1;if(n.length>=4){let e=Number(n[3]);if(!Number.isFinite(e))return null;a=Math.min(1,Math.max(0,e))}return{r:l,g:i,b:o,a:a}}function ba(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,r=t>>>24&255;return{r:t>>>16&255,g:t>>>8&255,b:t&255,a:r===0?1:r/255}}function ga(e,t){return Number.parseInt(e.slice(t,t+2),16)}function ma(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function ya(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function va(e){if(e.a>=1)return xa(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function xa(e,t,r){return`#${wa(e)}${wa(t)}${wa(r)}`.toUpperCase()}function wa(e){return e.toString(16).padStart(2,"0")}var ka="#111111",Sa="#FFFFFF",Ca="#000000";function readableOn(e){let t=pa(e);if(t===null)return Sa;let r=Ta(t),n=Ta({r:17,g:17,b:17}),l=Ta({r:255,g:255,b:255});return za(r,l)>=za(r,n)?Sa:ka}function ja(e,t){let r=readableOn(e);return contrastRatio(r,e)>=t?r:contrastRatio(Sa,e)>=contrastRatio(Ca,e)?Sa:Ca}function Ra(e){let t=t=>e.reduce((e,r)=>Math.min(e,contrastRatio(t,r)),Number.POSITIVE_INFINITY);return t(Sa)>=t(Ca)?Sa:Ca}function Ta(e){let t=_a(e.r/255),r=_a(e.g/255),n=_a(e.b/255);return.2126*t+.7152*r+.0722*n}function _a(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function za(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}function contrastRatio(e,t){let r=pa(e),n=pa(t);if(r===null||n===null)return 1;let l=n.a>=1?n:{...n},i=r.a>=1?r:Ia(r,l);return za(Ta(i),Ta(l))}function Ia(e,t){let r=e.a,n=(e,t)=>Math.round(e*r+t*(1-r));return{r:n(e.r,t.r),g:n(e.g,t.g),b:n(e.b,t.b),a:1}}function Pa(e,t){let r=pa(e),n=pa(t);if(r===null||n===null)return null;let l=r.a>=1?r:Ia(r,{...n});return xa(l.r,l.g,l.b)}function Ea(e,t){let r=pa(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return`rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}var Ma=.05;function Fa(e,t,r,n){let l=t[0];if(l===void 0)return r;let i=e=>t.every(t=>contrastRatio(e,t)>=n);if(pa(e)===null)return r;if(i(e))return e;let o=Pa(e,l),a=o===null?null:pa(o),s=pa(r);if(a===null||s===null)return r;for(let e=1;e<1/Ma;e+=1){let t=e*Ma,r=(e,r)=>Math.round(e+(r-e)*t),n=xa(r(a.r,s.r),r(a.g,s.g),r(a.b,s.b));if(i(n))return n}return r}var Aa=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});var La=56,Oa=12,Va=14,Da=10,Ba=.45,Ha="rgba(7,193,104,0.55)",Wa="rgba(185,28,28,0.55)",Na=200,Ua=300,$a=20,qa=22,Ga=12,Ka="rgba(0,0,0,0.78)",Ya=220,Qa=100,Za="rgba(255,255,255,0.15)";function AttachmentStrip({attachments:r,rejected:l,uploadFailed:i=false,onRetry:o,onRemove:a,onPreview:s,style:u}){let c=useEverfurTheme(),d=e.useMemo(()=>Ja(c),[c]);return r.length===0&&l===null?null:/* @__PURE__ */t.jsxs(n.View,{style:[d.strip,u],children:[r.length>0?/* @__PURE__ */t.jsx(n.View,{style:d.cards,children:r.map(e=>/* @__PURE__ */t.jsx(PreviewCard,{row:e,styles:d,onRetry:o,onRemove:a,onPreview:s},e.id))}):null,i?/* @__PURE__ */t.jsx(Text,{style:d.rejected,accessibilityRole:"alert",children:pe.attachmentsFailedBlocked}):null,l!==null?/* @__PURE__ */t.jsx(Text,{style:d.rejected,accessibilityRole:"alert",children:Uo(l)}):null]})}function PreviewCard({row:r,styles:l,onRetry:i,onRemove:o,onPreview:a}){let s=useEverfurTheme(),u=r.status==="uploading",c=r.status==="failed",d=r.status==="uploaded",p=e.useRef(r.status),[f,h]=e.useState(false);return e.useEffect(()=>{let e=p.current;p.current=r.status,r.status==="uploaded"&&e==="uploading"&&h(true)},[r.status]),/* @__PURE__ */t.jsxs(n.View,{style:l.card,children:[
102
102
  /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:d?"button":"image",accessibilityLabel:d?fe(pe.previewAttachment,{filename:r.filename}):r.filename,accessibilityState:{busy:u,disabled:!d},disabled:!d,style:l.thumbHit,onPress:()=>a(r),children:/* @__PURE__ */t.jsxs(n.View,{style:l.thumb,children:[
103
- /* @__PURE__ */t.jsx(n.Image,{source:{uri:r.previewUri},style:l.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),u?/* @__PURE__ */t.jsx(n.View,{style:l.uploadingOverlay,children:/* @__PURE__ */t.jsx(n.ActivityIndicator,{size:"small",color:s.color.surface})}):null,f?/* @__PURE__ */t.jsx(SuccessFlash,{styles:l,onDone:()=>h(false)}):null]})}),c?/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:fe(pe.retryUpload,{filename:r.filename}),style:l.failedOverlay,onPress:()=>i(r.id),children:/* @__PURE__ */t.jsx(n.View,{style:l.failedInner,children:/* @__PURE__ */t.jsx(CloseGlyph,{size:Ba,color:s.color.surface,strokeWidth:2})})}):null,
104
- /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:fe(pe.removeAttachment,{filename:r.filename}),hitSlop:6,containerStyle:l.removeSlot,style:l.removeButton,onPress:()=>o(r.id),children:/* @__PURE__ */t.jsx(CloseGlyph,{size:Wa,color:s.color.surface,strokeWidth:1.5})})]})}function SuccessFlash({styles:r,onDone:l}){let i=useEverfurTheme(),o=Di(),a=e.useRef(null);a.current===null&&(a.current=new n.Animated.Value(0));let s=a.current;return e.useEffect(()=>{let e=n.Animated.sequence([n.Animated.timing(s,{toValue:1,duration:Va,useNativeDriver:true}),n.Animated.delay(o.uploadFlashMs),n.Animated.timing(s,{toValue:0,duration:Da,useNativeDriver:true})]);return e.start(({finished:e})=>{e&&l()}),()=>e.stop()},[s,o.uploadFlashMs,l]),/* @__PURE__ */t.jsx(n.Animated.View,{pointerEvents:"none",style:[r.successOverlay,{opacity:s}],children:/* @__PURE__ */t.jsx(CheckGlyph,{size:Ba,color:i.color.surface,strokeWidth:2})})}function SentImages({images:r,onPreview:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Ga(i),[i]);if(r.length===0)return null;let a=r.length===1;/* @__PURE__ */
105
- return t.jsx(n.View,{style:a?o.sentSingle:o.sentGrid,children:r.map((e,r)=>/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:fe(pe.attachedImage,{filename:e.filename}),onPress:()=>l(e),children:/* @__PURE__ */t.jsx(n.Image,{source:{uri:e.uri},style:a?o.singleImage:o.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${e.uri}-${r}`))})}function Ga(e){let t=e.color,r=e.type;return n.StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:Pa,height:Pa,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:Ea,overflow:"hidden",backgroundColor:t.composerFill,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...Ia,alignItems:"center",justifyContent:"center",backgroundColor:Ta(e.color.brandInk,Aa)??e.color.brandSofter},successOverlay:{...Ia,alignItems:"center",justifyContent:"center",backgroundColor:La},failedOverlay:{...Ia,borderRadius:Ea,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:Oa},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:Ha,height:Ha,borderRadius:Ha/2,backgroundColor:Na,borderWidth:1.5,borderColor:t.surface,alignItems:"center",justifyContent:"center"},rejected:{...face(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:Ua,height:Ua,borderRadius:Ma,backgroundColor:qa},gridImage:{width:$a,height:$a,borderRadius:Fa,backgroundColor:qa}})}var Ka="file",Ya="multipart upload failed";function Qa(e){let t;try{t=new FormData;for(let[r,n]of Object.entries(e.fields))t.append(r,n);t.append(Ka,e.file)}catch{return Promise.reject(new Error(Ya))}return e.fetch!==void 0?Xa(e.fetch,e.url,t,e.signal):Ja(e.url,t,e.signal)}function Za(e){return e>=200&&e<300}function Ja(e,t,r){return new Promise((n,l)=>{let i=globalThis.XMLHttpRequest;if(typeof i!="function"||r?.aborted===true){l(new Error(Ya));return}let o=null,a=()=>{o!==null&&r?.removeEventListener("abort",o)},s=()=>{a(),l(new Error(Ya))};try{let l=new i;l.open("POST",e),l.withCredentials=!1,l.onload=()=>{a(),n(Za(l.status))},l.onerror=s,l.ontimeout=s,l.onabort=s,r!==void 0&&(o=()=>{try{l.abort()}finally{s()}},r.addEventListener("abort",o,{once:!0})),l.send(t)}catch{s()}})}function Xa(e,t,r,n){return Promise.resolve().then(()=>e(t,{method:"POST",body:r,credentials:"omit",...n?{signal:n}:{}})).then(e=>e.ok)}var es="chat attachment upload: the file handle has no uri",ts="chat attachment upload failed";function rs(e){return{uri:e.uri,name:sanitizeFilename(e.name),type:e.mimeType}}function createRnChatAttachmentTransport(e={}){/* @__PURE__ */
106
- return Object.freeze({postMultipart(t,r,n){if(typeof r.uri!="string"||r.uri.length===0)return Promise.reject(new Error(es));let{signal:l,onProgress:i}=n,o=()=>Promise.reject(new Error(ts));return l?.aborted===true?o():Qa({url:t.upload_url,fields:t.upload_fields,file:rs(r),signal:l,fetch:e.fetch}).then(e=>{if(!e)return o();i?.(1)},o)}})}var ns=300,ls=3e3,is=120,os=44,as=120,ss="88%",us=520,cs=2,ds=.5,ps=1.5,fs=1.6,hs=.6,bs=56,gs=1.5,ms=5,ys=5,vs=36,xs=20,ws=14,ks=os,Ss=4,Cs=24,js=22,Rs=.4,Ts=os,_s=20,zs=.4,Is=480,Ps=12,Es=.72,Ms=48,Fs=1.5,As=1.3,Ls=1,Os=1,Vs=12,Ds=18,Bs=1.5,Hs="12%",Ws=14,Ns=16,Us=28,$s=18,qs="84%",Gs=10,Ks=15,Ys=1.42,Qs=4,Zs=3,Js=14,Xs=20;function eu(){let t=useEverfurTheme(),r=e.useMemo(()=>tu(t),[t]);return{theme:t,styles:r}}function tu(e){let t=e.color,r=e.space,l=e.radius,i=e.type,o=Math.round(i.size.body*ps),a=Math.round(i.size.body*fs),s=Math.round(xs*i.size.body/ws),u=t.borderRingCream,c=e.slots;return n.StyleSheet.create({container:{flex:1,minHeight:is,backgroundColor:t.chatGround},body:{flex:1},centered:{minHeight:is,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},homeEmpty:{flexGrow:1},emptyContent:{flexGrow:1,alignItems:"stretch",justifyContent:"flex-start",paddingTop:Hs,paddingHorizontal:r.lg,paddingBottom:r.lg,minHeight:Is,gap:r.lg},errorText:{...face(e,"regular"),fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.snug,color:t.danger,textAlign:"center",marginBottom:r.md},retryButton:{minHeight:os,minWidth:os,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:l.pill,backgroundColor:t.brand,...ho(c.primaryButton)},retryLabel:{...face(e,"medium"),color:t.onPrimary,fontSize:i.size.body,...go(c.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.sm,backgroundColor:t.surfaceCream},setupNoticeText:{...face(e,"regular"),color:t.danger,fontSize:i.size.caption,flexShrink:1},turnNotice:{gap:r.xs,padding:r.md,borderRadius:l.md,backgroundColor:t.surfaceCream,borderWidth:Os,borderColor:t.borderRingCream,alignItems:"flex-start"},turnNoticeError:{borderColor:t.danger},turnNoticeTitle:{...face(e,"bold"),color:t.text.primary,fontSize:i.size.bodyTight},turnNoticeTitleError:{color:t.danger},turnNoticeBody:{...face(e,"regular"),color:t.text.muted,fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.normal},turnNoticeAction:{minHeight:os,justifyContent:"center"},turnNoticeActionLabel:{...face(e,"bold"),color:t.brandInk,fontSize:i.size.bodyTight},setupNoticeAction:{...face(e,"medium"),color:t.brandInk,fontSize:i.size.caption},reconnectingCaption:{...face(e,"medium"),color:t.text.secondary,fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},readingBox:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingVertical:r.md,paddingHorizontal:r.md+r.xs/2,backgroundColor:t.surfaceSubtle,borderRadius:l.md},readingDot:{width:6,height:6,borderRadius:l.pill,backgroundColor:t.brandInk},readingInline:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:Zs,minHeight:Js},readingDotInline:{width:Qs,height:Qs,borderRadius:l.pill,backgroundColor:t.text.muted},list:{flex:1},earlierButton:{alignSelf:"center",minHeight:os,justifyContent:"center",paddingHorizontal:r.md+r.xs/2},earlierLabel:{...face(e,"monoBold"),color:t.linkInk,fontSize:i.size.caption},listContent:{padding:r.lg,gap:r.xl},listContentCards:{paddingTop:Ws,paddingHorizontal:Ns,paddingBottom:Us,gap:$s},rowBlock:{gap:r.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:r.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:ss,alignItems:"flex-start"},bubbleSideUser:{alignItems:"flex-end"},bubbleUser:{maxWidth:us,paddingVertical:r.md,paddingHorizontal:r.lg+cs,backgroundColor:t.bubbleUser,...t.primaryEdge!==t.primary&&t.bubbleUser===t.primary?{borderWidth:ds,borderColor:t.primaryEdge}:{},borderRadius:l.lg,borderBottomRightRadius:l.xs,...ho(c.userBubble,ds)},bubbleAssistant:c.assistantBubble?.backgroundColor===void 0?{...ho(c.assistantBubble,ds)}:{paddingVertical:r.md,paddingHorizontal:r.lg+cs,borderRadius:l.lg,...ho(c.assistantBubble,ds)},bubbleVet:{maxWidth:us,paddingVertical:r.md,paddingHorizontal:r.lg+cs,backgroundColor:t.bubbleVet,borderRadius:l.lg,borderTopLeftRadius:l.xs,...ho(c.vetBubble,ds)},bubbleCards:{maxWidth:qs},bubbleUserCards:{paddingVertical:Gs,paddingHorizontal:Ks},bubbleTextUserCards:{fontSize:textRole(e,"message").fontSize,lineHeight:Math.round(textRole(e,"message").fontSize*Ys)},bubblePending:{opacity:hs},bubbleTextUser:{...face(e,"regular"),color:t.onPrimary,fontSize:i.size.body,lineHeight:o,...go(c.userBubble)},bubbleTextAssistant:{...face(e,"regular"),color:t.text.primary,fontSize:i.size.body,lineHeight:a,...go(c.assistantBubble)},bubbleTextVet:{...face(e,"regular"),color:t.onBubbleVet,fontSize:i.size.body,lineHeight:o,...go(c.vetBubble)},assistantName:{...face(e,"bold"),color:t.brandInk,fontSize:i.size.bodyTight,marginBottom:r.xs},assistantSender:{flexDirection:"row",alignItems:"center",gap:r.sm,marginBottom:r.xs},assistantAvatar:{width:Xs,height:Xs,borderRadius:Xs/2},assistantNameInRow:{marginBottom:0},vetHeader:{flexDirection:"row",alignItems:"baseline",gap:r.sm,marginBottom:r.xs},vetSender:{...face(e,"bold"),color:t.text.primary,fontSize:i.size.bodyTight},vetTime:{...face(e,"regular"),color:t.text.muted,fontSize:i.size.caption},bubbleBold:face(e,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:face(e,"mono"),followUps:{alignSelf:"stretch",marginTop:r.md},followUpsHeading:{...face(e,"monoBold"),color:t.text.muted,fontSize:Ps,textTransform:"uppercase",letterSpacing:Es,paddingBottom:r.sm,borderBottomWidth:Ls,borderBottomColor:u},followUpSlot:{alignSelf:"stretch"},followUpSlotRuled:{borderTopWidth:Ls,borderTopColor:u},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.md,minHeight:Ms,paddingVertical:r.sm+cs,...c.chip?.backgroundColor!==void 0||c.chip?.borderColor!==void 0?{paddingHorizontal:r.md}:{},...ho(c.chip)},followUpText:{...face(e,"bold"),flex:1,color:t.brandInk,fontSize:i.size.bodyTight,...go(c.chip)},askChips:{flexDirection:"row",flexWrap:"wrap",gap:r.sm,marginTop:r.md},askChip:{minHeight:os,maxWidth:"100%",justifyContent:"center",paddingVertical:r.sm,paddingHorizontal:r.lg,borderRadius:l.pill,borderWidth:Fs,borderColor:t.brandInk,backgroundColor:t.chatGround,...ho(c.chip,Fs)},askChipText:{...face(e,"bold"),color:t.brandInk,fontSize:i.size.bodyTight,lineHeight:Math.round(i.size.bodyTight*As),...go(c.chip)},composerOuter:{position:"relative"},askEntry:{marginHorizontal:r.md,marginTop:r.xs},composer:{marginHorizontal:r.md,marginTop:r.xs,minHeight:bs,justifyContent:"center",paddingLeft:r.sm,paddingRight:ms,paddingVertical:ys,backgroundColor:t.composerFill,borderWidth:gs,borderColor:t.composerBorder,borderRadius:l.pill,...ho(c.composerInput,gs)},composerRow:{flexDirection:"row",alignItems:"center",gap:r.xs,minHeight:vs},dictationError:{...face(e,"regular"),fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.normal,color:t.danger,paddingHorizontal:r.xs},attachControl:{width:Ts,height:Ts,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:zs},input:{flex:1,minHeight:vs,maxHeight:as,paddingHorizontal:0,paddingVertical:0,...face(e,"regular"),fontSize:i.size.body,lineHeight:s,color:t.text.primary,...go(c.composerInput)},sendControl:{minHeight:ks,minWidth:ks,alignItems:"center",justifyContent:"center"},sendDisc:{width:ks,height:ks,borderRadius:ks/2,alignItems:"center",justifyContent:"center",...ho(c.sendButton)},sendControlDisabled:{opacity:Rs},footnote:{...face(e,"regular"),color:t.text.muted,fontSize:Vs,lineHeight:Ds,textAlign:"center",marginTop:r.sm,marginBottom:r.xs,paddingHorizontal:r.lg},footnoteInThread:{...face(e,"regular"),color:t.text.muted,fontSize:i.size.caption,lineHeight:Math.round(i.size.caption*Bs),textAlign:"left",marginTop:r.md,marginBottom:r.sm,paddingHorizontal:r.xs},poweredBy:{...face(e,"regular"),color:t.text.muted,fontSize:i.size.micro,textAlign:"center",paddingBottom:r.xs}})}var ru=18,nu=28,lu=6,iu=1200,ou=.4,au=.4;function DictationButton({active:r,listening:l,elapsedMs:i,disabled:o=false,onToggle:a}){let s=useEverfurTheme(),u=e.useMemo(()=>su(s),[s]);return e.useEffect(()=>{if(l)try{n.AccessibilityInfo.announceForAccessibility(pe.listening)}catch{}},[l]),/* @__PURE__ */t.jsxs(n.View,{style:u.wrap,children:[l?/* @__PURE__ */t.jsx(Text,{style:u.timer,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:"everfur-dictation-timer",children:Uo(i)}):null,
103
+ /* @__PURE__ */t.jsx(n.Image,{source:{uri:r.previewUri},style:l.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),u?/* @__PURE__ */t.jsx(n.View,{style:l.uploadingOverlay,children:/* @__PURE__ */t.jsx(n.ActivityIndicator,{size:"small",color:s.color.surface})}):null,f?/* @__PURE__ */t.jsx(SuccessFlash,{styles:l,onDone:()=>h(false)}):null]})}),c?/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:fe(pe.retryUpload,{filename:r.filename}),style:l.failedOverlay,onPress:()=>i(r.id),children:/* @__PURE__ */t.jsx(n.View,{style:l.failedInner,children:/* @__PURE__ */t.jsx(CloseGlyph,{size:$a,color:s.color.surface,strokeWidth:2})})}):null,
104
+ /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:fe(pe.removeAttachment,{filename:r.filename}),hitSlop:6,containerStyle:l.removeSlot,style:l.removeButton,onPress:()=>o(r.id),children:/* @__PURE__ */t.jsx(CloseGlyph,{size:Ga,color:s.color.surface,strokeWidth:1.5})})]})}function SuccessFlash({styles:r,onDone:l}){let i=useEverfurTheme(),o=Ui(),a=e.useRef(null);a.current===null&&(a.current=new n.Animated.Value(0));let s=a.current;return e.useEffect(()=>{let e=n.Animated.sequence([n.Animated.timing(s,{toValue:1,duration:Na,useNativeDriver:true}),n.Animated.delay(o.uploadFlashMs),n.Animated.timing(s,{toValue:0,duration:Ua,useNativeDriver:true})]);return e.start(({finished:e})=>{e&&l()}),()=>e.stop()},[s,o.uploadFlashMs,l]),/* @__PURE__ */t.jsx(n.Animated.View,{pointerEvents:"none",style:[r.successOverlay,{opacity:s}],children:/* @__PURE__ */t.jsx(CheckGlyph,{size:$a,color:i.color.surface,strokeWidth:2})})}function SentImages({images:r,onPreview:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Ja(i),[i]);if(r.length===0)return null;let a=r.length===1;/* @__PURE__ */
105
+ return t.jsx(n.View,{style:a?o.sentSingle:o.sentGrid,children:r.map((e,r)=>/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:fe(pe.attachedImage,{filename:e.filename}),onPress:()=>l(e),children:/* @__PURE__ */t.jsx(n.Image,{source:{uri:e.uri},style:a?o.singleImage:o.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${e.uri}-${r}`))})}function Ja(e){let t=e.color,r=e.type;return n.StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:La,height:La,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:Oa,overflow:"hidden",backgroundColor:t.composerFill,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...Aa,alignItems:"center",justifyContent:"center",backgroundColor:Ea(e.color.brandInk,Ba)??e.color.brandSofter},successOverlay:{...Aa,alignItems:"center",justifyContent:"center",backgroundColor:Ha},failedOverlay:{...Aa,borderRadius:Oa,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:Wa},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:qa,height:qa,borderRadius:qa/2,backgroundColor:Ka,borderWidth:1.5,borderColor:t.surface,alignItems:"center",justifyContent:"center"},rejected:{...face(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:Ya,height:Ya,borderRadius:Va,backgroundColor:Za},gridImage:{width:Qa,height:Qa,borderRadius:Da,backgroundColor:Za}})}var Xa="file",es="multipart upload failed";function ts(e){let t;try{t=new FormData;for(let[r,n]of Object.entries(e.fields))t.append(r,n);t.append(Xa,e.file)}catch{return Promise.reject(new Error(es))}return e.fetch!==void 0?ls(e.fetch,e.url,t,e.signal):ns(e.url,t,e.signal)}function rs(e){return e>=200&&e<300}function ns(e,t,r){return new Promise((n,l)=>{let i=globalThis.XMLHttpRequest;if(typeof i!="function"||r?.aborted===true){l(new Error(es));return}let o=null,a=()=>{o!==null&&r?.removeEventListener("abort",o)},s=()=>{a(),l(new Error(es))};try{let l=new i;l.open("POST",e),l.withCredentials=!1,l.onload=()=>{a(),n(rs(l.status))},l.onerror=s,l.ontimeout=s,l.onabort=s,r!==void 0&&(o=()=>{try{l.abort()}finally{s()}},r.addEventListener("abort",o,{once:!0})),l.send(t)}catch{s()}})}function ls(e,t,r,n){return Promise.resolve().then(()=>e(t,{method:"POST",body:r,credentials:"omit",...n?{signal:n}:{}})).then(e=>e.ok)}var is="chat attachment upload: the file handle has no uri",os="chat attachment upload failed";function as(e){return{uri:e.uri,name:sanitizeFilename(e.name),type:e.mimeType}}function createRnChatAttachmentTransport(e={}){/* @__PURE__ */
106
+ return Object.freeze({postMultipart(t,r,n){if(typeof r.uri!="string"||r.uri.length===0)return Promise.reject(new Error(is));let{signal:l,onProgress:i}=n,o=()=>Promise.reject(new Error(os));return l?.aborted===true?o():ts({url:t.upload_url,fields:t.upload_fields,file:as(r),signal:l,fetch:e.fetch}).then(e=>{if(!e)return o();i?.(1)},o)}})}var ss=300,us=3e3,cs=120,ds=44,ps=120,fs="88%",hs=520,bs=2,gs=.5,ms=1.5,ys=1.6,vs=.6,xs=56,ws=1.5,ks=5,Ss=5,Cs=36,js=20,Rs=14,Ts=ds,_s=4,zs=24,Is=22,Ps=.4,Es=ds,Ms=20,Fs=.4,As=480,Ls=12,Os=.72,Vs=48,Ds=1.5,Bs=1.3,Hs=1,Ws=1,Ns="12%",Us=14,$s=16,qs=28,Gs=18,Ks="84%",Ys=10,Qs=15,Zs=1.42,Js=4,Xs=3,eu=14,tu=20;function ru(){let t=useEverfurTheme(),r=e.useMemo(()=>nu(t),[t]);return{theme:t,styles:r}}function nu(e){let t=e.color,r=e.space,l=e.radius,i=e.type,o=Math.round(i.size.body*ms),a=Math.round(i.size.body*ys),s=Math.round(js*i.size.body/Rs),u=t.borderRingCream,c=e.slots;return n.StyleSheet.create({container:{flex:1,minHeight:cs,backgroundColor:t.chatGround},body:{flex:1},centered:{minHeight:cs,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},homeEmpty:{flexGrow:1},emptyContent:{flexGrow:1,alignItems:"stretch",justifyContent:"flex-start",paddingTop:Ns,paddingHorizontal:r.lg,paddingBottom:r.lg,minHeight:As,gap:r.lg},errorText:{...face(e,"regular"),fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.snug,color:t.danger,textAlign:"center",marginBottom:r.md},retryButton:{minHeight:ds,minWidth:ds,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:l.pill,backgroundColor:t.brand,...vo(c.primaryButton)},retryLabel:{...face(e,"medium"),color:t.onPrimary,fontSize:i.size.body,...wo(c.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.sm,backgroundColor:t.surfaceCream},setupNoticeText:{...face(e,"regular"),color:t.danger,fontSize:i.size.caption,flexShrink:1},turnNotice:{gap:r.xs,padding:r.md,borderRadius:l.md,backgroundColor:t.surfaceCream,borderWidth:Ws,borderColor:t.borderRingCream,alignItems:"flex-start"},turnNoticeError:{borderColor:t.danger},turnNoticeTitle:{...face(e,"bold"),color:t.text.primary,fontSize:i.size.bodyTight},turnNoticeTitleError:{color:t.danger},turnNoticeBody:{...face(e,"regular"),color:t.text.muted,fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.normal},turnNoticeAction:{minHeight:ds,justifyContent:"center"},turnNoticeActionLabel:{...face(e,"bold"),color:t.brandInk,fontSize:i.size.bodyTight},setupNoticeAction:{...face(e,"medium"),color:t.brandInk,fontSize:i.size.caption},reconnectingCaption:{...face(e,"medium"),color:t.text.secondary,fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},readingBox:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingVertical:r.md,paddingHorizontal:r.md+r.xs/2,backgroundColor:t.surfaceSubtle,borderRadius:l.md},readingDot:{width:6,height:6,borderRadius:l.pill,backgroundColor:t.brandInk},readingInline:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:Xs,minHeight:eu},readingDotInline:{width:Js,height:Js,borderRadius:l.pill,backgroundColor:t.text.muted},list:{flex:1},earlierButton:{alignSelf:"center",minHeight:ds,justifyContent:"center",paddingHorizontal:r.md+r.xs/2},earlierLabel:{...face(e,"monoBold"),color:t.linkInk,fontSize:i.size.caption},listContent:{padding:r.lg,gap:r.xl},listContentCards:{paddingTop:Us,paddingHorizontal:$s,paddingBottom:qs,gap:Gs},rowBlock:{gap:r.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:r.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:fs,alignItems:"flex-start"},bubbleSideUser:{alignItems:"flex-end"},bubbleUser:{maxWidth:hs,paddingVertical:r.md,paddingHorizontal:r.lg+bs,backgroundColor:t.bubbleUser,...t.primaryEdge!==t.primary&&t.bubbleUser===t.primary?{borderWidth:gs,borderColor:t.primaryEdge}:{},borderRadius:l.lg,borderBottomRightRadius:l.xs,...vo(c.userBubble,gs)},bubbleAssistant:c.assistantBubble?.backgroundColor===void 0?{...vo(c.assistantBubble,gs)}:{paddingVertical:r.md,paddingHorizontal:r.lg+bs,borderRadius:l.lg,...vo(c.assistantBubble,gs)},bubbleVet:{maxWidth:hs,paddingVertical:r.md,paddingHorizontal:r.lg+bs,backgroundColor:t.bubbleVet,borderRadius:l.lg,borderTopLeftRadius:l.xs,...vo(c.vetBubble,gs)},bubbleCards:{maxWidth:Ks},bubbleUserCards:{paddingVertical:Ys,paddingHorizontal:Qs},bubbleTextUserCards:{fontSize:textRole(e,"message").fontSize,lineHeight:Math.round(textRole(e,"message").fontSize*Zs)},bubblePending:{opacity:vs},bubbleTextUser:{...face(e,"regular"),color:t.onPrimary,fontSize:i.size.body,lineHeight:o,...wo(c.userBubble)},bubbleTextAssistant:{...face(e,"regular"),color:t.text.primary,fontSize:i.size.body,lineHeight:a,...wo(c.assistantBubble)},bubbleTextVet:{...face(e,"regular"),color:t.onBubbleVet,fontSize:i.size.body,lineHeight:o,...wo(c.vetBubble)},assistantName:{...face(e,"bold"),color:t.brandInk,fontSize:i.size.bodyTight,marginBottom:r.xs},assistantSender:{flexDirection:"row",alignItems:"center",gap:r.sm,marginBottom:r.xs},assistantAvatar:{width:tu,height:tu,borderRadius:tu/2},assistantNameInRow:{marginBottom:0},vetHeader:{flexDirection:"row",alignItems:"baseline",gap:r.sm,marginBottom:r.xs},vetSender:{...face(e,"bold"),color:t.text.primary,fontSize:i.size.bodyTight},vetTime:{...face(e,"regular"),color:t.text.muted,fontSize:i.size.caption},bubbleBold:face(e,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:face(e,"mono"),followUps:{alignSelf:"stretch",marginTop:r.md},followUpsHeading:{...face(e,"monoBold"),color:t.text.muted,fontSize:Ls,textTransform:"uppercase",letterSpacing:Os,paddingBottom:r.sm,borderBottomWidth:Hs,borderBottomColor:u},followUpSlot:{alignSelf:"stretch"},followUpSlotRuled:{borderTopWidth:Hs,borderTopColor:u},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.md,minHeight:Vs,paddingVertical:r.sm+bs,...c.chip?.backgroundColor!==void 0||c.chip?.borderColor!==void 0?{paddingHorizontal:r.md}:{},...vo(c.chip)},followUpText:{...face(e,"bold"),flex:1,color:t.brandInk,fontSize:i.size.bodyTight,...wo(c.chip)},askChips:{flexDirection:"row",flexWrap:"wrap",gap:r.sm,marginTop:r.md},askChip:{minHeight:ds,maxWidth:"100%",justifyContent:"center",paddingVertical:r.sm,paddingHorizontal:r.lg,borderRadius:l.pill,borderWidth:Ds,borderColor:t.brandInk,backgroundColor:t.chatGround,...vo(c.chip,Ds)},askChipText:{...face(e,"bold"),color:t.brandInk,fontSize:i.size.bodyTight,lineHeight:Math.round(i.size.bodyTight*Bs),...wo(c.chip)},composerOuter:{position:"relative"},askEntry:{marginHorizontal:r.md,marginTop:r.xs},composer:{marginHorizontal:r.md,marginTop:r.xs,minHeight:xs,justifyContent:"center",paddingLeft:r.sm,paddingRight:ks,paddingVertical:Ss,backgroundColor:t.composerFill,borderWidth:ws,borderColor:t.composerBorder,borderRadius:l.pill,...vo(c.composerInput,ws)},composerRow:{flexDirection:"row",alignItems:"center",gap:r.xs,minHeight:Cs},dictationError:{...face(e,"regular"),fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.normal,color:t.danger,paddingHorizontal:r.xs},attachControl:{width:Es,height:Es,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:Fs},input:{flex:1,minHeight:Cs,maxHeight:ps,paddingHorizontal:0,paddingVertical:0,...face(e,"regular"),fontSize:i.size.body,lineHeight:s,color:t.text.primary,...wo(c.composerInput)},sendControl:{minHeight:Ts,minWidth:Ts,alignItems:"center",justifyContent:"center"},sendDisc:{width:Ts,height:Ts,borderRadius:Ts/2,alignItems:"center",justifyContent:"center",...vo(c.sendButton)},sendControlDisabled:{opacity:Ps},poweredBy:{...face(e,"regular"),color:t.text.muted,fontSize:i.size.micro,textAlign:"center",paddingBottom:r.xs}})}var lu=18,iu=28,ou=6,au=1200,su=.4,uu=.4;function DictationButton({active:r,listening:l,elapsedMs:i,disabled:o=false,onToggle:a}){let s=useEverfurTheme(),u=e.useMemo(()=>cu(s),[s]);return e.useEffect(()=>{if(l)try{n.AccessibilityInfo.announceForAccessibility(pe.listening)}catch{}},[l]),/* @__PURE__ */t.jsxs(n.View,{style:u.wrap,children:[l?/* @__PURE__ */t.jsx(Text,{style:u.timer,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:"everfur-dictation-timer",children:Yo(i)}):null,
107
107
  /* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>a(),disabled:o,accessibilityRole:"button",accessibilityLabel:r?pe.stopDictation:pe.dictate,accessibilityState:{selected:r,disabled:o},style:[u.button,o?u.buttonDisabled:null],testID:"everfur-dictation-button",children:r?/* @__PURE__ */t.jsxs(t.Fragment,{children:[
108
108
  /* @__PURE__ */t.jsx(Pulse,{style:u.pulse,reduced:s.motion.reducedMotion}),
109
- /* @__PURE__ */t.jsx(StopGlyph,{size:nu,color:s.color.brandInk,testID:"everfur-dictation-stop"})]}):/* @__PURE__ */t.jsx(MicGlyph,{size:ru,color:s.color.brandInk,testID:"everfur-dictation-mic"})})]})}function Pulse({style:r,reduced:l}){let i=e.useRef(new n.Animated.Value(1)).current;return e.useEffect(()=>{if(l)return;let e=n.Animated.loop(n.Animated.sequence([n.Animated.timing(i,{toValue:ou,duration:iu/2,useNativeDriver:true}),n.Animated.timing(i,{toValue:1,duration:iu/2,useNativeDriver:true})]));return e.start(),()=>e.stop()},[i,l]),/* @__PURE__ */t.jsx(n.Animated.View,{style:[r,{opacity:i}],accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"})}function su(e){let t=e.color,r=e.type.tierSizes.compact.micro;return n.StyleSheet.create({wrap:{flexDirection:"row",flexShrink:0,alignItems:"center",gap:e.space.xs},timer:{...face(e,"mono"),fontSize:r,lineHeight:r+2,fontVariant:["tabular-nums"],color:t.text.muted},button:{width:os,height:os,borderRadius:e.radius.pill,alignItems:"center",justifyContent:"center"},buttonDisabled:{opacity:au},pulse:{position:"absolute",top:lu,right:lu,bottom:lu,left:lu,borderRadius:e.radius.pill,backgroundColor:t.brandSofter}})}function optionalModule(e,t,r){let n;try{n=t()}catch(t){return cu(`optional peer '${e}' is not installed: ${du(t)}`)}let l=uu(n);return l==null?cu(`optional peer '${e}' resolved to no module`):r&&!r(l)?cu(`optional peer '${e}' is present but failed its shape check`):/* @__PURE__ */Object.freeze({available:true,module:l})}function uu(e){return typeof e=="object"&&e!==null&&"default"in e&&Object.keys(e).length<=2?e.default:e}function cu(e){/* @__PURE__ */
110
- return Object.freeze({available:false,module:null,reason:e})}function du(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}var pu=/* @__PURE__ */Symbol.for("@everfur/sdk/rn-dictation");function fu(){let e=globalThis,t=e[pu];if(t!==void 0)return t;let r={loader:null,memo:void 0};return e[pu]=r,r}function registerEverfurDictation(e){let t=fu();t.loader=e,t.memo=void 0,t.version=(t.version??0)+1;for(let e of[...t.listeners??[]])try{e()}catch{}}function hu(){return fu().version??0}function bu(e){let t=fu(),r=t.listeners??/* @__PURE__ */new Set;t.listeners=r;let n=()=>e();return r.add(n),()=>{r.delete(n)}}function gu(e){if(typeof e!="object"||e===null)return false;let t=e;return typeof t.start=="function"&&typeof t.isRecognitionAvailable=="function"&&typeof t.addListener=="function"}function mu(e){return typeof e!="object"||e===null?null:e.ExpoSpeechRecognitionModule??e}function yu(){let e=fu();if(e.memo!==void 0)return e.memo;e.memo=null;let t=e.loader;if(t===null||n.Platform.OS!=="ios"&&n.Platform.OS!=="android")return e.memo;let r=optionalModule("expo-speech-recognition",()=>({box:mu(t())}),e=>typeof e=="object"&&e!==null&&gu(e.box));return r.available&&(e.memo=r.module.box),e.memo}function vu(e){if(e===null)return false;try{return e.isRecognitionAvailable()===!0}catch{return false}}function xu(){try{return Intl.DateTimeFormat().resolvedOptions().locale||ku}catch{return ku}}function wu(e){return e.replace(/_/g,"-").toLowerCase()}var ku="en-US";function Su(e=xu()){let[t=""]=e.replace(/_/g,"-").split("-u-"),r=t.split("-");if(r[0]?.toLowerCase()!=="en")return ku;let n=r.slice(1).find(e=>/^[A-Za-z]{2}$/.test(e));return n?`en-${n.toUpperCase()}`:ku}function Cu(e,t){if(t.length===0)return null;let r=e=>t.find(t=>wu(t)===wu(e));return r(e)??r(ku)??t.find(e=>wu(e).startsWith("en-"))??null}async function ju(e,t){if(n.Platform.OS!=="ios")return t;try{let{locales:r}=await e.getSupportedLocales({});return Cu(t,r??[])??t}catch{return t}}async function Ru(e,t){let r=false;try{r=e.supportsOnDeviceRecognition()===!0}catch{r=false}if(!r)return"network";if(n.Platform.OS!=="android")return"on_device";try{let{installedLocales:r}=await e.getSupportedLocales({}),n=wu(t);return(r??[]).some(e=>wu(e)===n)?"on_device":"network"}catch{return"network"}}function Tu(){return n.Platform.OS!=="android"?true:Number(n.Platform.Version)>=_u}var _u=33;function zu(e,t,r){return{lang:t,interimResults:true,continuous:Tu(),maxAlternatives:1,addsPunctuation:true,requiresOnDeviceRecognition:e==="on_device",contextualStrings:r.slice(0,100),iosTaskHint:"dictation"}}var Iu=/* @__PURE__ */new Set(["not-allowed","no-speech","speech-timeout","aborted","interrupted"]),Pu=/* @__PURE__ */new Set(["busy","client","network","audio-capture","too-many-requests","unknown"]);function Eu(e){return Pu.has(e)}var Mu=600,Fu=3;function Au(e,t,r){if(Iu.has(r))return null;let n=Eu(r)?Mu:0;return r==="language-not-supported"&&wu(t)!==wu(ku)?{mode:"network",lang:ku,delayMs:n}:e==="on_device"?{mode:"network",lang:t,delayMs:n}:n>0?{mode:"network",lang:t,delayMs:n}:null}function Lu(e){return e==="not-allowed"?"permissionDenied":e==="no-speech"||e==="speech-timeout"?"noSpeech":"unavailable"}async function Ou(e){try{if((await e.getPermissionsAsync()).granted)return"granted"}catch{}try{return(await e.requestPermissionsAsync()).granted?"granted":"denied"}catch{return"error"}}var Vu=55e3,Du=3e3,Bu=1e3;function Hu(e){return Wu.has(e)||Eu(e)}var Wu=/* @__PURE__ */new Set(["no-speech","speech-timeout","aborted","interrupted"]),Nu=/* @__PURE__ */Object.freeze({committed:/* @__PURE__ */Object.freeze([]),interim:""});function Uu(e){return e.replace(/\s+/g," ").trim()}function $u(e,t,r){let n=Uu(t);return r?n?{committed:[...e.committed,n],interim:""}:{committed:e.committed,interim:""}:{committed:e.committed,interim:n}}function qu(e){return Uu([...e.committed,e.interim].join(" "))}function Gu(e,t,r,n=Date.now){let l=0,i=null,o=Number.NEGATIVE_INFINITY,a=e=>i!==null&&i.token===e?i:null;function s(e){for(let t of e.subscriptions)try{t.remove()}catch{}e.subscriptions=[]}function u(e){s(e),e.autoStopTimer!==null&&clearTimeout(e.autoStopTimer),e.graceTimer!==null&&clearTimeout(e.graceTimer),e.retryTimer!==null&&clearTimeout(e.retryTimer),e.autoStopTimer=null,e.graceTimer=null,e.retryTimer=null,i===e&&(i=null)}function c(e){return!e.sawStart&&e.errorCode===null&&e.pendingRetry===null&&qu(e.transcript)===""&&e.launchedAt-o<Bu}function d(e){return e.mode??"none"}function p(e,t){qo(r(),"chat_dictation_completed",{mode:d(e),duration_ms:e.startedAt===null?0:Math.max(0,n()-e.startedAt),char_count:t.length})}function f(e,n){qo(r(),"chat_dictation_failed",{mode:d(e),error:n}),t.onStatus("idle"),t.onError(n)}function h(e){if(a(e.token)===null)return;u(e);let r=qu(e.transcript),n=e.errorCode;if(n!==null&&!(r&&Hu(n))){f(e,Lu(n));return}if(!r){f(e,"noSpeech");return}p(e,r),t.onStatus("idle")}function b(l){l.subscriptions=[e.addListener("start",()=>{a(l.token)!==null&&(l.sawStart=true,l.startedAt===null&&(l.startedAt=n()),qo(r(),"chat_dictation_started",{mode:d(l)}),t.onStatus("listening"))}),e.addListener("result",e=>{if(a(l.token)===null)return;let r=e?.results?.[0]?.transcript??"";l.transcript=$u(l.transcript,r,e?.isFinal===true),t.onText(qu(l.transcript))}),e.addListener("error",e=>{if(a(l.token)===null)return;let t=e?.error??"unknown";if(l.userStopped&&(t==="aborted"||Eu(t)))return;let r=qu(l.transcript)==="",n=l.mode!==null&&!l.userStopped&&r&&l.retries<Fu?Au(l.mode,l.lang,t):null;if(n!==null){l.pendingRetry=n;return}l.errorCode===null&&(l.errorCode=t)}),e.addListener("end",()=>{if(a(l.token)!==null&&!c(l)){if(l.pendingRetry!==null){let e=l.pendingRetry;if(l.pendingRetry=null,l.retries+=1,l.lang=e.lang,e.delayMs<=0){g(l,e.mode);return}s(l),l.retryTimer=setTimeout(()=>{l.retryTimer=null,!(a(l.token)===null||l.userStopped)&&g(l,e.mode)},e.delayMs);return}h(l)}})]}function g(t,r){s(t),t.mode=r,t.sawStart=false,t.launchedAt=n(),t.transcript=Nu,t.errorCode=null,b(t);try{e.start(zu(r,t.lang,t.phrases))}catch{t.errorCode="unknown",h(t)}}async function m(t){let r=await Ou(e);if(a(t.token)===null)return;if(r!=="granted"){u(t),f(t,r==="denied"?"permissionDenied":"unavailable");return}if(t.lang=await ju(e,t.lang),a(t.token)===null)return;let n=await Ru(e,t.lang);a(t.token)!==null&&(t.autoStopTimer=setTimeout(()=>y(t),Vu),g(t,n))}function y(r){if(!(a(r.token)===null||r.userStopped)){if(r.userStopped=true,r.pendingRetry=null,r.mode===null||r.retryTimer!==null){u(r),t.onStatus("idle");return}r.graceTimer=setTimeout(()=>h(r),Du);try{e.stop()}catch{h(r)}}}return{start(e){if(i!==null)return;let r={token:++l,phrases:e,lang:Su(),mode:null,retries:0,pendingRetry:null,userStopped:false,transcript:Nu,errorCode:null,startedAt:null,sawStart:false,launchedAt:0,subscriptions:[],autoStopTimer:null,graceTimer:null,retryTimer:null};i=r,t.onStatus("starting"),m(r)},stop(){i!==null&&y(i)},cancel(){let r=i;if(r===null)return;let l=r.mode!==null&&r.retryTimer===null,a=qu(r.transcript);if(u(r),t.onStatus("idle"),!!l){a&&p(r,a),o=n();try{e.abort()}catch{}}},isActive:()=>i!==null,isPreparing:()=>i!==null&&i.mode===null}}function Ku({enabled:t,input:r,setInput:l,phrases:i,maxLength:o,telemetry:a}){let s=e.useSyncExternalStore(bu,hu,hu),u=e.useMemo(()=>t?yu():null,[t,s]),c=e.useMemo(()=>vu(u),[u]),[d,p]=e.useState("idle"),[f,h]=e.useState(null),[b,g]=e.useState(0),m=e.useRef(r);m.current=r;let y=e.useRef(l);y.current=l;let v=e.useRef(a);v.current=a;let x=e.useRef(""),w=e.useRef(o);w.current=o;let k=e.useRef(null);u!==null&&k.current?.mod!==u&&(k.current?.controller.cancel(),k.current={mod:u,controller:Gu(u,{onStatus:e=>{p(t=>e==="idle"&&t==="error"?t:e)},onText:e=>y.current(No(x.current,e,w.current)),onError:e=>{h(e),p("error")}},()=>v.current)});let S=u===null?null:k.current?.controller??null,C=e.useCallback(()=>{S?.cancel()},[S]),j=e.useCallback(()=>{if(S!==null){if(S.isActive()){S.stop();return}h(null),g(0),x.current=m.current,S.start(i)}},[S,i]);e.useEffect(()=>{if(d!=="listening")return;let e=Date.now();g(0);let t=setInterval(()=>g(Date.now()-e),1e3);return()=>clearInterval(t)},[d]),e.useEffect(()=>{if(d!=="error")return;let e=setTimeout(()=>{h(null),p("idle")},Wo);return()=>clearTimeout(e)},[d]),e.useEffect(()=>{if(S===null)return;let e=null;try{e=n.AppState.addEventListener("change",e=>{e==="background"&&!S.isPreparing()&&S.cancel()})}catch{}return()=>{e?.remove(),S.cancel()}},[S]);let R=t&&c;return e.useEffect(()=>{R||S?.cancel()},[R,S]),{supported:R,status:d,active:d==="starting"||d==="listening",error:f,elapsedMs:b,toggle:j,cancel:C}}var Yu=/* @__PURE__ */Symbol.for("everfur.sdk.rn.chatPaneShown");function Qu(){let t=globalThis,r=t[Yu];if(r!==void 0)return r;let n=e.createContext(true);return t[Yu]=n,n}var Zu=Qu();function Ju(){return e.useContext(Zu)}var Xu=/* @__PURE__ */Object.freeze(["photo"]),ec=52,tc=1.5,rc=10,nc=14,lc=10,ic=40,oc=20,ac=.3,sc=2.5,uc=1,cc=1.5,dc=38,pc=22,fc=3;function hc(e,t,r,n="ask",l=false){let i=typeof t=="string"&&t.trim()!=="";return r&&i&&n!=="urgent"?be(pe.placeholder,t):e!==null?!l||!e.includes("{pet}")?e:i?e.split("{pet}").join(t.trim()):be(pe.placeholder,t):n==="urgent"?pe.placeholderUrgentWeb:n==="followUp"?pe.placeholderFollowUpWeb:be(pe.placeholder,t)}function ComposerWithAttachments({attachments:r,...n}){let l=e.useMemo(()=>createRnChatAttachmentTransport(),[]),i=useChatAttachments({maxPerMessage:r.maxPerMessage??jo,transport:l}),o=e.useMemo(()=>({state:i,sources:r.sources??Xu,pick:r.pick}),[i,r.sources,r.pick]);/* @__PURE__ */
111
- return t.jsx(Composer,{...n,attachments:o})}function Composer({send:r,stop:l,isStreaming:i,conversationId:conversationId,attachments:o,seed:a,draftStore:s,onStage:u,onPreview:c,petName:d,petBreed:p=null,mood:f="ask",dictation:h=false,telemetry:b=null,compact:g=false,petPlaceholder:m=false,dimEmptySend:y=false}){let{theme:v,styles:x}=eu(),w=e.useMemo(()=>xc(v),[v]),k=e.useMemo(()=>wc(v),[v]),S=Di(),[C,j]=Yo(r,conversationId,a),[R,T]=e.useState(false),[_,z]=e.useState(false),I=e.useCallback(()=>z(true),[]),P=e.useCallback(()=>z(false),[]),[E,M]=e.useState(false);e.useEffect(()=>{M(false)},[conversationId]);let F=hc(v.meta.placeholder,d,m,f,v.meta.placeholderFillsPet===true),A=e.useMemo(()=>Ko({name:d,breed:p}),[d,p]),L=Ku({enabled:h,input:C,setInput:j,phrases:A,maxLength:ko,telemetry:b}),O=L.cancel,V=L.active;Qo(s,conversationId===null?null:String(conversationId),C,j,V);let D=e.useRef(conversationId);e.useEffect(()=>{D.current!==conversationId&&(D.current=conversationId,O())},[conversationId,O]);let B=Ju();e.useEffect(()=>{B||O()},[B,O]);let H=o?.state.uploading??false,W=o?.state.failed??false,N=H||W,U=o?.state.attachments??bc;ro(U.length,S);let $=e.useCallback(()=>{let e=C.trim();if(e.length===0||N||[...e].length>ko)return;V&&O();let t=o?.state.s3Keys??gc;o!==null&&t.length>0?(u(o.state.attachments.filter(e=>e.status==="uploaded").map(e=>({uri:e.previewUri,filename:e.filename}))),r(e,{imageS3Keys:t}),o.state.clear()):r(e),j(""),M(false)},[C,r,N,V,O,o,u]),q=e.useCallback(e=>{V&&O(),j(e)},[V,O,j]),G=e.useCallback(()=>{l()},[l]),K=e.useCallback(e=>{T(false),o!==null&&(M(false),o.state.dismissRejected(),kr(o.pick,e).then(e=>{if(!e.ok){M(true);return}e.value!==null&&o.state.add(e.value)}))},[o]),Y=e.useMemo(()=>[...C.trim()].length>ko,[C]),Q=Y||N||C.trim().length===0,Z=Y||N||y&&C.trim().length===0,J=o!==null&&U.length>=o.state.maxPerMessage,X=v.slots.sendButton?.textColor??v.color.brandInk,ee=v.slots.sendButton?.textColor??v.color.surface;/* @__PURE__ */
112
- return t.jsxs(n.View,{style:x.composerOuter,children:[o!==null&&R?/* @__PURE__ */t.jsx(AttachmentPickerPopover,{sources:o.sources,full:J,onPick:K,onClose:()=>T(false)}):null,o!==null?/* @__PURE__ */t.jsx(AttachmentStrip,{attachments:U,rejected:E?vc:o.state.rejected,uploadFailed:W,onRetry:o.state.retry,onRemove:o.state.remove,onPreview:e=>c({uri:e.previewUri,label:e.filename}),style:g?w.tray:k.tray}):null,
109
+ /* @__PURE__ */t.jsx(StopGlyph,{size:iu,color:s.color.brandInk,testID:"everfur-dictation-stop"})]}):/* @__PURE__ */t.jsx(MicGlyph,{size:lu,color:s.color.brandInk,testID:"everfur-dictation-mic"})})]})}function Pulse({style:r,reduced:l}){let i=e.useRef(new n.Animated.Value(1)).current;return e.useEffect(()=>{if(l)return;let e=n.Animated.loop(n.Animated.sequence([n.Animated.timing(i,{toValue:su,duration:au/2,useNativeDriver:true}),n.Animated.timing(i,{toValue:1,duration:au/2,useNativeDriver:true})]));return e.start(),()=>e.stop()},[i,l]),/* @__PURE__ */t.jsx(n.Animated.View,{style:[r,{opacity:i}],accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"})}function cu(e){let t=e.color,r=e.type.tierSizes.compact.micro;return n.StyleSheet.create({wrap:{flexDirection:"row",flexShrink:0,alignItems:"center",gap:e.space.xs},timer:{...face(e,"mono"),fontSize:r,lineHeight:r+2,fontVariant:["tabular-nums"],color:t.text.muted},button:{width:ds,height:ds,borderRadius:e.radius.pill,alignItems:"center",justifyContent:"center"},buttonDisabled:{opacity:uu},pulse:{position:"absolute",top:ou,right:ou,bottom:ou,left:ou,borderRadius:e.radius.pill,backgroundColor:t.brandSofter}})}function optionalModule(e,t,r){let n;try{n=t()}catch(t){return pu(`optional peer '${e}' is not installed: ${fu(t)}`)}let l=du(n);return l==null?pu(`optional peer '${e}' resolved to no module`):r&&!r(l)?pu(`optional peer '${e}' is present but failed its shape check`):/* @__PURE__ */Object.freeze({available:true,module:l})}function du(e){return typeof e=="object"&&e!==null&&"default"in e&&Object.keys(e).length<=2?e.default:e}function pu(e){/* @__PURE__ */
110
+ return Object.freeze({available:false,module:null,reason:e})}function fu(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}var hu=/* @__PURE__ */Symbol.for("@everfur/sdk/rn-dictation");function bu(){let e=globalThis,t=e[hu];if(t!==void 0)return t;let r={loader:null,memo:void 0};return e[hu]=r,r}function registerEverfurDictation(e){let t=bu();t.loader=e,t.memo=void 0,t.version=(t.version??0)+1;for(let e of[...t.listeners??[]])try{e()}catch{}}function gu(){return bu().version??0}function mu(e){let t=bu(),r=t.listeners??/* @__PURE__ */new Set;t.listeners=r;let n=()=>e();return r.add(n),()=>{r.delete(n)}}function yu(e){if(typeof e!="object"||e===null)return false;let t=e;return typeof t.start=="function"&&typeof t.isRecognitionAvailable=="function"&&typeof t.addListener=="function"}function vu(e){return typeof e!="object"||e===null?null:e.ExpoSpeechRecognitionModule??e}function xu(){let e=bu();if(e.memo!==void 0)return e.memo;e.memo=null;let t=e.loader;if(t===null||n.Platform.OS!=="ios"&&n.Platform.OS!=="android")return e.memo;let r=optionalModule("expo-speech-recognition",()=>({box:vu(t())}),e=>typeof e=="object"&&e!==null&&yu(e.box));return r.available&&(e.memo=r.module.box),e.memo}function wu(e){if(e===null)return false;try{return e.isRecognitionAvailable()===!0}catch{return false}}function ku(){try{return Intl.DateTimeFormat().resolvedOptions().locale||Cu}catch{return Cu}}function Su(e){return e.replace(/_/g,"-").toLowerCase()}var Cu="en-US";function ju(e=ku()){let[t=""]=e.replace(/_/g,"-").split("-u-"),r=t.split("-");if(r[0]?.toLowerCase()!=="en")return Cu;let n=r.slice(1).find(e=>/^[A-Za-z]{2}$/.test(e));return n?`en-${n.toUpperCase()}`:Cu}function Ru(e,t){if(t.length===0)return null;let r=e=>t.find(t=>Su(t)===Su(e));return r(e)??r(Cu)??t.find(e=>Su(e).startsWith("en-"))??null}async function Tu(e,t){if(n.Platform.OS!=="ios")return t;try{let{locales:r}=await e.getSupportedLocales({});return Ru(t,r??[])??t}catch{return t}}async function _u(e,t){let r=false;try{r=e.supportsOnDeviceRecognition()===!0}catch{r=false}if(!r)return"network";if(n.Platform.OS!=="android")return"on_device";try{let{installedLocales:r}=await e.getSupportedLocales({}),n=Su(t);return(r??[]).some(e=>Su(e)===n)?"on_device":"network"}catch{return"network"}}function zu(){return n.Platform.OS!=="android"?true:Number(n.Platform.Version)>=Iu}var Iu=33;function Pu(e,t,r){return{lang:t,interimResults:true,continuous:zu(),maxAlternatives:1,addsPunctuation:true,requiresOnDeviceRecognition:e==="on_device",contextualStrings:r.slice(0,100),iosTaskHint:"dictation"}}var Eu=/* @__PURE__ */new Set(["not-allowed","no-speech","speech-timeout","aborted","interrupted"]),Mu=/* @__PURE__ */new Set(["busy","client","network","audio-capture","too-many-requests","unknown"]);function Fu(e){return Mu.has(e)}var Au=600,Lu=3;function Ou(e,t,r){if(Eu.has(r))return null;let n=Fu(r)?Au:0;return r==="language-not-supported"&&Su(t)!==Su(Cu)?{mode:"network",lang:Cu,delayMs:n}:e==="on_device"?{mode:"network",lang:t,delayMs:n}:n>0?{mode:"network",lang:t,delayMs:n}:null}function Vu(e){return e==="not-allowed"?"permissionDenied":e==="no-speech"||e==="speech-timeout"?"noSpeech":"unavailable"}async function Du(e){try{if((await e.getPermissionsAsync()).granted)return"granted"}catch{}try{return(await e.requestPermissionsAsync()).granted?"granted":"denied"}catch{return"error"}}var Bu=55e3,Hu=3e3,Wu=1e3;function Nu(e){return Uu.has(e)||Fu(e)}var Uu=/* @__PURE__ */new Set(["no-speech","speech-timeout","aborted","interrupted"]),$u=/* @__PURE__ */Object.freeze({committed:/* @__PURE__ */Object.freeze([]),interim:""});function qu(e){return e.replace(/\s+/g," ").trim()}function Gu(e,t,r){let n=qu(t);return r?n?{committed:[...e.committed,n],interim:""}:{committed:e.committed,interim:""}:{committed:e.committed,interim:n}}function Ku(e){return qu([...e.committed,e.interim].join(" "))}function Yu(e,t,r,n=Date.now){let l=0,i=null,o=Number.NEGATIVE_INFINITY,a=e=>i!==null&&i.token===e?i:null;function s(e){for(let t of e.subscriptions)try{t.remove()}catch{}e.subscriptions=[]}function u(e){s(e),e.autoStopTimer!==null&&clearTimeout(e.autoStopTimer),e.graceTimer!==null&&clearTimeout(e.graceTimer),e.retryTimer!==null&&clearTimeout(e.retryTimer),e.autoStopTimer=null,e.graceTimer=null,e.retryTimer=null,i===e&&(i=null)}function c(e){return!e.sawStart&&e.errorCode===null&&e.pendingRetry===null&&Ku(e.transcript)===""&&e.launchedAt-o<Wu}function d(e){return e.mode??"none"}function p(e,t){Zo(r(),"chat_dictation_completed",{mode:d(e),duration_ms:e.startedAt===null?0:Math.max(0,n()-e.startedAt),char_count:t.length})}function f(e,n){Zo(r(),"chat_dictation_failed",{mode:d(e),error:n}),t.onStatus("idle"),t.onError(n)}function h(e){if(a(e.token)===null)return;u(e);let r=Ku(e.transcript),n=e.errorCode;if(n!==null&&!(r&&Nu(n))){f(e,Vu(n));return}if(!r){f(e,"noSpeech");return}p(e,r),t.onStatus("idle")}function b(l){l.subscriptions=[e.addListener("start",()=>{a(l.token)!==null&&(l.sawStart=true,l.startedAt===null&&(l.startedAt=n()),Zo(r(),"chat_dictation_started",{mode:d(l)}),t.onStatus("listening"))}),e.addListener("result",e=>{if(a(l.token)===null)return;let r=e?.results?.[0]?.transcript??"";l.transcript=Gu(l.transcript,r,e?.isFinal===true),t.onText(Ku(l.transcript))}),e.addListener("error",e=>{if(a(l.token)===null)return;let t=e?.error??"unknown";if(l.userStopped&&(t==="aborted"||Fu(t)))return;let r=Ku(l.transcript)==="",n=l.mode!==null&&!l.userStopped&&r&&l.retries<Lu?Ou(l.mode,l.lang,t):null;if(n!==null){l.pendingRetry=n;return}l.errorCode===null&&(l.errorCode=t)}),e.addListener("end",()=>{if(a(l.token)!==null&&!c(l)){if(l.pendingRetry!==null){let e=l.pendingRetry;if(l.pendingRetry=null,l.retries+=1,l.lang=e.lang,e.delayMs<=0){g(l,e.mode);return}s(l),l.retryTimer=setTimeout(()=>{l.retryTimer=null,!(a(l.token)===null||l.userStopped)&&g(l,e.mode)},e.delayMs);return}h(l)}})]}function g(t,r){s(t),t.mode=r,t.sawStart=false,t.launchedAt=n(),t.transcript=$u,t.errorCode=null,b(t);try{e.start(Pu(r,t.lang,t.phrases))}catch{t.errorCode="unknown",h(t)}}async function m(t){let r=await Du(e);if(a(t.token)===null)return;if(r!=="granted"){u(t),f(t,r==="denied"?"permissionDenied":"unavailable");return}if(t.lang=await Tu(e,t.lang),a(t.token)===null)return;let n=await _u(e,t.lang);a(t.token)!==null&&(t.autoStopTimer=setTimeout(()=>y(t),Bu),g(t,n))}function y(r){if(!(a(r.token)===null||r.userStopped)){if(r.userStopped=true,r.pendingRetry=null,r.mode===null||r.retryTimer!==null){u(r),t.onStatus("idle");return}r.graceTimer=setTimeout(()=>h(r),Hu);try{e.stop()}catch{h(r)}}}return{start(e){if(i!==null)return;let r={token:++l,phrases:e,lang:ju(),mode:null,retries:0,pendingRetry:null,userStopped:false,transcript:$u,errorCode:null,startedAt:null,sawStart:false,launchedAt:0,subscriptions:[],autoStopTimer:null,graceTimer:null,retryTimer:null};i=r,t.onStatus("starting"),m(r)},stop(){i!==null&&y(i)},cancel(){let r=i;if(r===null)return;let l=r.mode!==null&&r.retryTimer===null,a=Ku(r.transcript);if(u(r),t.onStatus("idle"),!!l){a&&p(r,a),o=n();try{e.abort()}catch{}}},isActive:()=>i!==null,isPreparing:()=>i!==null&&i.mode===null}}function Qu({enabled:t,input:r,setInput:l,phrases:i,maxLength:o,telemetry:a}){let s=e.useSyncExternalStore(mu,gu,gu),u=e.useMemo(()=>t?xu():null,[t,s]),c=e.useMemo(()=>wu(u),[u]),[d,p]=e.useState("idle"),[f,h]=e.useState(null),[b,g]=e.useState(0),m=e.useRef(r);m.current=r;let y=e.useRef(l);y.current=l;let v=e.useRef(a);v.current=a;let x=e.useRef(""),w=e.useRef(o);w.current=o;let k=e.useRef(null);u!==null&&k.current?.mod!==u&&(k.current?.controller.cancel(),k.current={mod:u,controller:Yu(u,{onStatus:e=>{p(t=>e==="idle"&&t==="error"?t:e)},onText:e=>y.current(Ko(x.current,e,w.current)),onError:e=>{h(e),p("error")}},()=>v.current)});let S=u===null?null:k.current?.controller??null,C=e.useCallback(()=>{S?.cancel()},[S]),j=e.useCallback(()=>{if(S!==null){if(S.isActive()){S.stop();return}h(null),g(0),x.current=m.current,S.start(i)}},[S,i]);e.useEffect(()=>{if(d!=="listening")return;let e=Date.now();g(0);let t=setInterval(()=>g(Date.now()-e),1e3);return()=>clearInterval(t)},[d]),e.useEffect(()=>{if(d!=="error")return;let e=setTimeout(()=>{h(null),p("idle")},Go);return()=>clearTimeout(e)},[d]),e.useEffect(()=>{if(S===null)return;let e=null;try{e=n.AppState.addEventListener("change",e=>{e==="background"&&!S.isPreparing()&&S.cancel()})}catch{}return()=>{e?.remove(),S.cancel()}},[S]);let R=t&&c;return e.useEffect(()=>{R||S?.cancel()},[R,S]),{supported:R,status:d,active:d==="starting"||d==="listening",error:f,elapsedMs:b,toggle:j,cancel:C}}var Zu=/* @__PURE__ */Symbol.for("everfur.sdk.rn.chatPaneShown");function Ju(){let t=globalThis,r=t[Zu];if(r!==void 0)return r;let n=e.createContext(true);return t[Zu]=n,n}var Xu=Ju();function ec(){return e.useContext(Xu)}var tc=/* @__PURE__ */Object.freeze(["photo"]),rc=52,nc=1.5,lc=10,ic=14,oc=10,ac=40,sc=20,uc=.3,cc=2.5,dc=1,pc=1.5,fc=38,hc=22,bc=3;function gc(e,t,r,n="ask",l=false){let i=typeof t=="string"&&t.trim()!=="";return r&&i&&n!=="urgent"?be(pe.placeholder,t):e!==null?!l||!e.includes("{pet}")?e:i?e.split("{pet}").join(t.trim()):be(pe.placeholder,t):n==="urgent"?pe.placeholderUrgentWeb:n==="followUp"?pe.placeholderFollowUpWeb:be(pe.placeholder,t)}function ComposerWithAttachments({attachments:r,...n}){let l=e.useMemo(()=>createRnChatAttachmentTransport(),[]),i=useChatAttachments({maxPerMessage:r.maxPerMessage??Io,transport:l}),o=e.useMemo(()=>({state:i,sources:r.sources??tc,pick:r.pick}),[i,r.sources,r.pick]);/* @__PURE__ */
111
+ return t.jsx(Composer,{...n,attachments:o})}function Composer({send:r,stop:l,isStreaming:i,conversationId:conversationId,attachments:o,seed:a,draftStore:s,onStage:u,onPreview:c,petName:d,petBreed:p=null,mood:f="ask",dictation:h=false,telemetry:b=null,compact:g=false,petPlaceholder:m=false,dimEmptySend:y=false}){let{theme:v,styles:x}=ru(),w=e.useMemo(()=>kc(v),[v]),k=e.useMemo(()=>Sc(v),[v]),S=Ui(),[C,j]=ea(r,conversationId,a),[R,T]=e.useState(false),[_,z]=e.useState(false),I=e.useCallback(()=>z(true),[]),P=e.useCallback(()=>z(false),[]),[E,M]=e.useState(false);e.useEffect(()=>{M(false)},[conversationId]);let F=gc(v.meta.placeholder,d,m,f,v.meta.placeholderFillsPet===true),A=e.useMemo(()=>Xo({name:d,breed:p}),[d,p]),L=Qu({enabled:h,input:C,setInput:j,phrases:A,maxLength:To,telemetry:b}),O=L.cancel,V=L.active;ta(s,conversationId===null?null:String(conversationId),C,j,V);let D=e.useRef(conversationId);e.useEffect(()=>{D.current!==conversationId&&(D.current=conversationId,O())},[conversationId,O]);let B=ec();e.useEffect(()=>{B||O()},[B,O]);let H=o?.state.uploading??false,W=o?.state.failed??false,N=H||W,U=o?.state.attachments??mc;ao(U.length,S);let $=e.useCallback(()=>{let e=C.trim();if(e.length===0||N||[...e].length>To)return;V&&O();let t=o?.state.s3Keys??yc;o!==null&&t.length>0?(u(o.state.attachments.filter(e=>e.status==="uploaded").map(e=>({uri:e.previewUri,filename:e.filename}))),r(e,{imageS3Keys:t}),o.state.clear()):r(e),j(""),M(false)},[C,r,N,V,O,o,u]),q=e.useCallback(e=>{V&&O(),j(e)},[V,O,j]),G=e.useCallback(()=>{l()},[l]),K=e.useCallback(e=>{T(false),o!==null&&(M(false),o.state.dismissRejected(),kr(o.pick,e).then(e=>{if(!e.ok){M(true);return}e.value!==null&&o.state.add(e.value)}))},[o]),Y=e.useMemo(()=>[...C.trim()].length>To,[C]),Q=Y||N||C.trim().length===0,Z=Y||N||y&&C.trim().length===0,J=o!==null&&U.length>=o.state.maxPerMessage,X=v.slots.sendButton?.textColor??v.color.brandInk,ee=v.slots.sendButton?.textColor??v.color.surface;/* @__PURE__ */
112
+ return t.jsxs(n.View,{style:x.composerOuter,children:[o!==null&&R?/* @__PURE__ */t.jsx(AttachmentPickerPopover,{sources:o.sources,full:J,onPick:K,onClose:()=>T(false)}):null,o!==null?/* @__PURE__ */t.jsx(AttachmentStrip,{attachments:U,rejected:E?wc:o.state.rejected,uploadFailed:W,onRetry:o.state.retry,onRemove:o.state.remove,onPreview:e=>c({uri:e.previewUri,label:e.filename}),style:g?w.tray:k.tray}):null,
113
113
  /* @__PURE__ */t.jsxs(n.View,{style:g?[x.composer,w.bar,_?w.barFocused:null]:x.composer,children:[L.supported&&L.error!==null?/* @__PURE__ */t.jsxs(t.Fragment,{children:[
114
- /* @__PURE__ */t.jsx(Text,{style:x.dictationError,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:$o(L.error)}),
115
- /* @__PURE__ */t.jsx(AnnounceLine,{line:$o(L.error)})]}):null,
116
- /* @__PURE__ */t.jsxs(n.View,{style:x.composerRow,children:[o!==null?/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:J?Bo(U.length,o.state.maxPerMessage):pe.attachPhotoOrFileNative,accessibilityState:{disabled:J,expanded:R},disabled:J,style:[x.attachControl,g?w.add:null,J?x.attachControlDisabled:null],hitSlop:g?fc:void 0,onPress:()=>T(e=>!e),children:/* @__PURE__ */t.jsx(UploadGlyph,{size:g?pc:_s,color:J?v.color.text.muted:g?v.color.text.primary:v.color.brandInk,strokeWidth:1.75})}):null,
117
- /* @__PURE__ */t.jsx(re,{style:g?[x.input,w.input]:x.input,onFocus:I,onBlur:P,value:C,onChangeText:q,placeholder:F,placeholderTextColor:v.slots.composerInput?.textColor??v.color.text.placeholder,accessibilityLabel:pe.composerLabel,onSubmitEditing:$,returnKeyType:"send",...mc,...g?yc:null,blurOnSubmit:false,multiline:true,editable:true}),L.supported?/* @__PURE__ */t.jsx(DictationButton,{active:L.active,listening:L.status==="listening",elapsedMs:L.elapsedMs,onToggle:L.toggle}):null,i?/* @__PURE__ */t.jsx(n.Pressable,{onPress:G,accessibilityRole:"button",accessibilityLabel:pe.stop,style:x.sendControl,children:/* @__PURE__ */t.jsx(n.View,{style:g?w.disc:x.sendDisc,testID:"everfur-stop-disc",children:/* @__PURE__ */t.jsx(StopGlyph,{size:g?oc:js,color:g?ee:X,testID:"everfur-stop-glyph"})})}):/* @__PURE__ */t.jsx(n.Pressable,{onPress:$,disabled:Q,accessibilityRole:"button",accessibilityLabel:pe.send,accessibilityState:{disabled:Q,busy:H},style:[x.sendControl,Z?g?w.dimmed:x.sendControlDisabled:null],children:g?/* @__PURE__ */t.jsx(n.View,{style:w.disc,testID:"everfur-send-disc",children:/* @__PURE__ */t.jsx(ArrowUpGlyph,{size:oc,color:ee,strokeWidth:2.25,testID:"everfur-send-arrow"})}):/* @__PURE__ */t.jsx(n.View,{style:x.sendDisc,testID:"everfur-send-disc",children:/* @__PURE__ */t.jsx(SendGlyph,{size:Cs,color:X,testID:"everfur-send-glyph"})})})]})]})]})}var bc=/* @__PURE__ */Object.freeze([]),gc=/* @__PURE__ */Object.freeze([]),mc=/* @__PURE__ */Object.freeze({submitBehavior:"submit"}),yc=/* @__PURE__ */Object.freeze(n.Platform.OS==="web"?{rows:1}:{}),vc=/* @__PURE__ */Object.freeze({code:"unknown",retryable:true,filename:""});function xc(e){let t=e.color,r=e.slots.sendButton,l=textRole(e,"body").fontSize+uc;return n.StyleSheet.create({bar:{marginTop:rc,marginHorizontal:nc,marginBottom:lc,minHeight:ec,paddingLeft:8,paddingRight:6,paddingVertical:0,borderWidth:tc,borderColor:e.slots.composerInput?.borderColor??t.text.primary},barFocused:{borderWidth:sc,paddingLeft:8-(sc-tc),paddingRight:6-(sc-tc)},input:{fontSize:l,lineHeight:Math.round(l*cc),minHeight:Math.round(l*cc),...n.Platform.OS==="web"?{outlineStyle:"none"}:null},add:{width:dc,height:dc,borderRadius:dc/2},disc:{width:ic,height:ic,borderRadius:ic/2,alignItems:"center",justifyContent:"center",backgroundColor:r?.backgroundColor??t.text.primary,...ho(r)},dimmed:{opacity:ac},tray:{marginHorizontal:nc,marginTop:rc,paddingBottom:0}})}function wc(e){return n.StyleSheet.create({tray:{marginHorizontal:e.space.md,marginTop:e.space.xs,paddingBottom:0}})}var kc=/* @__PURE__ */new WeakMap;function Sc(e,t){let r=kc.get(e);return r===void 0&&(r=/* @__PURE__ */new Set,kc.set(e,r)),r.add(t),()=>{r?.delete(t)}}function useEverfurPets(){let{runtime:t,userRef:userRef,activePet:r,scopeEpoch:n}=we(),l=e.useMemo(()=>createPetsRepository(t.registry.services.authFor(userRef)),[t,userRef,n]),[i,o]=e.useState({repository:l,pets:[],loading:true,error:null}),a=i.repository===l?i:{pets:[],loading:true,error:null},s=e.useRef(0),u=e.useCallback(async()=>{let e=++s.current;o(e=>({...e,repository:l,loading:true,error:null,pets:e.repository===l?e.pets:[]}));let t=await l.list();e===s.current&&o(t.ok?{repository:l,pets:t.value,loading:false,error:null}:e=>({repository:l,pets:e.repository===l?e.pets:[],loading:false,error:t.error}))},[l]);e.useEffect(()=>(u(),()=>{s.current+=1}),[u]),e.useEffect(()=>Sc(t,()=>{u()}),[t,u]);let c=e.useMemo(()=>r===null?null:a.pets.find(e=>e.petRef===r)??null,[r,a.pets]);return e.useMemo(()=>({pets:a.pets,activePet:c,loading:a.loading,error:a.error,refresh:u}),[a.pets,a.loading,a.error,c,u])}function Cc(e,t){if(t!==null){let r=e.find(e=>e.petRef===t);if(r!==void 0)return r}return e[0]??null}var jc=/* @__PURE__ */Object.freeze({visitButton:"Vet"});var Rc=false;function Tc(e,t){return t!==void 0?(vr(t,e),"onStartInApp"):f(e)==="presented"?"presenter":m(e)?"experience":(Rc||(Rc=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}var _c=/* @__PURE__ */Object.freeze(["visit","join","summary","messages"]);function isVetVisitIntent(e){return typeof e=="string"&&_c.includes(e)}var zc="/widget/v1/televet/handoffs",Ic="/widget/v1/televet/availability",Pc="/widget/v1/televet/chat-entry",Ec=/^[a-z0-9][a-z0-9_-]{0,39}$/,Mc=/^[A-Za-z0-9_-]{22}$/;var Fc=32,Ac=128,Lc=64;function vetVisitErrorReasonOf(e){let t=e.httpStatus;switch(e.code){case"sessionRequired":return"sessionRequired";case"authExpired":case"authRejected":return"authRejected";case"sdkUpdateRequired":return"sdkUpdateRequired";case"validationFailed":return"invalidRequest";case"rateLimited":case"quotaExceeded":return"rateLimited"}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}function Oc(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Vc(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function Dc(petRef,e){let t={};petRef!==void 0&&(t.pet_ref=petRef);let r=e?.returnTo;if(r!=null){if(typeof r!="string"||!Ec.test(r))return{ok:false,message:"returnTo must be a registered return destination key"};t.return_to=r}let n=e?.entry;if(n!=null){if(n!=="chat"||petRef===void 0)return{ok:false,message:"entry 'chat' needs the pet the chat is about"};t.entry=n}let l=e?.visitRef,i=e?.intent,o=l!=null;if(o){let e=typeof l=="string"?l.trim():"";if(e.length<1||[...e].length>Lc)return{ok:false,message:`visitRef must be 1..${Lc} characters`};t.visit_ref=e}if(i!=null){if(!o)return{ok:false,message:"intent needs the visitRef it opens"};if(!isVetVisitIntent(i))return{ok:false,message:`intent must be one of ${_c.join(", ")}`};t.intent=i}return{ok:true,body:t}}function Bc(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!isVetVisitIntent(r)?null:/* @__PURE__ */Object.freeze({visitRef:t,intent:r})}function Hc(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=e=>(Gc(r,"televet.visit.handoff_failed",{reason:vetVisitErrorReasonOf(e)}),err(e));return{async createHandoff(petRef,e){let l;if(petRef!=null){let e=typeof petRef=="string"?[...petRef].length:0;if(e<1||e>Ac)return n(makeEverfurError("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Ac} characters`}));l=petRef}let i=Dc(l,e);if(!i.ok){let e=Oc(i.message);return e.ok?e:n(e.error)}let o=i.body,a=await t.send("televet.visit.handoff",{method:"POST",path:zc,body:o},{idempotent:false,maxAttempts:1});if(!a.ok)return n(a.error);let s=Wc(a.value),u=o.return_to!==void 0,c=u?a.value?.flow_id:void 0;if(u&&(typeof c!="string"||!Mc.test(c))){let e=Vc("the handoff response carried no usable return flow id");return e.ok?e:n(e.error)}let d=o.visit_ref!==void 0,p=d?Bc(a.value?.visit):null;if(d&&p===null){let e=Vc("the handoff response did not confirm the visit it opens");return e.ok?e:n(e.error)}let f=s===null?null:/* @__PURE__ */Object.freeze({...s,...u?{flowId:c}:{},...p!==null?{visit:p}:{}});return f===null?n(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(Gc(r,"televet.visit.handoff_created",{pet_scoped:o.pet_ref!==void 0}),ok(f))},async checkAvailability(e){if(typeof e!="string"||e.length>Fc)return Oc(`state must be at most ${Fc} characters`);let r=await t.send("televet.visit.availability",{method:"POST",path:Ic,body:{state:e}},{idempotent:false,maxAttempts:1});if(!r.ok)return err(r.error);let n=r.value?.available;return typeof n!="boolean"?Vc("the availability response carried no usable answer"):ok(/* @__PURE__ */Object.freeze({available:n}))},async chatEntryOpen(){try{let e=await t.send("televet.visit.chat_entry",{method:"GET",path:Pc},{maxAttempts:1});return e.ok&&e.value?.open===!0}catch{return false}}}}function Wc(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!qc(t)?null:/* @__PURE__ */Object.freeze({url:t,expiresAt:r})}var Nc=/* @__PURE__ */new Set(["localhost","127.0.0.1","[::1]"]),Uc=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,$c=/[\s\u0000-\u001f\u007f]/;function qc(e){if($c.test(e))return false;let t=Uc.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let l=n.replace(/:\d+$/,"").toLowerCase(),i=r==="https",o=r==="http"&&Nc.has(l);if(!i&&!o)return false;let a=e.indexOf("#");if(a<0)return false;let s=e.slice(a);return s.startsWith("#h=")&&s.length>3}function Gc(e,t,r){if(e)try{e.track(t,r)}catch{}}var Kc=/* @__PURE__ */Object.freeze({status:"idle",error:null,errorReason:null});function Yc(t,r,n){let{usState:l,chat:i,scope:o}=n,a=r&&(l!==null||i),s=`${l??""}|${i?"chat":""}`,[u,c]=e.useState(null);if(e.useEffect(()=>{if(!a)return;let e=true,r=t.current;return c(null),(async()=>{try{if(i&&!(r.chatEntryOpen&&await r.chatEntryOpen()))return!1;if(l===null)return!0;if(!r.checkAvailability)return!1;let e=await r.checkAvailability(l);return e.ok&&e.value.available}catch{return false}})().then(t=>{e&&c({key:s,open:t})}),()=>{e=false}},[a,s,l,i,o,t]),!a)return null;let d=u!==null&&u.key===s;return{open:d&&u.open,pending:!d}}var Qc=/* @__PURE__ */Object.freeze({status:"opening",error:null,errorReason:null});function Zc(t,r={}){let{runtime:n,userRef:userRef,scopeEpoch:l}=we(),i=useCapability("televet"),o=i.enabled&&userRef!==null,a=r.usState??null,s=r.entry==="chat",u=r.petRef??null,c=r.prefer==="redirect",d=e.useMemo(()=>{if(r.controller)return r.controller;let{services:e}=n.registry;return Hc({auth:e.authFor(userRef),telemetry:e.telemetry,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})},[n,userRef,l,r.controller]),p=e.useRef(d);p.current=d;let f=e.useMemo(()=>({runtime:n,userRef:userRef,scopeEpoch:l}),[n,userRef,l]),h=Yc(p,o,{usState:a,chat:s,scope:f}),b=o&&(h===null||h.open)&&(!s||u!==null),g=r.returnTo??null,[m,y]=e.useState(Kc),v=e.useRef(null),x=e.useRef({runtime:n,userRef:userRef,scopeEpoch:l});x.current={runtime:n,userRef:userRef,scopeEpoch:l};let w=e.useRef(d);w.current=d;let k=e.useRef(b);k.current=b;let S=e.useCallback((petRef,e)=>{if(v.current)return v.current;let r=(e,t)=>(y({status:e==="cancelled"?"idle":"error",error:t,errorReason:e==="cancelled"?null:e}),/* @__PURE__ */Object.freeze({opened:false,reason:e,error:t}));if(!k.current)return Promise.resolve(r("unavailable",null));let n=t.prepare();if(!n.ok)return Promise.resolve(r(n.reason,null));let l=x.current,i=w.current;y(Qc);let o=(async()=>{let o,a={...g!==null?{returnTo:g}:{},...s?{entry:"chat"}:{},...e!==null?{visitRef:e.visitRef}:{},...e!==null&&e.intent!==null&&e.intent!==void 0?{intent:e.intent}:{}},c=Object.keys(a).length===0?void 0:a,d=petRef===void 0?u:petRef;try{o=await(c===void 0?i.createHandoff(d):i.createHandoff(d,c))}catch{return t.abandon(n.value),r("unknown",null)}let p=x.current;if(p.runtime!==l.runtime||p.userRef!==l.userRef||p.scopeEpoch!==l.scopeEpoch)return t.abandon(n.value),r("cancelled",null);if(!o.ok)return t.abandon(n.value),r(vetVisitErrorReasonOf(o.error),o.error);let f=await t.finish(n.value,o.value);return f!==null?r(f,null):(y(Kc),/* @__PURE__ */Object.freeze(o.value.flowId===void 0?{opened:true}:{opened:true,flowId:o.value.flowId}))})().finally(()=>{v.current===o&&(v.current=null)});return v.current=o,o},[t,u,g,s]),C=e.useCallback((petRef,e)=>{if(!k.current)return y({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(/* @__PURE__ */Object.freeze({opened:false,reason:"unavailable",error:null}));let t=petRef===void 0?u:petRef,r={...t!==null?{petRef:t}:{},...a!==null?{usState:a}:{},...e!==null&&"consultId"in e?{consultId:e.consultId}:{},...e!==null&&"visitRef"in e?{visitRef:e.visitRef,intent:e.intent}:{}};return Tc(r)===null?(y({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(/* @__PURE__ */Object.freeze({opened:false,reason:"unavailable",error:null}))):(y(Kc),Promise.resolve(/* @__PURE__ */Object.freeze({opened:true})))},[u,a]),j=e.useCallback(petRef=>c?S(petRef,null):C(petRef,null),[c,S,C]),R=e.useCallback((e,t)=>c?S(void 0,{visitRef:e,intent:t??null}):C(void 0,{visitRef:e,intent:t??null}),[c,S,C]),T=e.useCallback(e=>c?S(void 0,null):C(void 0,{consultId:e.trim()}),[c,S,C]);return{available:b,isPending:i.isPending||(h?.pending??false),status:m.status,error:m.error,errorReason:m.errorReason,open:j,openVisit:R,joinVisit:T}}var Jc=e=>n.Linking.openURL(e);function useVetVisit(t={}){let{openUrl:r,...n}=t,l=e.useMemo(()=>{let e=r??Jc;return{prepare:()=>({ok:true,value:null}),async finish(t,r){try{return await e(r.url),null}catch{return"openFailed"}},abandon:()=>{}}},[r]);return Zc(l,n)}var Xc=44,ed=.6;function VetVisitButtonCore(r){let{petRef:petRef,label:l,openUrl:i,onOpened:o,onError:a,style:s,labelStyle:u,controller:c,returnTo:d,usState:p,entry:f,visitRef:h,intent:b,onStartInApp:g,prefer:m}=r,y=m==="redirect",v=useVetVisit({...d!==void 0?{returnTo:d}:{},...p!==void 0?{usState:p}:{},...f!==void 0?{entry:f}:{},...petRef!==void 0?{petRef:petRef}:{},...i!==void 0?{openUrl:i}:{},...c!==void 0?{controller:c}:{},prefer:y?"redirect":"in-app"}),x=useEverfurTheme(),w=e.useMemo(()=>td(x),[x]),k=e.useRef(false);if(!v.available)/* @__PURE__ */
114
+ /* @__PURE__ */t.jsx(Text,{style:x.dictationError,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:Qo(L.error)}),
115
+ /* @__PURE__ */t.jsx(AnnounceLine,{line:Qo(L.error)})]}):null,
116
+ /* @__PURE__ */t.jsxs(n.View,{style:x.composerRow,children:[o!==null?/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:J?$o(U.length,o.state.maxPerMessage):pe.attachPhotoOrFileNative,accessibilityState:{disabled:J,expanded:R},disabled:J,style:[x.attachControl,g?w.add:null,J?x.attachControlDisabled:null],hitSlop:g?bc:void 0,onPress:()=>T(e=>!e),children:/* @__PURE__ */t.jsx(UploadGlyph,{size:g?hc:Ms,color:J?v.color.text.muted:g?v.color.text.primary:v.color.brandInk,strokeWidth:1.75})}):null,
117
+ /* @__PURE__ */t.jsx(re,{style:g?[x.input,w.input]:x.input,onFocus:I,onBlur:P,value:C,onChangeText:q,placeholder:F,placeholderTextColor:v.slots.composerInput?.textColor??v.color.text.placeholder,accessibilityLabel:pe.composerLabel,onSubmitEditing:$,returnKeyType:"send",...vc,...g?xc:null,blurOnSubmit:false,multiline:true,editable:true}),L.supported?/* @__PURE__ */t.jsx(DictationButton,{active:L.active,listening:L.status==="listening",elapsedMs:L.elapsedMs,onToggle:L.toggle}):null,i?/* @__PURE__ */t.jsx(n.Pressable,{onPress:G,accessibilityRole:"button",accessibilityLabel:pe.stop,style:x.sendControl,children:/* @__PURE__ */t.jsx(n.View,{style:g?w.disc:x.sendDisc,testID:"everfur-stop-disc",children:/* @__PURE__ */t.jsx(StopGlyph,{size:g?sc:Is,color:g?ee:X,testID:"everfur-stop-glyph"})})}):/* @__PURE__ */t.jsx(n.Pressable,{onPress:$,disabled:Q,accessibilityRole:"button",accessibilityLabel:pe.send,accessibilityState:{disabled:Q,busy:H},style:[x.sendControl,Z?g?w.dimmed:x.sendControlDisabled:null],children:g?/* @__PURE__ */t.jsx(n.View,{style:w.disc,testID:"everfur-send-disc",children:/* @__PURE__ */t.jsx(ArrowUpGlyph,{size:sc,color:ee,strokeWidth:2.25,testID:"everfur-send-arrow"})}):/* @__PURE__ */t.jsx(n.View,{style:x.sendDisc,testID:"everfur-send-disc",children:/* @__PURE__ */t.jsx(SendGlyph,{size:zs,color:X,testID:"everfur-send-glyph"})})})]})]})]})}var mc=/* @__PURE__ */Object.freeze([]),yc=/* @__PURE__ */Object.freeze([]),vc=/* @__PURE__ */Object.freeze({submitBehavior:"submit"}),xc=/* @__PURE__ */Object.freeze(n.Platform.OS==="web"?{rows:1}:{}),wc=/* @__PURE__ */Object.freeze({code:"unknown",retryable:true,filename:""});function kc(e){let t=e.color,r=e.slots.sendButton,l=textRole(e,"body").fontSize+dc;return n.StyleSheet.create({bar:{marginTop:lc,marginHorizontal:ic,marginBottom:oc,minHeight:rc,paddingLeft:8,paddingRight:6,paddingVertical:0,borderWidth:nc,borderColor:e.slots.composerInput?.borderColor??t.text.primary},barFocused:{borderWidth:cc,paddingLeft:8-(cc-nc),paddingRight:6-(cc-nc)},input:{fontSize:l,lineHeight:Math.round(l*pc),minHeight:Math.round(l*pc),...n.Platform.OS==="web"?{outlineStyle:"none"}:null},add:{width:fc,height:fc,borderRadius:fc/2},disc:{width:ac,height:ac,borderRadius:ac/2,alignItems:"center",justifyContent:"center",backgroundColor:r?.backgroundColor??t.text.primary,...vo(r)},dimmed:{opacity:uc},tray:{marginHorizontal:ic,marginTop:lc,paddingBottom:0}})}function Sc(e){return n.StyleSheet.create({tray:{marginHorizontal:e.space.md,marginTop:e.space.xs,paddingBottom:0}})}var Cc=/* @__PURE__ */new WeakMap;function jc(e,t){let r=Cc.get(e);return r===void 0&&(r=/* @__PURE__ */new Set,Cc.set(e,r)),r.add(t),()=>{r?.delete(t)}}function useEverfurPets(){let{runtime:t,userRef:userRef,activePet:r,scopeEpoch:n}=we(),l=e.useMemo(()=>createPetsRepository(t.registry.services.authFor(userRef)),[t,userRef,n]),[i,o]=e.useState({repository:l,pets:[],loading:true,error:null}),a=i.repository===l?i:{pets:[],loading:true,error:null},s=e.useRef(0),u=e.useCallback(async()=>{let e=++s.current;o(e=>({...e,repository:l,loading:true,error:null,pets:e.repository===l?e.pets:[]}));let t=await l.list();e===s.current&&o(t.ok?{repository:l,pets:t.value,loading:false,error:null}:e=>({repository:l,pets:e.repository===l?e.pets:[],loading:false,error:t.error}))},[l]);e.useEffect(()=>(u(),()=>{s.current+=1}),[u]),e.useEffect(()=>jc(t,()=>{u()}),[t,u]);let c=e.useMemo(()=>r===null?null:a.pets.find(e=>e.petRef===r)??null,[r,a.pets]);return e.useMemo(()=>({pets:a.pets,activePet:c,loading:a.loading,error:a.error,refresh:u}),[a.pets,a.loading,a.error,c,u])}function Rc(e,t){if(t!==null){let r=e.find(e=>e.petRef===t);if(r!==void 0)return r}return e[0]??null}var Tc=/* @__PURE__ */Object.freeze({visitButton:"Vet"});var _c=false;function zc(e,t){return t!==void 0?(vr(t,e),"onStartInApp"):f(e)==="presented"?"presenter":m(e)?"experience":(_c||(_c=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}var Ic=/* @__PURE__ */Object.freeze(["visit","join","summary","messages"]);function isVetVisitIntent(e){return typeof e=="string"&&Ic.includes(e)}var Pc="/widget/v1/televet/handoffs",Ec="/widget/v1/televet/availability",Mc="/widget/v1/televet/chat-entry",Fc=/^[a-z0-9][a-z0-9_-]{0,39}$/,Ac=/^[A-Za-z0-9_-]{22}$/;var Lc=32,Oc=128,Vc=64;function vetVisitErrorReasonOf(e){let t=e.httpStatus;switch(e.code){case"sessionRequired":return"sessionRequired";case"authExpired":case"authRejected":return"authRejected";case"sdkUpdateRequired":return"sdkUpdateRequired";case"validationFailed":return"invalidRequest";case"rateLimited":case"quotaExceeded":return"rateLimited"}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}function Dc(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Bc(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function Hc(petRef,e){let t={};petRef!==void 0&&(t.pet_ref=petRef);let r=e?.returnTo;if(r!=null){if(typeof r!="string"||!Fc.test(r))return{ok:false,message:"returnTo must be a registered return destination key"};t.return_to=r}let n=e?.entry;if(n!=null){if(n!=="chat"||petRef===void 0)return{ok:false,message:"entry 'chat' needs the pet the chat is about"};t.entry=n}let l=e?.visitRef,i=e?.intent,o=l!=null;if(o){let e=typeof l=="string"?l.trim():"";if(e.length<1||[...e].length>Vc)return{ok:false,message:`visitRef must be 1..${Vc} characters`};t.visit_ref=e}if(i!=null){if(!o)return{ok:false,message:"intent needs the visitRef it opens"};if(!isVetVisitIntent(i))return{ok:false,message:`intent must be one of ${Ic.join(", ")}`};t.intent=i}return{ok:true,body:t}}function Wc(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!isVetVisitIntent(r)?null:/* @__PURE__ */Object.freeze({visitRef:t,intent:r})}function Nc(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=e=>(Yc(r,"televet.visit.handoff_failed",{reason:vetVisitErrorReasonOf(e)}),err(e));return{async createHandoff(petRef,e){let l;if(petRef!=null){let e=typeof petRef=="string"?[...petRef].length:0;if(e<1||e>Oc)return n(makeEverfurError("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Oc} characters`}));l=petRef}let i=Hc(l,e);if(!i.ok){let e=Dc(i.message);return e.ok?e:n(e.error)}let o=i.body,a=await t.send("televet.visit.handoff",{method:"POST",path:Pc,body:o},{idempotent:false,maxAttempts:1});if(!a.ok)return n(a.error);let s=Uc(a.value),u=o.return_to!==void 0,c=u?a.value?.flow_id:void 0;if(u&&(typeof c!="string"||!Ac.test(c))){let e=Bc("the handoff response carried no usable return flow id");return e.ok?e:n(e.error)}let d=o.visit_ref!==void 0,p=d?Wc(a.value?.visit):null;if(d&&p===null){let e=Bc("the handoff response did not confirm the visit it opens");return e.ok?e:n(e.error)}let f=s===null?null:/* @__PURE__ */Object.freeze({...s,...u?{flowId:c}:{},...p!==null?{visit:p}:{}});return f===null?n(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(Yc(r,"televet.visit.handoff_created",{pet_scoped:o.pet_ref!==void 0}),ok(f))},async checkAvailability(e){if(typeof e!="string"||e.length>Lc)return Dc(`state must be at most ${Lc} characters`);let r=await t.send("televet.visit.availability",{method:"POST",path:Ec,body:{state:e}},{idempotent:false,maxAttempts:1});if(!r.ok)return err(r.error);let n=r.value?.available;return typeof n!="boolean"?Bc("the availability response carried no usable answer"):ok(/* @__PURE__ */Object.freeze({available:n}))},async chatEntryOpen(){try{let e=await t.send("televet.visit.chat_entry",{method:"GET",path:Mc},{maxAttempts:1});return e.ok&&e.value?.open===!0}catch{return false}}}}function Uc(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Kc(t)?null:/* @__PURE__ */Object.freeze({url:t,expiresAt:r})}var $c=/* @__PURE__ */new Set(["localhost","127.0.0.1","[::1]"]),qc=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Gc=/[\s\u0000-\u001f\u007f]/;function Kc(e){if(Gc.test(e))return false;let t=qc.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let l=n.replace(/:\d+$/,"").toLowerCase(),i=r==="https",o=r==="http"&&$c.has(l);if(!i&&!o)return false;let a=e.indexOf("#");if(a<0)return false;let s=e.slice(a);return s.startsWith("#h=")&&s.length>3}function Yc(e,t,r){if(e)try{e.track(t,r)}catch{}}var Qc=/* @__PURE__ */Object.freeze({status:"idle",error:null,errorReason:null});function Zc(t,r,n){let{usState:l,chat:i,scope:o}=n,a=r&&(l!==null||i),s=`${l??""}|${i?"chat":""}`,[u,c]=e.useState(null);if(e.useEffect(()=>{if(!a)return;let e=true,r=t.current;return c(null),(async()=>{try{if(i&&!(r.chatEntryOpen&&await r.chatEntryOpen()))return!1;if(l===null)return!0;if(!r.checkAvailability)return!1;let e=await r.checkAvailability(l);return e.ok&&e.value.available}catch{return false}})().then(t=>{e&&c({key:s,open:t})}),()=>{e=false}},[a,s,l,i,o,t]),!a)return null;let d=u!==null&&u.key===s;return{open:d&&u.open,pending:!d}}var Jc=/* @__PURE__ */Object.freeze({status:"opening",error:null,errorReason:null});function Xc(t,r={}){let{runtime:n,userRef:userRef,scopeEpoch:l}=we(),i=useCapability("televet"),o=i.enabled&&userRef!==null,a=r.usState??null,s=r.entry==="chat",u=r.petRef??null,c=r.prefer==="redirect",d=e.useMemo(()=>{if(r.controller)return r.controller;let{services:e}=n.registry;return Nc({auth:e.authFor(userRef),telemetry:e.telemetry,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})},[n,userRef,l,r.controller]),p=e.useRef(d);p.current=d;let f=e.useMemo(()=>({runtime:n,userRef:userRef,scopeEpoch:l}),[n,userRef,l]),h=Zc(p,o,{usState:a,chat:s,scope:f}),b=o&&(h===null||h.open)&&(!s||u!==null),g=r.returnTo??null,[m,y]=e.useState(Qc),v=e.useRef(null),x=e.useRef({runtime:n,userRef:userRef,scopeEpoch:l});x.current={runtime:n,userRef:userRef,scopeEpoch:l};let w=e.useRef(d);w.current=d;let k=e.useRef(b);k.current=b;let S=e.useCallback((petRef,e)=>{if(v.current)return v.current;let r=(e,t)=>(y({status:e==="cancelled"?"idle":"error",error:t,errorReason:e==="cancelled"?null:e}),/* @__PURE__ */Object.freeze({opened:false,reason:e,error:t}));if(!k.current)return Promise.resolve(r("unavailable",null));let n=t.prepare();if(!n.ok)return Promise.resolve(r(n.reason,null));let l=x.current,i=w.current;y(Jc);let o=(async()=>{let o,a={...g!==null?{returnTo:g}:{},...s?{entry:"chat"}:{},...e!==null?{visitRef:e.visitRef}:{},...e!==null&&e.intent!==null&&e.intent!==void 0?{intent:e.intent}:{}},c=Object.keys(a).length===0?void 0:a,d=petRef===void 0?u:petRef;try{o=await(c===void 0?i.createHandoff(d):i.createHandoff(d,c))}catch{return t.abandon(n.value),r("unknown",null)}let p=x.current;if(p.runtime!==l.runtime||p.userRef!==l.userRef||p.scopeEpoch!==l.scopeEpoch)return t.abandon(n.value),r("cancelled",null);if(!o.ok)return t.abandon(n.value),r(vetVisitErrorReasonOf(o.error),o.error);let f=await t.finish(n.value,o.value);return f!==null?r(f,null):(y(Qc),/* @__PURE__ */Object.freeze(o.value.flowId===void 0?{opened:true}:{opened:true,flowId:o.value.flowId}))})().finally(()=>{v.current===o&&(v.current=null)});return v.current=o,o},[t,u,g,s]),C=e.useCallback((petRef,e)=>{if(!k.current)return y({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(/* @__PURE__ */Object.freeze({opened:false,reason:"unavailable",error:null}));let t=petRef===void 0?u:petRef,r={...t!==null?{petRef:t}:{},...a!==null?{usState:a}:{},...e!==null&&"consultId"in e?{consultId:e.consultId}:{},...e!==null&&"visitRef"in e?{visitRef:e.visitRef,intent:e.intent}:{}};return zc(r)===null?(y({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(/* @__PURE__ */Object.freeze({opened:false,reason:"unavailable",error:null}))):(y(Qc),Promise.resolve(/* @__PURE__ */Object.freeze({opened:true})))},[u,a]),j=e.useCallback(petRef=>c?S(petRef,null):C(petRef,null),[c,S,C]),R=e.useCallback((e,t)=>c?S(void 0,{visitRef:e,intent:t??null}):C(void 0,{visitRef:e,intent:t??null}),[c,S,C]),T=e.useCallback(e=>c?S(void 0,null):C(void 0,{consultId:e.trim()}),[c,S,C]);return{available:b,isPending:i.isPending||(h?.pending??false),status:m.status,error:m.error,errorReason:m.errorReason,open:j,openVisit:R,joinVisit:T}}var ed=e=>n.Linking.openURL(e);function useVetVisit(t={}){let{openUrl:r,...n}=t,l=e.useMemo(()=>{let e=r??ed;return{prepare:()=>({ok:true,value:null}),async finish(t,r){try{return await e(r.url),null}catch{return"openFailed"}},abandon:()=>{}}},[r]);return Xc(l,n)}var td=44,rd=.6;function VetVisitButtonCore(r){let{petRef:petRef,label:l,openUrl:i,onOpened:o,onError:a,style:s,labelStyle:u,controller:c,returnTo:d,usState:p,entry:f,visitRef:h,intent:b,onStartInApp:g,prefer:m}=r,y=m==="redirect",v=useVetVisit({...d!==void 0?{returnTo:d}:{},...p!==void 0?{usState:p}:{},...f!==void 0?{entry:f}:{},...petRef!==void 0?{petRef:petRef}:{},...i!==void 0?{openUrl:i}:{},...c!==void 0?{controller:c}:{},prefer:y?"redirect":"in-app"}),x=useEverfurTheme(),w=e.useMemo(()=>nd(x),[x]),k=e.useRef(false);if(!v.available)/* @__PURE__ */
118
118
  return t.jsxs(t.Fragment,{children:[null,
119
- /* @__PURE__ */t.jsx(TelevetHostOutlet,{})]});let S=v.status==="opening",C=l??jc.visitButton;/* @__PURE__ */
119
+ /* @__PURE__ */t.jsx(TelevetHostOutlet,{})]});let S=v.status==="opening",C=l??Tc.visitButton;/* @__PURE__ */
120
120
  return t.jsxs(t.Fragment,{children:[
121
- /* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>{if(!(S||k.current)){if(!y){let e={...petRef!==void 0?{petRef:petRef}:{},...p!==void 0?{usState:p}:{},...h!=null?{visitRef:h,intent:b??null}:{}};Tc(e,g)===null&&vr(a,"unavailable",null);return}k.current=true,(h==null?v.open():v.openVisit(h,b??null)).then(e=>{e.opened?vr(o,e.flowId??null):e.reason!=="cancelled"&&vr(a,e.reason,e.error)}).finally(()=>{k.current=false})}},accessibilityRole:"button",accessibilityLabel:C,accessibilityState:{busy:S,disabled:S},style:[w.button,S?w.busy:null,s],children:/* @__PURE__ */t.jsx(Text,{style:[w.label,u],children:C})}),
122
- /* @__PURE__ */t.jsx(TelevetHostOutlet,{})]})}function td(e){let{color:t,space:r,radius:l,type:i,slots:o}=e;return n.StyleSheet.create({button:{minHeight:Xc,minWidth:Xc,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:l.pill,backgroundColor:t.primary,...ho(o.vetVisitButton)},busy:{opacity:ed},label:{...face(e,"medium"),color:t.onPrimary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,...go(o.vetVisitButton)}})}function rd(t){let[r,n]=e.useState(null);return{shown:t!==null&&r!==t,onError:()=>n(t)}}function BrandImage({uri:e,label:r,decorative:l=false,style:i,resizeMode:o="contain",fallback:a=null,onError:s,testID:u}){let c=rd(e);if(e===null||!c.shown)return a;let d=l?{accessible:false,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"}:{accessible:true,accessibilityRole:"image",...r===void 0?{}:{accessibilityLabel:r}};/* @__PURE__ */
123
- return t.jsx(n.Image,{source:{uri:e},style:i,resizeMode:o,...d,onError:()=>{c.onError(),s?.()},...u===void 0?{}:{testID:u}})}function BrandLogo({logoUrl:e,name:r,barStyle:l,logoStyle:i,testID:o}){let a=rd(e);return e===null||!a.shown?null:/* @__PURE__ */t.jsx(n.View,{style:l,...o===void 0?{}:{testID:o},children:/* @__PURE__ */t.jsx(n.Image,{source:{uri:e},style:i,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:r,onError:a.onError})})}var nd=/* @__PURE__ */Object.freeze({row:null,leading:null,trailing:null}),ld=/* @__PURE__ */Object.freeze({leading:void 0,trailing:void 0});function id(e,t,r){if(e.row===null||e.leading===null||e.trailing===null)return ld;let n=Math.abs(e.leading-e.trailing);if(n<.5)return ld;let l=e.row-t-e.leading-e.trailing,i=Math.min(n,Math.max(0,l-r));return i<.5?ld:e.leading<e.trailing?{leading:e.leading+i,trailing:void 0}:{leading:void 0,trailing:e.trailing+i}}function od(e,t,r){let n=e[t];return n!==null&&Math.abs(n-r)<.5?e:{...e,[t]:r}}function ad(e){return[e.surface,e.surfaceCream,e.surfaceSubtle,e.background,e.chatGround,e.composerFill]}function sd(e){if(e.brightness!=="light")return false;let t=Y.color,r=e.color,n=(e,t)=>parseColor(e)===parseColor(t),l=new Set(ad(t));return n(r.brand,t.brand)&&n(r.accent,t.accent)&&ad(r).every(e=>l.has(e))}function ud(e){let t=(e.brightness==="dark"?Z:Y).color,r=e.color,n=(e,t)=>parseColor(e)===parseColor(t);return{success:!n(r.success,t.success),warning:!n(r.warningStrong,t.warningStrong)||!n(r.cautionAccent,t.cautionAccent),info:!(n(r.info,r.brandInk)&&n(r.badgeBgInfo,r.brandSoft)&&n(r.infoEdge,r.structureEdge))}}function cd(e){return canonicalPetSpecies(e)==="cat"?"cat":"dog"}function dd(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.floor(e)}function pd(e){let t=dd(e.ageYears),r=cd(e.species)==="cat"?"Cat":"Dog";if(t==null)return r;let n=t===1?"1 yr":`${t} yrs`;return`${r} · ${n}`}var fd=/* @__PURE__ */Object.freeze([
121
+ /* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>{if(!(S||k.current)){if(!y){let e={...petRef!==void 0?{petRef:petRef}:{},...p!==void 0?{usState:p}:{},...h!=null?{visitRef:h,intent:b??null}:{}};zc(e,g)===null&&vr(a,"unavailable",null);return}k.current=true,(h==null?v.open():v.openVisit(h,b??null)).then(e=>{e.opened?vr(o,e.flowId??null):e.reason!=="cancelled"&&vr(a,e.reason,e.error)}).finally(()=>{k.current=false})}},accessibilityRole:"button",accessibilityLabel:C,accessibilityState:{busy:S,disabled:S},style:[w.button,S?w.busy:null,s],children:/* @__PURE__ */t.jsx(Text,{style:[w.label,u],children:C})}),
122
+ /* @__PURE__ */t.jsx(TelevetHostOutlet,{})]})}function nd(e){let{color:t,space:r,radius:l,type:i,slots:o}=e;return n.StyleSheet.create({button:{minHeight:td,minWidth:td,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:l.pill,backgroundColor:t.primary,...vo(o.vetVisitButton)},busy:{opacity:rd},label:{...face(e,"medium"),color:t.onPrimary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,...wo(o.vetVisitButton)}})}function ld(t){let[r,n]=e.useState(null);return{shown:t!==null&&r!==t,onError:()=>n(t)}}function BrandImage({uri:e,label:r,decorative:l=false,style:i,resizeMode:o="contain",fallback:a=null,onError:s,testID:u}){let c=ld(e);if(e===null||!c.shown)return a;let d=l?{accessible:false,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"}:{accessible:true,accessibilityRole:"image",...r===void 0?{}:{accessibilityLabel:r}};/* @__PURE__ */
123
+ return t.jsx(n.Image,{source:{uri:e},style:i,resizeMode:o,...d,onError:()=>{c.onError(),s?.()},...u===void 0?{}:{testID:u}})}function BrandLogo({logoUrl:e,name:r,barStyle:l,logoStyle:i,testID:o}){let a=ld(e);return e===null||!a.shown?null:/* @__PURE__ */t.jsx(n.View,{style:l,...o===void 0?{}:{testID:o},children:/* @__PURE__ */t.jsx(n.Image,{source:{uri:e},style:i,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:r,onError:a.onError})})}var id=/* @__PURE__ */Object.freeze({row:null,leading:null,trailing:null}),od=/* @__PURE__ */Object.freeze({leading:void 0,trailing:void 0});function ad(e,t,r){if(e.row===null||e.leading===null||e.trailing===null)return od;let n=Math.abs(e.leading-e.trailing);if(n<.5)return od;let l=e.row-t-e.leading-e.trailing,i=Math.min(n,Math.max(0,l-r));return i<.5?od:e.leading<e.trailing?{leading:e.leading+i,trailing:void 0}:{leading:void 0,trailing:e.trailing+i}}function sd(e,t,r){let n=e[t];return n!==null&&Math.abs(n-r)<.5?e:{...e,[t]:r}}function ud(e){return[e.surface,e.surfaceCream,e.surfaceSubtle,e.background,e.chatGround,e.composerFill]}function cd(e){if(e.brightness!=="light")return false;let t=Y.color,r=e.color,n=(e,t)=>parseColor(e)===parseColor(t),l=new Set(ud(t));return n(r.brand,t.brand)&&n(r.accent,t.accent)&&ud(r).every(e=>l.has(e))}function dd(e){let t=(e.brightness==="dark"?Z:Y).color,r=e.color,n=(e,t)=>parseColor(e)===parseColor(t);return{success:!n(r.success,t.success),warning:!n(r.warningStrong,t.warningStrong)||!n(r.cautionAccent,t.cautionAccent),info:!(n(r.info,r.brandInk)&&n(r.badgeBgInfo,r.brandSoft)&&n(r.infoEdge,r.structureEdge))}}function pd(e){return canonicalPetSpecies(e)==="cat"?"cat":"dog"}function fd(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.floor(e)}function hd(e){let t=fd(e.ageYears),r=pd(e.species)==="cat"?"Cat":"Dog";if(t==null)return r;let n=t===1?"1 yr":`${t} yrs`;return`${r} · ${n}`}var bd=/* @__PURE__ */Object.freeze([
124
124
  /* @__PURE__ */Object.freeze({background:"#ffbdbd",foreground:"#6d1d14"}),
125
125
  /* @__PURE__ */Object.freeze({background:"#a0c4f6",foreground:"#0b3a73"}),
126
126
  /* @__PURE__ */Object.freeze({background:"#fbc558",foreground:"#10462e"}),
127
127
  /* @__PURE__ */Object.freeze({background:"#bde7c5",foreground:"#0e3b22"}),
128
128
  /* @__PURE__ */Object.freeze({background:"#dcc7f4",foreground:"#3a1d6a"}),
129
- /* @__PURE__ */Object.freeze({background:"#ffd8a8",foreground:"#5a2a04"})]);function hd(e){let t=0;for(let r=0;r<e.length;r+=1)t=t*31+e.charCodeAt(r)>>>0;return fd[t%fd.length]}function bd(e){let t=(e??"").trim();return(Array.from(t)[0]??"?").toUpperCase()}function gd(e){return{...hd(e.petRef),initial:bd(e.name)}}function md(e,t,r){let n=gd(e);return t?n:{background:r.fill,foreground:r.ink,initial:n.initial}}function yd(e){return Math.max(12,Math.round(e*.42))}function PetDisc({pet:r,size:l,ringStroke:i}){let o=useEverfurTheme(),a=e.useMemo(()=>vd(o),[o]),s=l-i*2,u=r===null?null:md(r,sd(o),{fill:o.color.highlight,ink:o.color.onHighlight}),c=yd(s);/* @__PURE__ */
130
- return t.jsx(Ring,{size:l,strokeWidth:i,color:o.color.mark,children:/* @__PURE__ */t.jsx(n.View,{style:[a.disc,{width:s,height:s,borderRadius:s/2},u===null?a.discEmpty:{backgroundColor:u.background}],children:/* @__PURE__ */t.jsx(Text,{tier:"badge",style:[a.letter,{fontSize:c,lineHeight:Math.round(c*1.2),color:u===null?o.color.text.muted:u.foreground}],children:u===null?bd(null):u.initial})})})}function vd(e){return n.StyleSheet.create({disc:{alignItems:"center",justifyContent:"center",overflow:"hidden"},discEmpty:{backgroundColor:e.color.brandSoft},letter:{...face(e,"bold"),textAlign:"center",includeFontPadding:false}})}function xd(e,t){let{borderRadius:r,...n}=ho(e,t);return r===void 0?n:{...n,borderTopLeftRadius:r,borderTopRightRadius:r}}function wd(e,t){let{backgroundColor:r,borderColor:n,borderWidth:l,borderRadius:i}=ho(e,t);return{...r===void 0?{}:{backgroundColor:r},...n===void 0?{}:{borderRightColor:n,borderRightWidth:l??1},...i===void 0?{}:{borderTopRightRadius:i,borderBottomRightRadius:i}}}var kd=48,Sd=2,Cd=320,jd="80%",Rd="rgba(17,17,17,0.45)",Td=18,_d=22,zd=12,Id=.4,Pd=44;function Ed(e){return e?.name?.trim()||pe.yourPet}function PetSwitcherSheet({visible:r,pets:l,activePetRef:i,onSelect:o,onAddPet:a=null,onClose:s}){let u=useEverfurTheme(),c=e.useMemo(()=>Md(u),[u]);return r?/* @__PURE__ */t.jsx(n.Modal,{visible:true,transparent:true,animationType:u.motion.reducedMotion?"none":"fade",onRequestClose:s,children:/* @__PURE__ */t.jsxs(n.View,{style:c.root,children:[
131
- /* @__PURE__ */t.jsx(n.Pressable,{style:Ia,onPress:s,accessibilityRole:"button",accessibilityLabel:pe.close,children:/* @__PURE__ */t.jsx(n.View,{style:c.backdrop})}),
129
+ /* @__PURE__ */Object.freeze({background:"#ffd8a8",foreground:"#5a2a04"})]);function gd(e){let t=0;for(let r=0;r<e.length;r+=1)t=t*31+e.charCodeAt(r)>>>0;return bd[t%bd.length]}function md(e){let t=(e??"").trim();return(Array.from(t)[0]??"?").toUpperCase()}function yd(e){return{...gd(e.petRef),initial:md(e.name)}}function vd(e,t,r){let n=yd(e);return t?n:{background:r.fill,foreground:r.ink,initial:n.initial}}function xd(e){return Math.max(12,Math.round(e*.42))}function PetDisc({pet:r,size:l,ringStroke:i}){let o=useEverfurTheme(),a=e.useMemo(()=>wd(o),[o]),s=l-i*2,u=r===null?null:vd(r,cd(o),{fill:o.color.highlight,ink:o.color.onHighlight}),c=xd(s);/* @__PURE__ */
130
+ return t.jsx(Ring,{size:l,strokeWidth:i,color:o.color.mark,children:/* @__PURE__ */t.jsx(n.View,{style:[a.disc,{width:s,height:s,borderRadius:s/2},u===null?a.discEmpty:{backgroundColor:u.background}],children:/* @__PURE__ */t.jsx(Text,{tier:"badge",style:[a.letter,{fontSize:c,lineHeight:Math.round(c*1.2),color:u===null?o.color.text.muted:u.foreground}],children:u===null?md(null):u.initial})})})}function wd(e){return n.StyleSheet.create({disc:{alignItems:"center",justifyContent:"center",overflow:"hidden"},discEmpty:{backgroundColor:e.color.brandSoft},letter:{...face(e,"bold"),textAlign:"center",includeFontPadding:false}})}function kd(e,t){let{borderRadius:r,...n}=vo(e,t);return r===void 0?n:{...n,borderTopLeftRadius:r,borderTopRightRadius:r}}function Sd(e,t){let{backgroundColor:r,borderColor:n,borderWidth:l,borderRadius:i}=vo(e,t);return{...r===void 0?{}:{backgroundColor:r},...n===void 0?{}:{borderRightColor:n,borderRightWidth:l??1},...i===void 0?{}:{borderTopRightRadius:i,borderBottomRightRadius:i}}}var Cd=48,jd=2,Rd=320,Td="80%",_d="rgba(17,17,17,0.45)",zd=18,Id=22,Pd=12,Ed=.4,Md=44;function Fd(e){return e?.name?.trim()||pe.yourPet}function PetSwitcherSheet({visible:r,pets:l,activePetRef:i,onSelect:o,onAddPet:a=null,onClose:s}){let u=useEverfurTheme(),c=e.useMemo(()=>Ad(u),[u]);return r?/* @__PURE__ */t.jsx(n.Modal,{visible:true,transparent:true,animationType:u.motion.reducedMotion?"none":"fade",onRequestClose:s,children:/* @__PURE__ */t.jsxs(n.View,{style:c.root,children:[
131
+ /* @__PURE__ */t.jsx(n.Pressable,{style:Aa,onPress:s,accessibilityRole:"button",accessibilityLabel:pe.close,children:/* @__PURE__ */t.jsx(n.View,{style:c.backdrop})}),
132
132
  /* @__PURE__ */t.jsxs(n.View,{style:c.panel,accessibilityViewIsModal:true,children:[
133
133
  /* @__PURE__ */t.jsx(Text,{tier:"heading",style:c.title,accessibilityRole:"header",children:pe.yourPets}),
134
- /* @__PURE__ */t.jsx(n.ScrollView,{style:c.list,contentContainerStyle:c.listContent,showsVerticalScrollIndicator:true,children:l.map(e=>{let r=e.petRef===i,l=Ed(e),a=pd(e);/* @__PURE__ */
134
+ /* @__PURE__ */t.jsx(n.ScrollView,{style:c.list,contentContainerStyle:c.listContent,showsVerticalScrollIndicator:true,children:l.map(e=>{let r=e.petRef===i,l=Fd(e),a=hd(e);/* @__PURE__ */
135
135
  return t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:fe(r?pe.petCurrentlyActive:pe.switchToPet,{name:l}),accessibilityState:{selected:r},style:[c.row,r?c.rowActive:null],onPress:()=>o(e.petRef),children:[
136
- /* @__PURE__ */t.jsx(PetDisc,{pet:e,size:kd,ringStroke:Sd}),
136
+ /* @__PURE__ */t.jsx(PetDisc,{pet:e,size:Cd,ringStroke:jd}),
137
137
  /* @__PURE__ */t.jsxs(n.View,{style:c.copy,children:[
138
138
  /* @__PURE__ */t.jsx(Text,{style:c.name,numberOfLines:1,children:l}),
139
- /* @__PURE__ */t.jsx(Text,{tier:"compact",style:c.meta,numberOfLines:1,children:r?`${pe.activePrefix}${a}`:a})]}),r?/* @__PURE__ */t.jsx(CheckGlyph,{size:Td,color:u.color.brandInk}):null]},e.petRef)})}),a!==null?/* @__PURE__ */t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.addAnotherPet,style:c.addRow,onPress:a,children:[
139
+ /* @__PURE__ */t.jsx(Text,{tier:"compact",style:c.meta,numberOfLines:1,children:r?`${pe.activePrefix}${a}`:a})]}),r?/* @__PURE__ */t.jsx(CheckGlyph,{size:zd,color:u.color.brandInk}):null]},e.petRef)})}),a!==null?/* @__PURE__ */t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.addAnotherPet,style:c.addRow,onPress:a,children:[
140
140
  /* @__PURE__ */t.jsx(n.View,{style:c.addDisc,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:c.addPlus,children:"+"})}),
141
141
  /* @__PURE__ */t.jsx(Text,{style:c.addLabel,children:pe.addAnotherPet})]}):null,
142
- /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.close,containerStyle:c.closeSlot,style:c.closeButton,onPress:s,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:c.closeText,children:pe.close})})]})]})}):null}function Md(e){let t=e.color,r=e.radius,l=go(e.slots.dialog);return n.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:Rd},panel:{backgroundColor:t.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:_d,borderTopRightRadius:_d,gap:14,maxHeight:jd,...xd(e.slots.dialog)},title:{...headingFace(e,"bold"),fontSize:18,lineHeight:22,color:t.brandInk,...l},list:{maxHeight:Cd,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:Pd,paddingHorizontal:8},addDisc:{width:kd,height:kd,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:Sd,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream},addPlus:{...face(e,"bold"),fontSize:20,lineHeight:22,color:t.brandInk},addLabel:{...face(e,"bold"),fontSize:15,lineHeight:20,color:t.text.primary,...l},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowActive:{borderColor:t.brandInk,backgroundColor:t.brandSoft},copy:{flex:1,gap:2},name:{...face(e,"bold"),fontSize:15,lineHeight:18,color:t.text.primary},meta:{...face(e,"monoBold"),fontSize:11,lineHeight:13,color:t.text.muted,textTransform:"uppercase",letterSpacing:Id},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:zd,backgroundColor:t.brandSoft},closeText:{...face(e,"bold"),color:t.brandInk,fontSize:13,lineHeight:16,letterSpacing:Id}})}var Fd=44,Ad=36,Ld=22,Od=20,Vd=9,Dd=1.5,Bd=6,Hd=35,Wd=1.75,Nd=12.4,Ud=.5,$d=8,qd=28,Gd=160,Kd=16,Yd=8;function Qd(e,petRef){return Cc(e,petRef)}function ChatHeader({pets:r,petRef:petRef,historyUnread:l,onOpenHistory:i,onNewChat:o,onPetChange:a,onAddPet:s,vet:u,textingEntry:c=null}){let d=useEverfurTheme(),p=e.useMemo(()=>Zd(d),[d]),[f,h]=e.useState(false),b=Qd(r.pets,petRef),g=b!==null&&(r.pets.length>=2||s!==void 0),m=petRef??b?.petRef??null,y=Ed(b),[v,x]=e.useState(nd),w=e.useCallback(e=>t=>{let r=t.nativeEvent.layout.width;x(t=>od(t,e,r))},[]),k=e.useMemo(()=>w("row"),[w]),S=e.useMemo(()=>w("leading"),[w]),C=e.useMemo(()=>w("trailing"),[w]),j=2*Kd+2*(d.slots.header?.borderColor!==void 0?1:0)+2*Yd,R=id(v,j,Gd),T=e=>{h(false),r.setActivePet(e),vr(a,e)},_=s===void 0?null:()=>{h(false),vr(s)};/* @__PURE__ */
142
+ /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.close,containerStyle:c.closeSlot,style:c.closeButton,onPress:s,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:c.closeText,children:pe.close})})]})]})}):null}function Ad(e){let t=e.color,r=e.radius,l=wo(e.slots.dialog);return n.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:_d},panel:{backgroundColor:t.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:Id,borderTopRightRadius:Id,gap:14,maxHeight:Td,...kd(e.slots.dialog)},title:{...headingFace(e,"bold"),fontSize:18,lineHeight:22,color:t.brandInk,...l},list:{maxHeight:Rd,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:Md,paddingHorizontal:8},addDisc:{width:Cd,height:Cd,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:jd,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream},addPlus:{...face(e,"bold"),fontSize:20,lineHeight:22,color:t.brandInk},addLabel:{...face(e,"bold"),fontSize:15,lineHeight:20,color:t.text.primary,...l},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowActive:{borderColor:t.brandInk,backgroundColor:t.brandSoft},copy:{flex:1,gap:2},name:{...face(e,"bold"),fontSize:15,lineHeight:18,color:t.text.primary},meta:{...face(e,"monoBold"),fontSize:11,lineHeight:13,color:t.text.muted,textTransform:"uppercase",letterSpacing:Ed},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:Pd,backgroundColor:t.brandSoft},closeText:{...face(e,"bold"),color:t.brandInk,fontSize:13,lineHeight:16,letterSpacing:Ed}})}var Ld=44,Od=36,Vd=22,Dd=20,Bd=9,Hd=1.5,Wd=6,Nd=35,Ud=1.75,$d=12.4,qd=.5,Gd=8,Kd=28,Yd=160,Qd=16,Zd=8;function Jd(e,petRef){return Rc(e,petRef)}function ChatHeader({pets:r,petRef:petRef,historyUnread:l,onOpenHistory:i,onNewChat:o,onPetChange:a,onAddPet:s,vet:u,textingEntry:c=null}){let d=useEverfurTheme(),p=e.useMemo(()=>Xd(d),[d]),[f,h]=e.useState(false),b=Jd(r.pets,petRef),g=b!==null&&(r.pets.length>=2||s!==void 0),m=petRef??b?.petRef??null,y=Fd(b),[v,x]=e.useState(id),w=e.useCallback(e=>t=>{let r=t.nativeEvent.layout.width;x(t=>sd(t,e,r))},[]),k=e.useMemo(()=>w("row"),[w]),S=e.useMemo(()=>w("leading"),[w]),C=e.useMemo(()=>w("trailing"),[w]),j=2*Qd+2*(d.slots.header?.borderColor!==void 0?1:0)+2*Zd,R=ad(v,j,Yd),T=e=>{h(false),r.setActivePet(e),vr(a,e)},_=s===void 0?null:()=>{h(false),vr(s)};/* @__PURE__ */
143
143
  return t.jsxs(t.Fragment,{children:[
144
144
  /* @__PURE__ */t.jsxs(n.View,{style:p.row,onLayout:k,children:[
145
- /* @__PURE__ */t.jsx(n.View,{style:[p.leading,R.leading===void 0?null:{minWidth:R.leading}],children:/* @__PURE__ */t.jsxs(n.View,{style:p.sideContent,onLayout:S,children:[o!==void 0?/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:Jl.newChat,containerStyle:p.iconSlot,style:p.iconButton,onPress:o,children:/* @__PURE__ */t.jsx(EditGlyph,{size:Od,color:d.slots.header?.textColor??d.color.text.primary,strokeWidth:2})}):null,
145
+ /* @__PURE__ */t.jsx(n.View,{style:[p.leading,R.leading===void 0?null:{minWidth:R.leading}],children:/* @__PURE__ */t.jsxs(n.View,{style:p.sideContent,onLayout:S,children:[o!==void 0?/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:ni.newChat,containerStyle:p.iconSlot,style:p.iconButton,onPress:o,children:/* @__PURE__ */t.jsx(EditGlyph,{size:Dd,color:d.slots.header?.textColor??d.color.text.primary,strokeWidth:2})}):null,
146
146
  /* @__PURE__ */t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:l?`${pe.openHistoryNative}${pe.newReplySuffix}`:pe.openHistoryNative,containerStyle:p.iconSlot,style:p.iconButton,onPress:i,children:[
147
- /* @__PURE__ */t.jsx(MenuGlyph,{size:Ld,color:d.slots.header?.textColor??d.color.text.primary,strokeWidth:2}),l?/* @__PURE__ */t.jsx(n.View,{style:p.unreadDot,pointerEvents:"none"}):null]})]})}),
147
+ /* @__PURE__ */t.jsx(MenuGlyph,{size:Vd,color:d.slots.header?.textColor??d.color.text.primary,strokeWidth:2}),l?/* @__PURE__ */t.jsx(n.View,{style:p.unreadDot,pointerEvents:"none"}):null]})]})}),
148
148
  /* @__PURE__ */t.jsx(n.View,{style:p.centre,pointerEvents:"box-none",children:/* @__PURE__ */t.jsx(BrandLogo,{logoUrl:d.meta.logoUrl,name:d.meta.displayName,barStyle:p.logoBar,logoStyle:p.logo})}),
149
149
  /* @__PURE__ */t.jsx(n.View,{style:[p.trailing,R.trailing===void 0?null:{minWidth:R.trailing}],children:/* @__PURE__ */t.jsxs(n.View,{style:p.trailingContent,onLayout:C,children:[m===null?null:/* @__PURE__ */t.jsx(VetVisitButtonCore,{entry:"chat",petRef:m,...u?.returnTo!==void 0?{returnTo:u.returnTo}:{},...u?.usState!==void 0?{usState:u.usState}:{},...u?.prefer!==void 0?{prefer:u.prefer}:{},style:p.vetEntry,labelStyle:p.vetEntryLabel}),
150
150
  /* @__PURE__ */t.jsx(n.View,{style:p.right,children:g?/* @__PURE__ */t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:fe(pe.switchActivePet,{name:y}),containerStyle:p.avatarSlot,style:p.avatarWrap,onPress:()=>h(true),children:[
151
- /* @__PURE__ */t.jsx(PetDisc,{pet:b,size:Hd,ringStroke:Wd}),
152
- /* @__PURE__ */t.jsx(n.View,{style:p.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */t.jsx(PlusGlyph,{size:$d,color:d.color.brandInk,strokeWidth:2})})]}):r.loading&&b===null?
153
- /* @__PURE__ */t.jsx(n.View,{style:p.avatarWrap,accessible:true,accessibilityLabel:pe.yourPet,children:/* @__PURE__ */t.jsx(Ring,{size:Hd,strokeWidth:Wd,color:d.color.mark,children:/* @__PURE__ */t.jsx(n.View,{style:p.placeholderDisc})})}):/* @__PURE__ */t.jsx(n.View,{style:p.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:b===null?pe.yourPet:y,children:/* @__PURE__ */t.jsx(PetDisc,{pet:b,size:Hd,ringStroke:Wd})})})]})}),
154
- /* @__PURE__ */t.jsx(PetSwitcherSheet,{visible:f,pets:r.pets,activePetRef:b?.petRef??null,onSelect:T,onAddPet:_,onClose:()=>h(false)})]}),c===null?null:/* @__PURE__ */t.jsx(TextingEntryRow,{entry:c,place:"header"})]})}function TextingEntryRow({entry:r,place:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Zd(i),[i]);/* @__PURE__ */
155
- return t.jsx(n.View,{style:l==="header"?o.textingEntryRowHeader:o.textingEntryRowThread,children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:r.label,containerStyle:o.textingEntrySlot,style:o.vetEntry,onPress:r.onOpen,testID:"everfur-texting-entry",children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:o.vetEntryLabel,numberOfLines:1,children:r.label})})})}function Zd(e){let t=e.color,r=Hd-Wd*2,l=e.slots.header;return n.StyleSheet.create({vetEntry:{minHeight:Fd,justifyContent:"center",paddingHorizontal:12,borderRadius:e.radius.pill,backgroundColor:t.surfaceCream,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.controlEdge},vetEntryLabel:{...face(e,"bold"),color:t.brandInk,fontSize:e.type.size.caption},textingEntrySlot:{borderRadius:e.radius.pill,maxWidth:"100%"},textingEntryRowHeader:{flexDirection:"row",justifyContent:"flex-end",paddingHorizontal:Kd,paddingBottom:10,backgroundColor:l?.backgroundColor??t.surface},textingEntryRowThread:{flexDirection:"row",justifyContent:"flex-end",paddingHorizontal:Kd,paddingTop:e.space.sm},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:Kd,paddingVertical:10,backgroundColor:t.surface,...ho(l)},iconSlot:{borderRadius:Ad/2},iconButton:{width:Ad,height:Ad,borderRadius:Ad/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:Bd,right:Bd,width:Vd,height:Vd,borderRadius:Vd,backgroundColor:t.danger,borderWidth:Dd,borderColor:l?.backgroundColor??t.surface},leading:{flexShrink:0,alignItems:"flex-start"},trailing:{flexShrink:0,alignItems:"flex-end"},sideContent:{flexDirection:"row",alignItems:"center"},trailingContent:{flexDirection:"row",alignItems:"center",gap:e.space.sm},centre:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,marginHorizontal:Yd,alignItems:"center",justifyContent:"center"},logoBar:{alignSelf:"stretch",alignItems:"center"},logo:{height:qd,width:Gd,maxWidth:"100%"},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:Hd/2},avatarWrap:{width:Hd,height:Hd,position:"relative"},placeholderDisc:{width:r,height:r,borderRadius:r/2,backgroundColor:t.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:Nd,height:Nd,borderRadius:Nd/2,borderWidth:Ud,borderColor:t.mark,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"}})}var Jd=/* @__PURE__ */Object.freeze([
151
+ /* @__PURE__ */t.jsx(PetDisc,{pet:b,size:Nd,ringStroke:Ud}),
152
+ /* @__PURE__ */t.jsx(n.View,{style:p.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */t.jsx(PlusGlyph,{size:Gd,color:d.color.brandInk,strokeWidth:2})})]}):r.loading&&b===null?
153
+ /* @__PURE__ */t.jsx(n.View,{style:p.avatarWrap,accessible:true,accessibilityLabel:pe.yourPet,children:/* @__PURE__ */t.jsx(Ring,{size:Nd,strokeWidth:Ud,color:d.color.mark,children:/* @__PURE__ */t.jsx(n.View,{style:p.placeholderDisc})})}):/* @__PURE__ */t.jsx(n.View,{style:p.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:b===null?pe.yourPet:y,children:/* @__PURE__ */t.jsx(PetDisc,{pet:b,size:Nd,ringStroke:Ud})})})]})}),
154
+ /* @__PURE__ */t.jsx(PetSwitcherSheet,{visible:f,pets:r.pets,activePetRef:b?.petRef??null,onSelect:T,onAddPet:_,onClose:()=>h(false)})]}),c===null?null:/* @__PURE__ */t.jsx(TextingEntryRow,{entry:c,place:"header"})]})}function TextingEntryRow({entry:r,place:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Xd(i),[i]);/* @__PURE__ */
155
+ return t.jsx(n.View,{style:l==="header"?o.textingEntryRowHeader:o.textingEntryRowThread,children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:r.label,containerStyle:o.textingEntrySlot,style:o.vetEntry,onPress:r.onOpen,testID:"everfur-texting-entry",children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:o.vetEntryLabel,numberOfLines:1,children:r.label})})})}function Xd(e){let t=e.color,r=Nd-Ud*2,l=e.slots.header;return n.StyleSheet.create({vetEntry:{minHeight:Ld,justifyContent:"center",paddingHorizontal:12,borderRadius:e.radius.pill,backgroundColor:t.surfaceCream,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.controlEdge},vetEntryLabel:{...face(e,"bold"),color:t.brandInk,fontSize:e.type.size.caption},textingEntrySlot:{borderRadius:e.radius.pill,maxWidth:"100%"},textingEntryRowHeader:{flexDirection:"row",justifyContent:"flex-end",paddingHorizontal:Qd,paddingBottom:10,backgroundColor:l?.backgroundColor??t.surface},textingEntryRowThread:{flexDirection:"row",justifyContent:"flex-end",paddingHorizontal:Qd,paddingTop:e.space.sm},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:Qd,paddingVertical:10,backgroundColor:t.surface,...vo(l)},iconSlot:{borderRadius:Od/2},iconButton:{width:Od,height:Od,borderRadius:Od/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:Wd,right:Wd,width:Bd,height:Bd,borderRadius:Bd,backgroundColor:t.danger,borderWidth:Hd,borderColor:l?.backgroundColor??t.surface},leading:{flexShrink:0,alignItems:"flex-start"},trailing:{flexShrink:0,alignItems:"flex-end"},sideContent:{flexDirection:"row",alignItems:"center"},trailingContent:{flexDirection:"row",alignItems:"center",gap:e.space.sm},centre:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,marginHorizontal:Zd,alignItems:"center",justifyContent:"center"},logoBar:{alignSelf:"stretch",alignItems:"center"},logo:{height:Kd,width:Yd,maxWidth:"100%"},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:Nd/2},avatarWrap:{width:Nd,height:Nd,position:"relative"},placeholderDisc:{width:r,height:r,borderRadius:r/2,backgroundColor:t.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:$d,height:$d,borderRadius:$d/2,borderWidth:qd,borderColor:t.mark,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"}})}var ep=/* @__PURE__ */Object.freeze([
156
156
  /* @__PURE__ */Object.freeze({key:"inaccurate",label:pe.feedbackReasonInaccurate,feedbackType:"wrong"}),
157
157
  /* @__PURE__ */Object.freeze({key:"outdated",label:pe.feedbackReasonOutdated,feedbackType:"outdated"}),
158
158
  /* @__PURE__ */Object.freeze({key:"unsafe",label:pe.feedbackReasonUnsafe,feedbackType:"dangerous"}),
159
159
  /* @__PURE__ */Object.freeze({key:"unclear",label:pe.feedbackReasonUnclear,feedbackType:"unclear"}),
160
- /* @__PURE__ */Object.freeze({key:"other",label:pe.feedbackReasonOther,feedbackType:"not_helpful"})]),Xd=/* @__PURE__ */Object.freeze([
160
+ /* @__PURE__ */Object.freeze({key:"other",label:pe.feedbackReasonOther,feedbackType:"not_helpful"})]),tp=/* @__PURE__ */Object.freeze([
161
161
  /* @__PURE__ */Object.freeze({sentiment:"up",label:pe.feedbackHelpful}),
162
- /* @__PURE__ */Object.freeze({sentiment:"down",label:pe.feedbackNotHelpful})]);function ep(e){switch(e){case"up":return"helpful";case"neutral":return"neutral";case"down":return"not_helpful"}}function tp(e,t){if(e==="down"&&t!==null){let e=Jd.find(e=>e.key===t);if(e!==void 0)return e.feedbackType}return ep(e)}var rp=44,np="rgba(17,17,17,0.55)",lp=26,ip=36,op=4,ap=20,sp=38,up=18,cp=12;function FeedbackReasons({visible:r,onSubmit:l,onSkip:i}){let o=useEverfurTheme(),a=e.useMemo(()=>dp(o),[o]),[s,u]=e.useState(null),[c,d]=e.useState(""),[p,f]=e.useState(false),[h,b]=e.useState(false),g=()=>{u(null),d(""),f(false),b(false)},m=()=>{p||(g(),i())},y=async()=>{if(p)return;f(true),b(false);let e=c.trim();await l(s,e.length>0?e:null)?g():(f(false),b(true))};if(!r)return null;let v=[...c].length>wo;/* @__PURE__ */
162
+ /* @__PURE__ */Object.freeze({sentiment:"down",label:pe.feedbackNotHelpful})]);function rp(e){switch(e){case"up":return"helpful";case"neutral":return"neutral";case"down":return"not_helpful"}}function np(e,t){if(e==="down"&&t!==null){let e=ep.find(e=>e.key===t);if(e!==void 0)return e.feedbackType}return rp(e)}var lp=44,ip="rgba(17,17,17,0.55)",op=26,ap=36,sp=4,up=20,cp=38,dp=18,pp=12;function FeedbackReasons({visible:r,onSubmit:l,onSkip:i}){let o=useEverfurTheme(),a=e.useMemo(()=>fp(o),[o]),[s,u]=e.useState(null),[c,d]=e.useState(""),[p,f]=e.useState(false),[h,b]=e.useState(false),g=()=>{u(null),d(""),f(false),b(false)},m=()=>{p||(g(),i())},y=async()=>{if(p)return;f(true),b(false);let e=c.trim();await l(s,e.length>0?e:null)?g():(f(false),b(true))};if(!r)return null;let v=[...c].length>Ro;/* @__PURE__ */
163
163
  return t.jsx(n.Modal,{visible:true,transparent:true,animationType:o.motion.reducedMotion?"none":"slide",onRequestClose:m,children:/* @__PURE__ */t.jsxs(n.KeyboardAvoidingView,{behavior:n.Platform.OS==="ios"?"padding":void 0,style:a.root,children:[
164
164
  /* @__PURE__ */t.jsx(n.Pressable,{style:a.scrim,onPress:m,accessibilityRole:"button",accessibilityLabel:pe.feedbackSkipA11y}),
165
165
  /* @__PURE__ */t.jsxs(n.View,{style:a.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[
166
166
  /* @__PURE__ */t.jsx(n.View,{style:a.handle}),
167
167
  /* @__PURE__ */t.jsxs(n.View,{style:a.header,children:[
168
- /* @__PURE__ */t.jsx(n.View,{style:a.iconBadge,children:/* @__PURE__ */t.jsx(ThumbGlyph,{size:up,color:o.color.brandInk,active:false,rotate:"180deg"})}),
168
+ /* @__PURE__ */t.jsx(n.View,{style:a.iconBadge,children:/* @__PURE__ */t.jsx(ThumbGlyph,{size:dp,color:o.color.brandInk,active:false,rotate:"180deg"})}),
169
169
  /* @__PURE__ */t.jsxs(n.View,{style:a.headerText,children:[
170
170
  /* @__PURE__ */t.jsx(Text,{tier:"heading",style:a.title,accessibilityRole:"header",children:pe.feedbackTitle}),
171
171
  /* @__PURE__ */t.jsx(Text,{style:a.subtitle,children:pe.feedbackSubtitle})]})]}),
172
- /* @__PURE__ */t.jsx(n.View,{style:a.options,children:Jd.map(e=>{let r=s===e.key;/* @__PURE__ */
172
+ /* @__PURE__ */t.jsx(n.View,{style:a.options,children:ep.map(e=>{let r=s===e.key;/* @__PURE__ */
173
173
  return t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:e.label,accessibilityState:{selected:r},style:[a.option,r?a.optionSelected:null],onPress:()=>u(t=>t===e.key?null:e.key),children:[
174
174
  /* @__PURE__ */t.jsx(Text,{style:[a.optionLabel,r?a.optionLabelSelected:null],children:e.label}),
175
- /* @__PURE__ */t.jsx(n.View,{style:[a.radio,r?a.radioSelected:null],children:r?/* @__PURE__ */t.jsx(CheckGlyph,{size:cp,color:o.color.surface,strokeWidth:2}):null})]},e.key)})}),
175
+ /* @__PURE__ */t.jsx(n.View,{style:[a.radio,r?a.radioSelected:null],children:r?/* @__PURE__ */t.jsx(CheckGlyph,{size:pp,color:o.color.surface,strokeWidth:2}):null})]},e.key)})}),
176
176
  /* @__PURE__ */t.jsxs(n.View,{style:a.inputWrap,children:[
177
- /* @__PURE__ */t.jsx(re,{style:a.input,placeholder:pe.feedbackNotesPlaceholder,placeholderTextColor:o.color.text.placeholder,accessibilityLabel:pe.feedbackNotesPlaceholder,value:c,onChangeText:d,multiline:true,editable:!p}),c.length>0?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:[a.counter,v?a.counterOver:null],children:`${[...c].length}/${wo}`}):null]}),h?/* @__PURE__ */t.jsx(Text,{style:a.failed,accessibilityRole:"alert",children:pe.feedbackFailed}):null,
177
+ /* @__PURE__ */t.jsx(re,{style:a.input,placeholder:pe.feedbackNotesPlaceholder,placeholderTextColor:o.color.text.placeholder,accessibilityLabel:pe.feedbackNotesPlaceholder,value:c,onChangeText:d,multiline:true,editable:!p}),c.length>0?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:[a.counter,v?a.counterOver:null],children:`${[...c].length}/${Ro}`}):null]}),h?/* @__PURE__ */t.jsx(Text,{style:a.failed,accessibilityRole:"alert",children:pe.feedbackFailed}):null,
178
178
  /* @__PURE__ */t.jsxs(n.View,{style:a.actions,children:[
179
179
  /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.feedbackSubmit,accessibilityState:{busy:p,disabled:p||v},disabled:p||v,style:[a.submit,p||v?a.submitDisabled:null],onPress:()=>{y()},children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:a.submitLabel,children:pe.feedbackSubmit})}),
180
- /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:pe.feedbackSkipA11y,hitSlop:8,onPress:m,style:a.skip,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:a.skipLabel,children:pe.feedbackSkip})})]})]})]})})}function dp(e){let t=e.color,r=e.type,l=e.radius,i=e.slots,o=go(i.dialog);return n.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{...Ia,backgroundColor:np},sheet:{backgroundColor:t.surface,borderTopLeftRadius:lp,borderTopRightRadius:lp,paddingHorizontal:22,paddingTop:12,paddingBottom:34,gap:14,...xd(i.dialog)},handle:{alignSelf:"center",width:ip,height:op,borderRadius:op/2,backgroundColor:t.brandBorder,marginBottom:2},header:{flexDirection:"row",alignItems:"center",gap:12},iconBadge:{width:sp,height:sp,borderRadius:sp/2,alignItems:"center",justifyContent:"center",backgroundColor:t.brandSoft},headerText:{flex:1,gap:2},title:{...headingFace(e,"bold"),fontSize:20,lineHeight:28,color:t.text.primary,letterSpacing:r.letterSpacing.tight,...o},subtitle:{...face(e,"regular"),fontSize:r.size.body,lineHeight:r.size.body*r.lineHeight.relaxed,color:t.text.muted,...o},options:{gap:8},option:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:14,paddingVertical:13,borderRadius:l.md,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.controlEdge,backgroundColor:t.surface,...ho(i.chip,n.StyleSheet.hairlineWidth)},optionSelected:{borderColor:t.brandInk,backgroundColor:t.brandSoft},optionLabel:{...face(e,"medium"),fontSize:r.size.body,color:t.text.primary,...go(i.chip)},optionLabelSelected:{color:t.brandInk},radio:{width:ap,height:ap,borderRadius:ap/2,borderWidth:2,borderColor:t.brandBorderStrong,alignItems:"center",justifyContent:"center"},radioSelected:{borderColor:t.brandInk,backgroundColor:t.brandInk},inputWrap:{gap:4},input:{minHeight:72,maxHeight:132,borderRadius:l.md,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:14,paddingTop:12,paddingBottom:12,...face(e,"regular"),fontSize:r.size.body,color:t.text.primary,textAlignVertical:"top",...ho(i.input,1),...go(i.input)},counter:{...face(e,"mono"),alignSelf:"flex-end",fontSize:r.size.caption,letterSpacing:.3,color:t.text.placeholder},counterOver:{color:t.danger},failed:{...face(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},actions:{gap:10,alignItems:"center"},submit:{alignSelf:"stretch",minHeight:rp,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.xl,borderRadius:l.pill,backgroundColor:t.brand,...ho(i.primaryButton)},submitDisabled:{opacity:.6},submitLabel:{...face(e,"medium"),fontSize:r.size.body,color:t.onPrimary,...go(i.primaryButton)},skip:{minHeight:rp,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},skipLabel:{...face(e,"medium"),fontSize:r.size.body,color:t.text.muted}})}var pp=/* @__PURE__ */Symbol.for("everfur.sdk.rn.askHome");function fp(){let t=globalThis,r=t[pp];if(r!==void 0)return r;let n={factory:e.createContext(null),home:e.createContext(null)};return t[pp]=n,n}var hp=fp().factory,bp=fp().home;function gp(){return e.useContext(hp)}function mp(){return e.useContext(bp)?.kit??null}function yp(){return e.useContext(bp)}var vp=15,xp=8;function HistoryBar({bar:r,history:l,empty:i,unread:o,extra:a}){let s=useEverfurTheme(),u=mp(),c=e.useMemo(()=>u!==null?Sp(s,u):Cp(s),[s,u]),d=l.cursor===null?l.rows.length:0,p=e=>{let l=r.renderIcon;if(l!==void 0)/* @__PURE__ */return t.jsx(HostRender,{render:()=>l(e),fallback:null});if(u===null)return null;let i=String(n.StyleSheet.flatten(c.label).color??s.color.linkInk);return e==="history"?/* @__PURE__ */t.jsx(HistoryGlyph,{size:kp,color:i,strokeWidth:1.8}):/* @__PURE__ */t.jsx(EditGlyph,{size:kp,color:i,strokeWidth:1.8})};/* @__PURE__ */
180
+ /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:pe.feedbackSkipA11y,hitSlop:8,onPress:m,style:a.skip,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:a.skipLabel,children:pe.feedbackSkip})})]})]})]})})}function fp(e){let t=e.color,r=e.type,l=e.radius,i=e.slots,o=wo(i.dialog);return n.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{...Aa,backgroundColor:ip},sheet:{backgroundColor:t.surface,borderTopLeftRadius:op,borderTopRightRadius:op,paddingHorizontal:22,paddingTop:12,paddingBottom:34,gap:14,...kd(i.dialog)},handle:{alignSelf:"center",width:ap,height:sp,borderRadius:sp/2,backgroundColor:t.brandBorder,marginBottom:2},header:{flexDirection:"row",alignItems:"center",gap:12},iconBadge:{width:cp,height:cp,borderRadius:cp/2,alignItems:"center",justifyContent:"center",backgroundColor:t.brandSoft},headerText:{flex:1,gap:2},title:{...headingFace(e,"bold"),fontSize:20,lineHeight:28,color:t.text.primary,letterSpacing:r.letterSpacing.tight,...o},subtitle:{...face(e,"regular"),fontSize:r.size.body,lineHeight:r.size.body*r.lineHeight.relaxed,color:t.text.muted,...o},options:{gap:8},option:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:14,paddingVertical:13,borderRadius:l.md,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.controlEdge,backgroundColor:t.surface,...vo(i.chip,n.StyleSheet.hairlineWidth)},optionSelected:{borderColor:t.brandInk,backgroundColor:t.brandSoft},optionLabel:{...face(e,"medium"),fontSize:r.size.body,color:t.text.primary,...wo(i.chip)},optionLabelSelected:{color:t.brandInk},radio:{width:up,height:up,borderRadius:up/2,borderWidth:2,borderColor:t.brandBorderStrong,alignItems:"center",justifyContent:"center"},radioSelected:{borderColor:t.brandInk,backgroundColor:t.brandInk},inputWrap:{gap:4},input:{minHeight:72,maxHeight:132,borderRadius:l.md,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:14,paddingTop:12,paddingBottom:12,...face(e,"regular"),fontSize:r.size.body,color:t.text.primary,textAlignVertical:"top",...vo(i.input,1),...wo(i.input)},counter:{...face(e,"mono"),alignSelf:"flex-end",fontSize:r.size.caption,letterSpacing:.3,color:t.text.placeholder},counterOver:{color:t.danger},failed:{...face(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},actions:{gap:10,alignItems:"center"},submit:{alignSelf:"stretch",minHeight:lp,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.xl,borderRadius:l.pill,backgroundColor:t.brand,...vo(i.primaryButton)},submitDisabled:{opacity:.6},submitLabel:{...face(e,"medium"),fontSize:r.size.body,color:t.onPrimary,...wo(i.primaryButton)},skip:{minHeight:lp,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},skipLabel:{...face(e,"medium"),fontSize:r.size.body,color:t.text.muted}})}var hp=/* @__PURE__ */Symbol.for("everfur.sdk.rn.askHome");function bp(){let t=globalThis,r=t[hp];if(r!==void 0)return r;let n={factory:e.createContext(null),home:e.createContext(null)};return t[hp]=n,n}var gp=bp().factory,mp=bp().home;function yp(){return e.useContext(gp)}function vp(){return e.useContext(mp)?.kit??null}function xp(){return e.useContext(mp)}var wp=15,kp=8;function HistoryBar({bar:r,history:l,empty:i,unread:o,extra:a}){let s=useEverfurTheme(),u=vp(),c=e.useMemo(()=>u!==null?jp(s,u):Rp(s),[s,u]),d=l.cursor===null?l.rows.length:0,p=e=>{let l=r.renderIcon;if(l!==void 0)/* @__PURE__ */return t.jsx(HostRender,{render:()=>l(e),fallback:null});if(u===null)return null;let i=String(n.StyleSheet.flatten(c.label).color??s.color.linkInk);return e==="history"?/* @__PURE__ */t.jsx(HistoryGlyph,{size:Cp,color:i,strokeWidth:1.8}):/* @__PURE__ */t.jsx(EditGlyph,{size:Cp,color:i,strokeWidth:1.8})};/* @__PURE__ */
181
181
  return t.jsxs(n.View,{style:c.bar,testID:"everfur-history-bar",children:[
182
- /* @__PURE__ */t.jsxs(n.Pressable,{accessibilityRole:"button",accessibilityLabel:d>0?`${r.chats} ${d}`:r.chats,accessibilityState:{expanded:l.open},onPress:l.open?l.close:l.show,style:c.control,hitSlop:u!==null?wp:void 0,children:[p("history"),
182
+ /* @__PURE__ */t.jsxs(n.Pressable,{accessibilityRole:"button",accessibilityLabel:d>0?`${r.chats} ${d}`:r.chats,accessibilityState:{expanded:l.open},onPress:l.open?l.close:l.show,style:c.control,hitSlop:u!==null?Sp:void 0,children:[p("history"),
183
183
  /* @__PURE__ */t.jsx(Text,{tier:"control",style:c.label,children:r.chats}),d>0?/* @__PURE__ */t.jsx(n.View,{style:c.count,children:/* @__PURE__ */t.jsx(Text,{tier:"badge",style:c.countText,children:String(d)})}):null,o?/* @__PURE__ */t.jsx(n.View,{style:c.dot,testID:"everfur-chat-history-bar-unread"}):null]}),r.extra??null,a??null,
184
- /* @__PURE__ */t.jsx(n.View,{style:c.spacer}),i?null:/* @__PURE__ */t.jsxs(n.Pressable,{accessibilityRole:"button",accessibilityLabel:r.newChat,onPress:l.newConversation,style:c.control,hitSlop:u!==null?wp:void 0,children:[p("edit"),
185
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:c.label,children:r.newChat})]})]})}var wp=4,kp=18;function Sp(e,t){return{...Cp(e),bar:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:e.space.sm},control:t.view(".thread__hist"),label:t.text(".thread__hist"),count:t.view(".thread__count"),countText:t.text(".thread__count")}}function Cp(e){let t=e.color,r=e.space;return n.StyleSheet.create({bar:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.xs},control:{flexDirection:"row",alignItems:"center",gap:6,minHeight:os},label:{...face(e,"bold"),fontSize:vp,color:t.brandInk},count:{minWidth:22,paddingHorizontal:7,borderRadius:e.radius.pill,backgroundColor:t.surfaceSubtle,alignItems:"center"},countText:{...face(e,"bold"),fontSize:e.type.size.caption,color:t.text.primary},dot:{width:xp,height:xp,borderRadius:xp/2,backgroundColor:t.danger},spacer:{flexGrow:1}})}var jp=.88,Rp=420,Tp=58,_p="rgba(17,17,17,0.28)",zp=.15,Ip=14,Pp=12,Ep=44,Mp=16,Fp=14,Ap=12,Lp=14,Op=8,Vp=2,Dp=.5,Bp=Ni(Mi.standard);function Hp(e){return Math.min(Math.round(e*jp),Rp)}function HistoryDrawer({chat:r,history:n}){let[l,i]=e.useState(n.open),o=e.useCallback(()=>i(false),[]);return n.open&&!l&&i(true),l?/* @__PURE__ */t.jsx(DrawerModal,{chat:r,history:n,onHidden:o}):null}function DrawerModal({chat:r,history:i,onHidden:o}){let a=useEverfurTheme(),s=e.useMemo(()=>Wp(a),[a]),u=Di(),c=l.useSafeAreaInsets(),{width:d}=n.useWindowDimensions(),p=Hp(d),f=i.open,h=e.useRef(null);h.current===null&&(h.current=new n.Animated.Value(u.drawerMs<=0&&f?1:0));let b=h.current;e.useEffect(()=>{if(!f&&u.drawerMs<=0){o();return}let e=n.Animated.timing(b,{toValue:f?1:0,duration:u.drawerMs,easing:Bp,useNativeDriver:true});return e.start(({finished:e})=>{e&&!f&&o()}),()=>e.stop()},[f,b,u.drawerMs,o]);let g=b.interpolate({inputRange:[0,1],outputRange:[-p,0]}),m=i.filtered,y=i.rows.length===0,v=i.cursor===null&&!i.loading&&i.error===null,x=y&&i.loading?/* @__PURE__ */t.jsxs(n.View,{style:s.emptyCard,accessibilityLabel:Jl.loading,accessibilityState:{busy:true},children:[
184
+ /* @__PURE__ */t.jsx(n.View,{style:c.spacer}),i?null:/* @__PURE__ */t.jsxs(n.Pressable,{accessibilityRole:"button",accessibilityLabel:r.newChat,onPress:l.newConversation,style:c.control,hitSlop:u!==null?Sp:void 0,children:[p("edit"),
185
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:c.label,children:r.newChat})]})]})}var Sp=4,Cp=18;function jp(e,t){return{...Rp(e),bar:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:e.space.sm},control:t.view(".thread__hist"),label:t.text(".thread__hist"),count:t.view(".thread__count"),countText:t.text(".thread__count")}}function Rp(e){let t=e.color,r=e.space;return n.StyleSheet.create({bar:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.xs},control:{flexDirection:"row",alignItems:"center",gap:6,minHeight:ds},label:{...face(e,"bold"),fontSize:wp,color:t.brandInk},count:{minWidth:22,paddingHorizontal:7,borderRadius:e.radius.pill,backgroundColor:t.surfaceSubtle,alignItems:"center"},countText:{...face(e,"bold"),fontSize:e.type.size.caption,color:t.text.primary},dot:{width:kp,height:kp,borderRadius:kp/2,backgroundColor:t.danger},spacer:{flexGrow:1}})}var Tp=.88,_p=420,zp=58,Ip="rgba(17,17,17,0.28)",Pp=.15,Ep=14,Mp=12,Fp=44,Ap=16,Lp=14,Op=12,Vp=14,Dp=8,Bp=2,Hp=.5,Wp=Ki(Vi.standard);function Np(e){return Math.min(Math.round(e*Tp),_p)}function HistoryDrawer({chat:r,history:n}){let[l,i]=e.useState(n.open),o=e.useCallback(()=>i(false),[]);return n.open&&!l&&i(true),l?/* @__PURE__ */t.jsx(DrawerModal,{chat:r,history:n,onHidden:o}):null}function DrawerModal({chat:r,history:i,onHidden:o}){let a=useEverfurTheme(),s=e.useMemo(()=>Up(a),[a]),u=Ui(),c=l.useSafeAreaInsets(),{width:d}=n.useWindowDimensions(),p=Np(d),f=i.open,h=e.useRef(null);h.current===null&&(h.current=new n.Animated.Value(u.drawerMs<=0&&f?1:0));let b=h.current;e.useEffect(()=>{if(!f&&u.drawerMs<=0){o();return}let e=n.Animated.timing(b,{toValue:f?1:0,duration:u.drawerMs,easing:Wp,useNativeDriver:true});return e.start(({finished:e})=>{e&&!f&&o()}),()=>e.stop()},[f,b,u.drawerMs,o]);let g=b.interpolate({inputRange:[0,1],outputRange:[-p,0]}),m=i.filtered,y=i.rows.length===0,v=i.cursor===null&&!i.loading&&i.error===null,x=y&&i.loading?/* @__PURE__ */t.jsxs(n.View,{style:s.emptyCard,accessibilityLabel:ni.loading,accessibilityState:{busy:true},children:[
186
186
  /* @__PURE__ */t.jsx(n.ActivityIndicator,{color:s.emptyTitle.color}),
187
- /* @__PURE__ */t.jsx(Text,{style:s.emptyBody,children:Jl.loading})]}):y&&i.error!==null?/* @__PURE__ */t.jsxs(n.View,{style:s.emptyCard,children:[
188
- /* @__PURE__ */t.jsx(Text,{style:s.emptyTitle,accessibilityRole:"alert",children:Jl.loadFailed}),
187
+ /* @__PURE__ */t.jsx(Text,{style:s.emptyBody,children:ni.loading})]}):y&&i.error!==null?/* @__PURE__ */t.jsxs(n.View,{style:s.emptyCard,children:[
188
+ /* @__PURE__ */t.jsx(Text,{style:s.emptyTitle,accessibilityRole:"alert",children:ni.loadFailed}),
189
189
  /* @__PURE__ */t.jsx(Text,{style:s.emptyBody,children:i.error}),
190
- /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:Jl.retry,containerStyle:s.retrySlot,style:s.retryButton,onPress:()=>{i.load()},children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:s.retryText,children:Jl.retry})})]}):i.emptyKind==="empty"?/* @__PURE__ */t.jsxs(n.View,{style:s.emptyCard,children:[
191
- /* @__PURE__ */t.jsx(Text,{style:s.emptyTitle,children:Jl.empty}),
192
- /* @__PURE__ */t.jsx(Text,{style:s.emptyBody,children:Jl.emptyBody})]}):
193
- /* @__PURE__ */t.jsx(Text,{style:s.noMatch,children:Jl.noMatch}),w=!i.searching&&i.loadingMore?/* @__PURE__ */t.jsx(n.View,{style:s.loadMoreFooter,children:/* @__PURE__ */t.jsx(Text,{style:s.loadMoreLabel,children:Jl.loadingMore})}):null;/* @__PURE__ */
190
+ /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:ni.retry,containerStyle:s.retrySlot,style:s.retryButton,onPress:()=>{i.load()},children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:s.retryText,children:ni.retry})})]}):i.emptyKind==="empty"?/* @__PURE__ */t.jsxs(n.View,{style:s.emptyCard,children:[
191
+ /* @__PURE__ */t.jsx(Text,{style:s.emptyTitle,children:ni.empty}),
192
+ /* @__PURE__ */t.jsx(Text,{style:s.emptyBody,children:ni.emptyBody})]}):
193
+ /* @__PURE__ */t.jsx(Text,{style:s.noMatch,children:ni.noMatch}),w=!i.searching&&i.loadingMore?/* @__PURE__ */t.jsx(n.View,{style:s.loadMoreFooter,children:/* @__PURE__ */t.jsx(Text,{style:s.loadMoreLabel,children:ni.loadingMore})}):null;/* @__PURE__ */
194
194
  return t.jsx(n.Modal,{visible:true,transparent:true,animationType:"none",onRequestClose:i.close,children:/* @__PURE__ */t.jsxs(n.View,{style:s.root,children:[
195
- /* @__PURE__ */t.jsx(n.Pressable,{style:Ia,onPress:i.close,accessibilityRole:"button",accessibilityLabel:Jl.closeA11y,children:/* @__PURE__ */t.jsx(n.Animated.View,{style:[s.backdrop,{opacity:b}]})}),
196
- /* @__PURE__ */t.jsx(n.Animated.View,{style:[s.panel,{width:p,paddingTop:Math.max(Tp,c.top+a.space.md),transform:[{translateX:g}]}],accessibilityViewIsModal:true,children:/* @__PURE__ */t.jsxs(n.KeyboardAvoidingView,{style:s.keyboardAvoider,behavior:n.Platform.OS==="ios"?"padding":"height",children:[
195
+ /* @__PURE__ */t.jsx(n.Pressable,{style:Aa,onPress:i.close,accessibilityRole:"button",accessibilityLabel:ni.closeA11y,children:/* @__PURE__ */t.jsx(n.Animated.View,{style:[s.backdrop,{opacity:b}]})}),
196
+ /* @__PURE__ */t.jsx(n.Animated.View,{style:[s.panel,{width:p,paddingTop:Math.max(zp,c.top+a.space.md),transform:[{translateX:g}]}],accessibilityViewIsModal:true,children:/* @__PURE__ */t.jsxs(n.KeyboardAvoidingView,{style:s.keyboardAvoider,behavior:n.Platform.OS==="ios"?"padding":"height",children:[
197
197
  /* @__PURE__ */t.jsxs(n.View,{style:s.header,children:[
198
- /* @__PURE__ */t.jsx(Text,{tier:"heading",style:s.heading,accessibilityRole:"header",children:Jl.heading}),
199
- /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:Jl.newChat,style:s.newChat,onPress:i.newConversation,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:s.newChatLabel,children:Jl.newChat})}),
200
- /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:Jl.close,hitSlop:0,style:s.closeButton,onPress:i.close,children:/* @__PURE__ */t.jsx(CloseGlyph,{size:Mp,color:a.color.text.muted,strokeWidth:1.75})})]}),
198
+ /* @__PURE__ */t.jsx(Text,{tier:"heading",style:s.heading,accessibilityRole:"header",children:ni.heading}),
199
+ /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:ni.newChat,style:s.newChat,onPress:i.newConversation,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:s.newChatLabel,children:ni.newChat})}),
200
+ /* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:ni.close,hitSlop:0,style:s.closeButton,onPress:i.close,children:/* @__PURE__ */t.jsx(CloseGlyph,{size:Ap,color:a.color.text.muted,strokeWidth:1.75})})]}),
201
201
  /* @__PURE__ */t.jsxs(n.View,{style:s.searchPill,children:[
202
- /* @__PURE__ */t.jsx(SearchGlyph,{size:Lp,color:a.color.text.muted,strokeWidth:1.5}),
203
- /* @__PURE__ */t.jsx(re,{value:i.query,onChangeText:e=>i.setQuery(e.replace(/^\s+/,"")),style:s.searchInput,placeholder:Jl.searchPlaceholder,placeholderTextColor:a.color.text.placeholder,accessibilityLabel:Jl.search,autoCorrect:false,autoCapitalize:"none",returnKeyType:"search"})]}),
204
- /* @__PURE__ */t.jsx(Text,{tier:"compact",style:s.countLabel,children:ri(i.rows.length,v)}),i.error!==null&&!y?/* @__PURE__ */t.jsx(n.View,{style:s.errorCard,children:/* @__PURE__ */t.jsx(Text,{style:s.errorText,accessibilityRole:"alert",children:i.error})}):null,
205
- /* @__PURE__ */t.jsx(n.FlatList,{data:m,keyExtractor:e=>e.id,renderItem:({item:e})=>/* @__PURE__ */t.jsx(Row,{row:e,active:e.id===r.conversationId,disabled:i.loading,styles:s,onPress:()=>{i.resume(e.id)}}),contentContainerStyle:m.length===0?s.listEmpty:s.list,keyboardShouldPersistTaps:"handled",ListEmptyComponent:x,ListFooterComponent:w,onEndReached:i.loadMore,onEndReachedThreshold:Dp})]})})]})})}function Row({row:e,active:r,disabled:l,styles:i,onPress:o}){let a=e.unreadCount!==null&&e.unreadCount>0,s=ti(e);/* @__PURE__ */
206
- return t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:ni(e),accessibilityState:{selected:r,disabled:l},disabled:l,style:[i.item,r?i.itemActive:null],onPress:o,children:[
202
+ /* @__PURE__ */t.jsx(SearchGlyph,{size:Vp,color:a.color.text.muted,strokeWidth:1.5}),
203
+ /* @__PURE__ */t.jsx(re,{value:i.query,onChangeText:e=>i.setQuery(e.replace(/^\s+/,"")),style:s.searchInput,placeholder:ni.searchPlaceholder,placeholderTextColor:a.color.text.placeholder,accessibilityLabel:ni.search,autoCorrect:false,autoCapitalize:"none",returnKeyType:"search"})]}),
204
+ /* @__PURE__ */t.jsx(Text,{tier:"compact",style:s.countLabel,children:ai(i.rows.length,v)}),i.error!==null&&!y?/* @__PURE__ */t.jsx(n.View,{style:s.errorCard,children:/* @__PURE__ */t.jsx(Text,{style:s.errorText,accessibilityRole:"alert",children:i.error})}):null,
205
+ /* @__PURE__ */t.jsx(n.FlatList,{data:m,keyExtractor:e=>e.id,renderItem:({item:e})=>/* @__PURE__ */t.jsx(Row,{row:e,active:e.id===r.conversationId,disabled:i.loading,styles:s,onPress:()=>{i.resume(e.id)}}),contentContainerStyle:m.length===0?s.listEmpty:s.list,keyboardShouldPersistTaps:"handled",ListEmptyComponent:x,ListFooterComponent:w,onEndReached:i.loadMore,onEndReachedThreshold:Hp})]})})]})})}function Row({row:e,active:r,disabled:l,styles:i,onPress:o}){let a=e.unreadCount!==null&&e.unreadCount>0,s=oi(e);/* @__PURE__ */
206
+ return t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:si(e),accessibilityState:{selected:r,disabled:l},disabled:l,style:[i.item,r?i.itemActive:null],onPress:o,children:[
207
207
  /* @__PURE__ */t.jsxs(n.View,{style:i.itemRow,children:[
208
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:i.itemTitle,numberOfLines:1,children:Xl(e.title)}),a?/* @__PURE__ */t.jsx(n.View,{style:i.unreadDot}):null]}),s!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:i.itemMeta,numberOfLines:1,children:s}):null]})}function Wp(e){let t=e.color,r=e.space,l=e.type,i=e.slots,o=t.text.primary,a=go(i.card);return n.StyleSheet.create({root:{flex:1},backdrop:{flex:1,backgroundColor:_p},panel:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:t.surface,paddingHorizontal:r.lg,borderRightWidth:n.StyleSheet.hairlineWidth,borderRightColor:t.borderRingCream,gap:r.md,...wd(i.dialog,n.StyleSheet.hairlineWidth)},keyboardAvoider:{flex:1,gap:r.md},header:{flexDirection:"row",alignItems:"center",gap:r.sm},heading:{...headingFace(e,"bold"),flex:1,fontSize:l.size.subtitle,color:o,...go(i.dialog)},newChat:{minHeight:Ep,justifyContent:"center",paddingHorizontal:r.xs},newChatLabel:{...face(e,"bold"),fontSize:Ip,color:t.brandInk},closeButton:{width:Ep,height:Ep,alignItems:"center",justifyContent:"center"},searchPill:{flexDirection:"row",alignItems:"center",gap:r.sm,borderRadius:e.radius.pill,backgroundColor:t.surfaceSubtle,paddingHorizontal:r.md+Vp,paddingVertical:r.sm+Vp,borderWidth:1,borderColor:t.borderRingCream,...ho(i.input,1)},searchInput:{...face(e,"regular"),flex:1,fontSize:l.size.bodyTight,color:t.text.primary,padding:0,...go(i.input)},countLabel:{...face(e,"mono"),fontSize:Pp,color:t.text.muted},list:{gap:r.xs,paddingBottom:r.xl},listEmpty:{flexGrow:1},item:{paddingVertical:r.sm+Vp,paddingHorizontal:r.sm,borderRadius:e.radius.md,gap:Vp},itemActive:{backgroundColor:Ta(t.highlight,zp)??t.surfaceSubtle},itemRow:{flexDirection:"row",alignItems:"center",gap:r.sm},itemTitle:{...face(e,"bold"),flex:1,fontSize:l.size.bodyTight,color:o},itemMeta:{...face(e,"regular"),fontSize:l.size.caption,color:t.text.muted},unreadDot:{width:Op,height:Op,borderRadius:Op/2,backgroundColor:t.danger},errorCard:{borderRadius:Ap,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.danger,backgroundColor:t.surface,padding:r.md},errorText:{...face(e,"regular"),fontSize:l.size.caption,color:t.danger},emptyCard:{borderRadius:Fp,padding:r.md+Vp,gap:r.xs+Vp,backgroundColor:t.surfaceSubtle,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.borderRingCream,...ho(i.card,n.StyleSheet.hairlineWidth)},emptyTitle:{...headingFace(e,"bold"),fontSize:l.size.bodyTight,color:o,...a},emptyBody:{...face(e,"regular"),fontSize:l.size.caption,color:t.text.secondary,...a},noMatch:{...face(e,"regular"),fontSize:l.size.bodyTight,color:t.text.muted,paddingVertical:r.sm},retrySlot:{marginTop:r.sm,alignSelf:"flex-start"},retryButton:{borderRadius:e.radius.pill,paddingHorizontal:r.md+Vp,paddingVertical:r.sm,borderWidth:1,borderColor:t.brandInk,...ho(i.primaryButton)},retryText:{...face(e,"bold"),fontSize:l.size.caption,color:t.brandInk,...go(i.primaryButton)},loadMoreFooter:{paddingVertical:r.md+Vp,alignItems:"center"},loadMoreLabel:{...face(e,"regular"),fontSize:l.size.caption,color:t.text.muted}})}function Np(e,t=/* @__PURE__ */new Date,r){let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let l=new Date(t);l.setHours(0,0,0,0);let i=new Date(n);i.setHours(0,0,0,0);let o=Math.round((l.getTime()-i.getTime())/864e5);if(o===0||o===1)try{let e=new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(-o,"day");return e.charAt(0).toLocaleUpperCase(r)+e.slice(1)}catch{}return n.toLocaleDateString(r,{month:"short",day:"numeric"})}function Up(e,t){let r=new Date(e);return Number.isNaN(r.getTime())?null:r.toLocaleTimeString(t,{hour:"numeric",minute:"2-digit"})}function $p(e,t=/* @__PURE__ */new Date){let r=[];for(let n of e){let e=Np(n.updatedAt,t)??"",l=r[r.length-1];l!==void 0&&l.day===e?l.rows.push(n):r.push({day:e,rows:[n]})}return r}var qp="rgba(38,37,35,0.38)",Gp=28,Kp=40,Yp=5,Qp=11,Zp=10.5,Jp=36,Xp=11,ef=14,tf=15,rf=13.5,nf=48,lf=2,of=1.3,af=.12,sf=16,uf=8,cf="80%";function df(e,r,n){let l=e?.renderIcon;return l===void 0?n:/* @__PURE__ */t.jsx(HostRender,{render:()=>l(r),fallback:n})}function HistorySheet({chat:r,history:i,sheet:o}){let a=useEverfurTheme(),s=e.useMemo(()=>pf(a),[a]),u=l.useSafeAreaInsets(),c=e.useMemo(()=>$p(i.rows),[i.rows]);if(!i.open)return null;let d=a.color,p=o?.title?.trim(),f=p!==void 0&&p!==""?p:Jl.heading;/* @__PURE__ */
208
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:i.itemTitle,numberOfLines:1,children:li(e.title)}),a?/* @__PURE__ */t.jsx(n.View,{style:i.unreadDot}):null]}),s!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:i.itemMeta,numberOfLines:1,children:s}):null]})}function Up(e){let t=e.color,r=e.space,l=e.type,i=e.slots,o=t.text.primary,a=wo(i.card);return n.StyleSheet.create({root:{flex:1},backdrop:{flex:1,backgroundColor:Ip},panel:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:t.surface,paddingHorizontal:r.lg,borderRightWidth:n.StyleSheet.hairlineWidth,borderRightColor:t.borderRingCream,gap:r.md,...Sd(i.dialog,n.StyleSheet.hairlineWidth)},keyboardAvoider:{flex:1,gap:r.md},header:{flexDirection:"row",alignItems:"center",gap:r.sm},heading:{...headingFace(e,"bold"),flex:1,fontSize:l.size.subtitle,color:o,...wo(i.dialog)},newChat:{minHeight:Fp,justifyContent:"center",paddingHorizontal:r.xs},newChatLabel:{...face(e,"bold"),fontSize:Ep,color:t.brandInk},closeButton:{width:Fp,height:Fp,alignItems:"center",justifyContent:"center"},searchPill:{flexDirection:"row",alignItems:"center",gap:r.sm,borderRadius:e.radius.pill,backgroundColor:t.surfaceSubtle,paddingHorizontal:r.md+Bp,paddingVertical:r.sm+Bp,borderWidth:1,borderColor:t.borderRingCream,...vo(i.input,1)},searchInput:{...face(e,"regular"),flex:1,fontSize:l.size.bodyTight,color:t.text.primary,padding:0,...wo(i.input)},countLabel:{...face(e,"mono"),fontSize:Mp,color:t.text.muted},list:{gap:r.xs,paddingBottom:r.xl},listEmpty:{flexGrow:1},item:{paddingVertical:r.sm+Bp,paddingHorizontal:r.sm,borderRadius:e.radius.md,gap:Bp},itemActive:{backgroundColor:Ea(t.highlight,Pp)??t.surfaceSubtle},itemRow:{flexDirection:"row",alignItems:"center",gap:r.sm},itemTitle:{...face(e,"bold"),flex:1,fontSize:l.size.bodyTight,color:o},itemMeta:{...face(e,"regular"),fontSize:l.size.caption,color:t.text.muted},unreadDot:{width:Dp,height:Dp,borderRadius:Dp/2,backgroundColor:t.danger},errorCard:{borderRadius:Op,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.danger,backgroundColor:t.surface,padding:r.md},errorText:{...face(e,"regular"),fontSize:l.size.caption,color:t.danger},emptyCard:{borderRadius:Lp,padding:r.md+Bp,gap:r.xs+Bp,backgroundColor:t.surfaceSubtle,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.borderRingCream,...vo(i.card,n.StyleSheet.hairlineWidth)},emptyTitle:{...headingFace(e,"bold"),fontSize:l.size.bodyTight,color:o,...a},emptyBody:{...face(e,"regular"),fontSize:l.size.caption,color:t.text.secondary,...a},noMatch:{...face(e,"regular"),fontSize:l.size.bodyTight,color:t.text.muted,paddingVertical:r.sm},retrySlot:{marginTop:r.sm,alignSelf:"flex-start"},retryButton:{borderRadius:e.radius.pill,paddingHorizontal:r.md+Bp,paddingVertical:r.sm,borderWidth:1,borderColor:t.brandInk,...vo(i.primaryButton)},retryText:{...face(e,"bold"),fontSize:l.size.caption,color:t.brandInk,...wo(i.primaryButton)},loadMoreFooter:{paddingVertical:r.md+Bp,alignItems:"center"},loadMoreLabel:{...face(e,"regular"),fontSize:l.size.caption,color:t.text.muted}})}function $p(e,t=/* @__PURE__ */new Date,r){let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let l=new Date(t);l.setHours(0,0,0,0);let i=new Date(n);i.setHours(0,0,0,0);let o=Math.round((l.getTime()-i.getTime())/864e5);if(o===0||o===1)try{let e=new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(-o,"day");return e.charAt(0).toLocaleUpperCase(r)+e.slice(1)}catch{}return n.toLocaleDateString(r,{month:"short",day:"numeric"})}function qp(e,t){let r=new Date(e);return Number.isNaN(r.getTime())?null:r.toLocaleTimeString(t,{hour:"numeric",minute:"2-digit"})}function Gp(e,t=/* @__PURE__ */new Date){let r=[];for(let n of e){let e=$p(n.updatedAt,t)??"",l=r[r.length-1];l!==void 0&&l.day===e?l.rows.push(n):r.push({day:e,rows:[n]})}return r}var Kp="rgba(38,37,35,0.38)",Yp=28,Qp=40,Zp=5,Jp=11,Xp=10.5,ef=36,tf=11,rf=14,nf=15,lf=13.5,of=48,af=2,sf=1.3,uf=.12,cf=16,df=8,pf="80%";function ff(e,r,n){let l=e?.renderIcon;return l===void 0?n:/* @__PURE__ */t.jsx(HostRender,{render:()=>l(r),fallback:n})}function HistorySheet({chat:r,history:i,sheet:o}){let a=useEverfurTheme(),s=e.useMemo(()=>hf(a),[a]),u=l.useSafeAreaInsets(),c=e.useMemo(()=>Gp(i.rows),[i.rows]);if(!i.open)return null;let d=a.color,p=o?.title?.trim(),f=p!==void 0&&p!==""?p:ni.heading;/* @__PURE__ */
209
209
  return t.jsx(n.Modal,{visible:true,transparent:true,animationType:"slide",onRequestClose:i.close,children:/* @__PURE__ */t.jsxs(n.View,{style:s.root,children:[
210
- /* @__PURE__ */t.jsx(n.Pressable,{style:[Ia,s.scrim],onPress:i.close,accessibilityRole:"button",accessibilityLabel:Jl.closeA11y}),
210
+ /* @__PURE__ */t.jsx(n.Pressable,{style:[Aa,s.scrim],onPress:i.close,accessibilityRole:"button",accessibilityLabel:ni.closeA11y}),
211
211
  /* @__PURE__ */t.jsxs(n.View,{style:[s.sheet,{paddingBottom:Math.max(40,u.bottom+a.space.lg)}],accessibilityViewIsModal:true,testID:"everfur-history-sheet",children:[
212
212
  /* @__PURE__ */t.jsx(n.View,{style:s.grab}),
213
213
  /* @__PURE__ */t.jsxs(n.View,{style:s.top,children:[
214
214
  /* @__PURE__ */t.jsx(Text,{tier:"compact",style:s.kicker,accessibilityRole:"header",children:f}),
215
- /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:Jl.closeA11y,onPress:i.close,style:s.close,children:df(o,"close",/* @__PURE__ */t.jsx(CloseGlyph,{size:22,color:d.text.primary,strokeWidth:2}))})]}),
216
- /* @__PURE__ */t.jsxs(n.ScrollView,{style:s.scroll,contentContainerStyle:s.scrollContent,keyboardShouldPersistTaps:"handled",children:[i.loading&&i.rows.length===0?/* @__PURE__ */t.jsxs(n.View,{style:s.state,accessibilityLabel:Jl.loading,accessibilityState:{busy:true},children:[
215
+ /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:ni.closeA11y,onPress:i.close,style:s.close,children:ff(o,"close",/* @__PURE__ */t.jsx(CloseGlyph,{size:22,color:d.text.primary,strokeWidth:2}))})]}),
216
+ /* @__PURE__ */t.jsxs(n.ScrollView,{style:s.scroll,contentContainerStyle:s.scrollContent,keyboardShouldPersistTaps:"handled",children:[i.loading&&i.rows.length===0?/* @__PURE__ */t.jsxs(n.View,{style:s.state,accessibilityLabel:ni.loading,accessibilityState:{busy:true},children:[
217
217
  /* @__PURE__ */t.jsx(n.ActivityIndicator,{color:d.brandInk}),
218
- /* @__PURE__ */t.jsx(Text,{tier:"compact",style:s.mono,children:Jl.loading})]}):null,i.error!==null?/* @__PURE__ */t.jsxs(n.View,{style:s.state,children:[
219
- /* @__PURE__ */t.jsx(Text,{style:s.stateText,accessibilityRole:"alert",children:Jl.loadFailed}),
220
- /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:Jl.retry,onPress:()=>{i.load()},style:s.link,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:s.linkText,children:Jl.retry})})]}):null,!i.loading&&i.error===null&&i.rows.length===0?/* @__PURE__ */t.jsx(Text,{style:[s.stateText,s.state],children:Jl.empty}):null,c.map((l,a)=>/* @__PURE__ */t.jsxs(e.Fragment,{children:[l.day?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:[s.mono,s.day,a===0?s.dayFirst:null],children:l.day}):null,l.rows.map(e=>{let l=e.id===r.conversationId,a=e.unreadCount!==null&&e.unreadCount>0,u=Up(e.updatedAt);/* @__PURE__ */
221
- return t.jsxs(n.Pressable,{accessibilityRole:"button",accessibilityLabel:ni(e),accessibilityState:{selected:l},onPress:()=>{i.resume(e.id)},style:[s.row,l?s.rowCurrent:null],children:[
222
- /* @__PURE__ */t.jsx(n.View,{style:s.icon,children:df(o,"chat",/* @__PURE__ */t.jsx(ChatBubbleGlyph,{size:19,color:d.linkInk,strokeWidth:1.75}))}),
218
+ /* @__PURE__ */t.jsx(Text,{tier:"compact",style:s.mono,children:ni.loading})]}):null,i.error!==null?/* @__PURE__ */t.jsxs(n.View,{style:s.state,children:[
219
+ /* @__PURE__ */t.jsx(Text,{style:s.stateText,accessibilityRole:"alert",children:ni.loadFailed}),
220
+ /* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:ni.retry,onPress:()=>{i.load()},style:s.link,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:s.linkText,children:ni.retry})})]}):null,!i.loading&&i.error===null&&i.rows.length===0?/* @__PURE__ */t.jsx(Text,{style:[s.stateText,s.state],children:ni.empty}):null,c.map((l,a)=>/* @__PURE__ */t.jsxs(e.Fragment,{children:[l.day?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:[s.mono,s.day,a===0?s.dayFirst:null],children:l.day}):null,l.rows.map(e=>{let l=e.id===r.conversationId,a=e.unreadCount!==null&&e.unreadCount>0,u=qp(e.updatedAt);/* @__PURE__ */
221
+ return t.jsxs(n.Pressable,{accessibilityRole:"button",accessibilityLabel:si(e),accessibilityState:{selected:l},onPress:()=>{i.resume(e.id)},style:[s.row,l?s.rowCurrent:null],children:[
222
+ /* @__PURE__ */t.jsx(n.View,{style:s.icon,children:ff(o,"chat",/* @__PURE__ */t.jsx(ChatBubbleGlyph,{size:19,color:d.linkInk,strokeWidth:1.75}))}),
223
223
  /* @__PURE__ */t.jsxs(n.View,{style:s.rowWords,children:[
224
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:s.rowTitle,numberOfLines:1,children:Xl(e.title)}),e.preview!==void 0?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:s.preview,numberOfLines:1,children:e.preview}):null]}),
225
- /* @__PURE__ */t.jsxs(n.View,{style:s.rowEnd,children:[u!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:[s.mono,s.time,a?s.timeUnread:null],children:u}):null,a?/* @__PURE__ */t.jsx(n.View,{style:s.unreadDot,testID:`everfur-history-sheet-unread-${String(e.id)}`}):null]})]},String(e.id))})]},l.day)),i.cursor!==null&&!i.loadingMore?/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:Jl.more,onPress:i.loadMore,style:s.link,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:s.linkText,children:Jl.more})}):null]}),
226
- /* @__PURE__ */t.jsxs(n.Pressable,{accessibilityRole:"button",accessibilityLabel:Jl.newChat,onPress:i.newConversation,style:s.newChat,children:[df(o,"edit",/* @__PURE__ */t.jsx(EditGlyph,{size:18,color:a.slots.primaryButton?.textColor??d.onPrimary,strokeWidth:1.75})),
227
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:s.newChatText,children:Jl.newChat})]})]})]})})}function pf(e){let t=e.color,r=e.space,l={...face(e,"mono"),fontSize:Zp,letterSpacing:Zp*.06,textTransform:"uppercase",color:t.text.muted};return n.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{backgroundColor:qp},sheet:{maxHeight:cf,backgroundColor:t.surface,borderTopLeftRadius:Gp,borderTopRightRadius:Gp,paddingTop:10,paddingHorizontal:20},grab:{width:Kp,height:Yp,borderRadius:3,backgroundColor:t.borderRingCream,alignSelf:"center",marginBottom:10},top:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},kicker:{...l,fontSize:Qp,letterSpacing:Qp*.08,flexShrink:1},close:{width:os,height:os,marginRight:-10,alignItems:"center",justifyContent:"center",borderRadius:os/2},scroll:{flexGrow:0},scrollContent:{paddingBottom:r.xs},mono:l,day:{marginTop:r.lg,marginBottom:r.xs},dayFirst:{marginTop:lf},state:{marginVertical:r.md,gap:r.sm,alignItems:"flex-start"},stateText:{...face(e,"regular"),fontSize:e.type.size.body,color:t.text.primary},link:{minHeight:os,justifyContent:"center"},linkText:{...face(e,"bold"),fontSize:e.type.size.body,color:t.brandInk},row:{flexDirection:"row",alignItems:"center",gap:r.md,paddingVertical:10,paddingHorizontal:r.sm,borderRadius:ef,minHeight:os},rowCurrent:{backgroundColor:t.surfaceSubtle},icon:{width:Jp,height:Jp,borderRadius:Xp,backgroundColor:Ta(t.linkInk,af)??t.surfaceSubtle,alignItems:"center",justifyContent:"center"},rowWords:{flex:1,minWidth:0},rowTitle:{...face(e,"bold"),fontSize:tf,lineHeight:tf*of,color:t.text.primary},preview:{...face(e,"regular"),fontSize:rf,color:t.text.muted,marginTop:2},rowEnd:{alignSelf:"flex-start",alignItems:"flex-end",gap:6},time:{marginTop:3,letterSpacing:Zp*.04,textTransform:"none"},timeUnread:{...face(e,"monoBold"),color:t.text.primary},unreadDot:{width:uf,height:uf,borderRadius:uf/2,backgroundColor:t.danger},newChat:{marginTop:r.lg,minHeight:nf,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:r.sm,borderRadius:e.radius.pill,backgroundColor:t.primary,...ho(e.slots.primaryButton)},newChatText:{...face(e,"bold"),fontSize:sf,color:t.onPrimary,...go(e.slots.primaryButton)}})}var ff="Close",hf=/* @__PURE__ */Object.freeze({action:e=>e.possessive===null?null:`See ${e.possessive} Health Plan`,ask:"What does it mean?",askPrompt:(e,t)=>e.risk?.lead?`${e.risk.lead} ${t}`:`${e.title}: ${t}`,close:e=>e.possessive===null?null:`Close ${e.possessive} focus`,resultsKicker:e=>e.possessive===null?null:`${bf(e.possessive)} results`,resultsClose:e=>e.possessive===null?null:`Close ${e.possessive} results`,resultsTopRisk:"Top risk"});function bf(e){return e.charAt(0).toUpperCase()+e.slice(1)}function healthPlanPossessive(e){let t=typeof e.sex=="string"?e.sex.trim().toLowerCase():null;if(t==="female")return"her";if(t==="male")return"his";let r=typeof e.name=="string"?e.name.trim():"";return r!==""?`${r}'s`:null}function healthPlanTopCard(e,t={}){let r=e?.page?.focus;if(e===null||r===void 0||r.title.trim()===""||r.kicker.trim()==="")return;let n={...hf,...t.copy},l={pet:e.pet,possessive:healthPlanPossessive(e.pet)},i=r.sources?.find(e=>e.label.trim()!=="")?.label,o=t.onOpenPlan,a=o===void 0?null:n.action(l),s=n.close(l),u=n.ask.trim(),c=t.results!==void 0&&r.report!==void 0?t.results:void 0;if(c!==void 0){let e=n.resultsKicker(l)?.trim()||r.kicker,s=n.resultsClose(l),d=c.onTopRisk??o,p={key:"top-risk",label:n.resultsTopRisk,title:r.title,...r.risk?.lead?{line:r.risk.lead}:{},tone:"risk",...d===void 0?{}:{onPress:d}};return{kicker:e,...i===void 0?{}:{badge:i},title:r.title,results:[p,...c.rows??[]],...a===null||a.trim()===""||o===void 0?{}:{action:{label:a,onPress:o}},...u===""?{}:{ask:{label:u,prompt:n.askPrompt(r,u)}},closeLabel:s===null||s.trim()===""?ff:s,pill:e,...t.renderIcon===void 0?{}:{renderIcon:t.renderIcon}}}return{kicker:r.kicker,...i===void 0?{}:{badge:i},title:r.title,...r.risk?.lead?{lead:r.risk.lead}:{},...r.risk?.body?{body:r.risk.body}:{},...a===null||a.trim()===""||o===void 0?{}:{action:{label:a,onPress:o}},...u===""?{}:{ask:{label:u,prompt:n.askPrompt(r,u)}},closeLabel:s===null||s.trim()===""?ff:s,pill:r.kicker,...t.renderIcon===void 0?{}:{renderIcon:t.renderIcon}}}function gf(e){let t=face(e,"medium");return t.fontWeight===void 0?t:{fontFamily:t.fontFamily,fontWeight:"600"}}function mf(e){let t=face(e,"bold");return t.fontWeight===void 0?t:{fontFamily:t.fontFamily,fontWeight:"800"}}var yf=20,vf=14,xf=16,wf=18,kf=22,Sf=15,Cf=12,jf=24,Rf=15,Tf=14.5,_f=21,zf=14.5,If=18,Pf=9,Ef=36,Mf=14,Ff=15,Af=8,Lf=40;function TopCard({card:r,open:l,onOpenChange:i,ask:o}){let a=useEverfurTheme(),s=mp(),u=e.useMemo(()=>s!==null?Vf(s):Df(a),[a,s]),c=e.useMemo(()=>ho(a.slots.card),[a.slots.card]);if(!l)return null;let d=r.closeLabel===void 0?null:r.closeLabel.trim()!==""?r.closeLabel:pe.close,p=r.action,f=r.ask,h=/* @__PURE__ */t.jsx(CloseGlyph,{size:s!==null?HOME_CLOSE_GLYPH(s):If,color:s!==null?String(s.text(".ask-focus__x").color):a.color.text.primary,strokeWidth:2});/* @__PURE__ */
224
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:s.rowTitle,numberOfLines:1,children:li(e.title)}),e.preview!==void 0?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:s.preview,numberOfLines:1,children:e.preview}):null]}),
225
+ /* @__PURE__ */t.jsxs(n.View,{style:s.rowEnd,children:[u!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:[s.mono,s.time,a?s.timeUnread:null],children:u}):null,a?/* @__PURE__ */t.jsx(n.View,{style:s.unreadDot,testID:`everfur-history-sheet-unread-${String(e.id)}`}):null]})]},String(e.id))})]},l.day)),i.cursor!==null&&!i.loadingMore?/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:ni.more,onPress:i.loadMore,style:s.link,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:s.linkText,children:ni.more})}):null]}),
226
+ /* @__PURE__ */t.jsxs(n.Pressable,{accessibilityRole:"button",accessibilityLabel:ni.newChat,onPress:i.newConversation,style:s.newChat,children:[ff(o,"edit",/* @__PURE__ */t.jsx(EditGlyph,{size:18,color:a.slots.primaryButton?.textColor??d.onPrimary,strokeWidth:1.75})),
227
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:s.newChatText,children:ni.newChat})]})]})]})})}function hf(e){let t=e.color,r=e.space,l={...face(e,"mono"),fontSize:Xp,letterSpacing:Xp*.06,textTransform:"uppercase",color:t.text.muted};return n.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{backgroundColor:Kp},sheet:{maxHeight:pf,backgroundColor:t.surface,borderTopLeftRadius:Yp,borderTopRightRadius:Yp,paddingTop:10,paddingHorizontal:20},grab:{width:Qp,height:Zp,borderRadius:3,backgroundColor:t.borderRingCream,alignSelf:"center",marginBottom:10},top:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},kicker:{...l,fontSize:Jp,letterSpacing:Jp*.08,flexShrink:1},close:{width:ds,height:ds,marginRight:-10,alignItems:"center",justifyContent:"center",borderRadius:ds/2},scroll:{flexGrow:0},scrollContent:{paddingBottom:r.xs},mono:l,day:{marginTop:r.lg,marginBottom:r.xs},dayFirst:{marginTop:af},state:{marginVertical:r.md,gap:r.sm,alignItems:"flex-start"},stateText:{...face(e,"regular"),fontSize:e.type.size.body,color:t.text.primary},link:{minHeight:ds,justifyContent:"center"},linkText:{...face(e,"bold"),fontSize:e.type.size.body,color:t.brandInk},row:{flexDirection:"row",alignItems:"center",gap:r.md,paddingVertical:10,paddingHorizontal:r.sm,borderRadius:rf,minHeight:ds},rowCurrent:{backgroundColor:t.surfaceSubtle},icon:{width:ef,height:ef,borderRadius:tf,backgroundColor:Ea(t.linkInk,uf)??t.surfaceSubtle,alignItems:"center",justifyContent:"center"},rowWords:{flex:1,minWidth:0},rowTitle:{...face(e,"bold"),fontSize:nf,lineHeight:nf*sf,color:t.text.primary},preview:{...face(e,"regular"),fontSize:lf,color:t.text.muted,marginTop:2},rowEnd:{alignSelf:"flex-start",alignItems:"flex-end",gap:6},time:{marginTop:3,letterSpacing:Xp*.04,textTransform:"none"},timeUnread:{...face(e,"monoBold"),color:t.text.primary},unreadDot:{width:df,height:df,borderRadius:df/2,backgroundColor:t.danger},newChat:{marginTop:r.lg,minHeight:of,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:r.sm,borderRadius:e.radius.pill,backgroundColor:t.primary,...vo(e.slots.primaryButton)},newChatText:{...face(e,"bold"),fontSize:cf,color:t.onPrimary,...wo(e.slots.primaryButton)}})}var bf="Close",gf=/* @__PURE__ */Object.freeze({action:e=>e.possessive===null?null:`See ${e.possessive} Health Plan`,ask:"What does it mean?",askPrompt:(e,t)=>e.risk?.lead?`${e.risk.lead} ${t}`:`${e.title}: ${t}`,close:e=>e.possessive===null?null:`Close ${e.possessive} focus`,resultsKicker:e=>e.possessive===null?null:`${mf(e.possessive)} results`,resultsClose:e=>e.possessive===null?null:`Close ${e.possessive} results`,resultsTopRisk:"Top risk"});function mf(e){return e.charAt(0).toUpperCase()+e.slice(1)}function healthPlanPossessive(e){let t=typeof e.sex=="string"?e.sex.trim().toLowerCase():null;if(t==="female")return"her";if(t==="male")return"his";let r=typeof e.name=="string"?e.name.trim():"";return r!==""?`${r}'s`:null}function healthPlanTopCard(e,t={}){let r=e?.page?.focus;if(e===null||r===void 0||r.title.trim()===""||r.kicker.trim()==="")return;let n={...gf,...t.copy},l={pet:e.pet,possessive:healthPlanPossessive(e.pet)},i=r.sources?.find(e=>e.label.trim()!=="")?.label,o=t.onOpenPlan,a=o===void 0?null:n.action(l),s=n.close(l),u=n.ask.trim(),c=t.results!==void 0&&r.report!==void 0?t.results:void 0;if(c!==void 0){let e=n.resultsKicker(l)?.trim()||r.kicker,s=n.resultsClose(l),d=c.onTopRisk??o,p={key:"top-risk",label:n.resultsTopRisk,title:r.title,...r.risk?.lead?{line:r.risk.lead}:{},tone:"risk",...d===void 0?{}:{onPress:d}};return{kicker:e,...i===void 0?{}:{badge:i},title:r.title,results:[p,...c.rows??[]],...a===null||a.trim()===""||o===void 0?{}:{action:{label:a,onPress:o}},...u===""?{}:{ask:{label:u,prompt:n.askPrompt(r,u)}},closeLabel:s===null||s.trim()===""?bf:s,pill:e,...t.renderIcon===void 0?{}:{renderIcon:t.renderIcon}}}return{kicker:r.kicker,...i===void 0?{}:{badge:i},title:r.title,...r.risk?.lead?{lead:r.risk.lead}:{},...r.risk?.body?{body:r.risk.body}:{},...a===null||a.trim()===""||o===void 0?{}:{action:{label:a,onPress:o}},...u===""?{}:{ask:{label:u,prompt:n.askPrompt(r,u)}},closeLabel:s===null||s.trim()===""?bf:s,pill:r.kicker,...t.renderIcon===void 0?{}:{renderIcon:t.renderIcon}}}function yf(e){let t=face(e,"medium");return t.fontWeight===void 0?t:{fontFamily:t.fontFamily,fontWeight:"600"}}function vf(e){let t=face(e,"bold");return t.fontWeight===void 0?t:{fontFamily:t.fontFamily,fontWeight:"800"}}var xf=20,wf=14,kf=16,Sf=18,Cf=22,jf=15,Rf=12,Tf=24,_f=15,zf=14.5,If=21,Pf=14.5,Ef=18,Mf=9,Ff=36,Af=14,Lf=15,Of=8,Vf=40;function TopCard({card:r,open:l,onOpenChange:i,ask:o}){let a=useEverfurTheme(),s=vp(),u=e.useMemo(()=>s!==null?Bf(s):Hf(a),[a,s]),c=e.useMemo(()=>vo(a.slots.card),[a.slots.card]);if(!l)return null;let d=r.closeLabel===void 0?null:r.closeLabel.trim()!==""?r.closeLabel:pe.close,p=r.action,f=r.ask,h=/* @__PURE__ */t.jsx(CloseGlyph,{size:s!==null?HOME_CLOSE_GLYPH(s):Ef,color:s!==null?String(s.text(".ask-focus__x").color):a.color.text.primary,strokeWidth:2});/* @__PURE__ */
228
228
  return t.jsxs(n.View,{style:[u.card,c],testID:"everfur-top-card",children:[
229
229
  /* @__PURE__ */t.jsxs(n.View,{style:u.kickerRow,children:[
230
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:u.kicker,children:r.kicker}),r.badge!==void 0?/* @__PURE__ */t.jsx(n.View,{style:u.badge,children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:u.badgeText,numberOfLines:1,children:r.badge})}):null,d!==null?/* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>i(false),accessibilityRole:"button",accessibilityLabel:d,style:u.close,hitSlop:s!==null?Of:void 0,testID:"everfur-top-card-close",children:r.renderIcon!==void 0?/* @__PURE__ */t.jsx(HostRender,{render:()=>r.renderIcon?.("close"),fallback:h}):h}):null]}),
230
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:u.kicker,children:r.kicker}),r.badge!==void 0?/* @__PURE__ */t.jsx(n.View,{style:u.badge,children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:u.badgeText,numberOfLines:1,children:r.badge})}):null,d!==null?/* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>i(false),accessibilityRole:"button",accessibilityLabel:d,style:u.close,hitSlop:s!==null?Df:void 0,testID:"everfur-top-card-close",children:r.renderIcon!==void 0?/* @__PURE__ */t.jsx(HostRender,{render:()=>r.renderIcon?.("close"),fallback:h}):h}):null]}),
231
231
  /* @__PURE__ */t.jsx(Text,{tier:"heading",style:u.title,accessibilityRole:"header",children:r.title}),r.lead!==void 0||r.body!==void 0?/* @__PURE__ */t.jsxs(n.View,{style:u.finding,children:[
232
232
  /* @__PURE__ */t.jsx(n.View,{style:u.dot}),
233
- /* @__PURE__ */t.jsxs(Text,{style:u.findingText,children:[r.lead!==void 0?/* @__PURE__ */t.jsx(Text,{style:u.lead,children:r.lead}):null,r.lead!==void 0&&r.body!==void 0?" ":null,r.body??null]})]}):null,p!==void 0||f!==void 0?/* @__PURE__ */t.jsxs(n.View,{style:u.actions,children:[p!==void 0?/* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>{vr(p.onPress)},accessibilityRole:"button",accessibilityLabel:p.label,style:u.action,hitSlop:s!==null?Of:void 0,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:u.actionText,children:p.label})}):null,f!==void 0?/* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>o(f.prompt),accessibilityRole:"button",accessibilityLabel:f.label,style:u.ask,hitSlop:s!==null?Of:void 0,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:u.askText,children:f.label})}):null]}):null]})}function TopCardPill({card:r,open:l,onOpenChange:i}){let o=useEverfurTheme(),a=mp(),s=e.useMemo(()=>a!==null?Vf(a):Df(o),[o,a]);if(l||r.closeLabel===void 0)return null;let u=r.pill??r.kicker;/* @__PURE__ */
234
- return t.jsxs(n.Pressable,{onPress:()=>i(true),accessibilityRole:"button",accessibilityLabel:u,accessibilityState:{expanded:false},style:s.pill,hitSlop:a!==null?Of:void 0,testID:"everfur-top-card-pill",children:[
233
+ /* @__PURE__ */t.jsxs(Text,{style:u.findingText,children:[r.lead!==void 0?/* @__PURE__ */t.jsx(Text,{style:u.lead,children:r.lead}):null,r.lead!==void 0&&r.body!==void 0?" ":null,r.body??null]})]}):null,p!==void 0||f!==void 0?/* @__PURE__ */t.jsxs(n.View,{style:u.actions,children:[p!==void 0?/* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>{vr(p.onPress)},accessibilityRole:"button",accessibilityLabel:p.label,style:u.action,hitSlop:s!==null?Df:void 0,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:u.actionText,children:p.label})}):null,f!==void 0?/* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>o(f.prompt),accessibilityRole:"button",accessibilityLabel:f.label,style:u.ask,hitSlop:s!==null?Df:void 0,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:u.askText,children:f.label})}):null]}):null]})}function TopCardPill({card:r,open:l,onOpenChange:i}){let o=useEverfurTheme(),a=vp(),s=e.useMemo(()=>a!==null?Bf(a):Hf(o),[o,a]);if(l||r.closeLabel===void 0)return null;let u=r.pill??r.kicker;/* @__PURE__ */
234
+ return t.jsxs(n.Pressable,{onPress:()=>i(true),accessibilityRole:"button",accessibilityLabel:u,accessibilityState:{expanded:false},style:s.pill,hitSlop:a!==null?Df:void 0,testID:"everfur-top-card-pill",children:[
235
235
  /* @__PURE__ */t.jsx(n.View,{style:s.pillDot}),
236
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:s.pillText,numberOfLines:1,children:u})]})}var Of=4,HOME_CLOSE_GLYPH=e=>{let t=e.icon(".ask-focus__x svg").width;return typeof t=="number"?t:If};function Vf(e){let t=e.text(".hp-need__s",".ask-focus .hp-need__s"),r=typeof t.lineHeight=="number"?t.lineHeight:21,n=e.view(".dot",".dot--risk"),l=typeof n.height=="number"?n.height:Pf;return{card:e.view(".ask-focus"),kickerRow:e.view(".hp-need__k"),kicker:[e.text(".hp-need__k"),{flexShrink:1}],badge:[e.view(".hp-srcs"),e.view(".hp-src",".hp-src--dna"),{flexShrink:1}],badgeText:e.text(".hp-src",".hp-src--dna"),close:e.view(".ask-focus__x"),title:[e.view(".ask-focus h3"),e.text(".ask-focus h3")],finding:[e.view(".hp-need__s"),{alignItems:"flex-start"}],dot:[e.col(".hp-need__s",0),n,{marginTop:Math.round((r-l)/2)}],findingText:[e.col(".hp-need__s",1),t],lead:(({fontFamily:e,fontWeight:t,color:r})=>({fontFamily:e,fontWeight:t,color:r}))(e.strong(".hp-need__s b")),actions:e.view(".ask-focus__acts"),action:[e.view(".emb-btn",".emb-btn--sm"),{maxWidth:"100%"}],actionText:e.text(".emb-btn",".emb-btn--sm"),ask:[e.view(".ask-focus__q"),{justifyContent:"center",maxWidth:"100%"}],askText:e.text(".ask-focus__q"),pill:[e.view(".ask-focus-pill"),{maxWidth:"100%"}],pillDot:e.view(".ask-focus-pill i"),pillText:[e.text(".ask-focus-pill"),{flexShrink:1}]}}function Df(e){let t=e.color,r=e.space;return n.StyleSheet.create({card:{paddingTop:vf,paddingHorizontal:xf,paddingBottom:xf,borderRadius:yf,backgroundColor:t.surface,borderWidth:1,borderColor:t.borderRingCream,alignSelf:"stretch"},kickerRow:{flexDirection:"row",alignItems:"center",gap:r.sm,minHeight:os-8},kicker:{...mf(e),fontSize:Sf,color:t.text.primary,flexShrink:1},badge:{marginLeft:"auto",minHeight:jf,justifyContent:"center",paddingHorizontal:9,borderRadius:e.radius.pill,backgroundColor:t.surfaceSubtle,flexShrink:1},badgeText:{...face(e,"bold"),fontSize:Cf,color:t.text.secondary},close:{width:os,height:os,marginVertical:-4,marginRight:-10,alignItems:"center",justifyContent:"center",borderRadius:os/2},title:{...mf(e),fontSize:wf,lineHeight:kf,color:t.text.primary,marginTop:r.xs},finding:{flexDirection:"row",gap:r.sm,marginTop:r.xs+2},dot:{width:Pf,height:Pf,borderRadius:Pf/2,marginTop:7,backgroundColor:t.danger},findingText:{...face(e,"regular"),flex:1,fontSize:Tf,lineHeight:_f,color:t.text.primary},lead:face(e,"bold"),actions:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:r.lg,marginTop:14},action:{minHeight:Math.max(Lf,os),paddingHorizontal:r.lg,borderRadius:e.radius.pill,backgroundColor:t.primary,alignItems:"center",justifyContent:"center",maxWidth:"100%"},actionText:{...face(e,"bold"),fontSize:Rf,color:t.onPrimary},ask:{minHeight:os,justifyContent:"center",maxWidth:"100%"},askText:{...face(e,"bold"),fontSize:zf,color:t.brandInk,textDecorationLine:"underline"},pill:{flexDirection:"row",alignItems:"center",gap:r.sm,minHeight:Math.max(Ef,os),paddingHorizontal:Mf,borderRadius:e.radius.pill,backgroundColor:t.badgeBgCritical,alignSelf:"flex-start",maxWidth:"100%"},pillDot:{width:Af,height:Af,borderRadius:Af/2,backgroundColor:t.danger},pillText:{...face(e,"bold"),fontSize:Ff,color:t.danger,flexShrink:1}})}var Bf=/* @__PURE__ */Object.freeze({ink:"#262523",ink2:"#4A4845",ink3:"#6B6863",paper:"#F8F7F4",card:"#FFFFFF",line:"#E7E6E2",tile:"#F2F1EE",shadow:"rgba(38, 37, 35, .07)",riskBg:"#FFE3E1",riskInk:"#B0231B",riskDot:"#E5372B",clearBg:"#E6F4D3",clearInk:"#2F6A12",clearDot:"#5FA82B",watchDot:"#E5A000"}),Hf=/* @__PURE__ */new WeakMap;function Wf(e){let t=Hf.get(e);if(t!==void 0)return t;let r=e.color,n=e.brightness==="dark",l=n?{dark:n,ink:r.text.primary,ink2:r.text.secondary,ink3:r.text.muted,paper:r.background,card:r.surface,line:r.borderRingCream,tile:r.surfaceSubtle,shadow:r.shadow,riskBg:r.badgeBgCritical,riskInk:r.danger,riskDot:r.danger,clearBg:r.badgeBgPositive,clearInk:r.success,clearDot:r.success,watchDot:r.warningStrong}:{dark:n,...Bf},i=(e,t)=>za(e,t,wa(t),Nf),o=(e,t)=>contrastRatio(e,t)>=Nf?e:xa(t,Nf),a=[l.card,l.paper].map(e=>Ra(r.brandSoft,e)??e),s={primary:r.primary,onPrimary:o(r.onPrimary,r.primary),accent:r.accent,onAccent:o(r.onAccent,r.accent),link:i(r.linkInk,[l.card,l.paper,l.tile]),badge:r.brandSoft,onBadge:i(r.brandInk,a)},u=/* @__PURE__ */Object.freeze({...l,...s});return Hf.set(e,u),u}var Nf=4.5;function Uf(e,t){for(let r of t)if(contrastRatio(r,e)>=Nf)return r;return xa(e,Nf)}function $f(e,t,r){let n=Ta(e,t);return(n===null?null:Ra(n,r))??r}function qf(e){let t=Wf(e),r=e.color,n=t.card;return{ink:t.ink,ink2:t.ink2,ink3:t.ink3,paper:t.paper,tile:t.tile,line:t.line,card:n,onInk:t.dark?r.background:"#FFFFFF",primary:t.primary,onPrimary:t.onPrimary,accent:t.accent,onAccent:Uf(t.accent,[t.ink,t.onAccent]),accent2:$f(t.accent,.75,n),accent4:$f(t.accent,.17,n),accentChip:$f(t.accent,.47,n),link:t.link,linkChip:$f(t.link,.2,n),riskDot:t.riskDot,riskChip:t.dark?r.badgeBgCritical:"#FFD8D6",clearBg:t.clearBg,clearInk:t.clearInk,clearChip:t.dark?r.badgeBgPositive:"#DDEFC4",byInk:r.brandInk}}var Gf=/* @__PURE__ */new Set(["color","fontSize","fontWeight","fontStyle","lh","ls","family","textAlign","textTransform","textDecorationLine"]),Kf=/* @__PURE__ */new Set(["dur","delay","stagger","ease","tint","k","cols","nowrap"]),Yf=["paddingTop","paddingRight","paddingBottom","paddingLeft"],Qf=17,Zf=1.5,Jf=400,Xf=700;function eh(e){return e<=450?"regular":e<=650?"medium":"bold"}function th(e){let t=Math.min(900,Math.max(100,Math.round(e/100)*100));return String(t)}function rh(e,t,r){if(t==="$mono"){let t=r<=450?"mono":r<=650?"monoMedium":"monoBold",n=face(e,t);return n.fontWeight===void 0?{fontFamily:n.fontFamily}:{fontFamily:n.fontFamily,fontWeight:th(r)}}let n=t==="$serif"?headingFace(e,eh(r)):face(e,eh(r));return n.fontWeight===void 0?{fontFamily:n.fontFamily}:{fontFamily:n.fontFamily,fontWeight:th(r)}}function nh(e,t,r={}){let n=qf(e),l=e.brightness==="dark",i=e.motion.reducedMotion,o=e=>{if(typeof e=="string"&&e.startsWith("$")){let t=e.slice(1);return t.startsWith("n_")?l?n.line??e:`#${t.slice(2)}`:t==="sans"||t==="serif"||t==="mono"?e:n[t]??e}return Array.isArray(e)?e.map(e=>o(e)):e},a=/* @__PURE__ */new Map,s=e=>{let n=e.filter(e=>typeof e=="string"&&e!==""),l=n.join("|"),s=a.get(l);if(s!==void 0)return s;let u={},c=e=>{if(e!==void 0)for(let[t,r]of Object.entries(e))u[t]=o(r)};for(let e of n)c(t[e]),i&&c(r[e]);let d=/* @__PURE__ */Object.freeze(u);return a.set(l,d),d},u=/* @__PURE__ */new Map,c=(...e)=>{let t=e.filter(Boolean).join("|"),r=u.get(t);if(r!==void 0)return r;let n=s(e),l={};for(let[e,t]of Object.entries(n))Gf.has(e)||Kf.has(e)||e==="ring"||e==="edge"||e==="shadow"||e==="round"||e==="zIndex"&&typeof t=="number"&&t<0||t!==null&&(l[e]=t);if((typeof n.fontSize=="number"||n.flexDirection==="row")&&n.position!=="absolute"&&typeof n.height=="number"&&typeof n.width!="number"){let e=l.height;delete l.height,typeof l.minHeight!="number"&&(l.minHeight=e)}let i=n.ring;if(Array.isArray(i)){let[e,t]=i;l.borderWidth=e,l.borderColor=t;for(let t of Yf){let r=l[t];typeof r=="number"&&(l[t]=Math.max(0,r-e))}}let o=n.edge;if(Array.isArray(o)){let[e,t]=o;l.borderBottomWidth=e,l.borderBottomColor=t}let a=n.shadow;if(Array.isArray(a)){let[e,t,r,n]=a;l.shadowColor=n,l.shadowOffset={width:e,height:t},l.shadowOpacity=1,l.shadowRadius=r/2}if(n.round===1){let e=typeof n.width=="number"?n.width:typeof n.height=="number"?n.height:999;l.borderRadius=e/2}let c=/* @__PURE__ */Object.freeze(l);return u.set(t,c),c},d=/* @__PURE__ */new Map,p=(t,r)=>{let l=`${t}|${r.filter(Boolean).join("|")}`,i=d.get(l);if(i!==void 0)return i;let o=s(r),a=typeof o.fontSize=="number"?o.fontSize:Qf,u=typeof o.lh=="number"?o.lh:Zf,c=typeof o.fontWeight=="string"?Number(o.fontWeight):t,p=typeof o.family=="string"?o.family:"$sans",f={...rh(e,p,c),fontSize:a,lineHeight:Math.round(a*u*100)/100,color:typeof o.color=="string"?o.color:n.ink};typeof o.ls=="number"&&(f.letterSpacing=Math.round(o.ls*a*100)/100);for(let e of["fontStyle","textAlign","textTransform","textDecorationLine"])typeof o[e]=="string"&&(f[e]=o[e]);let h=/* @__PURE__ */Object.freeze(f);return d.set(l,h),h};return{reduced:i,colors:n,view:c,text:(...e)=>p(Jf,e),strong:(...e)=>p(Xf,e),icon:(...e)=>{let t=s(e),r={tintColor:typeof t.color=="string"?t.color:n.ink};for(let e of["width","height","opacity"])typeof t[e]=="number"&&(r[e]=t[e]);return r},col:(e,t)=>{let r=s([e]).cols;if(!Array.isArray(r))return{};let n=r[Math.min(t,r.length-1)];if(typeof n=="number")return{width:n,flexShrink:0};let l=typeof n=="string"?Number.parseFloat(n):1;return{flex:Number.isFinite(l)?l:1,minWidth:0}},motion:(...e)=>{let t=s(e),r=t.ease;return{dur:typeof t.dur=="number"?t.dur:0,delay:typeof t.delay=="number"?t.delay:0,stagger:typeof t.stagger=="number"?t.stagger:0,ease:Array.isArray(r)&&r.length===4?r:null}},raw:(e,...t)=>s(t)[e]}}var lh={".serif":{family:"$serif",fontWeight:"800",ls:-.01},".emb-btn":{flexDirection:"row",alignItems:"center",justifyContent:"center",minHeight:48,paddingTop:0,paddingRight:22,paddingBottom:0,paddingLeft:22,borderRadius:999,backgroundColor:"$primary",color:"$onPrimary",fontWeight:"700",fontSize:16,textDecorationLine:"none",dur:160,ease:[.23,1,.32,1],gap:8},".emb-btn--sm":{minHeight:40,paddingTop:0,paddingRight:16,paddingBottom:0,paddingLeft:16,fontSize:15},".dot":{width:9,height:9,round:1,flexGrow:0,flexShrink:0},".dot--risk":{backgroundColor:"$riskDot"},".ask-chips":{flexDirection:"column",alignItems:"center",marginTop:22,gap:10},".chip":{paddingTop:10,paddingRight:16,paddingBottom:10,paddingLeft:16,borderRadius:999,fontSize:15,fontWeight:"600",lh:1.3,textAlign:"center",dur:160,ease:[.23,1,.32,1]},".ask-empty":{minHeight:"100%",flexDirection:"column",alignItems:"center",paddingTop:14,paddingRight:16,paddingBottom:22,paddingLeft:16,textAlign:"center"},".ask-empty h2":{fontSize:23,lh:1.12},".ask-start":{width:"100%",marginTop:"auto",marginRight:0,marginBottom:"auto",marginLeft:0,paddingTop:18,paddingRight:0,paddingBottom:18,paddingLeft:0,flexDirection:"column",alignItems:"center"},".ask-empty .ask-chips":{marginTop:14,alignSelf:"center",alignItems:"stretch",width:"100%",maxWidth:340},".hp-need__k":{flexDirection:"row",alignItems:"center",fontSize:15,fontWeight:"800",gap:8},".hp-srcs":{marginLeft:"auto",flexDirection:"row",gap:4},".hp-src":{height:24,paddingTop:0,paddingRight:9,paddingBottom:0,paddingLeft:9,borderRadius:999,backgroundColor:"$tile",color:"$ink2",fontSize:12,fontWeight:"700",flexDirection:"row",alignItems:"center",nowrap:1},".hp-src--dna":{backgroundColor:"$n_E0FDFF",color:"$link"},".hp-need__s":{alignItems:"baseline",marginTop:6,fontSize:15,lh:1.45,color:"$ink2",flexDirection:"row",cols:[9,"1fr"],gap:9},".hp-need__s b":{color:"$ink",fontWeight:"800"},".ask-focus":{width:"100%",paddingTop:14,paddingRight:16,paddingBottom:16,paddingLeft:16,borderRadius:20,backgroundColor:"$card",textAlign:"left",shadow:[0,1,3,"rgba(38, 37, 35, .07)"]},".ask-focus h3":{marginTop:10,fontSize:18,fontWeight:"800",lh:1.22},".ask-focus__x":{width:36,height:36,marginTop:-8,marginRight:-10,marginBottom:-8,marginLeft:-2,alignItems:"center",justifyContent:"center",round:1,color:"$ink2"},".ask-focus__x svg":{width:18,height:18},".ask-focus-pill":{marginLeft:"auto",flexDirection:"row",alignItems:"center",minHeight:36,paddingTop:0,paddingRight:14,paddingBottom:0,paddingLeft:14,borderRadius:999,backgroundColor:"$n_FFE3E1",color:"$n_B0231B",fontSize:15,fontWeight:"800",gap:7},".ask-focus-pill i":{width:8,height:8,round:1,backgroundColor:"$riskDot"},".ask-focus .hp-need__s":{fontSize:14.5},".ask-focus__acts":{flexDirection:"row",flexWrap:"wrap",alignItems:"center",marginTop:12,rowGap:4,columnGap:16},".ask-focus__q":{minHeight:36,fontSize:14.5,fontWeight:"700",color:"$link",textDecorationLine:"underline"},".ask-top":{alignSelf:"stretch",flexDirection:"row",marginTop:-8,marginRight:0,marginBottom:6,marginLeft:0},".thread__hist":{flexDirection:"row",alignItems:"center",minHeight:36,paddingTop:0,paddingRight:4,paddingBottom:0,paddingLeft:4,fontSize:15,fontWeight:"700",color:"$link",gap:6},".thread__hist svg":{width:18,height:18},".thread__count":{minWidth:22,height:20,paddingTop:0,paddingRight:6,paddingBottom:0,paddingLeft:6,borderRadius:999,backgroundColor:"$card",color:"$ink2",fontSize:12,fontWeight:"800",alignItems:"center",justifyContent:"center",ring:[1,"$line"]}},ih=16;var oh=4e3,ah=.5;function sh(e,t,r){let n=1,l=-1;for(let i of e)l<0?l=i:l+t+i<=r?l+=t+i:(n+=1,l=i);return n}function uh(e,t,r){if(e.length===0)return r;let n=sh(e,t,r),l=[];for(let n=0;n<e.length;n+=1){let i=0;for(let o=n;o<e.length;o+=1)i+=(o>n?t:0)+e[o],i<=r&&l.push(i)}l.sort((e,t)=>e-t);let i=ah*e.length+1;for(let o of l)if(sh(e,t,o)<=n)return Math.min(r,o+i);return r}function BalancedTitle({text:r,style:l,measureCh:i}){let o=e.useMemo(()=>r.split(/\s+/).filter(e=>e!==""),[r]),a=n.StyleSheet.flatten(l),s=[r,a.fontFamily,a.fontSize,a.fontWeight,a.letterSpacing].join("|"),u=e.useRef({key:"",ch:null,line:null,words:[]});u.current.key!==s&&(u.current={key:s,ch:null,line:null,words:o.map(()=>null)});let[c,d]=e.useState(null),p=c!==null&&c.key===s?c.value:null,f=()=>{let e=u.current;if(e.ch===null||e.line===null||e.words.some(e=>e===null))return;let t=e.words,r=t.reduce((e,t)=>e+t,0),n=t.length>1?Math.max(0,(e.line-r)/(t.length-1)):0,l=uh(t,n,(e.ch+ah)*i);d(t=>t!==null&&t.key===e.key&&t.value===l?t:{key:e.key,value:l})},h=e=>t=>{u.current.key===s&&(e(u.current,t.nativeEvent.layout.width),f())};/* @__PURE__ */
237
- return t.jsxs(n.View,{style:ch.wrap,children:[
236
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:s.pillText,numberOfLines:1,children:u})]})}var Df=4,HOME_CLOSE_GLYPH=e=>{let t=e.icon(".ask-focus__x svg").width;return typeof t=="number"?t:Ef};function Bf(e){let t=e.text(".hp-need__s",".ask-focus .hp-need__s"),r=typeof t.lineHeight=="number"?t.lineHeight:21,n=e.view(".dot",".dot--risk"),l=typeof n.height=="number"?n.height:Mf;return{card:e.view(".ask-focus"),kickerRow:e.view(".hp-need__k"),kicker:[e.text(".hp-need__k"),{flexShrink:1}],badge:[e.view(".hp-srcs"),e.view(".hp-src",".hp-src--dna"),{flexShrink:1}],badgeText:e.text(".hp-src",".hp-src--dna"),close:e.view(".ask-focus__x"),title:[e.view(".ask-focus h3"),e.text(".ask-focus h3")],finding:[e.view(".hp-need__s"),{alignItems:"flex-start"}],dot:[e.col(".hp-need__s",0),n,{marginTop:Math.round((r-l)/2)}],findingText:[e.col(".hp-need__s",1),t],lead:(({fontFamily:e,fontWeight:t,color:r})=>({fontFamily:e,fontWeight:t,color:r}))(e.strong(".hp-need__s b")),actions:e.view(".ask-focus__acts"),action:[e.view(".emb-btn",".emb-btn--sm"),{maxWidth:"100%"}],actionText:e.text(".emb-btn",".emb-btn--sm"),ask:[e.view(".ask-focus__q"),{justifyContent:"center",maxWidth:"100%"}],askText:e.text(".ask-focus__q"),pill:[e.view(".ask-focus-pill"),{maxWidth:"100%"}],pillDot:e.view(".ask-focus-pill i"),pillText:[e.text(".ask-focus-pill"),{flexShrink:1}]}}function Hf(e){let t=e.color,r=e.space;return n.StyleSheet.create({card:{paddingTop:wf,paddingHorizontal:kf,paddingBottom:kf,borderRadius:xf,backgroundColor:t.surface,borderWidth:1,borderColor:t.borderRingCream,alignSelf:"stretch"},kickerRow:{flexDirection:"row",alignItems:"center",gap:r.sm,minHeight:ds-8},kicker:{...vf(e),fontSize:jf,color:t.text.primary,flexShrink:1},badge:{marginLeft:"auto",minHeight:Tf,justifyContent:"center",paddingHorizontal:9,borderRadius:e.radius.pill,backgroundColor:t.surfaceSubtle,flexShrink:1},badgeText:{...face(e,"bold"),fontSize:Rf,color:t.text.secondary},close:{width:ds,height:ds,marginVertical:-4,marginRight:-10,alignItems:"center",justifyContent:"center",borderRadius:ds/2},title:{...vf(e),fontSize:Sf,lineHeight:Cf,color:t.text.primary,marginTop:r.xs},finding:{flexDirection:"row",gap:r.sm,marginTop:r.xs+2},dot:{width:Mf,height:Mf,borderRadius:Mf/2,marginTop:7,backgroundColor:t.danger},findingText:{...face(e,"regular"),flex:1,fontSize:zf,lineHeight:If,color:t.text.primary},lead:face(e,"bold"),actions:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:r.lg,marginTop:14},action:{minHeight:Math.max(Vf,ds),paddingHorizontal:r.lg,borderRadius:e.radius.pill,backgroundColor:t.primary,alignItems:"center",justifyContent:"center",maxWidth:"100%"},actionText:{...face(e,"bold"),fontSize:_f,color:t.onPrimary},ask:{minHeight:ds,justifyContent:"center",maxWidth:"100%"},askText:{...face(e,"bold"),fontSize:Pf,color:t.brandInk,textDecorationLine:"underline"},pill:{flexDirection:"row",alignItems:"center",gap:r.sm,minHeight:Math.max(Ff,ds),paddingHorizontal:Af,borderRadius:e.radius.pill,backgroundColor:t.badgeBgCritical,alignSelf:"flex-start",maxWidth:"100%"},pillDot:{width:Of,height:Of,borderRadius:Of/2,backgroundColor:t.danger},pillText:{...face(e,"bold"),fontSize:Lf,color:t.danger,flexShrink:1}})}var Wf=/* @__PURE__ */Object.freeze({ink:"#262523",ink2:"#4A4845",ink3:"#6B6863",paper:"#F8F7F4",card:"#FFFFFF",line:"#E7E6E2",tile:"#F2F1EE",shadow:"rgba(38, 37, 35, .07)",riskBg:"#FFE3E1",riskInk:"#B0231B",riskDot:"#E5372B",clearBg:"#E6F4D3",clearInk:"#2F6A12",clearDot:"#5FA82B",watchDot:"#E5A000"}),Nf=/* @__PURE__ */new WeakMap;function Uf(e){let t=Nf.get(e);if(t!==void 0)return t;let r=e.color,n=e.brightness==="dark",l=n?{dark:n,ink:r.text.primary,ink2:r.text.secondary,ink3:r.text.muted,paper:r.background,card:r.surface,line:r.borderRingCream,tile:r.surfaceSubtle,shadow:r.shadow,riskBg:r.badgeBgCritical,riskInk:r.danger,riskDot:r.danger,clearBg:r.badgeBgPositive,clearInk:r.success,clearDot:r.success,watchDot:r.warningStrong}:{dark:n,...Wf},i=(e,t)=>Fa(e,t,Ra(t),$f),o=(e,t)=>contrastRatio(e,t)>=$f?e:ja(t,$f),a=[l.card,l.paper].map(e=>Pa(r.brandSoft,e)??e),s={primary:r.primary,onPrimary:o(r.onPrimary,r.primary),accent:r.accent,onAccent:o(r.onAccent,r.accent),link:i(r.linkInk,[l.card,l.paper,l.tile]),badge:r.brandSoft,onBadge:i(r.brandInk,a)},u=/* @__PURE__ */Object.freeze({...l,...s});return Nf.set(e,u),u}var $f=4.5;function qf(e,t){for(let r of t)if(contrastRatio(r,e)>=$f)return r;return ja(e,$f)}function Gf(e,t,r){let n=Ea(e,t);return(n===null?null:Pa(n,r))??r}function Kf(e){let t=Uf(e),r=e.color,n=t.card;return{ink:t.ink,ink2:t.ink2,ink3:t.ink3,paper:t.paper,tile:t.tile,line:t.line,card:n,onInk:t.dark?r.background:"#FFFFFF",primary:t.primary,onPrimary:t.onPrimary,accent:t.accent,onAccent:qf(t.accent,[t.ink,t.onAccent]),accent2:Gf(t.accent,.75,n),accent4:Gf(t.accent,.17,n),accentChip:Gf(t.accent,.47,n),link:t.link,linkChip:Gf(t.link,.2,n),riskDot:t.riskDot,riskChip:t.dark?r.badgeBgCritical:"#FFD8D6",clearBg:t.clearBg,clearInk:t.clearInk,clearChip:t.dark?r.badgeBgPositive:"#DDEFC4",byInk:r.brandInk}}var Yf=/* @__PURE__ */new Set(["color","fontSize","fontWeight","fontStyle","lh","ls","family","textAlign","textTransform","textDecorationLine"]),Qf=/* @__PURE__ */new Set(["dur","delay","stagger","ease","tint","k","cols","nowrap"]),Zf=["paddingTop","paddingRight","paddingBottom","paddingLeft"],Jf=17,Xf=1.5,eh=400,th=700;function rh(e){return e<=450?"regular":e<=650?"medium":"bold"}function nh(e){let t=Math.min(900,Math.max(100,Math.round(e/100)*100));return String(t)}function lh(e,t,r){if(t==="$mono"){let t=r<=450?"mono":r<=650?"monoMedium":"monoBold",n=face(e,t);return n.fontWeight===void 0?{fontFamily:n.fontFamily}:{fontFamily:n.fontFamily,fontWeight:nh(r)}}let n=t==="$serif"?headingFace(e,rh(r)):face(e,rh(r));return n.fontWeight===void 0?{fontFamily:n.fontFamily}:{fontFamily:n.fontFamily,fontWeight:nh(r)}}function ih(e,t,r={}){let n=Kf(e),l=e.brightness==="dark",i=e.motion.reducedMotion,o=e=>{if(typeof e=="string"&&e.startsWith("$")){let t=e.slice(1);return t.startsWith("n_")?l?n.line??e:`#${t.slice(2)}`:t==="sans"||t==="serif"||t==="mono"?e:n[t]??e}return Array.isArray(e)?e.map(e=>o(e)):e},a=/* @__PURE__ */new Map,s=e=>{let n=e.filter(e=>typeof e=="string"&&e!==""),l=n.join("|"),s=a.get(l);if(s!==void 0)return s;let u={},c=e=>{if(e!==void 0)for(let[t,r]of Object.entries(e))u[t]=o(r)};for(let e of n)c(t[e]),i&&c(r[e]);let d=/* @__PURE__ */Object.freeze(u);return a.set(l,d),d},u=/* @__PURE__ */new Map,c=(...e)=>{let t=e.filter(Boolean).join("|"),r=u.get(t);if(r!==void 0)return r;let n=s(e),l={};for(let[e,t]of Object.entries(n))Yf.has(e)||Qf.has(e)||e==="ring"||e==="edge"||e==="shadow"||e==="round"||e==="zIndex"&&typeof t=="number"&&t<0||t!==null&&(l[e]=t);if((typeof n.fontSize=="number"||n.flexDirection==="row")&&n.position!=="absolute"&&typeof n.height=="number"&&typeof n.width!="number"){let e=l.height;delete l.height,typeof l.minHeight!="number"&&(l.minHeight=e)}let i=n.ring;if(Array.isArray(i)){let[e,t]=i;l.borderWidth=e,l.borderColor=t;for(let t of Zf){let r=l[t];typeof r=="number"&&(l[t]=Math.max(0,r-e))}}let o=n.edge;if(Array.isArray(o)){let[e,t]=o;l.borderBottomWidth=e,l.borderBottomColor=t}let a=n.shadow;if(Array.isArray(a)){let[e,t,r,n]=a;l.shadowColor=n,l.shadowOffset={width:e,height:t},l.shadowOpacity=1,l.shadowRadius=r/2}if(n.round===1){let e=typeof n.width=="number"?n.width:typeof n.height=="number"?n.height:999;l.borderRadius=e/2}let c=/* @__PURE__ */Object.freeze(l);return u.set(t,c),c},d=/* @__PURE__ */new Map,p=(t,r)=>{let l=`${t}|${r.filter(Boolean).join("|")}`,i=d.get(l);if(i!==void 0)return i;let o=s(r),a=typeof o.fontSize=="number"?o.fontSize:Jf,u=typeof o.lh=="number"?o.lh:Xf,c=typeof o.fontWeight=="string"?Number(o.fontWeight):t,p=typeof o.family=="string"?o.family:"$sans",f={...lh(e,p,c),fontSize:a,lineHeight:Math.round(a*u*100)/100,color:typeof o.color=="string"?o.color:n.ink};typeof o.ls=="number"&&(f.letterSpacing=Math.round(o.ls*a*100)/100);for(let e of["fontStyle","textAlign","textTransform","textDecorationLine"])typeof o[e]=="string"&&(f[e]=o[e]);let h=/* @__PURE__ */Object.freeze(f);return d.set(l,h),h};return{reduced:i,colors:n,view:c,text:(...e)=>p(eh,e),strong:(...e)=>p(th,e),icon:(...e)=>{let t=s(e),r={tintColor:typeof t.color=="string"?t.color:n.ink};for(let e of["width","height","opacity"])typeof t[e]=="number"&&(r[e]=t[e]);return r},col:(e,t)=>{let r=s([e]).cols;if(!Array.isArray(r))return{};let n=r[Math.min(t,r.length-1)];if(typeof n=="number")return{width:n,flexShrink:0};let l=typeof n=="string"?Number.parseFloat(n):1;return{flex:Number.isFinite(l)?l:1,minWidth:0}},motion:(...e)=>{let t=s(e),r=t.ease;return{dur:typeof t.dur=="number"?t.dur:0,delay:typeof t.delay=="number"?t.delay:0,stagger:typeof t.stagger=="number"?t.stagger:0,ease:Array.isArray(r)&&r.length===4?r:null}},raw:(e,...t)=>s(t)[e]}}var oh={".serif":{family:"$serif",fontWeight:"800",ls:-.01},".emb-btn":{flexDirection:"row",alignItems:"center",justifyContent:"center",minHeight:48,paddingTop:0,paddingRight:22,paddingBottom:0,paddingLeft:22,borderRadius:999,backgroundColor:"$primary",color:"$onPrimary",fontWeight:"700",fontSize:16,textDecorationLine:"none",dur:160,ease:[.23,1,.32,1],gap:8},".emb-btn--sm":{minHeight:40,paddingTop:0,paddingRight:16,paddingBottom:0,paddingLeft:16,fontSize:15},".dot":{width:9,height:9,round:1,flexGrow:0,flexShrink:0},".dot--risk":{backgroundColor:"$riskDot"},".ask-chips":{flexDirection:"column",alignItems:"center",marginTop:22,gap:10},".chip":{paddingTop:10,paddingRight:16,paddingBottom:10,paddingLeft:16,borderRadius:999,fontSize:15,fontWeight:"600",lh:1.3,textAlign:"center",dur:160,ease:[.23,1,.32,1]},".ask-empty":{minHeight:"100%",flexDirection:"column",alignItems:"center",paddingTop:14,paddingRight:16,paddingBottom:22,paddingLeft:16,textAlign:"center"},".ask-empty h2":{fontSize:23,lh:1.12},".ask-start":{width:"100%",marginTop:"auto",marginRight:0,marginBottom:"auto",marginLeft:0,paddingTop:18,paddingRight:0,paddingBottom:18,paddingLeft:0,flexDirection:"column",alignItems:"center"},".ask-empty .ask-chips":{marginTop:14,alignSelf:"center",alignItems:"stretch",width:"100%",maxWidth:340},".hp-need__k":{flexDirection:"row",alignItems:"center",fontSize:15,fontWeight:"800",gap:8},".hp-srcs":{marginLeft:"auto",flexDirection:"row",gap:4},".hp-src":{height:24,paddingTop:0,paddingRight:9,paddingBottom:0,paddingLeft:9,borderRadius:999,backgroundColor:"$tile",color:"$ink2",fontSize:12,fontWeight:"700",flexDirection:"row",alignItems:"center",nowrap:1},".hp-src--dna":{backgroundColor:"$n_E0FDFF",color:"$link"},".hp-need__s":{alignItems:"baseline",marginTop:6,fontSize:15,lh:1.45,color:"$ink2",flexDirection:"row",cols:[9,"1fr"],gap:9},".hp-need__s b":{color:"$ink",fontWeight:"800"},".ask-focus":{width:"100%",paddingTop:14,paddingRight:16,paddingBottom:16,paddingLeft:16,borderRadius:20,backgroundColor:"$card",textAlign:"left",shadow:[0,1,3,"rgba(38, 37, 35, .07)"]},".ask-focus h3":{marginTop:10,fontSize:18,fontWeight:"800",lh:1.22},".ask-focus__x":{width:36,height:36,marginTop:-8,marginRight:-10,marginBottom:-8,marginLeft:-2,alignItems:"center",justifyContent:"center",round:1,color:"$ink2"},".ask-focus__x svg":{width:18,height:18},".ask-focus-pill":{marginLeft:"auto",flexDirection:"row",alignItems:"center",minHeight:36,paddingTop:0,paddingRight:14,paddingBottom:0,paddingLeft:14,borderRadius:999,backgroundColor:"$n_FFE3E1",color:"$n_B0231B",fontSize:15,fontWeight:"800",gap:7},".ask-focus-pill i":{width:8,height:8,round:1,backgroundColor:"$riskDot"},".ask-focus .hp-need__s":{fontSize:14.5},".ask-focus__acts":{flexDirection:"row",flexWrap:"wrap",alignItems:"center",marginTop:12,rowGap:4,columnGap:16},".ask-focus__q":{minHeight:36,fontSize:14.5,fontWeight:"700",color:"$link",textDecorationLine:"underline"},".ask-top":{alignSelf:"stretch",flexDirection:"row",marginTop:-8,marginRight:0,marginBottom:6,marginLeft:0},".thread__hist":{flexDirection:"row",alignItems:"center",minHeight:36,paddingTop:0,paddingRight:4,paddingBottom:0,paddingLeft:4,fontSize:15,fontWeight:"700",color:"$link",gap:6},".thread__hist svg":{width:18,height:18},".thread__count":{minWidth:22,height:20,paddingTop:0,paddingRight:6,paddingBottom:0,paddingLeft:6,borderRadius:999,backgroundColor:"$card",color:"$ink2",fontSize:12,fontWeight:"800",alignItems:"center",justifyContent:"center",ring:[1,"$line"]}},ah=16;var sh=4e3,uh=.5;function ch(e,t,r){let n=1,l=-1;for(let i of e)l<0?l=i:l+t+i<=r?l+=t+i:(n+=1,l=i);return n}function dh(e,t,r){if(e.length===0)return r;let n=ch(e,t,r),l=[];for(let n=0;n<e.length;n+=1){let i=0;for(let o=n;o<e.length;o+=1)i+=(o>n?t:0)+e[o],i<=r&&l.push(i)}l.sort((e,t)=>e-t);let i=uh*e.length+1;for(let o of l)if(ch(e,t,o)<=n)return Math.min(r,o+i);return r}function BalancedTitle({text:r,style:l,measureCh:i}){let o=e.useMemo(()=>r.split(/\s+/).filter(e=>e!==""),[r]),a=n.StyleSheet.flatten(l),s=[r,a.fontFamily,a.fontSize,a.fontWeight,a.letterSpacing].join("|"),u=e.useRef({key:"",ch:null,line:null,words:[]});u.current.key!==s&&(u.current={key:s,ch:null,line:null,words:o.map(()=>null)});let[c,d]=e.useState(null),p=c!==null&&c.key===s?c.value:null,f=()=>{let e=u.current;if(e.ch===null||e.line===null||e.words.some(e=>e===null))return;let t=e.words,r=t.reduce((e,t)=>e+t,0),n=t.length>1?Math.max(0,(e.line-r)/(t.length-1)):0,l=dh(t,n,(e.ch+uh)*i);d(t=>t!==null&&t.key===e.key&&t.value===l?t:{key:e.key,value:l})},h=e=>t=>{u.current.key===s&&(e(u.current,t.nativeEvent.layout.width),f())};/* @__PURE__ */
237
+ return t.jsxs(n.View,{style:ph.wrap,children:[
238
238
  /* @__PURE__ */t.jsx(Text,{tier:"heading",style:p===null?l:[l,{maxWidth:p}],accessibilityRole:"header",children:r}),
239
- /* @__PURE__ */t.jsx(n.View,{style:ch.probeClip,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */t.jsxs(n.View,{style:ch.probeRow,children:[
239
+ /* @__PURE__ */t.jsx(n.View,{style:ph.probeClip,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */t.jsxs(n.View,{style:ph.probeRow,children:[
240
240
  /* @__PURE__ */t.jsx(Text,{tier:"heading",style:l,onLayout:h((e,t)=>{e.ch=t}),children:"0"}),
241
- /* @__PURE__ */t.jsx(Text,{tier:"heading",style:l,onLayout:h((e,t)=>{e.line=t}),children:o.join(" ")}),o.map((e,r)=>/* @__PURE__ */t.jsx(Text,{tier:"heading",style:l,onLayout:h((e,t)=>{e.words[r]=t}),children:e},`${r}:${e}`))]})})]})}var ch=n.StyleSheet.create({wrap:{alignSelf:"stretch",alignItems:"center"},probeClip:{position:"absolute",left:0,top:0,width:0,height:0,overflow:"hidden",opacity:0},probeRow:{width:oh,flexDirection:"row",alignItems:"flex-start"}});function dh(e){return{kit:nh(e,lh),Title:BalancedTitle,titleCh:ih}}var ph=/* @__PURE__ */Symbol.for("everfur.sdk.rn.poweredBy");function fh(){let e=globalThis,t=e[ph];if(t!==void 0)return t;let r={count:0,listeners:/* @__PURE__ */new Set};return e[ph]=r,r}var hh=e=>{let t=fh();return t.listeners.add(e),()=>t.listeners.delete(e)},bh=()=>fh().count>0;function useHostPoweredBy(){return e.useSyncExternalStore(hh,bh,bh)}function EverfurPoweredBy({children:r,style:n}){let l=useEverfurTheme().meta.hidePoweredBy;return e.useEffect(()=>{if(l)return;let e=fh();return e.count+=1,e.listeners.forEach(e=>e()),()=>{e.count-=1,e.listeners.forEach(e=>e())}},[l]),l?null:r??/* @__PURE__ */t.jsx(Text,{tier:"compact",style:n,accessibilityRole:"text",children:pe.poweredBy})}var gh=/* @__PURE__ */Object.freeze({}),mh=100,yh=20;function vh(e,t,r,n){return![e,t,r,n].every(Number.isFinite)||e+r>n+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}function xh(t,r){let l=typeof t=="number"&&Number.isFinite(t),i=e.useRef(null),[o,a]=e.useState(null),s=e.useRef(null),u=e.useRef(null),c=e.useRef(true),d=e.useCallback(()=>{u.current!==null&&clearTimeout(u.current),u.current=null},[]);e.useEffect(()=>(c.current=true,()=>{c.current=false,d()}),[d]);let p=e.useCallback(function e(t){i.current?.measureInWindow((r,l)=>{let i=s.current;if(!c.current||i===null)return;let o=vh(l,i.y,i.height,n.Dimensions.get("window").height);if(o!==null){a(e=>e!==null&&e.chatTop===o.chatTop&&e.parentTop===o.parentTop?e:o);return}t>=yh||(u.current=setTimeout(()=>{u.current=null,e(t+1)},mh))})},[]),f=e.useCallback(e=>{let{y:t,height:r}=e.nativeEvent.layout;s.current={y:t,height:r},d(),p(0)},[p,d]);return e.useMemo(()=>{if(!r)return{avoidingProps:l?{keyboardVerticalOffset:t}:gh,probeRef:null,topInWindow:null};let e=o?.parentTop??0;return{avoidingProps:l?{keyboardVerticalOffset:t,onLayout:f}:e>0?{keyboardVerticalOffset:e,onLayout:f}:{onLayout:f},probeRef:i,topInWindow:o?.chatTop??null}},[r,l,t,o,f])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */t.jsx(n.View,{ref:e,collapsable:false,pointerEvents:"none",style:wh})}var wh=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function kh(){let[t,r]=e.useState(false);return e.useEffect(()=>{let e=n.Keyboard;if(typeof e?.addListener!="function")return;let t=n.Platform.OS==="ios",l=e.addListener(t?"keyboardWillShow":"keyboardDidShow",()=>r(true)),i=e.addListener(t?"keyboardWillHide":"keyboardDidHide",()=>r(false));return()=>{l.remove(),i.remove()}},[]),t}var Sh=4.5;var Ch=3;function jh(e,t,r){return za(e,t,wa(t),r)}function Rh(e,t){if(e.level==="emergency")return e;let r=e.level==="schedule_soon",n=ud(t),l=r?n.warning:n.info,i=sd(t)&&!l?e:Th(e,t,r);return _h(i,t.slots.banner)}function Th(e,t,r){let n=t.color,l=Ra(r?n.badgeBgCaution:n.badgeBgInfo,n.surface)??n.surface,i=r?n.cautionAccent:n.infoEdge,o=jh(Ra(i,n.surface)??i,[n.surface,n.chatGround],Ch),a=jh(r?n.warningStrong:n.info,[l,n.surface],Sh);/* @__PURE__ */
242
- return Object.freeze({...e,borderColor:o,backgroundColor:l,textColor:a,reasonColor:jh(n.text.primary,[l],Sh),pillColor:n.surface})}function _h(e,t){if(t===void 0)return e;let r={...e};return t.backgroundColor!==void 0&&(r.backgroundColor=t.backgroundColor),t.borderColor!==void 0&&(r.borderColor=t.borderColor),t.textColor!==void 0&&(r.textColor=t.textColor,r.reasonColor=t.textColor),/* @__PURE__ */Object.freeze(r)}function zh(petRef,e){let t={entry:"chat",petRef:petRef};return e?.returnTo!==void 0&&(t.returnTo=e.returnTo),e?.usState!==void 0&&(t.usState=e.usState),e?.prefer!==void 0&&(t.prefer=e.prefer),t}var Ih=.75,Ph=1.5,Eh=.4,Mh=4,Fh=1.5,Ah=22,Lh=14,Oh=8,Vh=20,Dh=10,Bh=13,Hh=12,Wh=15,Nh=44,Uh=14,$h=1.25,qh=14,Gh=6,Kh=2;function Yh(e,t){let r=e.color;if(t.level==="emergency")return{card:{backgroundColor:r.badgeBgCritical,borderColor:Ta(r.danger,Eh)??r.danger,borderWidth:Ph},label:r.danger,reason:r.text.primary,close:r.danger,action:{fill:r.surface,edge:r.danger,ink:r.danger}};let n=e.slots.banner?.borderRadius;return{card:{backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:Ih,...n===void 0?{}:{borderRadius:n}},label:t.textColor,reason:t.reasonColor,close:t.textColor,action:null}}function UrgencyBanner({surface:r,petRef:petRef,renderVetAction:n,onFindVet:l,vet:i,compact:o=false}){let a=useEverfurTheme(),s=e.useMemo(()=>Qh(a),[a]),u=Di(),c=r.tier===null?null:Rh(r.tier,a),d=r.source;/* @__PURE__ */
241
+ /* @__PURE__ */t.jsx(Text,{tier:"heading",style:l,onLayout:h((e,t)=>{e.line=t}),children:o.join(" ")}),o.map((e,r)=>/* @__PURE__ */t.jsx(Text,{tier:"heading",style:l,onLayout:h((e,t)=>{e.words[r]=t}),children:e},`${r}:${e}`))]})})]})}var ph=n.StyleSheet.create({wrap:{alignSelf:"stretch",alignItems:"center"},probeClip:{position:"absolute",left:0,top:0,width:0,height:0,overflow:"hidden",opacity:0},probeRow:{width:sh,flexDirection:"row",alignItems:"flex-start"}});function fh(e){return{kit:ih(e,oh),Title:BalancedTitle,titleCh:ah}}var hh=/* @__PURE__ */Symbol.for("everfur.sdk.rn.poweredBy");function bh(){let e=globalThis,t=e[hh];if(t!==void 0)return t;let r={count:0,listeners:/* @__PURE__ */new Set};return e[hh]=r,r}var gh=e=>{let t=bh();return t.listeners.add(e),()=>t.listeners.delete(e)},mh=()=>bh().count>0;function useHostPoweredBy(){return e.useSyncExternalStore(gh,mh,mh)}function EverfurPoweredBy({children:r,style:n}){let l=useEverfurTheme().meta.hidePoweredBy;return e.useEffect(()=>{if(l)return;let e=bh();return e.count+=1,e.listeners.forEach(e=>e()),()=>{e.count-=1,e.listeners.forEach(e=>e())}},[l]),l?null:r??/* @__PURE__ */t.jsx(Text,{tier:"compact",style:n,accessibilityRole:"text",children:pe.poweredBy})}var yh=/* @__PURE__ */Object.freeze({}),vh=100,xh=20;function wh(e,t,r,n){return![e,t,r,n].every(Number.isFinite)||e+r>n+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}function kh(t,r){let l=typeof t=="number"&&Number.isFinite(t),i=e.useRef(null),[o,a]=e.useState(null),s=e.useRef(null),u=e.useRef(null),c=e.useRef(true),d=e.useCallback(()=>{u.current!==null&&clearTimeout(u.current),u.current=null},[]);e.useEffect(()=>(c.current=true,()=>{c.current=false,d()}),[d]);let p=e.useCallback(function e(t){i.current?.measureInWindow((r,l)=>{let i=s.current;if(!c.current||i===null)return;let o=wh(l,i.y,i.height,n.Dimensions.get("window").height);if(o!==null){a(e=>e!==null&&e.chatTop===o.chatTop&&e.parentTop===o.parentTop?e:o);return}t>=xh||(u.current=setTimeout(()=>{u.current=null,e(t+1)},vh))})},[]),f=e.useCallback(e=>{let{y:t,height:r}=e.nativeEvent.layout;s.current={y:t,height:r},d(),p(0)},[p,d]);return e.useMemo(()=>{if(!r)return{avoidingProps:l?{keyboardVerticalOffset:t}:yh,probeRef:null,topInWindow:null};let e=o?.parentTop??0;return{avoidingProps:l?{keyboardVerticalOffset:t,onLayout:f}:e>0?{keyboardVerticalOffset:e,onLayout:f}:{onLayout:f},probeRef:i,topInWindow:o?.chatTop??null}},[r,l,t,o,f])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */t.jsx(n.View,{ref:e,collapsable:false,pointerEvents:"none",style:Sh})}var Sh=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function Ch(){let[t,r]=e.useState(false);return e.useEffect(()=>{let e=n.Keyboard;if(typeof e?.addListener!="function")return;let t=n.Platform.OS==="ios",l=e.addListener(t?"keyboardWillShow":"keyboardDidShow",()=>r(true)),i=e.addListener(t?"keyboardWillHide":"keyboardDidHide",()=>r(false));return()=>{l.remove(),i.remove()}},[]),t}var jh=4.5;var Rh=3;function Th(e,t,r){return Fa(e,t,Ra(t),r)}function _h(e,t){if(e.level==="emergency")return e;let r=e.level==="schedule_soon",n=dd(t),l=r?n.warning:n.info,i=cd(t)&&!l?e:zh(e,t,r);return Ih(i,t.slots.banner)}function zh(e,t,r){let n=t.color,l=Pa(r?n.badgeBgCaution:n.badgeBgInfo,n.surface)??n.surface,i=r?n.cautionAccent:n.infoEdge,o=Th(Pa(i,n.surface)??i,[n.surface,n.chatGround],Rh),a=Th(r?n.warningStrong:n.info,[l,n.surface],jh);/* @__PURE__ */
242
+ return Object.freeze({...e,borderColor:o,backgroundColor:l,textColor:a,reasonColor:Th(n.text.primary,[l],jh),pillColor:n.surface})}function Ih(e,t){if(t===void 0)return e;let r={...e};return t.backgroundColor!==void 0&&(r.backgroundColor=t.backgroundColor),t.borderColor!==void 0&&(r.borderColor=t.borderColor),t.textColor!==void 0&&(r.textColor=t.textColor,r.reasonColor=t.textColor),/* @__PURE__ */Object.freeze(r)}function Ph(petRef,e){let t={entry:"chat",petRef:petRef};return e?.returnTo!==void 0&&(t.returnTo=e.returnTo),e?.usState!==void 0&&(t.usState=e.usState),e?.prefer!==void 0&&(t.prefer=e.prefer),t}var Eh=.75,Mh=1.5,Fh=.4,Ah=4,Lh=1.5,Oh=22,Vh=14,Dh=8,Bh=20,Hh=10,Wh=13,Nh=12,Uh=15,$h=44,qh=14,Gh=1.25,Kh=14,Yh=6,Qh=2;function Zh(e,t){let r=e.color;if(t.level==="emergency")return{card:{backgroundColor:r.badgeBgCritical,borderColor:Ea(r.danger,Fh)??r.danger,borderWidth:Mh},label:r.danger,reason:r.text.primary,close:r.danger,action:{fill:r.surface,edge:r.danger,ink:r.danger}};let n=e.slots.banner?.borderRadius;return{card:{backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:Eh,...n===void 0?{}:{borderRadius:n}},label:t.textColor,reason:t.reasonColor,close:t.textColor,action:null}}function UrgencyBanner({surface:r,petRef:petRef,renderVetAction:n,onFindVet:l,vet:i,compact:o=false}){let a=useEverfurTheme(),s=e.useMemo(()=>Jh(a),[a]),u=Ui(),c=r.tier===null?null:_h(r.tier,a),d=r.source;/* @__PURE__ */
243
243
  return t.jsxs(t.Fragment,{children:[
244
244
  /* @__PURE__ */t.jsx(FadePresence,{visible:r.showBanner&&c!==null,inMs:u.bannerInMs,outMs:u.bannerOutMs,style:s.pinned,children:c!==null&&d!==null?/* @__PURE__ */t.jsx(BannerCard,{tier:c,reason:d.reason,surface:r,petRef:petRef,renderVetAction:n,onFindVet:l,vet:i,styles:s,compact:o}):null}),
245
- /* @__PURE__ */t.jsx(FadePresence,{visible:r.showCompactIcon,inMs:u.iconInMs,outMs:u.iconOutMs,style:s.indicatorRow,children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.showLatestVetAlert,hitSlop:Dh,onPress:r.expand,children:/* @__PURE__ */t.jsx(InfoGlyph,{size:Vh,color:a.color.text.muted,strokeWidth:2})})})]})}function BannerCard({tier:e,reason:r,surface:l,petRef:petRef,renderVetAction:i,onFindVet:o,vet:a,styles:s,compact:u}){let c=useEverfurTheme(),d=Yh(c,e),p=/* @__PURE__ */t.jsx(VetAction,{tier:e,paint:d,petRef:petRef,onFindVet:o,vet:a,styles:s}),f=l.showVetAction?i!==void 0?/* @__PURE__ */t.jsx(HostRender,{render:()=>i(e.level),fallback:p,resetKey:e.level}):p:null,h=d.action!==null?/* @__PURE__ */t.jsx(PoisonControl,{paint:d.action,styles:s}):null,b=e.level==="emergency"&&o===void 0,g=e.level==="emergency"||e.level==="schedule_soon";/* @__PURE__ */
245
+ /* @__PURE__ */t.jsx(FadePresence,{visible:r.showCompactIcon,inMs:u.iconInMs,outMs:u.iconOutMs,style:s.indicatorRow,children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.showLatestVetAlert,hitSlop:Hh,onPress:r.expand,children:/* @__PURE__ */t.jsx(InfoGlyph,{size:Bh,color:a.color.text.muted,strokeWidth:2})})})]})}function BannerCard({tier:e,reason:r,surface:l,petRef:petRef,renderVetAction:i,onFindVet:o,vet:a,styles:s,compact:u}){let c=useEverfurTheme(),d=Zh(c,e),p=/* @__PURE__ */t.jsx(VetAction,{tier:e,paint:d,petRef:petRef,onFindVet:o,vet:a,styles:s}),f=l.showVetAction?i!==void 0?/* @__PURE__ */t.jsx(HostRender,{render:()=>i(e.level),fallback:p,resetKey:e.level}):p:null,h=d.action!==null?/* @__PURE__ */t.jsx(PoisonControl,{paint:d.action,styles:s}):null,b=e.level==="emergency"&&o===void 0,g=e.level==="emergency"||e.level==="schedule_soon";/* @__PURE__ */
246
246
  return t.jsxs(n.View,{...g?{accessibilityRole:"alert"}:{accessibilityLiveRegion:"polite"},style:[s.card,d.card,u?s.cardCompact:null],testID:u?"chat-urgency-compact":void 0,children:[
247
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:[s.label,{color:d.label}],children:e.label}),r!==null?/* @__PURE__ */t.jsx(Text,{style:[s.reason,{color:d.reason}],numberOfLines:u?Kh:void 0,accessibilityLabel:u?r:void 0,children:r}):null,b?/* @__PURE__ */t.jsx(Text,{style:[s.reason,s.erLine,{color:d.reason}],children:pe.goToNearestEmergencyVet}):null,f!==null||h!==null?/* @__PURE__ */t.jsxs(n.View,{style:s.actions,children:[f,h]}):null,l.dismissLabel!==null?/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:l.dismissLabel,hitSlop:Oh,containerStyle:s.closeSlot,style:s.closeButton,onPress:l.dismiss,children:/* @__PURE__ */t.jsx(CloseGlyph,{size:Lh,color:d.close,strokeWidth:1.5})}):null]})}function PoisonControl({paint:e,styles:r}){let l=()=>{try{n.Linking.openURL(ge).catch(()=>{})}catch{}};/* @__PURE__ */
248
- return t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.poisonControlNative,hitSlop:0,style:[r.action,{backgroundColor:e.fill,borderColor:e.edge}],onPress:l,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:[r.actionLabel,{color:e.ink}],children:pe.poisonControlNative})})}function VetAction({tier:e,paint:r,petRef:petRef,onFindVet:n,vet:l,styles:i}){let o=useEverfurTheme(),a=useVetVisit(zh(petRef,l)),s=a.status==="opening",u=!a.available&&n!==void 0,c=a.available?()=>{a.open()}:n!==void 0?()=>{vr(n,e.level)}:null;if(c===null)return null;let d=r.action;if(d!==null){let e=u?pe.nearestEmergencyVet:pe.findVet,r=bo(o.slots.vetVisitButton)?.textColor??d.ink;/* @__PURE__ */
247
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:[s.label,{color:d.label}],children:e.label}),r!==null?/* @__PURE__ */t.jsx(Text,{style:[s.reason,{color:d.reason}],numberOfLines:u?Qh:void 0,accessibilityLabel:u?r:void 0,children:r}):null,b?/* @__PURE__ */t.jsx(Text,{style:[s.reason,s.erLine,{color:d.reason}],children:pe.goToNearestEmergencyVet}):null,f!==null||h!==null?/* @__PURE__ */t.jsxs(n.View,{style:s.actions,children:[f,h]}):null,l.dismissLabel!==null?/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:l.dismissLabel,hitSlop:Dh,containerStyle:s.closeSlot,style:s.closeButton,onPress:l.dismiss,children:/* @__PURE__ */t.jsx(CloseGlyph,{size:Vh,color:d.close,strokeWidth:1.5})}):null]})}function PoisonControl({paint:e,styles:r}){let l=()=>{try{n.Linking.openURL(ge).catch(()=>{})}catch{}};/* @__PURE__ */
248
+ return t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.poisonControlNative,hitSlop:0,style:[r.action,{backgroundColor:e.fill,borderColor:e.edge}],onPress:l,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:[r.actionLabel,{color:e.ink}],children:pe.poisonControlNative})})}function VetAction({tier:e,paint:r,petRef:petRef,onFindVet:n,vet:l,styles:i}){let o=useEverfurTheme(),a=useVetVisit(Ph(petRef,l)),s=a.status==="opening",u=!a.available&&n!==void 0,c=a.available?()=>{a.open()}:n!==void 0?()=>{vr(n,e.level)}:null;if(c===null)return null;let d=r.action;if(d!==null){let e=u?pe.nearestEmergencyVet:pe.findVet,r=xo(o.slots.vetVisitButton)?.textColor??d.ink;/* @__PURE__ */
249
249
  return t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:u?pe.nearestEmergencyVet:pe.findVetA11y,accessibilityState:{busy:s},hitSlop:0,style:[i.action,{backgroundColor:d.fill,borderColor:d.edge},i.findVetSlotBox,s?i.findVetBusy:null],onPress:c,children:[
250
- /* @__PURE__ */t.jsx(MapPinGlyph,{size:Bh,color:r,strokeWidth:1.5}),
251
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:[i.actionLabel,{color:r}],children:e})]})}let p=bo(o.slots.vetVisitButton)?.textColor??e.textColor;/* @__PURE__ */
250
+ /* @__PURE__ */t.jsx(MapPinGlyph,{size:Wh,color:r,strokeWidth:1.5}),
251
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:[i.actionLabel,{color:r}],children:e})]})}let p=xo(o.slots.vetVisitButton)?.textColor??e.textColor;/* @__PURE__ */
252
252
  return t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:pe.findVetA11y,accessibilityState:{busy:s},style:[i.findVetButton,{borderColor:e.borderColor,backgroundColor:e.pillColor},i.findVetSlotBox,s?i.findVetBusy:null],onPress:c,children:[
253
- /* @__PURE__ */t.jsx(MapPinGlyph,{size:Bh,color:p,strokeWidth:1.5}),
254
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:[i.findVetLabel,{color:p}],children:pe.findVet})]})}function Qh(e){let t=bo(e.slots.vetVisitButton),r=e.space,l=e.type;return n.StyleSheet.create({pinned:{marginTop:0,marginBottom:r.xs,paddingHorizontal:r.lg},card:{borderRadius:e.radius.lg,paddingHorizontal:r.lg+Mh,paddingVertical:r.lg,gap:r.sm},cardCompact:{paddingVertical:r.md,gap:r.xs},label:{...face(e,"bold"),fontSize:l.size.body,paddingRight:Ah},reason:{...face(e,"regular"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*Fh),paddingRight:Ah},erLine:{...face(e,"bold")},actions:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:r.sm},action:{flexDirection:"row",alignItems:"center",gap:Gh,minHeight:Nh,paddingHorizontal:Uh,borderRadius:e.radius.pill,borderWidth:$h},actionLabel:{...face(e,"bold"),fontSize:qh},findVetButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:e.radius.pill,borderWidth:1},findVetSlotBox:{...ho(t,1)},findVetBusy:{opacity:.6},findVetLabel:{...face(e,"monoBold"),fontSize:Hh,lineHeight:Wh},closeSlot:{position:"absolute",top:r.md,right:r.md},closeButton:{width:Ah,height:Ah,borderRadius:Ah/2,alignItems:"center",justifyContent:"center"},indicatorRow:{alignItems:"flex-end",paddingHorizontal:r.lg,paddingTop:2,paddingBottom:r.xs}})}function Zh(t,userRef,petRef,r){let[n,l]=e.useState({pet:petRef,user:userRef}),i=n.pet!==petRef||n.user===null&&userRef!==null;i&&l({pet:petRef,user:userRef});let o=i?{user:userRef}:n,a=petRef!==null&&o.user!==null&&o.user!==userRef;return e.useEffect(()=>{if(!a||userRef===null||petRef===null)return;let e=true,r=createPetsRepository(t.registry.services.authFor(userRef)),n=async()=>{let t=await r.list();e&&t.ok&&t.value.some(e=>e.petRef===petRef)&&l({pet:petRef,user:userRef})};n();let i=Sc(t,()=>{n()});return()=>{e=false,i()}},[a,t,userRef,petRef,r]),a}var Jh=/* @__PURE__ */Object.freeze({status:"idle",messages:/* @__PURE__ */Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:/* @__PURE__ */Object.freeze([]),unreadCount:null});function useEverfurChat(t){let{runtime:r,userRef:userRef,activePet:n,scopeEpoch:l}=we(),petRef=t?.petRef??n??null,conversationId=t?.conversationId??null,i=Zh(r,userRef,petRef,l),o=e.useMemo(()=>({runtime:r,userRef:userRef,petRef:petRef,conversationId:conversationId,scopeEpoch:l,held:i}),[r,userRef,petRef,conversationId,l,i]),[a,s]=e.useState(null),u=i?null:a?.scope===o?a.controller:r.registry.peekChat({userRef:userRef,petRef:petRef,conversationId:conversationId}),c=e.useRef(null);e.useEffect(()=>{if(i)return;let e=r.registry.acquireChat({userRef:userRef,petRef:petRef,conversationId:conversationId});return c.current=e,s({scope:o,controller:e}),()=>{c.current=null,s(t=>t?.controller===e?null:t),r.registry.releaseChat(e)}},[r,userRef,petRef,conversationId,l,i,o]);let d=e.useCallback(e=>u?u.subscribe(e):NOOP_UNSUBSCRIBE,[u]),p=e.useCallback(()=>u?u.getSnapshot():Jh,[u]),f=e.useSyncExternalStore(d,p,p),h=e.useCallback((e,t)=>u&&c.current===u&&!u.getSnapshot().isBootstrapping?eb(u,u.send(e,t?.imageS3Keys===void 0?{}:{imageS3Keys:t.imageS3Keys}),()=>c.current===u):Promise.resolve(rb()),[u]),b=e.useCallback(e=>u&&c.current===u&&!u.getSnapshot().isBootstrapping?eb(u,u.askEverfur(e),()=>c.current===u):Promise.resolve(rb()),[u]),g=e.useCallback(()=>u&&c.current===u?eb(u,u.retryLast(),()=>c.current===u):Promise.resolve(rb()),[u]),m=e.useCallback(()=>{u&&c.current===u&&u.stop()},[u]),y=e.useCallback(()=>{u&&c.current===u&&u.newConversation()},[u]),[v,x]=e.useState({controller:null,byMessage:{}}),w=v.controller===u?v.byMessage:Xh,k=e.useCallback(async(e,t,r,n)=>{if(!u||c.current!==u)return err(makeEverfurError("accessDenied"));let l=String(e),i=v.controller===u?v.byMessage[l]:void 0;if(i===t&&r==null)return x(e=>{let t={...e.controller===u?e.byMessage:{}};return delete t[l],{controller:u,byMessage:t}}),ok(/* @__PURE__ */Object.freeze({feedbackId:""}));x(e=>({controller:u,byMessage:{...e.controller===u?e.byMessage:{},[l]:t}}));let o=await u.submitFeedback(e,tp(t,r??null),n??null);return c.current!==u?err(makeEverfurError("accessDenied")):(o.ok||x(e=>{let t={...e.controller===u?e.byMessage:{}};return i===void 0?delete t[l]:t[l]=i,{controller:u,byMessage:t}}),o)},[u,v]),S=e.useMemo(()=>{let e=async e=>{if(!u||c.current!==u)return err(makeEverfurError("accessDenied"));let t=await e(u);return c.current===u?t:err(makeEverfurError("accessDenied"))};return{listConversations:t=>e(e=>e.listConversations({...petRef?{petRef:petRef}:{},...t})),getMessages:(t,r)=>e(e=>e.getMessages(t,r)),resumeConversation:t=>e(e=>e.resumeConversation(t)),loadOlderMessages:()=>e(e=>e.loadOlderMessages()),markRead:()=>e(e=>e.markRead()),refreshActiveThread:t=>e(e=>e.refreshActiveThread(t)),answerCheckin:(t,r)=>e(e=>e.answerCheckin(t,r)),openCheckin:t=>e(e=>e.openCheckin(t))}},[u,petRef]);return e.useMemo(()=>({status:f.status,messages:f.messages,conversationId:f.conversationId,petRef:petRef,error:f.error,isStreaming:f.isStreaming,isBootstrapping:f.isBootstrapping,historyCursor:f.historyCursor??null,isLoadingHistory:f.isLoadingHistory??false,stopped:f.stopped??false,reconnecting:f.reconnecting??false,...S,suggestedPrompts:f.suggestedPrompts,unreadCount:f.unreadCount,hasUnreadThreads:f.hasUnreadThreads??false,pendingCheckin:f.pendingCheckin??null,newConversation:y,sentimentByMessage:w,feedback:k,send:h,askEverfur:b,retryLast:g,stop:m}),[f,petRef,h,b,g,m,S,y,w,k])}var NOOP_UNSUBSCRIBE=()=>{},Xh=/* @__PURE__ */Object.freeze({});async function eb(e,t,r){for await(let e of t);if(!r())return err(makeEverfurError("accessDenied"));let n=e.getSnapshot();return n.status==="error"&&n.error!==null?err(n.error):ok(tb(n.messages))}function tb(e){for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r&&r.role==="assistant"&&r.responseId!==void 0)return r.responseId}return null}function rb(){return xl()}function nb(){let t=useEverfurPets(),{handle:r}=we(),n=e.useCallback(petRef=>r.setActivePet(petRef),[r]);return e.useMemo(()=>({...t,setActivePet:n}),[t,n])}function lb(){try{let e=n.AccessibilityInfo?.announceForAccessibility;typeof e=="function"&&e.call(n.AccessibilityInfo,pe.answered)}catch{}}function ib(t){let r=e.useRef(false),n=e.useRef({send:t.send,id:t.conversationId});e.useEffect(()=>{let e=n.current;if((e.send!==t.send||e.id!==null&&e.id!==t.conversationId)&&(r.current=false),n.current={send:t.send,id:t.conversationId},r.current&&!t.isStreaming){let e=t.messages[t.messages.length-1];e!==void 0&&e.role==="assistant"&&lb()}r.current=t.isStreaming},[t.isStreaming,t.messages,t.send,t.conversationId])}var ob=/* @__PURE__ */Object.freeze({kind:"live"}),ab=/* @__PURE__ */Object.freeze({kind:"folded"});function sb(e){if(e.role!=="assistant"||e.checkin===void 0)return null;let t=e.checkin.caseId,r=Bl(e.proactiveOriginRef);return{caseId:t,dueDay:r!==null&&r.caseId===t?r.dueDay:""}}function ub(e){let t=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;for(let t of e){let e=sb(t);if(e===null)continue;let n=r.get(e.caseId);(n===void 0||e.dueDay>=n.dueDay)&&r.set(e.caseId,{messageId:t.id,dueDay:e.dueDay})}if(r.size===0)return t;let n=null;for(let l of e){let e=sb(l);if(e===null){n=null;continue}if(r.get(e.caseId)?.messageId===l.id){t.set(l.id,ob),n=null;continue}if(n!==null&&n.caseId===e.caseId){n.days.push(e.dueDay),t.set(l.id,ab);continue}let i=[e.dueDay];n={id:l.id,caseId:e.caseId,days:i},t.set(l.id,{kind:"past",runDueDays:i})}return t}function cb(e){let t=/* @__PURE__ */new Set;for(let[r,n]of e)n.kind==="live"&&t.add(r);return t}var db=864e5,pb=365;function fb(e,t){if(typeof e!="string"||typeof t!="string")return null;let r=Date.parse(e),n=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(n))return null;let l=Math.floor(n/db)-Math.floor(r/db);return l<1||l>pb?null:l}function hb(e){return sb(e)?.dueDay||null}function bb(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function AssistantSender({avatarUrl:e,named:r,styles:l}){let i=rd(e);return i.shown?/* @__PURE__ */t.jsxs(n.View,{style:l.assistantSender,testID:"everfur-assistant-sender",children:[
255
- /* @__PURE__ */t.jsx(BrandImage,{uri:e,decorative:true,style:l.assistantAvatar,resizeMode:"cover",onError:i.onError,testID:"everfur-assistant-avatar"}),r?/* @__PURE__ */t.jsx(Text,{tier:"control",style:[l.assistantName,l.assistantNameInRow],children:pe.assistantName}):null]}):r?/* @__PURE__ */t.jsx(Text,{tier:"control",style:l.assistantName,children:pe.assistantName}):null}var gb=/* @__PURE__ */Object.freeze({TIER_1:"#07C168",TIER_2:"#27A9FF",TIER_3:"#FBC558"}),mb="#C8BEB4";function yb(e){return e?gb[e.toUpperCase()]??mb:mb}function vb(e){if(!e)return null;let t=/^tier[_\s-]?(\d+)$/i.exec(e.trim());return t?`Tier ${t[1]}`:e}function xb(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0?null:t}function wb(e){let t=xb(e);return t!==null&&/^https:\/\/\S+$/i.test(t)?t:null}function kb(e,t){let r=xb(e.source_name)??xb(e.sourceName),n=xb(e.section),l=xb(e.authority_tier)??xb(e.authorityTier),i=vb(l),o=r??xb(e.title)??`Source ${t+1}`,a=xb(e.monograph_chunk_id)??xb(e.chunkId),s=[n,i].filter(e=>e!==null).join(" · ");/* @__PURE__ */
256
- return Object.freeze({title:o,sourceName:r,section:n,authorityTier:l,tierLabel:i,meta:s.length===0?null:s,url:wb(e.url),excerpt:xb(e.excerpt),tierColor:yb(l),key:`${o}-${a??"none"}-${t}`})}function Sb(e){return e===void 0||e.length===0?Cb:/* @__PURE__ */Object.freeze(e.map((e,t)=>kb(e,t)))}var Cb=/* @__PURE__ */Object.freeze([]);function jb(e){return e===1?`1 ${pe.sourceSingular}`:`${e} ${pe.sourcePlural}`}function Rb(e,t){return`${t?pe.hideSources:pe.showSources} ${jb(e)}`}function Tb(e){return[e.url!==null?`${pe.openSource}: ${e.title}`:e.title,e.meta,e.excerpt].filter(e=>e!==null&&e.length>0).join(". ")}var _b="https:\\/\\/sdk(?:-[a-z]+)?\\.everfur\\.com";function zb(e){return e.replace(/[.*+?^${}()|[\]\\/]/g,"\\$&")}typeof __EVERFUR_BRAND_CDN_ORIGIN__=="string"&&__EVERFUR_BRAND_CDN_ORIGIN__.length>0?zb(__EVERFUR_BRAND_CDN_ORIGIN__):_b;function hardenHttpsUrl(e){if(e===null)return null;let t=e.trim();return t.length===0?null:/^https:\/\/\S+$/i.test(t)?t:null}function Ib(e){let t=e.split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0?t:[e]}var Pb=/^\s*[-*]\s+(\S.*)$/,Eb=/^\s*(\d{1,3})[.)]\s+(\S.*)$/;function Mb(e){let t=[],r=[],n=null,l=()=>{r.length>0&&t.push({kind:"text",text:r.join(`\n`)}),r=[]},i=()=>{n!==null&&t.push(n.ordered?{kind:"list",ordered:true,start:n.start,items:n.items}:{kind:"list",ordered:false,items:n.items}),n=null};for(let t of e.split(`\n`)){let e=Pb.exec(t),o=e===null?Eb.exec(t):null,a=e?.[1]??o?.[2];if(a===void 0){i(),r.push(t);continue}let s=o!==null;l(),n!==null&&n.ordered!==s&&i(),n===null&&(n={ordered:s,start:o===null?1:Number(o[1]),items:[]}),n.items.push(a.trim())}return l(),i(),t}function Fb(e,t){let r=e.findIndex(e=>e.id===t);for(let t=r-1;t>=0;t-=1){let r=e[t];if(r!==void 0&&r.role==="user")return r.text}return null}function Ab(e,t){if(e===void 0)return[];try{let r=e(t);return Array.isArray(r)?r:[]}catch{return[]}}function Lb(e){return hardenHttpsUrl(e.trim())}function Ob(e,t){if(t?.followUpActions===void 0||e.isStreaming||e.status==="error")return[];let r=e.messages[e.messages.length-1];return r===void 0||r.role!=="assistant"||r.pending===true?[]:Ab(t.followUpActions,{answer:r.text,question:Fb(e.messages,r.id),messageId:r.id})}var Vb=/\*\*([^*]+?)\*\*|\*([^*]+?)\*|`([^`]+?)`/g,Db=new RegExp(`\\[([^\\]\\n]{1,300})\\]\\((https:\\/\\/[^\\s()<>]{1,${wi}})\\)|(https:\\/\\/[^\\s<>"'\`*\\[\\]]{1,${wi}})`,"gi"),Bb=/https:\/\//i,Hb=`.,;:!?'"`;function Wb(e,t){return e.includes("*")||e.includes("`")||t!==void 0&&Bb.test(e)}function Nb(e,t){let r=[],n=e=>{t===void 0?r.push({kind:"text",text:e}):qb(r,e,t)},l=0;Vb.lastIndex=0;for(let t=Vb.exec(e);t!==null;t=Vb.exec(e)){t.index>l&&n(e.slice(l,t.index));let i=t[1],o=t[2],a=t[3];i!==void 0?r.push({kind:"bold",text:i}):o!==void 0?r.push({kind:"italic",text:o}):a!==void 0&&r.push({kind:"code",text:a}),l=t.index+t[0].length}return l<e.length&&n(e.slice(l)),r}function Ub(e){let t=e.length;for(;;){let r=e[t-1];if(r===void 0)break;if(Hb.includes(r))t-=1;else if(r===")"&&$b(e,"(",t)<$b(e,")",t))t-=1;else break}return e.slice(0,t)}function $b(e,t,r){let n=0;for(let l=0;l<r;l+=1)e[l]===t&&(n+=1);return n}function qb(e,t,r){if(!Bb.test(t)){e.push({kind:"text",text:t});return}let n=0;Db.lastIndex=0;for(let l=Db.exec(t);l!==null;l=Db.exec(t)){let i=l[1],o=l[2],a=l[3],s,u,c;if(i!==void 0&&o!==void 0)s=i.trim(),u=s.length>0?ji(o,r):null,c=l[0].length;else if(a!==void 0)s=Ub(a),u=ji(s,r),c=s.length;else continue;u!==null&&(l.index>n&&e.push({kind:"text",text:t.slice(n,l.index)}),e.push({kind:"link",text:s,href:u}),n=l.index+c,Db.lastIndex=n)}n<t.length&&e.push({kind:"text",text:t.slice(n)})}var Gb=/* @__PURE__ */Object.freeze({textDecorationLine:"underline"});function Kb(e,t){return t===void 0||!Wb(e,t.hosts)?false:Nb(e,t.hosts).some(e=>e.kind==="link")}function Yb(e,r,n){let l=n?.hosts;return Wb(e,l)?Nb(e,l).map((e,l)=>{switch(e.kind){case"bold":/* @__PURE__ */
253
+ /* @__PURE__ */t.jsx(MapPinGlyph,{size:Wh,color:p,strokeWidth:1.5}),
254
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:[i.findVetLabel,{color:p}],children:pe.findVet})]})}function Jh(e){let t=xo(e.slots.vetVisitButton),r=e.space,l=e.type;return n.StyleSheet.create({pinned:{marginTop:0,marginBottom:r.xs,paddingHorizontal:r.lg},card:{borderRadius:e.radius.lg,paddingHorizontal:r.lg+Ah,paddingVertical:r.lg,gap:r.sm},cardCompact:{paddingVertical:r.md,gap:r.xs},label:{...face(e,"bold"),fontSize:l.size.body,paddingRight:Oh},reason:{...face(e,"regular"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*Lh),paddingRight:Oh},erLine:{...face(e,"bold")},actions:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:r.sm},action:{flexDirection:"row",alignItems:"center",gap:Yh,minHeight:$h,paddingHorizontal:qh,borderRadius:e.radius.pill,borderWidth:Gh},actionLabel:{...face(e,"bold"),fontSize:Kh},findVetButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:e.radius.pill,borderWidth:1},findVetSlotBox:{...vo(t,1)},findVetBusy:{opacity:.6},findVetLabel:{...face(e,"monoBold"),fontSize:Nh,lineHeight:Uh},closeSlot:{position:"absolute",top:r.md,right:r.md},closeButton:{width:Oh,height:Oh,borderRadius:Oh/2,alignItems:"center",justifyContent:"center"},indicatorRow:{alignItems:"flex-end",paddingHorizontal:r.lg,paddingTop:2,paddingBottom:r.xs}})}function Xh(t,userRef,petRef,r){let[n,l]=e.useState({pet:petRef,user:userRef}),i=n.pet!==petRef||n.user===null&&userRef!==null;i&&l({pet:petRef,user:userRef});let o=i?{user:userRef}:n,a=petRef!==null&&o.user!==null&&o.user!==userRef;return e.useEffect(()=>{if(!a||userRef===null||petRef===null)return;let e=true,r=createPetsRepository(t.registry.services.authFor(userRef)),n=async()=>{let t=await r.list();e&&t.ok&&t.value.some(e=>e.petRef===petRef)&&l({pet:petRef,user:userRef})};n();let i=jc(t,()=>{n()});return()=>{e=false,i()}},[a,t,userRef,petRef,r]),a}var eb=/* @__PURE__ */Object.freeze({status:"idle",messages:/* @__PURE__ */Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:/* @__PURE__ */Object.freeze([]),unreadCount:null});function useEverfurChat(t){let{runtime:r,userRef:userRef,activePet:n,scopeEpoch:l}=we(),petRef=t?.petRef??n??null,conversationId=t?.conversationId??null,i=Xh(r,userRef,petRef,l),o=e.useMemo(()=>({runtime:r,userRef:userRef,petRef:petRef,conversationId:conversationId,scopeEpoch:l,held:i}),[r,userRef,petRef,conversationId,l,i]),[a,s]=e.useState(null),u=i?null:a?.scope===o?a.controller:r.registry.peekChat({userRef:userRef,petRef:petRef,conversationId:conversationId}),c=e.useRef(null);e.useEffect(()=>{if(i)return;let e=r.registry.acquireChat({userRef:userRef,petRef:petRef,conversationId:conversationId});return c.current=e,s({scope:o,controller:e}),()=>{c.current=null,s(t=>t?.controller===e?null:t),r.registry.releaseChat(e)}},[r,userRef,petRef,conversationId,l,i,o]);let d=e.useCallback(e=>u?u.subscribe(e):NOOP_UNSUBSCRIBE,[u]),p=e.useCallback(()=>u?u.getSnapshot():eb,[u]),f=e.useSyncExternalStore(d,p,p),h=e.useCallback((e,t)=>u&&c.current===u&&!u.getSnapshot().isBootstrapping?rb(u,u.send(e,t?.imageS3Keys===void 0?{}:{imageS3Keys:t.imageS3Keys}),()=>c.current===u):Promise.resolve(lb()),[u]),b=e.useCallback(e=>u&&c.current===u&&!u.getSnapshot().isBootstrapping?rb(u,u.askEverfur(e),()=>c.current===u):Promise.resolve(lb()),[u]),g=e.useCallback(()=>u&&c.current===u?rb(u,u.retryLast(),()=>c.current===u):Promise.resolve(lb()),[u]),m=e.useCallback(()=>{u&&c.current===u&&u.stop()},[u]),y=e.useCallback(()=>{u&&c.current===u&&u.newConversation()},[u]),[v,x]=e.useState({controller:null,byMessage:{}}),w=v.controller===u?v.byMessage:tb,k=e.useCallback(async(e,t,r,n)=>{if(!u||c.current!==u)return err(makeEverfurError("accessDenied"));let l=String(e),i=v.controller===u?v.byMessage[l]:void 0;if(i===t&&r==null)return x(e=>{let t={...e.controller===u?e.byMessage:{}};return delete t[l],{controller:u,byMessage:t}}),ok(/* @__PURE__ */Object.freeze({feedbackId:""}));x(e=>({controller:u,byMessage:{...e.controller===u?e.byMessage:{},[l]:t}}));let o=await u.submitFeedback(e,np(t,r??null),n??null);return c.current!==u?err(makeEverfurError("accessDenied")):(o.ok||x(e=>{let t={...e.controller===u?e.byMessage:{}};return i===void 0?delete t[l]:t[l]=i,{controller:u,byMessage:t}}),o)},[u,v]),S=e.useMemo(()=>{let e=async e=>{if(!u||c.current!==u)return err(makeEverfurError("accessDenied"));let t=await e(u);return c.current===u?t:err(makeEverfurError("accessDenied"))};return{listConversations:t=>e(e=>e.listConversations({...petRef?{petRef:petRef}:{},...t})),getMessages:(t,r)=>e(e=>e.getMessages(t,r)),resumeConversation:t=>e(e=>e.resumeConversation(t)),loadOlderMessages:()=>e(e=>e.loadOlderMessages()),markRead:()=>e(e=>e.markRead()),refreshActiveThread:t=>e(e=>e.refreshActiveThread(t)),answerCheckin:(t,r)=>e(e=>e.answerCheckin(t,r)),openCheckin:t=>e(e=>e.openCheckin(t))}},[u,petRef]);return e.useMemo(()=>({status:f.status,messages:f.messages,conversationId:f.conversationId,petRef:petRef,error:f.error,isStreaming:f.isStreaming,isBootstrapping:f.isBootstrapping,historyCursor:f.historyCursor??null,isLoadingHistory:f.isLoadingHistory??false,stopped:f.stopped??false,reconnecting:f.reconnecting??false,...S,suggestedPrompts:f.suggestedPrompts,unreadCount:f.unreadCount,hasUnreadThreads:f.hasUnreadThreads??false,pendingCheckin:f.pendingCheckin??null,newConversation:y,sentimentByMessage:w,feedback:k,send:h,askEverfur:b,retryLast:g,stop:m}),[f,petRef,h,b,g,m,S,y,w,k])}var NOOP_UNSUBSCRIBE=()=>{},tb=/* @__PURE__ */Object.freeze({});async function rb(e,t,r){for await(let e of t);if(!r())return err(makeEverfurError("accessDenied"));let n=e.getSnapshot();return n.status==="error"&&n.error!==null?err(n.error):ok(nb(n.messages))}function nb(e){for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r&&r.role==="assistant"&&r.responseId!==void 0)return r.responseId}return null}function lb(){return xl()}function ib(){let t=useEverfurPets(),{handle:r}=we(),n=e.useCallback(petRef=>r.setActivePet(petRef),[r]);return e.useMemo(()=>({...t,setActivePet:n}),[t,n])}function ob(){try{let e=n.AccessibilityInfo?.announceForAccessibility;typeof e=="function"&&e.call(n.AccessibilityInfo,pe.answered)}catch{}}function ab(t){let r=e.useRef(false),n=e.useRef({send:t.send,id:t.conversationId});e.useEffect(()=>{let e=n.current;if((e.send!==t.send||e.id!==null&&e.id!==t.conversationId)&&(r.current=false),n.current={send:t.send,id:t.conversationId},r.current&&!t.isStreaming){let e=t.messages[t.messages.length-1];e!==void 0&&e.role==="assistant"&&ob()}r.current=t.isStreaming},[t.isStreaming,t.messages,t.send,t.conversationId])}var sb=/* @__PURE__ */Object.freeze({kind:"live"}),ub=/* @__PURE__ */Object.freeze({kind:"folded"});function cb(e){if(e.role!=="assistant"||e.checkin===void 0)return null;let t=e.checkin.caseId,r=$l(e.proactiveOriginRef);return{caseId:t,dueDay:r!==null&&r.caseId===t?r.dueDay:""}}function db(e){let t=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;for(let t of e){let e=cb(t);if(e===null)continue;let n=r.get(e.caseId);(n===void 0||e.dueDay>=n.dueDay)&&r.set(e.caseId,{messageId:t.id,dueDay:e.dueDay})}if(r.size===0)return t;let n=null;for(let l of e){let e=cb(l);if(e===null){n=null;continue}if(r.get(e.caseId)?.messageId===l.id){t.set(l.id,sb),n=null;continue}if(n!==null&&n.caseId===e.caseId){n.days.push(e.dueDay),t.set(l.id,ub);continue}let i=[e.dueDay];n={id:l.id,caseId:e.caseId,days:i},t.set(l.id,{kind:"past",runDueDays:i})}return t}function pb(e){let t=/* @__PURE__ */new Set;for(let[r,n]of e)n.kind==="live"&&t.add(r);return t}var fb=864e5,hb=365;function bb(e,t){if(typeof e!="string"||typeof t!="string")return null;let r=Date.parse(e),n=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(n))return null;let l=Math.floor(n/fb)-Math.floor(r/fb);return l<1||l>hb?null:l}function gb(e){return cb(e)?.dueDay||null}function mb(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function AssistantSender({avatarUrl:e,named:r,styles:l}){let i=ld(e);return i.shown?/* @__PURE__ */t.jsxs(n.View,{style:l.assistantSender,testID:"everfur-assistant-sender",children:[
255
+ /* @__PURE__ */t.jsx(BrandImage,{uri:e,decorative:true,style:l.assistantAvatar,resizeMode:"cover",onError:i.onError,testID:"everfur-assistant-avatar"}),r?/* @__PURE__ */t.jsx(Text,{tier:"control",style:[l.assistantName,l.assistantNameInRow],children:pe.assistantName}):null]}):r?/* @__PURE__ */t.jsx(Text,{tier:"control",style:l.assistantName,children:pe.assistantName}):null}var yb=/* @__PURE__ */Object.freeze({TIER_1:"#07C168",TIER_2:"#27A9FF",TIER_3:"#FBC558"}),vb="#C8BEB4";function xb(e){return e?yb[e.toUpperCase()]??vb:vb}function wb(e){if(!e)return null;let t=/^tier[_\s-]?(\d+)$/i.exec(e.trim());return t?`Tier ${t[1]}`:e}function kb(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0?null:t}function Sb(e){let t=kb(e);return t!==null&&/^https:\/\/\S+$/i.test(t)?t:null}function Cb(e,t){let r=kb(e.source_name)??kb(e.sourceName),n=kb(e.section),l=kb(e.authority_tier)??kb(e.authorityTier),i=wb(l),o=r??kb(e.title)??`Source ${t+1}`,a=kb(e.monograph_chunk_id)??kb(e.chunkId),s=[n,i].filter(e=>e!==null).join(" · ");/* @__PURE__ */
256
+ return Object.freeze({title:o,sourceName:r,section:n,authorityTier:l,tierLabel:i,meta:s.length===0?null:s,url:Sb(e.url),excerpt:kb(e.excerpt),tierColor:xb(l),key:`${o}-${a??"none"}-${t}`})}function jb(e){return e===void 0||e.length===0?Rb:/* @__PURE__ */Object.freeze(e.map((e,t)=>Cb(e,t)))}var Rb=/* @__PURE__ */Object.freeze([]);function Tb(e){return e===1?`1 ${pe.sourceSingular}`:`${e} ${pe.sourcePlural}`}function _b(e,t){return`${t?pe.hideSources:pe.showSources} ${Tb(e)}`}function zb(e){return[e.url!==null?`${pe.openSource}: ${e.title}`:e.title,e.meta,e.excerpt].filter(e=>e!==null&&e.length>0).join(". ")}var Ib="https:\\/\\/sdk(?:-[a-z]+)?\\.everfur\\.com";function Pb(e){return e.replace(/[.*+?^${}()|[\]\\/]/g,"\\$&")}typeof __EVERFUR_BRAND_CDN_ORIGIN__=="string"&&__EVERFUR_BRAND_CDN_ORIGIN__.length>0?Pb(__EVERFUR_BRAND_CDN_ORIGIN__):Ib;function hardenHttpsUrl(e){if(e===null)return null;let t=e.trim();return t.length===0?null:/^https:\/\/\S+$/i.test(t)?t:null}function Eb(e){let t=e.split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0?t:[e]}var Mb=/^\s*[-*]\s+(\S.*)$/,Fb=/^\s*(\d{1,3})[.)]\s+(\S.*)$/;function Ab(e){let t=[],r=[],n=null,l=()=>{r.length>0&&t.push({kind:"text",text:r.join(`\n`)}),r=[]},i=()=>{n!==null&&t.push(n.ordered?{kind:"list",ordered:true,start:n.start,items:n.items}:{kind:"list",ordered:false,items:n.items}),n=null};for(let t of e.split(`\n`)){let e=Mb.exec(t),o=e===null?Fb.exec(t):null,a=e?.[1]??o?.[2];if(a===void 0){i(),r.push(t);continue}let s=o!==null;l(),n!==null&&n.ordered!==s&&i(),n===null&&(n={ordered:s,start:o===null?1:Number(o[1]),items:[]}),n.items.push(a.trim())}return l(),i(),t}function Lb(e,t){let r=e.findIndex(e=>e.id===t);for(let t=r-1;t>=0;t-=1){let r=e[t];if(r!==void 0&&r.role==="user")return r.text}return null}function Ob(e,t){if(e===void 0)return[];try{let r=e(t);return Array.isArray(r)?r:[]}catch{return[]}}function Vb(e){return hardenHttpsUrl(e.trim())}function Db(e,t){if(t?.followUpActions===void 0||e.isStreaming||e.status==="error")return[];let r=e.messages[e.messages.length-1];return r===void 0||r.role!=="assistant"||r.pending===true?[]:Ob(t.followUpActions,{answer:r.text,question:Lb(e.messages,r.id),messageId:r.id})}var Bb=/\*\*([^*]+?)\*\*|\*([^*]+?)\*|`([^`]+?)`/g,Hb=new RegExp(`\\[([^\\]\\n]{1,300})\\]\\((https:\\/\\/[^\\s()<>]{1,${Ri}})\\)|(https:\\/\\/[^\\s<>"'\`*\\[\\]]{1,${Ri}})`,"gi"),Wb=/https:\/\//i,Nb=`.,;:!?'"`;function Ub(e,t){return e.includes("*")||e.includes("`")||t!==void 0&&Wb.test(e)}function $b(e,t){let r=[],n=e=>{t===void 0?r.push({kind:"text",text:e}):Kb(r,e,t)},l=0;Bb.lastIndex=0;for(let t=Bb.exec(e);t!==null;t=Bb.exec(e)){t.index>l&&n(e.slice(l,t.index));let i=t[1],o=t[2],a=t[3];i!==void 0?r.push({kind:"bold",text:i}):o!==void 0?r.push({kind:"italic",text:o}):a!==void 0&&r.push({kind:"code",text:a}),l=t.index+t[0].length}return l<e.length&&n(e.slice(l)),r}function qb(e){let t=e.length;for(;;){let r=e[t-1];if(r===void 0)break;if(Nb.includes(r))t-=1;else if(r===")"&&Gb(e,"(",t)<Gb(e,")",t))t-=1;else break}return e.slice(0,t)}function Gb(e,t,r){let n=0;for(let l=0;l<r;l+=1)e[l]===t&&(n+=1);return n}function Kb(e,t,r){if(!Wb.test(t)){e.push({kind:"text",text:t});return}let n=0;Hb.lastIndex=0;for(let l=Hb.exec(t);l!==null;l=Hb.exec(t)){let i=l[1],o=l[2],a=l[3],s,u,c;if(i!==void 0&&o!==void 0)s=i.trim(),u=s.length>0?Ii(o,r):null,c=l[0].length;else if(a!==void 0)s=qb(a),u=Ii(s,r),c=s.length;else continue;u!==null&&(l.index>n&&e.push({kind:"text",text:t.slice(n,l.index)}),e.push({kind:"link",text:s,href:u}),n=l.index+c,Hb.lastIndex=n)}n<t.length&&e.push({kind:"text",text:t.slice(n)})}var Yb=/* @__PURE__ */Object.freeze({textDecorationLine:"underline"});function Qb(e,t){return t===void 0||!Ub(e,t.hosts)?false:$b(e,t.hosts).some(e=>e.kind==="link")}function Zb(e,r,n){let l=n?.hosts;return Ub(e,l)?$b(e,l).map((e,l)=>{switch(e.kind){case"bold":/* @__PURE__ */
257
257
  return t.jsx(Text,{style:r.bold,children:e.text},l);case"italic":return r.italic?/* @__PURE__ */t.jsx(Text,{style:r.italic,children:e.text},l):e.text;case"code":return r.code?/* @__PURE__ */t.jsx(Text,{style:r.code,children:e.text},l):e.text;case"link":{if(n===void 0)return e.text;let{href:r}=e;/* @__PURE__ */
258
- return t.jsx(Text,{style:Gb,accessibilityRole:"link",accessibilityLabel:e.text,onPress:()=>n.open(r),children:e.text},l)}default:return e.text}}):e}var Qb=10.5,Zb=16,Jb=12,Xb=38,eg=11,tg=15,rg=22,ng=32,lg=13.5,ig=14,og=15,ag=16,sg=13,ug=13,cg=26,dg=21,pg=42,fg=1,hg=.06,bg=.07,gg=.12,mg="45%";function yg(){let t=useEverfurTheme(),r=e.useMemo(()=>vg(t),[t]);return{theme:t,styles:r}}function Chevron({options:e,color:r}){let n=/* @__PURE__ */t.jsx(ChevronGlyph,{size:ag,color:r,strokeWidth:2,direction:"right"}),l=e?.renderIcon;return l===void 0?n:/* @__PURE__ */t.jsx(HostRender,{render:()=>l("chevron"),fallback:n})}function AnswerCard({card:e,options:r}){let{theme:l,styles:i}=yg();if(e.render!==void 0){let l=e.render;/* @__PURE__ */
259
- return t.jsx(n.View,{style:[i.card,e.variant!==void 0?r?.styles?.cardVariant?.[e.variant]:null],accessible:false,accessibilityLabel:e.title,testID:"everfur-answer-host-card",children:/* @__PURE__ */t.jsx(HostRender,{render:l,fallback:null})})}let o=e.value!==void 0,a=r?.styles,s=[i.card,o?a?.cardStat:null,e.variant!==void 0?a?.cardVariant?.[e.variant]:null],u=e.tile?.tone,c=e.pill?.tone,d=e.tile?.imageUrl!==void 0?Lb(e.tile.imageUrl):null,p=/* @__PURE__ */t.jsxs(t.Fragment,{children:[o?null:/* @__PURE__ */t.jsx(n.View,{style:[i.tile,u!==void 0?a?.tileTone?.[u]:null],children:d!==null?/* @__PURE__ */t.jsx(n.Image,{source:{uri:d},style:i.tileImage,accessibilityIgnoresInvertColors:true}):e.tile?.icon??null}),
258
+ return t.jsx(Text,{style:Yb,accessibilityRole:"link",accessibilityLabel:e.text,onPress:()=>n.open(r),children:e.text},l)}default:return e.text}}):e}var Jb=10.5,Xb=16,eg=12,tg=38,rg=11,ng=15,lg=22,ig=32,og=13.5,ag=14,sg=15,ug=16,cg=13,dg=13,pg=26,fg=21,hg=42,bg=1,gg=.06,mg=.07,yg=.12,vg="45%";function xg(){let t=useEverfurTheme(),r=e.useMemo(()=>wg(t),[t]);return{theme:t,styles:r}}function Chevron({options:e,color:r}){let n=/* @__PURE__ */t.jsx(ChevronGlyph,{size:ug,color:r,strokeWidth:2,direction:"right"}),l=e?.renderIcon;return l===void 0?n:/* @__PURE__ */t.jsx(HostRender,{render:()=>l("chevron"),fallback:n})}function AnswerCard({card:e,options:r}){let{theme:l,styles:i}=xg();if(e.render!==void 0){let l=e.render;/* @__PURE__ */
259
+ return t.jsx(n.View,{style:[i.card,e.variant!==void 0?r?.styles?.cardVariant?.[e.variant]:null],accessible:false,accessibilityLabel:e.title,testID:"everfur-answer-host-card",children:/* @__PURE__ */t.jsx(HostRender,{render:l,fallback:null})})}let o=e.value!==void 0,a=r?.styles,s=[i.card,o?a?.cardStat:null,e.variant!==void 0?a?.cardVariant?.[e.variant]:null],u=e.tile?.tone,c=e.pill?.tone,d=e.tile?.imageUrl!==void 0?Vb(e.tile.imageUrl):null,p=/* @__PURE__ */t.jsxs(t.Fragment,{children:[o?null:/* @__PURE__ */t.jsx(n.View,{style:[i.tile,u!==void 0?a?.tileTone?.[u]:null],children:d!==null?/* @__PURE__ */t.jsx(n.Image,{source:{uri:d},style:i.tileImage,accessibilityIgnoresInvertColors:true}):e.tile?.icon??null}),
260
260
  /* @__PURE__ */t.jsxs(n.View,{style:i.cardWords,children:[
261
261
  /* @__PURE__ */t.jsx(Text,{tier:"control",style:i.cardTitle,children:e.title}),e.meta!==void 0?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:i.cardMeta,children:e.meta}):null]}),o?/* @__PURE__ */t.jsxs(Text,{tier:"control",style:i.stat,children:[e.value?.amount,e.value?.unit!==void 0?/* @__PURE__ */t.jsx(Text,{style:i.statUnit,children:e.value.unit}):null]}):/* @__PURE__ */t.jsxs(t.Fragment,{children:[e.pill!==void 0?/* @__PURE__ */t.jsx(n.View,{style:[i.pill,c!==void 0?a?.pillTone?.[c]:null],children:/* @__PURE__ */t.jsx(Text,{tier:"badge",style:[i.pillText,c!==void 0?a?.pillToneText?.[c]:null],numberOfLines:1,ellipsizeMode:"tail",children:e.pill.label})}):null,e.onPress!==void 0?/* @__PURE__ */t.jsx(Chevron,{options:r,color:l.color.text.muted}):null]})]});if(e.onPress!==void 0){let r=e.onPress;/* @__PURE__ */
262
262
  return t.jsx(n.Pressable,{onPress:()=>{vr(r)},accessibilityRole:"button",accessibilityLabel:e.title,style:s,children:p})}/* @__PURE__ */
263
- return t.jsx(n.View,{style:s,children:p})}function CardsAnswer({message:r,text:l,streaming:i,messages:o,options:a,sentiment:s,onSentiment:u,sender:c,footer:d,onOpenUrl:p}){let{styles:f}=yg(),h=e.useMemo(()=>({answer:r.text,question:Fb(o,r.id),messageId:r.id}),[r.text,r.id,o]),b=!i&&r.pending!==true,g=b?Ab(a?.cards,h):[],m=e.useMemo(()=>b?Sb(r.citations):[],[b,r.citations]),y=a?.byline,v=a?.feedback!==void 0&&r.responseId!==void 0&&u!==void 0?a.feedback:null,x={bold:f.bold,italic:f.italic,code:f.code},w=_i(),k=b?w:void 0;/* @__PURE__ */
263
+ return t.jsx(n.View,{style:s,children:p})}function CardsAnswer({message:r,text:l,streaming:i,messages:o,options:a,sentiment:s,onSentiment:u,sender:c,footer:d,onOpenUrl:p}){let{styles:f}=xg(),h=e.useMemo(()=>({answer:r.text,question:Lb(o,r.id),messageId:r.id}),[r.text,r.id,o]),b=!i&&r.pending!==true,g=b?Ob(a?.cards,h):[],m=e.useMemo(()=>b?jb(r.citations):[],[b,r.citations]),y=a?.byline,v=a?.feedback!==void 0&&r.responseId!==void 0&&u!==void 0?a.feedback:null,x={bold:f.bold,italic:f.italic,code:f.code},w=Mi(),k=b?w:void 0;/* @__PURE__ */
264
264
  return t.jsxs(n.View,{style:f.answer,testID:"everfur-answer-cards",children:[y!==void 0?/* @__PURE__ */t.jsxs(n.View,{style:f.byline,children:[y.icon??null,
265
265
  /* @__PURE__ */t.jsx(Text,{tier:"compact",style:f.bylineText,children:y.label})]}):c,
266
- /* @__PURE__ */t.jsx(n.View,{style:f.body,children:Ib(l).flatMap((e,r)=>Mb(e).map((e,l)=>{let i=`${r}-${l}`;return e.kind==="text"?/* @__PURE__ */t.jsx(Text,{style:f.paragraph,children:Yb(e.text,x,k)},i):/* @__PURE__ */t.jsx(n.View,{style:f.list,children:e.items.map((r,l)=>/* @__PURE__ */t.jsxs(n.View,{style:f.listItem,children:[
266
+ /* @__PURE__ */t.jsx(n.View,{style:f.body,children:Eb(l).flatMap((e,r)=>Ab(e).map((e,l)=>{let i=`${r}-${l}`;return e.kind==="text"?/* @__PURE__ */t.jsx(Text,{style:f.paragraph,children:Zb(e.text,x,k)},i):/* @__PURE__ */t.jsx(n.View,{style:f.list,children:e.items.map((r,l)=>/* @__PURE__ */t.jsxs(n.View,{style:f.listItem,children:[
267
267
  /* @__PURE__ */t.jsx(Text,{style:f.paragraph,children:e.ordered?`${e.start+l}.`:"•"}),
268
- /* @__PURE__ */t.jsx(Text,{style:[f.paragraph,f.listText],children:Yb(r,x,k)})]},l))},i)}))}),g.length>0?/* @__PURE__ */t.jsx(n.View,{style:f.cards,children:g.map(e=>/* @__PURE__ */t.jsx(AnswerCard,{card:e,options:a},e.key))}):null,m.length>0?/* @__PURE__ */t.jsxs(n.View,{style:f.cards,accessibilityLabel:jb(m.length),children:[
268
+ /* @__PURE__ */t.jsx(Text,{style:[f.paragraph,f.listText],children:Zb(r,x,k)})]},l))},i)}))}),g.length>0?/* @__PURE__ */t.jsx(n.View,{style:f.cards,children:g.map(e=>/* @__PURE__ */t.jsx(AnswerCard,{card:e,options:a},e.key))}):null,m.length>0?/* @__PURE__ */t.jsxs(n.View,{style:f.cards,accessibilityLabel:Tb(m.length),children:[
269
269
  /* @__PURE__ */t.jsx(Text,{tier:"compact",style:f.label,children:pe.sourcesHeading}),m.map(e=>{let r=e.url;/* @__PURE__ */
270
270
  return t.jsx(AnswerCard,{card:{key:e.key,title:e.title,...e.meta!==null?{meta:e.meta}:{},tile:{icon:/* @__PURE__ */t.jsx(SourceTileGlyph,{})},...p!==void 0&&r!==null?{onPress:()=>p(r)}:{}},options:a},e.key)})]}):null,b&&v!==null&&u!==void 0?/* @__PURE__ */t.jsxs(n.View,{style:[f.feedback,a?.styles?.feedback],children:[
271
271
  /* @__PURE__ */t.jsx(FeedbackChip,{label:v.helpful,on:s==="up",onPress:()=>u("up"),styles:f,host:a?.styles}),
272
272
  /* @__PURE__ */t.jsx(FeedbackChip,{label:v.notHelpful,on:s==="down",onPress:()=>u("down"),styles:f,host:a?.styles})]}):null,b?d(v===null):null]})}function SourceTileGlyph(){let e=useEverfurTheme();/* @__PURE__ */
273
- return t.jsx(BookGlyph,{size:dg,color:e.color.linkInk,strokeWidth:1.5})}function FeedbackChip({label:e,on:r,onPress:l,styles:i,host:o}){/* @__PURE__ */
274
- return t.jsx(n.Pressable,{onPress:l,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{selected:r},style:[i.chip,o?.feedbackChip,r?i.chipOn:null],hitSlop:(os-ng)/2,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:[i.chipText,o?.feedbackChipText],children:e})})}function CardsFollowUps({prompts:e,onSelectPrompt:r,label:l,actions:i,options:o}){let{theme:a,styles:s}=yg();if(e.length===0&&i.length===0)return null;let u=o?.styles,c=l??pe.followUpsHeadingNative;/* @__PURE__ */
273
+ return t.jsx(BookGlyph,{size:fg,color:e.color.linkInk,strokeWidth:1.5})}function FeedbackChip({label:e,on:r,onPress:l,styles:i,host:o}){/* @__PURE__ */
274
+ return t.jsx(n.Pressable,{onPress:l,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{selected:r},style:[i.chip,o?.feedbackChip,r?i.chipOn:null],hitSlop:(ds-ig)/2,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:[i.chipText,o?.feedbackChipText],children:e})})}function CardsFollowUps({prompts:e,onSelectPrompt:r,label:l,actions:i,options:o}){let{theme:a,styles:s}=xg();if(e.length===0&&i.length===0)return null;let u=o?.styles,c=l??pe.followUpsHeadingNative;/* @__PURE__ */
275
275
  return t.jsxs(n.View,{style:[s.followUps,u?.followUps],accessibilityLabel:c,testID:"everfur-cards-follow-ups",children:[
276
- /* @__PURE__ */t.jsx(Text,{tier:"compact",style:[s.label,u?.followUpsLabel],accessibilityRole:"header",children:c}),i.map(e=>/* @__PURE__ */t.jsxs(n.Pressable,{onPress:()=>{vr(e.onPress)},accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:fg,style:[s.row,s.rowAction,u?.followUp,u?.followUpAction],children:[e.icon??null,
276
+ /* @__PURE__ */t.jsx(Text,{tier:"compact",style:[s.label,u?.followUpsLabel],accessibilityRole:"header",children:c}),i.map(e=>/* @__PURE__ */t.jsxs(n.Pressable,{onPress:()=>{vr(e.onPress)},accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:bg,style:[s.row,s.rowAction,u?.followUp,u?.followUpAction],children:[e.icon??null,
277
277
  /* @__PURE__ */t.jsx(Text,{tier:"control",style:[s.rowText,s.rowTextAction,u?.followUpText,u?.followUpActionText],children:e.label}),
278
- /* @__PURE__ */t.jsx(Chevron,{options:o,color:a.color.text.primary})]},`action:${e.key}`)),e.map(e=>/* @__PURE__ */t.jsxs(n.Pressable,{onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:e,hitSlop:fg,style:[s.row,u?.followUp],children:[
278
+ /* @__PURE__ */t.jsx(Chevron,{options:o,color:a.color.text.primary})]},`action:${e.key}`)),e.map(e=>/* @__PURE__ */t.jsxs(n.Pressable,{onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:e,hitSlop:bg,style:[s.row,u?.followUp],children:[
279
279
  /* @__PURE__ */t.jsx(Text,{tier:"control",style:[s.rowText,u?.followUpText],children:e}),
280
- /* @__PURE__ */t.jsx(Chevron,{options:o,color:a.color.linkInk})]},e))]})}function CardsByline({label:e}){let{styles:r}=yg();/* @__PURE__ */
281
- return t.jsx(n.View,{style:r.byline,children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:r.bylineText,children:e})})}function vg(e){let t=e.color,r=e.space,l={...face(e,"mono"),fontSize:Qb,textTransform:"uppercase",color:t.text.muted},i={borderWidth:1,borderColor:t.borderRingCream},o={borderWidth:1,borderColor:Ta(t.text.primary,hg)??t.borderRingCream},a={shadowColor:t.text.primary,shadowOffset:{width:0,height:1},shadowOpacity:bg,shadowRadius:2,elevation:1},s=textRole(e,"message"),chipInk=go(e.slots.chip);return n.StyleSheet.create({answer:{gap:r.md,alignSelf:"stretch"},byline:{flexDirection:"row",alignItems:"center",gap:10,minHeight:14},bylineText:{...l,letterSpacing:Qb*.06,flexShrink:1},body:{gap:10},paragraph:{...face(e,"regular"),fontSize:s.fontSize,lineHeight:Math.round(s.lineHeight),color:t.text.primary},list:{gap:4},listItem:{flexDirection:"row",gap:r.sm,paddingLeft:r.xs},listText:{flex:1},bold:face(e,"bold"),italic:{fontStyle:"italic"},code:face(e,"mono"),cards:{gap:r.sm},card:{flexDirection:"row",alignItems:"center",gap:r.md,padding:Jb,borderRadius:Zb,backgroundColor:t.surface,...o,...a,minHeight:os,...ho(e.slots.card)},tile:{width:Xb,height:Xb,borderRadius:eg,backgroundColor:Ta(t.linkInk,gg)??t.surfaceSubtle,alignItems:"center",justifyContent:"center",overflow:"hidden"},tileImage:{width:Xb,height:Xb},cardWords:{flex:1,minWidth:0},cardTitle:{...face(e,"bold"),fontSize:tg,lineHeight:Math.round(tg*1.25),color:t.text.primary,...go(e.slots.card)},cardMeta:{...l,letterSpacing:Qb*.04,marginTop:3},stat:{...face(e,"mono"),fontSize:rg,color:t.text.primary},statUnit:{...face(e,"mono"),fontSize:Qb+2,color:t.text.muted},pill:{minHeight:cg,paddingHorizontal:10,borderRadius:e.radius.pill,backgroundColor:t.surfaceSubtle,justifyContent:"center",flexShrink:1,maxWidth:mg},pillText:{...face(e,"bold"),fontSize:ug,color:t.text.primary},feedback:{flexDirection:"row",flexWrap:"wrap",gap:r.sm,alignItems:"center"},chip:{minHeight:ng,paddingHorizontal:12,borderRadius:e.radius.pill,...i,justifyContent:"center"},chipOn:{backgroundColor:t.surfaceSubtle},chipText:{...gf(e),fontSize:lg,color:t.text.primary,...chipInk},followUps:{gap:r.sm,alignSelf:"stretch",marginTop:r.xs},label:{...face(e,"bold"),fontSize:sg,lineHeight:Math.round(sg*1.5),color:t.text.muted,marginTop:2},row:{flexDirection:"row",alignItems:"center",gap:10,minHeight:pg,paddingTop:11,paddingBottom:11,paddingRight:12,paddingLeft:14,borderRadius:ig,backgroundColor:t.surface,...o},rowAction:{},rowText:{...gf(e),flex:1,fontSize:og,lineHeight:Math.round(og*1.3),color:t.linkInk},rowTextAction:{color:t.text.primary}})}var xg=/* @__PURE__ */Object.freeze({eyebrow:"Checking in",logged:"Logged",findVet:"Find a vet now",day:"Day {day}",daySeparator:" · ",answers:/* @__PURE__ */Object.freeze({better:"Better",same:"Same",worse:"Worse"})}),wg=/* @__PURE__ */Object.freeze(Al.map(e=>/* @__PURE__ */Object.freeze({answer:e,label:xg.answers[e]})));function kg(t,r){let[n,l]=e.useState(null),[i,o]=e.useState(null),[a,s]=e.useState(null),u=e.useCallback(e=>{r!==null&&(l(e),o(null),r(t.caseId,e).then(t=>{l(null),t.ok?s(e):o(t.error)}))},[r,t.caseId]),c=a??t.answer;return{answer:c,answerable:!isCheckinSettled(t),escalated:c==="worse",pending:n,error:i,choose:u}}var Sg=44,Cg=.6,jg=/* @__PURE__ */Object.freeze({caseId:"",answer:null,resolutionText:null,status:null});function CheckinCard({message:r,checkin:l,onAnswer:i,petRef:petRef,onFindVet:o,vet:a,onLayout:s,onOpen:u}){let c=useEverfurTheme(),d=e.useMemo(()=>Rg(c),[c]),p=kg(l??jg,l===null?null:i),f=p.answer!==null||p.pending!==null,h=l!==null&&i!==null&&p.answerable,b=l===null?null:fb(l.openedAt,hb(r));/* @__PURE__ */
282
- return t.jsxs(n.View,{style:d.card,accessibilityLabel:xg.eyebrow,onLayout:s,children:[
280
+ /* @__PURE__ */t.jsx(Chevron,{options:o,color:a.color.linkInk})]},e))]})}function CardsByline({label:e}){let{styles:r}=xg();/* @__PURE__ */
281
+ return t.jsx(n.View,{style:r.byline,children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:r.bylineText,children:e})})}function wg(e){let t=e.color,r=e.space,l={...face(e,"mono"),fontSize:Jb,textTransform:"uppercase",color:t.text.muted},i={borderWidth:1,borderColor:t.borderRingCream},o={borderWidth:1,borderColor:Ea(t.text.primary,gg)??t.borderRingCream},a={shadowColor:t.text.primary,shadowOffset:{width:0,height:1},shadowOpacity:mg,shadowRadius:2,elevation:1},s=textRole(e,"message"),chipInk=wo(e.slots.chip);return n.StyleSheet.create({answer:{gap:r.md,alignSelf:"stretch"},byline:{flexDirection:"row",alignItems:"center",gap:10,minHeight:14},bylineText:{...l,letterSpacing:Jb*.06,flexShrink:1},body:{gap:10},paragraph:{...face(e,"regular"),fontSize:s.fontSize,lineHeight:Math.round(s.lineHeight),color:t.text.primary},list:{gap:4},listItem:{flexDirection:"row",gap:r.sm,paddingLeft:r.xs},listText:{flex:1},bold:face(e,"bold"),italic:{fontStyle:"italic"},code:face(e,"mono"),cards:{gap:r.sm},card:{flexDirection:"row",alignItems:"center",gap:r.md,padding:eg,borderRadius:Xb,backgroundColor:t.surface,...o,...a,minHeight:ds,...vo(e.slots.card)},tile:{width:tg,height:tg,borderRadius:rg,backgroundColor:Ea(t.linkInk,yg)??t.surfaceSubtle,alignItems:"center",justifyContent:"center",overflow:"hidden"},tileImage:{width:tg,height:tg},cardWords:{flex:1,minWidth:0},cardTitle:{...face(e,"bold"),fontSize:ng,lineHeight:Math.round(ng*1.25),color:t.text.primary,...wo(e.slots.card)},cardMeta:{...l,letterSpacing:Jb*.04,marginTop:3},stat:{...face(e,"mono"),fontSize:lg,color:t.text.primary},statUnit:{...face(e,"mono"),fontSize:Jb+2,color:t.text.muted},pill:{minHeight:pg,paddingHorizontal:10,borderRadius:e.radius.pill,backgroundColor:t.surfaceSubtle,justifyContent:"center",flexShrink:1,maxWidth:vg},pillText:{...face(e,"bold"),fontSize:dg,color:t.text.primary},feedback:{flexDirection:"row",flexWrap:"wrap",gap:r.sm,alignItems:"center"},chip:{minHeight:ig,paddingHorizontal:12,borderRadius:e.radius.pill,...i,justifyContent:"center"},chipOn:{backgroundColor:t.surfaceSubtle},chipText:{...yf(e),fontSize:og,color:t.text.primary,...chipInk},followUps:{gap:r.sm,alignSelf:"stretch",marginTop:r.xs},label:{...face(e,"bold"),fontSize:cg,lineHeight:Math.round(cg*1.5),color:t.text.muted,marginTop:2},row:{flexDirection:"row",alignItems:"center",gap:10,minHeight:hg,paddingTop:11,paddingBottom:11,paddingRight:12,paddingLeft:14,borderRadius:ag,backgroundColor:t.surface,...o},rowAction:{},rowText:{...yf(e),flex:1,fontSize:sg,lineHeight:Math.round(sg*1.3),color:t.linkInk},rowTextAction:{color:t.text.primary}})}var kg=/* @__PURE__ */Object.freeze({eyebrow:"Checking in",logged:"Logged",findVet:"Find a vet now",day:"Day {day}",daySeparator:" · ",answers:/* @__PURE__ */Object.freeze({better:"Better",same:"Same",worse:"Worse"})}),Sg=/* @__PURE__ */Object.freeze(Bl.map(e=>/* @__PURE__ */Object.freeze({answer:e,label:kg.answers[e]})));function Cg(t,r){let[n,l]=e.useState(null),[i,o]=e.useState(null),[a,s]=e.useState(null),u=e.useCallback(e=>{r!==null&&(l(e),o(null),r(t.caseId,e).then(t=>{l(null),t.ok?s(e):o(t.error)}))},[r,t.caseId]),c=a??t.answer;return{answer:c,answerable:!isCheckinSettled(t),escalated:c==="worse",pending:n,error:i,choose:u}}var jg=44,Rg=.6,Tg=/* @__PURE__ */Object.freeze({caseId:"",answer:null,resolutionText:null,status:null});function CheckinCard({message:r,checkin:l,onAnswer:i,petRef:petRef,onFindVet:o,vet:a,onLayout:s,onOpen:u}){let c=useEverfurTheme(),d=e.useMemo(()=>_g(c),[c]),p=Cg(l??Tg,l===null?null:i),f=p.answer!==null||p.pending!==null,h=l!==null&&i!==null&&p.answerable,b=l===null?null:bb(l.openedAt,gb(r));/* @__PURE__ */
282
+ return t.jsxs(n.View,{style:d.card,accessibilityLabel:kg.eyebrow,onLayout:s,children:[
283
283
  /* @__PURE__ */t.jsxs(n.View,{style:d.head,children:[
284
- /* @__PURE__ */t.jsx(Text,{tier:"compact",style:d.eyebrow,children:xg.eyebrow}),b!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:d.headDay,children:fe(xg.day,{day:b})}):null]}),u?/* @__PURE__ */t.jsx(n.Pressable,{onPress:u,accessibilityRole:"button",accessibilityLabel:r.text,style:d.open,children:/* @__PURE__ */t.jsx(Text,{style:[d.question,d.openText],children:r.text})}):/* @__PURE__ */t.jsx(Text,{style:d.question,accessibilityRole:"text",children:r.text}),h?/* @__PURE__ */t.jsx(n.View,{style:[d.row,p.pending?d.rowPending:null],children:wg.map(({answer:e,label:r})=>{let l=(p.pending??p.answer)===e;/* @__PURE__ */
285
- return t.jsx(n.Pressable,{onPress:()=>p.choose(e),disabled:f,accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:l,disabled:f,busy:p.pending===e},style:[d.pill,l?d.pillSelected:null],children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:[d.pillLabel,l?d.pillLabelSelected:null],children:r})},e)})}):null,p.answer!==null?/* @__PURE__ */t.jsx(Text,{style:d.logged,children:xg.logged}):null,p.escalated?/* @__PURE__ */t.jsx(CheckinFindVet,{petRef:petRef??null,onFindVet:o,vet:a,styles:d}):null,l?.resolutionText?/* @__PURE__ */t.jsx(Text,{style:d.resolution,children:l.resolutionText}):null,p.error?/* @__PURE__ */t.jsx(Text,{style:d.error,accessibilityRole:"alert",children:p.error.displayMessage}):null]})}function CheckinFindVet({petRef:petRef,onFindVet:e,vet:r,styles:l}){return useVetVisit(zh(petRef,r)).available&&petRef!==null?/* @__PURE__ */t.jsx(VetVisitButtonCore,{entry:"chat",petRef:petRef,label:xg.findVet,...r?.returnTo!==void 0?{returnTo:r.returnTo}:{},...r?.usState!==void 0?{usState:r.usState}:{},...r?.prefer!==void 0?{prefer:r.prefer}:{},style:l.findVet,labelStyle:l.findVetLabel}):e===void 0?null:/* @__PURE__ */t.jsx(n.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:xg.findVet,style:l.findVet,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:l.findVetLabel,children:xg.findVet})})}function Rg(e){let t=e.color,r=e.space,l=e.radius,i=e.type,o=bo(e.slots.card),a=go(o);return n.StyleSheet.create({card:{maxWidth:"92%",padding:r.md,gap:r.sm,borderRadius:l.lg,backgroundColor:t.brandSoft,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.brandBorder,...ho(o,n.StyleSheet.hairlineWidth)},head:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},eyebrow:{...face(e,"regular"),color:t.text.secondary,fontSize:i.size.caption,letterSpacing:i.letterSpacing.eyebrow,textTransform:"uppercase",...a},headDay:{...face(e,"bold"),color:t.text.primary,fontSize:i.size.caption,letterSpacing:i.letterSpacing.eyebrow,textTransform:"uppercase",...a},question:{...face(e,"regular"),color:t.text.primary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.normal,...a},open:{minHeight:Sg,justifyContent:"center"},openText:{textDecorationLine:"underline"},row:{flexDirection:"row",gap:r.sm,marginTop:r.xs},rowPending:{opacity:Cg},pill:{flex:1,minHeight:Sg,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,borderRadius:l.pill,borderWidth:1,borderColor:t.controlEdge,backgroundColor:t.surface},pillSelected:{backgroundColor:t.brand,borderColor:t.brandInk},pillLabel:{...face(e,"regular"),color:t.text.primary,fontSize:i.size.body},pillLabelSelected:{color:t.onPrimary},logged:{...face(e,"regular"),color:t.text.secondary,fontSize:i.size.caption,...a},resolution:{...face(e,"regular"),color:t.text.primary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.normal,...a},error:{...face(e,"regular"),color:t.danger,fontSize:i.size.caption},findVet:{alignSelf:"stretch",minHeight:Sg,alignItems:"center",justifyContent:"center",borderRadius:l.pill,borderWidth:1.5,borderColor:t.controlEdge,backgroundColor:t.surface},findVetLabel:{...face(e,"bold"),color:t.brandInk,fontSize:i.size.body}})}var Tg=244,_g=8,zg=13,Ig=14,Pg=.3,Eg=-.24,Mg=22,Fg=10,Ag=15;function CitationCards({citations:r,onOpenUrl:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Lg(i),[i]),a=e.useMemo(()=>Sb(r),[r]),[s,u]=e.useState(false);if(a.length===0)return null;let c=a.length;/* @__PURE__ */
284
+ /* @__PURE__ */t.jsx(Text,{tier:"compact",style:d.eyebrow,children:kg.eyebrow}),b!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:d.headDay,children:fe(kg.day,{day:b})}):null]}),u?/* @__PURE__ */t.jsx(n.Pressable,{onPress:u,accessibilityRole:"button",accessibilityLabel:r.text,style:d.open,children:/* @__PURE__ */t.jsx(Text,{style:[d.question,d.openText],children:r.text})}):/* @__PURE__ */t.jsx(Text,{style:d.question,accessibilityRole:"text",children:r.text}),h?/* @__PURE__ */t.jsx(n.View,{style:[d.row,p.pending?d.rowPending:null],children:Sg.map(({answer:e,label:r})=>{let l=(p.pending??p.answer)===e;/* @__PURE__ */
285
+ return t.jsx(n.Pressable,{onPress:()=>p.choose(e),disabled:f,accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:l,disabled:f,busy:p.pending===e},style:[d.pill,l?d.pillSelected:null],children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:[d.pillLabel,l?d.pillLabelSelected:null],children:r})},e)})}):null,p.answer!==null?/* @__PURE__ */t.jsx(Text,{style:d.logged,children:kg.logged}):null,p.escalated?/* @__PURE__ */t.jsx(CheckinFindVet,{petRef:petRef??null,onFindVet:o,vet:a,styles:d}):null,l?.resolutionText?/* @__PURE__ */t.jsx(Text,{style:d.resolution,children:l.resolutionText}):null,p.error?/* @__PURE__ */t.jsx(Text,{style:d.error,accessibilityRole:"alert",children:p.error.displayMessage}):null]})}function CheckinFindVet({petRef:petRef,onFindVet:e,vet:r,styles:l}){return useVetVisit(Ph(petRef,r)).available&&petRef!==null?/* @__PURE__ */t.jsx(VetVisitButtonCore,{entry:"chat",petRef:petRef,label:kg.findVet,...r?.returnTo!==void 0?{returnTo:r.returnTo}:{},...r?.usState!==void 0?{usState:r.usState}:{},...r?.prefer!==void 0?{prefer:r.prefer}:{},style:l.findVet,labelStyle:l.findVetLabel}):e===void 0?null:/* @__PURE__ */t.jsx(n.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:kg.findVet,style:l.findVet,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:l.findVetLabel,children:kg.findVet})})}function _g(e){let t=e.color,r=e.space,l=e.radius,i=e.type,o=xo(e.slots.card),a=wo(o);return n.StyleSheet.create({card:{maxWidth:"92%",padding:r.md,gap:r.sm,borderRadius:l.lg,backgroundColor:t.brandSoft,borderWidth:n.StyleSheet.hairlineWidth,borderColor:t.brandBorder,...vo(o,n.StyleSheet.hairlineWidth)},head:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},eyebrow:{...face(e,"regular"),color:t.text.secondary,fontSize:i.size.caption,letterSpacing:i.letterSpacing.eyebrow,textTransform:"uppercase",...a},headDay:{...face(e,"bold"),color:t.text.primary,fontSize:i.size.caption,letterSpacing:i.letterSpacing.eyebrow,textTransform:"uppercase",...a},question:{...face(e,"regular"),color:t.text.primary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.normal,...a},open:{minHeight:jg,justifyContent:"center"},openText:{textDecorationLine:"underline"},row:{flexDirection:"row",gap:r.sm,marginTop:r.xs},rowPending:{opacity:Rg},pill:{flex:1,minHeight:jg,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,borderRadius:l.pill,borderWidth:1,borderColor:t.controlEdge,backgroundColor:t.surface},pillSelected:{backgroundColor:t.brand,borderColor:t.brandInk},pillLabel:{...face(e,"regular"),color:t.text.primary,fontSize:i.size.body},pillLabelSelected:{color:t.onPrimary},logged:{...face(e,"regular"),color:t.text.secondary,fontSize:i.size.caption,...a},resolution:{...face(e,"regular"),color:t.text.primary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.normal,...a},error:{...face(e,"regular"),color:t.danger,fontSize:i.size.caption},findVet:{alignSelf:"stretch",minHeight:jg,alignItems:"center",justifyContent:"center",borderRadius:l.pill,borderWidth:1.5,borderColor:t.controlEdge,backgroundColor:t.surface},findVetLabel:{...face(e,"bold"),color:t.brandInk,fontSize:i.size.body}})}var zg=244,Ig=8,Pg=13,Eg=14,Mg=.3,Fg=-.24,Ag=22,Lg=10,Og=15;function CitationCards({citations:r,onOpenUrl:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Vg(i),[i]),a=e.useMemo(()=>jb(r),[r]),[s,u]=e.useState(false);if(a.length===0)return null;let c=a.length;/* @__PURE__ */
286
286
  return t.jsxs(n.View,{style:o.block,children:[
287
- /* @__PURE__ */t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:Rb(c,s),accessibilityState:{expanded:s},containerStyle:o.toggleSlot,style:o.togglePill,onPress:()=>u(e=>!e),children:[
288
- /* @__PURE__ */t.jsx(BookGlyph,{size:zg,color:i.color.brandInk,strokeWidth:1.5}),
289
- /* @__PURE__ */t.jsx(Text,{tier:"compact",style:o.toggleLabel,children:jb(c)}),
290
- /* @__PURE__ */t.jsx(ChevronGlyph,{size:zg,color:i.color.brandInk,strokeWidth:1.5,direction:s?"up":"down"})]}),s?/* @__PURE__ */t.jsx(Deck,{cards:a,styles:o,open:l}):null]})}function Deck({cards:e,styles:r,open:l}){let i=Di(),o=Ki(i.citationsInMs,{risePx:i.citationsRisePx});/* @__PURE__ */
291
- return t.jsx(n.Animated.View,{style:o,children:/* @__PURE__ */t.jsx(n.ScrollView,{horizontal:true,nestedScrollEnabled:true,showsHorizontalScrollIndicator:false,contentContainerStyle:r.row,children:e.map(e=>/* @__PURE__ */t.jsx(Card,{card:e,styles:r,open:l},e.key))})})}function Card({card:e,styles:r,open:l}){let i=useEverfurTheme(),o=e.url!==null&&l!==void 0,a=Tb(o?e:{...e,url:null}),s=/* @__PURE__ */t.jsxs(t.Fragment,{children:[
287
+ /* @__PURE__ */t.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:_b(c,s),accessibilityState:{expanded:s},containerStyle:o.toggleSlot,style:o.togglePill,onPress:()=>u(e=>!e),children:[
288
+ /* @__PURE__ */t.jsx(BookGlyph,{size:Pg,color:i.color.brandInk,strokeWidth:1.5}),
289
+ /* @__PURE__ */t.jsx(Text,{tier:"compact",style:o.toggleLabel,children:Tb(c)}),
290
+ /* @__PURE__ */t.jsx(ChevronGlyph,{size:Pg,color:i.color.brandInk,strokeWidth:1.5,direction:s?"up":"down"})]}),s?/* @__PURE__ */t.jsx(Deck,{cards:a,styles:o,open:l}):null]})}function Deck({cards:e,styles:r,open:l}){let i=Ui(),o=Xi(i.citationsInMs,{risePx:i.citationsRisePx});/* @__PURE__ */
291
+ return t.jsx(n.Animated.View,{style:o,children:/* @__PURE__ */t.jsx(n.ScrollView,{horizontal:true,nestedScrollEnabled:true,showsHorizontalScrollIndicator:false,contentContainerStyle:r.row,children:e.map(e=>/* @__PURE__ */t.jsx(Card,{card:e,styles:r,open:l},e.key))})})}function Card({card:e,styles:r,open:l}){let i=useEverfurTheme(),o=e.url!==null&&l!==void 0,a=zb(o?e:{...e,url:null}),s=/* @__PURE__ */t.jsxs(t.Fragment,{children:[
292
292
  /* @__PURE__ */t.jsxs(n.View,{style:r.cardHeader,children:[
293
293
  /* @__PURE__ */t.jsx(n.View,{style:[r.tierDot,{backgroundColor:e.tierColor}]}),
294
- /* @__PURE__ */t.jsx(Text,{style:[r.cardTitle,o?r.cardTitleLink:null],numberOfLines:2,children:e.title}),o?/* @__PURE__ */t.jsx(ArrowUpRightGlyph,{size:Ig,color:i.color.linkInk,strokeWidth:1.5}):null]}),e.meta!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:r.cardMeta,numberOfLines:1,children:e.meta}):null,e.excerpt!==null?/* @__PURE__ */t.jsx(Text,{style:r.cardExcerpt,numberOfLines:3,children:e.excerpt}):null]});if(e.url!==null&&l!==void 0){let n=e.url;/* @__PURE__ */
294
+ /* @__PURE__ */t.jsx(Text,{style:[r.cardTitle,o?r.cardTitleLink:null],numberOfLines:2,children:e.title}),o?/* @__PURE__ */t.jsx(ArrowUpRightGlyph,{size:Eg,color:i.color.linkInk,strokeWidth:1.5}):null]}),e.meta!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:r.cardMeta,numberOfLines:1,children:e.meta}):null,e.excerpt!==null?/* @__PURE__ */t.jsx(Text,{style:r.cardExcerpt,numberOfLines:3,children:e.excerpt}):null]});if(e.url!==null&&l!==void 0){let n=e.url;/* @__PURE__ */
295
295
  return t.jsx(PressScale,{accessibilityRole:"link",accessibilityLabel:a,style:r.card,onPress:()=>l(n),children:s})}/* @__PURE__ */
296
- return t.jsx(n.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:a,style:r.card,children:s})}function Lg(e){let t=e.color,r=e.space,l=e.radius,i=e.type.size,o=go(e.slots.card);return n.StyleSheet.create({block:{gap:r.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:l.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:r.xs+2,paddingHorizontal:r.md,paddingVertical:r.xs+2,borderRadius:l.pill,backgroundColor:t.brandSoft},toggleLabel:{...face(e,"monoBold"),fontSize:i.micro,lineHeight:i.micro,letterSpacing:Pg,color:t.brandInk,textTransform:"uppercase"},row:{gap:r.sm,paddingRight:r.xl,paddingTop:r.xs},card:{width:Tg,borderRadius:l.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.md,gap:r.xs+2,...ho(e.slots.card,1)},cardHeader:{flexDirection:"row",alignItems:"center",gap:r.sm},tierDot:{width:_g,height:_g,borderRadius:l.pill},cardTitle:{...headingFace(e,"bold"),flex:1,fontSize:i.bodyTight,lineHeight:Mg,color:t.text.primary,letterSpacing:Eg,...o},cardTitleLink:{color:t.linkInk},cardMeta:{...face(e,"monoMedium"),fontSize:i.nano,lineHeight:Fg,letterSpacing:e.type.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase",...o},cardExcerpt:{...face(e,"regular"),fontSize:i.tiny,lineHeight:Ag,color:t.text.muted,...o}})}var Og=15,Vg=44,Dg=16,Bg=/* @__PURE__ */Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function MessageFooter({message:r,onCopy:l,sentiment:i=null,onSentiment:o,note:a=null}){let s=useEverfurTheme(),u=e.useMemo(()=>Hg(s),[s]),c=Di(),d=r.role==="user",p=e.useMemo(()=>bb(r.createdAt),[r.createdAt]),f=l!==void 0&&r.role!=="vet"&&r.text.length>0,h=r.role==="assistant"&&o!==void 0&&r.responseId!==void 0,[b,g]=e.useState(false),m=e.useRef(null);e.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);let y=()=>{l!==void 0&&(kr(l,r.text),g(true),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{g(false),m.current=null},c.copiedMs))};return p===null&&!f&&!h?null:/* @__PURE__ */t.jsxs(n.View,{style:u.wrap,children:[
297
- /* @__PURE__ */t.jsxs(n.View,{style:[u.row,d?u.rowUser:u.rowAssistant],children:[p!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:u.timestamp,children:p}):null,f?/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:b?pe.copied:d?pe.copyUserMessage:pe.copyAssistantMessage,onPress:y,style:u.iconHit,children:b?/* @__PURE__ */t.jsx(CheckGlyph,{size:Og,color:s.color.success,strokeWidth:2}):/* @__PURE__ */t.jsx(CopyGlyph,{size:Og,color:s.color.text.timestamp,strokeWidth:1.5})}):null,h?Xd.map(({sentiment:e,label:r})=>/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:i===e},onPress:()=>o?.(e),style:u.iconHit,children:/* @__PURE__ */t.jsx(ThumbGlyph,{size:Og,color:i===e?s.color.sentiment[e]:s.color.text.timestamp,active:i===e,rotate:Bg[e],strokeWidth:1.5})},e)):null]}),a==="thanks"?/* @__PURE__ */t.jsx(Text,{style:u.thanks,accessibilityLiveRegion:"polite",children:pe.feedbackThanks}):null,a==="failed"?/* @__PURE__ */t.jsxs(t.Fragment,{children:[
296
+ return t.jsx(n.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:a,style:r.card,children:s})}function Vg(e){let t=e.color,r=e.space,l=e.radius,i=e.type.size,o=wo(e.slots.card);return n.StyleSheet.create({block:{gap:r.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:l.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:r.xs+2,paddingHorizontal:r.md,paddingVertical:r.xs+2,borderRadius:l.pill,backgroundColor:t.brandSoft},toggleLabel:{...face(e,"monoBold"),fontSize:i.micro,lineHeight:i.micro,letterSpacing:Mg,color:t.brandInk,textTransform:"uppercase"},row:{gap:r.sm,paddingRight:r.xl,paddingTop:r.xs},card:{width:zg,borderRadius:l.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.md,gap:r.xs+2,...vo(e.slots.card,1)},cardHeader:{flexDirection:"row",alignItems:"center",gap:r.sm},tierDot:{width:Ig,height:Ig,borderRadius:l.pill},cardTitle:{...headingFace(e,"bold"),flex:1,fontSize:i.bodyTight,lineHeight:Ag,color:t.text.primary,letterSpacing:Fg,...o},cardTitleLink:{color:t.linkInk},cardMeta:{...face(e,"monoMedium"),fontSize:i.nano,lineHeight:Lg,letterSpacing:e.type.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase",...o},cardExcerpt:{...face(e,"regular"),fontSize:i.tiny,lineHeight:Og,color:t.text.muted,...o}})}var Dg=15,Bg=44,Hg=16,Wg=/* @__PURE__ */Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function MessageFooter({message:r,onCopy:l,sentiment:i=null,onSentiment:o,note:a=null}){let s=useEverfurTheme(),u=e.useMemo(()=>Ng(s),[s]),c=Ui(),d=r.role==="user",p=e.useMemo(()=>mb(r.createdAt),[r.createdAt]),f=l!==void 0&&r.role!=="vet"&&r.text.length>0,h=r.role==="assistant"&&o!==void 0&&r.responseId!==void 0,[b,g]=e.useState(false),m=e.useRef(null);e.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);let y=()=>{l!==void 0&&(kr(l,r.text),g(true),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{g(false),m.current=null},c.copiedMs))};return p===null&&!f&&!h?null:/* @__PURE__ */t.jsxs(n.View,{style:u.wrap,children:[
297
+ /* @__PURE__ */t.jsxs(n.View,{style:[u.row,d?u.rowUser:u.rowAssistant],children:[p!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:u.timestamp,children:p}):null,f?/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:b?pe.copied:d?pe.copyUserMessage:pe.copyAssistantMessage,onPress:y,style:u.iconHit,children:b?/* @__PURE__ */t.jsx(CheckGlyph,{size:Dg,color:s.color.success,strokeWidth:2}):/* @__PURE__ */t.jsx(CopyGlyph,{size:Dg,color:s.color.text.timestamp,strokeWidth:1.5})}):null,h?tp.map(({sentiment:e,label:r})=>/* @__PURE__ */t.jsx(n.Pressable,{accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:i===e},onPress:()=>o?.(e),style:u.iconHit,children:/* @__PURE__ */t.jsx(ThumbGlyph,{size:Dg,color:i===e?s.color.sentiment[e]:s.color.text.timestamp,active:i===e,rotate:Wg[e],strokeWidth:1.5})},e)):null]}),a==="thanks"?/* @__PURE__ */t.jsx(Text,{style:u.thanks,accessibilityLiveRegion:"polite",children:pe.feedbackThanks}):null,a==="failed"?/* @__PURE__ */t.jsxs(t.Fragment,{children:[
298
298
  /* @__PURE__ */t.jsx(Text,{style:u.failed,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:pe.feedbackFailed}),
299
- /* @__PURE__ */t.jsx(AnnounceLine,{line:pe.feedbackFailed})]}):null]})}function Hg(e){let t=e.type;return n.StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,minHeight:Dg,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...face(e,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:e.color.text.timestamp,textAlign:"center"},iconHit:{width:Vg,height:Vg,marginVertical:-28/2,alignItems:"center",justifyContent:"center"},thanks:{...face(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.text.secondary},failed:{...face(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.danger}})}var Wg=16,Ng=10,Ug=12,$g=10,qg=2,Gg=.06,Kg=34,Yg=9,Qg=10.5,Zg=.06,Jg=15,Xg=19.5,em=14,tm=19.6;function OpeningCard({card:r,onLayout:l}){let i=useEverfurTheme(),o=e.useMemo(()=>rm(i),[i]),a=r.styles;/* @__PURE__ */
299
+ /* @__PURE__ */t.jsx(AnnounceLine,{line:pe.feedbackFailed})]}):null]})}function Ng(e){let t=e.type;return n.StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,minHeight:Hg,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...face(e,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:e.color.text.timestamp,textAlign:"center"},iconHit:{width:Bg,height:Bg,marginVertical:-28/2,alignItems:"center",justifyContent:"center"},thanks:{...face(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.text.secondary},failed:{...face(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.danger}})}var Ug=16,$g=10,qg=12,Gg=10,Kg=2,Yg=.06,Qg=34,Zg=9,Jg=10.5,Xg=.06,em=15,tm=19.5,rm=14,nm=19.6;function OpeningCard({card:r,onLayout:l}){let i=useEverfurTheme(),o=e.useMemo(()=>lm(i),[i]),a=r.styles;/* @__PURE__ */
300
300
  return t.jsxs(n.View,{testID:"everfur-opening-card",onLayout:l,accessible:true,accessibilityLabel:[r.kicker,r.title,r.body].filter(e=>e!==void 0).join(", "),style:[o.card,a?.card],children:[r.icon!==void 0?/* @__PURE__ */t.jsx(n.View,{style:[o.icon,a?.icon],children:r.icon}):null,
301
301
  /* @__PURE__ */t.jsxs(n.View,{style:o.words,children:[
302
302
  /* @__PURE__ */t.jsx(Text,{tier:"compact",style:[o.kicker,a?.kicker],children:r.kicker}),
303
- /* @__PURE__ */t.jsx(Text,{tier:"control",style:[o.title,a?.title],children:r.title}),r.body!==void 0?/* @__PURE__ */t.jsx(Text,{style:[o.body,a?.body],children:r.body}):null]})]})}function rm(e){let t=e.color;return n.StyleSheet.create({card:{flexDirection:"row",alignItems:"flex-start",gap:$g,paddingVertical:Ng,paddingHorizontal:Ug,alignSelf:"stretch",borderRadius:Wg,backgroundColor:t.surface,borderWidth:1,borderColor:Ta(t.text.primary,Gg)??t.borderRingCream},icon:{flexShrink:0,width:Kg,height:Kg,borderRadius:Yg,backgroundColor:t.highlight,alignItems:"center",justifyContent:"center",overflow:"hidden"},words:{flex:1,minWidth:0,gap:qg},kicker:{...face(e,"mono"),fontSize:Qg,letterSpacing:Qg*Zg,textTransform:"uppercase",color:t.text.muted},title:{...face(e,"bold"),fontSize:Jg,lineHeight:Xg,color:t.text.primary},body:{...face(e,"regular"),fontSize:em,lineHeight:tm,color:t.text.secondary}})}var nm="#10462E",lm="Book a video visit",im="#000000",om="#83E0B4",am=/* @__PURE__ */Object.freeze([
303
+ /* @__PURE__ */t.jsx(Text,{tier:"control",style:[o.title,a?.title],children:r.title}),r.body!==void 0?/* @__PURE__ */t.jsx(Text,{style:[o.body,a?.body],children:r.body}):null]})]})}function lm(e){let t=e.color;return n.StyleSheet.create({card:{flexDirection:"row",alignItems:"flex-start",gap:Gg,paddingVertical:$g,paddingHorizontal:qg,alignSelf:"stretch",borderRadius:Ug,backgroundColor:t.surface,borderWidth:1,borderColor:Ea(t.text.primary,Yg)??t.borderRingCream},icon:{flexShrink:0,width:Qg,height:Qg,borderRadius:Zg,backgroundColor:t.highlight,alignItems:"center",justifyContent:"center",overflow:"hidden"},words:{flex:1,minWidth:0,gap:Kg},kicker:{...face(e,"mono"),fontSize:Jg,letterSpacing:Jg*Xg,textTransform:"uppercase",color:t.text.muted},title:{...face(e,"bold"),fontSize:em,lineHeight:tm,color:t.text.primary},body:{...face(e,"regular"),fontSize:rm,lineHeight:nm,color:t.text.secondary}})}var im="#10462E",om="Book a video visit",am="#000000",sm="#83E0B4",um=/* @__PURE__ */Object.freeze([
304
304
  /* @__PURE__ */Object.freeze({id:"breed-health-miss",intent:"send",label:"What {breed} health issue do owners miss most?",fallbackLabel:"What {species} health issue do owners miss most?",background:"#A0C4F6",borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),
305
- /* @__PURE__ */Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:om,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),
306
- /* @__PURE__ */Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:nm,brandEdge:true,borderWidth:1}),
307
- /* @__PURE__ */Object.freeze({id:"vet-prep",intent:"vet_report",label:"Help me prep for {petName}’s vet visit",background:"#FFBDBD",borderColor:"#6D1D14",borderWidth:1.25})]);function sm(e,t){return e?null:{fill:t.fill,ink:t.ink}}var um=8;function cm(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0&&t.length<=64&&!/[;{}<>]/u.test(t)?t:null}function dm(e){if(!Array.isArray(e))return null;let t=[];for(let r of e){if(t.length>=um)break;if(r===null||typeof r!="object"||typeof r.label!="string")continue;let e=r.label.trim();if(e.length===0)continue;let n=typeof r.prompt=="string"&&r.prompt.trim().length>0?r.prompt.trim():e,l=cm(r.tint);t.push(/* @__PURE__ */Object.freeze({id:`starter-${t.length}`,label:e,prompt:n,tint:l,ink:l===null?null:cm(r.ink)}))}return t.length>0?/* @__PURE__ */Object.freeze(t):null}var pm=/\s*-\s*(?:small|medium|large|giant|toy)\s*$/i;function fm(e){return e==null?e:e.replace(pm,"").trim()}var hm=/* @__PURE__ */new Set(["","?","-","--",".","n/a","na","none","null","nil","unknown","unspecified","unsure","not sure","not specified","not applicable","no idea","dunno","idk","tbd","other","i dont know","i don't know","dont know","don't know","do not know","i do not know","not known","no clue"]);function bm(e){let t=String(e??"").replace(/\s+/gu," ").trim().toLowerCase().replace(/\u2019/g,"'");return hm.has(t)}function gm(e){return e==="cat"?"Domestic Short Hair Mix":"Mixed Breed"}function mm(e){let t=e?.name?.trim()||pe.emptyTitlePetFallback;return fe(pe.emptyTitle,{petName:t})}function ym(e){let t=e.toLowerCase();return t===gm("dog").toLowerCase()||t===gm("cat").toLowerCase()}function vm(e){let t=fm(e);if(bm(t))return null;let r=String(t).replace(/\s+/gu," ").trim();return ym(r)?null:r}function xm(e,t=nm,r){let n=canonicalPetSpecies(e?.species),l=e?.name?.trim()||null,i=vm(e?.breed),o=dd(e?.ageYears),a=o===null?null:String(o),s=r?.vetPrepLabel?.trim()||null;/* @__PURE__ */
308
- return Object.freeze(am.flatMap(e=>{let r=e.intent==="vet_report"&&s!==null?s:e.label,o=r.includes("{breed}"),u=r.includes("{ageYears}"),c=e.fallbackLabel!==void 0&&(o&&!i||u&&!a)&&e.fallbackLabel?e.fallbackLabel:r;if(c.includes("{breed}")&&i===null||c.includes("{ageYears}")&&a===null||n===null&&(c.includes("{species}")||c.includes("{petName}")&&l===null))return[];let d=fe(c,{petName:l??(n==="cat"?"my cat":"my dog"),breed:i??"",species:n??"",ageYears:a??""}),p=!l&&c.startsWith("{petName}")?d.charAt(0).toUpperCase()+d.slice(1):d;return[/* @__PURE__ */Object.freeze({id:e.id,intent:e.intent,label:p,background:e.background,borderColor:e.brandEdge===true?t:e.borderColor,borderWidth:e.borderWidth})]}))}var wm=44,km=0,Sm={top:3,bottom:3},Cm=1,jm=.28,Rm=2,Tm=2,_m=1.3,zm=-.015,Im=/* @__PURE__ */Object.freeze([
305
+ /* @__PURE__ */Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:sm,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),
306
+ /* @__PURE__ */Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:im,brandEdge:true,borderWidth:1}),
307
+ /* @__PURE__ */Object.freeze({id:"vet-prep",intent:"vet_report",label:"Help me prep for {petName}’s vet visit",background:"#FFBDBD",borderColor:"#6D1D14",borderWidth:1.25})]);function cm(e,t){return e?null:{fill:t.fill,ink:t.ink}}var dm=8;function pm(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0&&t.length<=64&&!/[;{}<>]/u.test(t)?t:null}function fm(e){if(!Array.isArray(e))return null;let t=[];for(let r of e){if(t.length>=dm)break;if(r===null||typeof r!="object"||typeof r.label!="string")continue;let e=r.label.trim();if(e.length===0)continue;let n=typeof r.prompt=="string"&&r.prompt.trim().length>0?r.prompt.trim():e,l=pm(r.tint);t.push(/* @__PURE__ */Object.freeze({id:`starter-${t.length}`,label:e,prompt:n,tint:l,ink:l===null?null:pm(r.ink)}))}return t.length>0?/* @__PURE__ */Object.freeze(t):null}var hm=/\s*-\s*(?:small|medium|large|giant|toy)\s*$/i;function bm(e){return e==null?e:e.replace(hm,"").trim()}var gm=/* @__PURE__ */new Set(["","?","-","--",".","n/a","na","none","null","nil","unknown","unspecified","unsure","not sure","not specified","not applicable","no idea","dunno","idk","tbd","other","i dont know","i don't know","dont know","don't know","do not know","i do not know","not known","no clue"]);function mm(e){let t=String(e??"").replace(/\s+/gu," ").trim().toLowerCase().replace(/\u2019/g,"'");return gm.has(t)}function ym(e){return e==="cat"?"Domestic Short Hair Mix":"Mixed Breed"}function vm(e,t){let r=e?.trim();if(r===void 0||r==="")return xm(t);let n=t?.name?.trim()||pe.emptyTitlePetFallback,l=n.charAt(0).toUpperCase()+n.slice(1);return r.replace(/\{(pet|petName)\}/g,(e,t,r)=>r===0?l:n)}function xm(e){let t=e?.name?.trim()||pe.emptyTitlePetFallback;return fe(pe.emptyTitle,{petName:t})}function wm(e){let t=e.toLowerCase();return t===ym("dog").toLowerCase()||t===ym("cat").toLowerCase()}function km(e){let t=bm(e);if(mm(t))return null;let r=String(t).replace(/\s+/gu," ").trim();return wm(r)?null:r}function Sm(e,t=im,r){let n=canonicalPetSpecies(e?.species),l=e?.name?.trim()||null,i=km(e?.breed),o=fd(e?.ageYears),a=o===null?null:String(o),s=r?.vetPrepLabel?.trim()||null;/* @__PURE__ */
308
+ return Object.freeze(um.flatMap(e=>{let r=e.intent==="vet_report"&&s!==null?s:e.label,o=r.includes("{breed}"),u=r.includes("{ageYears}"),c=e.fallbackLabel!==void 0&&(o&&!i||u&&!a)&&e.fallbackLabel?e.fallbackLabel:r;if(c.includes("{breed}")&&i===null||c.includes("{ageYears}")&&a===null||n===null&&(c.includes("{species}")||c.includes("{petName}")&&l===null))return[];let d=fe(c,{petName:l??(n==="cat"?"my cat":"my dog"),breed:i??"",species:n??"",ageYears:a??""}),p=!l&&c.startsWith("{petName}")?d.charAt(0).toUpperCase()+d.slice(1):d;return[/* @__PURE__ */Object.freeze({id:e.id,intent:e.intent,label:p,background:e.background,borderColor:e.brandEdge===true?t:e.borderColor,borderWidth:e.borderWidth})]}))}var Cm=44,jm=0,Rm={top:3,bottom:3},Tm=1,_m=.28,zm=2,Im=2,Pm=1.3,Em=-.015,Mm=/* @__PURE__ */Object.freeze([
309
309
  /* @__PURE__ */Object.freeze({tint:"#FFE7A1",ink:"#262523"}),
310
310
  /* @__PURE__ */Object.freeze({tint:"#C8F4F8",ink:"#262523"}),
311
311
  /* @__PURE__ */Object.freeze({tint:"#DDEFC4",ink:"#262523"}),
312
- /* @__PURE__ */Object.freeze({tint:"#FFD8D6",ink:"#262523"})]);function QuickPrompts({pet:r,petRef:petRef,onSend:l,onVetPrep:i,vet:o,starterPrompts:a,emptyState:s,centered:u=false}){let c=useEverfurTheme(),d=e.useMemo(()=>Pm(c),[c]),p=e.useMemo(()=>dm(a),[a]),f=e.useMemo(()=>p!==null?p.map(e=>({prompt:{id:e.id,intent:"send",label:e.label,background:e.tint??c.color.highlight,borderColor:"transparent",borderWidth:1},send:e.prompt,paint:e.tint===null?null:{fill:e.tint,ink:e.ink??c.color.text.primary}})):xm(r,c.color.brandInk,{vetPrepLabel:lm}).map(e=>({prompt:e,send:e.label,paint:null})),[p,r,c.color.brandInk,c.color.highlight,c.color.text.primary]),h=s?.chipTints!==void 0,b=e.useMemo(()=>(s?.chipTints??(c.brightness==="light"?Im:[])).filter(e=>typeof e.tint=="string"&&e.tint.trim()!==""),[s?.chipTints,c.brightness]),g=e.useMemo(()=>b.length===0?f:f.map((e,t)=>{if(e.paint!==null)return e;let r=b[t%b.length];return{...e,paint:{fill:r.tint,ink:r.ink??c.color.text.primary},...h?{}:{cycleDefault:true}}}),[f,b,h,c.color.text.primary]),m=e.useMemo(()=>sm(sd(c),{fill:c.color.highlight,ink:c.color.onHighlight}),[c]),y=e.useMemo(()=>({fill:c.color.highlight,ink:c.color.onHighlight}),[c.color.highlight,c.color.onHighlight]),v=s?.title?.trim(),x=v!==void 0&&v!==""?v:mm(r),w=mp(),k=yp(),S=w!==null&&k!==null?/* @__PURE__ */t.jsx(k.Title,{text:x,style:[d.title,w.text(".serif",".ask-empty h2"),d.centerText],measureCh:k.titleCh}):/* @__PURE__ */t.jsx(Text,{tier:"heading",style:u?[d.title,d.centerText]:d.title,accessibilityRole:"header",children:x});/* @__PURE__ */
313
- return t.jsxs(n.View,{style:w!==null?d.homeBlock:d.block,children:[S,
314
- /* @__PURE__ */t.jsx(n.View,{style:w!==null?[d.list,d.listCentered,w.view(".ask-chips",".ask-empty .ask-chips")]:u?[d.list,d.listCentered]:d.list,accessibilityLabel:pe.suggestions,children:g.map(({prompt:e,send:n,paint:a,cycleDefault:s},c)=>/* @__PURE__ */t.jsx(Chip,{prompt:e,send:n,themed:a??(p!==null?y:m),index:c,petRef:petRef,onSend:l,onVetPrep:i,vet:o,pet:r,styles:d,tinted:a!==null&&s!==true,soft:a!==null,centered:u},e.id))})]})}function Chip({prompt:e,send:r,themed:l,index:i,pet:o,petRef:petRef,onSend:a,onVetPrep:s,vet:u,styles:c,tinted:d,soft:p,centered:f}){let h=Di(),b=Ki(h.followUpInMs,{delayMs:Oi(h,i),risePx:h.promptRisePx}),g=mp(),m=g!==null?[c.chipHome,g.view(".chip")]:f&&p?c.chipNoEdge:c.chipEdge,y={backgroundColor:l?.fill??e.background},v=c.chipSlot===null?y:d?{...c.chipSlot,...y}:{...y,...c.chipSlot},x=g!==null?[c.chipLabel,g.text(".chip")]:f?[c.chipLabel,c.centerText]:[c.chipLabel],w=g!==null?Sm:km,k=l===null?c.chipSlotLabel===null?x:[...x,c.chipSlotLabel]:d?[...x,...c.chipSlotLabel===null?[]:[c.chipSlotLabel],{color:l.ink}]:[...x,{color:l.ink},...c.chipSlotLabel===null?[]:[c.chipSlotLabel]];return e.intent==="vet_report"?s!==void 0?/* @__PURE__ */t.jsx(n.Animated.View,{style:b,children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:w,style:[c.chip,m,v],onPress:()=>{vr(s,o)},children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:k,children:e.label})})}):petRef===null?null:/* @__PURE__ */t.jsx(n.Animated.View,{style:b,children:/* @__PURE__ */t.jsx(VetVisitButtonCore,{entry:"chat",petRef:petRef,label:e.label,...u?.returnTo!==void 0?{returnTo:u.returnTo}:{},...u?.usState!==void 0?{usState:u.usState}:{},...u?.prefer!==void 0?{prefer:u.prefer}:{},style:[c.chip,m,v],labelStyle:k})}):/* @__PURE__ */t.jsx(n.Animated.View,{style:b,children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:w,style:[c.chip,m,v],onPress:()=>a(r),children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:k,children:e.label})})})}function Pm(e){let t=bo(e.slots.chip),r=go(t);return{chipSlot:t===void 0?null:ho(t,Cm),chipSlotLabel:r.color===void 0?null:r,...Em(e)}}function Em(e){let t=e.color,r=e.space,l=e.type;return n.StyleSheet.create({block:{gap:r.lg,alignItems:"stretch",width:"100%"},homeBlock:{alignItems:"stretch",width:"100%"},chipHome:{borderWidth:0,minHeight:0},title:{...headingFace(e,"medium"),fontSize:l.size.heading,lineHeight:Math.round(l.size.heading*l.lineHeight.snug),color:t.brandInk,letterSpacing:l.size.heading*zm,textAlign:"left"},list:{width:"100%",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",gap:r.sm+Rm},listCentered:{flexDirection:"column",flexWrap:"nowrap",alignItems:"stretch"},centerText:{textAlign:"center"},chipNoEdge:{borderWidth:Cm,borderColor:"transparent"},chip:{borderRadius:e.radius.pill,paddingHorizontal:r.lg+Tm,paddingVertical:r.sm,minHeight:wm,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipEdge:{borderWidth:Cm,borderColor:Ta(t.brandInk,jm)??t.borderRingCream},chipLabel:{...face(e,"bold"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*_m),color:im,textAlign:"left"}})}var Mm=1e3,Fm=150,Am=.25,Lm=.5,Om=3;function TypingIndicator({petName:r=null,inline:l=false}){let{theme:i,styles:o}=eu(),a=i.motion.reducedMotion,s=be(pe.reading,r),u=e.useRef(Array.from({length:Om},()=>new n.Animated.Value(0))).current;return e.useEffect(()=>{if(a)return;let e=u.map((e,t)=>n.Animated.loop(n.Animated.sequence([n.Animated.delay(t*Fm),n.Animated.timing(e,{toValue:1,duration:Mm*.4,useNativeDriver:true}),n.Animated.timing(e,{toValue:0,duration:Mm*.6,useNativeDriver:true}),n.Animated.delay((Om-t-1)*Fm)])));for(let t of e)t.start();return()=>{for(let t of e)t.stop()}},[a,u]),/* @__PURE__ */t.jsx(n.View,{style:l?o.readingInline:o.readingBox,accessible:true,accessibilityRole:"text",accessibilityLabel:s,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:u.map((e,r)=>/* @__PURE__ */t.jsx(n.Animated.View,{accessibilityElementsHidden:true,importantForAccessibility:"no",style:[l?o.readingDotInline:o.readingDot,a?{opacity:Lm}:{opacity:e.interpolate({inputRange:[0,1],outputRange:[Am,1]}),transform:[{translateY:e.interpolate({inputRange:[0,1],outputRange:[0,-3]})}]}]},r))})}function Vm(e,t,r){let n=e-r,l=t!=null?Math.min(n,t):n;return Math.max(0,l)}function Dm(e){let t=e.length-1,r=e[t];if(r===void 0||r.role!=="assistant")return null;let n=e[t-1];return{assistantIndex:t,userIndex:n!==void 0&&n.role==="user"?t-1:null}}function Bm(e,t,r){let n=Math.max(0,r),l=e===null?n:Math.min(Math.max(0,e),n);return l>t+1?l:null}var Hm=16;function Wm(t,r,n=null){let l=e.useRef(null),i=e.useRef(true),o=e.useRef(r),a=e.useRef(0),s=e.useRef(0),u=e.useRef(0),c=e.useRef(/* @__PURE__ */new Map),d=e.useRef(null),p=e.useRef(false),f=t[0]?.id??null,h=e.useRef(f),b=e.useRef(null);e.useEffect(()=>{let e=h.current;if(h.current=f,e===null||e===f||(b.current=null,i.current||!t.some(t=>t.id===e)))return;let r=c.current.get(e);r!==void 0&&(b.current={id:e,top:r,offset:a.current})},[f,t]);let g=Dm(t),m=g===null?null:t[g.assistantIndex]?.id??null,y=g===null||g.userIndex===null?null:t[g.userIndex]?.id??null,v=e.useCallback(()=>{let e=l.current;if(e===null||!i.current||s.current===0)return;let t=null;if(m!==null){let e=c.current.get(m);if(e===void 0)return;let r=y===null?null:c.current.get(y)??null;t=Vm(e,r,96)}let r=Bm(t,a.current,u.current-s.current);if(r!==null&&(a.current=r,e.scrollTo({y:r,animated:false})),!p.current||d.current===null)return;let n=Bm(d.current+Hm-s.current,a.current,u.current-s.current);n!==null&&(a.current=n,e.scrollTo({y:n,animated:false}))},[m,y]);e.useEffect(()=>{p.current=n!==null,n===null&&(d.current=null),v()},[n,v]),e.useEffect(()=>{r&&!o.current&&(i.current=true,p.current=false),o.current=r,v()},[t,r,v]);let x=e.useCallback(e=>{s.current=e.nativeEvent.layout.height,v()},[v]),w=e.useCallback((e,t)=>{u.current=t,s.current>0&&(a.current=Math.min(a.current,Math.max(0,t-s.current))),v()},[v]),k=e.useCallback(e=>{a.current=e.nativeEvent.contentOffset.y},[]),S=e.useCallback(()=>{i.current=false,p.current=false},[]),C=e.useCallback(e=>{let{contentOffset:t,contentSize:r,layoutMeasurement:n}=e.nativeEvent;a.current=t.y,i.current=r.height-t.y-n.height<=24},[]),j=e.useCallback(e=>t=>{let r=t.nativeEvent.layout.y;c.current.set(e,r);let n=b.current;if(n!==null&&n.id===e&&r!==n.top){b.current=null;let e=Math.max(0,n.offset+r-n.top);a.current=e,l.current?.scrollTo({y:e,animated:false})}(e===m||e===y)&&v()},[m,y,v]),R=e.useCallback(e=>{let{y:t,height:r}=e.nativeEvent.layout;d.current=t+r,v()},[v]);return{ref:l,onLayout:x,onContentSizeChange:w,onScroll:k,onScrollBeginDrag:S,onScrollEnd:C,rowLayout:j,asideLayout:R}}function Nm(e,r,n){switch(e){case"loading":return n.renderPending?/* @__PURE__ */t.jsx(HostRender,{render:n.renderPending,fallback:/* @__PURE__ */t.jsx(LoadingState,{})}):/* @__PURE__ */t.jsx(LoadingState,{});case"empty":/* @__PURE__ */
315
- return t.jsx(EmptyState,{pet:n.shownPet,petRef:r.petRef,onSelectPrompt:n.onSelectPrompt,onVetPrep:n.onVetPrep,vet:n.vet,top:n.threadTop,pendingCheckin:n.pendingCheckin??null,topCard:n.topCard,starterPrompts:n.starterPrompts,emptyState:n.emptyState,centered:n.emptyCentered===true,foot:n.threadFoot??null,renderEmptyHeader:n.renderEmptyHeader});case"error":/* @__PURE__ */
312
+ /* @__PURE__ */Object.freeze({tint:"#FFD8D6",ink:"#262523"})]);function QuickPrompts({pet:r,petRef:petRef,onSend:l,onVetPrep:i,vet:o,starterPrompts:a,emptyState:s,centered:u=false}){let c=useEverfurTheme(),d=e.useMemo(()=>Fm(c),[c]),p=e.useMemo(()=>fm(a),[a]),f=e.useMemo(()=>p!==null?p.map(e=>({prompt:{id:e.id,intent:"send",label:e.label,background:e.tint??c.color.highlight,borderColor:"transparent",borderWidth:1},send:e.prompt,paint:e.tint===null?null:{fill:e.tint,ink:e.ink??c.color.text.primary}})):Sm(r,c.color.brandInk,{vetPrepLabel:om}).map(e=>({prompt:e,send:e.label,paint:null})),[p,r,c.color.brandInk,c.color.highlight,c.color.text.primary]),h=s?.chipTints!==void 0,b=e.useMemo(()=>(s?.chipTints??(c.brightness==="light"?Mm:[])).filter(e=>typeof e.tint=="string"&&e.tint.trim()!==""),[s?.chipTints,c.brightness]),g=e.useMemo(()=>b.length===0?f:f.map((e,t)=>{if(e.paint!==null)return e;let r=b[t%b.length];return{...e,paint:{fill:r.tint,ink:r.ink??c.color.text.primary},...h?{}:{cycleDefault:true}}}),[f,b,h,c.color.text.primary]),m=e.useMemo(()=>cm(cd(c),{fill:c.color.highlight,ink:c.color.onHighlight}),[c]),y=e.useMemo(()=>({fill:c.color.highlight,ink:c.color.onHighlight}),[c.color.highlight,c.color.onHighlight]),v=vm(s?.title,r),x=vp(),w=xp(),k=x!==null&&w!==null?/* @__PURE__ */t.jsx(w.Title,{text:v,style:[d.title,x.text(".serif",".ask-empty h2"),d.centerText],measureCh:w.titleCh}):/* @__PURE__ */t.jsx(Text,{tier:"heading",style:u?[d.title,d.centerText]:d.title,accessibilityRole:"header",children:v});/* @__PURE__ */
313
+ return t.jsxs(n.View,{style:x!==null?d.homeBlock:d.block,children:[k,
314
+ /* @__PURE__ */t.jsx(n.View,{style:x!==null?[d.list,d.listCentered,x.view(".ask-chips",".ask-empty .ask-chips")]:u?[d.list,d.listCentered]:d.list,accessibilityLabel:pe.suggestions,children:g.map(({prompt:e,send:n,paint:a,cycleDefault:s},c)=>/* @__PURE__ */t.jsx(Chip,{prompt:e,send:n,themed:a??(p!==null?y:m),index:c,petRef:petRef,onSend:l,onVetPrep:i,vet:o,pet:r,styles:d,tinted:a!==null&&s!==true,soft:a!==null,centered:u},e.id))})]})}function Chip({prompt:e,send:r,themed:l,index:i,pet:o,petRef:petRef,onSend:a,onVetPrep:s,vet:u,styles:c,tinted:d,soft:p,centered:f}){let h=Ui(),b=Xi(h.followUpInMs,{delayMs:Wi(h,i),risePx:h.promptRisePx}),g=vp(),m=g!==null?[c.chipHome,g.view(".chip")]:f&&p?c.chipNoEdge:c.chipEdge,y={backgroundColor:l?.fill??e.background},v=c.chipSlot===null?y:d?{...c.chipSlot,...y}:{...y,...c.chipSlot},x=g!==null?[c.chipLabel,g.text(".chip")]:f?[c.chipLabel,c.centerText]:[c.chipLabel],w=g!==null?Rm:jm,k=l===null?c.chipSlotLabel===null?x:[...x,c.chipSlotLabel]:d?[...x,...c.chipSlotLabel===null?[]:[c.chipSlotLabel],{color:l.ink}]:[...x,{color:l.ink},...c.chipSlotLabel===null?[]:[c.chipSlotLabel]];return e.intent==="vet_report"?s!==void 0?/* @__PURE__ */t.jsx(n.Animated.View,{style:b,children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:w,style:[c.chip,m,v],onPress:()=>{vr(s,o)},children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:k,children:e.label})})}):petRef===null?null:/* @__PURE__ */t.jsx(n.Animated.View,{style:b,children:/* @__PURE__ */t.jsx(VetVisitButtonCore,{entry:"chat",petRef:petRef,label:e.label,...u?.returnTo!==void 0?{returnTo:u.returnTo}:{},...u?.usState!==void 0?{usState:u.usState}:{},...u?.prefer!==void 0?{prefer:u.prefer}:{},style:[c.chip,m,v],labelStyle:k})}):/* @__PURE__ */t.jsx(n.Animated.View,{style:b,children:/* @__PURE__ */t.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:w,style:[c.chip,m,v],onPress:()=>a(r),children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:k,children:e.label})})})}function Fm(e){let t=xo(e.slots.chip),r=wo(t);return{chipSlot:t===void 0?null:vo(t,Tm),chipSlotLabel:r.color===void 0?null:r,...Am(e)}}function Am(e){let t=e.color,r=e.space,l=e.type;return n.StyleSheet.create({block:{gap:r.lg,alignItems:"stretch",width:"100%"},homeBlock:{alignItems:"stretch",width:"100%"},chipHome:{borderWidth:0,minHeight:0},title:{...headingFace(e,"medium"),fontSize:l.size.heading,lineHeight:Math.round(l.size.heading*l.lineHeight.snug),color:t.brandInk,letterSpacing:l.size.heading*Em,textAlign:"left"},list:{width:"100%",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",gap:r.sm+zm},listCentered:{flexDirection:"column",flexWrap:"nowrap",alignItems:"stretch"},centerText:{textAlign:"center"},chipNoEdge:{borderWidth:Tm,borderColor:"transparent"},chip:{borderRadius:e.radius.pill,paddingHorizontal:r.lg+Im,paddingVertical:r.sm,minHeight:Cm,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipEdge:{borderWidth:Tm,borderColor:Ea(t.brandInk,_m)??t.borderRingCream},chipLabel:{...face(e,"bold"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*Pm),color:am,textAlign:"left"}})}var Lm=1e3,Om=150,Vm=.25,Dm=.5,Bm=3;function TypingIndicator({petName:r=null,inline:l=false}){let{theme:i,styles:o}=ru(),a=i.motion.reducedMotion,s=be(pe.reading,r),u=e.useRef(Array.from({length:Bm},()=>new n.Animated.Value(0))).current;return e.useEffect(()=>{if(a)return;let e=u.map((e,t)=>n.Animated.loop(n.Animated.sequence([n.Animated.delay(t*Om),n.Animated.timing(e,{toValue:1,duration:Lm*.4,useNativeDriver:true}),n.Animated.timing(e,{toValue:0,duration:Lm*.6,useNativeDriver:true}),n.Animated.delay((Bm-t-1)*Om)])));for(let t of e)t.start();return()=>{for(let t of e)t.stop()}},[a,u]),/* @__PURE__ */t.jsx(n.View,{style:l?o.readingInline:o.readingBox,accessible:true,accessibilityRole:"text",accessibilityLabel:s,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:u.map((e,r)=>/* @__PURE__ */t.jsx(n.Animated.View,{accessibilityElementsHidden:true,importantForAccessibility:"no",style:[l?o.readingDotInline:o.readingDot,a?{opacity:Dm}:{opacity:e.interpolate({inputRange:[0,1],outputRange:[Vm,1]}),transform:[{translateY:e.interpolate({inputRange:[0,1],outputRange:[0,-3]})}]}]},r))})}function Hm(e,t,r){let n=e-r,l=t!=null?Math.min(n,t):n;return Math.max(0,l)}function Wm(e){let t=e.length-1,r=e[t];if(r===void 0||r.role!=="assistant")return null;let n=e[t-1];return{assistantIndex:t,userIndex:n!==void 0&&n.role==="user"?t-1:null}}function Nm(e,t,r){let n=Math.max(0,r),l=e===null?n:Math.min(Math.max(0,e),n);return l>t+1?l:null}var Um=16;function $m(t,r,n=null){let l=e.useRef(null),i=e.useRef(true),o=e.useRef(r),a=e.useRef(0),s=e.useRef(0),u=e.useRef(0),c=e.useRef(/* @__PURE__ */new Map),d=e.useRef(null),p=e.useRef(false),f=t[0]?.id??null,h=e.useRef(f),b=e.useRef(null);e.useEffect(()=>{let e=h.current;if(h.current=f,e===null||e===f||(b.current=null,i.current||!t.some(t=>t.id===e)))return;let r=c.current.get(e);r!==void 0&&(b.current={id:e,top:r,offset:a.current})},[f,t]);let g=Wm(t),m=g===null?null:t[g.assistantIndex]?.id??null,y=g===null||g.userIndex===null?null:t[g.userIndex]?.id??null,v=e.useCallback(()=>{let e=l.current;if(e===null||!i.current||s.current===0)return;let t=null;if(m!==null){let e=c.current.get(m);if(e===void 0)return;let r=y===null?null:c.current.get(y)??null;t=Hm(e,r,96)}let r=Nm(t,a.current,u.current-s.current);if(r!==null&&(a.current=r,e.scrollTo({y:r,animated:false})),!p.current||d.current===null)return;let n=Nm(d.current+Um-s.current,a.current,u.current-s.current);n!==null&&(a.current=n,e.scrollTo({y:n,animated:false}))},[m,y]);e.useEffect(()=>{p.current=n!==null,n===null&&(d.current=null),v()},[n,v]),e.useEffect(()=>{r&&!o.current&&(i.current=true,p.current=false),o.current=r,v()},[t,r,v]);let x=e.useCallback(e=>{s.current=e.nativeEvent.layout.height,v()},[v]),w=e.useCallback((e,t)=>{u.current=t,s.current>0&&(a.current=Math.min(a.current,Math.max(0,t-s.current))),v()},[v]),k=e.useCallback(e=>{a.current=e.nativeEvent.contentOffset.y},[]),S=e.useCallback(()=>{i.current=false,p.current=false},[]),C=e.useCallback(e=>{let{contentOffset:t,contentSize:r,layoutMeasurement:n}=e.nativeEvent;a.current=t.y,i.current=r.height-t.y-n.height<=24},[]),j=e.useCallback(e=>t=>{let r=t.nativeEvent.layout.y;c.current.set(e,r);let n=b.current;if(n!==null&&n.id===e&&r!==n.top){b.current=null;let e=Math.max(0,n.offset+r-n.top);a.current=e,l.current?.scrollTo({y:e,animated:false})}(e===m||e===y)&&v()},[m,y,v]),R=e.useCallback(e=>{let{y:t,height:r}=e.nativeEvent.layout;d.current=t+r,v()},[v]);return{ref:l,onLayout:x,onContentSizeChange:w,onScroll:k,onScrollBeginDrag:S,onScrollEnd:C,rowLayout:j,asideLayout:R}}function qm(e,r,n){switch(e){case"loading":return n.renderPending?/* @__PURE__ */t.jsx(HostRender,{render:n.renderPending,fallback:/* @__PURE__ */t.jsx(LoadingState,{})}):/* @__PURE__ */t.jsx(LoadingState,{});case"empty":/* @__PURE__ */
315
+ return t.jsx(EmptyState,{pet:n.shownPet,petRef:r.petRef,onSelectPrompt:n.onSelectPrompt,onVetPrep:n.onVetPrep,vet:n.vet,top:n.threadTop,pendingCheckin:n.pendingCheckin??null,topCard:n.topCard,starterPrompts:n.starterPrompts,emptyState:n.emptyState,centered:n.emptyCentered===true,renderEmptyHeader:n.renderEmptyHeader});case"error":/* @__PURE__ */
316
316
  return t.jsx(ErrorState,{error:r.error,onRetry:r.retryLast,onAddPet:n.onAddPet});case"populated":/* @__PURE__ */
317
- return t.jsx(PopulatedState,{messages:r.messages,prompts:Jr(r,n.followUpPolicy),actions:n.answerCards?Ob(r,n.answerCards):$m,answerCards:n.answerCards??null,threadTop:n.threadTop,pendingCheckin:n.pendingCheckin??null,threadAside:n.threadAside,threadAsideKey:n.threadAsideKey??null,threadFoot:n.threadFoot??null,onSelectPrompt:n.onSelectPrompt,isStreaming:r.isStreaming,onAnswerCheckin:r.petRef?r.answerCheckin:null,onCopy:n.onCopy,sentimentByMessage:r.sentimentByMessage,onSentiment:n.onSentiment,feedbackNote:n.feedbackNote,imagesByMessage:n.imagesByMessage,onPreview:n.onPreview,notice:n.notice,reconnecting:r.reconnecting===true,onRetry:r.retryLast,onStartNew:r.newConversation,petRef:r.petRef,onFindVet:n.onCheckinFindVet,vet:n.vet,onOpenUrl:n.onOpenUrl,petName:n.shownPet?.name??null,followUpLabel:n.followUpPolicy?.label,openingCard:n.openingCard,earlier:r.historyCursor?{loading:r.isLoadingHistory,load:r.loadOlderMessages}:null});default:return assertNever(e)}}function LoadingState(){let{theme:r,styles:l}=eu(),[i,o]=e.useState(false);return e.useEffect(()=>{let e=setTimeout(()=>o(true),ns);return()=>clearTimeout(e)},[]),/* @__PURE__ */t.jsx(n.View,{style:l.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:pe.loading,children:i?/* @__PURE__ */t.jsx(n.ActivityIndicator,{color:r.color.brandInk}):null})}function EmptyState({pet:e,petRef:petRef,onSelectPrompt:r,onVetPrep:l,vet:i,top:o,topCard:a,pendingCheckin:s,starterPrompts:u,emptyState:c,centered:d,foot:p,renderEmptyHeader:f}){let{styles:h}=eu(),b=mp(),g=f===void 0?null:/* @__PURE__ */t.jsx(n.View,{testID:"everfur-empty-header",children:/* @__PURE__ */t.jsx(HostRender,{render:()=>f({ask:r}),fallback:null})});if(b!==null){let{minHeight:d,...f}=b.view(".ask-empty");/* @__PURE__ */
318
- return t.jsxs(n.ScrollView,{contentContainerStyle:[f,h.homeEmpty],keyboardShouldPersistTaps:"handled",keyboardDismissMode:Gm,nestedScrollEnabled:true,accessibilityLabel:pe.empty,children:[o!=null?/* @__PURE__ */t.jsx(n.View,{style:b.view(".ask-top"),children:o}):null,s,a??null,g,
319
- /* @__PURE__ */t.jsx(n.View,{style:b.view(".ask-start"),children:/* @__PURE__ */t.jsx(QuickPrompts,{pet:e,petRef:petRef,onSend:r,onVetPrep:l,vet:i,starterPrompts:u,emptyState:c,centered:true})}),p]})}
317
+ return t.jsx(PopulatedState,{messages:r.messages,prompts:Jr(r,n.followUpPolicy),actions:n.answerCards?Db(r,n.answerCards):Km,answerCards:n.answerCards??null,threadTop:n.threadTop,pendingCheckin:n.pendingCheckin??null,threadAside:n.threadAside,threadAsideKey:n.threadAsideKey??null,onSelectPrompt:n.onSelectPrompt,isStreaming:r.isStreaming,onAnswerCheckin:r.petRef?r.answerCheckin:null,onCopy:n.onCopy,sentimentByMessage:r.sentimentByMessage,onSentiment:n.onSentiment,feedbackNote:n.feedbackNote,imagesByMessage:n.imagesByMessage,onPreview:n.onPreview,notice:n.notice,reconnecting:r.reconnecting===true,onRetry:r.retryLast,onStartNew:r.newConversation,petRef:r.petRef,onFindVet:n.onCheckinFindVet,vet:n.vet,onOpenUrl:n.onOpenUrl,petName:n.shownPet?.name??null,followUpLabel:n.followUpPolicy?.label,openingCard:n.openingCard,earlier:r.historyCursor?{loading:r.isLoadingHistory,load:r.loadOlderMessages}:null});default:return assertNever(e)}}function LoadingState(){let{theme:r,styles:l}=ru(),[i,o]=e.useState(false);return e.useEffect(()=>{let e=setTimeout(()=>o(true),ss);return()=>clearTimeout(e)},[]),/* @__PURE__ */t.jsx(n.View,{style:l.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:pe.loading,children:i?/* @__PURE__ */t.jsx(n.ActivityIndicator,{color:r.color.brandInk}):null})}function EmptyState({pet:e,petRef:petRef,onSelectPrompt:r,onVetPrep:l,vet:i,top:o,topCard:a,pendingCheckin:s,starterPrompts:u,emptyState:c,centered:d,renderEmptyHeader:p}){let{styles:f}=ru(),h=vp(),b=p===void 0?null:/* @__PURE__ */t.jsx(n.View,{testID:"everfur-empty-header",children:/* @__PURE__ */t.jsx(HostRender,{render:()=>p({ask:r}),fallback:null})});if(h!==null){let{minHeight:d,...p}=h.view(".ask-empty");/* @__PURE__ */
318
+ return t.jsxs(n.ScrollView,{contentContainerStyle:[p,f.homeEmpty],keyboardShouldPersistTaps:"handled",keyboardDismissMode:Qm,nestedScrollEnabled:true,accessibilityLabel:pe.empty,children:[o!=null?/* @__PURE__ */t.jsx(n.View,{style:h.view(".ask-top"),children:o}):null,s,a??null,b,
319
+ /* @__PURE__ */t.jsx(n.View,{style:h.view(".ask-start"),children:/* @__PURE__ */t.jsx(QuickPrompts,{pet:e,petRef:petRef,onSend:r,onVetPrep:l,vet:i,starterPrompts:u,emptyState:c,centered:true})})]})}
320
320
  /* @__PURE__ */
321
- return t.jsxs(n.ScrollView,{contentContainerStyle:h.emptyContent,keyboardShouldPersistTaps:"handled",keyboardDismissMode:Gm,nestedScrollEnabled:true,accessibilityLabel:pe.empty,children:[o??null,s,a??null,g,
322
- /* @__PURE__ */t.jsx(QuickPrompts,{pet:e,petRef:petRef,onSend:r,onVetPrep:l,vet:i,starterPrompts:u,emptyState:c,centered:d}),p]})}function FollowUps({prompts:e,onSelectPrompt:r,label:l}){let{styles:i}=eu();return e.length===0?null:/* @__PURE__ */t.jsxs(n.View,{style:i.followUps,children:[
323
- /* @__PURE__ */t.jsx(Text,{tier:"compact",style:i.followUpsHeading,accessibilityRole:"header",children:l??pe.followUpsHeadingNative}),e.map((e,n)=>/* @__PURE__ */t.jsx(FollowUpRow,{prompt:e,index:n,onSelectPrompt:r},e))]})}function FollowUpRow({prompt:e,index:r,onSelectPrompt:l}){let{theme:i,styles:o}=eu(),a=Di(),s=Ki(a.followUpInMs,{delayMs:Oi(a,r)});/* @__PURE__ */
321
+ return t.jsxs(n.ScrollView,{contentContainerStyle:f.emptyContent,keyboardShouldPersistTaps:"handled",keyboardDismissMode:Qm,nestedScrollEnabled:true,accessibilityLabel:pe.empty,children:[o??null,s,a??null,b,
322
+ /* @__PURE__ */t.jsx(QuickPrompts,{pet:e,petRef:petRef,onSend:r,onVetPrep:l,vet:i,starterPrompts:u,emptyState:c,centered:d})]})}function FollowUps({prompts:e,onSelectPrompt:r,label:l}){let{styles:i}=ru();return e.length===0?null:/* @__PURE__ */t.jsxs(n.View,{style:i.followUps,children:[
323
+ /* @__PURE__ */t.jsx(Text,{tier:"compact",style:i.followUpsHeading,accessibilityRole:"header",children:l??pe.followUpsHeadingNative}),e.map((e,n)=>/* @__PURE__ */t.jsx(FollowUpRow,{prompt:e,index:n,onSelectPrompt:r},e))]})}function FollowUpRow({prompt:e,index:r,onSelectPrompt:l}){let{theme:i,styles:o}=ru(),a=Ui(),s=Xi(a.followUpInMs,{delayMs:Wi(a,r)});/* @__PURE__ */
324
324
  return t.jsx(n.Animated.View,{style:s,children:/* @__PURE__ */t.jsxs(PressScale,{onPress:()=>l(e),accessibilityRole:"button",accessibilityLabel:e,containerStyle:[o.followUpSlot,r>0?o.followUpSlotRuled:null],style:o.followUpRow,children:[
325
325
  /* @__PURE__ */t.jsx(Text,{tier:"control",style:o.followUpText,children:e}),
326
- /* @__PURE__ */t.jsx(PlusGlyph,{size:Km,color:i.slots.chip?.textColor??i.color.text.muted,strokeWidth:1.75})]})})}function ErrorState({error:e,onRetry:r,onAddPet:l}){let{styles:i}=eu(),o=hl(e)?wr(l):void 0,a=Nr(e);/* @__PURE__ */
326
+ /* @__PURE__ */t.jsx(PlusGlyph,{size:Zm,color:i.slots.chip?.textColor??i.color.text.muted,strokeWidth:1.75})]})})}function ErrorState({error:e,onRetry:r,onAddPet:l}){let{styles:i}=ru(),o=hl(e)?wr(l):void 0,a=Nr(e);/* @__PURE__ */
327
327
  return t.jsxs(n.View,{style:i.centered,accessible:true,accessibilityRole:"alert",children:[a!==null?/* @__PURE__ */t.jsx(Text,{style:i.errorText,testID:"everfur-chat-cap-reached",children:a.reached}):null,
328
- /* @__PURE__ */t.jsx(Text,{style:i.errorText,children:e.displayMessage}),a!==null&&a.guidance!==null?/* @__PURE__ */t.jsx(Text,{style:i.errorText,testID:"everfur-chat-cap-guidance",children:a.guidance}):null,o!==void 0?/* @__PURE__ */t.jsx(n.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:pe.addPet,style:i.retryButton,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:i.retryLabel,children:pe.addPet})}):null,e.retryable?/* @__PURE__ */t.jsx(n.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:pe.retry,style:i.retryButton,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:i.retryLabel,children:pe.retry})}):null]})}function PopulatedState({messages:r,prompts:l,onSelectPrompt:i,isStreaming:o,onAnswerCheckin:a,onCopy:s,sentimentByMessage:u,onSentiment:c,feedbackNote:d,imagesByMessage:p,onPreview:f,notice:h,reconnecting:b,onRetry:g,onStartNew:m,petRef:petRef,onFindVet:y,vet:v,onOpenUrl:x,petName:w,actions:k,answerCards:S,threadTop:C,pendingCheckin:j,threadAside:R,threadAsideKey:T,threadFoot:_,followUpLabel:z,openingCard:I,earlier:P}){let{styles:E}=eu(),M=Di();ro(r.length,M);let F=e.useMemo(()=>cb(ub(r)),[r]),A=qr(r,o),L=r[r.length-1],O=R??null,V=Wm(r,o,O===null?null:T??"shown"),D=Zi(r),B=r[0],H=I!==void 0&&B!==void 0&&B.role==="user"&&B.text.trim()===I.prompt?B.id:null;/* @__PURE__ */
329
- return t.jsxs(n.ScrollView,{ref:V.ref,style:E.list,contentContainerStyle:S!==null?E.listContentCards:E.listContent,accessibilityLabel:pe.transcript,keyboardShouldPersistTaps:"handled",keyboardDismissMode:Gm,nestedScrollEnabled:true,onLayout:V.onLayout,onContentSizeChange:V.onContentSizeChange,onScroll:V.onScroll,scrollEventThrottle:qm,onScrollBeginDrag:V.onScrollBeginDrag,onScrollEndDrag:V.onScrollEnd,onMomentumScrollEnd:V.onScrollEnd,children:[C??null,j,P!==null?/* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>{P.load()},disabled:P.loading,accessibilityRole:"button",accessibilityLabel:P.loading?Jl.loadingEarlier:Jl.earlier,accessibilityState:{disabled:P.loading,busy:P.loading},hitSlop:Ss,style:E.earlierButton,children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:E.earlierLabel,children:P.loading?Jl.loadingEarlier:Jl.earlier})}):null,r.map(e=>e.id===H&&I!==void 0?/* @__PURE__ */t.jsx(OpeningCard,{card:I.card,onLayout:V.rowLayout(e.id)},e.id):e.checkin&&F.has(e.id)?/* @__PURE__ */t.jsx(CheckinCard,{message:e,checkin:e.checkin,onAnswer:a,petRef:petRef,onFindVet:y,vet:v,onLayout:V.rowLayout(e.id)},e.id):/* @__PURE__ */t.jsx(MessageRow,{onLayout:V.rowLayout(e.id),message:e,revealing:o&&e===L&&e.role==="assistant",onCopy:s,sentiment:e.responseId===void 0?null:u[String(e.responseId)]??null,onSentiment:c,note:e.responseId!==void 0&&d?.responseId===String(e.responseId)?d.kind:null,images:p[e.id]??Um,onPreview:f,onOpenUrl:x,entering:D(e.id),answerCards:S,messages:r},e.id)),b?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:E.reconnectingCaption,accessibilityRole:"text",children:pe.reconnecting}):null,A?/* @__PURE__ */t.jsx(TypingIndicator,{petName:w,inline:S!==null}):null,h!==null?/* @__PURE__ */t.jsx(TurnNoticeCard,{notice:h,onRetry:g,onStartNew:m}):null,S!==null?/* @__PURE__ */t.jsx(CardsFollowUps,{prompts:l,onSelectPrompt:i,label:z,actions:k,options:S}):/* @__PURE__ */t.jsx(FollowUps,{prompts:l,onSelectPrompt:i,label:z}),O!==null?/* @__PURE__ */t.jsx(n.View,{onLayout:V.asideLayout,children:O}):null,_]})}function TurnNoticeCard({notice:e,onRetry:r,onStartNew:l}){let{styles:i}=eu(),o=e.tone==="error";/* @__PURE__ */
328
+ /* @__PURE__ */t.jsx(Text,{style:i.errorText,children:e.displayMessage}),a!==null&&a.guidance!==null?/* @__PURE__ */t.jsx(Text,{style:i.errorText,testID:"everfur-chat-cap-guidance",children:a.guidance}):null,o!==void 0?/* @__PURE__ */t.jsx(n.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:pe.addPet,style:i.retryButton,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:i.retryLabel,children:pe.addPet})}):null,e.retryable?/* @__PURE__ */t.jsx(n.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:pe.retry,style:i.retryButton,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:i.retryLabel,children:pe.retry})}):null]})}function PopulatedState({messages:r,prompts:l,onSelectPrompt:i,isStreaming:o,onAnswerCheckin:a,onCopy:s,sentimentByMessage:u,onSentiment:c,feedbackNote:d,imagesByMessage:p,onPreview:f,notice:h,reconnecting:b,onRetry:g,onStartNew:m,petRef:petRef,onFindVet:y,vet:v,onOpenUrl:x,petName:w,actions:k,answerCards:S,threadTop:C,pendingCheckin:j,threadAside:R,threadAsideKey:T,followUpLabel:_,openingCard:z,earlier:I}){let{styles:P}=ru(),E=Ui();ao(r.length,E);let M=e.useMemo(()=>pb(db(r)),[r]),F=qr(r,o),A=r[r.length-1],L=R??null,O=$m(r,o,L===null?null:T??"shown"),V=ro(r),D=r[0],B=z!==void 0&&D!==void 0&&D.role==="user"&&D.text.trim()===z.prompt?D.id:null;/* @__PURE__ */
329
+ return t.jsxs(n.ScrollView,{ref:O.ref,style:P.list,contentContainerStyle:S!==null?P.listContentCards:P.listContent,accessibilityLabel:pe.transcript,keyboardShouldPersistTaps:"handled",keyboardDismissMode:Qm,nestedScrollEnabled:true,onLayout:O.onLayout,onContentSizeChange:O.onContentSizeChange,onScroll:O.onScroll,scrollEventThrottle:Ym,onScrollBeginDrag:O.onScrollBeginDrag,onScrollEndDrag:O.onScrollEnd,onMomentumScrollEnd:O.onScrollEnd,children:[C??null,j,I!==null?/* @__PURE__ */t.jsx(n.Pressable,{onPress:()=>{I.load()},disabled:I.loading,accessibilityRole:"button",accessibilityLabel:I.loading?ni.loadingEarlier:ni.earlier,accessibilityState:{disabled:I.loading,busy:I.loading},hitSlop:_s,style:P.earlierButton,children:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:P.earlierLabel,children:I.loading?ni.loadingEarlier:ni.earlier})}):null,r.map(e=>e.id===B&&z!==void 0?/* @__PURE__ */t.jsx(OpeningCard,{card:z.card,onLayout:O.rowLayout(e.id)},e.id):e.checkin&&M.has(e.id)?/* @__PURE__ */t.jsx(CheckinCard,{message:e,checkin:e.checkin,onAnswer:a,petRef:petRef,onFindVet:y,vet:v,onLayout:O.rowLayout(e.id)},e.id):/* @__PURE__ */t.jsx(MessageRow,{onLayout:O.rowLayout(e.id),message:e,revealing:o&&e===A&&e.role==="assistant",onCopy:s,sentiment:e.responseId===void 0?null:u[String(e.responseId)]??null,onSentiment:c,note:e.responseId!==void 0&&d?.responseId===String(e.responseId)?d.kind:null,images:p[e.id]??Gm,onPreview:f,onOpenUrl:x,entering:V(e.id),answerCards:S,messages:r},e.id)),b?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:P.reconnectingCaption,accessibilityRole:"text",children:pe.reconnecting}):null,F?/* @__PURE__ */t.jsx(TypingIndicator,{petName:w,inline:S!==null}):null,h!==null?/* @__PURE__ */t.jsx(TurnNoticeCard,{notice:h,onRetry:g,onStartNew:m}):null,S!==null?/* @__PURE__ */t.jsx(CardsFollowUps,{prompts:l,onSelectPrompt:i,label:_,actions:k,options:S}):/* @__PURE__ */t.jsx(FollowUps,{prompts:l,onSelectPrompt:i,label:_}),L!==null?/* @__PURE__ */t.jsx(n.View,{onLayout:O.asideLayout,children:L}):null]})}function TurnNoticeCard({notice:e,onRetry:r,onStartNew:l}){let{styles:i}=ru(),o=e.tone==="error";/* @__PURE__ */
330
330
  return t.jsxs(n.View,{style:[i.turnNotice,o?i.turnNoticeError:null],accessible:true,accessibilityRole:"alert",children:[
331
331
  /* @__PURE__ */t.jsx(Text,{tier:"control",style:[i.turnNoticeTitle,o?i.turnNoticeTitleError:null],children:e.title}),
332
332
  /* @__PURE__ */t.jsx(Text,{tier:"compact",style:i.turnNoticeBody,children:e.body}),e.guidance!==void 0?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:i.turnNoticeBody,testID:"everfur-chat-cap-guidance",children:e.guidance}):null,
333
- /* @__PURE__ */t.jsx(n.Pressable,{onPress:e.action==="startNew"?l:r,accessibilityRole:"button",accessibilityLabel:e.actionLabel,hitSlop:Ss,style:i.turnNoticeAction,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:i.turnNoticeActionLabel,children:e.actionLabel})})]})}var Um=/* @__PURE__ */Object.freeze([]),$m=/* @__PURE__ */Object.freeze([]),qm=16,Gm=n.Platform.OS==="ios"?"interactive":"on-drag",Km=18;function MessageRow({message:r,revealing:l,onCopy:i,sentiment:o,onSentiment:a,note:s,images:u,onPreview:c,onOpenUrl:d,onLayout:p,entering:f,answerCards:h,messages:b}){let{theme:g,styles:m}=eu(),y=Di(),v=Qi(f,y),x=Xi(r.text,l,y),w=r.role==="user",k=r.role==="vet",S=r.role==="assistant",C=_i(),j=S&&!l?C:void 0,R=j!==void 0&&Kb(r.text,j),T=S&&!g.meta.hidePoweredBy,_=w?pe.senderUser:k?Xr(r):T?pe.assistantName:pe.senderAssistant,z=k?bb(r.createdAt):null,I=e.useCallback(e=>a(r,e),[a,r]),P=r.pending!==true,E=S&&g.meta.assistantAvatarUrl!==null?/* @__PURE__ */t.jsx(AssistantSender,{avatarUrl:g.meta.assistantAvatarUrl,named:T,styles:m}):T?h!==null?/* @__PURE__ */t.jsx(CardsByline,{label:pe.assistantName}):/* @__PURE__ */t.jsx(Text,{tier:"control",style:m.assistantName,children:pe.assistantName}):null,M=h!==null;return S&&h!==null?/* @__PURE__ */t.jsx(n.Animated.View,{style:[m.rowBlock,v],onLayout:p,accessibilityLabel:`${_}: ${r.text}`,children:/* @__PURE__ */t.jsx(CardsAnswer,{message:r,text:x,streaming:l,messages:b,options:h,sentiment:o,onSentiment:r.responseId===void 0?void 0:I,sender:E,onOpenUrl:d,footer:e=>/* @__PURE__ */t.jsx(MessageFooter,{message:r,onCopy:i,sentiment:o,onSentiment:e&&r.responseId!==void 0?I:void 0,note:s})})}):/* @__PURE__ */t.jsxs(n.View,{style:[m.rowBlock,w?m.rowBlockUser:m.rowBlockAssistant],onLayout:p,children:[
333
+ /* @__PURE__ */t.jsx(n.Pressable,{onPress:e.action==="startNew"?l:r,accessibilityRole:"button",accessibilityLabel:e.actionLabel,hitSlop:_s,style:i.turnNoticeAction,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:i.turnNoticeActionLabel,children:e.actionLabel})})]})}var Gm=/* @__PURE__ */Object.freeze([]),Km=/* @__PURE__ */Object.freeze([]),Ym=16,Qm=n.Platform.OS==="ios"?"interactive":"on-drag",Zm=18;function MessageRow({message:r,revealing:l,onCopy:i,sentiment:o,onSentiment:a,note:s,images:u,onPreview:c,onOpenUrl:d,onLayout:p,entering:f,answerCards:h,messages:b}){let{theme:g,styles:m}=ru(),y=Ui(),v=to(f,y),x=lo(r.text,l,y),w=r.role==="user",k=r.role==="vet",S=r.role==="assistant",C=Mi(),j=S&&!l?C:void 0,R=j!==void 0&&Qb(r.text,j),T=S&&!g.meta.hidePoweredBy,_=w?pe.senderUser:k?Xr(r):T?pe.assistantName:pe.senderAssistant,z=k?mb(r.createdAt):null,I=e.useCallback(e=>a(r,e),[a,r]),P=r.pending!==true,E=S&&g.meta.assistantAvatarUrl!==null?/* @__PURE__ */t.jsx(AssistantSender,{avatarUrl:g.meta.assistantAvatarUrl,named:T,styles:m}):T?h!==null?/* @__PURE__ */t.jsx(CardsByline,{label:pe.assistantName}):/* @__PURE__ */t.jsx(Text,{tier:"control",style:m.assistantName,children:pe.assistantName}):null,M=h!==null;return S&&h!==null?/* @__PURE__ */t.jsx(n.Animated.View,{style:[m.rowBlock,v],onLayout:p,accessibilityLabel:`${_}: ${r.text}`,children:/* @__PURE__ */t.jsx(CardsAnswer,{message:r,text:x,streaming:l,messages:b,options:h,sentiment:o,onSentiment:r.responseId===void 0?void 0:I,sender:E,onOpenUrl:d,footer:e=>/* @__PURE__ */t.jsx(MessageFooter,{message:r,onCopy:i,sentiment:o,onSentiment:e&&r.responseId!==void 0?I:void 0,note:s})})}):/* @__PURE__ */t.jsxs(n.View,{style:[m.rowBlock,w?m.rowBlockUser:m.rowBlockAssistant],onLayout:p,children:[
334
334
  /* @__PURE__ */t.jsx(n.View,{style:[m.row,w?m.rowUser:m.rowAssistant],accessible:!R,accessibilityRole:R?void 0:"text",accessibilityLabel:R?void 0:`${_}: ${r.text}`,accessibilityState:r.pending===true?{busy:true}:void 0,children:/* @__PURE__ */t.jsxs(n.Animated.View,{style:[m.bubble,M?m.bubbleCards:null,w?m.bubbleSideUser:null,v],children:[E,k?/* @__PURE__ */t.jsxs(n.View,{style:m.vetHeader,children:[
335
335
  /* @__PURE__ */t.jsx(Text,{tier:"control",style:m.vetSender,children:_}),z!==null?/* @__PURE__ */t.jsx(Text,{tier:"compact",style:m.vetTime,children:z}):null]}):null,
336
336
  /* @__PURE__ */t.jsxs(n.View,{style:[w?m.bubbleUser:k?m.bubbleVet:m.bubbleAssistant,w&&M?m.bubbleUserCards:null,r.pending?m.bubblePending:null],children:[w&&u.length>0?/* @__PURE__ */t.jsx(SentImages,{images:u,onPreview:e=>c({uri:e.uri,label:e.filename})}):null,
337
- /* @__PURE__ */t.jsx(Text,{style:w?M?[m.bubbleTextUser,m.bubbleTextUserCards]:m.bubbleTextUser:k?m.bubbleTextVet:m.bubbleTextAssistant,children:S?Yb(x,{bold:m.bubbleBold,italic:m.bubbleItalic,code:m.bubbleCode},j):r.text})]})]})}),S&&!l?/* @__PURE__ */t.jsx(CitationCards,{citations:r.citations,onOpenUrl:d}):null,P&&!(w&&h!==null)?/* @__PURE__ */t.jsx(MessageFooter,{message:r,onCopy:i,sentiment:o,onSentiment:r.responseId===void 0?void 0:I,note:s}):null]})}var Ym=/* @__PURE__ */new Set(["emergency","schedule_soon"]);function textingAskThreadReady(e){if(e.isBootstrapping===true||e.isLoadingHistory===true||e.isStreaming===true||e.status==="error"||e.stopped===true)return false;let t=e.messages[e.messages.length-1];return t===void 0||t.role!=="assistant"||t.pending===true||t.checkin!==void 0||t.text.trim().length===0?false:!(typeof t.urgencyLevel=="string"&&Ym.has(t.urgencyLevel))}var NO_SNAPSHOT2=()=>null;function Qm(){let{runtime:t}=we(),r=t.entitlements??null,n=e.useCallback(e=>r===null?()=>{}:r.subscribe(e),[r]),l=r===null?NO_SNAPSHOT2:r.getSnapshot,i=e.useSyncExternalStore(n,l,l);return e.useMemo(()=>i!==null&&decideCapability("texting",i.decisions,{isPending:i.isPending}).enabled,[i])}var Zm=/* @__PURE__ */Object.freeze({runner:null,line:null,entry:null,stage:null,headerEntry:null});function Jm(r,n,l=false){let[i,o]=e.useState(null);if(!r)return Zm;let a=/* @__PURE__ */t.jsx(AskRunner,{ready:textingAskThreadReady(n),onAsk:o,entry:l}),u=l&&i!==null&&i.canOpen?{label:s.textingAskLines(i).accept,onOpen:i.open}:null;if(i===null||i.stage==="hidden"||i.stage==="dismissed")return{runner:a,line:null,entry:null,stage:null,headerEntry:u};let c=s.textingAskLines(i),d=/* @__PURE__ */t.jsx(AskLine,{stage:i.stage,text:i.stage==="verified"?c.verified:c.line,accept:c.accept,dismiss:c.dismiss,onAccept:i.accept,onDismiss:i.dismiss}),p=i.stage==="enrolling"?/* @__PURE__ */t.jsx(s.ChatTextingAskComposer,{ask:i}):null;return{runner:a,line:d,entry:p,stage:i.stage,headerEntry:u}}function AskRunner({ready:r,onAsk:n,entry:l}){let{userRef:userRef}=we(),i=Qm(),o=userRef!==null&&i;return e.useEffect(()=>{o||n(null)},[o,n]),o?/* @__PURE__ */t.jsx(s.ChatTextingAskController,{enabled:true,ready:r,onAsk:n,entry:l}):null}function AskLine({stage:e,text:r,accept:l,dismiss:i,onAccept:o,onDismiss:a}){let{theme:s,styles:u}=eu(),c=!s.meta.hidePoweredBy,d=c?pe.assistantName:pe.senderAssistant,p=s.meta.assistantAvatarUrl!==null?/* @__PURE__ */t.jsx(AssistantSender,{avatarUrl:s.meta.assistantAvatarUrl,named:c,styles:u}):c?/* @__PURE__ */t.jsx(Text,{tier:"control",style:u.assistantName,children:pe.assistantName}):null;/* @__PURE__ */
337
+ /* @__PURE__ */t.jsx(Text,{style:w?M?[m.bubbleTextUser,m.bubbleTextUserCards]:m.bubbleTextUser:k?m.bubbleTextVet:m.bubbleTextAssistant,children:S?Zb(x,{bold:m.bubbleBold,italic:m.bubbleItalic,code:m.bubbleCode},j):r.text})]})]})}),S&&!l?/* @__PURE__ */t.jsx(CitationCards,{citations:r.citations,onOpenUrl:d}):null,P&&!(w&&h!==null)?/* @__PURE__ */t.jsx(MessageFooter,{message:r,onCopy:i,sentiment:o,onSentiment:r.responseId===void 0?void 0:I,note:s}):null]})}var Jm=/* @__PURE__ */new Set(["emergency","schedule_soon"]);function textingAskThreadReady(e){if(e.isBootstrapping===true||e.isLoadingHistory===true||e.isStreaming===true||e.status==="error"||e.stopped===true)return false;let t=e.messages[e.messages.length-1];return t===void 0||t.role!=="assistant"||t.pending===true||t.checkin!==void 0||t.text.trim().length===0?false:!(typeof t.urgencyLevel=="string"&&Jm.has(t.urgencyLevel))}var NO_SNAPSHOT2=()=>null;function Xm(){let{runtime:t}=we(),r=t.entitlements??null,n=e.useCallback(e=>r===null?()=>{}:r.subscribe(e),[r]),l=r===null?NO_SNAPSHOT2:r.getSnapshot,i=e.useSyncExternalStore(n,l,l);return e.useMemo(()=>i!==null&&decideCapability("texting",i.decisions,{isPending:i.isPending}).enabled,[i])}var ey=/* @__PURE__ */Object.freeze({runner:null,line:null,entry:null,stage:null,headerEntry:null});function ty(r,n,l=false){let[i,o]=e.useState(null);if(!r)return ey;let a=/* @__PURE__ */t.jsx(AskRunner,{ready:textingAskThreadReady(n),onAsk:o,entry:l}),u=l&&i!==null&&i.canOpen?{label:s.textingAskLines(i).accept,onOpen:i.open}:null;if(i===null||i.stage==="hidden"||i.stage==="dismissed")return{runner:a,line:null,entry:null,stage:null,headerEntry:u};let c=s.textingAskLines(i),d=/* @__PURE__ */t.jsx(AskLine,{stage:i.stage,text:i.stage==="verified"?c.verified:c.line,accept:c.accept,dismiss:c.dismiss,onAccept:i.accept,onDismiss:i.dismiss}),p=i.stage==="enrolling"?/* @__PURE__ */t.jsx(s.ChatTextingAskComposer,{ask:i}):null;return{runner:a,line:d,entry:p,stage:i.stage,headerEntry:u}}function AskRunner({ready:r,onAsk:n,entry:l}){let{userRef:userRef}=we(),i=Xm(),o=userRef!==null&&i;return e.useEffect(()=>{o||n(null)},[o,n]),o?/* @__PURE__ */t.jsx(s.ChatTextingAskController,{enabled:true,ready:r,onAsk:n,entry:l}):null}function AskLine({stage:e,text:r,accept:l,dismiss:i,onAccept:o,onDismiss:a}){let{theme:s,styles:u}=ru(),c=!s.meta.hidePoweredBy,d=c?pe.assistantName:pe.senderAssistant,p=s.meta.assistantAvatarUrl!==null?/* @__PURE__ */t.jsx(AssistantSender,{avatarUrl:s.meta.assistantAvatarUrl,named:c,styles:u}):c?/* @__PURE__ */t.jsx(Text,{tier:"control",style:u.assistantName,children:pe.assistantName}):null;/* @__PURE__ */
338
338
  return t.jsxs(n.View,{style:[u.rowBlock,u.rowBlockAssistant],testID:`everfur-texting-ask-${e}`,children:[
339
339
  /* @__PURE__ */t.jsx(n.View,{style:[u.row,u.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${d}: ${r}`,children:/* @__PURE__ */t.jsxs(n.View,{style:u.bubble,children:[p,
340
- /* @__PURE__ */t.jsx(n.View,{style:u.bubbleAssistant,children:/* @__PURE__ */t.jsx(Text,{style:u.bubbleTextAssistant,children:r})})]})}),e==="offered"?/* @__PURE__ */t.jsx(n.View,{style:u.askChips,children:[{label:l,onPress:o,testID:"everfur-texting-ask-accept"},{label:i,onPress:a,testID:"everfur-texting-ask-dismiss"}].map(e=>/* @__PURE__ */t.jsx(PressScale,{onPress:e.onPress,accessibilityRole:"button",accessibilityLabel:e.label,style:u.askChip,testID:e.testID,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:u.askChipText,children:e.label})},e.testID))}):null]})}function Xm(){let t=/* @__PURE__ */Symbol.for("@everfur/sdk#SdkSurfaceHooks@v1"),r=globalThis;return r[t]??(r[t]=e.createContext(null))}var ey=/* @__PURE__ */Xm();function ty(e){return typeof e=="object"&&e!==null&&e.ok===true}function ry(e){if(typeof e!="object"||e===null)return null;let t=e;return t.ok!==false||typeof t.error!="object"||t.error===null?null:Xe(t.error)}function ny(t){let r=e.useContext(ey),n=r?.onMessageSent,l=r?.onFreeCapReached,i=e.useCallback((...e)=>{let r=t(...e);return Promise.resolve(r).then(e=>{try{if(ty(e)){n?.();return}let t=l===void 0?null:ry(e);t!==null&&l?.(t)}catch{}},()=>{}),r},[t,n,l]);return n===void 0&&l===void 0?t:i}function EverfurChatCore(e){let{style:r,renderPending:n}=e;/* @__PURE__ */
341
- return t.jsx(CapabilityGate,{capability:"chat",style:r,...n?{renderPending:n}:{},children:/* @__PURE__ */t.jsx(MessageLinksScope,{linkHosts:e.linkHosts,onOpenUrl:e.onOpenUrl,children:/* @__PURE__ */t.jsx(ChatBody,{...e})})})}function ly(){try{return we()}catch{return null}}function iy(e){return Hr({...e.presentation,chatComposerMic:e.presentation?.chatComposerMic??(e.dictation===void 0?void 0:e.dictation!==false),chatComposerUpload:e.presentation?.chatComposerUpload??(e.attachments===void 0?void 0:true)})}function ChatBody(e){let r=ly();return r===null?/* @__PURE__ */t.jsx(ChatBodyAlone,{...e}):/* @__PURE__ */t.jsx(ChatBodyInProvider,{...e,activePet:r.activePet,telemetry:r.runtime.registry?.services?.telemetry??null})}function ChatBodyAlone(r){let n=iy(r),l=JSON.stringify(n),i=r.petRef??null,o=e.useMemo(()=>({presentation:resolvePresentation({server:null,locked:null,client:n}),isLocked:()=>false,planPage:null,planPetRef:i,inProvider:false,telemetry:null}),[l,i]);/* @__PURE__ */
342
- return t.jsx(ChatSurface,{...r,settings:o})}function ChatBodyInProvider({activePet:r,telemetry:n,...l}){let{presentation:i,isLocked:isLocked}=Br(iy(l)),o=Mr("healthPlan"),a=i.chatTopCard==="focus"&&l.topCard===void 0&&o,s=l.petRef??r??null,u=useHealthPlanPage({petRef:s,enabled:a}),c=a&&u.phase==="ready"?u.page:null,d=e.useMemo(()=>({presentation:i,isLocked:isLocked,planPage:c,planPetRef:s,inProvider:true,telemetry:n}),[i,isLocked,c,s,n]);/* @__PURE__ */
343
- return t.jsx(ChatSurface,{...l,settings:d})}function ChatSurface({settings:r,petRef:petRef,conversationId:conversationId,style:i,renderPending:o,onCopy:a,onPetChange:s,onVetPrep:u,onFindVet:c,renderVetAction:d,attachments:p,pet:f,onAddPet:h,checkinTarget:b,handoffToken:g,initialAsk:m,initialAskKey:y,composerSeed:v,lifecycle:x,refreshIntervalMs:w,refreshesBlankThread:k,openUnreadOnRefresh:S,draftStore:C,vetReturnTo:j,vetUsState:R,vetPrefer:T,onOpenUrl:_,keyboardVerticalOffset:z,topCard:I,onOpenHealthPlan:P,answerCards:E,historySheet:M,historyBar:F,starterPrompts:A,emptyState:L,header:O=true,textingEntry:V=true,renderEmptyHeader:D,followUpPolicy:B,initialAskCard:H}){let{presentation:W,isLocked:isLocked,planPage:N,planPetRef:U}=r,{theme:$,styles:q}=eu(),G=gp()??(W.chatAnswerStyle==="cards"?dh:null),K=e.useMemo(()=>G===null?null:G($),[G,$]),Y=useHostPoweredBy(),Q=Di(),Z=e.useMemo(()=>en(petRef,conversationId),[petRef,conversationId]),J=useEverfurChat(Z),X=ny(J.send),ee=e.useMemo(()=>X===J.send?J:{...J,send:X},[J,X]),te=Wr(ee),re=nb(),ne=ai(ee),le=l.useSafeAreaInsets(),ie=$r(ee,"web"),oe=e.useMemo(()=>c===void 0?void 0:()=>{vr(c,"emergency")},[c]),ae=e.useMemo(()=>j===void 0&&R===void 0&&T===void 0?void 0:{returnTo:j,usState:R,prefer:T},[j,R,T]),se=Qd(re.pets,ee.petRef),ue=e.useMemo(()=>fi(ee.messages,se?.name??null),[ee.messages,se?.name]),ce=bi(ue);ib(ee),ro(ce.showBanner,Q);let de=ly(),fe=Yl(g,de);Zl(ee.openCheckin,b??fe,{petRef:ee.petRef,pinned:petRef!==void 0,ready:!ee.isBootstrapping,selectPet:e=>{re.setActivePet(e),vr(s,e)}}),Cl(ee.askEverfur,ee.isBootstrapping,m,y);let he=e.useMemo(()=>Sl(v),[v]),ge=e.useMemo(()=>Sl(m),[m]),me=e.useMemo(()=>H!==void 0&&ge!==null?{card:H,prompt:ge}:void 0,[H,ge]),ye=e.useMemo(()=>x===void 0?createAppStateLifecycle():x??void 0,[x]);Pl(ye,{conversationId:ee.conversationId===null?null:String(ee.conversationId),isTurnInFlight:ee.isStreaming,refreshesBlankThread:k===true||S===true,refresh:ee.refreshActiveThread===void 0?void 0:()=>ee.refreshActiveThread?.(S===true?Tl:_l)??Promise.resolve()},{intervalMs:w===void 0?3e4:w,isVisibleFallback:fo});let ve=ee.pendingCheckin??null,xe=ve===null?null:/* @__PURE__ */t.jsx(n.View,{testID:"everfur-pending-checkin",accessibilityLiveRegion:"polite",children:/* @__PURE__ */t.jsx(CheckinCard,{message:ve.message,checkin:ve.checkin,onAnswer:ee.petRef?ee.answerCheckin:null,petRef:ee.petRef,onFindVet:oe,vet:ae,onOpen:()=>{ee.resumeConversation(ve.conversationId)}})}),we=(ee.hasUnreadThreads??false)||ne.rows.some(e=>e.unreadCount!==null&&e.unreadCount>0)||(ee.unreadCount??0)>0,ke=yl(ee.messages),[Se,Ce]=e.useState(null),je=e.useCallback(()=>Ce(null),[]),[Re,Te]=e.useState(null),[_e,ze]=e.useState(null),Ie=e.useRef(null);e.useEffect(()=>()=>{Ie.current&&clearTimeout(Ie.current)},[]);let Pe=e.useCallback((e,t)=>{ze({responseId:String(e),kind:t}),Ie.current&&clearTimeout(Ie.current),Ie.current=t==="thanks"?setTimeout(()=>{ze(null),Ie.current=null},ls):null},[]),Ee=e.useCallback((e,t)=>{let r=e.responseId;if(r===void 0)return;let n=ee.sentimentByMessage[String(r)];ze(e=>e?.responseId===String(r)?null:e),ee.feedback(r,t).then(e=>{e.ok||Pe(r,"failed")}),t==="down"&&n!=="down"&&Te(r)},[ee,Pe]),Me=e.useCallback(async(e,t)=>Re===null||!(e==null&&t===null?{ok:true}:await ee.feedback(Re,"down",e??"other",t)).ok?false:(Te(null),Pe(Re,"thanks"),true),[ee,Re,Pe]),Fe=e.useCallback(()=>Te(null),[]),Ae=e.useCallback(e=>{ee.send(e)},[ee.send]),Le=e.useMemo(()=>_===void 0?void 0:e=>{vr(_,e,"citation")},[_]),Oe=n.Platform.OS==="ios"?"padding":void 0,Ve=xh(z,Oe!==void 0),De=Ve.topInWindow===null?le.top:Math.max(0,le.top-Ve.topInWindow),Be=kh(),He=e.useMemo(()=>P===void 0?void 0:()=>{vr(P,U)},[P,U]),We=e.useMemo(()=>I===void 0?healthPlanTopCard(N,{onOpenPlan:He}):void 0,[I,N,He]),Ne=W.chatTopCard==="focus"?I??We:void 0,[Ue,$e]=e.useState(true),qe=e.useCallback(e=>{ee.send(e)},[ee.send]),Ge=e.useMemo(()=>nn(B,W,isLocked("chatFollowUpCount")),[B,W,isLocked]),Ke=W.chatAnswerStyle==="cards",Ye=e.useMemo(()=>Ke&&ee.messages.length===0?sy(ee.suggestedPrompts):void 0,[Ke,ee.messages.length,ee.suggestedPrompts]),Qe=W.chatHistoryStyle==="sheet",Ze=ee.messages.length===0,Je=Ne!==void 0?/* @__PURE__ */t.jsx(TopCardPill,{card:Ne,open:Ue,onOpenChange:$e}):null,Xe=F??(O?void 0:uy),et=Xe!==void 0?/* @__PURE__ */t.jsx(HistoryBar,{bar:Xe,history:ne,empty:Ze,unread:we,extra:Je}):null,tt=W.chatHistoryBar==="scroll"&&(te==="empty"||te==="populated"),rt=Ne===void 0?null:/* @__PURE__ */t.jsxs(t.Fragment,{children:[
344
- /* @__PURE__ */t.jsx(TopCard,{card:Ne,open:Ue,onOpenChange:$e,ask:qe}),Xe===void 0?Je:null]}),nt=Xe!==void 0,lt=ne.load,it=ne.open;e.useEffect(()=>{nt&&!it&&lt()},[nt,it,ee.conversationId,lt]);let ot={send:ee.send,stop:ee.stop,isStreaming:ee.isStreaming,conversationId:ee.conversationId,seed:he,draftStore:C,onStage:ke.stage,onPreview:Ce,petName:se?.name??null,petBreed:se?.breed??null,compact:W.chatComposerStyle==="compact",petPlaceholder:W.chatComposerPlaceholder==="pet_name",dimEmptySend:W.chatSendButton==="dim_when_empty",mood:cy(te,ce.source?.level??null),dictation:W.chatComposerMic,telemetry:r.telemetry},at=Jm(W.chatTextingAsk&&r.inProvider,ee,V),st=p!==void 0&&W.chatComposerUpload,ut=!W.chatGeneralBanner&&ce.source?.level==="general",ct=W.safetyDisclaimerPlacement==="none",dt=W.safetyDisclaimerPlacement==="answer_footer"&&(te==="empty"||te==="populated"),pt=/* @__PURE__ */t.jsx(Text,{tier:"compact",style:dt?q.footnoteInThread:q.footnote,accessibilityRole:"text",children:be(pe.footnoteWeb,se?.name)});
340
+ /* @__PURE__ */t.jsx(n.View,{style:u.bubbleAssistant,children:/* @__PURE__ */t.jsx(Text,{style:u.bubbleTextAssistant,children:r})})]})}),e==="offered"?/* @__PURE__ */t.jsx(n.View,{style:u.askChips,children:[{label:l,onPress:o,testID:"everfur-texting-ask-accept"},{label:i,onPress:a,testID:"everfur-texting-ask-dismiss"}].map(e=>/* @__PURE__ */t.jsx(PressScale,{onPress:e.onPress,accessibilityRole:"button",accessibilityLabel:e.label,style:u.askChip,testID:e.testID,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:u.askChipText,children:e.label})},e.testID))}):null]})}function ry(){let t=/* @__PURE__ */Symbol.for("@everfur/sdk#SdkSurfaceHooks@v1"),r=globalThis;return r[t]??(r[t]=e.createContext(null))}var ny=/* @__PURE__ */ry();function ly(e){return typeof e=="object"&&e!==null&&e.ok===true}function iy(e){if(typeof e!="object"||e===null)return null;let t=e;return t.ok!==false||typeof t.error!="object"||t.error===null?null:Xe(t.error)}function oy(t){let r=e.useContext(ny),n=r?.onMessageSent,l=r?.onFreeCapReached,i=e.useCallback((...e)=>{let r=t(...e);return Promise.resolve(r).then(e=>{try{if(ly(e)){n?.();return}let t=l===void 0?null:iy(e);t!==null&&l?.(t)}catch{}},()=>{}),r},[t,n,l]);return n===void 0&&l===void 0?t:i}function EverfurChatCore(e){let{style:r,renderPending:n}=e;/* @__PURE__ */
341
+ return t.jsx(CapabilityGate,{capability:"chat",style:r,...n?{renderPending:n}:{},children:/* @__PURE__ */t.jsx(MessageLinksScope,{linkHosts:e.linkHosts,onOpenUrl:e.onOpenUrl,children:/* @__PURE__ */t.jsx(ChatBody,{...e})})})}function ay(){try{return we()}catch{return null}}function sy(e){return Hr({...e.presentation,chatComposerMic:e.presentation?.chatComposerMic??(e.dictation===void 0?void 0:e.dictation!==false),chatComposerUpload:e.presentation?.chatComposerUpload??(e.attachments===void 0?void 0:true)})}function ChatBody(e){let r=ay();return r===null?/* @__PURE__ */t.jsx(ChatBodyAlone,{...e}):/* @__PURE__ */t.jsx(ChatBodyInProvider,{...e,activePet:r.activePet,telemetry:r.runtime.registry?.services?.telemetry??null})}function ChatBodyAlone(r){let n=sy(r),l=JSON.stringify(n),i=r.petRef??null,o=e.useMemo(()=>({presentation:resolvePresentation({server:null,locked:null,client:n}),isLocked:()=>false,planPage:null,planPetRef:i,inProvider:false,telemetry:null}),[l,i]);/* @__PURE__ */
342
+ return t.jsx(ChatSurface,{...r,settings:o})}function ChatBodyInProvider({activePet:r,telemetry:n,...l}){let{presentation:i,isLocked:isLocked}=Br(sy(l)),o=Mr("healthPlan"),a=i.chatTopCard==="focus"&&l.topCard===void 0&&o,s=l.petRef??r??null,u=useHealthPlanPage({petRef:s,enabled:a}),c=a&&u.phase==="ready"?u.page:null,d=e.useMemo(()=>({presentation:i,isLocked:isLocked,planPage:c,planPetRef:s,inProvider:true,telemetry:n}),[i,isLocked,c,s,n]);/* @__PURE__ */
343
+ return t.jsx(ChatSurface,{...l,settings:d})}function ChatSurface({settings:r,petRef:petRef,conversationId:conversationId,style:i,renderPending:o,onCopy:a,onPetChange:s,onVetPrep:u,onFindVet:c,renderVetAction:d,attachments:p,pet:f,onAddPet:h,checkinTarget:b,handoffToken:g,initialAsk:m,initialAskKey:y,composerSeed:v,lifecycle:x,refreshIntervalMs:w,refreshesBlankThread:k,openUnreadOnRefresh:S,draftStore:C,vetReturnTo:j,vetUsState:R,vetPrefer:T,onOpenUrl:_,keyboardVerticalOffset:z,topCard:I,onOpenHealthPlan:P,answerCards:E,historySheet:M,historyBar:F,starterPrompts:A,emptyState:L,header:O=true,textingEntry:V=true,renderEmptyHeader:D,followUpPolicy:B,initialAskCard:H}){let{presentation:W,isLocked:isLocked,planPage:N,planPetRef:U}=r,{theme:$,styles:q}=ru(),G=yp()??(W.chatAnswerStyle==="cards"?fh:null),K=e.useMemo(()=>G===null?null:G($),[G,$]),Y=useHostPoweredBy(),Q=Ui(),Z=e.useMemo(()=>en(petRef,conversationId),[petRef,conversationId]),J=useEverfurChat(Z),X=oy(J.send),ee=e.useMemo(()=>X===J.send?J:{...J,send:X},[J,X]),te=Wr(ee),re=ib(),ne=pi(ee),le=l.useSafeAreaInsets(),ie=$r(ee,"web"),oe=e.useMemo(()=>c===void 0?void 0:()=>{vr(c,"emergency")},[c]),ae=e.useMemo(()=>j===void 0&&R===void 0&&T===void 0?void 0:{returnTo:j,usState:R,prefer:T},[j,R,T]),se=Jd(re.pets,ee.petRef),ue=e.useMemo(()=>yi(ee.messages,se?.name??null),[ee.messages,se?.name]),ce=xi(ue);ab(ee),ao(ce.showBanner,Q);let de=ay(),fe=ei(g,de);ri(ee.openCheckin,b??fe,{petRef:ee.petRef,pinned:petRef!==void 0,ready:!ee.isBootstrapping,selectPet:e=>{re.setActivePet(e),vr(s,e)}}),Cl(ee.askEverfur,ee.isBootstrapping,m,y);let he=e.useMemo(()=>Sl(v),[v]),be=e.useMemo(()=>Sl(m),[m]),ge=e.useMemo(()=>H!==void 0&&be!==null?{card:H,prompt:be}:void 0,[H,be]),me=e.useMemo(()=>x===void 0?createAppStateLifecycle():x??void 0,[x]);Ll(me,{conversationId:ee.conversationId===null?null:String(ee.conversationId),isTurnInFlight:ee.isStreaming,refreshesBlankThread:k===true||S===true,refresh:ee.refreshActiveThread===void 0?void 0:()=>ee.refreshActiveThread?.(zl(S===true,Il(me,yo)))??Promise.resolve()},{intervalMs:w===void 0?3e4:w,isVisibleFallback:yo}),Pl({isStreaming:ee.isStreaming,status:ee.status,conversationId:ee.conversationId===null?null:String(ee.conversationId),unreadCount:ee.unreadCount,markRead:ee.markRead},()=>Il(me,yo));let ye=ee.pendingCheckin??null,ve=ye===null?null:/* @__PURE__ */t.jsx(n.View,{testID:"everfur-pending-checkin",accessibilityLiveRegion:"polite",children:/* @__PURE__ */t.jsx(CheckinCard,{message:ye.message,checkin:ye.checkin,onAnswer:ee.petRef?ee.answerCheckin:null,petRef:ee.petRef,onFindVet:oe,vet:ae,onOpen:()=>{ee.resumeConversation(ye.conversationId)}})}),xe=(ee.hasUnreadThreads??false)||ne.rows.some(e=>e.unreadCount!==null&&e.unreadCount>0)||(ee.unreadCount??0)>0,we=yl(ee.messages),[ke,Se]=e.useState(null),Ce=e.useCallback(()=>Se(null),[]),[je,Re]=e.useState(null),[Te,_e]=e.useState(null),ze=e.useRef(null);e.useEffect(()=>()=>{ze.current&&clearTimeout(ze.current)},[]);let Ie=e.useCallback((e,t)=>{_e({responseId:String(e),kind:t}),ze.current&&clearTimeout(ze.current),ze.current=t==="thanks"?setTimeout(()=>{_e(null),ze.current=null},us):null},[]),Pe=e.useCallback((e,t)=>{let r=e.responseId;if(r===void 0)return;let n=ee.sentimentByMessage[String(r)];_e(e=>e?.responseId===String(r)?null:e),ee.feedback(r,t).then(e=>{e.ok||Ie(r,"failed")}),t==="down"&&n!=="down"&&Re(r)},[ee,Ie]),Ee=e.useCallback(async(e,t)=>je===null||!(e==null&&t===null?{ok:true}:await ee.feedback(je,"down",e??"other",t)).ok?false:(Re(null),Ie(je,"thanks"),true),[ee,je,Ie]),Me=e.useCallback(()=>Re(null),[]),Fe=e.useCallback(e=>{ee.send(e)},[ee.send]),Ae=e.useMemo(()=>_===void 0?void 0:e=>{vr(_,e,"citation")},[_]),Le=n.Platform.OS==="ios"?"padding":void 0,Oe=kh(z,Le!==void 0),Ve=Oe.topInWindow===null?le.top:Math.max(0,le.top-Oe.topInWindow),De=Ch(),Be=e.useMemo(()=>P===void 0?void 0:()=>{vr(P,U)},[P,U]),He=e.useMemo(()=>I===void 0?healthPlanTopCard(N,{onOpenPlan:Be}):void 0,[I,N,Be]),We=W.chatTopCard==="focus"?I??He:void 0,[Ne,Ue]=e.useState(true),$e=e.useCallback(e=>{ee.send(e)},[ee.send]),qe=e.useMemo(()=>nn(B,W,isLocked("chatFollowUpCount")),[B,W,isLocked]),Ge=W.chatAnswerStyle==="cards",Ke=e.useMemo(()=>Ge&&ee.messages.length===0?dy(ee.suggestedPrompts):void 0,[Ge,ee.messages.length,ee.suggestedPrompts]),Ye=W.chatHistoryStyle==="sheet",Qe=ee.messages.length===0,Ze=We!==void 0?/* @__PURE__ */t.jsx(TopCardPill,{card:We,open:Ne,onOpenChange:Ue}):null,Je=F??(O?void 0:py),Xe=Je!==void 0?/* @__PURE__ */t.jsx(HistoryBar,{bar:Je,history:ne,empty:Qe,unread:xe,extra:Ze}):null,et=W.chatHistoryBar==="scroll"&&(te==="empty"||te==="populated"),tt=We===void 0?null:/* @__PURE__ */t.jsxs(t.Fragment,{children:[
344
+ /* @__PURE__ */t.jsx(TopCard,{card:We,open:Ne,onOpenChange:Ue,ask:$e}),Je===void 0?Ze:null]}),rt=Je!==void 0,nt=ne.load,lt=ne.open;e.useEffect(()=>{rt&&!lt&&nt()},[rt,lt,ee.conversationId,nt]);let it={send:ee.send,stop:ee.stop,isStreaming:ee.isStreaming,conversationId:ee.conversationId,seed:he,draftStore:C,onStage:we.stage,onPreview:Se,petName:se?.name??null,petBreed:se?.breed??null,compact:W.chatComposerStyle==="compact",petPlaceholder:W.chatComposerPlaceholder==="pet_name",dimEmptySend:W.chatSendButton==="dim_when_empty",mood:fy(te,ce.source?.level??null),dictation:W.chatComposerMic,telemetry:r.telemetry},ot=ty(W.chatTextingAsk&&r.inProvider,ee,V),at=p!==void 0&&W.chatComposerUpload,st=!W.chatGeneralBanner&&ce.source?.level==="general";
345
345
  /* @__PURE__ */
346
- return t.jsx(bp.Provider,{value:K,children:/* @__PURE__ */t.jsxs(n.KeyboardAvoidingView,{style:[q.container,{paddingTop:De},i],behavior:Oe,...Ve.avoidingProps,children:[
347
- /* @__PURE__ */t.jsx(KeyboardOffsetProbe,{probeRef:Ve.probeRef}),O?/* @__PURE__ */t.jsx(ChatHeader,{pets:re,petRef:ee.petRef,historyUnread:we,onOpenHistory:ne.show,onNewChat:ne.newConversation,onPetChange:s,onAddPet:h,vet:ae,textingEntry:at.headerEntry}):null,f!==void 0?/* @__PURE__ */t.jsx(PetSetupNotice,{petRef:petRef??null,pet:f,onRegistered:re.refresh}):null,!O&&at.headerEntry!==null?/* @__PURE__ */t.jsx(TextingEntryRow,{entry:at.headerEntry,place:"thread"}):null,tt?null:et,ut?null:/* @__PURE__ */t.jsx(UrgencyBanner,{surface:ce,petRef:ee.petRef,renderVetAction:d,onFindVet:c,vet:ae,compact:Be}),
348
- /* @__PURE__ */t.jsx(n.View,{style:q.body,children:Nm(te,ee,{notice:ie,vet:ae,onCheckinFindVet:oe,onSelectPrompt:Ae,renderPending:o,shownPet:se,onVetPrep:u,onCopy:a,onSentiment:Ee,feedbackNote:_e,imagesByMessage:ke.byMessage,onPreview:Ce,onAddPet:h,onOpenUrl:Le,threadTop:tt?et:null,pendingCheckin:xe,topCard:rt,starterPrompts:A??Ye,emptyState:L,emptyCentered:W.chatAnswerStyle==="cards",followUpPolicy:Ge,answerCards:W.chatAnswerStyle==="cards"?E??oy:null,threadFoot:dt&&!ct?pt:null,threadAside:at.line,threadAsideKey:at.stage,renderEmptyHeader:D,openingCard:me})}),at.runner,at.entry!==null?/* @__PURE__ */t.jsx(n.View,{style:q.composerOuter,children:/* @__PURE__ */t.jsx(n.View,{style:q.askEntry,children:at.entry})}):st&&p!==void 0?/* @__PURE__ */t.jsx(ComposerWithAttachments,{...ot,attachments:p}):/* @__PURE__ */t.jsx(Composer,{...ot,attachments:null}),dt||ct?null:pt,$.meta.hidePoweredBy||Y?null:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:q.poweredBy,accessibilityRole:"text",accessibilityLabel:pe.poweredBy,children:pe.poweredBy}),Qe?/* @__PURE__ */t.jsx(HistorySheet,{chat:ee,history:ne,sheet:M}):/* @__PURE__ */t.jsx(HistoryDrawer,{chat:ee,history:ne}),
349
- /* @__PURE__ */t.jsx(FeedbackReasons,{visible:Re!==null,onSubmit:Me,onSkip:Fe}),
350
- /* @__PURE__ */t.jsx(AttachmentImageLightbox,{uri:Se?.uri??null,label:Se?.label??"",onClose:je}),
351
- /* @__PURE__ */t.jsx(TelevetHostOutlet,{})]})})}function PetSetupNotice({petRef:petRef,pet:e,onRegistered:r}){let{styles:l}=eu(),i=gl(petRef,e,r);return i.status!=="failed"||i.error===null?null:/* @__PURE__ */t.jsxs(n.View,{style:l.setupNotice,accessible:true,accessibilityRole:"alert",children:[
346
+ return t.jsx(mp.Provider,{value:K,children:/* @__PURE__ */t.jsxs(n.KeyboardAvoidingView,{style:[q.container,{paddingTop:Ve},i],behavior:Le,...Oe.avoidingProps,children:[
347
+ /* @__PURE__ */t.jsx(KeyboardOffsetProbe,{probeRef:Oe.probeRef}),O?/* @__PURE__ */t.jsx(ChatHeader,{pets:re,petRef:ee.petRef,historyUnread:xe,onOpenHistory:ne.show,onNewChat:ne.newConversation,onPetChange:s,onAddPet:h,vet:ae,textingEntry:ot.headerEntry}):null,f!==void 0?/* @__PURE__ */t.jsx(PetSetupNotice,{petRef:petRef??null,pet:f,onRegistered:re.refresh}):null,!O&&ot.headerEntry!==null?/* @__PURE__ */t.jsx(TextingEntryRow,{entry:ot.headerEntry,place:"thread"}):null,et?null:Xe,st?null:/* @__PURE__ */t.jsx(UrgencyBanner,{surface:ce,petRef:ee.petRef,renderVetAction:d,onFindVet:c,vet:ae,compact:De}),
348
+ /* @__PURE__ */t.jsx(n.View,{style:q.body,children:qm(te,ee,{notice:ie,vet:ae,onCheckinFindVet:oe,onSelectPrompt:Fe,renderPending:o,shownPet:se,onVetPrep:u,onCopy:a,onSentiment:Pe,feedbackNote:Te,imagesByMessage:we.byMessage,onPreview:Se,onAddPet:h,onOpenUrl:Ae,threadTop:et?Xe:null,pendingCheckin:ve,topCard:tt,starterPrompts:A??Ke,emptyState:L,emptyCentered:W.chatAnswerStyle==="cards",followUpPolicy:qe,answerCards:W.chatAnswerStyle==="cards"?E??uy:null,threadAside:ot.line,threadAsideKey:ot.stage,renderEmptyHeader:D,openingCard:ge})}),ot.runner,ot.entry!==null?/* @__PURE__ */t.jsx(n.View,{style:q.composerOuter,children:/* @__PURE__ */t.jsx(n.View,{style:q.askEntry,children:ot.entry})}):at&&p!==void 0?/* @__PURE__ */t.jsx(ComposerWithAttachments,{...it,attachments:p}):/* @__PURE__ */t.jsx(Composer,{...it,attachments:null}),$.meta.hidePoweredBy||Y?null:/* @__PURE__ */t.jsx(Text,{tier:"compact",style:q.poweredBy,accessibilityRole:"text",accessibilityLabel:pe.poweredBy,children:pe.poweredBy}),Ye?/* @__PURE__ */t.jsx(HistorySheet,{chat:ee,history:ne,sheet:M}):/* @__PURE__ */t.jsx(HistoryDrawer,{chat:ee,history:ne}),
349
+ /* @__PURE__ */t.jsx(FeedbackReasons,{visible:je!==null,onSubmit:Ee,onSkip:Me}),
350
+ /* @__PURE__ */t.jsx(AttachmentImageLightbox,{uri:ke?.uri??null,label:ke?.label??"",onClose:Ce}),
351
+ /* @__PURE__ */t.jsx(TelevetHostOutlet,{})]})})}function PetSetupNotice({petRef:petRef,pet:e,onRegistered:r}){let{styles:l}=ru(),i=gl(petRef,e,r);return i.status!=="failed"||i.error===null?null:/* @__PURE__ */t.jsxs(n.View,{style:l.setupNotice,accessible:true,accessibilityRole:"alert",children:[
352
352
  /* @__PURE__ */t.jsx(Text,{tier:"compact",style:l.setupNoticeText,children:i.error.displayMessage}),
353
- /* @__PURE__ */t.jsx(n.Pressable,{onPress:i.retry,accessibilityRole:"button",accessibilityLabel:pe.retry,hitSlop:Ss,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:l.setupNoticeAction,children:pe.retry})})]})}var oy=/* @__PURE__ */Object.freeze({}),ay=3;function sy(e){let t=[];for(let r of e){let e=r.trim();if(e.length>0&&!t.some(t=>t.label===e)&&t.push(/* @__PURE__ */Object.freeze({label:e})),t.length===ay)break}return t.length>0?/* @__PURE__ */Object.freeze(t):void 0}var uy=/* @__PURE__ */Object.freeze({chats:Jl.heading,newChat:Jl.newChat});function cy(e,t){return t==="emergency"?"urgent":e==="populated"?"followUp":"ask"}function EverfurChat(e){/* @__PURE__ */
354
- return t.jsx(u.Provider,{value:EverfurTelevetHost,children:/* @__PURE__ */t.jsx(EverfurChatCore,{...e})})}var dy=/* @__PURE__ */Object.freeze({hasUnread:null,unreadCount:null,conversationId:null,petRef:null}),NO_SUBSCRIPTION=()=>()=>{};function py(t,r){let{runtime:n,userRef:userRef,activePet:l,scopeEpoch:i}=we(),o=n.unread??null,petRef=t===void 0?l:t,a=e.useCallback(e=>o===null?NO_SUBSCRIPTION():o.subscribe(e),[o]),s=e.useCallback(()=>o===null||userRef===null?dy:o.get(petRef),[o,userRef,petRef]),u=e.useSyncExternalStore(a,s,s),c=e.useCallback(()=>o===null||userRef===null?Promise.resolve():o.refresh(petRef),[o,userRef,petRef]);return e.useEffect(()=>{c()},[c,i]),Pl(r,{conversationId:null,isTurnInFlight:false,refreshesBlankThread:true,refresh:c}),e.useMemo(()=>({...u,refresh:c}),[u,c])}function useEverfurUnread(t={}){let{lifecycle:r}=t,n=e.useMemo(()=>r===void 0?createAppStateLifecycle():r??void 0,[r]);return py(t.petRef,n)}exports.EverfurChat=EverfurChat;exports.EverfurPoweredBy=EverfurPoweredBy;exports.chatHandoffTokenFromUrl=chatHandoffTokenFromUrl;exports.createAppStateLifecycle=createAppStateLifecycle;exports.createRnChatAttachmentTransport=createRnChatAttachmentTransport;exports.registerEverfurDictation=registerEverfurDictation;exports.useChatAttachments=useChatAttachments;exports.useEverfurChat=useEverfurChat;exports.useEverfurPets=useEverfurPets;exports.useEverfurUnread=useEverfurUnread;exports.useHostPoweredBy=useHostPoweredBy;
353
+ /* @__PURE__ */t.jsx(n.Pressable,{onPress:i.retry,accessibilityRole:"button",accessibilityLabel:pe.retry,hitSlop:_s,children:/* @__PURE__ */t.jsx(Text,{tier:"control",style:l.setupNoticeAction,children:pe.retry})})]})}var uy=/* @__PURE__ */Object.freeze({}),cy=3;function dy(e){let t=[];for(let r of e){let e=r.trim();if(e.length>0&&!t.some(t=>t.label===e)&&t.push(/* @__PURE__ */Object.freeze({label:e})),t.length===cy)break}return t.length>0?/* @__PURE__ */Object.freeze(t):void 0}var py=/* @__PURE__ */Object.freeze({chats:ni.heading,newChat:ni.newChat});function fy(e,t){return t==="emergency"?"urgent":e==="populated"?"followUp":"ask"}function EverfurChat(e){/* @__PURE__ */
354
+ return t.jsx(u.Provider,{value:EverfurTelevetHost,children:/* @__PURE__ */t.jsx(EverfurChatCore,{...e})})}var hy=/* @__PURE__ */Object.freeze({hasUnread:null,unreadCount:null,conversationId:null,petRef:null}),NO_SUBSCRIPTION=()=>()=>{};function by(t,r){let{runtime:n,userRef:userRef,activePet:l,scopeEpoch:i}=we(),o=n.unread??null,petRef=t===void 0?l:t,a=e.useCallback(e=>o===null?NO_SUBSCRIPTION():o.subscribe(e),[o]),s=e.useCallback(()=>o===null||userRef===null?hy:o.get(petRef),[o,userRef,petRef]),u=e.useSyncExternalStore(a,s,s),c=e.useCallback(()=>o===null||userRef===null?Promise.resolve():o.refresh(petRef),[o,userRef,petRef]);return e.useEffect(()=>{c()},[c,i]),Ll(r,{conversationId:null,isTurnInFlight:false,refreshesBlankThread:true,refresh:c}),e.useMemo(()=>({...u,refresh:c}),[u,c])}function useEverfurUnread(t={}){let{lifecycle:r}=t,n=e.useMemo(()=>r===void 0?createAppStateLifecycle():r??void 0,[r]);return by(t.petRef,n)}exports.EverfurChat=EverfurChat;exports.EverfurPoweredBy=EverfurPoweredBy;exports.chatHandoffTokenFromUrl=chatHandoffTokenFromUrl;exports.createAppStateLifecycle=createAppStateLifecycle;exports.createRnChatAttachmentTransport=createRnChatAttachmentTransport;exports.registerEverfurDictation=registerEverfurDictation;exports.useChatAttachments=useChatAttachments;exports.useEverfurChat=useEverfurChat;exports.useEverfurPets=useEverfurPets;exports.useEverfurUnread=useEverfurUnread;exports.useHostPoweredBy=useHostPoweredBy;