@everfur/sdk 1.6.0 → 1.7.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 (218) hide show
  1. package/dist/{Chat.d-B4GybUU4.d.ts → Chat.d-BIr_4AJt.d.ts} +1 -1
  2. package/dist/{Chat.d-DPM2ncxi.d.cts → Chat.d-BhevtXn9.d.cts} +1 -1
  3. package/dist/{DepthViews.d-BGspxovy.d.cts → DepthViews.d-C8KdfzwR.d.cts} +1 -1
  4. package/dist/{DepthViews.d-BaLh7Lsi.d.cts → DepthViews.d-DWQ-J208.d.cts} +1 -1
  5. package/dist/{DepthViews.d-BIHVrf9r.d.ts → DepthViews.d-DYVUq4Xk.d.ts} +1 -1
  6. package/dist/{DepthViews.d-CEVk9poG.d.ts → DepthViews.d-oKr9R0Ql.d.ts} +1 -1
  7. package/dist/{IntakeMedia.d-CwSkSLNM.d.ts → IntakeMedia.d-B-ZZK6vd.d.ts} +1 -1
  8. package/dist/{IntakeMedia.d-LRXO38_z.d.cts → IntakeMedia.d-CuVkzIsO.d.cts} +1 -1
  9. package/dist/{IntakeMedia.d-DmaeGU6T.d.cts → IntakeMedia.d-CyF6NPHx.d.cts} +1 -1
  10. package/dist/{IntakeMedia.d-Dyb9R8b0.d.ts → IntakeMedia.d-vU8g9OM5.d.ts} +1 -1
  11. package/dist/{RecordsPage.d-D10RIgdc.d.ts → RecordsPage.d-DU8Nswzh.d.ts} +1 -1
  12. package/dist/{RecordsPage.d-DbhYNSbq.d.cts → RecordsPage.d-DzPhqMHW.d.cts} +1 -1
  13. package/dist/animations/index.d.cts +3 -3
  14. package/dist/animations/index.d.ts +3 -3
  15. package/dist/{attachments.d-CF4lLuGK.d.cts → attachments.d-0nOPDIng.d.cts} +1 -1
  16. package/dist/{attachments.d-BlukNfIf.d.ts → attachments.d-BlyI-RCY.d.ts} +1 -1
  17. package/dist/{bookingCopy.d-Bn8bdo89.d.ts → bookingCopy.d-ClL8OxBS.d.ts} +3 -3
  18. package/dist/{bookingCopy.d-Dg7bPM-U.d.cts → bookingCopy.d-DUVqhF5f.d.cts} +3 -3
  19. package/dist/{branding.d-XrZYClN4.d.ts → branding.d-D0LV3aFE.d.ts} +1 -1
  20. package/dist/{branding.d-CqDLKj1U.d.cts → branding.d-DzSPLZKl.d.cts} +1 -1
  21. package/dist/{casesRepository.d-CVuKTkJo.d.cts → casesRepository.d-DnanKXJ1.d.cts} +1 -1
  22. package/dist/{casesRepository.d-Dn1fK1b2.d.ts → casesRepository.d-_4QucKVC.d.ts} +1 -1
  23. package/dist/chat/index.cjs +239 -238
  24. package/dist/chat/index.d.cts +11 -11
  25. package/dist/chat/index.d.ts +11 -11
  26. package/dist/chat/index.js +241 -240
  27. package/dist/chat/lite/index.cjs +239 -238
  28. package/dist/chat/lite/index.d.cts +11 -11
  29. package/dist/chat/lite/index.d.ts +11 -11
  30. package/dist/chat/lite/index.js +239 -238
  31. package/dist/chat-cards/index.cjs +2 -2
  32. package/dist/chat-cards/index.js +9 -9
  33. package/dist/{chatHandoffToken.d-zdp23Ukr.d.ts → chatHandoffToken.d-BoZGGbIB.d.ts} +5 -5
  34. package/dist/{chatHandoffToken.d-Cap2z62P.d.cts → chatHandoffToken.d-DhhGdLNH.d.cts} +5 -5
  35. package/dist/{checkin.d-CuIUahcd.d.cts → checkin.d-DB-HlK7r.d.cts} +9 -4
  36. package/dist/{checkin.d-BoZXWjxX.d.ts → checkin.d-DogrR06X.d.ts} +9 -4
  37. package/dist/{chunk-LMIBOI3I.js → chunk-6E3J6IVM.js} +13 -13
  38. package/dist/{chunk-6AIEUA4V.js → chunk-J5ZUBY3S.js} +1 -1
  39. package/dist/{chunk-BN7OAFBS.js → chunk-LPHBCDJP.js} +21 -21
  40. package/dist/{chunk-IXHLESYC.js → chunk-ULQDOC75.js} +1 -1
  41. package/dist/client/index.cjs +28 -27
  42. package/dist/client/index.d.cts +13 -13
  43. package/dist/client/index.d.ts +13 -13
  44. package/dist/client/index.js +25 -24
  45. package/dist/{clinicBatch.d-C0xx5L4j.d.cts → clinicBatch.d-BvPF6vXS.d.cts} +2 -2
  46. package/dist/{clinicBatch.d-DNi4UURs.d.ts → clinicBatch.d-CF0GIvpx.d.ts} +2 -2
  47. package/dist/{config.d-B7Z-KTGq.d.ts → config.d-Bc41Ax6M.d.ts} +5 -1
  48. package/dist/{config.d-ClAI2RZ6.d.cts → config.d-Bn6GEGfl.d.cts} +5 -1
  49. package/dist/consent/index.d.cts +5 -5
  50. package/dist/consent/index.d.ts +5 -5
  51. package/dist/{context.d-D7zX6Q0J.d.ts → context.d-0QfLaI3W.d.ts} +5 -5
  52. package/dist/{context.d-guaLkx5t.d.cts → context.d-CyQpedoU.d.cts} +5 -5
  53. package/dist/{copy.d--F5A9cXK.d.cts → copy.d-B55PpLxr.d.cts} +2 -2
  54. package/dist/{copy.d-DmxuFJFe.d.ts → copy.d-B8wIE6cH.d.ts} +2 -2
  55. package/dist/core/index.cjs +32 -31
  56. package/dist/core/index.d.cts +22 -16
  57. package/dist/core/index.d.ts +22 -16
  58. package/dist/core/index.js +37 -36
  59. package/dist/{depth.d-CgzYE6_n.d.ts → depth.d-CrtZXnLy.d.ts} +2 -2
  60. package/dist/{depth.d-DLaP0o8Y.d.cts → depth.d-Cxz6VisZ.d.cts} +2 -2
  61. package/dist/{entitlementRepository.d-CkUTlVAb.d.ts → entitlementRepository.d-BaZTIe1B.d.ts} +3 -3
  62. package/dist/{entitlementRepository.d-DVTp-BB9.d.cts → entitlementRepository.d-YeNG2TKI.d.cts} +3 -3
  63. package/dist/{focus.d-u-HYvim0.d.ts → focus.d-520VEHKB.d.ts} +1 -1
  64. package/dist/{focus.d-CLTjm6In.d.cts → focus.d-DoempN1I.d.cts} +1 -1
  65. package/dist/health-plan/index.cjs +236 -235
  66. package/dist/health-plan/index.d.cts +15 -15
  67. package/dist/health-plan/index.d.ts +15 -15
  68. package/dist/health-plan/index.js +236 -235
  69. package/dist/{healthPlanRepository.d-CwRXeoM7.d.ts → healthPlanRepository.d-BHu9LO0r.d.ts} +2 -2
  70. package/dist/{healthPlanRepository.d-B22kjrYa.d.cts → healthPlanRepository.d-tUR1f_5s.d.cts} +2 -2
  71. package/dist/{idempotency.d-DrxKLPPe.d.cts → idempotency.d-CcFLvzYW.d.cts} +1 -1
  72. package/dist/{idempotency.d-CbB07p64.d.ts → idempotency.d-CvqKG3Uq.d.ts} +1 -1
  73. package/dist/{identity.d-D4VtpqRr.d.ts → identity.d-Bex_XJZx.d.ts} +1 -1
  74. package/dist/{identity.d-DDpXOtas.d.cts → identity.d-Dm0Buvn8.d.cts} +1 -1
  75. package/dist/{inbox.d-B2JXK0uI.d.ts → inbox.d-9ajb0oiJ.d.ts} +1 -1
  76. package/dist/{inbox.d-CwA1ogzV.d.cts → inbox.d-CGCYOZIq.d.cts} +1 -1
  77. package/dist/index.cjs +259 -258
  78. package/dist/index.d.cts +17 -17
  79. package/dist/index.d.ts +17 -17
  80. package/dist/index.js +258 -257
  81. package/dist/{introEvents.d-DW3gLljE.d.ts → introEvents.d-CuVaufTy.d.ts} +1 -1
  82. package/dist/{introEvents.d-B7acmGwf.d.cts → introEvents.d-DU6feqx4.d.cts} +1 -1
  83. package/dist/{layout.d-C8y_ki1V.d.ts → layout.d-BQ5IVS-m.d.ts} +1 -1
  84. package/dist/{layout.d-DfaFM_lp.d.cts → layout.d-CSPr33BP.d.cts} +1 -1
  85. package/dist/notifications/inbox/index.d.cts +6 -6
  86. package/dist/notifications/inbox/index.d.ts +6 -6
  87. package/dist/notifications/index.d.cts +7 -7
  88. package/dist/notifications/index.d.ts +7 -7
  89. package/dist/{optInView.d-Cps7aLQN.d.ts → optInView.d-DpGXnpGw.d.ts} +21 -3
  90. package/dist/{optInView.d-ChJyJMBA.d.cts → optInView.d-dLjrI3co.d.cts} +21 -3
  91. package/dist/{pets.d-BpLObpfM.d.ts → pets.d-CHdSIoBf.d.ts} +1 -1
  92. package/dist/{pets.d-DXhzTNuI.d.cts → pets.d-jnhrJhqm.d.cts} +1 -1
  93. package/dist/{petsRepository.d-ai_tZ3lu.d.cts → petsRepository.d-BeKRiNao.d.cts} +1 -1
  94. package/dist/{petsRepository.d-_QfM7F6T.d.ts → petsRepository.d-BjwB1vku.d.ts} +1 -1
  95. package/dist/{presentation.d-BkIvMtIl.d.cts → presentation.d-Br3TnwA6.d.cts} +17 -1
  96. package/dist/{presentation.d-BkIvMtIl.d.ts → presentation.d-Br3TnwA6.d.ts} +17 -1
  97. package/dist/records/depth/index.d.cts +9 -9
  98. package/dist/records/depth/index.d.ts +9 -9
  99. package/dist/records/index.cjs +237 -228
  100. package/dist/records/index.d.cts +39 -12
  101. package/dist/records/index.d.ts +39 -12
  102. package/dist/records/index.js +155 -146
  103. package/dist/{requestFunnel.d-DKBPTpsy.d.ts → requestFunnel.d-C_NMgz9R.d.ts} +2 -2
  104. package/dist/{requestFunnel.d-BwZDfWVD.d.cts → requestFunnel.d-DoJWLySc.d.cts} +2 -2
  105. package/dist/{route.d-QBCoO62z.d.cts → route.d-BW2abFVK.d.cts} +2 -2
  106. package/dist/{route.d-B3u14HJT.d.ts → route.d-Olr_gXaa.d.ts} +2 -2
  107. package/dist/{runtimeTypes.d-hjN6xvxm.d.ts → runtimeTypes.d-Bp2VW6YE.d.ts} +6 -6
  108. package/dist/{runtimeTypes.d-BSxuUCOX.d.cts → runtimeTypes.d-StvJY45N.d.cts} +6 -6
  109. package/dist/{screenProps.d-fHBKArt_.d.ts → screenProps.d-BTLSji0N.d.ts} +1 -1
  110. package/dist/{screenProps.d-6xmE1C-V.d.cts → screenProps.d-B_5Bh7aQ.d.cts} +1 -1
  111. package/dist/server/events/index.cjs +2 -2
  112. package/dist/server/events/index.d.cts +19 -5
  113. package/dist/server/events/index.d.ts +19 -5
  114. package/dist/server/events/index.js +2 -2
  115. package/dist/server/index.cjs +1 -1
  116. package/dist/server/index.d.cts +3 -3
  117. package/dist/server/index.d.ts +3 -3
  118. package/dist/server/index.js +1 -1
  119. package/dist/shop/index.d.cts +3 -3
  120. package/dist/shop/index.d.ts +3 -3
  121. package/dist/slots/index.cjs +200 -199
  122. package/dist/slots/index.d.cts +5 -5
  123. package/dist/slots/index.d.ts +5 -5
  124. package/dist/slots/index.js +200 -199
  125. package/dist/tabs/index.cjs +200 -190
  126. package/dist/tabs/index.d.cts +68 -11
  127. package/dist/tabs/index.d.ts +68 -11
  128. package/dist/tabs/index.js +201 -191
  129. package/dist/tabs-bar/index.cjs +247 -0
  130. package/dist/tabs-bar/index.d.cts +10 -0
  131. package/dist/tabs-bar/index.d.ts +10 -0
  132. package/dist/tabs-bar/index.js +247 -0
  133. package/dist/{tabsModel.d-D9GWPFrL.d.ts → tabsModel.d-B4MSQB57.d.cts} +5 -2
  134. package/dist/{tabsModel.d-D9GWPFrL.d.cts → tabsModel.d-C8pd-DP3.d.ts} +5 -2
  135. package/dist/televet/booking/index.cjs +147 -145
  136. package/dist/televet/booking/index.d.cts +10 -10
  137. package/dist/televet/booking/index.d.ts +10 -10
  138. package/dist/televet/booking/index.js +163 -161
  139. package/dist/televet/call/index.cjs +52 -52
  140. package/dist/televet/call/index.d.cts +5 -0
  141. package/dist/televet/call/index.d.ts +5 -0
  142. package/dist/televet/call/index.js +25 -25
  143. package/dist/televet/index.d.cts +3 -3
  144. package/dist/televet/index.d.ts +3 -3
  145. package/dist/{televetGlobal.d-gZrXPaLl.d.cts → televetGlobal.d-B_I_fy7O.d.cts} +9 -0
  146. package/dist/{televetGlobal.d-DkJkV55Y.d.ts → televetGlobal.d-DN7o45WJ.d.ts} +9 -0
  147. package/dist/testing/index.cjs +3 -3
  148. package/dist/testing/index.d.cts +1 -1
  149. package/dist/testing/index.d.ts +1 -1
  150. package/dist/testing/index.js +3 -3
  151. package/dist/testing/rn/index.d.cts +9 -9
  152. package/dist/testing/rn/index.d.ts +9 -9
  153. package/dist/testing/web/index.d.cts +9 -9
  154. package/dist/testing/web/index.d.ts +9 -9
  155. package/dist/texting/index.cjs +32 -27
  156. package/dist/texting/index.d.cts +5 -5
  157. package/dist/texting/index.d.ts +5 -5
  158. package/dist/texting/index.js +52 -47
  159. package/dist/{threadOptions.d-NSlFx-Lp.d.ts → threadOptions.d-D_3hk79R.d.ts} +5 -5
  160. package/dist/{threadOptions.d-Dc57dm7h.d.cts → threadOptions.d-D_GU6lp9.d.cts} +5 -5
  161. package/dist/{timelineRows.d-CthNM5hV.d.ts → timelineRows.d-BbVuARtc.d.ts} +1 -1
  162. package/dist/{timelineRows.d-7w8NsNi4.d.cts → timelineRows.d-BiLAAbYl.d.cts} +1 -1
  163. package/dist/{typeStyle.d-8mcLhtbH.d.ts → typeStyle.d-DSk99BuZ.d.ts} +1 -1
  164. package/dist/{typeStyle.d-CLrQZW-r.d.cts → typeStyle.d-DqR6mWCF.d.cts} +1 -1
  165. package/dist/{useHealthPlanSubscription.d-CV7M21HS.d.ts → useHealthPlanSubscription.d-CpE6l1VW.d.ts} +3 -3
  166. package/dist/{useHealthPlanSubscription.d-SA9-SuKe.d.cts → useHealthPlanSubscription.d-DRiWDJXq.d.cts} +3 -3
  167. package/dist/{useInboxUnread.d-0DrQPn7J.d.ts → useInboxUnread.d-BV7PkWDH.d.ts} +1 -1
  168. package/dist/{useInboxUnread.d-CRcOTkmu.d.cts → useInboxUnread.d-CElyXBkY.d.cts} +1 -1
  169. package/dist/{usePresentation.d-BJzFicRQ.d.cts → usePresentation.d-BcazazQH.d.cts} +3 -3
  170. package/dist/{usePresentation.d-DgSGIWS-.d.ts → usePresentation.d-CMOypLlH.d.ts} +3 -3
  171. package/dist/{useRecordsDepth.d-ZX2rhcUx.d.ts → useRecordsDepth.d-Bka4KQhq.d.ts} +1 -1
  172. package/dist/{useRecordsDepth.d-C9W45gwS.d.cts → useRecordsDepth.d-TgmpxKdX.d.cts} +1 -1
  173. package/dist/{useUnread.d-4SbFChbd.d.ts → useUnread.d-CGqaP-dB.d.ts} +27 -5
  174. package/dist/{useUnread.d-B0YhhR_D.d.cts → useUnread.d-DVVnYNPU.d.cts} +27 -5
  175. package/dist/{view.d-3lxzyJlL.d.cts → view.d-CwruYhQy.d.cts} +3 -3
  176. package/dist/{view.d-DRiYNQJ8.d.ts → view.d-DamH8TQF.d.ts} +3 -3
  177. package/dist/web/consent/index.d.cts +5 -5
  178. package/dist/web/consent/index.d.ts +5 -5
  179. package/dist/web/health-plan/index.cjs +9 -8
  180. package/dist/web/health-plan/index.d.cts +16 -16
  181. package/dist/web/health-plan/index.d.ts +16 -16
  182. package/dist/web/health-plan/index.js +49 -48
  183. package/dist/web/inbox/index.d.cts +7 -7
  184. package/dist/web/inbox/index.d.ts +7 -7
  185. package/dist/web/index.cjs +185 -184
  186. package/dist/web/index.d.cts +32 -32
  187. package/dist/web/index.d.ts +32 -32
  188. package/dist/web/index.js +187 -186
  189. package/dist/web/intro/index.d.cts +7 -7
  190. package/dist/web/intro/index.d.ts +7 -7
  191. package/dist/web/notifications/index.d.cts +6 -6
  192. package/dist/web/notifications/index.d.ts +6 -6
  193. package/dist/web/records/depth/index.d.cts +9 -9
  194. package/dist/web/records/depth/index.d.ts +9 -9
  195. package/dist/web/records/index.d.cts +11 -11
  196. package/dist/web/records/index.d.ts +11 -11
  197. package/dist/web/records-sheet/index.cjs +111 -110
  198. package/dist/web/records-sheet/index.js +111 -110
  199. package/dist/web/shop/index.cjs +1 -1
  200. package/dist/web/shop/index.d.cts +3 -3
  201. package/dist/web/shop/index.d.ts +3 -3
  202. package/dist/web/shop/index.js +1 -1
  203. package/dist/web/televet/booking/index.cjs +3 -3
  204. package/dist/web/televet/booking/index.d.cts +10 -10
  205. package/dist/web/televet/booking/index.d.ts +10 -10
  206. package/dist/web/televet/booking/index.js +69 -69
  207. package/dist/web/televet/call/index.cjs +1 -1
  208. package/dist/web/televet/call/index.js +1 -1
  209. package/dist/web/televet/index.d.cts +3 -3
  210. package/dist/web/televet/index.d.ts +3 -3
  211. package/dist/web/texting/index.cjs +34 -29
  212. package/dist/web/texting/index.d.cts +5 -5
  213. package/dist/web/texting/index.d.ts +5 -5
  214. package/dist/web/texting/index.js +45 -40
  215. package/dist/web/ui/index.cjs +1 -1
  216. package/dist/web/ui/index.js +33 -33
  217. package/package.json +16 -1
  218. package/tabs-bar/package.json +8 -0
@@ -1,7 +1,7 @@
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("zod"),r=require("react-native"),n=require("react/jsx-runtime"),i=require("react-native-safe-area-context");function l(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 o=/*#__PURE__*/l(r);var a=[{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}],s=/* @__PURE__ */Object.freeze(a.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(s.map(e=>e.wireCode));var d=/* @__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"}),c=/* @__PURE__ */Object.freeze(s.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:d[e.wireCode]}))),u=new Map(c.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),h=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(c.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",...h]){let t=u.get(e+r);if(t)return t}}var p=/* @__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 p[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 g=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return g.has(e)}var f=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||f.has(e)}var m=500,b=8e3,y=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(m*2**r,b);return Math.floor(t()*n)}var x="This feature isn't available on your account right now.",w="Something in that request was not right. Check the details and try again.",v=/* @__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:x,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:w,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:x,runtimeDisposed:w,unknown:"Something went wrong. Please try again."}),k="This session has ended. Please sign in again.",j="linked_account_read_only";function S(e,t,r){return e==="conflict"&&r===j?x:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?k:userFacingError(e)}function userFacingError(e){return v[e]}function C(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var R=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===j,i={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:S(e,t?.wireCode,n?j:null)};t?.httpStatus!==void 0&&(i.httpStatus=t.httpStatus),t?.requestId&&(i.requestId=t.requestId),typeof t?.reasonCode=="string"&&R.test(t.reasonCode)&&(i.reasonCode=t.reasonCode);let l=t?.retryAfterSeconds;if(typeof l=="number"&&Number.isFinite(l)&&l>=0&&(i.retryAfterSeconds=Math.round(l)),r);return t?.wireMessage&&C(i,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&C(i,"raw",t.raw),/* @__PURE__ */Object.freeze(i)}function ok(e,t){/* @__PURE__ */
3
3
  return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
4
- return Object.freeze({ok:false,error:e})}var T=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var _=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;function z(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 V(e,t)}var I=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,D=/[\s\u0000-\u001f\u007f\\]/,H={"http:":"80","https:":"443"};function V(e,t){let r=e.trim();if(t!==void 0&&!_.test(r)){let e=V(t);if(e===null||!r.startsWith("/")||r.startsWith("//"))return null;r=e.origin+r}let n=D.test(r)?null:I.exec(r);if(n===null)return null;let[,i="",l="",o="",a="",s="",d="",c="",u=""]=n,h=`${i.toLowerCase()}:`,p=Number(s);if(p>65535)return null;let g=s===""||String(p)===H[h]?"":String(p),f=H[h]!==void 0,m=a.toLowerCase()+(g&&`:${g}`),b=d||(f?"/":""),y=l||o?`${l}${o&&`:${o}`}@`:"";return{href:`${h}//${y}${m}${b}${c}${u}`,protocol:h,username:l,password:o,hostname:a.toLowerCase(),port:g,origin:f?`${h}//${m}`:"null",pathname:b,search:c==="?"?"":c,hash:u==="#"?"":u}}var P=/* @__PURE__ */Object.freeze(["vet","groomer","boarding"]),L=/* @__PURE__ */t.z.string().min(1).refine(e=>e.startsWith("https://")),E=/* @__PURE__ */t.z.string().nullish(),O=/* @__PURE__ */t.z.unknown().optional(),A=/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),share_url:/* @__PURE__ */t.z.string().min(1),expires_at:E,audience:O}),$=/* @__PURE__ */t.z.object({shares:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),expires_at:E,created_at:E,view_count:/* @__PURE__ */t.z.number().int().nonnegative().nullish(),last_viewed_at:E,audience:O})).optional()}),B=/* @__PURE__ */t.z.object({download_url:L,expires_at:E}),F=/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),expires_at:E,audience:O}),M=/* @__PURE__ */t.z.object({audience:/* @__PURE__ */t.z.string().min(1),sections:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()),entity_types:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()).nullable()}),q=254;function isShareRecipientEmail(e){let t=e.trim();return t.length>0&&t.length<=q&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)}var N=e=>typeof e=="string"&&P.includes(e);function W(e){return N(e)?e:null}function mapShareAudiences(e){let r=t.z.array(M).safeParse(e);if(!r.success)/* @__PURE__ */return Object.freeze([]);let n=/* @__PURE__ */new Set,i=[];for(let e of r.data)!N(e.audience)||n.has(e.audience)||(n.add(e.audience),i.push(/* @__PURE__ */Object.freeze({audience:e.audience,sections:/* @__PURE__ */Object.freeze([...e.sections]),entityTypes:e.entity_types===null?null:/* @__PURE__ */Object.freeze([...e.entity_types])}))/* @__PURE__ */);return Object.freeze(i)}function resolveShareUrl(e,t){let r=e.trim();if(r.length===0)return null;let n=/^[a-z][a-z0-9+.-]*:/i.test(r)?z(r):t!==void 0?z(r,t):null;return n===null||n.protocol!=="https:"?null:n.href}function mapRecordShareLink(e,t){let r=A.safeParse(e);if(!r.success)return null;let n=resolveShareUrl(r.data.share_url,t);return n===null?null:/* @__PURE__ */Object.freeze({shareId:r.data.share_id,shareUrl:n,expiresAt:r.data.expires_at??null,audience:W(r.data.audience)})}function mapRecordShareList(e){let t=$.safeParse(e);return t.success?/* @__PURE__ */Object.freeze((t.data.shares??[]).map(e=>/* @__PURE__ */Object.freeze({shareId:e.share_id,expiresAt:e.expires_at??null,createdAt:e.created_at??null,viewCount:e.view_count??0,lastViewedAt:e.last_viewed_at??null,audience:W(e.audience)}))):null}function mapRecordShareEmailReceipt(e){let t=F.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({shareId:t.data.share_id,expiresAt:t.data.expires_at??null,audience:W(t.data.audience)}):null}function mapRecordPdfLink(e){let t=B.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({downloadUrl:t.data.download_url,expiresAt:t.data.expires_at??null}):null}var U="application/pdf",G=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/heic","image/heif"]),K=e=>G.includes(e);function Y(e,t){return e===U||t!==void 0&&K(e)&&t.includes(e)}var X=/* @__PURE__ */Object.freeze({features:/* @__PURE__ */Object.freeze({}),uploadContentTypes:/* @__PURE__ */Object.freeze([U]),shareAudiences:/* @__PURE__ */Object.freeze([])}),Q=/* @__PURE__ */t.z.object({features:/* @__PURE__ */t.z.record(/* @__PURE__ */t.z.boolean()),upload_content_types:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()).nullish(),share_audiences:/* @__PURE__ */t.z.unknown().optional()});function J(e){let t=Q.safeParse(e);if(!t.success)return X;let r=t.data.upload_content_types??[],n=G.filter(e=>r.includes(e));/* @__PURE__ */
4
+ return Object.freeze({ok:false,error:e})}var T=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var _=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;function z(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 V(e,t)}var I=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,D=/[\s\u0000-\u001f\u007f\\]/,H={"http:":"80","https:":"443"};function V(e,t){let r=e.trim();if(t!==void 0&&!_.test(r)){let e=V(t);if(e===null||!r.startsWith("/")||r.startsWith("//"))return null;r=e.origin+r}let n=D.test(r)?null:I.exec(r);if(n===null)return null;let[,i="",l="",o="",a="",s="",d="",c="",u=""]=n,h=`${i.toLowerCase()}:`,p=Number(s);if(p>65535)return null;let g=s===""||String(p)===H[h]?"":String(p),f=H[h]!==void 0,m=a.toLowerCase()+(g&&`:${g}`),b=d||(f?"/":""),y=l||o?`${l}${o&&`:${o}`}@`:"";return{href:`${h}//${y}${m}${b}${c}${u}`,protocol:h,username:l,password:o,hostname:a.toLowerCase(),port:g,origin:f?`${h}//${m}`:"null",pathname:b,search:c==="?"?"":c,hash:u==="#"?"":u}}var P=/* @__PURE__ */Object.freeze(["vet","groomer","boarding"]),L=/* @__PURE__ */t.z.string().min(1).refine(e=>e.startsWith("https://")),O=/* @__PURE__ */t.z.string().nullish(),E=/* @__PURE__ */t.z.unknown().optional(),A=/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),share_url:/* @__PURE__ */t.z.string().min(1),expires_at:O,audience:E}),$=/* @__PURE__ */t.z.object({shares:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),expires_at:O,created_at:O,view_count:/* @__PURE__ */t.z.number().int().nonnegative().nullish(),last_viewed_at:O,audience:E})).optional()}),B=/* @__PURE__ */t.z.object({download_url:L,expires_at:O}),F=/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),expires_at:O,audience:E}),M=/* @__PURE__ */t.z.object({audience:/* @__PURE__ */t.z.string().min(1),sections:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()),entity_types:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()).nullable()}),q=254;function isShareRecipientEmail(e){let t=e.trim();return t.length>0&&t.length<=q&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)}var N=e=>typeof e=="string"&&P.includes(e);function W(e){return N(e)?e:null}function mapShareAudiences(e){let r=t.z.array(M).safeParse(e);if(!r.success)/* @__PURE__ */return Object.freeze([]);let n=/* @__PURE__ */new Set,i=[];for(let e of r.data)!N(e.audience)||n.has(e.audience)||(n.add(e.audience),i.push(/* @__PURE__ */Object.freeze({audience:e.audience,sections:/* @__PURE__ */Object.freeze([...e.sections]),entityTypes:e.entity_types===null?null:/* @__PURE__ */Object.freeze([...e.entity_types])}))/* @__PURE__ */);return Object.freeze(i)}function resolveShareUrl(e,t){let r=e.trim();if(r.length===0)return null;let n=/^[a-z][a-z0-9+.-]*:/i.test(r)?z(r):t!==void 0?z(r,t):null;return n===null||n.protocol!=="https:"?null:n.href}function mapRecordShareLink(e,t){let r=A.safeParse(e);if(!r.success)return null;let n=resolveShareUrl(r.data.share_url,t);return n===null?null:/* @__PURE__ */Object.freeze({shareId:r.data.share_id,shareUrl:n,expiresAt:r.data.expires_at??null,audience:W(r.data.audience)})}function mapRecordShareList(e){let t=$.safeParse(e);return t.success?/* @__PURE__ */Object.freeze((t.data.shares??[]).map(e=>/* @__PURE__ */Object.freeze({shareId:e.share_id,expiresAt:e.expires_at??null,createdAt:e.created_at??null,viewCount:e.view_count??0,lastViewedAt:e.last_viewed_at??null,audience:W(e.audience)}))):null}function mapRecordShareEmailReceipt(e){let t=F.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({shareId:t.data.share_id,expiresAt:t.data.expires_at??null,audience:W(t.data.audience)}):null}function mapRecordPdfLink(e){let t=B.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({downloadUrl:t.data.download_url,expiresAt:t.data.expires_at??null}):null}var U="application/pdf",G=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/heic","image/heif"]),K=e=>G.includes(e);function Y(e,t){return e===U||t!==void 0&&K(e)&&t.includes(e)}var X=/* @__PURE__ */Object.freeze({features:/* @__PURE__ */Object.freeze({}),uploadContentTypes:/* @__PURE__ */Object.freeze([U]),shareAudiences:/* @__PURE__ */Object.freeze([])}),Q=/* @__PURE__ */t.z.object({features:/* @__PURE__ */t.z.record(/* @__PURE__ */t.z.boolean()),upload_content_types:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()).nullish(),share_audiences:/* @__PURE__ */t.z.unknown().optional()});function J(e){let t=Q.safeParse(e);if(!t.success)return X;let r=t.data.upload_content_types??[],n=G.filter(e=>r.includes(e));/* @__PURE__ */
5
5
  return Object.freeze({features:/* @__PURE__ */Object.freeze({...t.data.features}),uploadContentTypes:/* @__PURE__ */Object.freeze([U,...n]),shareAudiences:mapShareAudiences(t.data.share_audiences)})}function acceptsPhotos(e){return e!==void 0&&e.some(K)}function Z(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ee=/* @__PURE__ */new Set(["requested","awaiting_clinic","awaiting_upload","received","parsing","in_review","published","failed","revoked"]),te=/* @__PURE__ */Object.freeze({submitted:"requested",sent:"requested",dispatching:"requested",awaiting_response:"awaiting_clinic",clinic_responded_no_records:"awaiting_clinic",records_received:"received",parsing_failed:"in_review",review_email_failed:"in_review",clinic_declined:"failed"});function re(e){let t=Object.prototype.hasOwnProperty.call(te,e)?te[e]:void 0;if(t!==void 0)return t;let r=e;return ee.has(r)?r:"parsing"}function ne(e){return e==="owner_reported"||e==="clinic_document"?e:null}var ie=/* @__PURE__ */t.z.object({request_id:/* @__PURE__ */t.z.string().min(1),pet_ref:/* @__PURE__ */t.z.string().min(1),status:/* @__PURE__ */t.z.string(),simple_status:/* @__PURE__ */t.z.string().nullish(),simple_status_detail:/* @__PURE__ */t.z.string().nullish(),status_label:/* @__PURE__ */t.z.string().optional(),dispatch_status:/* @__PURE__ */t.z.string().nullish(),can_retry_send:/* @__PURE__ */t.z.boolean().optional(),can_revoke:/* @__PURE__ */t.z.boolean().optional(),can_convert_to_upload:/* @__PURE__ */t.z.boolean().optional(),can_update_clinic_email:/* @__PURE__ */t.z.boolean().optional(),reminder_count:/* @__PURE__ */t.z.number().int().nonnegative().optional(),last_reminder_at:/* @__PURE__ */t.z.string().nullish(),waiting_expectation:/* @__PURE__ */t.z.string().nullish(),document_count:/* @__PURE__ */t.z.number().optional(),held_item_count:/* @__PURE__ */t.z.number().optional(),received_at:/* @__PURE__ */t.z.string().nullish(),parsing_started_at:/* @__PURE__ */t.z.string().nullish(),review_started_at:/* @__PURE__ */t.z.string().nullish(),created_at:/* @__PURE__ */t.z.string().optional(),updated_at:/* @__PURE__ */t.z.string().optional(),source:/* @__PURE__ */t.z.string().nullish().catch(null),action_needed_label:/* @__PURE__ */t.z.string().nullish().catch(null),failure_reason:/* @__PURE__ */t.z.string().nullish().catch(null),failure_code:/* @__PURE__ */t.z.string().nullish().catch(null),recovery_stage:/* @__PURE__ */t.z.string().nullish().catch(null),show_clinic_phone:/* @__PURE__ */t.z.boolean().optional().catch(void 0),clinic_name:/* @__PURE__ */t.z.string().nullish().catch(null),clinic_email:/* @__PURE__ */t.z.string().nullish().catch(null),clinic_phone:/* @__PURE__ */t.z.string().nullish().catch(null),converted_to_upload_at:/* @__PURE__ */t.z.string().nullish().catch(null),request_group_id:/* @__PURE__ */t.z.string().nullish().catch(null)}).passthrough();function le(e){let t=ie.safeParse(e);if(!t.success)return null;let r=t.data,n=se(r.simple_status),i=n==="requested"&&(r.status==="awaiting_upload"||r.simple_status_detail==="awaiting_owner_upload")?"awaiting_upload":n==="parsing"&&(r.simple_status_detail==="in_review"||r.simple_status_detail==="review_email_failed")?"in_review":n??re(r.status);/* @__PURE__ */
6
6
  return Object.freeze({id:r.request_id,petRef:r.pet_ref,status:i,simpleStatus:n,simpleStatusDetail:r.simple_status_detail??null,statusLabel:r.status_label??"",dispatchStatus:r.dispatch_status??null,canRetrySend:r.can_retry_send===true,canRevoke:r.can_revoke===true,canConvertToUpload:r.can_convert_to_upload===true,canUpdateClinicEmail:r.can_update_clinic_email===true,reminderCount:r.reminder_count??0,lastReminderAt:r.last_reminder_at??null,waitingExpectation:r.waiting_expectation??null,documentCount:Te(r.document_count,0),heldItemCount:Te(r.held_item_count,0),receivedAt:r.received_at??null,parsingStartedAt:r.parsing_started_at??null,reviewStartedAt:r.review_started_at??null,createdAt:r.created_at??"",updatedAt:r.updated_at??"",wireStatus:r.status,source:r.source??null,actionNeededLabel:r.action_needed_label??null,failureReason:r.failure_reason??null,failureCode:r.failure_code??null,recoveryStage:r.recovery_stage??null,showClinicPhone:r.show_clinic_phone===true,clinicName:r.clinic_name??null,clinicEmail:r.clinic_email??null,clinicPhone:r.clinic_phone??null,convertedToUploadAt:r.converted_to_upload_at??null,requestGroupId:r.request_group_id??null})}var oe=/* @__PURE__ */t.z.object({request_group_id:/* @__PURE__ */t.z.string().min(1),pet_ref:/* @__PURE__ */t.z.string().min(1),total:/* @__PURE__ */t.z.number().int().nonnegative(),responded:/* @__PURE__ */t.z.number().int().nonnegative(),pending:/* @__PURE__ */t.z.number().int().nonnegative(),members:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.unknown())});function ae(e){let t=oe.safeParse(e);if(!t.success)return null;let r=t.data,n=de(r.members);return n.some(e=>e.petRef!==r.pet_ref)?null:/* @__PURE__ */Object.freeze({requestGroupId:r.request_group_id,petRef:r.pet_ref,total:r.total,responded:r.responded,pending:r.pending,members:n})}function se(e){return!e||e==="awaiting_upload"||e==="in_review"?null:ee.has(e)?e:null}function de(e){let t=Array.isArray(e)?e:[],r=[];for(let e of t){let t=le(e);t!==null&&r.push(t)}/* @__PURE__ */
7
7
  return Object.freeze(r)}var ce=/* @__PURE__ */t.z.object({source_doc_id:/* @__PURE__ */t.z.string().min(1),request_id:/* @__PURE__ */t.z.string().min(1)});function ue(e){let t=ce.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({documentId:t.data.source_doc_id,requestId:t.data.request_id,status:"received"}):null}var he=/* @__PURE__ */t.z.object({label:/* @__PURE__ */t.z.string(),value:/* @__PURE__ */t.z.string()}),pe=/* @__PURE__ */t.z.object({key:/* @__PURE__ */t.z.string(),category:/* @__PURE__ */t.z.string().optional(),label:/* @__PURE__ */t.z.string().optional(),value:/* @__PURE__ */t.z.string().nullish(),unit:/* @__PURE__ */t.z.string().nullish(),observed_at:/* @__PURE__ */t.z.string().nullish(),status:/* @__PURE__ */t.z.string().nullish(),origin:/* @__PURE__ */t.z.string().nullish(),canonical_key:/* @__PURE__ */t.z.string().nullish()}),ge=/* @__PURE__ */t.z.object({at:/* @__PURE__ */t.z.string(),value:/* @__PURE__ */t.z.number().nullish(),display:/* @__PURE__ */t.z.string().nullish(),origin:/* @__PURE__ */t.z.string().nullish()}),fe=/* @__PURE__ */t.z.object({key:/* @__PURE__ */t.z.string(),label:/* @__PURE__ */t.z.string().optional(),points:/* @__PURE__ */t.z.array(ge).optional()}),me=/* @__PURE__ */t.z.object({title:/* @__PURE__ */t.z.string(),detail:/* @__PURE__ */t.z.string().nullish(),due_at:/* @__PURE__ */t.z.string().nullish(),care_item_key:/* @__PURE__ */t.z.string().nullish(),due_date_source:/* @__PURE__ */t.z.string().nullish()}),be=/* @__PURE__ */t.z.object({doc_id:/* @__PURE__ */t.z.string(),title:/* @__PURE__ */t.z.string().nullish(),document_class:/* @__PURE__ */t.z.string().nullish(),page_count:/* @__PURE__ */t.z.number().nullish(),received_at:/* @__PURE__ */t.z.string().nullish()});function ye(e){/* @__PURE__ */
@@ -10,15 +10,15 @@ return Object.freeze({docId:e.doc_id,title:e.title??null,documentClass:e.documen
10
10
  return Object.freeze({petRef:i,schemaVersion:r,isEmpty:h,withheld:false,generatedAt:ze(t.generated_at),identity:/* @__PURE__ */Object.freeze(a),entities:/* @__PURE__ */Object.freeze(s),entitySeries:/* @__PURE__ */Object.freeze(d),forwardLooking:/* @__PURE__ */Object.freeze(c),documents:/* @__PURE__ */Object.freeze(u),disclaimer:n})}function ke(petRef,e,t){/* @__PURE__ */
11
11
  return Object.freeze({petRef:petRef,schemaVersion:e,isEmpty:false,withheld:true,generatedAt:null,identity:/* @__PURE__ */Object.freeze([]),entities:/* @__PURE__ */Object.freeze([]),entitySeries:/* @__PURE__ */Object.freeze([]),forwardLooking:/* @__PURE__ */Object.freeze([]),documents:/* @__PURE__ */Object.freeze({}),disclaimer:t})}var je=/* @__PURE__ */t.z.object({pet_ref:/* @__PURE__ */t.z.string().optional(),granted:/* @__PURE__ */t.z.boolean().optional(),version:/* @__PURE__ */t.z.string().nullish(),granted_at:/* @__PURE__ */t.z.string().nullish()});function Se(petRef,e){let t=je.safeParse(e),r=t.success?t.data:{};/* @__PURE__ */
12
12
  return Object.freeze({petRef:typeof r.pet_ref=="string"&&r.pet_ref.length>0?r.pet_ref:petRef,granted:r.granted===true,version:r.version??null,grantedAt:r.granted_at??null})}var Ce=/* @__PURE__ */t.z.object({granted:/* @__PURE__ */t.z.boolean().optional(),version:/* @__PURE__ */t.z.string().nullish(),granted_at:/* @__PURE__ */t.z.string().nullish(),pets:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.unknown()).optional()});function Re(e){let t=Ce.safeParse(e),r=t.success?t.data:{};/* @__PURE__ */
13
- return Object.freeze({scope:"all_pets",granted:r.granted===true,version:r.version??null,grantedAt:r.granted_at??null,pets:/* @__PURE__ */Object.freeze((r.pets??[]).map(e=>Se("",e)).filter(e=>e.petRef))})}function Te(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function _e(e,t){return typeof e=="string"&&e.length>0?e:t}function ze(e){return typeof e=="string"&&e.length>0?e:null}var Ie=/* @__PURE__ */Object.freeze(["published","failed","revoked"]);function isTerminalStatus(e){return Ie.includes(e)}function recordsDenialReasonOf(e){if(e===null)return null;let t=e.recordsReason;return t==="consent_required"||t==="session_required"||t==="entitlement"||t==="pet_not_found"?t:null}var De="records_consent_required";function He(e){let t=e.raw;if(t===null||typeof t!="object")return null;let r=t,n=typeof r.error=="object"&&r.error!==null?r.error.code:r.code;return typeof n=="string"&&n.length>0?n:null}function Ve(e){return e===null||e.httpStatus!==409?false:He(e)===De}var Pe=/* @__PURE__ */Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function Le(e){return e!==Pe}var Ee=/* @__PURE__ */Object.freeze({record(){}}),Oe=25*1024*1024,Ae=64,$e=128,Be=128;var Fe=9e4;function Me(e,t){let r=!t[0]&&e.length>0&&e.every(e=>e.granted);/* @__PURE__ */
14
- return Object.freeze({scope:"all_pets",granted:r,version:r?e[0]?.version??null:null,grantedAt:null,pets:/* @__PURE__ */Object.freeze(e),...t[0]?{failed:/* @__PURE__ */Object.freeze(t)}:{}})}function qe(e){return new Ne(e)}var Ne=class{constructor(e){this.recordCache=/* @__PURE__ */new Map;this.consentEpoch=/* @__PURE__ */new Map;this.reportedGaps=/* @__PURE__ */new Set;this.features=X;this.repository=e.repository,this.uploads=e.uploads,this.telemetry=e.telemetry??Ee,this.newIdempotencyKey=e.newIdempotencyKey??Qe(),this.timers=e.timers??Ye,this.uploadDeadlineMs=e.uploadDeadlineMs??Fe}async createUploadRequest(e){let t=await this.repository.createRequest({pet_ref:e.petRef,idempotency_key:e.idempotencyKey});if(!t.ok)return this.onRequestError(t.error);let r=le(t.value);return r===null?err(Ke()):(this.observeRequest(r),ok(r))}async getRequest(e){let t=await this.repository.getRequest(e);if(!t.ok)return this.onRequestError(t.error);let r=le(t.value);return r===null?err(Ke()):(this.observeRequest(r),ok(r))}async listRequests(){let e=await this.repository.listRequests();if(!e.ok)return this.onRequestError(e.error);let t=de(e.value);for(let e of t)this.observeRequest(e);return ok(t)}async readFeatures(){let e=this.repository.getFeatures;if(e===void 0)return this.features=X;let t=X;try{let r=await e.call(this.repository);r.ok&&(t=J(r.value))}catch{}return this.features=t,t}async uploadDocument(e){let{requestId:t,file:r}=e,n=We(r,this.features.uploadContentTypes);if(n!==null)return this.telemetry.record("records.upload.rejected",{reason:n}),err(Ge(`upload rejected: ${n}`));let i=await this.repository.initiateUpload(t,{content_type:r.mimeType,file_size:r.sizeBytes});if(!i.ok)return this.onRequestError(i.error);let l=await this.postToS3(i.value,r,e);if(!l.ok)return this.telemetry.record("records.upload.failed",{reason:l.reason}),err(Ge(l.reason));let o=await this.repository.completeUpload(t,{upload_id:i.value.upload_id});if(!o.ok)return o.error.code==="mediaUploadFailed"&&this.telemetry.record("records.upload.rejected",{reason:Ue(o.error)??"corrupt"}),this.onRequestError(o.error);let a=ue(o.value);return a===null?err(Ke()):ok(a)}async postToS3(e,t,r){let n=new AbortController,i=Xe(n.signal,r.signal),l=this.timers.setTimeout(()=>n.abort(),this.uploadDeadlineMs);try{let n={signal:i};return r.onProgress&&(n.onProgress=r.onProgress),await this.uploads.postMultipart(e,t,n),{ok:!0}}catch{return{ok:false,reason:n.signal.aborted&&r.signal?.aborted!==true?"timeout":"upload_error"}}finally{this.timers.clearTimeout(l)}}async getRecord(e){let t=this.consentEpoch.get(e)??0,r=await this.repository.getRecord(e);if(t!==(this.consentEpoch.get(e)??0))return err(/* @__PURE__ */Object.freeze({...makeEverfurError("accessDenied",{retryable:false}),recordsReason:"consent_required"}));if(!r.ok){let t=recordsDenialReasonOf(r.error);return t==="consent_required"?(this.recordCache.delete(e),this.telemetry.record("records.consent.denied",{pet_ref:e})):t==="entitlement"&&this.telemetry.record("records.capability.denied",{pet_ref:e}),err(r.error)}let n=ve(e,r.value);return n.petRef!==e?err(Ke()):n.withheld?(this.telemetry.record("records.redaction.withheld",{pet_ref:e}),this.recordCache.delete(e),ok(n)):(this.recordCache.set(e,n),ok(n))}peekCachedRecord(e){return this.recordCache.get(e)??null}async getConsent(e){let t=await this.repository.getConsent(e);return t.ok?ok(Se(e,t.value)):err(t.error)}async grantConsent(e){let t=await this.repository.putConsent(e.petRef,{consent_version:e.consentVersion,idempotency_key:e.idempotencyKey});return t.ok?ok(Se(e.petRef,t.value)):(recordsDenialReasonOf(t.error)==="entitlement"&&this.telemetry.record("records.capability.denied",{pet_ref:e.petRef}),err(t.error))}async revokeConsent(e){let t=await this.repository.deleteConsent(e);return t.ok?(this.consentEpoch.set(e,(this.consentEpoch.get(e)??0)+1),this.recordCache.delete(e),ok(Se(e,t.value))):err(t.error)}async getMemberConsent(){let e=await(this.repository.getMemberConsent?.());return e?e.ok?ok(Re(e.value)):e:err(makeEverfurError("resourceNotFound",{retryable:false,httpStatus:404}))}grantConsentAllPets(e){return this.allPets(e,true)}revokeConsentAllPets(e){return this.allPets(e,false)}async allPets(e,t){let{petRef:petRef,consentVersion:r,idempotencyKey:n}=e,i=await(t?this.repository.putMemberConsent?.({consent_version:r,idempotency_key:n}):this.repository.deleteMemberConsent?.());if(i?.ok){let r=Re(i.value);if(!t){let t=/* @__PURE__ */new Set([petRef,...this.recordCache.keys(),...r.pets.map(e=>e.petRef)]);for(let e of t)this.consentEpoch.set(e,(this.consentEpoch.get(e)??0)+1);this.recordCache.clear();for(let r of t)e.onRevoked?.(r)}return ok(r)}if(i&&i.error.httpStatus!==404&&i.error.httpStatus!==405)return t&&recordsDenialReasonOf(i.error)==="entitlement"&&this.telemetry.record("records.capability.denied",{pet_ref:petRef}),i;let l;try{l=e.listPetRefs?ok(await e.listPetRefs()):await(this.repository.listPetRefs?.())??err(makeEverfurError("notImplemented",{retryable:!1}))}catch{l=err(makeEverfurError("internalError"))}let o=[],a=[];for(let i of l.ok?/* @__PURE__ */new Set([petRef,...l.value]):[petRef]){let l=await(t?this.grantConsent({petRef:i,consentVersion:r,idempotencyKey:n}):this.revokeConsent(i));if(l.ok)t||e.onRevoked?.(i);else{if(t&&i===petRef)return l;a.push(/* @__PURE__ */Object.freeze({petRef:i,error:l.error}))}o.push(l.ok?l.value:Se(i,null))}let s=t?null:a[0]?.error??(l.ok?null:l.error);return s?err(s):ok(Me(o,a))}reportCapabilityDenied(e){this.telemetry.record("records.capability.denied",e?{pet_ref:e}:{})}observeRequest(e){e.reviewStartedAt!==null&&!this.reportedGaps.has(e.id)&&(this.reportedGaps.add(e.id),this.telemetry.record("records.parse.gap",{request_id:e.id}))}onRequestError(e){return recordsDenialReasonOf(e)==="entitlement"&&this.telemetry.record("records.capability.denied",{}),err(e)}};function We(e,t){if(!Y(e.mimeType,t))return"unsupported_format";let r=e.sizeBytes;return typeof r!="number"||!Number.isFinite(r)||r<=0||r>Oe?"oversize":null}function Ue(e){let t=e.wireMessage;return t==="unsupported_format"||t==="oversize"||t==="corrupt"?t:null}function Ge(e){return makeEverfurError("mediaUploadFailed",{retryable:false,wireMessage:e})}function Ke(){return makeEverfurError("internalError",{retryable:true})}var Ye={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)};function Xe(e,t){if(!t)return e;let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),r.signal;let n=()=>r.abort();return e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",n,{once:true}),r.signal}function Qe(){let e=0;return()=>`records-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
15
- 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 Je="x-everfur-anon-token",Ze="anonTokenInvalid";async function et(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function tt(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[Je]=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:{...rt(e.headers),...authHeaders(t)}}}function rt(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===Je||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await et(t),n=await t.transport.request(withAuthHeaders(e,nt(t,r)));if(n.ok||lt(n.error.raw)!==Ze||t.anonIdentity===void 0||t.userRef!==null)return n;let i=await t.anonIdentity.token({forceRefresh:true});return i===null||i===r?n:t.transport.request(withAuthHeaders(e,nt(t,i)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(tt(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 i;try{i=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(tt(e,{wireCode:lt(n.error.raw),requestId:n.error.requestId}))}let l=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!l.ok&&l.error.httpStatus===401?(t.identity.reportRejected?.(),err(it(l.error))):l}function nt(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function it(e){let t=e.raw,r=lt(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 lt(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 ot="1.6.0";function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:at(e)})}function at(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var st=3e4,dt=b*2,ct="idempotency-key",ut=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),ht=/* @__PURE__ */Object.freeze({onEvent(){}}),pt=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function gt(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??ht,r=e.timers??pt,n=e.rng??Math.random,i=e.sleep??((e,t)=>It(e,r,t)),l=e.maxAttempts??y,o=e.unaryTimeoutMs??st,a=e.newIdempotencyKey??mt(),s=e=>{try{t.onEvent(e)}catch{}};async function d(t,d,c){let u=c?.maxAttempts,h=Math.max(1,u??l),p=c?.idempotent??ut.has(d.method),g=c?.idempotencyKey===void 0?null:gt(c.idempotencyKey),f=p?g??a():null,m=ft(d,f),b=0;for(;;){let l=e=>/* @__PURE__ */Object.freeze({call:t,method:d.method,path:d.path,attempt:b,...f?{idempotencyKey:f}:{},...e});s(l({phase:"attempt"}));let a=_t(o,r),c=zt(a.signal,d.signal),p;try{p=await authedSend({...m,signal:c.signal},e.auth)}catch(e){p=err(networkError(e))}finally{c.dispose(),a.cancel()}if(p.ok)return s(l({phase:"settled",ok:true,reason:"ok"})),p;let g=p.error,y=yt(g,b,{maxAttempts:h,rng:n,now:r.now(),aborted:d.signal?.aborted===true,...u!==void 0?{perCallMaxAttempts:u}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),x={ok:false,code:g.code,reason:y.reason,...g.httpStatus!==void 0?{httpStatus:g.httpStatus}:{},...g.requestId!==void 0?{requestId:g.requestId}:{}};if(!y.retry)return s(l({phase:"settled",...x})),err(g);if(s(l({phase:"retry",...x,delayMs:y.delayMs})),await i(y.delayMs,d.signal),d.signal?.aborted===true)return s(l({phase:"settled",...x,reason:"aborted"})),err(g);b+=1}}async function c(t){return withAuthHeaders(t,await Tt(e.auth))}async function*u(t,r,n){s(
13
+ return Object.freeze({scope:"all_pets",granted:r.granted===true,version:r.version??null,grantedAt:r.granted_at??null,pets:/* @__PURE__ */Object.freeze((r.pets??[]).map(e=>Se("",e)).filter(e=>e.petRef))})}function Te(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function _e(e,t){return typeof e=="string"&&e.length>0?e:t}function ze(e){return typeof e=="string"&&e.length>0?e:null}var Ie=/* @__PURE__ */Object.freeze(["published","failed","revoked"]);function isTerminalStatus(e){return Ie.includes(e)}function recordsDenialReasonOf(e){if(e===null)return null;let t=e.recordsReason;return t==="consent_required"||t==="session_required"||t==="entitlement"||t==="pet_not_found"?t:null}var De="records_consent_required";function He(e){let t=e.raw;if(t===null||typeof t!="object")return null;let r=t,n=typeof r.error=="object"&&r.error!==null?r.error.code:r.code;return typeof n=="string"&&n.length>0?n:null}function Ve(e){return e===null||e.httpStatus!==409?false:He(e)===De}var Pe=/* @__PURE__ */Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function Le(e){return e!==Pe}var Oe=/* @__PURE__ */Object.freeze({record(){}}),Ee=25*1024*1024,Ae=64,$e=128,Be=128;var Fe=9e4;function Me(e,t){let r=!t[0]&&e.length>0&&e.every(e=>e.granted);/* @__PURE__ */
14
+ return Object.freeze({scope:"all_pets",granted:r,version:r?e[0]?.version??null:null,grantedAt:null,pets:/* @__PURE__ */Object.freeze(e),...t[0]?{failed:/* @__PURE__ */Object.freeze(t)}:{}})}function qe(e){return new Ne(e)}var Ne=class{constructor(e){this.recordCache=/* @__PURE__ */new Map;this.consentEpoch=/* @__PURE__ */new Map;this.reportedGaps=/* @__PURE__ */new Set;this.features=X;this.repository=e.repository,this.uploads=e.uploads,this.telemetry=e.telemetry??Oe,this.newIdempotencyKey=e.newIdempotencyKey??Qe(),this.timers=e.timers??Ye,this.uploadDeadlineMs=e.uploadDeadlineMs??Fe}async createUploadRequest(e){let t=await this.repository.createRequest({pet_ref:e.petRef,idempotency_key:e.idempotencyKey});if(!t.ok)return this.onRequestError(t.error);let r=le(t.value);return r===null?err(Ke()):(this.observeRequest(r),ok(r))}async getRequest(e){let t=await this.repository.getRequest(e);if(!t.ok)return this.onRequestError(t.error);let r=le(t.value);return r===null?err(Ke()):(this.observeRequest(r),ok(r))}async listRequests(){let e=await this.repository.listRequests();if(!e.ok)return this.onRequestError(e.error);let t=de(e.value);for(let e of t)this.observeRequest(e);return ok(t)}async readFeatures(){let e=this.repository.getFeatures;if(e===void 0)return this.features=X;let t=X;try{let r=await e.call(this.repository);r.ok&&(t=J(r.value))}catch{}return this.features=t,t}async uploadDocument(e){let{requestId:t,file:r}=e,n=We(r,this.features.uploadContentTypes);if(n!==null)return this.telemetry.record("records.upload.rejected",{reason:n}),err(Ge(`upload rejected: ${n}`));let i=await this.repository.initiateUpload(t,{content_type:r.mimeType,file_size:r.sizeBytes});if(!i.ok)return this.onRequestError(i.error);let l=await this.postToS3(i.value,r,e);if(!l.ok)return this.telemetry.record("records.upload.failed",{reason:l.reason}),err(Ge(l.reason));let o=await this.repository.completeUpload(t,{upload_id:i.value.upload_id});if(!o.ok)return o.error.code==="mediaUploadFailed"&&this.telemetry.record("records.upload.rejected",{reason:Ue(o.error)??"corrupt"}),this.onRequestError(o.error);let a=ue(o.value);return a===null?err(Ke()):ok(a)}async postToS3(e,t,r){let n=new AbortController,i=Xe(n.signal,r.signal),l=this.timers.setTimeout(()=>n.abort(),this.uploadDeadlineMs);try{let n={signal:i};return r.onProgress&&(n.onProgress=r.onProgress),await this.uploads.postMultipart(e,t,n),{ok:!0}}catch{return{ok:false,reason:n.signal.aborted&&r.signal?.aborted!==true?"timeout":"upload_error"}}finally{this.timers.clearTimeout(l)}}async getRecord(e){let t=this.consentEpoch.get(e)??0,r=await this.repository.getRecord(e);if(t!==(this.consentEpoch.get(e)??0))return err(/* @__PURE__ */Object.freeze({...makeEverfurError("accessDenied",{retryable:false}),recordsReason:"consent_required"}));if(!r.ok){let t=recordsDenialReasonOf(r.error);return t==="consent_required"?(this.recordCache.delete(e),this.telemetry.record("records.consent.denied",{pet_ref:e})):t==="entitlement"&&this.telemetry.record("records.capability.denied",{pet_ref:e}),err(r.error)}let n=ve(e,r.value);return n.petRef!==e?err(Ke()):n.withheld?(this.telemetry.record("records.redaction.withheld",{pet_ref:e}),this.recordCache.delete(e),ok(n)):(this.recordCache.set(e,n),ok(n))}peekCachedRecord(e){return this.recordCache.get(e)??null}async getConsent(e){let t=await this.repository.getConsent(e);return t.ok?ok(Se(e,t.value)):err(t.error)}async grantConsent(e){let t=await this.repository.putConsent(e.petRef,{consent_version:e.consentVersion,idempotency_key:e.idempotencyKey});return t.ok?ok(Se(e.petRef,t.value)):(recordsDenialReasonOf(t.error)==="entitlement"&&this.telemetry.record("records.capability.denied",{pet_ref:e.petRef}),err(t.error))}async revokeConsent(e){let t=await this.repository.deleteConsent(e);return t.ok?(this.consentEpoch.set(e,(this.consentEpoch.get(e)??0)+1),this.recordCache.delete(e),ok(Se(e,t.value))):err(t.error)}async getMemberConsent(){let e=await(this.repository.getMemberConsent?.());return e?e.ok?ok(Re(e.value)):e:err(makeEverfurError("resourceNotFound",{retryable:false,httpStatus:404}))}grantConsentAllPets(e){return this.allPets(e,true)}revokeConsentAllPets(e){return this.allPets(e,false)}async allPets(e,t){let{petRef:petRef,consentVersion:r,idempotencyKey:n}=e,i=await(t?this.repository.putMemberConsent?.({consent_version:r,idempotency_key:n}):this.repository.deleteMemberConsent?.());if(i?.ok){let r=Re(i.value);if(!t){let t=/* @__PURE__ */new Set([petRef,...this.recordCache.keys(),...r.pets.map(e=>e.petRef)]);for(let e of t)this.consentEpoch.set(e,(this.consentEpoch.get(e)??0)+1);this.recordCache.clear();for(let r of t)e.onRevoked?.(r)}return ok(r)}if(i&&i.error.httpStatus!==404&&i.error.httpStatus!==405)return t&&recordsDenialReasonOf(i.error)==="entitlement"&&this.telemetry.record("records.capability.denied",{pet_ref:petRef}),i;let l;try{l=e.listPetRefs?ok(await e.listPetRefs()):await(this.repository.listPetRefs?.())??err(makeEverfurError("notImplemented",{retryable:!1}))}catch{l=err(makeEverfurError("internalError"))}let o=[],a=[];for(let i of l.ok?/* @__PURE__ */new Set([petRef,...l.value]):[petRef]){let l=await(t?this.grantConsent({petRef:i,consentVersion:r,idempotencyKey:n}):this.revokeConsent(i));if(l.ok)t||e.onRevoked?.(i);else{if(t&&i===petRef)return l;a.push(/* @__PURE__ */Object.freeze({petRef:i,error:l.error}))}o.push(l.ok?l.value:Se(i,null))}let s=t?null:a[0]?.error??(l.ok?null:l.error);return s?err(s):ok(Me(o,a))}reportCapabilityDenied(e){this.telemetry.record("records.capability.denied",e?{pet_ref:e}:{})}observeRequest(e){e.reviewStartedAt!==null&&!this.reportedGaps.has(e.id)&&(this.reportedGaps.add(e.id),this.telemetry.record("records.parse.gap",{request_id:e.id}))}onRequestError(e){return recordsDenialReasonOf(e)==="entitlement"&&this.telemetry.record("records.capability.denied",{}),err(e)}};function We(e,t){if(!Y(e.mimeType,t))return"unsupported_format";let r=e.sizeBytes;return typeof r!="number"||!Number.isFinite(r)||r<=0||r>Ee?"oversize":null}function Ue(e){let t=e.wireMessage;return t==="unsupported_format"||t==="oversize"||t==="corrupt"?t:null}function Ge(e){return makeEverfurError("mediaUploadFailed",{retryable:false,wireMessage:e})}function Ke(){return makeEverfurError("internalError",{retryable:true})}var Ye={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)};function Xe(e,t){if(!t)return e;let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),r.signal;let n=()=>r.abort();return e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",n,{once:true}),r.signal}function Qe(){let e=0;return()=>`records-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
15
+ 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 Je="x-everfur-anon-token",Ze="anonTokenInvalid";async function et(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function tt(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[Je]=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:{...rt(e.headers),...authHeaders(t)}}}function rt(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===Je||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await et(t),n=await t.transport.request(withAuthHeaders(e,nt(t,r)));if(n.ok||lt(n.error.raw)!==Ze||t.anonIdentity===void 0||t.userRef!==null)return n;let i=await t.anonIdentity.token({forceRefresh:true});return i===null||i===r?n:t.transport.request(withAuthHeaders(e,nt(t,i)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(tt(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 i;try{i=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(tt(e,{wireCode:lt(n.error.raw),requestId:n.error.requestId}))}let l=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!l.ok&&l.error.httpStatus===401?(t.identity.reportRejected?.(),err(it(l.error))):l}function nt(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function it(e){let t=e.raw,r=lt(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 lt(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 ot="1.7.0";function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:at(e)})}function at(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var st=3e4,dt=b*2,ct="idempotency-key",ut=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),ht=/* @__PURE__ */Object.freeze({onEvent(){}}),pt=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function gt(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??ht,r=e.timers??pt,n=e.rng??Math.random,i=e.sleep??((e,t)=>It(e,r,t)),l=e.maxAttempts??y,o=e.unaryTimeoutMs??st,a=e.newIdempotencyKey??mt(),s=e=>{try{t.onEvent(e)}catch{}};async function d(t,d,c){let u=c?.maxAttempts,h=Math.max(1,u??l),p=c?.idempotent??ut.has(d.method),g=c?.idempotencyKey===void 0?null:gt(c.idempotencyKey),f=p?g??a():null,m=ft(d,f),b=0;for(;;){let l=e=>/* @__PURE__ */Object.freeze({call:t,method:d.method,path:d.path,attempt:b,...f?{idempotencyKey:f}:{},...e});s(l({phase:"attempt"}));let a=_t(o,r),c=zt(a.signal,d.signal),p;try{p=await authedSend({...m,signal:c.signal},e.auth)}catch(e){p=err(networkError(e))}finally{c.dispose(),a.cancel()}if(p.ok)return s(l({phase:"settled",ok:true,reason:"ok"})),p;let g=p.error,y=yt(g,b,{maxAttempts:h,rng:n,now:r.now(),aborted:d.signal?.aborted===true,...u!==void 0?{perCallMaxAttempts:u}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),x={ok:false,code:g.code,reason:y.reason,...g.httpStatus!==void 0?{httpStatus:g.httpStatus}:{},...g.requestId!==void 0?{requestId:g.requestId}:{}};if(!y.retry)return s(l({phase:"settled",...x})),err(g);if(s(l({phase:"retry",...x,delayMs:y.delayMs})),await i(y.delayMs,d.signal),d.signal?.aborted===true)return s(l({phase:"settled",...x,reason:"aborted"})),err(g);b+=1}}async function c(t){return withAuthHeaders(t,await Tt(e.auth))}async function*u(t,r,n){s(
16
16
  /* @__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
- return Object.freeze({send:d,authorize:c,stream:u})}function ft(e,t){let r={};for(let[t,n]of Object.entries(e.headers??{}))t.toLowerCase()!==ct&&(r[t]=n);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}function mt(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var bt=10;function yt(e,t,r){if(r.aborted)return{retry:false,reason:"aborted"};let n=xt(e);if(n==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if((()=>{if(r.policy===void 0)return false;try{return!r.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let l=()=>{if(r.policy===void 0)return null;let t;try{t=r.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(bt,Math.floor(t)))},o=r.perCallMaxAttempts??l()??r.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let a=wt(e,r.now);return a!==null?a>dt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:a}:{retry:true,reason:i,delayMs:backoffDelayMs(t,r.rng)}}function xt(e){let t=e.code==="unknown"?fromWire(Ct(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function wt(e,t){let r=kt(e.raw);if(r!==null){let e=r-t;return e>0?e:0}let n=vt(e.raw);return n===null?null:Math.round(n*1e3)}function vt(e){for(let t of jt(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function kt(e){for(let t of jt(e)){let e=t.resets_at,r=St(e);if(r!==null)return r}return null}function jt(e){if(!Rt(e))return[];let t=[e];for(let r of["error","detail"]){let n=e[r];Rt(n)&&t.push(n)}return t}function St(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}function Ct(e){for(let t of jt(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function Rt(e){return typeof e=="object"&&e!==null}async function Tt(e){if(e.mode==="anonymous"){let t=await et(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function _t(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return{signal:r.signal,cancel:()=>t.clearTimeout(n)}}function zt(e,t){let r=()=>{};if(!t)return{signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let i=()=>n.abort();return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i)}}}function It(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",l),n()},e),l=()=>{t.clearTimeout(i),n()};r?.addEventListener("abort",l,{once:true})})}function Dt(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 Ht(e){return[...e].length}function Vt(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function Pt(e){return e.code!=="conversationNotFound"?e:makeEverfurError("resourceNotFound",{retryable:false,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},...e.requestId===void 0?{}:{requestId:e.requestId},...e.reasonCode===void 0?{}:{reasonCode:e.reasonCode},...e.wireMessage===void 0?{}:{wireMessage:e.wireMessage},...e.raw===void 0?{}:{raw:e.raw}})}function Lt(e){return e.ok?e:err(Pt(e.error))}function Et(e){return{send:async(...t)=>Lt(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,r,n)=>e.stream(t,r,n)}}var Ot="/widget/v1/records";function At(e){let{auth:t}=e,r=t.mode,n=e.funnel??createRequestFunnel({auth:t,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),i=async(e,t,i)=>{let l=await n.send(e,t);return l.ok?l:err(Mt(Pt(l.error),r,i))},l=(e,t)=>typeof t!="string"||t.length===0?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${e} is required and must be a non-empty string`}):Dt(t)?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${e} contains an unpaired surrogate and cannot be encoded`}):null,o=(e,t,r)=>{let n=l(e,t);if(n!==null)return n;let i=[...t].length;return i>r?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${e} is ${i} characters; the server accepts at most ${r}`}):null},a=(...e)=>e.find(e=>e!==null)??null,s=e=>a(o("consent_version",e.consent_version,Ae),o("idempotency_key",e.idempotency_key,$e));return{createRequest:e=>{let t=a(o("idempotency_key",e.idempotency_key,$e),o("pet_ref",e.pet_ref,Be));return t?Promise.resolve(err(t)):i("records.createRequest",Nt(`${Ot}/requests`,e),"request")},initiateUpload:(e,t)=>{let r=l("request_id",e);return r?Promise.resolve(err(r)):i("records.initiateUpload",Nt(`${Ot}/requests/${encodeURIComponent(e)}/uploads/initiate`,t),"request")},completeUpload:(e,t)=>{let r=l("request_id",e);return r?Promise.resolve(err(r)):i("records.completeUpload",Nt(`${Ot}/requests/${encodeURIComponent(e)}/uploads/complete`,t),"request")},getRequest:e=>{let t=l("request_id",e);return t?Promise.resolve(err(t)):i("records.getRequest",qt(`${Ot}/requests/${encodeURIComponent(e)}`),"request")},listRequests:async()=>{let e=await i("records.listRequests",qt(`${Ot}/requests`),"request");if(!e.ok)return e;let t=e.value;return{ok:true,value:Array.isArray(t)?t:t.items??[]}},listPetRefs:async()=>{let e=await i("records.listPetRefs",qt("/widget/v1/pets"),"request");if(!e.ok)return e;let t=e.value,r=Array.isArray(t)?t:t?.pets;return{ok:true,value:(Array.isArray(r)?r:[]).map(e=>e?.pet_ref).filter(e=>typeof e=="string"&&e.length>0)}},getRecord:petRef=>{let e=o("pet_ref",petRef,Be);return e?Promise.resolve(err(e)):i("records.getRecord",qt(`${Ot}/pets/${encodeURIComponent(petRef)}/record`),"content")},getConsent:petRef=>{let e=o("pet_ref",petRef,Be);return e?Promise.resolve(err(e)):i("records.getConsent",qt(`${Ot}/pets/${encodeURIComponent(petRef)}/consent`),"consent")},putConsent:(petRef,e)=>{let t=a(s(e),o("pet_ref",petRef,Be));return t?Promise.resolve(err(t)):i("records.putConsent",Wt(`${Ot}/pets/${encodeURIComponent(petRef)}/consent`,e),"consent")},getMemberConsent:()=>i("records.getMemberConsent",qt(`${Ot}/consent`),"consent"),putMemberConsent:e=>{let t=s(e);return t?Promise.resolve(err(t)):i("records.putMemberConsent",Wt(`${Ot}/consent`,e),"consent")},deleteMemberConsent:()=>i("records.deleteMemberConsent",Ut(`${Ot}/consent`),"consent"),getFeatures:()=>i("records.getFeatures",qt(`${Ot}/features`),"request"),deleteConsent:petRef=>{let e=o("pet_ref",petRef,Be);return e?Promise.resolve(err(e)):i("records.deleteConsent",Ut(`${Ot}/pets/${encodeURIComponent(petRef)}/consent`),"consent")}}}function $t(e,t){let r={...e,recordsReason:t};for(let t of["wireMessage","raw"]){let n=Object.getOwnPropertyDescriptor(e,t);n!==void 0&&Object.defineProperty(r,t,n)}/* @__PURE__ */
18
- return Object.freeze(r)}var Bt="pet_not_registered";function Ft(e){return e.httpStatus!==404?null:e.reasonCode===Bt?"pet_not_found":"entitlement"}function Mt(e,t,r){let n=Ft(e);return n!==null?$t(e,n):e.code!=="accessDenied"?e:$t(e,t==="anonymous"?"session_required":r==="content"?"consent_required":"entitlement")}function qt(e){return{method:"GET",path:e}}function Nt(e,t){return{method:"POST",path:e,body:t}}function Wt(e,t){return{method:"PUT",path:e,body:t}}function Ut(e){return{method:"DELETE",path:e}}var Gt=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),Kt=globalThis,Yt=Kt[Gt]??(Kt[Gt]=e.createContext(null));Yt.displayName??="EverfurContext";function Xt(){let t=e.useContext(Yt);if(t===null)throw new T("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var Qt=/* @__PURE__ */new Map,Jt=/* @__PURE__ */new Set;function Zt(petRef){Qt.set(petRef,(Qt.get(petRef)??0)+1);for(let e of[...Jt])e()}function er(petRef){return Qt.get(petRef)??0}function tr(e){return Jt.add(e),()=>{Jt.delete(e)}}function rr(petRef){let t=e.useCallback(()=>er(petRef),[petRef]);return e.useSyncExternalStore(tr,t,t)}var nr={record:null,requests:[],consent:null,error:null,denialReason:null,withheld:false,loading:true,isUploading:false,uploadProgress:null,uploadQueue:[],uploadContentTypes:X.uploadContentTypes},ir=4e3,lr=30;function useEverfurRecords(t){let{petRef:petRef}=t,r=e.useRef(t.uploadTransport);r.current=t.uploadTransport;let n=t.uploadTransport!==void 0,{runtime:i,userRef:userRef,scopeEpoch:l}=Xt(),o=e.useMemo(()=>({}),[i,userRef,petRef,l,t.controller]),a=e.useRef(o),[s,d]=e.useState({scope:o,controller:t.controller??null}),c=t.controller??(s.scope===o?s.controller:null),[u,h]=e.useState({scope:o,value:nr}),p=u.scope===o?u.value:nr,g=e.useCallback(e=>{h(t=>t.scope===o?{scope:o,value:e(t.value)}:t)},[o]),f=e.useRef(0);e.useEffect(()=>(a.current=o,h({scope:o,value:nr}),()=>{a.current=null,f.current+=1}),[o]),e.useEffect(()=>{if(t.controller)return;let{services:e}=i.registry,l={record:(t,r)=>e.telemetry.track(t,r)},a=i.registry.acquire("records",`${userRef??""}|${petRef}${n?"|own-upload":""}`,()=>qe({repository:At({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),uploads:n?{postMultipart:(t,n,i)=>(r.current??e.uploadTransport).postMultipart(t,n,i)}:e.uploadTransport,telemetry:l}),()=>{});return d({scope:o,controller:a}),()=>{i.registry.release(a)}},[i,userRef,petRef,t.controller,l,o,n]);let m=e.useCallback(e=>{g(t=>({...t,...e}))},[g]),b=e.useCallback(async()=>{if(!c||a.current!==o)return;let e=f.current+=1;k.current=0,C(),m({loading:true,error:null,denialReason:null,withheld:false});let[t,r]=await Promise.all([c.getConsent(petRef),c.listRequests()]);if(e!==f.current)return;let n=t.ok?t.value:null,i=r.ok?r.value.filter(e=>e.petRef===petRef):[],l=r.ok?null:r.error;if(n&&n.granted){let t=await c.getRecord(petRef);if(e!==f.current)return;if(t.ok){m({consent:n,requests:i,record:t.value,withheld:t.value.withheld,error:t.value.withheld?hr():l,denialReason:null,loading:false});return}m({consent:n,requests:i,record:null,error:t.error,denialReason:recordsDenialReasonOf(t.error),withheld:false,loading:false});return}m({consent:n,requests:i,record:null,error:t.ok?l:t.error,denialReason:n?"consent_required":ur(t),withheld:false,loading:false})},[c,petRef,m,o]);e.useEffect(()=>(b(),()=>{f.current+=1}),[b]);let y=t.readUploadFeatures===true;e.useEffect(()=>{if(!y||!c?.readFeatures)return;let e=true;return c.readFeatures().then(t=>{e&&a.current===o&&m({uploadContentTypes:t.uploadContentTypes})}),()=>{e=false}},[c,y,m,o]);let x=e.useMemo(()=>dr(p.requests),[p.requests]),w=x?.id??null,v=x?.status??null,k=e.useRef(0),j=e.useRef(null),[S,C]=e.useReducer(e=>e+1,0);e.useEffect(()=>{if(!c||w===null||v===null||isTerminalStatus(v)||v==="in_review")return;j.current!==String(w)&&(j.current=String(w),k.current=0);let e=false,t=async()=>{if(e||k.current>=lr)return;k.current+=1;let n=await c.getRequest(w);if(!e){if(n.ok&&n.value.petRef===petRef){if(g(e=>({...e,requests:cr(e.requests,n.value)})),isTerminalStatus(n.value.status)){n.value.status==="published"&&b();return}if(n.value.status==="in_review")return}r=setTimeout(()=>{t()},ir)}},r=setTimeout(()=>{t()},ir);return()=>{e=true,clearTimeout(r)}},[c,w,v,b,S,petRef,g]);let R=e.useCallback(async e=>{if(!c||a.current!==o)return pr();let t=await c.createUploadRequest({petRef:petRef,idempotencyKey:e});return a.current===o&&t.ok&&t.value.petRef===petRef&&g(e=>({...e,requests:cr(e.requests,t.value)})),t},[c,petRef,o,g]),T=e.useCallback((e,t)=>{g(r=>({...r,uploadQueue:r.uploadQueue.map(r=>r.key===e?t(r):r)}))},[g]),_=e.useCallback(async(e,t)=>{let r=Date.now().toString(36),n=t.map((e,t)=>{let n=or(e,p.uploadContentTypes);return{key:`${r}-${t}`,name:e.name??null,status:n===null?"queued":"skipped",progress:0,skipReason:n,error:null}}),i=[...n];if(!c||a.current!==o)/* @__PURE__ */return Object.freeze(i);g(e=>({...e,uploadQueue:n,isUploading:true,uploadProgress:0}));for(let[r,l]of t.entries()){let t=n[r];if(t.status==="skipped")continue;if(a.current!==o)break;T(t.key,e=>({...e,status:"uploading",progress:0})),m({uploadProgress:0});let s=await c.uploadDocument({requestId:e,file:l,onProgress:e=>{if(a.current!==o)return;let r=Math.min(1,Math.max(0,e));T(t.key,e=>({...e,progress:Math.max(e.progress,r)})),m({uploadProgress:r})}});if(a.current!==o)break;let d=s.ok?{...t,status:"done",progress:1}:{...t,status:"failed",error:s.error};if(i[r]=d,T(t.key,()=>d),s.ok){let t=await c.getRequest(e);a.current===o&&t.ok&&t.value.petRef===petRef&&g(e=>({...e,requests:cr(e.requests,t.value)}))}}return a.current===o&&m({isUploading:false,uploadProgress:null}),/* @__PURE__ */Object.freeze(i)},[c,m,T,petRef,o,g,p.uploadContentTypes]),z=e.useCallback(async(e,t)=>{if(!c||a.current!==o)return pr();let r=`${Date.now().toString(36)}-0`;g(e=>({...e,isUploading:true,uploadProgress:0,uploadQueue:[{key:r,name:t.name??null,status:"uploading",progress:0,skipReason:null,error:null}]}));let n=await c.uploadDocument({requestId:e,file:t,onProgress:e=>{a.current===o&&(m({uploadProgress:e}),T(r,t=>({...t,progress:Math.max(t.progress,Math.min(1,e))})))}});if(a.current!==o)return n;if(m({isUploading:false,uploadProgress:null}),T(r,e=>n.ok?{...e,status:"done",progress:1}:{...e,status:"failed",error:n.error}),n.ok){let t=await c.getRequest(e);a.current===o&&t.ok&&t.value.petRef===petRef&&g(e=>({...e,requests:cr(e.requests,t.value)}))}return n},[c,m,T,petRef,o,g]),I=t.consentScope==="all_pets"&&c?.grantConsentAllPets&&c.revokeConsentAllPets?"all_pets":"pet",D=e.useCallback(async(e,t)=>{if(!c||a.current!==o)return pr();let r;if(I==="all_pets"&&c.grantConsentAllPets){let n=await c.grantConsentAllPets({petRef:petRef,consentVersion:e,idempotencyKey:t}),i=n.ok?n.value.failed?.[0]:void 0;r=n.ok?i?err(i.error):ok(n.value.pets.find(e=>e.petRef===petRef)??Se(petRef,{granted:n.value.granted,version:n.value.version,granted_at:n.value.grantedAt})):n}else r=await c.grantConsent({petRef:petRef,consentVersion:e,idempotencyKey:t});return r.ok&&a.current===o&&b(),r},[c,petRef,b,o,I]),H=e.useCallback(e=>{Zt(e),!(e!==petRef||a.current!==o)&&(f.current+=1,m({record:null,withheld:false,loading:false,denialReason:"consent_required",consent:Se(petRef,null)}))},[petRef,m,o]),V=e.useCallback(async()=>{if(!c||a.current!==o)return pr();if(!c.revokeConsentAllPets)return err(makeEverfurError("notImplemented",{retryable:false}));let e=false,t=await c.revokeConsentAllPets({petRef:petRef,onRevoked:t=>{e=true,H(t)}});if(t.ok&&!e)for(let e of[petRef,...t.value.pets.map(e=>e.petRef)])H(e);return t},[c,petRef,o,H]),P=e.useCallback(async()=>{if(!c||a.current!==o)return pr();if(I==="all_pets"){let e=await V();return e.ok?ok(e.value.pets.find(e=>e.petRef===petRef)??Se(petRef,null)):e}let e=await c.revokeConsent(petRef);return e.ok&&H(petRef),e.ok&&a.current===o&&m({consent:e.value}),e},[c,petRef,m,o,I,V,H]),L=e.useCallback(()=>b(),[b]),E=sr(p,c!==null);return e.useMemo(()=>({status:E,record:p.record,requests:p.requests,activeRequest:x,consent:p.consent,consentScope:I,error:p.error,denialReason:p.denialReason,withheld:p.withheld,isUploading:p.isUploading,uploadProgress:p.uploadProgress,uploadQueue:p.uploadQueue,uploadContentTypes:p.uploadContentTypes,createRequest:R,uploadDocument:z,uploadDocuments:_,grantConsent:D,revokeConsent:P,revokeConsentAllPets:V,refresh:L}),[E,p,x,I,R,z,_,D,P,V,L])}function or(e,t){if(!Y(e.mimeType,t))return"unsupported";let r=e.sizeBytes;return typeof r!="number"||!Number.isFinite(r)||r<=0||r>Oe?"too_large":null}function ar(e,t){let r=[],n=[];for(let i of e){let e=or(i,t);e===null?r.push(i):n.push({name:i.name??null,reason:e})}return{uploadable:r,skipped:n}}function sr(e,t){return e.loading||!t?"loading":e.withheld||e.denialReason!==null||e.error!==null?"error":e.record!==null&&!e.record.isEmpty||e.requests.length>0?"populated":"empty"}function dr(e){if(e.length===0)return null;let t=e[0];for(let r of e)r.updatedAt>t.updatedAt&&(t=r);return t}function cr(e,t){let r=e.filter(e=>e.id!==t.id);return[t,...r]}function ur(e){return e.ok?"consent_required":recordsDenialReasonOf(e.error)??"consent_required"}function hr(){return makeEverfurError("internalError",{retryable:false})}function pr(){return{ok:false,error:makeEverfurError("internalError",{retryable:true})}}function gr(e){let t={};if(e==null)return t;for(let r of Object.keys(e))e[r]!==void 0&&(t[r]=e[r]);return t}function fr(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function mr(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function br(e,...t){if(typeof e=="function")try{let r=e(...t);return mr(r)&&Promise.resolve(r).then(void 0,fr),r}catch(e){fr(e);return}}var yr=/* @__PURE__ */new WeakMap;function xr(e){if(typeof e!="function")return;let t=yr.get(e);if(t!==void 0)return t;let r=(...t)=>{br(e,...t)};return yr.set(e,r),r}function wr(e,t){let r=null;for(let n of t){let t=e[n];typeof t=="function"&&(r??={...e},r[n]=xr(t))}return r??e}function vr(e,...t){let r;try{r=e(...t)}catch(e){return fr(e),Promise.resolve({ok:false,error:e})}return Promise.resolve(r).then(e=>({ok:true,value:e}),e=>({ok:false,error:e}))}var kr=/* @__PURE__ */Object.freeze({name:"dashboard"});function initialRecordsNav(e=kr){/* @__PURE__ */
17
+ return Object.freeze({send:d,authorize:c,stream:u})}function ft(e,t){let r={};for(let[t,n]of Object.entries(e.headers??{}))t.toLowerCase()!==ct&&(r[t]=n);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}function mt(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var bt=10;function yt(e,t,r){if(r.aborted)return{retry:false,reason:"aborted"};let n=xt(e);if(n==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if((()=>{if(r.policy===void 0)return false;try{return!r.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let l=()=>{if(r.policy===void 0)return null;let t;try{t=r.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(bt,Math.floor(t)))},o=r.perCallMaxAttempts??l()??r.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let a=wt(e,r.now);return a!==null?a>dt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:a}:{retry:true,reason:i,delayMs:backoffDelayMs(t,r.rng)}}function xt(e){let t=e.code==="unknown"?fromWire(Ct(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function wt(e,t){let r=kt(e.raw);if(r!==null){let e=r-t;return e>0?e:0}let n=vt(e.raw);return n===null?null:Math.round(n*1e3)}function vt(e){for(let t of jt(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function kt(e){for(let t of jt(e)){let e=t.resets_at,r=St(e);if(r!==null)return r}return null}function jt(e){if(!Rt(e))return[];let t=[e];for(let r of["error","detail"]){let n=e[r];Rt(n)&&t.push(n)}return t}function St(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}function Ct(e){for(let t of jt(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function Rt(e){return typeof e=="object"&&e!==null}async function Tt(e){if(e.mode==="anonymous"){let t=await et(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function _t(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return{signal:r.signal,cancel:()=>t.clearTimeout(n)}}function zt(e,t){let r=()=>{};if(!t)return{signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let i=()=>n.abort();return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i)}}}function It(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",l),n()},e),l=()=>{t.clearTimeout(i),n()};r?.addEventListener("abort",l,{once:true})})}function Dt(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 Ht(e){return[...e].length}function Vt(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function Pt(e){return e.code!=="conversationNotFound"?e:makeEverfurError("resourceNotFound",{retryable:false,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},...e.requestId===void 0?{}:{requestId:e.requestId},...e.reasonCode===void 0?{}:{reasonCode:e.reasonCode},...e.wireMessage===void 0?{}:{wireMessage:e.wireMessage},...e.raw===void 0?{}:{raw:e.raw}})}function Lt(e){return e.ok?e:err(Pt(e.error))}function Ot(e){return{send:async(...t)=>Lt(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,r,n)=>e.stream(t,r,n)}}var Et="/widget/v1/records";function At(e){let{auth:t}=e,r=t.mode,n=e.funnel??createRequestFunnel({auth:t,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),i=async(e,t,i)=>{let l=await n.send(e,t);return l.ok?l:err(Mt(Pt(l.error),r,i))},l=(e,t)=>typeof t!="string"||t.length===0?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${e} is required and must be a non-empty string`}):Dt(t)?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${e} contains an unpaired surrogate and cannot be encoded`}):null,o=(e,t,r)=>{let n=l(e,t);if(n!==null)return n;let i=[...t].length;return i>r?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${e} is ${i} characters; the server accepts at most ${r}`}):null},a=(...e)=>e.find(e=>e!==null)??null,s=e=>a(o("consent_version",e.consent_version,Ae),o("idempotency_key",e.idempotency_key,$e));return{createRequest:e=>{let t=a(o("idempotency_key",e.idempotency_key,$e),o("pet_ref",e.pet_ref,Be));return t?Promise.resolve(err(t)):i("records.createRequest",Nt(`${Et}/requests`,e),"request")},initiateUpload:(e,t)=>{let r=l("request_id",e);return r?Promise.resolve(err(r)):i("records.initiateUpload",Nt(`${Et}/requests/${encodeURIComponent(e)}/uploads/initiate`,t),"request")},completeUpload:(e,t)=>{let r=l("request_id",e);return r?Promise.resolve(err(r)):i("records.completeUpload",Nt(`${Et}/requests/${encodeURIComponent(e)}/uploads/complete`,t),"request")},getRequest:e=>{let t=l("request_id",e);return t?Promise.resolve(err(t)):i("records.getRequest",qt(`${Et}/requests/${encodeURIComponent(e)}`),"request")},listRequests:async()=>{let e=await i("records.listRequests",qt(`${Et}/requests`),"request");if(!e.ok)return e;let t=e.value;return{ok:true,value:Array.isArray(t)?t:t.items??[]}},listPetRefs:async()=>{let e=await i("records.listPetRefs",qt("/widget/v1/pets"),"request");if(!e.ok)return e;let t=e.value,r=Array.isArray(t)?t:t?.pets;return{ok:true,value:(Array.isArray(r)?r:[]).map(e=>e?.pet_ref).filter(e=>typeof e=="string"&&e.length>0)}},getRecord:petRef=>{let e=o("pet_ref",petRef,Be);return e?Promise.resolve(err(e)):i("records.getRecord",qt(`${Et}/pets/${encodeURIComponent(petRef)}/record`),"content")},getConsent:petRef=>{let e=o("pet_ref",petRef,Be);return e?Promise.resolve(err(e)):i("records.getConsent",qt(`${Et}/pets/${encodeURIComponent(petRef)}/consent`),"consent")},putConsent:(petRef,e)=>{let t=a(s(e),o("pet_ref",petRef,Be));return t?Promise.resolve(err(t)):i("records.putConsent",Wt(`${Et}/pets/${encodeURIComponent(petRef)}/consent`,e),"consent")},getMemberConsent:()=>i("records.getMemberConsent",qt(`${Et}/consent`),"consent"),putMemberConsent:e=>{let t=s(e);return t?Promise.resolve(err(t)):i("records.putMemberConsent",Wt(`${Et}/consent`,e),"consent")},deleteMemberConsent:()=>i("records.deleteMemberConsent",Ut(`${Et}/consent`),"consent"),getFeatures:()=>i("records.getFeatures",qt(`${Et}/features`),"request"),deleteConsent:petRef=>{let e=o("pet_ref",petRef,Be);return e?Promise.resolve(err(e)):i("records.deleteConsent",Ut(`${Et}/pets/${encodeURIComponent(petRef)}/consent`),"consent")}}}function $t(e,t){let r={...e,recordsReason:t};for(let t of["wireMessage","raw"]){let n=Object.getOwnPropertyDescriptor(e,t);n!==void 0&&Object.defineProperty(r,t,n)}/* @__PURE__ */
18
+ return Object.freeze(r)}var Bt="pet_not_registered";function Ft(e){return e.httpStatus!==404?null:e.reasonCode===Bt?"pet_not_found":"entitlement"}function Mt(e,t,r){let n=Ft(e);return n!==null?$t(e,n):e.code!=="accessDenied"?e:$t(e,t==="anonymous"?"session_required":r==="content"?"consent_required":"entitlement")}function qt(e){return{method:"GET",path:e}}function Nt(e,t){return{method:"POST",path:e,body:t}}function Wt(e,t){return{method:"PUT",path:e,body:t}}function Ut(e){return{method:"DELETE",path:e}}var Gt=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),Kt=globalThis,Yt=Kt[Gt]??(Kt[Gt]=e.createContext(null));Yt.displayName??="EverfurContext";function Xt(){let t=e.useContext(Yt);if(t===null)throw new T("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var Qt=/* @__PURE__ */new Map,Jt=/* @__PURE__ */new Set;function Zt(petRef){Qt.set(petRef,(Qt.get(petRef)??0)+1);for(let e of[...Jt])e()}function er(petRef){return Qt.get(petRef)??0}function tr(e){return Jt.add(e),()=>{Jt.delete(e)}}function rr(petRef){let t=e.useCallback(()=>er(petRef),[petRef]);return e.useSyncExternalStore(tr,t,t)}var nr={record:null,requests:[],consent:null,error:null,denialReason:null,withheld:false,loading:true,isUploading:false,uploadProgress:null,uploadQueue:[],uploadContentTypes:X.uploadContentTypes},ir=4e3,lr=30;function useEverfurRecords(t){let{petRef:petRef}=t,r=e.useRef(t.uploadTransport);r.current=t.uploadTransport;let n=t.uploadTransport!==void 0,{runtime:i,userRef:userRef,scopeEpoch:l}=Xt(),o=e.useMemo(()=>({}),[i,userRef,petRef,l,t.controller]),a=e.useRef(o),[s,d]=e.useState({scope:o,controller:t.controller??null}),c=t.controller??(s.scope===o?s.controller:null),[u,h]=e.useState({scope:o,value:nr}),p=u.scope===o?u.value:nr,g=e.useCallback(e=>{h(t=>t.scope===o?{scope:o,value:e(t.value)}:t)},[o]),f=e.useRef(0);e.useEffect(()=>(a.current=o,h({scope:o,value:nr}),()=>{a.current=null,f.current+=1}),[o]),e.useEffect(()=>{if(t.controller)return;let{services:e}=i.registry,l={record:(t,r)=>e.telemetry.track(t,r)},a=i.registry.acquire("records",`${userRef??""}|${petRef}${n?"|own-upload":""}`,()=>qe({repository:At({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),uploads:n?{postMultipart:(t,n,i)=>(r.current??e.uploadTransport).postMultipart(t,n,i)}:e.uploadTransport,telemetry:l}),()=>{});return d({scope:o,controller:a}),()=>{i.registry.release(a)}},[i,userRef,petRef,t.controller,l,o,n]);let m=e.useCallback(e=>{g(t=>({...t,...e}))},[g]),b=e.useCallback(async()=>{if(!c||a.current!==o)return;let e=f.current+=1;k.current=0,C(),m({loading:true,error:null,denialReason:null,withheld:false});let[t,r]=await Promise.all([c.getConsent(petRef),c.listRequests()]);if(e!==f.current)return;let n=t.ok?t.value:null,i=r.ok?r.value.filter(e=>e.petRef===petRef):[],l=r.ok?null:r.error;if(n&&n.granted){let t=await c.getRecord(petRef);if(e!==f.current)return;if(t.ok){m({consent:n,requests:i,record:t.value,withheld:t.value.withheld,error:t.value.withheld?hr():l,denialReason:null,loading:false});return}m({consent:n,requests:i,record:null,error:t.error,denialReason:recordsDenialReasonOf(t.error),withheld:false,loading:false});return}m({consent:n,requests:i,record:null,error:t.ok?l:t.error,denialReason:n?"consent_required":ur(t),withheld:false,loading:false})},[c,petRef,m,o]);e.useEffect(()=>(b(),()=>{f.current+=1}),[b]);let y=t.readUploadFeatures===true;e.useEffect(()=>{if(!y||!c?.readFeatures)return;let e=true;return c.readFeatures().then(t=>{e&&a.current===o&&m({uploadContentTypes:t.uploadContentTypes})}),()=>{e=false}},[c,y,m,o]);let x=e.useMemo(()=>dr(p.requests),[p.requests]),w=x?.id??null,v=x?.status??null,k=e.useRef(0),j=e.useRef(null),[S,C]=e.useReducer(e=>e+1,0);e.useEffect(()=>{if(!c||w===null||v===null||isTerminalStatus(v)||v==="in_review")return;j.current!==String(w)&&(j.current=String(w),k.current=0);let e=false,t=async()=>{if(e||k.current>=lr)return;k.current+=1;let n=await c.getRequest(w);if(!e){if(n.ok&&n.value.petRef===petRef){if(g(e=>({...e,requests:cr(e.requests,n.value)})),isTerminalStatus(n.value.status)){n.value.status==="published"&&b();return}if(n.value.status==="in_review")return}r=setTimeout(()=>{t()},ir)}},r=setTimeout(()=>{t()},ir);return()=>{e=true,clearTimeout(r)}},[c,w,v,b,S,petRef,g]);let R=e.useCallback(async e=>{if(!c||a.current!==o)return pr();let t=await c.createUploadRequest({petRef:petRef,idempotencyKey:e});return a.current===o&&t.ok&&t.value.petRef===petRef&&g(e=>({...e,requests:cr(e.requests,t.value)})),t},[c,petRef,o,g]),T=e.useCallback((e,t)=>{g(r=>({...r,uploadQueue:r.uploadQueue.map(r=>r.key===e?t(r):r)}))},[g]),_=e.useCallback(async(e,t)=>{let r=Date.now().toString(36),n=t.map((e,t)=>{let n=or(e,p.uploadContentTypes);return{key:`${r}-${t}`,name:e.name??null,status:n===null?"queued":"skipped",progress:0,skipReason:n,error:null}}),i=[...n];if(!c||a.current!==o)/* @__PURE__ */return Object.freeze(i);g(e=>({...e,uploadQueue:n,isUploading:true,uploadProgress:0}));for(let[r,l]of t.entries()){let t=n[r];if(t.status==="skipped")continue;if(a.current!==o)break;T(t.key,e=>({...e,status:"uploading",progress:0})),m({uploadProgress:0});let s=await c.uploadDocument({requestId:e,file:l,onProgress:e=>{if(a.current!==o)return;let r=Math.min(1,Math.max(0,e));T(t.key,e=>({...e,progress:Math.max(e.progress,r)})),m({uploadProgress:r})}});if(a.current!==o)break;let d=s.ok?{...t,status:"done",progress:1}:{...t,status:"failed",error:s.error};if(i[r]=d,T(t.key,()=>d),s.ok){let t=await c.getRequest(e);a.current===o&&t.ok&&t.value.petRef===petRef&&g(e=>({...e,requests:cr(e.requests,t.value)}))}}return a.current===o&&m({isUploading:false,uploadProgress:null}),/* @__PURE__ */Object.freeze(i)},[c,m,T,petRef,o,g,p.uploadContentTypes]),z=e.useCallback(async(e,t)=>{if(!c||a.current!==o)return pr();let r=`${Date.now().toString(36)}-0`;g(e=>({...e,isUploading:true,uploadProgress:0,uploadQueue:[{key:r,name:t.name??null,status:"uploading",progress:0,skipReason:null,error:null}]}));let n=await c.uploadDocument({requestId:e,file:t,onProgress:e=>{a.current===o&&(m({uploadProgress:e}),T(r,t=>({...t,progress:Math.max(t.progress,Math.min(1,e))})))}});if(a.current!==o)return n;if(m({isUploading:false,uploadProgress:null}),T(r,e=>n.ok?{...e,status:"done",progress:1}:{...e,status:"failed",error:n.error}),n.ok){let t=await c.getRequest(e);a.current===o&&t.ok&&t.value.petRef===petRef&&g(e=>({...e,requests:cr(e.requests,t.value)}))}return n},[c,m,T,petRef,o,g]),I=t.consentScope==="all_pets"&&c?.grantConsentAllPets&&c.revokeConsentAllPets?"all_pets":"pet",D=e.useCallback(async(e,t)=>{if(!c||a.current!==o)return pr();let r;if(I==="all_pets"&&c.grantConsentAllPets){let n=await c.grantConsentAllPets({petRef:petRef,consentVersion:e,idempotencyKey:t}),i=n.ok?n.value.failed?.[0]:void 0;r=n.ok?i?err(i.error):ok(n.value.pets.find(e=>e.petRef===petRef)??Se(petRef,{granted:n.value.granted,version:n.value.version,granted_at:n.value.grantedAt})):n}else r=await c.grantConsent({petRef:petRef,consentVersion:e,idempotencyKey:t});return r.ok&&a.current===o&&b(),r},[c,petRef,b,o,I]),H=e.useCallback(e=>{Zt(e),!(e!==petRef||a.current!==o)&&(f.current+=1,m({record:null,withheld:false,loading:false,denialReason:"consent_required",consent:Se(petRef,null)}))},[petRef,m,o]),V=e.useCallback(async()=>{if(!c||a.current!==o)return pr();if(!c.revokeConsentAllPets)return err(makeEverfurError("notImplemented",{retryable:false}));let e=false,t=await c.revokeConsentAllPets({petRef:petRef,onRevoked:t=>{e=true,H(t)}});if(t.ok&&!e)for(let e of[petRef,...t.value.pets.map(e=>e.petRef)])H(e);return t},[c,petRef,o,H]),P=e.useCallback(async()=>{if(!c||a.current!==o)return pr();if(I==="all_pets"){let e=await V();return e.ok?ok(e.value.pets.find(e=>e.petRef===petRef)??Se(petRef,null)):e}let e=await c.revokeConsent(petRef);return e.ok&&H(petRef),e.ok&&a.current===o&&m({consent:e.value}),e},[c,petRef,m,o,I,V,H]),L=e.useCallback(()=>b(),[b]),O=sr(p,c!==null);return e.useMemo(()=>({status:O,record:p.record,requests:p.requests,activeRequest:x,consent:p.consent,consentScope:I,error:p.error,denialReason:p.denialReason,withheld:p.withheld,isUploading:p.isUploading,uploadProgress:p.uploadProgress,uploadQueue:p.uploadQueue,uploadContentTypes:p.uploadContentTypes,createRequest:R,uploadDocument:z,uploadDocuments:_,grantConsent:D,revokeConsent:P,revokeConsentAllPets:V,refresh:L}),[O,p,x,I,R,z,_,D,P,V,L])}function or(e,t){if(!Y(e.mimeType,t))return"unsupported";let r=e.sizeBytes;return typeof r!="number"||!Number.isFinite(r)||r<=0||r>Ee?"too_large":null}function ar(e,t){let r=[],n=[];for(let i of e){let e=or(i,t);e===null?r.push(i):n.push({name:i.name??null,reason:e})}return{uploadable:r,skipped:n}}function sr(e,t){return e.loading||!t?"loading":e.withheld||e.denialReason!==null||e.error!==null?"error":e.record!==null&&!e.record.isEmpty||e.requests.length>0?"populated":"empty"}function dr(e){if(e.length===0)return null;let t=e[0];for(let r of e)r.updatedAt>t.updatedAt&&(t=r);return t}function cr(e,t){let r=e.filter(e=>e.id!==t.id);return[t,...r]}function ur(e){return e.ok?"consent_required":recordsDenialReasonOf(e.error)??"consent_required"}function hr(){return makeEverfurError("internalError",{retryable:false})}function pr(){return{ok:false,error:makeEverfurError("internalError",{retryable:true})}}function gr(e){let t={};if(e==null)return t;for(let r of Object.keys(e))e[r]!==void 0&&(t[r]=e[r]);return t}function fr(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function mr(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function br(e,...t){if(typeof e=="function")try{let r=e(...t);return mr(r)&&Promise.resolve(r).then(void 0,fr),r}catch(e){fr(e);return}}var yr=/* @__PURE__ */new WeakMap;function xr(e){if(typeof e!="function")return;let t=yr.get(e);if(t!==void 0)return t;let r=(...t)=>{br(e,...t)};return yr.set(e,r),r}function wr(e,t){let r=null;for(let n of t){let t=e[n];typeof t=="function"&&(r??={...e},r[n]=xr(t))}return r??e}function vr(e,...t){let r;try{r=e(...t)}catch(e){return fr(e),Promise.resolve({ok:false,error:e})}return Promise.resolve(r).then(e=>({ok:true,value:e}),e=>({ok:false,error:e}))}var kr=/* @__PURE__ */Object.freeze({name:"dashboard"});function initialRecordsNav(e=kr){/* @__PURE__ */
19
19
  return Object.freeze({stack:/* @__PURE__ */Object.freeze([e])})}function currentRecordsScreen(e){return e.stack[e.stack.length-1]??kr}function pushRecordsNav(e,t){/* @__PURE__ */
20
20
  return Object.freeze({stack:/* @__PURE__ */Object.freeze([...e.stack,t])})}function replaceRecordsNav(e,t){/* @__PURE__ */
21
- return Object.freeze({stack:/* @__PURE__ */Object.freeze([...e.stack.slice(0,-1),t])})}function resetRecordsNav(e){return initialRecordsNav(e)}function popRecordsNav(e){return e.stack.length<=1?{state:e,handled:false}:{state:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze(e.stack.slice(0,-1))}),handled:true}}function transitionRecordsNav(e,t){return t.name==="dashboard"?resetRecordsNav(t):currentRecordsScreen(e).name==="upload"&&t.name==="request"?replaceRecordsNav(e,t):pushRecordsNav(e,t)}function recordsNavReducer(e,t){switch(t.type){case"push":return pushRecordsNav(e,t.screen);case"pop":return popRecordsNav(e).state;case"replace":return replaceRecordsNav(e,t.screen);case"reset":return resetRecordsNav(t.screen);case"navigate":return transitionRecordsNav(e,t.screen);default:return e}}var jr=/* @__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[jr[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[jr[t]]};let i=face(e,t);return i.fontWeight===void 0||n===null?i:{fontFamily:i.fontFamily,fontWeight:n}}function Sr(e){return e<=450?"regular":e<=650?"medium":"bold"}var Cr={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=Rr.get(e);r===void 0&&(r=/* @__PURE__ */new Map,Rr.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=Tr(e,t);return r.set(t,i),i}var Rr=/* @__PURE__ */new WeakMap;function Tr(e,t){let r=e.type.roles[t],n=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,i=Sr(Number(n)),l=r.face==="mono"?face(e,Cr[i]):r.face==="heading"?headingFace(e,i):face(e,i),o=r.face==="heading"?e.type.headingWeight??n:n,a=l.fontWeight===void 0?l:{fontFamily:l.fontFamily,fontWeight:o},s=r.size,d={...a,fontSize:s,lineHeight:Math.round(s*r.lineHeight*100)/100};return r.letterSpacing!==0&&(d.letterSpacing=Math.round(s*r.letterSpacing*100)/100),r.uppercase&&(d.textTransform="uppercase"),/* @__PURE__ */Object.freeze(d)}var _r=/* @__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 zr=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){zr(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var Ir=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var Dr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Hr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Vr={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},Pr={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Lr={regular:"400",medium:"500",bold:"700"},Er={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},Or=0,Ar="System",$r="monospace",Br=["content","heading","control","compact","badge"];function Fr(e){let t={};for(let r of Br)t[r]=e;return t}var Mr=[];function qr(){return{family:Ar,mono:$r,fontUrl:null,families:{regular:Ar,medium:Ar,bold:Ar,mono:$r,monoMedium:$r,monoBold:$r},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Vr,tierSizes:Fr(Vr),lineHeight:Pr,weight:Lr,letterSpacing:Er,scale:1,maxScale:Or,scaleCaps:Ir,headingFamily:null,headingWeight:null,fontSources:Mr,roles:_r,typeScale:1}}var Nr={},Wr=/* @__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 Ur={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(Wr.standard),emphasized:cssCubicBezier(Wr.emphasized),exit:cssCubicBezier(Wr.exit)},reducedMotion:false},Gr={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)"},Kr=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Gr,space:Dr,radius:Hr,type:qr(),motion:Ur,slots:Nr}),Yr={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)"},Xr=deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Yr,space:Dr,radius:Hr,type:qr(),motion:Ur,slots:Nr});var Qr=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Jr=globalThis,Zr=Jr[Qr]??(Jr[Qr]=e.createContext(Kr));Zr.displayName??="EverfurThemeContext";function useEverfurTheme(){return e.useContext(Zr)}function en(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:t,variant:n,...i}){let l=useEverfurTheme(),o=n===void 0?void 0:l.type.roles[n],a=en(l.type,t??o?.tier??"content"),s=n===void 0?i:{...i,style:[{...textRole(l,n),color:l.color.text.primary,flexShrink:1},i.style]};return e.createElement(r.Text,a===void 0?s:{maxFontSizeMultiplier:a,...s})}var tn=e.forwardRef(function(t,n){return e.createElement(r.TextInput,{...t,...n===null?{}:{ref:n}})});function rn(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 nn(e){return e?.textColor===void 0?{}:{color:e.textColor}}function ln(e){return e.recordCard??e.card}var on=/* @__PURE__ */Object.freeze({title:"Request records",clinic:"Clinic",search:"Search clinics by name or location",placeholder:"Clinic name, city, or ZIP",email:"Clinic email",emailPlaceholder:"records@clinic.com",ownerName:"Your full name",scopeHeading:"What you’re authorizing",send:"Send request",sending:"Sending…",cancel:"Cancel",sign:"Signature",draw:"Draw your signature",type:"Type your name to sign",toType:"Can’t draw? Type your name instead",toDraw:"Draw your signature instead",clear:"Clear",drawHint:"Draw your signature in the box above.",clearA11y:"Clear signature",typedSignatureA11y:e=>`Typed signature: ${e}`,missingSignature:"Please add your signature before submitting.",recentlyUsed:"Recently used",moreClinics:"Load more"});var an=/* @__PURE__ */Object.freeze({title:on.title,titleFor:e=>{let t=e?.trim()??"";return t.length>0?`Request ${t}’s records`:on.title},leadWeb:"Find the clinic that has them. We send a secure request and read every page they send back.",leadNative:"Find the clinic that has them.",searchLabelWeb:"Find the clinic",howItWorks:"How it works",howSteps:e=>[{title:"We send a secure request",body:"With your permission, straight to the clinic’s records team."},{title:"The clinic sends the file",body:"Most clinics respond within 3 to 5 business days. We follow up for you."},{title:"Everfur reads every page",body:`Visits, vaccines, labs and prescriptions land in ${e}’s records.`}],placeholder:on.placeholder,searchA11y:on.search,clearSearch:"Clear search",loading:"Loading clinics",uploadOwn:"I already have the records",uploadOwnStarting:"Setting up your upload…",noPet:"Add a pet first, then come back to request their records.",recentlyUsed:on.recentlyUsed,noMatch:e=>`No clinics match “${e}”. You can still request records using the option above.`,loadingMore:"Loading more…",loadMoreFailed:"Couldn’t load more. Tap to retry.",selectA11y:e=>`Request records from ${e}`,resultsCount:e=>e===1?"Showing 1 clinic":`Showing ${String(e)} clinics`,fallback:/* @__PURE__ */Object.freeze({title:"Can’t find your clinic?",subtitle:"Add it by email and we’ll request your records.",nameLabel:"Clinic name",namePlaceholder:"Your clinic’s name",emailLabel:"Clinic email",emailPlaceholder:"records@clinic.com",reviewNote:"We review every request by hand before reaching out to the clinic.",submit:"Continue"})});function sn(e){switch(e){case"verified":return{label:"Email on file",a11y:"verified email on file, we can request records directly",tone:"positive"};case"unverified":return{label:"Email unconfirmed",a11y:"email on file but unconfirmed, we will try and let you know",tone:"caution"};default:return{label:"We may need your help",a11y:"no email on file, we may ask you to confirm how to reach this clinic",tone:"neutral"}}}var dn=1.609344;function cn(e){return e===null||!Number.isFinite(e)?null:(e/dn).toFixed(1)}function un(e){let t=cn(e);return t===null?"":`${t} mi`}function hn(e){let t=cn(e);return t===null?"":`${t} ${t==="1.0"?"mile":"miles"} away`}var pn=300,gn=2;var fn=/* @__PURE__ */Object.freeze({loading:"Loading",empty:"No records yet",upload:"Upload records",consentRequired:"Consent required",allow:"Allow",allPetsConsent:"This covers all your pets. You can withdraw it at any time.",sessionRequired:"Sign in required",recordUnavailable:"Record unavailable",retry:"Try again",records:"Records",beingReviewed:"being reviewed"}),mn="Everfur summarizes what your vet recorded. It is informational, not diagnostic.";var bn="your pet";function yn(e){let t=e?.trim()??"";return t.length>0?t:bn}var xn=/* @__PURE__ */Object.freeze({title:"Health records",titleWeb:e=>{let t=e?.trim()??"";return t.length>0?`${t}’s Records`:"Health records"},titleNative:e=>{let t=e?.trim()??"";return t.length>0?t:"Health records"},openTimeline:"Open timeline",loading:"Loading health records",lead:e=>`${yn(e)}’s lab trends`,retryMarkers:"Retry loading lab trends",viewFullRecord:"View full medical record",viewTimeline:"View full timeline",important:e=>`Important: ${e}`}),wn=/* @__PURE__ */Object.freeze({title:"At a glance",marker:"Marker",markers:"Markers",outOfRange:"out of range",inRange:"in range",noRange:"NO RANGE",subtitle:"Summary of your pet’s biomarkers",ask:"Ask about these markers",a11y:(e,t,r,n)=>`Marker summary: ${e} ${e===1?"marker":"markers"}, ${t} in range, ${r} out of range${n>0?`, ${n} without a range`:""}.`}),vn=/* @__PURE__ */Object.freeze({counter:(e,t)=>`${e+1} of ${t}`,a11y:(e,t,r)=>e!==null?`${e}, marker ${t+1} of ${r}. Swipe left or right to see more markers.`:`Marker ${t+1} of ${r}`}),kn=/* @__PURE__ */Object.freeze({tapHint:"Tap a point to see where it came from.",singleHint:"One reading so far: we’ll plot a trend as more come in.",empty:"No readings for this marker yet.",ask:"Ask about this marker",askNamed:e=>{let t=e?.trim()??"";return t.length>0?`Ask about ${t}`:"Ask about this marker"},status:e=>`Status: ${e}`,latestA11y:(e,t,r)=>`Latest reading ${e}, ${t}, collected ${r}`,readingsA11y:e=>`${e} readings, oldest to newest`}),jn=/* @__PURE__ */Object.freeze({title:"Where this comes from",close:"Close reading details",collected:"Collected",clinic:"Clinic",referenceRange:"Reference range",noRange:"Not on file for this reading",sourceDocument:"Source document",unverified:"Our team hasn’t verified this reading against the original document yet.",reviewed:"Reviewed by our team",ask:"Ask about this reading"}),Sn=/* @__PURE__ */Object.freeze({title:e=>`${yn(e)}’s records are on the way`,anotherClinic:"Another clinic",anotherClinicSub:"Seen more than one vet? We ask each one.",uploadDocumentPhotoSub:"A PDF, or a photo of a paper record.",body:e=>`We’re requesting ${yn(e)}’s records from your vet. This usually takes a few days; we’ll show lab trends here as soon as they arrive.`,a11y:e=>`Records request in progress for ${yn(e)}.`,ask:"Ask about this request"}),Cn=/* @__PURE__ */Object.freeze({title:e=>`Add ${yn(e)}’s records`,firstRecordTitle:e=>`Add ${yn(e)}’s first record`,body:"Records can come from more than one clinic over a lifetime.",requestFromClinic:"Request from a clinic",requestFromClinicSub:"We send a secure request and read every page they send back.",uploadDocument:"Upload a document"});function Rn(e){return!isTerminalStatus(e.status)}function pickPetRecordsRequest(e,petRef){if(petRef===null)return null;let t=e.filter(e=>e.petRef===petRef);if(t.length===0)return null;let r=t.find(e=>e.status==="published");return r!==void 0?r:t.filter(Rn).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null}function deriveRecordsDashboardState(e){if(e.hasMarkers)return"published";let t=pickPetRecordsRequest(e.requests,e.petRef);return t===null?"none":t.status==="published"||Rn(t)?"in_progress":"none"}function Tn(e){return e.recordLoading?true:e.hasFullRecord?false:e.markersLoading||!e.hasMarkers&&e.requestsLoading}function selectDashboardView(e){return Tn(e)?"loading":e.hasFullRecord?"record":e.markersError||e.recordError&&!e.hasMarkers?"error":e.dashboardState==="in_progress"&&e.drivingRequest!==null?"in_progress":e.dashboardState==="none"?"none":"labs_only"}function _n(e){return e?.httpStatus===429?"rate_limited":e?.httpStatus===502?"service_unavailable":"error"}var zn=/* @__PURE__ */Object.freeze({loading:"Loading record request",sentTitle:"Request sent",sentLeadWeb:(e,t)=>`${e} has the request. We’ll let you know when ${t}’s file arrives.`,sentLeadNative:e=>`We’ll let you know when ${e}’s file arrives.`,whereItStands:"Where it stands",details:"Request details",detailsClinic:"Clinic",detailsSent:"Sent",timelineA11y:"Request timeline",awaitingNote:"Clinics usually reply within a week. We follow up automatically and will let you know if there’s no reply by day 14.",waitingBanner:e=>`It’s been ${e} ${e===1?"day":"days"}. Some clinics take a little longer; we’ve been following up automatically and are still on it. If there’s no reply by day 14, we’ll let you know.`,viewRecords:"View health records",nextStep:"You can try a different clinic or upload records you already have.",tryAnotherClinic:"Request from a different clinic",convert:"Upload my own records instead",converting:"Switching…",convertHint:"We’ll stop waiting on the clinic so you can add the records you already have. If the clinic does reply, we’ll still add their records too.",freshUpload:"Upload your own records",freshUploadStarting:"Starting…",cancel:"Cancel request",cancelling:"Cancelling…",resend:"Resend email",resending:"Resending…",errors:/* @__PURE__ */Object.freeze({cancel:"We couldn’t cancel this request. Please try again.",retry:"We couldn’t retry this request. Please try again.",email:"We couldn’t update the clinic email. Please try again.",convert:"We couldn’t switch this to an upload. Please try again.",start:"We couldn’t start that. Please try again.",invalidEmail:"Enter a valid clinic email."})});function In(e){if(e.wireStatus==="clinic_declined")return"The clinic declined to release the records.";if(e.wireStatus==="clinic_responded_no_records")return"The clinic replied but didn’t include your records.";switch(e.failureCode){case"no_response":return"The clinic didn’t reply after several reminders over 14 days.";case"parse_timeout":case"parse_error":return"We received the records but couldn’t read them. Uploading a clean copy usually fixes this.";case"hard_bounce":case"dispatch_failed":return"We couldn’t deliver the email to the clinic.";default:return"This request didn’t go through."}}function Dn(e){let t=e.failureReason?.trim()??"";return t.length>0?t:In(e)}var Hn=1440*60*1e3;function Vn(e,t){if(!e.createdAt)return 0;let r=Date.parse(e.createdAt);if(Number.isNaN(r))return 0;let n=t-r;return n<=0?0:Math.floor(n/Hn)}var Pn=7;function Ln(e,t){return e.wireStatus!=="awaiting_response"?false:Vn(e,t)>=Pn}function En(e){return e.status==="failed"}function On(e){return En(e)||e.canUpdateClinicEmail===true||e.canRetrySend===true}function An(t,r){let[n,i]=e.useState(""),[l,o]=e.useState(""),[a,s]=e.useState([]),[d,c]=e.useState(null),[u,h]=e.useState([]),[p,g]=e.useState(true),[f,m]=e.useState(false),[b,y]=e.useState(false),[x,w]=e.useState(null),[v,k]=e.useState(null),[j,S]=e.useState(0),C=e.useRef(0),R=e.useRef(true),T=r?.latitude,_=r?.longitude,z=e.useMemo(()=>T!==void 0&&_!==void 0?{latitude:T,longitude:_}:void 0,[T,_]);e.useEffect(()=>(R.current=true,()=>{R.current=false,C.current+=1}),[t]),e.useEffect(()=>{let e=true;return g(true),t.recentClinics({limit:5}).then(t=>{e&&(t.ok&&h(t.value.clinics),g(false))}).catch(()=>{e&&g(false)}),()=>{e=false}},[t]),e.useEffect(()=>{let e=n.trim();if(e.length<gn){o("");return}let t=setTimeout(()=>o(e),pn);return()=>clearTimeout(t)},[n]);let I=l.length>=gn;e.useEffect(()=>{let e=C.current+=1;if(s([]),c(null),w(null),k(null),!I){m(false);return}m(true),t.searchClinics({query:l,limit:25,...z?{location:z}:{}}).then(t=>{!R.current||e!==C.current||(t.ok?(s(t.value.clinics),c(t.value.nextCursor)):w(t.error),m(false))}).catch(()=>{R.current&&e===C.current&&m(false)})},[t,l,I,z,j]);let D=e.useCallback(()=>{if(!I||d===null||b)return;let e=C.current;y(true),k(null),t.searchClinics({query:l,limit:25,cursor:d,...z?{location:z}:{}}).then(t=>{!R.current||e!==C.current||(t.ok?(s(e=>[...e,...t.value.clinics]),c(t.value.nextCursor)):k(t.error),y(false))}).catch(()=>{R.current&&e===C.current&&y(false)})},[t,d,l,I,b,z]),H=e.useCallback(e=>i(e),[]),V=e.useCallback(()=>S(e=>e+1),[]);return e.useMemo(()=>({query:n,debouncedQuery:l,isSearchActive:I,clinics:a,recent:u,recentLoading:p,initialLoading:f,loadingMore:b,hasNextPage:d!==null,error:x,pageError:v,setQuery:H,loadMore:D,retry:V}),[n,l,I,a,u,p,f,b,d,x,v,H,D,V])}function $n(e,t,r,n){/* @__PURE__ */
21
+ return Object.freeze({stack:/* @__PURE__ */Object.freeze([...e.stack.slice(0,-1),t])})}function resetRecordsNav(e){return initialRecordsNav(e)}function popRecordsNav(e){return e.stack.length<=1?{state:e,handled:false}:{state:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze(e.stack.slice(0,-1))}),handled:true}}function transitionRecordsNav(e,t){return t.name==="dashboard"?resetRecordsNav(t):currentRecordsScreen(e).name==="upload"&&t.name==="request"?replaceRecordsNav(e,t):pushRecordsNav(e,t)}function recordsNavReducer(e,t){switch(t.type){case"push":return pushRecordsNav(e,t.screen);case"pop":return popRecordsNav(e).state;case"replace":return replaceRecordsNav(e,t.screen);case"reset":return resetRecordsNav(t.screen);case"navigate":return transitionRecordsNav(e,t.screen);default:return e}}var jr=/* @__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[jr[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[jr[t]]};let i=face(e,t);return i.fontWeight===void 0||n===null?i:{fontFamily:i.fontFamily,fontWeight:n}}function Sr(e){return e<=450?"regular":e<=650?"medium":"bold"}var Cr={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=Rr.get(e);r===void 0&&(r=/* @__PURE__ */new Map,Rr.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=Tr(e,t);return r.set(t,i),i}var Rr=/* @__PURE__ */new WeakMap;function Tr(e,t){let r=e.type.roles[t],n=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,i=Sr(Number(n)),l=r.face==="mono"?face(e,Cr[i]):r.face==="heading"?headingFace(e,i):face(e,i),o=r.face==="heading"?e.type.headingWeight??n:n,a=l.fontWeight===void 0?l:{fontFamily:l.fontFamily,fontWeight:o},s=r.size,d={...a,fontSize:s,lineHeight:Math.round(s*r.lineHeight*100)/100};return r.letterSpacing!==0&&(d.letterSpacing=Math.round(s*r.letterSpacing*100)/100),r.uppercase&&(d.textTransform="uppercase"),/* @__PURE__ */Object.freeze(d)}var _r=/* @__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 zr=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){zr(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var Ir=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var Dr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Hr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Vr={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},Pr={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Lr={regular:"400",medium:"500",bold:"700"},Or={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},Er=0,Ar="System",$r="monospace",Br=["content","heading","control","compact","badge"];function Fr(e){let t={};for(let r of Br)t[r]=e;return t}var Mr=[];function qr(){return{family:Ar,mono:$r,fontUrl:null,families:{regular:Ar,medium:Ar,bold:Ar,mono:$r,monoMedium:$r,monoBold:$r},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Vr,tierSizes:Fr(Vr),lineHeight:Pr,weight:Lr,letterSpacing:Or,scale:1,maxScale:Er,scaleCaps:Ir,headingFamily:null,headingWeight:null,fontSources:Mr,roles:_r,typeScale:1}}var Nr={},Wr=/* @__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 Ur={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(Wr.standard),emphasized:cssCubicBezier(Wr.emphasized),exit:cssCubicBezier(Wr.exit)},reducedMotion:false},Gr={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)"},Kr=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Gr,space:Dr,radius:Hr,type:qr(),motion:Ur,slots:Nr}),Yr={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)"},Xr=deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Yr,space:Dr,radius:Hr,type:qr(),motion:Ur,slots:Nr});var Qr=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Jr=globalThis,Zr=Jr[Qr]??(Jr[Qr]=e.createContext(Kr));Zr.displayName??="EverfurThemeContext";function useEverfurTheme(){return e.useContext(Zr)}function en(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:t,variant:n,...i}){let l=useEverfurTheme(),o=n===void 0?void 0:l.type.roles[n],a=en(l.type,t??o?.tier??"content"),s=n===void 0?i:{...i,style:[{...textRole(l,n),color:l.color.text.primary,flexShrink:1},i.style]};return e.createElement(r.Text,a===void 0?s:{maxFontSizeMultiplier:a,...s})}var tn=e.forwardRef(function(t,n){return e.createElement(r.TextInput,{...t,...n===null?{}:{ref:n}})});function rn(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 nn(e){return e?.textColor===void 0?{}:{color:e.textColor}}function ln(e){return e.recordCard??e.card}var on=/* @__PURE__ */Object.freeze({title:"Request records",clinic:"Clinic",search:"Search clinics by name or location",placeholder:"Clinic name, city, or ZIP",email:"Clinic email",emailPlaceholder:"records@clinic.com",ownerName:"Your full name",scopeHeading:"What you’re authorizing",send:"Send request",sending:"Sending…",cancel:"Cancel",sign:"Signature",draw:"Draw your signature",type:"Type your name to sign",toType:"Can’t draw? Type your name instead",toDraw:"Draw your signature instead",clear:"Clear",drawHint:"Draw your signature in the box above.",clearA11y:"Clear signature",typedSignatureA11y:e=>`Typed signature: ${e}`,missingSignature:"Please add your signature before submitting.",recentlyUsed:"Recently used",moreClinics:"Load more"});var an=/* @__PURE__ */Object.freeze({title:on.title,titleFor:e=>{let t=e?.trim()??"";return t.length>0?`Request ${t}’s records`:on.title},leadWeb:"Find the clinic that has them. We send a secure request and read every page they send back.",leadNative:"Find the clinic that has them.",searchLabelWeb:"Find the clinic",howItWorks:"How it works",howSteps:e=>[{title:"We send a secure request",body:"With your permission, straight to the clinic’s records team."},{title:"The clinic sends the file",body:"Most clinics respond within 3 to 5 business days. We follow up for you."},{title:"Everfur reads every page",body:`Visits, vaccines, labs and prescriptions land in ${e}’s records.`}],placeholder:on.placeholder,searchA11y:on.search,clearSearch:"Clear search",loading:"Loading clinics",uploadOwn:"I already have the records",uploadOwnStarting:"Setting up your upload…",noPet:"Add a pet first, then come back to request their records.",recentlyUsed:on.recentlyUsed,noMatch:e=>`No clinics match “${e}”. You can still request records using the option above.`,loadingMore:"Loading more…",loadMoreFailed:"Couldn’t load more. Tap to retry.",selectA11y:e=>`Request records from ${e}`,resultsCount:e=>e===1?"Showing 1 clinic":`Showing ${String(e)} clinics`,fallback:/* @__PURE__ */Object.freeze({title:"Can’t find your clinic?",subtitle:"Add it by email and we’ll request your records.",nameLabel:"Clinic name",namePlaceholder:"Your clinic’s name",emailLabel:"Clinic email",emailPlaceholder:"records@clinic.com",reviewNote:"We review every request by hand before reaching out to the clinic.",submit:"Continue"})});function sn(e){switch(e){case"verified":return{label:"Email on file",a11y:"verified email on file, we can request records directly",tone:"positive"};case"unverified":return{label:"Email unconfirmed",a11y:"email on file but unconfirmed, we will try and let you know",tone:"caution"};default:return{label:"We may need your help",a11y:"no email on file, we may ask you to confirm how to reach this clinic",tone:"neutral"}}}var dn=1.609344;function cn(e){return e===null||!Number.isFinite(e)?null:(e/dn).toFixed(1)}function un(e){let t=cn(e);return t===null?"":`${t} mi`}function hn(e){let t=cn(e);return t===null?"":`${t} ${t==="1.0"?"mile":"miles"} away`}var pn=300,gn=2;var fn=/* @__PURE__ */Object.freeze({loading:"Loading",empty:"No records yet",upload:"Upload records",consentRequired:"Consent required",allow:"Allow",allPetsConsent:"This covers all your pets. You can withdraw it at any time.",sessionRequired:"Sign in required",recordUnavailable:"Record unavailable",retry:"Try again",records:"Records",beingReviewed:"being reviewed"}),mn="Everfur summarizes what your vet recorded. It is informational, not diagnostic.";var bn="your pet";function yn(e){let t=e?.trim()??"";return t.length>0?t:bn}var xn=/* @__PURE__ */Object.freeze({title:"Health records",titleWeb:e=>{let t=e?.trim()??"";return t.length>0?`${t}’s Records`:"Health records"},titleNative:e=>{let t=e?.trim()??"";return t.length>0?t:"Health records"},openTimeline:"Open timeline",loading:"Loading health records",lead:e=>`${yn(e)}’s lab trends`,retryMarkers:"Retry loading lab trends",viewFullRecord:"View full medical record",viewTimeline:"View full timeline",important:e=>`Important: ${e}`}),wn=/* @__PURE__ */Object.freeze({title:"At a glance",marker:"Marker",markers:"Markers",outOfRange:"out of range",inRange:"in range",noRange:"NO RANGE",subtitle:"Summary of your pet’s biomarkers",ask:"Ask about these markers",a11y:(e,t,r,n)=>`Marker summary: ${e} ${e===1?"marker":"markers"}, ${t} in range, ${r} out of range${n>0?`, ${n} without a range`:""}.`}),vn=/* @__PURE__ */Object.freeze({counter:(e,t)=>`${e+1} of ${t}`,a11y:(e,t,r)=>e!==null?`${e}, marker ${t+1} of ${r}. Swipe left or right to see more markers.`:`Marker ${t+1} of ${r}`}),kn=/* @__PURE__ */Object.freeze({tapHint:"Tap a point to see where it came from.",singleHint:"One reading so far: we’ll plot a trend as more come in.",empty:"No readings for this marker yet.",ask:"Ask about this marker",askNamed:e=>{let t=e?.trim()??"";return t.length>0?`Ask about ${t}`:"Ask about this marker"},status:e=>`Status: ${e}`,latestA11y:(e,t,r)=>`Latest reading ${e}, ${t}, collected ${r}`,readingsA11y:e=>`${e} readings, oldest to newest`}),jn=/* @__PURE__ */Object.freeze({title:"Where this comes from",close:"Close reading details",collected:"Collected",clinic:"Clinic",referenceRange:"Reference range",noRange:"Not on file for this reading",sourceDocument:"Source document",unverified:"Our team hasn’t verified this reading against the original document yet.",reviewed:"Reviewed by our team",ask:"Ask about this reading"}),Sn=/* @__PURE__ */Object.freeze({title:e=>`${yn(e)}’s records are on the way`,anotherClinic:"Another clinic",anotherClinicSub:"Seen more than one vet? We ask each one.",uploadDocumentPhotoSub:"A PDF, or a photo of a paper record.",body:e=>`We’re requesting ${yn(e)}’s records from your vet. This usually takes a few days; we’ll show lab trends here as soon as they arrive.`,a11y:e=>`Records request in progress for ${yn(e)}.`,ask:"Ask about this request"}),Cn=/* @__PURE__ */Object.freeze({title:e=>`Add ${yn(e)}’s records`,firstRecordTitle:e=>`Add ${yn(e)}’s first record`,body:"Records can come from more than one clinic over a lifetime.",requestFromClinic:"Request from a clinic",requestFromClinicSub:"We send a secure request and read every page they send back.",uploadDocument:"Upload a document"});function Rn(e){return!isTerminalStatus(e.status)}function pickPetRecordsRequest(e,petRef){if(petRef===null)return null;let t=e.filter(e=>e.petRef===petRef);if(t.length===0)return null;let r=t.find(e=>e.status==="published");return r!==void 0?r:t.filter(Rn).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null}function deriveRecordsDashboardState(e){if(e.hasMarkers)return"published";let t=pickPetRecordsRequest(e.requests,e.petRef);return t===null?"none":t.status==="published"||Rn(t)?"in_progress":"none"}function Tn(e){return e.recordLoading?true:e.hasFullRecord?false:e.markersLoading||!e.hasMarkers&&e.requestsLoading}function selectDashboardView(e){return Tn(e)?"loading":e.hasFullRecord?"record":e.markersError||e.recordError&&!e.hasMarkers?"error":e.dashboardState==="in_progress"&&e.drivingRequest!==null?"in_progress":e.dashboardState==="none"?"none":"labs_only"}function _n(e){return e?.httpStatus===429?"rate_limited":e?.httpStatus===502?"service_unavailable":"error"}var zn=/* @__PURE__ */Object.freeze({loading:"Loading record request",sentTitle:"Request sent",sentLeadWeb:(e,t)=>`${e} has the request. We’ll let you know when ${t}’s file arrives.`,sentLeadNative:e=>`We’ll let you know when ${e}’s file arrives.`,whereItStands:"Where it stands",details:"Request details",detailsClinic:"Clinic",detailsSent:"Sent",timelineA11y:"Request timeline",awaitingNote:"Clinics usually reply within a week. We follow up automatically and will let you know if there’s no reply by day 14.",waitingBanner:e=>`It’s been ${e} ${e===1?"day":"days"}. Some clinics take a little longer; we’ve been following up automatically and are still on it. If there’s no reply by day 14, we’ll let you know.`,viewRecords:"View health records",nextStep:"You can try a different clinic or upload records you already have.",tryAnotherClinic:"Request from a different clinic",convert:"Upload my own records instead",converting:"Switching…",convertHint:"We’ll stop waiting on the clinic so you can add the records you already have. If the clinic does reply, we’ll still add their records too.",freshUpload:"Upload your own records",freshUploadStarting:"Starting…",cancel:"Cancel request",cancelling:"Cancelling…",resend:"Resend email",resending:"Resending…",errors:/* @__PURE__ */Object.freeze({cancel:"We couldn’t cancel this request. Please try again.",retry:"We couldn’t retry this request. Please try again.",email:"We couldn’t update the clinic email. Please try again.",convert:"We couldn’t switch this to an upload. Please try again.",start:"We couldn’t start that. Please try again.",invalidEmail:"Enter a valid clinic email."})});function In(e){if(e.wireStatus==="clinic_declined")return"The clinic declined to release the records.";if(e.wireStatus==="clinic_responded_no_records")return"The clinic replied but didn’t include your records.";switch(e.failureCode){case"no_response":return"The clinic didn’t reply after several reminders over 14 days.";case"parse_timeout":case"parse_error":return"We received the records but couldn’t read them. Uploading a clean copy usually fixes this.";case"hard_bounce":case"dispatch_failed":return"We couldn’t deliver the email to the clinic.";default:return"This request didn’t go through."}}function Dn(e){let t=e.failureReason?.trim()??"";return t.length>0?t:In(e)}var Hn=1440*60*1e3;function Vn(e,t){if(!e.createdAt)return 0;let r=Date.parse(e.createdAt);if(Number.isNaN(r))return 0;let n=t-r;return n<=0?0:Math.floor(n/Hn)}var Pn=7;function Ln(e,t){return e.wireStatus!=="awaiting_response"?false:Vn(e,t)>=Pn}function On(e){return e.status==="failed"}function En(e){return On(e)||e.canUpdateClinicEmail===true||e.canRetrySend===true}function An(t,r){let[n,i]=e.useState(""),[l,o]=e.useState(""),[a,s]=e.useState([]),[d,c]=e.useState(null),[u,h]=e.useState([]),[p,g]=e.useState(true),[f,m]=e.useState(false),[b,y]=e.useState(false),[x,w]=e.useState(null),[v,k]=e.useState(null),[j,S]=e.useState(0),C=e.useRef(0),R=e.useRef(true),T=r?.latitude,_=r?.longitude,z=e.useMemo(()=>T!==void 0&&_!==void 0?{latitude:T,longitude:_}:void 0,[T,_]);e.useEffect(()=>(R.current=true,()=>{R.current=false,C.current+=1}),[t]),e.useEffect(()=>{let e=true;return g(true),t.recentClinics({limit:5}).then(t=>{e&&(t.ok&&h(t.value.clinics),g(false))}).catch(()=>{e&&g(false)}),()=>{e=false}},[t]),e.useEffect(()=>{let e=n.trim();if(e.length<gn){o("");return}let t=setTimeout(()=>o(e),pn);return()=>clearTimeout(t)},[n]);let I=l.length>=gn;e.useEffect(()=>{let e=C.current+=1;if(s([]),c(null),w(null),k(null),!I){m(false);return}m(true),t.searchClinics({query:l,limit:25,...z?{location:z}:{}}).then(t=>{!R.current||e!==C.current||(t.ok?(s(t.value.clinics),c(t.value.nextCursor)):w(t.error),m(false))}).catch(()=>{R.current&&e===C.current&&m(false)})},[t,l,I,z,j]);let D=e.useCallback(()=>{if(!I||d===null||b)return;let e=C.current;y(true),k(null),t.searchClinics({query:l,limit:25,cursor:d,...z?{location:z}:{}}).then(t=>{!R.current||e!==C.current||(t.ok?(s(e=>[...e,...t.value.clinics]),c(t.value.nextCursor)):k(t.error),y(false))}).catch(()=>{R.current&&e===C.current&&y(false)})},[t,d,l,I,b,z]),H=e.useCallback(e=>i(e),[]),V=e.useCallback(()=>S(e=>e+1),[]);return e.useMemo(()=>({query:n,debouncedQuery:l,isSearchActive:I,clinics:a,recent:u,recentLoading:p,initialLoading:f,loadingMore:b,hasNextPage:d!==null,error:x,pageError:v,setQuery:H,loadMore:D,retry:V}),[n,l,I,a,u,p,f,b,d,x,v,H,D,V])}function $n(e,t,r,n){/* @__PURE__ */
22
22
  return Object.freeze({key:e?.id??`free:${t??""}`,clinic:e,freeText:t,email:r,idempotencyKey:n})}var Bn=10,Fn=/* @__PURE__ */t.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),Mn=(e,r=1)=>t.z.string().refine(t=>!Dt(t)&&[...t].length>=r&&[...t].length<=e),qn=e=>[...e].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)===127),Nn=/* @__PURE__ */t.z.object({clinicId:/* @__PURE__ */Fn.optional(),clinicFreeText:Mn(200).refine(e=>e.trim().length>0).optional(),clinicEmail:Mn(320,3).refine(e=>!qn(e)&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e.trim())).optional(),signatureId:/* @__PURE__ */Fn.optional(),signaturePngBase64:/* @__PURE__ */t.z.string().min(1).max(2*1024*1024).optional(),idempotencyKey:/* @__PURE__ */t.z.string().regex(/^[A-Za-z0-9._-]{8,128}$/)}).strict().refine(e=>e.clinicId===void 0!=(e.clinicFreeText===void 0)).refine(e=>e.signatureId===void 0!=(e.signaturePngBase64===void 0)),Wn=/* @__PURE__ */t.z.object({petRef:Mn(128),ownerName:Mn(200).refine(e=>e.trim().length>0&&!qn(e)),authorizationVersion:Mn(64),clinics:/* @__PURE__ */t.z.array(Nn).min(1).max(Bn)}).strict(),Un=/* @__PURE__ */t.z.object({request_group_id:Fn,pet_ref:/* @__PURE__ */t.z.string(),created_count:/* @__PURE__ */t.z.number().int().nonnegative(),failed_count:/* @__PURE__ */t.z.number().int().nonnegative(),results:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.object({idempotency_key:/* @__PURE__ */t.z.string(),clinic_id:/* @__PURE__ */Fn.nullable().optional(),clinic_free_text:/* @__PURE__ */t.z.string().nullable().optional(),created:/* @__PURE__ */t.z.boolean(),request:/* @__PURE__ */t.z.unknown().optional(),failure_code:/* @__PURE__ */t.z.string().nullable().optional(),failure_reason:/* @__PURE__ */t.z.string().nullable().optional()}))});function createRecordsClinicBatchClient(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}});return{async createClinicRequestBatch(e){if(!Wn.safeParse(e).success)return err(makeEverfurError("validationFailed",{retryable:false}));let r=await t.send("records.clinic.createBatch",{method:"POST",path:"/widget/v1/records/clinic-requests/batch",body:{pet_ref:e.petRef,owner_name:e.ownerName,authorization_version:e.authorizationVersion,clinics:e.clinics.map(e=>({...e.clinicId!==void 0?{clinic_id:e.clinicId}:{clinic_free_text:e.clinicFreeText},...e.clinicEmail!==void 0?{clinic_email:e.clinicEmail}:{},...e.signatureId!==void 0?{signature_id:e.signatureId}:{signature_png_base64:e.signaturePngBase64},idempotency_key:e.idempotencyKey}))}});if(!r.ok)return r;let n=Un.safeParse(r.value);if(!n.success||n.data.pet_ref!==e.petRef)return Gn();let i=[];for(let e of n.data.results){let t=e.request===void 0||e.request===null?null:le(e.request);if(e.created!==(t!==null))return Gn();i.push(/* @__PURE__ */Object.freeze({idempotencyKey:e.idempotency_key,clinicId:e.clinic_id??null,clinicFreeText:e.clinic_free_text??null,created:e.created,request:t,failureCode:e.failure_code??null,failureReason:e.failure_reason??null}))}return ok(/* @__PURE__ */Object.freeze({requestGroupId:n.data.request_group_id,petRef:n.data.pet_ref,results:/* @__PURE__ */Object.freeze(i),createdCount:n.data.created_count,failedCount:n.data.failed_count}))}}}function Gn(){return err(makeEverfurError("internalError",{retryable:false}))}var Kn=/* @__PURE__ */t.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),Yn=/* @__PURE__ */t.z.object({clinics:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.object({clinic_id:Kn,name:/* @__PURE__ */t.z.string().min(1),address:/* @__PURE__ */t.z.string().nullable(),phone:/* @__PURE__ */t.z.string().nullable(),email_status:/* @__PURE__ */t.z.string(),distance_km:/* @__PURE__ */t.z.number().finite().nonnegative().nullable()})),next_cursor:/* @__PURE__ */t.z.string().nullable().optional()}),Xn=/* @__PURE__ */t.z.object({authorization_version:/* @__PURE__ */t.z.string().min(1),scope_template:/* @__PURE__ */t.z.string().min(1),authorization_template:/* @__PURE__ */t.z.string().min(1)}),Qn=/* @__PURE__ */t.z.object({upload_id:/* @__PURE__ */t.z.string().min(1),upload_url:/* @__PURE__ */t.z.string().url().refine(e=>e.startsWith("https://")),upload_fields:/* @__PURE__ */t.z.record(/* @__PURE__ */t.z.string())});function Jn(e){let{repository:r}=e,n=async e=>{let t=await e;if(!t.ok)return t;let r=le(t.value);return r===null?Zn():ok(r)},i=async e=>{let t=await e;if(!t.ok)return t;let r=Yn.safeParse(t.value);return r.success?ok(/* @__PURE__ */Object.freeze({clinics:/* @__PURE__ */Object.freeze(r.data.clinics.map(e=>/* @__PURE__ */Object.freeze({id:e.clinic_id,name:e.name,address:e.address,phone:e.phone,emailStatus:e.email_status,distanceKm:e.distance_km}))),nextCursor:r.data.next_cursor??null})):Zn()};return{searchClinics:(e={})=>i(r.searchClinics(e)),recentClinics:(e={})=>i(r.recentClinics(e)),async getRequestGroup(e){let t=await r.getRequestGroup(e);if(!t.ok)return t;let n=ae(t.value);return n===null?Zn():ok(n)},async getAuthorizationCopy(){let e=await r.getAuthorizationCopy();if(!e.ok)return e;let t=Xn.safeParse(e.value);return t.success?ok(/* @__PURE__ */Object.freeze({authorizationVersion:t.data.authorization_version,scopeTemplate:t.data.scope_template,authorizationTemplate:t.data.authorization_template})):Zn()},async createClinicRequest(e){let t=await n(r.createClinicRequest(e));return t.ok&&t.value.petRef!==e.petRef?Zn():t},retryRequest:e=>n(r.retryRequest(e)),revokeRequest:e=>n(r.revokeRequest(e)),updateClinicEmail:(e,t)=>n(r.updateClinicEmail(e,t)),convertToUpload:e=>n(r.convertToUpload(e)),async initiateSignatureUpload(e){let t=await r.initiateSignatureUpload(e);if(!t.ok)return t;let n=Qn.safeParse(t.value);return n.success?ok(/* @__PURE__ */Object.freeze({uploadId:n.data.upload_id,uploadUrl:n.data.upload_url,uploadFields:/* @__PURE__ */Object.freeze(n.data.upload_fields)})):Zn()},async completeSignatureUpload(e){let n=await r.completeSignatureUpload(e);if(!n.ok)return n;let i=t.z.object({signature_id:Kn}).safeParse(n.value);return i.success?ok(i.data.signature_id):Zn()}}}function Zn(){return err(makeEverfurError("internalError",{retryable:false}))}var ei="/widget/v1/records",ti=/* @__PURE__ */t.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),ri=(e,r=1)=>t.z.string().refine(t=>!Dt(t)&&[...t].length>=r&&[...t].length<=e),ni=e=>[...e].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)===127),ii=ri(320,3).refine(e=>!ni(e)&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e.trim())),li=ri(64),oi=/* @__PURE__ */t.z.object({limit:/* @__PURE__ */t.z.number().int().min(1).max(25).optional()}).strict(),ai=/* @__PURE__ */t.z.object({query:ri(200,0).optional(),location:/* @__PURE__ */t.z.object({latitude:/* @__PURE__ */t.z.number().finite().min(-90).max(90),longitude:/* @__PURE__ */t.z.number().finite().min(-180).max(180)}).strict().optional(),limit:/* @__PURE__ */t.z.number().int().min(1).max(100).optional(),cursor:ri(512,0).optional()}).strict(),si=/* @__PURE__ */t.z.object({petRef:ri(128),ownerName:ri(200).refine(e=>e.trim().length>0&&!ni(e)),authorizationVersion:ri(64),clinicId:/* @__PURE__ */ti.optional(),clinicFreeText:ri(200).refine(e=>e.trim().length>0).optional(),clinicEmail:ii.optional(),signatureId:/* @__PURE__ */ti.optional(),signaturePngBase64:/* @__PURE__ */t.z.string().min(1).max(2*1024*1024).optional(),idempotencyKey:/* @__PURE__ */t.z.string().regex(/^[A-Za-z0-9._-]{8,128}$/)}).strict().refine(e=>e.clinicId===void 0!=(e.clinicFreeText===void 0)).refine(e=>e.signatureId===void 0!=(e.signaturePngBase64===void 0));function di(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=(e,r,n=false)=>t.send(`records.clinic.${e}`,r,r.method==="GET"||n?void 0:{idempotent:false,maxAttempts:1}),n=(e,t,n)=>li.safeParse(e).success?r(t,{method:"POST",path:`${ei}/requests/${encodeURIComponent(e)}/${t}`,...n?{body:n}:{}}):ci();return{searchClinics(e){return ai.safeParse(e).success?r("search",{method:"GET",path:`${ei}/clinics/search`,query:{q:e.query??"",lat:e.location?.latitude,lng:e.location?.longitude,limit:e.limit,cursor:e.cursor}}):ci()},recentClinics(e){return oi.safeParse(e).success?r("recent",{method:"GET",path:`${ei}/clinics/recent`,query:{limit:e.limit}}):ci()},getRequestGroup(e){return li.safeParse(e).success?r("requestGroup",{method:"GET",path:`${ei}/request-groups/${encodeURIComponent(e)}`}):ci()},getAuthorizationCopy:()=>r("authorizationCopy",{method:"GET",path:`${ei}/authorization-copy`}),createClinicRequest(e){return si.safeParse(e).success?r("create",{method:"POST",path:`${ei}/clinic-requests`,body:{pet_ref:e.petRef,owner_name:e.ownerName,authorization_version:e.authorizationVersion,idempotency_key:e.idempotencyKey,...e.clinicId!==void 0?{clinic_id:e.clinicId}:{clinic_free_text:e.clinicFreeText},...e.clinicEmail!==void 0?{clinic_email:e.clinicEmail}:{},...e.signatureId!==void 0?{signature_id:e.signatureId}:{signature_png_base64:e.signaturePngBase64}}},true):ci()},retryRequest:e=>n(e,"retry"),revokeRequest:e=>n(e,"revoke"),convertToUpload:e=>n(e,"convert-to-upload"),updateClinicEmail(e,t){return ii.safeParse(t).success?n(e,"clinic-email",{clinic_email:t}):ci()},initiateSignatureUpload(e){return!Number.isInteger(e)||e<=0||e>2*1024*1024?ci():r("signatureInitiate",{method:"POST",path:`${ei}/signatures/initiate`,body:{content_type:"image/png",file_size:e}})},completeSignatureUpload(e){return/^sig-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)?r("signatureComplete",{method:"POST",path:`${ei}/signatures/complete`,body:{upload_id:e}}):ci()}}}function ci(){return Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false})))}function useEverfurRecordsClinic(){let{runtime:t,userRef:userRef,scopeEpoch:r}=Xt(),n=e.useMemo(()=>{let{services:e}=t.registry;return Jn({repository:di({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})})},[t,userRef,r]),i=e.useRef(n);return e.useEffect(()=>(i.current=n,()=>{i.current=null}),[n]),e.useMemo(()=>{let e=async e=>{if(userRef===null||i.current!==n)return err(makeEverfurError("accessDenied"));let t=await e();return i.current===n?t:err(makeEverfurError("accessDenied"))};return{searchClinics:t=>e(()=>n.searchClinics(t)),recentClinics:t=>e(()=>n.recentClinics(t)),getRequestGroup:t=>e(()=>n.getRequestGroup(t)),getAuthorizationCopy:()=>e(()=>n.getAuthorizationCopy()),createClinicRequest:t=>e(()=>n.createClinicRequest(t)),retryRequest:t=>e(()=>n.retryRequest(t)),revokeRequest:t=>e(()=>n.revokeRequest(t)),updateClinicEmail:(t,r)=>e(()=>n.updateClinicEmail(t,r)),convertToUpload:t=>e(()=>n.convertToUpload(t)),initiateSignatureUpload:t=>e(()=>n.initiateSignatureUpload(t)),completeSignatureUpload:t=>e(()=>n.completeSignatureUpload(t))}},[n,userRef])}function useEverfurRecordsClinicBatch(){let{runtime:t,userRef:userRef,scopeEpoch:r}=Xt(),n=e.useMemo(()=>{let{services:e}=t.registry;return createRecordsClinicBatchClient({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})},[t,userRef,r]),i=e.useRef(n);return e.useEffect(()=>(i.current=n,()=>{i.current=null}),[n]),e.useMemo(()=>({async createClinicRequestBatch(e){if(userRef===null||i.current!==n)return err(makeEverfurError("accessDenied"));let t=await n.createClinicRequestBatch(e);return i.current===n?t:err(makeEverfurError("accessDenied"))}}),[n,userRef])}var ui=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(ui,{fallback:r,resetKey:n,children:e.createElement(RenderHost,{render:t})})}var hi=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(e){return hi[e]}function decideCapability(e,t,r){let n=requires(e),i=/* @__PURE__ */new Map;for(let e of t)i.set(e.resource,e);if(r?.isPending===true&&n.some(e=>!i.has(e)))return fi({name:e,enabled:false,isPending:true,limits:{}});let l=pi(n,i);return n.filter(e=>i.get(e)?.granted!==true).length===0?fi({name:e,enabled:true,isPending:false,limits:l}):fi({name:e,enabled:false,isPending:false,limits:l,disabled:gi(n,i)})}function pi(e,t){let r={};for(let n of e){let e=t.get(n)?.limits;if(e)for(let[t,n]of Object.entries(e)){let e=r[t];r[t]=e===void 0?n:Math.min(e,n)}}return r}function gi(e,t){for(let r of e){let e=t.get(r)?.disabled;if(e)/* @__PURE__ */
23
23
  return Object.freeze({reason:e.reason,level:e.level,recoverable:e.recoverable})}/* @__PURE__ */
24
24
  return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function fi(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:/* @__PURE__ */Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),/* @__PURE__ */Object.freeze(t)}function useCapability(t){let{runtime:r}=Xt(),n=r.entitlements,i=e.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot);return e.useMemo(()=>decideCapability(t,i.decisions,{isPending:i.isPending}),[t,i])}var mi=48;function bi(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(t){let{capability:r,children:i,renderDisabled:l,renderPending:o,style:a}=t,s=useCapability(r),d=e.useMemo(()=>bi(s),[s]);switch(d){case"enabled":return i;case"pending":return o?/* @__PURE__ */n.jsx(HostRender,{render:o,fallback:/* @__PURE__ */n.jsx(PendingSkeleton,{capability:r,style:a})}):/* @__PURE__ */n.jsx(PendingSkeleton,{capability:r,style:a});case"disabled":return l?/* @__PURE__ */n.jsx(HostRender,{render:()=>l(s),fallback:/* @__PURE__ */n.jsx(OffState,{decision:s,style:a}),resetKey:s}):/* @__PURE__ */n.jsx(OffState,{decision:s,style:a});default:return assertNever(d)}}function PendingSkeleton({capability:t,style:i}){let l=useEverfurTheme(),o=e.useMemo(()=>yi(l),[l]);/* @__PURE__ */
@@ -86,7 +86,7 @@ return n.jsx(WifiOffGlyph,{size:t,color:r});default:return null}}function Record
86
86
  return n.jsxs(r.View,{style:a.container,accessibilityRole:"summary",testID:o,children:[
87
87
  /* @__PURE__ */n.jsx(r.View,{style:a.glyph,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:"records-empty-glyph",children:/* @__PURE__ */n.jsx(RecordsEmptyGlyph,{variant:t,size:Vi,color:s.color.brandInk})}),
88
88
  /* @__PURE__ */n.jsx(Text,{style:a.title,children:d.title}),
89
- /* @__PURE__ */n.jsx(Text,{style:a.body,children:l??d.body}),p!==null&&i?/* @__PURE__ */n.jsx(r.Pressable,{onPress:i,disabled:h,accessibilityRole:"button",accessibilityLabel:h?Ti:p,accessibilityState:{disabled:h},style:[a.action,h?a.actionDisabled:null],testID:o?`${o}-action`:`records-empty-${t}-action`,children:/* @__PURE__ */n.jsx(Text,{style:a.actionLabel,children:p})}):null]})}function Hi(){let t=useEverfurTheme();return e.useMemo(()=>Li(t),[t])}var Vi=22,Pi=48;function Li(e){let{color:t,space:n,radius:i,type:l,slots:o}=e;return r.StyleSheet.create({container:{paddingVertical:n.xxl,paddingHorizontal:n.xl,alignItems:"center",gap:n.sm+n.xs/2},glyph:{width:Pi,height:Pi,alignItems:"center",justifyContent:"center",marginBottom:n.xs},title:{...headingFace(e,"bold"),fontSize:l.size.subtitle,lineHeight:Math.round(l.size.subtitle*l.lineHeight.snug)-1,color:t.brandInk,textAlign:"center"},body:{...face(e,"regular"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*l.lineHeight.normal),color:t.text.muted,textAlign:"center",maxWidth:320},action:{marginTop:n.sm,minHeight:n.xxl+n.sm,borderRadius:i.pill,paddingHorizontal:n.lg+n.xs/2,backgroundColor:t.brand,alignItems:"center",justifyContent:"center",...rn(o.primaryButton)},actionDisabled:{opacity:.5},actionLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*l.lineHeight.snug)-1,...nn(o.primaryButton)}})}var Ei=/* @__PURE__ */Object.freeze({note:"Test account: clinics are never contacted. Use records test mode to move a request forward.",clinicNotContacted:"Clinic not contacted",notEmailed:e=>`This is a test account, so no email went to ${e}.`,newClinicDirectSendNote:"This is a test account, so this clinic will not be emailed."});var NO_SUBSCRIPTION=()=>()=>{};function Oi(e){return e?.livemode===false}function Ai(){try{return Xt().runtime.entitlements??null}catch{return null}}function $i(){let t=Ai(),r=e.useCallback(e=>t===null?NO_SUBSCRIPTION():t.subscribe(e),[t]),n=e.useCallback(()=>t===null?false:Oi(t.getSnapshot()),[t]);return e.useSyncExternalStore(r,n,n)}function Bi(t){let[r,n]=e.useState(null);return{shown:t!==null&&r!==t,onError:()=>n(t)}}function BrandLogo({logoUrl:e,name:t,barStyle:i,logoStyle:l,testID:o}){let a=Bi(e);return e===null||!a.shown?null:/* @__PURE__ */n.jsx(r.View,{style:i,...o===void 0?{}:{testID:o},children:/* @__PURE__ */n.jsx(r.Image,{source:{uri:e},style:l,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:a.onError})})}function parseColor(e){let t=Fi(e);return t===null?null:Ki(t)}function Fi(e){if(typeof e=="number")return Ni(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return Mi(t.slice(1));if(t.toLowerCase().startsWith("0x"))return Mi(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return qi(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=Mi(t);if(e!==null)return e}return/^\d+$/.test(t)?Ni(Number.parseInt(t,10)):null}function Mi(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:Ui(t[0]),g:Ui(t[1]),b:Ui(t[2]),a:1};if(t.length===6)return{r:Wi(t,0),g:Wi(t,2),b:Wi(t,4),a:1};if(t.length===8){let e=Wi(t,0);return{r:Wi(t,2),g:Wi(t,4),b:Wi(t,6),a:e/255}}return null}function qi(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 i=Gi(Number(n[0])),l=Gi(Number(n[1])),o=Gi(Number(n[2]));if(i===null||l===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:i,g:l,b:o,a:a}}function Ni(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 Wi(e,t){return Number.parseInt(e.slice(t,t+2),16)}function Ui(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function Gi(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function Ki(e){if(e.a>=1)return Yi(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function Yi(e,t,r){return`#${Xi(e)}${Xi(t)}${Xi(r)}`.toUpperCase()}function Xi(e){return e.toString(16).padStart(2,"0")}var Qi="#111111",Ji="#FFFFFF",Zi="#000000";function readableOn(e){let t=Fi(e);if(t===null)return Ji;let r=rl(t),n=rl({r:17,g:17,b:17}),i=rl({r:255,g:255,b:255});return il(r,i)>=il(r,n)?Ji:Qi}function el(e,t){let r=readableOn(e);return contrastRatio(r,e)>=t?r:contrastRatio(Ji,e)>=contrastRatio(Zi,e)?Ji:Zi}function tl(e){let t=t=>e.reduce((e,r)=>Math.min(e,contrastRatio(t,r)),Number.POSITIVE_INFINITY);return t(Ji)>=t(Zi)?Ji:Zi}function rl(e){let t=nl(e.r/255),r=nl(e.g/255),n=nl(e.b/255);return.2126*t+.7152*r+.0722*n}function nl(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function il(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}function contrastRatio(e,t){let r=Fi(e),n=Fi(t);if(r===null||n===null)return 1;let i=n.a>=1?n:{...n},l=r.a>=1?r:ll(r,i);return il(rl(l),rl(i))}function ll(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 ol(e,t){let r=Fi(e),n=Fi(t);if(r===null||n===null)return null;let i=r.a>=1?r:ll(r,{...n});return Yi(i.r,i.g,i.b)}function al(e,t){let r=Fi(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 sl=.05;function dl(e,t,r,n){let i=t[0];if(i===void 0)return r;let l=e=>t.every(t=>contrastRatio(e,t)>=n);if(Fi(e)===null)return r;if(l(e))return e;let o=ol(e,i),a=o===null?null:Fi(o),s=Fi(r);if(a===null||s===null)return r;for(let e=1;e<1/sl;e+=1){let t=e*sl,r=(e,r)=>Math.round(e+(r-e)*t),n=Yi(r(a.r,s.r),r(a.g,s.g),r(a.b,s.b));if(l(n))return n}return r}var cl=/* @__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"}),ul=/* @__PURE__ */new WeakMap;function hl(e){let t=ul.get(e);if(t!==void 0)return t;let r=e.color,n=e.brightness==="dark",i=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,...cl},l=(e,t)=>dl(e,t,tl(t),pl),o=(e,t)=>contrastRatio(e,t)>=pl?e:el(t,pl),a=[i.card,i.paper].map(e=>ol(r.brandSoft,e)??e),s={primary:r.primary,onPrimary:o(r.onPrimary,r.primary),accent:r.accent,onAccent:o(r.onAccent,r.accent),link:l(r.linkInk,[i.card,i.paper,i.tile]),badge:r.brandSoft,onBadge:l(r.brandInk,a)},d=/* @__PURE__ */Object.freeze({...i,...s});return ul.set(e,d),d}var pl=4.5;function gl(e,t){for(let r of t)if(contrastRatio(r,e)>=pl)return r;return el(e,pl)}var fl=/* @__PURE__ */Object.freeze({ink:"#10462E",go:"#07C168",muted:"#6B6B6B",line:"#E4E4E4",alert:"#C03410",alertDeep:"#6D1D14",tintSage:"#E6ECE8",tintBlue:"#EAEEF6",tintYellow:"#FCF0D6",tintRed:"#FBF1EE",tintGo:"#DCF6EA",icoSage:"#819E90",efWhite:"#FFFFFF",efBlack:"#000000",efCharcoal:"#3D3D3D",efSkyBlue:"#4E98C9",embCyan1:"#E0FDFF",bgMist:"#F1F5F2",paper:"#F8F7F4",embB1:"#FFCE34",embB2:"#5CC8F2",embB3:"#FF6665",embB4:"#A55BD8",embRiskDot:"#E5372B",embRiskInk:"#B0231B",embClearDot:"#5FA82B",embInk2:"#4A4845",embInk3:"#6B6863",embTealInk:"#00707C",embYellow:"#FFCE34",watch:"#F9E6B9",barTrack:"#ECECEC",topCard:"#FFCE34",topKicker:"#4A4845",topInk:"#262523",plainEdge:"rgba(16, 70, 46, 0.2)"}),ml=/* @__PURE__ */Object.freeze({".rec-note":/* @__PURE__ */Object.freeze({fontSize:12.5}),".efh":/* @__PURE__ */Object.freeze({gap:12,fontSize:15}),".efh-sheet":/* @__PURE__ */Object.freeze({marginTop:20,paddingTop:20,paddingBottom:28,paddingLeft:16,borderTopLeftRadius:28}),".efh-ico":/* @__PURE__ */Object.freeze({width:22}),".efh-label":/* @__PURE__ */Object.freeze({fontSize:12}),".efh-pill":/* @__PURE__ */Object.freeze({minHeight:24,paddingLeft:10,fontSize:12,letterSpacing:.72}),".efh-card":/* @__PURE__ */Object.freeze({paddingTop:16,borderRadius:20}),".efh-card__title":/* @__PURE__ */Object.freeze({fontSize:18}),".efh-btn":/* @__PURE__ */Object.freeze({minHeight:48,paddingLeft:20,fontSize:16}),".efh-btn--row":/* @__PURE__ */Object.freeze({minHeight:40,paddingLeft:16,fontSize:15}),".efh-head":/* @__PURE__ */Object.freeze({marginBottom:8}),".efh-name":/* @__PURE__ */Object.freeze({fontSize:22}),".efh-meta":/* @__PURE__ */Object.freeze({fontSize:13}),".efh-stage":/* @__PURE__ */Object.freeze({height:236,marginTop:4,marginLeft:-16}),".efh-stage__grass":/* @__PURE__ */Object.freeze({height:"44%"}),".efh-stage__pet":/* @__PURE__ */Object.freeze({left:"58%",bottom:22,height:"86%"}),".efh-stage .efh-vitals":/* @__PURE__ */Object.freeze({top:14,left:16,gap:12}),".efh-head__from":/* @__PURE__ */Object.freeze({marginTop:12}),".efh-due":/* @__PURE__ */Object.freeze({marginLeft:-12}),".efh-due li":/* @__PURE__ */Object.freeze({gap:12,paddingTop:12,paddingLeft:12,borderRadius:10}),".efh-due__title":/* @__PURE__ */Object.freeze({fontSize:17,lineHeight:22.1}),".efh-sec":/* @__PURE__ */Object.freeze({marginTop:8,marginBottom:12}),".efh-tiles":/* @__PURE__ */Object.freeze({gap:10}),".efh-tile":/* @__PURE__ */Object.freeze({gap:8,paddingTop:16,borderRadius:20}),".efh-tile__title":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:18.75,letterSpacing:-.15}),".efh-tile__foot":/* @__PURE__ */Object.freeze({gap:8,minHeight:28}),".efh-tile__foot .efh-pill":/* @__PURE__ */Object.freeze({minHeight:22,paddingLeft:7,fontSize:10.5,letterSpacing:.21}),".efh-tile__foot:has(.efh-pill + .efh-pill)":/* @__PURE__ */Object.freeze({gap:6}),".efh-tile__num":/* @__PURE__ */Object.freeze({fontSize:20,lineHeight:20,letterSpacing:-.4}),".efh-wt":/* @__PURE__ */Object.freeze({gap:8}),".efh-wt b":/* @__PURE__ */Object.freeze({fontSize:32,lineHeight:32,letterSpacing:-.64}),".efh-emb":/* @__PURE__ */Object.freeze({gap:8,marginTop:12,fontSize:15,lineHeight:19.5}),".efh-wchart":/* @__PURE__ */Object.freeze({marginTop:20}),".efh-wchart__plot":/* @__PURE__ */Object.freeze({height:148}),".efh-wkey":/* @__PURE__ */Object.freeze({rowGap:4,columnGap:16,marginTop:12,fontSize:13,lineHeight:18.2}),".efh-wkey span":/* @__PURE__ */Object.freeze({gap:6}),".efh-key":/* @__PURE__ */Object.freeze({rowGap:8,columnGap:16,fontSize:13,lineHeight:18.2}),".efh-key span":/* @__PURE__ */Object.freeze({gap:6}),".efh-key span::before":/* @__PURE__ */Object.freeze({width:10}),".efh-tl__dot":/* @__PURE__ */Object.freeze({width:16,marginTop:3}),".efh-tl__year":/* @__PURE__ */Object.freeze({marginTop:20,marginBottom:12,marginLeft:40}),".efh-tl .efh-tl__year":/* @__PURE__ */Object.freeze({marginTop:4}),".efh-tl__item":/* @__PURE__ */Object.freeze({gap:16,paddingBottom:24}),".efh-tl__item::before":/* @__PURE__ */Object.freeze({left:11,top:22,bottom:-2}),".efh-tl__date":/* @__PURE__ */Object.freeze({fontSize:12,lineHeight:16.8,letterSpacing:.48}),".efh-tl__title":/* @__PURE__ */Object.freeze({marginTop:2,fontSize:17,lineHeight:22.1}),".efh-tl__text":/* @__PURE__ */Object.freeze({marginTop:2,lineHeight:22.5}),".efh-add":/* @__PURE__ */Object.freeze({gap:12}),".efh-add > p":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:22.5}),".efh-sheet .rec-note":/* @__PURE__ */Object.freeze({marginTop:4}),".efh-lab":/* @__PURE__ */Object.freeze({paddingTop:8,paddingBottom:96,paddingLeft:16}),".efh-titles":/* @__PURE__ */Object.freeze({gap:2,paddingTop:4}),".efh-title":/* @__PURE__ */Object.freeze({fontSize:22}),".efh-smeta":/* @__PURE__ */Object.freeze({fontSize:13}),".efh-mk__name":/* @__PURE__ */Object.freeze({fontSize:17}),".efh-mk__line":/* @__PURE__ */Object.freeze({rowGap:0,columnGap:6,marginTop:1,fontSize:13,lineHeight:18.2}),".efh-mk__line b":/* @__PURE__ */Object.freeze({fontSize:17}),".efh-none":/* @__PURE__ */Object.freeze({paddingTop:0}),".efh-none__scene":/* @__PURE__ */Object.freeze({marginBottom:16,marginLeft:-16}),".efh-none__t":/* @__PURE__ */Object.freeze({fontSize:22,lineHeight:25.3,letterSpacing:-.44}),".efh-none__lead":/* @__PURE__ */Object.freeze({marginTop:8,fontSize:15,lineHeight:22.5}),".efh-ways":/* @__PURE__ */Object.freeze({gap:12,marginTop:16}),".efh-way":/* @__PURE__ */Object.freeze({columnGap:12,paddingTop:16,borderRadius:20}),".efh-way__w":/* @__PURE__ */Object.freeze({gap:2}),".efh-way__t":/* @__PURE__ */Object.freeze({fontSize:16,lineHeight:20.8}),".efh-way__x":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:21.75}),".efh-peek__labs .efh-card__title":/* @__PURE__ */Object.freeze({marginBottom:8}),".efh-peek__g":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:21.75,marginBottom:6}),".efh-peek__g b":/* @__PURE__ */Object.freeze({fontSize:16}),".dot":/* @__PURE__ */Object.freeze({width:9}),".rec-top":/* @__PURE__ */Object.freeze({gap:8,paddingTop:16,paddingRight:18,paddingBottom:18,paddingLeft:18,borderRadius:22}),".rec-top__k":/* @__PURE__ */Object.freeze({gap:7,fontSize:10.5,letterSpacing:.63}),".rec-top .emb-btn":/* @__PURE__ */Object.freeze({marginTop:4}),".mixbar":/* @__PURE__ */Object.freeze({gap:2,height:10}),".mixlegend":/* @__PURE__ */Object.freeze({rowGap:6,columnGap:14,marginTop:12,fontSize:13.5}),".mixlegend li":/* @__PURE__ */Object.freeze({gap:7}),".mixlegend i":/* @__PURE__ */Object.freeze({width:9}),".mixlegend b":/* @__PURE__ */Object.freeze({fontSize:12}),".askbar":/* @__PURE__ */Object.freeze({gap:6,height:52,paddingRight:6,paddingLeft:8,borderWidth:1.5}),".askbar input":/* @__PURE__ */Object.freeze({fontSize:16}),".askbar__add":/* @__PURE__ */Object.freeze({width:38}),".askbar__add svg":/* @__PURE__ */Object.freeze({width:22}),".askbar__send":/* @__PURE__ */Object.freeze({width:40}),".askbar__send svg":/* @__PURE__ */Object.freeze({width:20}),".ph-head":/* @__PURE__ */Object.freeze({height:58,paddingLeft:14}),".ph-back":/* @__PURE__ */Object.freeze({width:44,marginLeft:-6}),".ph-back svg":/* @__PURE__ */Object.freeze({width:26}),".ph-title":/* @__PURE__ */Object.freeze({fontSize:17}),".emb-card":/* @__PURE__ */Object.freeze({borderRadius:22}),".emb-tile":/* @__PURE__ */Object.freeze({width:46,height:46,borderRadius:13}),".ask-pill":/* @__PURE__ */Object.freeze({right:16,bottom:16,gap:8,minHeight:48,paddingRight:18,paddingLeft:14,fontSize:15.5}),".ask-pill svg":/* @__PURE__ */Object.freeze({width:22}),".ph-askbar":/* @__PURE__ */Object.freeze({paddingTop:10,paddingRight:14,paddingBottom:10,paddingLeft:14}),".rec":/* @__PURE__ */Object.freeze({paddingTop:18,paddingLeft:16}),".rec-dna":/* @__PURE__ */Object.freeze({paddingTop:16,marginTop:16}),".rec-dna__top":/* @__PURE__ */Object.freeze({gap:12,marginBottom:14}),".rec-dna__top h3":/* @__PURE__ */Object.freeze({fontSize:17}),".rec-dna__top p":/* @__PURE__ */Object.freeze({fontSize:10.5,letterSpacing:.53,marginTop:2}),".rec-dna__risk":/* @__PURE__ */Object.freeze({gap:10,marginTop:14,paddingTop:12,paddingRight:12,paddingBottom:12,paddingLeft:14,borderRadius:14}),".rec-dna__risk small":/* @__PURE__ */Object.freeze({fontSize:13}),".rec-dna__risk strong":/* @__PURE__ */Object.freeze({marginTop:1,fontSize:16,lineHeight:20}),".rec-dna__clear":/* @__PURE__ */Object.freeze({gap:7,minHeight:36,marginTop:4,paddingLeft:4,fontSize:14}),".rec-dna__clear .dot":/* @__PURE__ */Object.freeze({width:7})}),bl=/* @__PURE__ */Object.freeze({viewBox:[0,0,240,64],path:{x0:12,y0:60,cx:120,cy:-4,x1:228,y1:60},width:210,headX:.34,headTop:0,gap:2,fontSize:22,fontWeight:"500",beats:4,keyframes:[{offset:0,opacity:0},{offset:.025,opacity:1},{offset:.052,opacity:1},{offset:.077,opacity:0},{offset:1,opacity:0}],durationMs:44e3,easing:"ease-in-out",delayMs:1200,staggerMs:3600}),yl=/* @__PURE__ */Object.freeze({height:212,grassHeight:64,petHeight:150,petBottom:16,petAspect:.731,grassSize:[1520,479],petSize:[307,420]});var xl=ml;function wl(e,t){let r=xl[e]?.[t];return typeof r=="number"?r:Number.NaN}var vl=wl;function kl(e,t){let r=xl[e]?.[t];return typeof r=="string"&&r.endsWith("%")?Number(r.slice(0,-1))/100:Number.NaN}var jl=/* @__PURE__ */Object.freeze({gap:vl(".efh","gap"),sheetPadTop:vl(".efh-sheet","paddingTop"),sheetPadX:vl(".efh-sheet","paddingLeft"),sheetPadBottom:vl(".efh-sheet","paddingBottom"),sheetRadius:vl(".efh-sheet","borderTopLeftRadius"),sheetGap:vl(".efh-sheet","marginTop"),cardPad:vl(".efh-card","paddingTop"),cardRadius:vl(".efh-card","borderRadius"),name:vl(".efh-name","fontSize"),cardTitle:vl(".efh-card__title","fontSize"),rowTitle:vl(".efh-mk__name","fontSize"),body:vl(".efh","fontSize"),small:vl(".efh-meta","fontSize"),mono:vl(".efh-label","fontSize"),tileNum:vl(".efh-tile__num","fontSize"),big:vl(".efh-wt b","fontSize"),button:vl(".efh-btn","minHeight"),rowButton:vl(".efh-btn--row","minHeight"),pill:vl(".efh-pill","minHeight"),plot:vl(".efh-wchart__plot","height"),rowRadius:vl(".efh-due li","borderRadius"),tileGap:vl(".efh-tiles","gap"),icon:vl(".efh-ico","width")});function Sl(e,t){return e.trim().toLowerCase()===t.trim().toLowerCase()}function Cl(e,t,r){let n=al(e,r);return(n!==null?ol(n,t):null)??t}var Rl=(e,t)=>parseColor(e)===parseColor(t);function Tl(e){if(e.brightness!=="light")return false;let t=e.color,r=Kr.color;return Rl(t.primary,r.primary)&&Rl(t.brandInk,r.brandInk)&&Rl(t.onPrimary,r.onPrimary)&&Rl(t.accent,r.accent)&&Rl(t.accentEdge,r.accentEdge)}function _l(e){let t=e.color,r=fl,n=hl(e),i=e.brightness==="dark",l=Tl(e),o=(i?Xr:Kr).color,a=!Rl(t.accent,o.accent),s=i?t.surface:r.efWhite,d=(e,t)=>Cl(e,s,i?.18:t),c=l?r.tintSage:d(n.primary,.105),u=l?r.topCard:a?n.accent:c;return{tintSage:c,chevron:l?r.icoSage:Cl(t.brandInk,s,.527),rowGround:l?r.bgMist:d(n.primary,.059),tintPartner:a?d(n.accent,.14):r.embCyan1,topFill:u,plainEdge:l?r.plainEdge:al(t.brandInk,.2)??t.structureEdge,topKicker:gl(u,[a?n.onAccent:i?n.ink3:r.topKicker,r.topInk]),topInk:gl(u,[a?n.onAccent:i?n.ink:r.topInk,r.topInk])}}function recordsSheetLook(e){let t=e.color,r=fl,n=hl(e),i=_l(e),l=Tl(e)?r.go:Sl(t.accent,t.primary)?t.onPrimary:t.accent;return e.brightness==="dark"?/* @__PURE__ */Object.freeze({dark:true,paper:n.paper,ground:t.background,card:n.card,text:n.ink,muted:n.ink3,line:t.structureEdge,ink:t.brandInk,fill:n.primary,onFill:n.onPrimary,accentOnFill:l,accent:n.accent,go:t.success,goTint:t.badgeBgPositive,alert:n.riskInk,alertDeep:n.riskInk,alertTint:t.badgeBgCritical,watch:t.badgeBgCaution,wind:r.efSkyBlue,tintBlue:t.surfaceSubtle,tintYellow:t.surfaceSubtle,barTrack:t.structureEdge,...i}):/* @__PURE__ */Object.freeze({dark:false,paper:n.paper,ground:r.efWhite,card:r.efWhite,text:r.efBlack,muted:r.muted,line:r.line,ink:t.brandInk,fill:n.primary,onFill:n.onPrimary,accentOnFill:l,accent:n.accent,go:r.go,goTint:r.tintGo,alert:r.alert,alertDeep:r.alertDeep,alertTint:r.tintRed,watch:r.watch,wind:r.efSkyBlue,tintBlue:r.tintBlue,tintYellow:r.tintYellow,barTrack:r.barTrack,...i})}function zl(e){return Tl(e)}function Il(e){let t=(e.brightness==="dark"?Xr:Kr).color;return!Rl(e.color.accent,t.accent)}function Dl(e){if(e===void 0)return null;let t=e.split(",")[0]?.trim().replace(/^["']|["']$/g,"").trim()??"";return t.length>0?t:null}function Hl(e,t,r){let n=Dl(r?.font),i=Dl(r?.mono),l=t==="everfur"||t==="raph";if(!l&&n===null&&i===null)return e;let o=e.type,a={...o.families,...n!==null?{regular:n,medium:n,bold:n}:{},...i!==null?{mono:i,monoMedium:i,monoBold:i}:{}},s={...o.namedFaces,...n!==null?{regular:false,medium:false,bold:false}:{},...i!==null?{mono:false,monoMedium:false,monoBold:false}:{}};return{...e,...l?{brightness:"light",highContrast:false,color:Kr.color}:{},type:{...o,families:a,namedFaces:s,family:a.regular,mono:a.mono}}}var Vl=e.createContext("sheet"),Pl=Vl.Provider;function Ll(){return e.useContext(Vl)}function El(e,t={}){return{padding:e.cardPad,gap:12,...t,...e.card}}function Ol(e,t){let r={...e};for(let n of Object.keys(t)){let i=t[n];i!==void 0&&(r[n]={...e[n],...i})}return r}var Al=/* @__PURE__ */new WeakMap;function $l(e){let t=Al.get(e);if(t!==void 0)return t;let r=recordsSheetLook(e),n=ln(e.slots),i=face(e,"bold"),l={...i,fontSize:16,lineHeight:20},o=/* @__PURE__ */Object.freeze({look:r,ground:r.ground,card:{backgroundColor:r.card,borderRadius:e.radius.lg,borderWidth:r.dark?1:0,borderColor:r.line,shadowColor:"#000000",shadowOpacity:r.dark?0:.09,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:r.dark?0:1,...rn(n,1)},cardPad:jl.cardPad,cardTitle:{...i,fontSize:jl.cardTitle,lineHeight:Math.round(jl.cardTitle*1.25*100)/100,letterSpacing:-.36,color:r.ink,...nn(n)},body:{...face(e,"regular"),fontSize:15,lineHeight:21,color:r.ink,...nn(n)},title:{...face(e,"medium"),fontSize:jl.name,lineHeight:Math.round(jl.name*1.2*100)/100,letterSpacing:-.33,color:r.ink},button:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,minHeight:jl.button,paddingHorizontal:20,borderRadius:999},buttonInk:{backgroundColor:r.fill,borderWidth:0,...rn(e.slots.primaryButton)},buttonInkLabel:{...l,color:r.onFill,...nn(e.slots.primaryButton)},buttonOutline:{backgroundColor:"transparent",borderWidth:1.5,borderColor:r.ink},buttonOutlineLabel:{...l,color:r.ink},askPill:{backgroundColor:fl.embYellow,borderWidth:0,paddingLeft:wl(".ask-pill","paddingLeft"),paddingRight:wl(".ask-pill","paddingRight")},askPillLabel:{...i,fontSize:wl(".ask-pill","fontSize"),lineHeight:wl(".ask-pill","fontSize")*1.2,color:fl.topInk}});return Al.set(e,o),o}var Bl=/* @__PURE__ */Object.freeze({pressScale:.97,pressMs:160,riseWebPx:16,riseNativePx:14,fadeMs:320,moveMs:480,staggerMs:55,maxSteps:8});var Fl=e=>e.replace(/\s+/gu," ").trim().replace(/\.$/u,"").toLowerCase(),Ml=Fl(mn);function ql(e){let t=Fl(e);return t.length===0||t===Ml}function Nl(e){let t=(e.brightness==="dark"?Xr:Kr).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))}}var Wl=4.5;function Ul(e){if(!Nl(e).success)return null;let t=[e.color.surface];return dl(e.color.success,t,tl(t),Wl)}var Gl=52,Kl="rgba(0,0,0,0.4)";function Yl(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>Jl(t,r),[t,r])}function Xl(){let e=useEverfurTheme();return Ll()==="sheet"?$l(e):null}function DisclaimerBand({disclaimer:e,style:t}){let i=Yl();return ql(e)?null:/* @__PURE__ */n.jsxs(r.View,{style:[i.band,t],accessible:true,accessibilityRole:"text",accessibilityLabel:xn.important(e),testID:"records-disclaimer-band",children:[
89
+ /* @__PURE__ */n.jsx(Text,{style:a.body,children:l??d.body}),p!==null&&i?/* @__PURE__ */n.jsx(r.Pressable,{onPress:i,disabled:h,accessibilityRole:"button",accessibilityLabel:h?Ti:p,accessibilityState:{disabled:h},style:[a.action,h?a.actionDisabled:null],testID:o?`${o}-action`:`records-empty-${t}-action`,children:/* @__PURE__ */n.jsx(Text,{style:a.actionLabel,children:p})}):null]})}function Hi(){let t=useEverfurTheme();return e.useMemo(()=>Li(t),[t])}var Vi=22,Pi=48;function Li(e){let{color:t,space:n,radius:i,type:l,slots:o}=e;return r.StyleSheet.create({container:{paddingVertical:n.xxl,paddingHorizontal:n.xl,alignItems:"center",gap:n.sm+n.xs/2},glyph:{width:Pi,height:Pi,alignItems:"center",justifyContent:"center",marginBottom:n.xs},title:{...headingFace(e,"bold"),fontSize:l.size.subtitle,lineHeight:Math.round(l.size.subtitle*l.lineHeight.snug)-1,color:t.brandInk,textAlign:"center"},body:{...face(e,"regular"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*l.lineHeight.normal),color:t.text.muted,textAlign:"center",maxWidth:320},action:{marginTop:n.sm,minHeight:n.xxl+n.sm,borderRadius:i.pill,paddingHorizontal:n.lg+n.xs/2,backgroundColor:t.brand,alignItems:"center",justifyContent:"center",...rn(o.primaryButton)},actionDisabled:{opacity:.5},actionLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*l.lineHeight.snug)-1,...nn(o.primaryButton)}})}var Oi=/* @__PURE__ */Object.freeze({note:"Test account: clinics are never contacted. Use records test mode to move a request forward.",clinicNotContacted:"Clinic not contacted",notEmailed:e=>`This is a test account, so no email went to ${e}.`,newClinicDirectSendNote:"This is a test account, so this clinic will not be emailed."});var NO_SUBSCRIPTION=()=>()=>{};function Ei(e){return e?.livemode===false}function Ai(){try{return Xt().runtime.entitlements??null}catch{return null}}function $i(){let t=Ai(),r=e.useCallback(e=>t===null?NO_SUBSCRIPTION():t.subscribe(e),[t]),n=e.useCallback(()=>t===null?false:Ei(t.getSnapshot()),[t]);return e.useSyncExternalStore(r,n,n)}function Bi(t){let[r,n]=e.useState(null);return{shown:t!==null&&r!==t,onError:()=>n(t)}}function BrandLogo({logoUrl:e,name:t,barStyle:i,logoStyle:l,testID:o}){let a=Bi(e);return e===null||!a.shown?null:/* @__PURE__ */n.jsx(r.View,{style:i,...o===void 0?{}:{testID:o},children:/* @__PURE__ */n.jsx(r.Image,{source:{uri:e},style:l,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:a.onError})})}function parseColor(e){let t=Fi(e);return t===null?null:Ki(t)}function Fi(e){if(typeof e=="number")return Ni(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return Mi(t.slice(1));if(t.toLowerCase().startsWith("0x"))return Mi(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return qi(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=Mi(t);if(e!==null)return e}return/^\d+$/.test(t)?Ni(Number.parseInt(t,10)):null}function Mi(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:Ui(t[0]),g:Ui(t[1]),b:Ui(t[2]),a:1};if(t.length===6)return{r:Wi(t,0),g:Wi(t,2),b:Wi(t,4),a:1};if(t.length===8){let e=Wi(t,0);return{r:Wi(t,2),g:Wi(t,4),b:Wi(t,6),a:e/255}}return null}function qi(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 i=Gi(Number(n[0])),l=Gi(Number(n[1])),o=Gi(Number(n[2]));if(i===null||l===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:i,g:l,b:o,a:a}}function Ni(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 Wi(e,t){return Number.parseInt(e.slice(t,t+2),16)}function Ui(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function Gi(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function Ki(e){if(e.a>=1)return Yi(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function Yi(e,t,r){return`#${Xi(e)}${Xi(t)}${Xi(r)}`.toUpperCase()}function Xi(e){return e.toString(16).padStart(2,"0")}var Qi="#111111",Ji="#FFFFFF",Zi="#000000";function readableOn(e){let t=Fi(e);if(t===null)return Ji;let r=rl(t),n=rl({r:17,g:17,b:17}),i=rl({r:255,g:255,b:255});return il(r,i)>=il(r,n)?Ji:Qi}function el(e,t){let r=readableOn(e);return contrastRatio(r,e)>=t?r:contrastRatio(Ji,e)>=contrastRatio(Zi,e)?Ji:Zi}function tl(e){let t=t=>e.reduce((e,r)=>Math.min(e,contrastRatio(t,r)),Number.POSITIVE_INFINITY);return t(Ji)>=t(Zi)?Ji:Zi}function rl(e){let t=nl(e.r/255),r=nl(e.g/255),n=nl(e.b/255);return.2126*t+.7152*r+.0722*n}function nl(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function il(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}function contrastRatio(e,t){let r=Fi(e),n=Fi(t);if(r===null||n===null)return 1;let i=n.a>=1?n:{...n},l=r.a>=1?r:ll(r,i);return il(rl(l),rl(i))}function ll(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 ol(e,t){let r=Fi(e),n=Fi(t);if(r===null||n===null)return null;let i=r.a>=1?r:ll(r,{...n});return Yi(i.r,i.g,i.b)}function al(e,t){let r=Fi(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 sl=.05;function dl(e,t,r,n){let i=t[0];if(i===void 0)return r;let l=e=>t.every(t=>contrastRatio(e,t)>=n);if(Fi(e)===null)return r;if(l(e))return e;let o=ol(e,i),a=o===null?null:Fi(o),s=Fi(r);if(a===null||s===null)return r;for(let e=1;e<1/sl;e+=1){let t=e*sl,r=(e,r)=>Math.round(e+(r-e)*t),n=Yi(r(a.r,s.r),r(a.g,s.g),r(a.b,s.b));if(l(n))return n}return r}var cl=/* @__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"}),ul=/* @__PURE__ */new WeakMap;function hl(e){let t=ul.get(e);if(t!==void 0)return t;let r=e.color,n=e.brightness==="dark",i=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,...cl},l=(e,t)=>dl(e,t,tl(t),pl),o=(e,t)=>contrastRatio(e,t)>=pl?e:el(t,pl),a=[i.card,i.paper].map(e=>ol(r.brandSoft,e)??e),s={primary:r.primary,onPrimary:o(r.onPrimary,r.primary),accent:r.accent,onAccent:o(r.onAccent,r.accent),link:l(r.linkInk,[i.card,i.paper,i.tile]),badge:r.brandSoft,onBadge:l(r.brandInk,a)},d=/* @__PURE__ */Object.freeze({...i,...s});return ul.set(e,d),d}var pl=4.5;function gl(e,t){for(let r of t)if(contrastRatio(r,e)>=pl)return r;return el(e,pl)}var fl=/* @__PURE__ */Object.freeze({ink:"#10462E",go:"#07C168",muted:"#6B6B6B",line:"#E4E4E4",alert:"#C03410",alertDeep:"#6D1D14",tintSage:"#E6ECE8",tintBlue:"#EAEEF6",tintYellow:"#FCF0D6",tintRed:"#FBF1EE",tintGo:"#DCF6EA",icoSage:"#819E90",efWhite:"#FFFFFF",efBlack:"#000000",efCharcoal:"#3D3D3D",efSkyBlue:"#4E98C9",embCyan1:"#E0FDFF",bgMist:"#F1F5F2",paper:"#F8F7F4",embB1:"#FFCE34",embB2:"#5CC8F2",embB3:"#FF6665",embB4:"#A55BD8",embRiskDot:"#E5372B",embRiskInk:"#B0231B",embClearDot:"#5FA82B",embInk2:"#4A4845",embInk3:"#6B6863",embTealInk:"#00707C",embYellow:"#FFCE34",watch:"#F9E6B9",barTrack:"#ECECEC",topCard:"#FFCE34",topKicker:"#4A4845",topInk:"#262523",plainEdge:"rgba(16, 70, 46, 0.2)"}),ml=/* @__PURE__ */Object.freeze({".rec-note":/* @__PURE__ */Object.freeze({fontSize:12.5}),".efh":/* @__PURE__ */Object.freeze({gap:12,fontSize:15}),".efh-sheet":/* @__PURE__ */Object.freeze({marginTop:20,paddingTop:20,paddingBottom:28,paddingLeft:16,borderTopLeftRadius:28}),".efh-ico":/* @__PURE__ */Object.freeze({width:22}),".efh-label":/* @__PURE__ */Object.freeze({fontSize:12}),".efh-pill":/* @__PURE__ */Object.freeze({minHeight:24,paddingLeft:10,fontSize:12,letterSpacing:.72}),".efh-card":/* @__PURE__ */Object.freeze({paddingTop:16,borderRadius:20}),".efh-card__title":/* @__PURE__ */Object.freeze({fontSize:18}),".efh-btn":/* @__PURE__ */Object.freeze({minHeight:48,paddingLeft:20,fontSize:16}),".efh-btn--row":/* @__PURE__ */Object.freeze({minHeight:40,paddingLeft:16,fontSize:15}),".efh-head":/* @__PURE__ */Object.freeze({marginBottom:8}),".efh-name":/* @__PURE__ */Object.freeze({fontSize:22}),".efh-meta":/* @__PURE__ */Object.freeze({fontSize:13}),".efh-stage":/* @__PURE__ */Object.freeze({height:236,marginTop:4,marginLeft:-16}),".efh-stage__grass":/* @__PURE__ */Object.freeze({height:"44%"}),".efh-stage__pet":/* @__PURE__ */Object.freeze({left:"58%",bottom:22,height:"86%"}),".efh-stage .efh-vitals":/* @__PURE__ */Object.freeze({top:14,left:16,gap:12}),".efh-head__from":/* @__PURE__ */Object.freeze({marginTop:12}),".efh-due":/* @__PURE__ */Object.freeze({marginLeft:-12}),".efh-due li":/* @__PURE__ */Object.freeze({gap:12,paddingTop:12,paddingLeft:12,borderRadius:10}),".efh-due__title":/* @__PURE__ */Object.freeze({fontSize:17,lineHeight:22.1}),".efh-sec":/* @__PURE__ */Object.freeze({marginTop:8,marginBottom:12}),".efh-tiles":/* @__PURE__ */Object.freeze({gap:10}),".efh-tile":/* @__PURE__ */Object.freeze({gap:8,paddingTop:16,borderRadius:20}),".efh-tile__title":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:18.75,letterSpacing:-.15}),".efh-tile__foot":/* @__PURE__ */Object.freeze({gap:8,minHeight:28}),".efh-tile__foot .efh-pill":/* @__PURE__ */Object.freeze({minHeight:22,paddingLeft:7,fontSize:10.5,letterSpacing:.21}),".efh-tile__foot:has(.efh-pill + .efh-pill)":/* @__PURE__ */Object.freeze({gap:6}),".efh-tile__num":/* @__PURE__ */Object.freeze({fontSize:20,lineHeight:20,letterSpacing:-.4}),".efh-wt":/* @__PURE__ */Object.freeze({gap:8}),".efh-wt b":/* @__PURE__ */Object.freeze({fontSize:32,lineHeight:32,letterSpacing:-.64}),".efh-emb":/* @__PURE__ */Object.freeze({gap:8,marginTop:12,fontSize:15,lineHeight:19.5}),".efh-wchart":/* @__PURE__ */Object.freeze({marginTop:20}),".efh-wchart__plot":/* @__PURE__ */Object.freeze({height:148}),".efh-wkey":/* @__PURE__ */Object.freeze({rowGap:4,columnGap:16,marginTop:12,fontSize:13,lineHeight:18.2}),".efh-wkey span":/* @__PURE__ */Object.freeze({gap:6}),".efh-key":/* @__PURE__ */Object.freeze({rowGap:8,columnGap:16,fontSize:13,lineHeight:18.2}),".efh-key span":/* @__PURE__ */Object.freeze({gap:6}),".efh-key span::before":/* @__PURE__ */Object.freeze({width:10}),".efh-tl__dot":/* @__PURE__ */Object.freeze({width:16,marginTop:3}),".efh-tl__year":/* @__PURE__ */Object.freeze({marginTop:20,marginBottom:12,marginLeft:40}),".efh-tl .efh-tl__year":/* @__PURE__ */Object.freeze({marginTop:4}),".efh-tl__item":/* @__PURE__ */Object.freeze({gap:16,paddingBottom:24}),".efh-tl__item::before":/* @__PURE__ */Object.freeze({left:11,top:22,bottom:-2}),".efh-tl__date":/* @__PURE__ */Object.freeze({fontSize:12,lineHeight:16.8,letterSpacing:.48}),".efh-tl__title":/* @__PURE__ */Object.freeze({marginTop:2,fontSize:17,lineHeight:22.1}),".efh-tl__text":/* @__PURE__ */Object.freeze({marginTop:2,lineHeight:22.5}),".efh-add":/* @__PURE__ */Object.freeze({gap:12}),".efh-add > p":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:22.5}),".efh-sheet .rec-note":/* @__PURE__ */Object.freeze({marginTop:4}),".efh-lab":/* @__PURE__ */Object.freeze({paddingTop:8,paddingBottom:96,paddingLeft:16}),".efh-titles":/* @__PURE__ */Object.freeze({gap:2,paddingTop:4}),".efh-title":/* @__PURE__ */Object.freeze({fontSize:22}),".efh-smeta":/* @__PURE__ */Object.freeze({fontSize:13}),".efh-mk__name":/* @__PURE__ */Object.freeze({fontSize:17}),".efh-mk__line":/* @__PURE__ */Object.freeze({rowGap:0,columnGap:6,marginTop:1,fontSize:13,lineHeight:18.2}),".efh-mk__line b":/* @__PURE__ */Object.freeze({fontSize:17}),".efh-none":/* @__PURE__ */Object.freeze({paddingTop:0}),".efh-none__scene":/* @__PURE__ */Object.freeze({marginBottom:16,marginLeft:-16}),".efh-none__t":/* @__PURE__ */Object.freeze({fontSize:22,lineHeight:25.3,letterSpacing:-.44}),".efh-none__lead":/* @__PURE__ */Object.freeze({marginTop:8,fontSize:15,lineHeight:22.5}),".efh-ways":/* @__PURE__ */Object.freeze({gap:12,marginTop:16}),".efh-way":/* @__PURE__ */Object.freeze({columnGap:12,paddingTop:16,borderRadius:20}),".efh-way__w":/* @__PURE__ */Object.freeze({gap:2}),".efh-way__t":/* @__PURE__ */Object.freeze({fontSize:16,lineHeight:20.8}),".efh-way__x":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:21.75}),".efh-peek__labs .efh-card__title":/* @__PURE__ */Object.freeze({marginBottom:8}),".efh-peek__g":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:21.75,marginBottom:6}),".efh-peek__g b":/* @__PURE__ */Object.freeze({fontSize:16}),".dot":/* @__PURE__ */Object.freeze({width:9}),".rec-top":/* @__PURE__ */Object.freeze({gap:8,paddingTop:16,paddingRight:18,paddingBottom:18,paddingLeft:18,borderRadius:22}),".rec-top__k":/* @__PURE__ */Object.freeze({gap:7,fontSize:10.5,letterSpacing:.63}),".rec-top .emb-btn":/* @__PURE__ */Object.freeze({marginTop:4}),".mixbar":/* @__PURE__ */Object.freeze({gap:2,height:10}),".mixlegend":/* @__PURE__ */Object.freeze({rowGap:6,columnGap:14,marginTop:12,fontSize:13.5}),".mixlegend li":/* @__PURE__ */Object.freeze({gap:7}),".mixlegend i":/* @__PURE__ */Object.freeze({width:9}),".mixlegend b":/* @__PURE__ */Object.freeze({fontSize:12}),".askbar":/* @__PURE__ */Object.freeze({gap:6,height:52,paddingRight:6,paddingLeft:8,borderWidth:1.5}),".askbar input":/* @__PURE__ */Object.freeze({fontSize:16}),".askbar__add":/* @__PURE__ */Object.freeze({width:38}),".askbar__add svg":/* @__PURE__ */Object.freeze({width:22}),".askbar__send":/* @__PURE__ */Object.freeze({width:40}),".askbar__send svg":/* @__PURE__ */Object.freeze({width:20}),".ph-head":/* @__PURE__ */Object.freeze({height:58,paddingLeft:14}),".ph-back":/* @__PURE__ */Object.freeze({width:44,marginLeft:-6}),".ph-back svg":/* @__PURE__ */Object.freeze({width:26}),".ph-title":/* @__PURE__ */Object.freeze({fontSize:17}),".emb-card":/* @__PURE__ */Object.freeze({borderRadius:22}),".emb-tile":/* @__PURE__ */Object.freeze({width:46,height:46,borderRadius:13}),".ask-pill":/* @__PURE__ */Object.freeze({right:16,bottom:16,gap:8,minHeight:48,paddingRight:18,paddingLeft:14,fontSize:15.5}),".ask-pill svg":/* @__PURE__ */Object.freeze({width:22}),".ph-askbar":/* @__PURE__ */Object.freeze({paddingTop:10,paddingRight:14,paddingBottom:10,paddingLeft:14}),".rec":/* @__PURE__ */Object.freeze({paddingTop:18,paddingLeft:16}),".rec-dna":/* @__PURE__ */Object.freeze({paddingTop:16,marginTop:16}),".rec-dna__top":/* @__PURE__ */Object.freeze({gap:12,marginBottom:14}),".rec-dna__top h3":/* @__PURE__ */Object.freeze({fontSize:17}),".rec-dna__top p":/* @__PURE__ */Object.freeze({fontSize:10.5,letterSpacing:.53,marginTop:2}),".rec-dna__risk":/* @__PURE__ */Object.freeze({gap:10,marginTop:14,paddingTop:12,paddingRight:12,paddingBottom:12,paddingLeft:14,borderRadius:14}),".rec-dna__risk small":/* @__PURE__ */Object.freeze({fontSize:13}),".rec-dna__risk strong":/* @__PURE__ */Object.freeze({marginTop:1,fontSize:16,lineHeight:20}),".rec-dna__clear":/* @__PURE__ */Object.freeze({gap:7,minHeight:36,marginTop:4,paddingLeft:4,fontSize:14}),".rec-dna__clear .dot":/* @__PURE__ */Object.freeze({width:7})}),bl=/* @__PURE__ */Object.freeze({viewBox:[0,0,240,64],path:{x0:12,y0:60,cx:120,cy:-4,x1:228,y1:60},width:210,headX:.34,headTop:0,gap:2,fontSize:22,fontWeight:"500",beats:4,keyframes:[{offset:0,opacity:0},{offset:.025,opacity:1},{offset:.052,opacity:1},{offset:.077,opacity:0},{offset:1,opacity:0}],durationMs:44e3,easing:"ease-in-out",delayMs:1200,staggerMs:3600}),yl=/* @__PURE__ */Object.freeze({height:212,grassHeight:64,petHeight:150,petBottom:16,petAspect:.731,grassSize:[1520,479],petSize:[307,420]});var xl=ml;function wl(e,t){let r=xl[e]?.[t];return typeof r=="number"?r:Number.NaN}var vl=wl;function kl(e,t){let r=xl[e]?.[t];return typeof r=="string"&&r.endsWith("%")?Number(r.slice(0,-1))/100:Number.NaN}var jl=/* @__PURE__ */Object.freeze({gap:vl(".efh","gap"),sheetPadTop:vl(".efh-sheet","paddingTop"),sheetPadX:vl(".efh-sheet","paddingLeft"),sheetPadBottom:vl(".efh-sheet","paddingBottom"),sheetRadius:vl(".efh-sheet","borderTopLeftRadius"),sheetGap:vl(".efh-sheet","marginTop"),cardPad:vl(".efh-card","paddingTop"),cardRadius:vl(".efh-card","borderRadius"),name:vl(".efh-name","fontSize"),cardTitle:vl(".efh-card__title","fontSize"),rowTitle:vl(".efh-mk__name","fontSize"),body:vl(".efh","fontSize"),small:vl(".efh-meta","fontSize"),mono:vl(".efh-label","fontSize"),tileNum:vl(".efh-tile__num","fontSize"),big:vl(".efh-wt b","fontSize"),button:vl(".efh-btn","minHeight"),rowButton:vl(".efh-btn--row","minHeight"),pill:vl(".efh-pill","minHeight"),plot:vl(".efh-wchart__plot","height"),rowRadius:vl(".efh-due li","borderRadius"),tileGap:vl(".efh-tiles","gap"),icon:vl(".efh-ico","width")});function Sl(e,t){return e.trim().toLowerCase()===t.trim().toLowerCase()}function Cl(e,t,r){let n=al(e,r);return(n!==null?ol(n,t):null)??t}var Rl=(e,t)=>parseColor(e)===parseColor(t);function Tl(e){if(e.brightness!=="light")return false;let t=e.color,r=Kr.color;return Rl(t.primary,r.primary)&&Rl(t.brandInk,r.brandInk)&&Rl(t.onPrimary,r.onPrimary)&&Rl(t.accent,r.accent)&&Rl(t.accentEdge,r.accentEdge)}function _l(e){let t=e.color,r=fl,n=hl(e),i=e.brightness==="dark",l=Tl(e),o=(i?Xr:Kr).color,a=!Rl(t.accent,o.accent),s=i?t.surface:r.efWhite,d=(e,t)=>Cl(e,s,i?.18:t),c=l?r.tintSage:d(n.primary,.105),u=l?r.topCard:a?n.accent:c;return{tintSage:c,chevron:l?r.icoSage:Cl(t.brandInk,s,.527),rowGround:l?r.bgMist:d(n.primary,.059),tintPartner:a?d(n.accent,.14):r.embCyan1,topFill:u,plainEdge:l?r.plainEdge:al(t.brandInk,.2)??t.structureEdge,topKicker:gl(u,[a?n.onAccent:i?n.ink3:r.topKicker,r.topInk]),topInk:gl(u,[a?n.onAccent:i?n.ink:r.topInk,r.topInk])}}function recordsSheetLook(e){let t=e.color,r=fl,n=hl(e),i=_l(e),l=Tl(e)?r.go:Sl(t.accent,t.primary)?t.onPrimary:t.accent;return e.brightness==="dark"?/* @__PURE__ */Object.freeze({dark:true,paper:n.paper,ground:t.background,card:n.card,text:n.ink,muted:n.ink3,line:t.structureEdge,ink:t.brandInk,fill:n.primary,onFill:n.onPrimary,accentOnFill:l,accent:n.accent,go:t.success,goTint:t.badgeBgPositive,alert:n.riskInk,alertDeep:n.riskInk,alertTint:t.badgeBgCritical,watch:t.badgeBgCaution,wind:r.efSkyBlue,tintBlue:t.surfaceSubtle,tintYellow:t.surfaceSubtle,barTrack:t.structureEdge,...i}):/* @__PURE__ */Object.freeze({dark:false,paper:n.paper,ground:r.efWhite,card:r.efWhite,text:r.efBlack,muted:r.muted,line:r.line,ink:t.brandInk,fill:n.primary,onFill:n.onPrimary,accentOnFill:l,accent:n.accent,go:r.go,goTint:r.tintGo,alert:r.alert,alertDeep:r.alertDeep,alertTint:r.tintRed,watch:r.watch,wind:r.efSkyBlue,tintBlue:r.tintBlue,tintYellow:r.tintYellow,barTrack:r.barTrack,...i})}function zl(e){return Tl(e)}function Il(e){let t=(e.brightness==="dark"?Xr:Kr).color;return!Rl(e.color.accent,t.accent)}function Dl(e){if(e===void 0)return null;let t=e.split(",")[0]?.trim().replace(/^["']|["']$/g,"").trim()??"";return t.length>0?t:null}function Hl(e,t,r){let n=Dl(r?.font),i=Dl(r?.mono),l=t==="everfur"||t==="raph";if(!l&&n===null&&i===null)return e;let o=e.type,a={...o.families,...n!==null?{regular:n,medium:n,bold:n}:{},...i!==null?{mono:i,monoMedium:i,monoBold:i}:{}},s={...o.namedFaces,...n!==null?{regular:false,medium:false,bold:false}:{},...i!==null?{mono:false,monoMedium:false,monoBold:false}:{}};return{...e,...l?{brightness:"light",highContrast:false,color:Kr.color}:{},type:{...o,families:a,namedFaces:s,family:a.regular,mono:a.mono}}}var Vl=e.createContext("sheet"),Pl=Vl.Provider;function Ll(){return e.useContext(Vl)}function Ol(e,t={}){return{padding:e.cardPad,gap:12,...t,...e.card}}function El(e,t){let r={...e};for(let n of Object.keys(t)){let i=t[n];i!==void 0&&(r[n]={...e[n],...i})}return r}var Al=/* @__PURE__ */new WeakMap;function $l(e){let t=Al.get(e);if(t!==void 0)return t;let r=recordsSheetLook(e),n=ln(e.slots),i=face(e,"bold"),l={...i,fontSize:16,lineHeight:20},o=/* @__PURE__ */Object.freeze({look:r,ground:r.ground,card:{backgroundColor:r.card,borderRadius:e.radius.lg,borderWidth:r.dark?1:0,borderColor:r.line,shadowColor:"#000000",shadowOpacity:r.dark?0:.09,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:r.dark?0:1,...rn(n,1)},cardPad:jl.cardPad,cardTitle:{...i,fontSize:jl.cardTitle,lineHeight:Math.round(jl.cardTitle*1.25*100)/100,letterSpacing:-.36,color:r.ink,...nn(n)},body:{...face(e,"regular"),fontSize:15,lineHeight:21,color:r.ink,...nn(n)},title:{...face(e,"medium"),fontSize:jl.name,lineHeight:Math.round(jl.name*1.2*100)/100,letterSpacing:-.33,color:r.ink},button:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,minHeight:jl.button,paddingHorizontal:20,borderRadius:999},buttonInk:{backgroundColor:r.fill,borderWidth:0,...rn(e.slots.primaryButton)},buttonInkLabel:{...l,color:r.onFill,...nn(e.slots.primaryButton)},buttonOutline:{backgroundColor:"transparent",borderWidth:1.5,borderColor:r.ink},buttonOutlineLabel:{...l,color:r.ink},askPill:{backgroundColor:fl.embYellow,borderWidth:0,paddingLeft:wl(".ask-pill","paddingLeft"),paddingRight:wl(".ask-pill","paddingRight")},askPillLabel:{...i,fontSize:wl(".ask-pill","fontSize"),lineHeight:wl(".ask-pill","fontSize")*1.2,color:fl.topInk}});return Al.set(e,o),o}var Bl=/* @__PURE__ */Object.freeze({pressScale:.97,pressMs:160,riseWebPx:16,riseNativePx:14,fadeMs:320,moveMs:480,staggerMs:55,maxSteps:8});var Fl=e=>e.replace(/\s+/gu," ").trim().replace(/\.$/u,"").toLowerCase(),Ml=Fl(mn);function ql(e){let t=Fl(e);return t.length===0||t===Ml}function Nl(e){let t=(e.brightness==="dark"?Xr:Kr).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))}}var Wl=4.5;function Ul(e){if(!Nl(e).success)return null;let t=[e.color.surface];return dl(e.color.success,t,tl(t),Wl)}var Gl=52,Kl="rgba(0,0,0,0.4)";function Yl(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>Jl(t,r),[t,r])}function Xl(){let e=useEverfurTheme();return Ll()==="sheet"?$l(e):null}function DisclaimerBand({disclaimer:e,style:t}){let i=Yl();return ql(e)?null:/* @__PURE__ */n.jsxs(r.View,{style:[i.band,t],accessible:true,accessibilityRole:"text",accessibilityLabel:xn.important(e),testID:"records-disclaimer-band",children:[
90
90
  /* @__PURE__ */n.jsx(r.View,{style:i.infoGlyph,accessibilityElementsHidden:true,importantForAccessibility:"no",children:/* @__PURE__ */n.jsx(Text,{style:i.infoGlyphText,children:"i"})}),
91
91
  /* @__PURE__ */n.jsx(Text,{style:i.bandText,children:e})]})}function Pill({label:e,onPress:t,kind:i="primary",disabled:l=false,busy:o=false,accessibilityLabel:a,accessibilityHint:s,testID:d,style:c}){let u=Yl(),h=useEverfurTheme(),p=h.motion.reducedMotion,g=i==="primary"?u.pillPrimary:i==="outline"?u.pillOutline:i==="danger"?u.pillDanger:i==="ask"?u.pillAsk:u.pillLink,f=i==="primary"?u.pillPrimaryLabel:i==="danger"?u.pillDangerLabel:i==="ask"?u.pillAskLabel:i==="link"?u.pillLinkLabel:u.pillOutlineLabel;/* @__PURE__ */
92
92
  return n.jsxs(r.Pressable,{onPress:t,disabled:l||o,accessibilityRole:"button",accessibilityLabel:a??e,accessibilityHint:s,accessibilityState:{disabled:l||o,busy:o},style:({pressed:e})=>[u.pill,g,l?u.pillDisabled:null,e&&!p?u.pressed:null,c],testID:d,children:[o?/* @__PURE__ */n.jsx(r.ActivityIndicator,{size:"small",color:i==="primary"?h.color.onPrimary:h.color.brandInk}):null,
@@ -101,7 +101,7 @@ return n.jsxs(r.View,{style:{minHeight:wl(".ph-head","height"),paddingHorizontal
101
101
  /* @__PURE__ */n.jsx(r.View,{style:a.right,children:i??/* @__PURE__ */n.jsx(r.View,{style:a.back})})]}),u=d===null?c:/* @__PURE__ */n.jsxs(r.View,{style:a.bar,children:[
102
102
  /* @__PURE__ */n.jsx(BrandLogo,{logoUrl:d,name:s.meta.displayName,barStyle:a.logoBar,logoStyle:a.logo,testID:l?`${l}-logo`:void 0}),c]});/* @__PURE__ */
103
103
  return n.jsxs(n.Fragment,{children:[u,
104
- /* @__PURE__ */n.jsx(SandboxNote,{})]})}function SandboxNote(){let e=$i(),t=Yl(),i=oo();return e?/* @__PURE__ */n.jsx(r.View,{style:[t.band,i.sandboxNote],accessible:true,accessibilityRole:"text",testID:"records-sandbox-note",children:/* @__PURE__ */n.jsx(Text,{style:t.bandText,children:Ei.note})}):null}function ListGlyph2(){let e=oo();/* @__PURE__ */
104
+ /* @__PURE__ */n.jsx(SandboxNote,{})]})}function SandboxNote(){let e=$i(),t=Yl(),i=oo();return e?/* @__PURE__ */n.jsx(r.View,{style:[t.band,i.sandboxNote],accessible:true,accessibilityRole:"text",testID:"records-sandbox-note",children:/* @__PURE__ */n.jsx(Text,{style:t.bandText,children:Oi.note})}):null}function ListGlyph2(){let e=oo();/* @__PURE__ */
105
105
  return n.jsxs(r.View,{style:e.listGlyph,accessibilityElementsHidden:true,importantForAccessibility:"no",children:[
106
106
  /* @__PURE__ */n.jsx(r.View,{style:e.listBar}),
107
107
  /* @__PURE__ */n.jsx(r.View,{style:e.listBar}),
@@ -118,7 +118,7 @@ return n.jsxs(r.View,{style:e.downloadGlyph,accessibilityElementsHidden:true,imp
118
118
  /* @__PURE__ */n.jsx(r.View,{style:e.downloadHead}),
119
119
  /* @__PURE__ */n.jsx(r.View,{style:e.downloadTray})]})}function oo(){let t=useEverfurTheme();return e.useMemo(()=>ao(t),[t])}function ao(e){let{color:t,space:n,type:i}=e,l=e.slots.header,o=l?.textColor??t.brandInk,a={flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:n.lg,paddingTop:n.xs,paddingBottom:n.md,gap:n.sm},s=n.xxl+n.md,d=n.md,c=n.xs/2,u=n.lg+n.xs+n.xs/2;return r.StyleSheet.create({row:{...a,...rn(l)},rowUnderLogo:a,bar:{...rn(l)},logoBar:{alignItems:"center",paddingTop:n.sm,paddingHorizontal:n.lg},logo:{height:to,width:ro},back:{width:s,height:s,alignItems:"center",justifyContent:"center"},chevron:{width:d,height:d,borderLeftWidth:c,borderBottomWidth:c,borderColor:o,transform:[{rotate:"45deg"}],marginLeft:n.xs},title:{flex:1,...headingFace(e,"bold"),fontSize:i.size.heading,lineHeight:Math.round(i.size.heading*i.lineHeight.tight)+1,color:o},spacer:{flex:1},sandboxNote:{marginHorizontal:n.lg,marginBottom:n.md},documentTitle:{flex:1,textAlign:"center",...headingFace(e,"bold"),fontSize:i.size.subtitle,lineHeight:Math.round(i.size.subtitle*i.lineHeight.snug),color:t.text.primary,...nn(l)},right:{flexDirection:"row",alignItems:"center",gap:n.sm+n.xs/2},listGlyph:{width:u,height:u,justifyContent:"space-evenly"},listBar:{height:c,borderRadius:c,backgroundColor:o},shareGlyph:{width:u-n.xs,height:u-n.xs},shareDot:{position:"absolute",width:n.xs+n.xs/2,height:n.xs+n.xs/2,borderRadius:n.xs,borderWidth:c,borderColor:o},shareDotTop:{right:0,top:0},shareDotLeft:{left:0,top:n.xs+n.xs/2},shareDotBottom:{right:0,bottom:0},shareStroke:{position:"absolute",left:n.xs,top:n.sm,width:n.sm+n.xs/2,height:c,backgroundColor:o},shareStrokeUp:{transform:[{rotate:"-30deg"}]},shareStrokeDown:{transform:[{rotate:"30deg"}]},sendGlyph:{width:u-n.xs,height:u-n.xs},downloadGlyph:{width:u-n.xs,height:u-n.xs,alignItems:"center"},downloadStem:{width:c,height:n.sm+n.xs/2,backgroundColor:o},downloadHead:{width:n.sm,height:n.sm,borderRightWidth:c,borderBottomWidth:c,borderColor:o,transform:[{rotate:"45deg"}],marginTop:-n.sm},downloadTray:{position:"absolute",bottom:0,left:0,right:0,height:n.xs+n.xs/2,borderLeftWidth:c,borderRightWidth:c,borderBottomWidth:c,borderColor:o}})}var so=120,co=44;function RecordsGateOffState({reason:e,onExit:t,exitLabel:i,style:l}){let{color:o,space:a,radius:s,type:d}=useEverfurTheme();/* @__PURE__ */
120
120
  return n.jsxs(r.View,{testID:"records-gate-off",style:[{minHeight:so,justifyContent:"center",gap:a.md,padding:a.lg,borderRadius:s.md,borderWidth:1,borderColor:o.brandBorder,backgroundColor:o.surfaceCream},l],children:[e.length>0?/* @__PURE__ */n.jsx(Text,{style:{fontSize:d.size.bodyTight,color:o.text.muted},children:e}):null,
121
- /* @__PURE__ */n.jsx(r.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:i,testID:"records-gate-off-exit",style:{minHeight:co,alignSelf:"flex-start",justifyContent:"center",paddingHorizontal:a.lg,borderRadius:s.pill,borderWidth:1.5,borderColor:o.brandInk},children:/* @__PURE__ */n.jsx(Text,{style:{fontSize:d.size.body,color:o.brandInk},children:i})})]})}function uo(e,t){return e===void 0?{}:{renderDisabled:r=>/* @__PURE__ */n.jsx(RecordsGateOffState,{reason:r.disabled?.reason??"",onExit:e,exitLabel:t})}}function ho(e,t){return e===null?"":t?`${e} ${t}`:e}function po(e){if(e===null||e.length===0)return"";let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(t!==null){let e=t[1]??"",r=t[2]??"",n=t[3]??"";return`${Number(r)}/${Number(n)}/${e.slice(2)}`}let r=Date.parse(e);if(Number.isNaN(r))return e;let n=new Date(r);return`${n.getUTCMonth()+1}/${n.getUTCDate()}/${String(n.getUTCFullYear()).slice(2)}`}var go=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function fo(e){if(!e)return"-";let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(t!==null)return mo(Number(t[1]),Number(t[2])-1,Number(t[3]));let r=Date.parse(e);if(Number.isNaN(r))return"-";let n=new Date(r);return mo(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate())}function mo(e,t,r){let n=go[t];return n===void 0?"-":`${n} ${r}, ${e}`}function bo(e){let t=e?/^([\d-]{10}T[\d:]+)(\.\d+)?(.*)$/.exec(e):null,r=t?Date.parse(`${t[1]}${(t[2]??"").slice(0,4)}${t[3]||"Z"}`):Number.NaN;if(Number.isNaN(r))return fo(e);let n=new Date(r);return mo(n.getFullYear(),n.getMonth(),n.getDate())}function yo(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let t=fo(e),r=Number(e.slice(8,10));return t==="-"||r<1||r>31?e:t}function xo(e){let t=e=>{let t=e.receivedAt===null?Number.NaN:Date.parse(e.receivedAt);return Number.isNaN(t)?Number.NEGATIVE_INFINITY:t};return Object.values(e).map((e,r)=>({doc:e,index:r,ms:t(e)})).sort((e,t)=>t.ms===e.ms?e.index-t.index:t.ms>e.ms?1:-1).map(e=>e.doc)}var wo=/* @__PURE__ */Object.freeze({timeline:"Timeline",loadingTimeline:"Loading timeline",labResults:"Blood & lab work",visits:"Visits",physicalExams:"Physical exams",visitNotes:"Visit notes",visit:"Visit",exam:"Exam",visitNote:"Visit note",notRecorded:"Not recorded",abnormal:"Abnormal",notExamined:"Not examined",normal:"Normal",measured:e=>`Measured ${e}`,uploadedDocument:"Uploaded document",kind:/* @__PURE__ */Object.freeze({visit:"Visit",vaccine:"Vaccine",weight:"Weight",medication:"Medication"}),clinicVisit:"Clinic visit",doctor:e=>`Dr. ${e}`,lot:e=>`Lot ${e}`,expires:e=>`Expires ${e}`});function vo(e){switch(e){case"above":return{label:"Above range",outOfRange:true};case"below":return{label:"Below range",outOfRange:true};case"in_range":return{label:"In range",outOfRange:false};default:return{label:"No range on file",outOfRange:false}}}function ko(e,t){return t<2?null:`${e==="flat"?"Holding steady":`Trending ${e==="down"?"down":e==="up"?"up":"steady"}`} over ${t} visits`}function jo(e){let t=e.replace(/_/g," ").trim();return t.length===0?e:t.charAt(0).toUpperCase()+t.slice(1)}var So=/* @__PURE__ */Object.freeze({general:"General / attitude",eent:"Eyes, ears, nose & throat",oral_dental:"Oral & dental",cardiovascular:"Cardiovascular",respiratory:"Respiratory",gastrointestinal:"GI / abdomen",urogenital:"Urogenital",musculoskeletal:"Musculoskeletal",neurologic:"Neurologic",integument:"Skin & coat",lymphatic:"Lymph nodes"});function Co(e){return Object.prototype.hasOwnProperty.call(So,e)?So[e]:jo(e)}var Ro=/* @__PURE__ */Object.freeze({reason_for_visit:"Reason for visit",subjective:"Subjective",objective:"Objective",assessment:"Assessment",plan:"Plan",discharge_instructions:"Discharge instructions",follow_up:"Follow-up",remarks:"Notes"});function To(e){return Object.prototype.hasOwnProperty.call(Ro,e)?Ro[e]:jo(e)}function _o(e){return e===null||!Number.isFinite(e)?"-":`${e.toFixed(3).replace(/\.?0+$/,"")} kg`}function zo(e,t,r){if((e===null||!Number.isFinite(e))&&r)return r;if(e===null||!Number.isFinite(e))return"-";let n=e.toFixed(3).replace(/\.?0+$/,"");return t?`${n} ${t}`:n}function Io(e,t,r){let n=ko(t,r);return e?`${wo.measured(fo(e))}${n?` · ${n}`:""}`:n}var Do=/* @__PURE__ */Object.freeze({lab_report:"Lab report",pims_export:"Practice export",vaccination_certificate:"Vaccination certificate",imaging_report:"Imaging report",discharge_summary:"Discharge summary",referral_letter:"Referral letter",clinician_note:"Clinician note",consent_form:"Consent form",invoice_estimate:"Invoice",prescription:"Prescription",genetic_report:"Genetic report"});function Ho(e){let t=e.title?.trim()??"";if(t.length>0)return t;let r=e.documentClass;return(r&&Object.prototype.hasOwnProperty.call(Do,r)?Do[r]:void 0)??wo.uploadedDocument}var Vo=/* @__PURE__ */Object.freeze({title:"Visits & records",shareA11y:"Share medical record",requestClinicsA11y:"Request records from clinics",inReview:e=>`${e} ${e===1?"document":"documents"} from your vet ${e===1?"is":"are"} being reviewed. Your full record will appear here once review is complete.`,needsAttention:"Needs attention",conflictSub:"Two documents list different values. Your vet can confirm which is correct.",askConflict:"Ask Everfur about this",whatsOnFile:"What's on file",coverage:/* @__PURE__ */Object.freeze({labs:"Labs",vaccines:"Vaccines",weight:"Weight",vitals:"Vitals",exams:"Exams",procedures:"Procedures",genetics:"Genetics",parasite:"Parasite prevention",reproductive:"Reproductive"}),onFile:"on file",noneOnFile:"none on file",documentsOnFile:e=>`${e} ${e===1?"document":"documents"} on file`,inReviewChip:e=>`${e} in review`,beingVerified:e=>`${e} being verified`,beingVerifiedA11y:e=>`${e} ${e===1?"fact is":"facts are"} being verified`,pendingReview:"Pending review: ",dateRange:(e,t)=>`${fo(e)} to ${fo(t)}`,documents:"Sources on file",uploadedDocument:wo.uploadedDocument,documentRowA11y:e=>`View what ${e} contributed to this record`,documentMeta:(e,t)=>{let r=t?fo(t):null,n=[e!==null&&Number.isInteger(e)&&e>0?`${e} ${e===1?"page":"pages"}`:null,r].filter(e=>e!==null);return n.length>0?n.join(" · "):null},identity:"Identity",needsReview:"Needs review",upcomingCare:"Upcoming care",careTimeline:"Care timeline",careTimelineSub:"Related records grouped over time, newest first.",lastDone:e=>`Last done ${e}`,overdue:"Overdue",due:e=>`Due ${e}`,askUpcomingCare:"Ask Everfur about upcoming care",askEverfur:"Ask Everfur",askExam:"Ask Everfur about this exam",askVisit:"Ask Everfur about this visit",labResults:wo.labResults,visits:wo.visits,physicalExams:wo.physicalExams,visitNotes:wo.visitNotes,document:/* @__PURE__ */Object.freeze({title:"Health Record",titleFor:e=>{let t=e?.trim()??"";return t.length>0?`${t}’s health record`:"Health Record"},download:"Download PDF",empty:"This record is empty for now.",docTitle:"Medical Record",namelessPet:"Your pet",generated:e=>`Generated ${fo(e)}`,identity:"Identity",labs:"Blood & Lab Work",ref:e=>`Ref ${e}`,noRange:"No reference range",upcomingCare:"Upcoming Care",physicalExams:"Physical Exams",clinicianNotes:"Clinician Notes"})}),Po=/* @__PURE__ */Object.freeze({vaccination:"Vaccinations",medication:"Medications",problem:"Problems & diagnoses",procedure:"Procedures & surgery",allergy:"Allergies",parasite_prevention:"Parasite prevention",reproductive:"Reproductive history",vital:"Vitals",body_weight:"Weight",lab_result:"Lab results",imaging:"Imaging & radiology",genetic_result:"Genetic testing",document_note:"Other notes"});function Lo(e){return Object.prototype.hasOwnProperty.call(Po,e)?Po[e]:jo(e)}var Eo=/* @__PURE__ */Object.freeze(["vaccination","medication","problem","procedure","allergy","parasite_prevention","reproductive","vital","body_weight"]);function Oo(e){let t=Eo.filter(t=>e.includes(t)),r=e.filter(e=>!Eo.includes(e));return[...t,...r]}function Ao(e){switch(e){case"identity_risk":return{label:"Identity mismatch",rank:0,tone:"critical"};case"benign":return{label:"Minor difference",rank:2,tone:"neutral"};default:return{label:"Needs review",rank:1,tone:"warning"}}}function $o(e,t){if(!e)return null;let r=Date.parse(e);if(Number.isNaN(r))return null;let n=r<t-1440*60*1e3;return{label:n?Vo.overdue:Vo.due(fo(e)),overdue:n}}function Bo(e){return e===null?null:e.refLow!==null&&e.refHigh!==null?`${e.refLow}-${e.refHigh}`:e.refLow!==null?`≥ ${e.refLow}`:e.refHigh!==null?`≤ ${e.refHigh}`:null}var Fo=/* @__PURE__ */Object.freeze({openA11y:"Share medical record",openA11yFor:e=>{let t=e?.trim()??"";return t.length>0?`Share ${t}’s record`:"Share medical record"},title:"Share medical record",titleFor:e=>{let t=e?.trim()??"";return t.length>0?`Send ${t}’s record`:"Share medical record"},helper:"Anyone with an active link can view this record until it expires. You can turn a link off anytime.",leadNative:"Pick who it’s for; we include the right pages.",leadWebFor:e=>{let t=e?.trim()??"";return t.length>0?`Share a snapshot of what ${t}’s vets recorded. Pick who it’s for and we include the right pages.`:"Pick who it’s for; we include the right pages."},audienceLabel:"Who it’s for",audiences:/* @__PURE__ */Object.freeze({vet:"Vet",groomer:"Groomer",boarding:"Boarding"}),included:"What’s included",sendTo:"Send to",sendToPlaceholder:"vet@example.com…",send:"Send",sending:"Sending…",addEmailFor:e=>{let t=e?.trim()??"";return t.length>0?`Add an email to send ${t}’s record.`:"Add an email to send the record."},emailInvalid:"That email doesn’t look right. Check it and try again.",emailFailed:"Could not send the email. Please try again.",close:"Close",closeSheetA11y:"Close share sheet",viewDocument:"View document",previewNative:"Preview what they get",createLink:"Create link and share",shareLinkNative:"Share link",linkTerms:"Sent as a secure link that works for 7 days. You can stop sharing it any time.",creatingLink:"Creating link...",downloadPdf:"Download PDF",preparingPdf:"Preparing PDF...",activeLinks:"Active links",loadingLinks:"Loading your share links",errorTitle:"Couldn’t load your links",errorBody:"Check your connection and try again. You can still create a new link above.",retry:"Try again",retrying:"Retrying...",emptyTitle:"No active links yet",emptyBody:"Create a link above to let your vet or a sitter view this record. It expires on its own, and you can turn it off anytime.",copyLink:"Copy link",turnOff:"Turn off",turnOffA11y:e=>`Turn off share link, ${e}`,turningOff:"Turning off...",keep:"Keep",confirmTurnOff:"Turn off this link? Anyone who has it will lose access.",shareMessage:e=>`View this medical record: ${e}`,consentOffTitle:"Records access is off",consentOffBody:"Allow records for this pet again to create a link or download the PDF. Any links that were live have been turned off. You can still turn off a link from this list.",toasts:/* @__PURE__ */Object.freeze({noAddress:"Link created, but no address came back. It is listed under Active links.",shareSheet:"Could not open the share sheet. The link is saved below.",pdfShareSheet:"Could not open the share sheet for this PDF.",copied:"Link copied.",copyFailed:"Could not copy the link.",copiedNative:"Link copied. It works for 7 days.",copyFailedNative:e=>`Couldn’t copy. The link is ${e}`,turnedOff:"Link turned off.",sentTo:e=>`Sent to ${e}. The link works for 7 days.`})}),Mo=/* @__PURE__ */Object.freeze(["Vaccines, medications and allergies","Conditions and procedures, with dates"]),qo=/* @__PURE__ */Object.freeze([["encounters","encounters",wo.visits],["lab_results","markers",wo.labResults],["physical_exams","physical_exams",wo.physicalExams]]);function No(e,t){let r=[];e.sections.includes("entities")&&(e.entityTypes===null?r.push(...Mo):r.push(...Oo(e.entityTypes).map(Lo)));for(let[n,i,l]of qo)e.sections.includes(n)&&t[i]===true&&r.push(l);return e.sections.includes("forward_looking")&&r.push(Vo.upcomingCare),/* @__PURE__ */Object.freeze(r)}function Wo(e,t){if(!e)return false;let r=Date.parse(e);return Number.isNaN(r)?false:r<=t}function Uo(e,t){let r=fo(e);return r==="-"?t?"Expired":"No expiry date":t?`Expired ${r}`:`Expires ${r}`}function Go(e,t,r){let n=e.map(e=>{let n=Wo(e.expiresAt,r),i=Uo(e.expiresAt,n),l=fo(e.createdAt),o=n?"Expired":"Active",a=i.replace(/^Expires /,"expiring ").replace(/^Expired /,"expired ").replace(/^Expired$/,"expired").replace(/^No expiry date$/,"with no expiry date");return{shareId:e.shareId,shareUrl:t[e.shareId]??null,active:!n,statusLabel:o,expiryLabel:i,createdLabel:l==="-"?null:`Created ${l}`,a11yLabel:`Share link. ${o}. ${i}.`,actionContext:a}});/* @__PURE__ */
121
+ /* @__PURE__ */n.jsx(r.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:i,testID:"records-gate-off-exit",style:{minHeight:co,alignSelf:"flex-start",justifyContent:"center",paddingHorizontal:a.lg,borderRadius:s.pill,borderWidth:1.5,borderColor:o.brandInk},children:/* @__PURE__ */n.jsx(Text,{style:{fontSize:d.size.body,color:o.brandInk},children:i})})]})}function uo(e,t){return e===void 0?{}:{renderDisabled:r=>/* @__PURE__ */n.jsx(RecordsGateOffState,{reason:r.disabled?.reason??"",onExit:e,exitLabel:t})}}function ho(e,t){return e===null?"":t?`${e} ${t}`:e}function po(e){if(e===null||e.length===0)return"";let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(t!==null){let e=t[1]??"",r=t[2]??"",n=t[3]??"";return`${Number(r)}/${Number(n)}/${e.slice(2)}`}let r=Date.parse(e);if(Number.isNaN(r))return e;let n=new Date(r);return`${n.getUTCMonth()+1}/${n.getUTCDate()}/${String(n.getUTCFullYear()).slice(2)}`}var go=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function fo(e){if(!e)return"-";let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(t!==null)return mo(Number(t[1]),Number(t[2])-1,Number(t[3]));let r=Date.parse(e);if(Number.isNaN(r))return"-";let n=new Date(r);return mo(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate())}function mo(e,t,r){let n=go[t];return n===void 0?"-":`${n} ${r}, ${e}`}function bo(e){let t=e?/^([\d-]{10}T[\d:]+)(\.\d+)?(.*)$/.exec(e):null,r=t?Date.parse(`${t[1]}${(t[2]??"").slice(0,4)}${t[3]||"Z"}`):Number.NaN;if(Number.isNaN(r))return fo(e);let n=new Date(r);return mo(n.getFullYear(),n.getMonth(),n.getDate())}function yo(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let t=fo(e),r=Number(e.slice(8,10));return t==="-"||r<1||r>31?e:t}function xo(e){let t=e=>{let t=e.receivedAt===null?Number.NaN:Date.parse(e.receivedAt);return Number.isNaN(t)?Number.NEGATIVE_INFINITY:t};return Object.values(e).map((e,r)=>({doc:e,index:r,ms:t(e)})).sort((e,t)=>t.ms===e.ms?e.index-t.index:t.ms>e.ms?1:-1).map(e=>e.doc)}var wo=/* @__PURE__ */Object.freeze({timeline:"Timeline",loadingTimeline:"Loading timeline",labResults:"Blood & lab work",visits:"Visits",physicalExams:"Physical exams",visitNotes:"Visit notes",visit:"Visit",exam:"Exam",visitNote:"Visit note",notRecorded:"Not recorded",abnormal:"Abnormal",notExamined:"Not examined",normal:"Normal",measured:e=>`Measured ${e}`,uploadedDocument:"Uploaded document",kind:/* @__PURE__ */Object.freeze({visit:"Visit",vaccine:"Vaccine",weight:"Weight",medication:"Medication"}),clinicVisit:"Clinic visit",doctor:e=>`Dr. ${e}`,lot:e=>`Lot ${e}`,expires:e=>`Expires ${e}`});function vo(e){switch(e){case"above":return{label:"Above range",outOfRange:true};case"below":return{label:"Below range",outOfRange:true};case"in_range":return{label:"In range",outOfRange:false};default:return{label:"No range on file",outOfRange:false}}}function ko(e,t){return t<2?null:`${e==="flat"?"Holding steady":`Trending ${e==="down"?"down":e==="up"?"up":"steady"}`} over ${t} visits`}function jo(e){let t=e.replace(/_/g," ").trim();return t.length===0?e:t.charAt(0).toUpperCase()+t.slice(1)}var So=/* @__PURE__ */Object.freeze({general:"General / attitude",eent:"Eyes, ears, nose & throat",oral_dental:"Oral & dental",cardiovascular:"Cardiovascular",respiratory:"Respiratory",gastrointestinal:"GI / abdomen",urogenital:"Urogenital",musculoskeletal:"Musculoskeletal",neurologic:"Neurologic",integument:"Skin & coat",lymphatic:"Lymph nodes"});function Co(e){return Object.prototype.hasOwnProperty.call(So,e)?So[e]:jo(e)}var Ro=/* @__PURE__ */Object.freeze({reason_for_visit:"Reason for visit",subjective:"Subjective",objective:"Objective",assessment:"Assessment",plan:"Plan",discharge_instructions:"Discharge instructions",follow_up:"Follow-up",remarks:"Notes"});function To(e){return Object.prototype.hasOwnProperty.call(Ro,e)?Ro[e]:jo(e)}function _o(e){return e===null||!Number.isFinite(e)?"-":`${e.toFixed(3).replace(/\.?0+$/,"")} kg`}function zo(e,t,r){if((e===null||!Number.isFinite(e))&&r)return r;if(e===null||!Number.isFinite(e))return"-";let n=e.toFixed(3).replace(/\.?0+$/,"");return t?`${n} ${t}`:n}function Io(e,t,r){let n=ko(t,r);return e?`${wo.measured(fo(e))}${n?` · ${n}`:""}`:n}var Do=/* @__PURE__ */Object.freeze({lab_report:"Lab report",pims_export:"Practice export",vaccination_certificate:"Vaccination certificate",imaging_report:"Imaging report",discharge_summary:"Discharge summary",referral_letter:"Referral letter",clinician_note:"Clinician note",consent_form:"Consent form",invoice_estimate:"Invoice",prescription:"Prescription",genetic_report:"Genetic report"});function Ho(e){let t=e.title?.trim()??"";if(t.length>0)return t;let r=e.documentClass;return(r&&Object.prototype.hasOwnProperty.call(Do,r)?Do[r]:void 0)??wo.uploadedDocument}var Vo=/* @__PURE__ */Object.freeze({title:"Visits & records",shareA11y:"Share medical record",requestClinicsA11y:"Request records from clinics",inReview:e=>`${e} ${e===1?"document":"documents"} from your vet ${e===1?"is":"are"} being reviewed. Your full record will appear here once review is complete.`,needsAttention:"Needs attention",conflictSub:"Two documents list different values. Your vet can confirm which is correct.",askConflict:"Ask Everfur about this",whatsOnFile:"What's on file",coverage:/* @__PURE__ */Object.freeze({labs:"Labs",vaccines:"Vaccines",weight:"Weight",vitals:"Vitals",exams:"Exams",procedures:"Procedures",genetics:"Genetics",parasite:"Parasite prevention",reproductive:"Reproductive"}),onFile:"on file",noneOnFile:"none on file",documentsOnFile:e=>`${e} ${e===1?"document":"documents"} on file`,inReviewChip:e=>`${e} in review`,beingVerified:e=>`${e} being verified`,beingVerifiedA11y:e=>`${e} ${e===1?"fact is":"facts are"} being verified`,pendingReview:"Pending review: ",dateRange:(e,t)=>`${fo(e)} to ${fo(t)}`,documents:"Sources on file",uploadedDocument:wo.uploadedDocument,documentRowA11y:e=>`View what ${e} contributed to this record`,documentMeta:(e,t)=>{let r=t?fo(t):null,n=[e!==null&&Number.isInteger(e)&&e>0?`${e} ${e===1?"page":"pages"}`:null,r].filter(e=>e!==null);return n.length>0?n.join(" · "):null},identity:"Identity",needsReview:"Needs review",upcomingCare:"Upcoming care",careTimeline:"Care timeline",careTimelineSub:"Related records grouped over time, newest first.",lastDone:e=>`Last done ${e}`,overdue:"Overdue",due:e=>`Due ${e}`,askUpcomingCare:"Ask Everfur about upcoming care",askEverfur:"Ask Everfur",askExam:"Ask Everfur about this exam",askVisit:"Ask Everfur about this visit",labResults:wo.labResults,visits:wo.visits,physicalExams:wo.physicalExams,visitNotes:wo.visitNotes,document:/* @__PURE__ */Object.freeze({title:"Health Record",titleFor:e=>{let t=e?.trim()??"";return t.length>0?`${t}’s health record`:"Health Record"},download:"Download PDF",empty:"This record is empty for now.",docTitle:"Medical Record",namelessPet:"Your pet",generated:e=>`Generated ${fo(e)}`,identity:"Identity",labs:"Blood & Lab Work",ref:e=>`Ref ${e}`,noRange:"No reference range",upcomingCare:"Upcoming Care",physicalExams:"Physical Exams",clinicianNotes:"Clinician Notes"})}),Po=/* @__PURE__ */Object.freeze({vaccination:"Vaccinations",medication:"Medications",problem:"Problems & diagnoses",procedure:"Procedures & surgery",allergy:"Allergies",parasite_prevention:"Parasite prevention",reproductive:"Reproductive history",vital:"Vitals",body_weight:"Weight",lab_result:"Lab results",imaging:"Imaging & radiology",genetic_result:"Genetic testing",document_note:"Other notes"});function Lo(e){return Object.prototype.hasOwnProperty.call(Po,e)?Po[e]:jo(e)}var Oo=/* @__PURE__ */Object.freeze(["vaccination","medication","problem","procedure","allergy","parasite_prevention","reproductive","vital","body_weight"]);function Eo(e){let t=Oo.filter(t=>e.includes(t)),r=e.filter(e=>!Oo.includes(e));return[...t,...r]}function Ao(e){switch(e){case"identity_risk":return{label:"Identity mismatch",rank:0,tone:"critical"};case"benign":return{label:"Minor difference",rank:2,tone:"neutral"};default:return{label:"Needs review",rank:1,tone:"warning"}}}function $o(e,t){if(!e)return null;let r=Date.parse(e);if(Number.isNaN(r))return null;let n=r<t-1440*60*1e3;return{label:n?Vo.overdue:Vo.due(fo(e)),overdue:n}}function Bo(e){return e===null?null:e.refLow!==null&&e.refHigh!==null?`${e.refLow}-${e.refHigh}`:e.refLow!==null?`≥ ${e.refLow}`:e.refHigh!==null?`≤ ${e.refHigh}`:null}var Fo=/* @__PURE__ */Object.freeze({openA11y:"Share medical record",openA11yFor:e=>{let t=e?.trim()??"";return t.length>0?`Share ${t}’s record`:"Share medical record"},title:"Share medical record",titleFor:e=>{let t=e?.trim()??"";return t.length>0?`Send ${t}’s record`:"Share medical record"},helper:"Anyone with an active link can view this record until it expires. You can turn a link off anytime.",leadNative:"Pick who it’s for; we include the right pages.",leadWebFor:e=>{let t=e?.trim()??"";return t.length>0?`Share a snapshot of what ${t}’s vets recorded. Pick who it’s for and we include the right pages.`:"Pick who it’s for; we include the right pages."},audienceLabel:"Who it’s for",audiences:/* @__PURE__ */Object.freeze({vet:"Vet",groomer:"Groomer",boarding:"Boarding"}),included:"What’s included",sendTo:"Send to",sendToPlaceholder:"vet@example.com…",send:"Send",sending:"Sending…",addEmailFor:e=>{let t=e?.trim()??"";return t.length>0?`Add an email to send ${t}’s record.`:"Add an email to send the record."},emailInvalid:"That email doesn’t look right. Check it and try again.",emailFailed:"Could not send the email. Please try again.",close:"Close",closeSheetA11y:"Close share sheet",viewDocument:"View document",previewNative:"Preview what they get",createLink:"Create link and share",shareLinkNative:"Share link",linkTerms:"Sent as a secure link that works for 7 days. You can stop sharing it any time.",creatingLink:"Creating link...",downloadPdf:"Download PDF",preparingPdf:"Preparing PDF...",activeLinks:"Active links",loadingLinks:"Loading your share links",errorTitle:"Couldn’t load your links",errorBody:"Check your connection and try again. You can still create a new link above.",retry:"Try again",retrying:"Retrying...",emptyTitle:"No active links yet",emptyBody:"Create a link above to let your vet or a sitter view this record. It expires on its own, and you can turn it off anytime.",copyLink:"Copy link",turnOff:"Turn off",turnOffA11y:e=>`Turn off share link, ${e}`,turningOff:"Turning off...",keep:"Keep",confirmTurnOff:"Turn off this link? Anyone who has it will lose access.",shareMessage:e=>`View this medical record: ${e}`,consentOffTitle:"Records access is off",consentOffBody:"Allow records for this pet again to create a link or download the PDF. Any links that were live have been turned off. You can still turn off a link from this list.",toasts:/* @__PURE__ */Object.freeze({noAddress:"Link created, but no address came back. It is listed under Active links.",shareSheet:"Could not open the share sheet. The link is saved below.",pdfShareSheet:"Could not open the share sheet for this PDF.",copied:"Link copied.",copyFailed:"Could not copy the link.",copiedNative:"Link copied. It works for 7 days.",copyFailedNative:e=>`Couldn’t copy. The link is ${e}`,turnedOff:"Link turned off.",sentTo:e=>`Sent to ${e}. The link works for 7 days.`})}),Mo=/* @__PURE__ */Object.freeze(["Vaccines, medications and allergies","Conditions and procedures, with dates"]),qo=/* @__PURE__ */Object.freeze([["encounters","encounters",wo.visits],["lab_results","markers",wo.labResults],["physical_exams","physical_exams",wo.physicalExams]]);function No(e,t){let r=[];e.sections.includes("entities")&&(e.entityTypes===null?r.push(...Mo):r.push(...Eo(e.entityTypes).map(Lo)));for(let[n,i,l]of qo)e.sections.includes(n)&&t[i]===true&&r.push(l);return e.sections.includes("forward_looking")&&r.push(Vo.upcomingCare),/* @__PURE__ */Object.freeze(r)}function Wo(e,t){if(!e)return false;let r=Date.parse(e);return Number.isNaN(r)?false:r<=t}function Uo(e,t){let r=fo(e);return r==="-"?t?"Expired":"No expiry date":t?`Expired ${r}`:`Expires ${r}`}function Go(e,t,r){let n=e.map(e=>{let n=Wo(e.expiresAt,r),i=Uo(e.expiresAt,n),l=fo(e.createdAt),o=n?"Expired":"Active",a=i.replace(/^Expires /,"expiring ").replace(/^Expired /,"expired ").replace(/^Expired$/,"expired").replace(/^No expiry date$/,"with no expiry date");return{shareId:e.shareId,shareUrl:t[e.shareId]??null,active:!n,statusLabel:o,expiryLabel:i,createdLabel:l==="-"?null:`Created ${l}`,a11yLabel:`Share link. ${o}. ${i}.`,actionContext:a}});/* @__PURE__ */
122
122
  return Object.freeze([...n.filter(e=>e.active),...n.filter(e=>!e.active)])}function Ko(e,t){let r=e?.httpStatus;if(Ve(e)){if(t==="create"||t==="email")return"Records access for this pet is off, so a new link cannot be created.";if(t==="download")return"Records access for this pet is off, so the PDF cannot be downloaded."}if(r===429)return"You are creating links a little too fast. Wait a moment, then try again.";if(t==="revoke"&&(r===404||r===409||r===410))return"That link was already turned off.";if(r===401||r===403)return"You need to be signed in as this pet's owner to do that.";if(t==="email"&&(r===400||r===422||e?.code==="validationFailed"))return Fo.emailInvalid;switch(t){case"create":return"Could not create a share link. Please try again.";case"revoke":return"Could not turn off that link. Please try again.";case"email":return Fo.emailFailed;default:return"Could not download the record PDF. Please try again."}}function SkeletonBlock({width:e,height:t,radius:i,style:l}){let{color:o,radius:a}=useEverfurTheme();/* @__PURE__ */
123
123
  return n.jsx(r.View,{style:[{width:e,height:t,borderRadius:i??a.xs,backgroundColor:o.skeleton},l],accessibilityElementsHidden:true,importantForAccessibility:"no"})}var Yo=180,Xo=70,Qo=22,Jo=300,Zo=44,ea=24,ta=34,ra=6,na=5;function DashboardSkeleton({testID:e}){let t=la(),i=e=>/* @__PURE__ */n.jsxs(r.View,{style:t.actionRow,children:[
124
124
  /* @__PURE__ */n.jsxs(r.View,{style:t.actionLeft,children:[
@@ -183,7 +183,7 @@ return n.jsxs(r.View,{style:t.document,accessible:true,accessibilityRole:"progre
183
183
  /* @__PURE__ */n.jsx(r.View,{style:t.documentRule})]}),Array.from({length:e},(e,i)=>/* @__PURE__ */n.jsxs(r.View,{style:[t.documentRow,i>0?t.recordDivider:null],children:[
184
184
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:i%2===0?"46%":"38%",height:14,radius:7}),
185
185
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:56,height:14,radius:7})]},i))]},i))]})}var ia=62;function la(){let t=useEverfurTheme();return e.useMemo(()=>oa(t),[t])}function oa(e){let{color:t,space:n,radius:i}=e,l=r.StyleSheet.hairlineWidth;return r.StyleSheet.create({dashboard:{flex:1,paddingHorizontal:n.sm,paddingTop:n.xs,gap:n.lg,backgroundColor:t.background},inset:{paddingHorizontal:n.sm},summaryCard:{alignItems:"center",borderRadius:i.lg-n.xs,borderWidth:l,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:n.lg,paddingVertical:n.lg+n.xs,gap:n.md+n.xs/2},badges:{flexDirection:"row",gap:n.md},carouselCard:{borderRadius:i.lg-n.xs,borderWidth:l,borderColor:t.brandBorder,backgroundColor:t.surface,padding:n.lg},dots:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:n.xs+n.xs/2},centered:{alignSelf:"center"},actions:{gap:n.sm+n.xs/2},actionRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderRadius:i.md,borderWidth:l,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:n.lg,paddingVertical:n.lg},actionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:n.md},request:{paddingHorizontal:n.lg,paddingTop:n.xs,gap:n.lg+n.xs/2,backgroundColor:t.background},railRow:{flexDirection:"row",alignItems:"flex-start",gap:n.md},railColumn:{alignItems:"center",width:ea},connector:{marginVertical:n.xs/2},railBody:{flex:1,paddingBottom:n.lg+n.xs/2,gap:n.xs+n.xs/2},statusCard:{borderRadius:i.md,backgroundColor:t.brandSoft,padding:n.md+n.xs/2,gap:n.sm},timeline:{flex:1,backgroundColor:t.background},timelineDisclaimer:{paddingHorizontal:n.lg,paddingTop:n.xs,paddingBottom:n.md},timelineRow:{flexDirection:"row",gap:n.md,paddingHorizontal:n.lg,paddingVertical:n.md+n.xs/2},timelineBody:{flex:1,gap:n.xs-1},timelineTop:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.sm},timelineSeparator:{height:l,backgroundColor:t.brandBorder,marginLeft:ia},clinics:{gap:n.md},clinicRow:{borderRadius:i.lg-n.xs/2,borderWidth:l,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md+n.xs/2,gap:n.sm},shares:{gap:n.md,padding:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:l,borderColor:t.brandBorder},shareRow:{gap:n.xs+n.xs/2},record:{flex:1,paddingHorizontal:n.lg,paddingTop:n.xs,gap:n.lg+n.xs,backgroundColor:t.background},recordSection:{gap:n.sm+n.xs/2},recordHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},recordCard:{borderRadius:i.lg,borderWidth:l,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:n.lg,paddingVertical:n.xs},recordRow:{gap:n.xs+n.xs/2,paddingVertical:n.md},recordDivider:{borderTopWidth:l,borderTopColor:t.borderHairlineGreen},document:{flex:1,paddingHorizontal:n.lg+n.xs,paddingTop:n.md,gap:n.lg},letterhead:{alignItems:"center",gap:n.sm,paddingBottom:n.lg,borderBottomWidth:2,borderBottomColor:t.skeleton},documentSection:{gap:n.xs},documentHead:{flexDirection:"row",alignItems:"center",gap:n.sm+n.xs/2,marginBottom:n.xs},documentRule:{flex:1,height:l,backgroundColor:t.borderHairlineGreen},documentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.md,paddingVertical:n.sm+1}})}var aa=640,sa=600,da=/* @__PURE__ */Object.freeze({width:0,height:0}),ca="useWindowDimensions"in o&&typeof o.useWindowDimensions=="function"?o.useWindowDimensions:()=>da,ua=/* @__PURE__ */Object.freeze({width:"100%",maxWidth:aa,alignSelf:"center"});/* @__PURE__ */Object.freeze({...ua,flex:1});var ha=/* @__PURE__ */Object.freeze({...ua,flexGrow:1,flexShrink:1});function pa(){return ca().width>=sa}function ga(e="flow"){let{width:t}=ca();if(t<sa)return null;if(e==="flow")return ua;let r=Math.max(0,Math.round((t-aa)/2));return{left:r,right:r}}function fa(e,t){return t===null?e:[e,t]}var ma=/* @__PURE__ */Symbol.for("@everfur/sdk#InSdkColumn@v1"),ba=globalThis,ya=ba[ma]??(ba[ma]=e.createContext(false));ya.displayName??="EverfurInSdkColumn";function SdkTabletColumn({children:t,style:i,testID:l}){let o=pa(),a=e.useContext(ya);return!o||a?t:/* @__PURE__ */n.jsx(r.View,{style:i===void 0?ha:[ha,i],testID:l??"everfur-tablet-column",children:/* @__PURE__ */n.jsx(ya.Provider,{value:true,children:t})})}var xa=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function EverfurClinicPicker(e){let{userRef:userRef,scopeEpoch:t}=Xt();/* @__PURE__ */
186
- return n.jsx(CapabilityGate,{capability:"recordsClinic",style:e.style,...uo(e.onBack,no),children:userRef===null?/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",children:fn.sessionRequired}):/* @__PURE__ */n.jsx(PickerBody,{...wr(e,["onNavigate","onBack"])},JSON.stringify([userRef,t,e.petRef]))})}function PickerBody({petRef:petRef,petName:t,controller:i,recordsController:l,location:o,onNavigate:a,onBack:s,style:d}){let c=Yl(),u=wa(),h=useEverfurTheme(),p=useEverfurRecordsClinic(),g=An(i??p,o),f=useEverfurRecords(l?{petRef:petRef,controller:l}:{petRef:petRef}),m=e.useRef(mt()),[b,y]=e.useState(false),[x,w]=e.useState(null),[v,k]=e.useState(false),[j,S]=e.useState(""),[C,R]=e.useState(false),[T,_]=e.useState(""),[z,I]=e.useState(false),D=e.useCallback(e=>{a?.({name:"consent",clinic:$n(e,null,"",m.current())})},[a]),H=()=>{b||(y(true),w(null),f.createRequest(`records-upload-${Date.now().toString(36)}`).then(e=>{if(y(false),!e.ok){w(zn.errors.start);return}a?.({name:"request",requestId:e.value.id})}))},V=C?j:g.query,P=xa.test(T.trim()),L=V.trim().length>0&&P,E=e=>{let{layoutMeasurement:t,contentOffset:r,contentSize:n}=e.nativeEvent;t.height+r.y>=n.height-t.height*.6&&g.loadMore()},O=g.isSearchActive?g.clinics:g.recent,A=g.isSearchActive?g.error?_n(g.error):!g.initialLoading&&g.clinics.length===0?"idle":null:g.recent.length>0||g.recentLoading?null:"idle",$=g.isSearchActive&&!g.initialLoading&&!g.error&&g.clinics.length>0?an.resultsCount(g.clinics.length):"";return e.useEffect(()=>{$.length>0&&r.AccessibilityInfo.announceForAccessibility?.($)},[$]),/* @__PURE__ */n.jsx(r.View,{style:[c.root,d],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
186
+ return n.jsx(CapabilityGate,{capability:"recordsClinic",style:e.style,...uo(e.onBack,no),children:userRef===null?/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",children:fn.sessionRequired}):/* @__PURE__ */n.jsx(PickerBody,{...wr(e,["onNavigate","onBack"])},JSON.stringify([userRef,t,e.petRef]))})}function PickerBody({petRef:petRef,petName:t,controller:i,recordsController:l,location:o,onNavigate:a,onBack:s,style:d}){let c=Yl(),u=wa(),h=useEverfurTheme(),p=useEverfurRecordsClinic(),g=An(i??p,o),f=useEverfurRecords(l?{petRef:petRef,controller:l}:{petRef:petRef}),m=e.useRef(mt()),[b,y]=e.useState(false),[x,w]=e.useState(null),[v,k]=e.useState(false),[j,S]=e.useState(""),[C,R]=e.useState(false),[T,_]=e.useState(""),[z,I]=e.useState(false),D=e.useCallback(e=>{a?.({name:"consent",clinic:$n(e,null,"",m.current())})},[a]),H=()=>{b||(y(true),w(null),f.createRequest(`records-upload-${Date.now().toString(36)}`).then(e=>{if(y(false),!e.ok){w(zn.errors.start);return}a?.({name:"request",requestId:e.value.id})}))},V=C?j:g.query,P=xa.test(T.trim()),L=V.trim().length>0&&P,O=e=>{let{layoutMeasurement:t,contentOffset:r,contentSize:n}=e.nativeEvent;t.height+r.y>=n.height-t.height*.6&&g.loadMore()},E=g.isSearchActive?g.clinics:g.recent,A=g.isSearchActive?g.error?_n(g.error):!g.initialLoading&&g.clinics.length===0?"idle":null:g.recent.length>0||g.recentLoading?null:"idle",$=g.isSearchActive&&!g.initialLoading&&!g.error&&g.clinics.length>0?an.resultsCount(g.clinics.length):"";return e.useEffect(()=>{$.length>0&&r.AccessibilityInfo.announceForAccessibility?.($)},[$]),/* @__PURE__ */n.jsx(r.View,{style:[c.root,d],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
187
187
  /* @__PURE__ */n.jsx(ScreenHeader,{title:an.titleFor(t),onBack:s,testID:"records-clinic-header"}),
188
188
  /* @__PURE__ */n.jsx(Text,{style:u.lead,testID:"records-clinic-lead",children:an.leadNative}),
189
189
  /* @__PURE__ */n.jsxs(r.View,{style:u.searchBar,children:[
@@ -191,7 +191,7 @@ return n.jsx(CapabilityGate,{capability:"recordsClinic",style:e.style,...uo(e.on
191
191
  /* @__PURE__ */n.jsx(tn,{value:g.query,onChangeText:g.setQuery,placeholder:an.placeholder,placeholderTextColor:h.color.text.muted,autoCorrect:false,autoCapitalize:"words",returnKeyType:"search",maxLength:200,accessibilityLabel:an.searchA11y,style:u.searchInput,testID:"records-clinic-search-input"}),g.query.length>0?/* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>g.setQuery(""),accessibilityRole:"button",accessibilityLabel:an.clearSearch,hitSlop:8,testID:"records-clinic-search-clear",children:/* @__PURE__ */n.jsx(Text,{style:u.clearGlyph,children:"×"})}):null]}),a?/* @__PURE__ */n.jsxs(r.View,{style:u.uploadWrap,children:[x?/* @__PURE__ */n.jsx(r.View,{style:c.errorBanner,accessibilityRole:"alert",children:/* @__PURE__ */n.jsx(Text,{style:c.errorText,children:x})}):null,
192
192
  /* @__PURE__ */n.jsx(Pill,{label:b?an.uploadOwnStarting:an.uploadOwn,kind:"outline",busy:b,onPress:H,testID:"records-clinic-upload-own"})]}):null,
193
193
  /* @__PURE__ */n.jsx(Text,{accessibilityLiveRegion:"polite",style:u.srOnly,testID:"records-clinic-results-status",children:$}),
194
- /* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:u.list,keyboardShouldPersistTaps:"handled",keyboardDismissMode:r.Platform.OS==="ios"?"interactive":"on-drag",onScroll:g.isSearchActive?E:void 0,scrollEventThrottle:200,testID:"records-clinic-results",children:[g.isSearchActive?/* @__PURE__ */n.jsxs(r.View,{style:u.fallbackCard,testID:"records-clinic-fallback-card",children:[
194
+ /* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:u.list,keyboardShouldPersistTaps:"handled",keyboardDismissMode:r.Platform.OS==="ios"?"interactive":"on-drag",onScroll:g.isSearchActive?O:void 0,scrollEventThrottle:200,testID:"records-clinic-results",children:[g.isSearchActive?/* @__PURE__ */n.jsxs(r.View,{style:u.fallbackCard,testID:"records-clinic-fallback-card",children:[
195
195
  /* @__PURE__ */n.jsxs(r.Pressable,{onPress:()=>k(e=>!e),accessibilityRole:"button",accessibilityLabel:an.fallback.title,accessibilityHint:an.fallback.subtitle,accessibilityState:{expanded:v},style:u.fallbackHeader,testID:"records-clinic-fallback",children:[
196
196
  /* @__PURE__ */n.jsxs(r.View,{style:u.fallbackCopy,children:[
197
197
  /* @__PURE__ */n.jsx(Text,{style:u.fallbackTitle,numberOfLines:1,children:an.fallback.title}),
@@ -202,7 +202,7 @@ return n.jsx(CapabilityGate,{capability:"recordsClinic",style:e.style,...uo(e.on
202
202
  /* @__PURE__ */n.jsx(Text,{style:c.fieldLabel,children:an.fallback.emailLabel}),
203
203
  /* @__PURE__ */n.jsx(tn,{accessibilityLabel:an.fallback.emailLabel,style:c.field,value:T,onChangeText:e=>{_(e),I(false)},onBlur:()=>I(true),placeholder:an.fallback.emailPlaceholder,placeholderTextColor:h.color.text.placeholder,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,maxLength:320,testID:"records-clinic-fallback-email"}),z&&T.trim().length>0&&!P?/* @__PURE__ */n.jsx(Text,{style:c.errorText,accessibilityRole:"alert",children:zn.errors.invalidEmail}):null,
204
204
  /* @__PURE__ */n.jsx(Text,{style:c.muted,children:an.fallback.reviewNote}),
205
- /* @__PURE__ */n.jsx(Pill,{label:an.fallback.submit,disabled:!L||!a,onPress:()=>a?.({name:"consent",clinic:$n(null,V.trim(),T.trim().toLowerCase(),m.current())}),testID:"records-clinic-fallback-submit"})]}):null]}):g.recent.length>0?/* @__PURE__ */n.jsx(Text,{style:u.sectionLabel,accessibilityRole:"header",testID:"records-clinic-recent-label",children:an.recentlyUsed}):null,g.isSearchActive&&g.initialLoading?/* @__PURE__ */n.jsx(ClinicsSkeleton,{testID:"records-clinic-page-loading"}):null,O.map(e=>/* @__PURE__ */n.jsx(ClinicRow,{clinic:e,onSelect:D,styles:u},e.id)),A&&!g.initialLoading?/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:A,message:g.isSearchActive&&A==="idle"?an.noMatch(g.debouncedQuery):g.error?.displayMessage,onAction:g.error?.retryable===true?g.retry:void 0,testID:"records-clinic-empty"}):null,
205
+ /* @__PURE__ */n.jsx(Pill,{label:an.fallback.submit,disabled:!L||!a,onPress:()=>a?.({name:"consent",clinic:$n(null,V.trim(),T.trim().toLowerCase(),m.current())}),testID:"records-clinic-fallback-submit"})]}):null]}):g.recent.length>0?/* @__PURE__ */n.jsx(Text,{style:u.sectionLabel,accessibilityRole:"header",testID:"records-clinic-recent-label",children:an.recentlyUsed}):null,g.isSearchActive&&g.initialLoading?/* @__PURE__ */n.jsx(ClinicsSkeleton,{testID:"records-clinic-page-loading"}):null,E.map(e=>/* @__PURE__ */n.jsx(ClinicRow,{clinic:e,onSelect:D,styles:u},e.id)),A&&!g.initialLoading?/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:A,message:g.isSearchActive&&A==="idle"?an.noMatch(g.debouncedQuery):g.error?.displayMessage,onAction:g.error?.retryable===true?g.retry:void 0,testID:"records-clinic-empty"}):null,
206
206
  /* @__PURE__ */n.jsxs(r.View,{style:u.footer,children:[g.loadingMore?/* @__PURE__ */n.jsxs(r.View,{style:u.footerLoading,testID:"records-clinic-loading-more",children:[
207
207
  /* @__PURE__ */n.jsx(r.ActivityIndicator,{color:h.color.brandInk,size:"small"}),
208
208
  /* @__PURE__ */n.jsx(Text,{style:c.muted,children:an.loadingMore})]}):null,g.pageError?/* @__PURE__ */n.jsx(r.Pressable,{onPress:g.loadMore,accessibilityRole:"button",accessibilityLabel:an.loadMoreFailed,style:u.footerRetry,testID:"records-clinic-page-error-retry",children:/* @__PURE__ */n.jsx(Text,{style:u.footerRetryLabel,children:an.loadMoreFailed})}):null]}),
@@ -216,7 +216,7 @@ return n.jsx(CapabilityGate,{capability:"recordsClinic",style:e.style,...uo(e.on
216
216
  return n.jsxs(r.Pressable,{onPress:()=>t(e),accessibilityRole:"button",accessibilityLabel:an.selectA11y(a),hitSlop:8,style:i.item,testID:`records-clinic-${e.id}`,children:[
217
217
  /* @__PURE__ */n.jsxs(r.View,{style:i.itemHeader,children:[
218
218
  /* @__PURE__ */n.jsx(Text,{style:i.itemName,numberOfLines:1,children:e.name}),o?/* @__PURE__ */n.jsx(Text,{style:i.itemDistance,accessibilityElementsHidden:true,importantForAccessibility:"no",children:o}):null]}),e.address?/* @__PURE__ */n.jsx(Text,{style:i.itemAddress,numberOfLines:2,children:e.address}):null,e.phone?/* @__PURE__ */n.jsx(Text,{style:i.itemPhone,numberOfLines:1,accessibilityElementsHidden:true,importantForAccessibility:"no",children:e.phone}):null,
219
- /* @__PURE__ */n.jsx(r.View,{style:[i.badge,l.tone==="positive"?i.badgePositive:l.tone==="caution"?i.badgeCaution:i.badgeNeutral],accessibilityElementsHidden:true,importantForAccessibility:"no",children:/* @__PURE__ */n.jsx(Text,{style:[i.badgeLabel,l.tone==="positive"?i.badgePositiveText:l.tone==="caution"?i.badgeCautionText:i.badgeNeutralText],children:l.label})})]})}function wa(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?ka(t):Ol(ka(t),va(r)),[t,r])}function va(e){return{howCard:El(e,{marginTop:8}),howTitle:e.cardTitle,item:El(e,{paddingHorizontal:e.cardPad,paddingVertical:12,gap:8}),fallbackCard:{...El(e,{paddingHorizontal:e.cardPad,paddingVertical:12}),borderWidth:1,borderStyle:"dashed",borderColor:e.look.line}}}function ka(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth,a=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n}),s=e.slots.card,d=nn(s);return r.StyleSheet.create({srOnly:{position:"absolute",width:1,height:1,overflow:"hidden"},lead:{...a(l.size.body,l.lineHeight.normal,t.text.muted),paddingHorizontal:n.lg,paddingBottom:n.md},howCard:{borderRadius:i.lg,backgroundColor:t.surfaceSubtle,padding:n.lg,gap:n.md,marginTop:n.sm,...rn(s)},howTitle:{...a(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),letterSpacing:-.4,...d},howRow:{flexDirection:"row",gap:n.md},howNumber:{...face(e,"monoBold"),fontSize:l.size.caption,lineHeight:Math.round(l.size.body*l.lineHeight.snug),color:t.brandInk,minWidth:n.xl},howText:{flex:1,gap:n.xs/2},howStepTitle:{...a(l.size.body,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...d},howStepBody:{...a(l.size.caption,l.lineHeight.normal,t.text.secondary),...d},searchBar:{flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.md+n.xs/2,height:n.xxl+n.md,marginHorizontal:n.lg,marginBottom:n.sm,borderRadius:i.lg+n.xs/2,backgroundColor:t.surfaceSubtle,borderWidth:o,borderColor:t.borderHairlineGreen,...rn(e.slots.input,o)},searchInput:{flex:1,...a(l.size.body,l.lineHeight.snug,t.text.primary),paddingVertical:0,...nn(e.slots.input)},clearGlyph:a(l.size.heading,l.lineHeight.tight,t.text.muted),uploadWrap:{paddingHorizontal:n.lg,paddingBottom:n.md,gap:n.sm},list:{paddingHorizontal:n.lg,paddingBottom:n.xxl,gap:n.md},sectionLabel:{...a(l.size.caption,l.lineHeight.normal,t.text.secondary,"bold"),textTransform:"uppercase",letterSpacing:l.letterSpacing.eyebrow/2},fallbackCard:{borderRadius:i.lg-n.xs/2,borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md,gap:n.md,...rn(s,1)},fallbackHeader:{flexDirection:"row",alignItems:"center",gap:n.md,minHeight:n.xxl+n.md},fallbackCopy:{flex:1,gap:n.xs/2},fallbackTitle:{...a(l.size.body,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...d},fallbackSubtitle:{...a(l.size.caption,l.lineHeight.normal,t.text.muted),...d},fallbackForm:{gap:n.sm},item:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md,gap:n.sm,...rn(s,1)},itemHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.sm},itemName:{flex:1,...a(l.size.body,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),...d},itemDistance:{...face(e,"mono"),fontSize:l.size.tiny,lineHeight:l.size.body,color:t.text.muted},itemAddress:{...a(l.size.caption,l.lineHeight.normal,t.text.primary),...d},itemPhone:{...a(l.size.caption,l.lineHeight.normal,t.text.muted),...d},badge:{alignSelf:"flex-start",borderRadius:i.pill,paddingHorizontal:n.sm+1,paddingVertical:n.xs},badgePositive:{backgroundColor:t.badgeBgPositive},badgeCaution:{backgroundColor:t.badgeBgCaution},badgeNeutral:{backgroundColor:t.badgeBgNeutral},badgeLabel:{...a(l.size.micro,l.lineHeight.snug,t.text.muted,"bold")},badgePositiveText:{color:t.success},badgeCautionText:{color:t.cautionAccent},badgeNeutralText:{color:t.text.muted},footer:{gap:n.sm,paddingTop:n.sm},footerLoading:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:n.sm,minHeight:n.xxl+n.md},footerRetry:{minHeight:n.xxl+n.md,alignItems:"center",justifyContent:"center"},footerRetryLabel:{...a(l.size.bodyTight,l.lineHeight.snug,t.brandInk,"bold")}})}var ja=/* @__PURE__ */Object.freeze({title:"Request records",resultTitle:"Request status",addClinic:"Add a clinic",atCap:`Up to ${Bn} clinics`,send:e=>`Send ${e} ${e===1?"request":"requests"}`,sending:"Sending…",addToContinue:"Add a clinic to continue",tryAgain:"Try again",remove:e=>`Remove ${e}`,emailToAdd:"Email to add",perClinic:"Per-clinic result",sent:"Sent",notSent:"Not sent",allFailed:"We couldn’t send any of these requests. See the details below and try again.",partial:(e,t,r)=>`${e} of ${t} requests sent. ${r} couldn’t be sent.`,allSent:e=>`${e} ${e===1?"request":"requests"} sent.`,responded:(e,t)=>`${e} of ${t} ${t===1?"clinic":"clinics"} responded`});var Sa=25,Ca=5;function Ra(t){let[r,n]=e.useState({list:t,shown:Ca}),i=r.list===t?r.shown:Ca,l=e.useCallback(()=>{n(e=>({list:t,shown:(e.list===t?e.shown:Ca)+Ca}))},[t]);return{visible:t.slice(0,i),hasMore:t.length>i,showMore:l}}var Ta=class extends Error{constructor(){super("Signature upload failed"),this.name="SignatureUploadLegError"}};function _a(e){return e instanceof Ta}function za(e,t,r,n){let i={owner_name:t,pet_name:r,clinic_name:n},l=false,o=e.scopeTemplate.replace(/\{([^{}]+)\}/g,(e,t)=>Object.prototype.hasOwnProperty.call(i,t)?i[t]??"":(l=true,""));return l||/[{}]/.test(o)?null:o}function Ia(e){return e===null||e.emailStatus!=="verified"&&e.emailStatus!=="unverified"}function Da(t,r,n){let[i,l]=e.useState(t.ownerName),[o,a]=e.useState(""),[s,d]=e.useState(null),[c,u]=e.useState(""),[h,p]=e.useState([]),[g,f]=e.useState([]),[m,b]=e.useState(null),[y,x]=e.useState(null),[w,v]=e.useState(false),[k,j]=e.useState(false),[S,C]=e.useState(null),[R,T]=e.useState(0),_=e.useRef(false),z=e.useRef(false),I=e.useRef(0),D=e.useRef(mt()),H=e.useRef(null),V=e.useRef(null),P=e.useRef(0);e.useEffect(()=>(_.current=true,z.current=false,v(false),()=>{_.current=false,P.current+=1,I.current+=1,H.current=null,V.current?.abort()}),[r]),e.useEffect(()=>{let e=true;return b(null),H.current=null,r.getAuthorizationCopy().then(t=>{e&&(t.ok?(b(t.value),x(null)):x(t.error))}).catch(()=>{e&&x(makeEverfurError("internalError"))}),()=>{e=false}},[r,R]),e.useEffect(()=>{let e=true;return f([]),r.recentClinics({limit:5}).then(t=>{e&&t.ok&&f(t.value.clinics)}).catch(()=>{}),()=>{e=false}},[r]);let L=()=>{H.current=null,x(null)},E=s?.name??o.trim(),O=m?za(m,i.trim(),t.petName,E):null,A=Ia(s),$=Ra(h),B=!!(m&&O&&i.trim()&&t.petName.trim()&&E&&(!A||/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(c.trim()))&&n),F=async()=>{if(z.current)return;let e=++I.current;j(true);try{let t=await r.searchClinics({query:o.trim(),limit:Sa});if(!_.current||e!==I.current)return;t.ok?(p(t.value.clinics),x(null)):x(t.error)}catch{_.current&&e===I.current&&x(makeEverfurError("internalError"))}finally{_.current&&e===I.current&&j(false)}},M=async()=>{if(z.current||S||!B||!m||!O||!n)return;z.current=true;let e=P.current,l=()=>_.current&&P.current===e;v(true),x(null);try{if(!H.current){V.current=new AbortController;let e=await n({petRef:t.petRef,petName:t.petName,ownerName:i.trim(),clinicName:E,authorizationVersion:m.authorizationVersion,scopeText:O,signal:V.current.signal});if(!l()||e===null)return;let r=s&&(!A||s.emailStatus==="none")?{clinicId:s.id}:{clinicFreeText:E};H.current={petRef:t.petRef,ownerName:i.trim(),authorizationVersion:m.authorizationVersion,...r,...A?{clinicEmail:c.trim().toLowerCase()}:{},...e.signatureId!==void 0?{signatureId:e.signatureId}:{signaturePngBase64:e.signaturePngBase64},idempotencyKey:D.current()}}if(!l())return;let e=await r.createClinicRequest(H.current);if(!l())return;if(!e.ok){x(e.error);return}if(e.value.petRef!==t.petRef){x(makeEverfurError("internalError"));return}C(e.value),H.current=null,t.onCreated?.(e.value)}catch{l()&&x(makeEverfurError("internalError"))}finally{z.current=false,l()&&v(false)}};return{ownerName:i,query:o,clinic:s,email:c,clinics:h,copy:m,scope:O,error:y,busy:w,searching:k,created:S,ready:B,needsEmail:A,visibleClinics:$.visible,hasMoreClinics:$.hasMore,showMoreClinics:$.showMore,recent:h.length===0&&s===null?g:[],setOwnerName(e){z.current||(L(),l(e))},setQuery(e){z.current||(L(),I.current+=1,j(false),p([]),d(null),u(""),a(e))},setEmail(e){z.current||(L(),u(e))},selectClinic(e){z.current||(L(),I.current+=1,j(false),p([]),d(e),a(e.name),u(""))},invalidate:L,search:F,submit:M,retryCopy(){x(null),T(e=>e+1)}}}var Ha=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Va(e){return e.clinic?.name??e.freeText??""}function Pa(e){return Ia(e.clinic)}function La(t,r,n,i,l){let[o,a]=e.useState(t.ownerName),[s,d]=e.useState(""),[c,u]=e.useState([]),[h,p]=e.useState([]),[g,f]=e.useState([]),[m,b]=e.useState(null),[y,x]=e.useState(null),[w,v]=e.useState(false),[k,j]=e.useState(false),[S,C]=e.useState(null),[R,T]=e.useState(null),[_,z]=e.useState(0),I=e.useRef(false),D=e.useRef(false),H=e.useRef(0),V=e.useRef(0),P=e.useRef(mt()),L=e.useRef(null),E=e.useRef(null);e.useEffect(()=>(I.current=true,D.current=false,v(false),()=>{I.current=false,V.current+=1,H.current+=1,L.current=null,E.current?.abort()}),[r,n]),e.useEffect(()=>{let e=true;return b(null),L.current=null,r.getAuthorizationCopy().then(t=>{e&&(t.ok?(b(t.value),x(null)):x(t.error))}).catch(()=>{e&&x(makeEverfurError("internalError"))}),()=>{e=false}},[r,_]),e.useEffect(()=>{let e=true;return p([]),r.recentClinics({limit:5}).then(t=>{e&&t.ok&&p(t.value.clinics)}).catch(()=>{}),()=>{e=false}},[r]);let O=Ra(c),A=()=>{L.current=null,x(null)},$=g.map(Va),B=yn(t.petName),F=m?$.map(e=>za(m,o.trim(),B,e)):[],M=F.every(e=>e!==null)?F.join(`\n\n`):null,q=g.length>0&&g.every(e=>!Pa(e)||Ha.test(e.email.trim())),N=g.length>=Bn,W=!!(m&&M&&o.trim()&&q&&i)&&S===null,U=async()=>{if(D.current)return;let e=++H.current;j(true);try{let t=await r.searchClinics({query:s.trim(),limit:Sa});if(!I.current||e!==H.current)return;t.ok?(u(t.value.clinics),x(null)):x(t.error)}catch{I.current&&e===H.current&&x(makeEverfurError("internalError"))}finally{I.current&&e===H.current&&j(false)}},G=e=>{D.current||N||S!==null||e.clinic!==null&&g.some(t=>t.clinic?.id===e.clinic?.id)||(A(),f(t=>[...t,{...e,key:P.current(),idempotencyKey:P.current()}]),u([]),d(""))},K=async()=>{if(D.current||S!==null||!W||!m||!M||!i)return;D.current=true;let e=V.current,r=()=>I.current&&V.current===e;v(true),x(null);try{if(L.current===null){E.current=new AbortController;let e=await i({petRef:t.petRef,petName:B,ownerName:o.trim(),clinicName:$.join(", "),authorizationVersion:m.authorizationVersion,scopeText:M,signal:E.current.signal});if(!r()||e===null)return;if(L.current=e,e.signaturePngBase64!==void 0&&l!==void 0){let t=E.current;try{let n=await l(e.signaturePngBase64,t.signal);if(!r())return;L.current={signatureId:n.signatureId}}catch(e){if(!_a(e)||t.signal.aborted)throw e;if(!r())return}}}let a=L.current,s=g.map(e=>({...e.clinic!==null&&(!Pa(e)||e.clinic.emailStatus==="none")?{clinicId:e.clinic.id}:{clinicFreeText:Va(e)},...Pa(e)?{clinicEmail:e.email.trim().toLowerCase()}:{},...a.signatureId!==void 0?{signatureId:a.signatureId}:{signaturePngBase64:a.signaturePngBase64},idempotencyKey:e.idempotencyKey})),d=await n.createClinicRequestBatch({petRef:t.petRef,ownerName:o.trim(),authorizationVersion:m.authorizationVersion,clinics:s});if(!r())return;if(!d.ok){x(d.error);return}C(d.value),t.onCreated?.(d.value),Y(d.value.requestGroupId,e)}catch{r()&&x(makeEverfurError("internalError"))}finally{D.current=false,r()&&v(false)}},Y=async(e,n)=>{try{let i=await r.getRequestGroup(e);if(!I.current||V.current!==n)return;i.ok&&i.value.petRef===t.petRef&&T(i.value)}catch{}},X=async()=>{S===null||D.current||await Y(S.requestGroupId,V.current)};return{ownerName:o,query:s,clinics:c,copy:m,scopeText:M,error:y,busy:w,searching:k,drafts:g,outcome:S,group:R,ready:W,atCap:N,visibleClinics:O.visible,hasMoreClinics:O.hasMore,showMoreClinics:O.showMore,recent:c.length===0?h.filter(e=>!g.some(t=>t.clinic?.id===e.id)):[],setOwnerName(e){D.current||(A(),a(e))},setQuery(e){D.current||(H.current+=1,j(false),u([]),d(e))},search:U,addClinic(e){G({clinic:e,freeText:null,email:""})},addFreeText(){let e=s.trim();e.length!==0&&G({clinic:null,freeText:e,email:""})},setDraftEmail(e,t){D.current||(A(),f(r=>r.map(r=>r.key===e?{...r,email:t}:r)))},removeDraft(e){D.current||S!==null||(A(),f(t=>t.filter(t=>t.key!==e)))},submit:K,refreshGroup:X,retryCopy(){x(null),z(e=>e+1)}}}var Ea=/* @__PURE__ */Object.freeze({}),Oa=100,Aa=20;function $a(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 Ba(t,n){let i=typeof t=="number",l=e.useRef(null),[o,a]=e.useState(null),s=e.useRef(null),d=e.useRef(null),c=e.useRef(true),u=e.useCallback(()=>{d.current!==null&&clearTimeout(d.current),d.current=null},[]);e.useEffect(()=>(c.current=true,()=>{c.current=false,u()}),[u]);let h=e.useCallback(function e(t){l.current?.measureInWindow((n,i)=>{let l=s.current;if(!c.current||l===null)return;let o=$a(i,l.y,l.height,r.Dimensions.get("window").height);if(o!==null){a(e=>e!==null&&e.chatTop===o.chatTop&&e.parentTop===o.parentTop?e:o);return}t>=Aa||(d.current=setTimeout(()=>{d.current=null,e(t+1)},Oa))})},[]),p=e.useCallback(e=>{let{y:t,height:r}=e.nativeEvent.layout;s.current={y:t,height:r},u(),h(0)},[h,u]);return e.useMemo(()=>{if(!n)return{avoidingProps:Ea,probeRef:null,topInWindow:null};let e=o?.parentTop??0;return{avoidingProps:e>0?{keyboardVerticalOffset:e,onLayout:p}:{onLayout:p},probeRef:l,topInWindow:o?.chatTop??null}},[n,i,t,o,p])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */n.jsx(r.View,{ref:e,collapsable:false,pointerEvents:"none",style:Fa})}var Fa=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function Ma(e){let t=z(e);if(t===null||t.protocol!=="https:"||t.username||t.password||t.port&&t.port!=="443")return false;let r=t.hostname.toLowerCase();return r==="s3.amazonaws.com"||r.endsWith(".s3.amazonaws.com")||/^(?:[a-z0-9][a-z0-9.-]*\.)?s3[.-][a-z0-9-]+\.amazonaws\.com$/.test(r)||/^(?:[a-z0-9][a-z0-9.-]*\.)?s3\.dualstack\.[a-z0-9-]+\.amazonaws\.com$/.test(r)||r==="s3-accelerate.amazonaws.com"||r.endsWith(".s3-accelerate.amazonaws.com")||r==="s3-accelerate.dualstack.amazonaws.com"||r.endsWith(".s3-accelerate.dualstack.amazonaws.com")}var qa="Signature upload failed",Na=3e4;function Wa(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}async function registerRnSignature(e,t,r,n){let i=()=>new Error(qa),l=Wa(e);if(l<=0||r.aborted)throw i();let o=await t.initiateSignatureUpload(l);if(!o.ok||r.aborted||!Ma(o.value.uploadUrl))throw i();let a=new FormData;for(let[e,t]of Object.entries(o.value.uploadFields))a.append(e,t);a.append("file",{uri:`data:image/png;base64,${e}`,name:"signature.png",type:"image/png"});let s=new AbortController,d=()=>s.abort();r.addEventListener("abort",d,{once:true});let c=setTimeout(d,Na);try{if(!(await(n??fetch)(o.value.uploadUrl,{method:"POST",body:a,credentials:"omit",signal:s.signal})).ok||r.aborted)throw i()}catch{throw r.aborted?i():new Ta}finally{clearTimeout(c),r.removeEventListener("abort",d)}let u=await t.completeSignatureUpload(o.value.uploadId);if(!u.ok||r.aborted)throw i();return{signatureId:u.value}}var Ua=/* @__PURE__ */Object.freeze({width:360,height:120});function Ga(e,t){return{width:e,height:t,pixels:new Uint8Array(e*t)}}function Ka(e,t,r,n){for(let i=-n;i<=n;i+=1)for(let l=-n;l<=n;l+=1){if(l*l+i*i>n*n+n)continue;let o=t+l,a=r+i;o<0||a<0||o>=e.width||a>=e.height||(e.pixels[a*e.width+o]=1)}}var Ya=16384;function Xa(e,t){let[r,n]=e;if(!Number.isFinite(r)||!Number.isFinite(n))return null;let i=Math.min(2*t.width,Math.max(-t.width,Math.round(r))),l=Math.min(2*t.height,Math.max(-t.height,Math.round(n)));return[i,l]}function Qa(e,t,r,n,i){let[l,o]=t,[a,s]=r,d=Math.abs(a-l),c=-Math.abs(s-o),u=l<a?1:-1,h=o<s?1:-1,p=d+c,g=0;for(;g<i&&(Ka(e,l,o,n),g+=1,!(l===a&&o===s));){let e=2*p;e>=c&&(p+=c,l+=u),e<=d&&(p+=d,o+=h)}return g}function rasterizeStrokes(e,t=1){let r=Ga(Ua.width,Ua.height);for(let n of e){let e=[];for(let t of n){let n=Xa(t,r);n!==null&&e.push(n)}if(e.length===0)continue;if(e.length===1){let[n,i]=e[0];Ka(r,n,i,t);continue}let i=Ya;for(let n=1;n<e.length&&i>0;n+=1)i-=Qa(r,e[n-1],e[n],t,i)}return r}var Ja="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,'-",Za="ehhvhhhuhhuhhufgggggfuhhhhhuvgguggvvggugggfggnhhfhhhvhhhv44444v72222ichikokihggggggvhrllhhhhpljhhhehhhhheuhhugggehhhliduhhukihfgge11uv444444hhhhhhehhhhha4hhhllrhhha4ahhhha4444v1248gv00e1fhfgguhhhu00fgggf11fhhhf00ehvgf698s8880fhhf1egguhhhh40c444e20622icggikokic44444e00qllhh00uhhhh00ehhhe0uhhugg0fhhf1100mpggg00fge1u88s889600hhhjd00hhha400hhlla00ha4ah00hhf1e00v248vehjlphe4c4444eeh1248vv2421he26aiv22vgu11he68guhhev124888ehhehheehhf12c00000cc0000c48c480000000v000",es="0123456789abcdefghijklmnopqrstuv",ts=5,rs=7,ns=ts+1;function is(e,t){let r=Ja.indexOf(e);return r<0?0:es.indexOf(Za.charAt(r*rs+t))}function rasterizeTypedName(e){let t=Ga(Ua.width,Ua.height),r=e.trim();if(r.length===0)return t;let n=[...r],i=4;for(;i>1&&(n.length*ns-1)*i>t.width-8;)i-=1;let l=(n.length*ns-1)*i,o=Math.max(0,Math.floor((t.width-l)/2)),a=Math.floor((t.height-rs*i)/2);return n.forEach((e,r)=>{let n=o+r*ns*i;for(let r=0;r<rs;r+=1){let l=is(e,r);for(let e=0;e<ts;e+=1)if((l>>ts-1-e&1)!==0)for(let l=0;l<i;l+=1)for(let o=0;o<i;o+=1){let s=n+e*i+o,d=a+r*i+l;s<t.width&&d<t.height&&(t.pixels[d*t.width+s]=1)}}}),t}var ls=class{constructor(){this.bytes=[];this.acc=0;this.count=0}writeBits(e,t){for(this.acc|=e<<this.count,this.count+=t;this.count>=8;)this.bytes.push(this.acc&255),this.acc>>>=8,this.count-=8}writeCode(e,t){let r=0;for(let n=0;n<t;n+=1)r=r<<1|e>>n&1;this.writeBits(r,t)}finish(){return this.count>0&&this.bytes.push(this.acc&255),Uint8Array.from(this.bytes)}};function os(e,t){t<144?e.writeCode(48+t,8):t<256?e.writeCode(400+(t-144),9):t<280?e.writeCode(t-256,7):e.writeCode(192+(t-280),8)}var as=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],ss=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ds=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],cs=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function us(e,t,r){let n=as.length-1;for(;as[n]>t;)n-=1;os(e,257+n),ss[n]>0&&e.writeBits(t-as[n],ss[n]);let i=ds.length-1;for(;ds[i]>r;)i-=1;e.writeCode(i,5),cs[i]>0&&e.writeBits(r-ds[i],cs[i])}var hs=32768,ps=3,gs=258,fs=15,ms=64;function bs(e){let t=new ls;t.writeBits(1,1),t.writeBits(1,2);let r=new Int32Array(1<<fs).fill(-1),n=new Int32Array(e.length).fill(-1),i=t=>(e[t]<<10^e[t+1]<<5^e[t+2])&(1<<fs)-1,l=t=>{if(t+ps>e.length)return;let l=i(t);n[t]=r[l],r[l]=t},o=0;for(;o<e.length;){let a=0,s=0;if(o+ps<=e.length){let t=r[i(o)],l=0,d=Math.min(gs,e.length-o);for(;t>=0&&l<ms&&o-t<=hs;){let r=0;for(;r<d&&e[t+r]===e[o+r];)r+=1;if(r>a&&(a=r,s=o-t,r===d))break;t=n[t],l+=1}}if(a>=ps){us(t,a,s);for(let e=0;e<a;e+=1)l(o+e);o+=a}else os(t,e[o]),l(o),o+=1}return os(t,256),t.finish()}function ys(e){let t=1,r=0;for(let n of e)t=(t+n)%65521,r=(r+t)%65521;return(r<<16|t)>>>0}var xs=null;function ws(e){if(xs===null){xs=new Uint32Array(256);for(let e=0;e<256;e+=1){let t=e;for(let e=0;e<8;e+=1)t=t&1?3988292384^t>>>1:t>>>1;xs[e]=t>>>0}}let t=4294967295;for(let r of e)t=xs[(t^r)&255]^t>>>8;return(t^4294967295)>>>0}function vs(e){return[e>>>24&255,e>>>16&255,e>>>8&255,e&255]}function ks(e,t){let r=Uint8Array.from([...e].map(e=>e.charCodeAt(0))),n=new Uint8Array(r.length+t.length);return n.set(r,0),n.set(t,r.length),[...vs(t.length),...n,...vs(ws(n))]}var js="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Ss(e){let t="";for(let r=0;r<e.length;r+=3){let n=e[r],i=r+1<e.length?e[r+1]:0,l=r+2<e.length?e[r+2]:0,o=n<<16|i<<8|l;t+=js.charAt(o>>18&63)+js.charAt(o>>12&63),t+=r+1<e.length?js.charAt(o>>6&63):"=",t+=r+2<e.length?js.charAt(o&63):"="}return t}function encodeSignaturePng(e){let{width:t,height:r,pixels:n}=e,i=Math.ceil(t/8)+1,l=new Uint8Array(i*r);for(let e=0;e<r;e+=1){let r=e*i;l[r]=0,l.fill(255,r+1,r+i);for(let i=0;i<t;i+=1)if(n[e*t+i]===1){let e=r+1+(i>>3);l[e]=l[e]&~(128>>(i&7))}}let o=bs(l),a=new Uint8Array(2+o.length+4);a[0]=120,a[1]=1,a.set(o,2),a.set(vs(ys(l)),2+o.length);let s=Uint8Array.from([...vs(t),...vs(r),1,0,0,0,0]),d=Uint8Array.from([137,80,78,71,13,10,26,10,...ks("IHDR",s),...ks("IDAT",a),...ks("IEND",new Uint8Array(0))]);return Ss(d)}var Cs=2.6,Rs="#111111";function Ts(e,t){let r=[];return e.forEach((e,n)=>{let i=r=>{let n=e[r];return[n[0]/t,n[1]/t]};if(e.length===1){let[e,t]=i(0);r.push({key:`${n}-0`,cx:e,cy:t,length:0,angle:0});return}for(let t=1;t<e.length;t+=1){let[e,l]=i(t-1),[o,a]=i(t);r.push({key:`${n}-${t}`,cx:(e+o)/2,cy:(l+a)/2,length:Math.hypot(o-e,a-l),angle:Math.atan2(a-l,o-e)})}}),r}var _s=8,zs=2;function SignaturePad({onChange:t,disabled:i=false,mode:l}){let o=Is(),[a,s]=e.useState("draw"),d=l!==void 0,c=l??a,[u,h]=e.useState(""),[p,g]=e.useState([]),[f,m]=e.useState(0),b=e.useRef([]),y=e.useRef(null),x=f>0?Ua.width/f:1,w=e.useRef(x);w.current=x;let v=e.useRef(i);v.current=i,e.useEffect(()=>{if(c==="type"){br(t,u.trim().length>0?encodeSignaturePng(rasterizeTypedName(u)):null);return}let e=p.reduce((e,t)=>e+t.length,0);br(t,e>=_s?encodeSignaturePng(rasterizeStrokes(p)):null)},[c,u,p,t]);let k=e=>{let{locationX:t,locationY:r}=e.nativeEvent;return[t*w.current,r*w.current]},j=()=>{let e=b.current,t=y.current;b.current=[],y.current=null,g(r=>[...r.filter(e=>e!==t),e])},S=e.useMemo(()=>r.PanResponder.create({onStartShouldSetPanResponder:()=>!v.current,onMoveShouldSetPanResponder:()=>!v.current,onPanResponderTerminationRequest:()=>false,onPanResponderGrant:e=>{b.current=[k(e)]},onPanResponderMove:e=>{let t=k(e),r=b.current[b.current.length-1];if(r!==void 0&&Math.abs(r[0]-t[0])<zs&&Math.abs(r[1]-t[1])<zs)return;b.current=[...b.current,t];let n=y.current,i=b.current;y.current=i,g(e=>[...e.filter(e=>e!==n),i])},onPanResponderRelease:()=>j(),onPanResponderTerminate:()=>j()}),[]),C=e.useCallback(()=>{v.current||(b.current=[],y.current=null,g([]),h(""))},[]),R=e.useCallback(()=>{C(),s(e=>e==="draw"?"type":"draw")},[C]),T=e.useRef(c);e.useEffect(()=>{T.current!==c&&(T.current=c,b.current=[],y.current=null,g([]),h(""))},[c]);let _=e=>m(e.nativeEvent.layout.width),z=p.reduce((e,t)=>e+t.length,0);/* @__PURE__ */
219
+ /* @__PURE__ */n.jsx(r.View,{style:[i.badge,l.tone==="positive"?i.badgePositive:l.tone==="caution"?i.badgeCaution:i.badgeNeutral],accessibilityElementsHidden:true,importantForAccessibility:"no",children:/* @__PURE__ */n.jsx(Text,{style:[i.badgeLabel,l.tone==="positive"?i.badgePositiveText:l.tone==="caution"?i.badgeCautionText:i.badgeNeutralText],children:l.label})})]})}function wa(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?ka(t):El(ka(t),va(r)),[t,r])}function va(e){return{howCard:Ol(e,{marginTop:8}),howTitle:e.cardTitle,item:Ol(e,{paddingHorizontal:e.cardPad,paddingVertical:12,gap:8}),fallbackCard:{...Ol(e,{paddingHorizontal:e.cardPad,paddingVertical:12}),borderWidth:1,borderStyle:"dashed",borderColor:e.look.line}}}function ka(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth,a=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n}),s=e.slots.card,d=nn(s);return r.StyleSheet.create({srOnly:{position:"absolute",width:1,height:1,overflow:"hidden"},lead:{...a(l.size.body,l.lineHeight.normal,t.text.muted),paddingHorizontal:n.lg,paddingBottom:n.md},howCard:{borderRadius:i.lg,backgroundColor:t.surfaceSubtle,padding:n.lg,gap:n.md,marginTop:n.sm,...rn(s)},howTitle:{...a(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),letterSpacing:-.4,...d},howRow:{flexDirection:"row",gap:n.md},howNumber:{...face(e,"monoBold"),fontSize:l.size.caption,lineHeight:Math.round(l.size.body*l.lineHeight.snug),color:t.brandInk,minWidth:n.xl},howText:{flex:1,gap:n.xs/2},howStepTitle:{...a(l.size.body,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...d},howStepBody:{...a(l.size.caption,l.lineHeight.normal,t.text.secondary),...d},searchBar:{flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.md+n.xs/2,height:n.xxl+n.md,marginHorizontal:n.lg,marginBottom:n.sm,borderRadius:i.lg+n.xs/2,backgroundColor:t.surfaceSubtle,borderWidth:o,borderColor:t.borderHairlineGreen,...rn(e.slots.input,o)},searchInput:{flex:1,...a(l.size.body,l.lineHeight.snug,t.text.primary),paddingVertical:0,...nn(e.slots.input)},clearGlyph:a(l.size.heading,l.lineHeight.tight,t.text.muted),uploadWrap:{paddingHorizontal:n.lg,paddingBottom:n.md,gap:n.sm},list:{paddingHorizontal:n.lg,paddingBottom:n.xxl,gap:n.md},sectionLabel:{...a(l.size.caption,l.lineHeight.normal,t.text.secondary,"bold"),textTransform:"uppercase",letterSpacing:l.letterSpacing.eyebrow/2},fallbackCard:{borderRadius:i.lg-n.xs/2,borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md,gap:n.md,...rn(s,1)},fallbackHeader:{flexDirection:"row",alignItems:"center",gap:n.md,minHeight:n.xxl+n.md},fallbackCopy:{flex:1,gap:n.xs/2},fallbackTitle:{...a(l.size.body,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...d},fallbackSubtitle:{...a(l.size.caption,l.lineHeight.normal,t.text.muted),...d},fallbackForm:{gap:n.sm},item:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md,gap:n.sm,...rn(s,1)},itemHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.sm},itemName:{flex:1,...a(l.size.body,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),...d},itemDistance:{...face(e,"mono"),fontSize:l.size.tiny,lineHeight:l.size.body,color:t.text.muted},itemAddress:{...a(l.size.caption,l.lineHeight.normal,t.text.primary),...d},itemPhone:{...a(l.size.caption,l.lineHeight.normal,t.text.muted),...d},badge:{alignSelf:"flex-start",borderRadius:i.pill,paddingHorizontal:n.sm+1,paddingVertical:n.xs},badgePositive:{backgroundColor:t.badgeBgPositive},badgeCaution:{backgroundColor:t.badgeBgCaution},badgeNeutral:{backgroundColor:t.badgeBgNeutral},badgeLabel:{...a(l.size.micro,l.lineHeight.snug,t.text.muted,"bold")},badgePositiveText:{color:t.success},badgeCautionText:{color:t.cautionAccent},badgeNeutralText:{color:t.text.muted},footer:{gap:n.sm,paddingTop:n.sm},footerLoading:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:n.sm,minHeight:n.xxl+n.md},footerRetry:{minHeight:n.xxl+n.md,alignItems:"center",justifyContent:"center"},footerRetryLabel:{...a(l.size.bodyTight,l.lineHeight.snug,t.brandInk,"bold")}})}var ja=/* @__PURE__ */Object.freeze({title:"Request records",resultTitle:"Request status",addClinic:"Add a clinic",atCap:`Up to ${Bn} clinics`,send:e=>`Send ${e} ${e===1?"request":"requests"}`,sending:"Sending…",addToContinue:"Add a clinic to continue",tryAgain:"Try again",remove:e=>`Remove ${e}`,emailToAdd:"Email to add",perClinic:"Per-clinic result",sent:"Sent",notSent:"Not sent",allFailed:"We couldn’t send any of these requests. See the details below and try again.",partial:(e,t,r)=>`${e} of ${t} requests sent. ${r} couldn’t be sent.`,allSent:e=>`${e} ${e===1?"request":"requests"} sent.`,responded:(e,t)=>`${e} of ${t} ${t===1?"clinic":"clinics"} responded`});var Sa=25,Ca=5;function Ra(t){let[r,n]=e.useState({list:t,shown:Ca}),i=r.list===t?r.shown:Ca,l=e.useCallback(()=>{n(e=>({list:t,shown:(e.list===t?e.shown:Ca)+Ca}))},[t]);return{visible:t.slice(0,i),hasMore:t.length>i,showMore:l}}var Ta=class extends Error{constructor(){super("Signature upload failed"),this.name="SignatureUploadLegError"}};function _a(e){return e instanceof Ta}function za(e,t,r,n){let i={owner_name:t,pet_name:r,clinic_name:n},l=false,o=e.scopeTemplate.replace(/\{([^{}]+)\}/g,(e,t)=>Object.prototype.hasOwnProperty.call(i,t)?i[t]??"":(l=true,""));return l||/[{}]/.test(o)?null:o}function Ia(e){return e===null||e.emailStatus!=="verified"&&e.emailStatus!=="unverified"}function Da(t,r,n){let[i,l]=e.useState(t.ownerName),[o,a]=e.useState(""),[s,d]=e.useState(null),[c,u]=e.useState(""),[h,p]=e.useState([]),[g,f]=e.useState([]),[m,b]=e.useState(null),[y,x]=e.useState(null),[w,v]=e.useState(false),[k,j]=e.useState(false),[S,C]=e.useState(null),[R,T]=e.useState(0),_=e.useRef(false),z=e.useRef(false),I=e.useRef(0),D=e.useRef(mt()),H=e.useRef(null),V=e.useRef(null),P=e.useRef(0);e.useEffect(()=>(_.current=true,z.current=false,v(false),()=>{_.current=false,P.current+=1,I.current+=1,H.current=null,V.current?.abort()}),[r]),e.useEffect(()=>{let e=true;return b(null),H.current=null,r.getAuthorizationCopy().then(t=>{e&&(t.ok?(b(t.value),x(null)):x(t.error))}).catch(()=>{e&&x(makeEverfurError("internalError"))}),()=>{e=false}},[r,R]),e.useEffect(()=>{let e=true;return f([]),r.recentClinics({limit:5}).then(t=>{e&&t.ok&&f(t.value.clinics)}).catch(()=>{}),()=>{e=false}},[r]);let L=()=>{H.current=null,x(null)},O=s?.name??o.trim(),E=m?za(m,i.trim(),t.petName,O):null,A=Ia(s),$=Ra(h),B=!!(m&&E&&i.trim()&&t.petName.trim()&&O&&(!A||/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(c.trim()))&&n),F=async()=>{if(z.current)return;let e=++I.current;j(true);try{let t=await r.searchClinics({query:o.trim(),limit:Sa});if(!_.current||e!==I.current)return;t.ok?(p(t.value.clinics),x(null)):x(t.error)}catch{_.current&&e===I.current&&x(makeEverfurError("internalError"))}finally{_.current&&e===I.current&&j(false)}},M=async()=>{if(z.current||S||!B||!m||!E||!n)return;z.current=true;let e=P.current,l=()=>_.current&&P.current===e;v(true),x(null);try{if(!H.current){V.current=new AbortController;let e=await n({petRef:t.petRef,petName:t.petName,ownerName:i.trim(),clinicName:O,authorizationVersion:m.authorizationVersion,scopeText:E,signal:V.current.signal});if(!l()||e===null)return;let r=s&&(!A||s.emailStatus==="none")?{clinicId:s.id}:{clinicFreeText:O};H.current={petRef:t.petRef,ownerName:i.trim(),authorizationVersion:m.authorizationVersion,...r,...A?{clinicEmail:c.trim().toLowerCase()}:{},...e.signatureId!==void 0?{signatureId:e.signatureId}:{signaturePngBase64:e.signaturePngBase64},idempotencyKey:D.current()}}if(!l())return;let e=await r.createClinicRequest(H.current);if(!l())return;if(!e.ok){x(e.error);return}if(e.value.petRef!==t.petRef){x(makeEverfurError("internalError"));return}C(e.value),H.current=null,t.onCreated?.(e.value)}catch{l()&&x(makeEverfurError("internalError"))}finally{z.current=false,l()&&v(false)}};return{ownerName:i,query:o,clinic:s,email:c,clinics:h,copy:m,scope:E,error:y,busy:w,searching:k,created:S,ready:B,needsEmail:A,visibleClinics:$.visible,hasMoreClinics:$.hasMore,showMoreClinics:$.showMore,recent:h.length===0&&s===null?g:[],setOwnerName(e){z.current||(L(),l(e))},setQuery(e){z.current||(L(),I.current+=1,j(false),p([]),d(null),u(""),a(e))},setEmail(e){z.current||(L(),u(e))},selectClinic(e){z.current||(L(),I.current+=1,j(false),p([]),d(e),a(e.name),u(""))},invalidate:L,search:F,submit:M,retryCopy(){x(null),T(e=>e+1)}}}var Ha=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Va(e){return e.clinic?.name??e.freeText??""}function Pa(e){return Ia(e.clinic)}function La(t,r,n,i,l){let[o,a]=e.useState(t.ownerName),[s,d]=e.useState(""),[c,u]=e.useState([]),[h,p]=e.useState([]),[g,f]=e.useState([]),[m,b]=e.useState(null),[y,x]=e.useState(null),[w,v]=e.useState(false),[k,j]=e.useState(false),[S,C]=e.useState(null),[R,T]=e.useState(null),[_,z]=e.useState(0),I=e.useRef(false),D=e.useRef(false),H=e.useRef(0),V=e.useRef(0),P=e.useRef(mt()),L=e.useRef(null),O=e.useRef(null);e.useEffect(()=>(I.current=true,D.current=false,v(false),()=>{I.current=false,V.current+=1,H.current+=1,L.current=null,O.current?.abort()}),[r,n]),e.useEffect(()=>{let e=true;return b(null),L.current=null,r.getAuthorizationCopy().then(t=>{e&&(t.ok?(b(t.value),x(null)):x(t.error))}).catch(()=>{e&&x(makeEverfurError("internalError"))}),()=>{e=false}},[r,_]),e.useEffect(()=>{let e=true;return p([]),r.recentClinics({limit:5}).then(t=>{e&&t.ok&&p(t.value.clinics)}).catch(()=>{}),()=>{e=false}},[r]);let E=Ra(c),A=()=>{L.current=null,x(null)},$=g.map(Va),B=yn(t.petName),F=m?$.map(e=>za(m,o.trim(),B,e)):[],M=F.every(e=>e!==null)?F.join(`\n\n`):null,q=g.length>0&&g.every(e=>!Pa(e)||Ha.test(e.email.trim())),N=g.length>=Bn,W=!!(m&&M&&o.trim()&&q&&i)&&S===null,U=async()=>{if(D.current)return;let e=++H.current;j(true);try{let t=await r.searchClinics({query:s.trim(),limit:Sa});if(!I.current||e!==H.current)return;t.ok?(u(t.value.clinics),x(null)):x(t.error)}catch{I.current&&e===H.current&&x(makeEverfurError("internalError"))}finally{I.current&&e===H.current&&j(false)}},G=e=>{D.current||N||S!==null||e.clinic!==null&&g.some(t=>t.clinic?.id===e.clinic?.id)||(A(),f(t=>[...t,{...e,key:P.current(),idempotencyKey:P.current()}]),u([]),d(""))},K=async()=>{if(D.current||S!==null||!W||!m||!M||!i)return;D.current=true;let e=V.current,r=()=>I.current&&V.current===e;v(true),x(null);try{if(L.current===null){O.current=new AbortController;let e=await i({petRef:t.petRef,petName:B,ownerName:o.trim(),clinicName:$.join(", "),authorizationVersion:m.authorizationVersion,scopeText:M,signal:O.current.signal});if(!r()||e===null)return;if(L.current=e,e.signaturePngBase64!==void 0&&l!==void 0){let t=O.current;try{let n=await l(e.signaturePngBase64,t.signal);if(!r())return;L.current={signatureId:n.signatureId}}catch(e){if(!_a(e)||t.signal.aborted)throw e;if(!r())return}}}let a=L.current,s=g.map(e=>({...e.clinic!==null&&(!Pa(e)||e.clinic.emailStatus==="none")?{clinicId:e.clinic.id}:{clinicFreeText:Va(e)},...Pa(e)?{clinicEmail:e.email.trim().toLowerCase()}:{},...a.signatureId!==void 0?{signatureId:a.signatureId}:{signaturePngBase64:a.signaturePngBase64},idempotencyKey:e.idempotencyKey})),d=await n.createClinicRequestBatch({petRef:t.petRef,ownerName:o.trim(),authorizationVersion:m.authorizationVersion,clinics:s});if(!r())return;if(!d.ok){x(d.error);return}C(d.value),t.onCreated?.(d.value),Y(d.value.requestGroupId,e)}catch{r()&&x(makeEverfurError("internalError"))}finally{D.current=false,r()&&v(false)}},Y=async(e,n)=>{try{let i=await r.getRequestGroup(e);if(!I.current||V.current!==n)return;i.ok&&i.value.petRef===t.petRef&&T(i.value)}catch{}},X=async()=>{S===null||D.current||await Y(S.requestGroupId,V.current)};return{ownerName:o,query:s,clinics:c,copy:m,scopeText:M,error:y,busy:w,searching:k,drafts:g,outcome:S,group:R,ready:W,atCap:N,visibleClinics:E.visible,hasMoreClinics:E.hasMore,showMoreClinics:E.showMore,recent:c.length===0?h.filter(e=>!g.some(t=>t.clinic?.id===e.id)):[],setOwnerName(e){D.current||(A(),a(e))},setQuery(e){D.current||(H.current+=1,j(false),u([]),d(e))},search:U,addClinic(e){G({clinic:e,freeText:null,email:""})},addFreeText(){let e=s.trim();e.length!==0&&G({clinic:null,freeText:e,email:""})},setDraftEmail(e,t){D.current||(A(),f(r=>r.map(r=>r.key===e?{...r,email:t}:r)))},removeDraft(e){D.current||S!==null||(A(),f(t=>t.filter(t=>t.key!==e)))},submit:K,refreshGroup:X,retryCopy(){x(null),z(e=>e+1)}}}var Oa=/* @__PURE__ */Object.freeze({}),Ea=100,Aa=20;function $a(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 Ba(t,n){let i=typeof t=="number",l=e.useRef(null),[o,a]=e.useState(null),s=e.useRef(null),d=e.useRef(null),c=e.useRef(true),u=e.useCallback(()=>{d.current!==null&&clearTimeout(d.current),d.current=null},[]);e.useEffect(()=>(c.current=true,()=>{c.current=false,u()}),[u]);let h=e.useCallback(function e(t){l.current?.measureInWindow((n,i)=>{let l=s.current;if(!c.current||l===null)return;let o=$a(i,l.y,l.height,r.Dimensions.get("window").height);if(o!==null){a(e=>e!==null&&e.chatTop===o.chatTop&&e.parentTop===o.parentTop?e:o);return}t>=Aa||(d.current=setTimeout(()=>{d.current=null,e(t+1)},Ea))})},[]),p=e.useCallback(e=>{let{y:t,height:r}=e.nativeEvent.layout;s.current={y:t,height:r},u(),h(0)},[h,u]);return e.useMemo(()=>{if(!n)return{avoidingProps:Oa,probeRef:null,topInWindow:null};let e=o?.parentTop??0;return{avoidingProps:e>0?{keyboardVerticalOffset:e,onLayout:p}:{onLayout:p},probeRef:l,topInWindow:o?.chatTop??null}},[n,i,t,o,p])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */n.jsx(r.View,{ref:e,collapsable:false,pointerEvents:"none",style:Fa})}var Fa=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function Ma(e){let t=z(e);if(t===null||t.protocol!=="https:"||t.username||t.password||t.port&&t.port!=="443")return false;let r=t.hostname.toLowerCase();return r==="s3.amazonaws.com"||r.endsWith(".s3.amazonaws.com")||/^(?:[a-z0-9][a-z0-9.-]*\.)?s3[.-][a-z0-9-]+\.amazonaws\.com$/.test(r)||/^(?:[a-z0-9][a-z0-9.-]*\.)?s3\.dualstack\.[a-z0-9-]+\.amazonaws\.com$/.test(r)||r==="s3-accelerate.amazonaws.com"||r.endsWith(".s3-accelerate.amazonaws.com")||r==="s3-accelerate.dualstack.amazonaws.com"||r.endsWith(".s3-accelerate.dualstack.amazonaws.com")}var qa="Signature upload failed",Na=3e4;function Wa(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}async function registerRnSignature(e,t,r,n){let i=()=>new Error(qa),l=Wa(e);if(l<=0||r.aborted)throw i();let o=await t.initiateSignatureUpload(l);if(!o.ok||r.aborted||!Ma(o.value.uploadUrl))throw i();let a=new FormData;for(let[e,t]of Object.entries(o.value.uploadFields))a.append(e,t);a.append("file",{uri:`data:image/png;base64,${e}`,name:"signature.png",type:"image/png"});let s=new AbortController,d=()=>s.abort();r.addEventListener("abort",d,{once:true});let c=setTimeout(d,Na);try{if(!(await(n??fetch)(o.value.uploadUrl,{method:"POST",body:a,credentials:"omit",signal:s.signal})).ok||r.aborted)throw i()}catch{throw r.aborted?i():new Ta}finally{clearTimeout(c),r.removeEventListener("abort",d)}let u=await t.completeSignatureUpload(o.value.uploadId);if(!u.ok||r.aborted)throw i();return{signatureId:u.value}}var Ua=/* @__PURE__ */Object.freeze({width:360,height:120});function Ga(e,t){return{width:e,height:t,pixels:new Uint8Array(e*t)}}function Ka(e,t,r,n){for(let i=-n;i<=n;i+=1)for(let l=-n;l<=n;l+=1){if(l*l+i*i>n*n+n)continue;let o=t+l,a=r+i;o<0||a<0||o>=e.width||a>=e.height||(e.pixels[a*e.width+o]=1)}}var Ya=16384;function Xa(e,t){let[r,n]=e;if(!Number.isFinite(r)||!Number.isFinite(n))return null;let i=Math.min(2*t.width,Math.max(-t.width,Math.round(r))),l=Math.min(2*t.height,Math.max(-t.height,Math.round(n)));return[i,l]}function Qa(e,t,r,n,i){let[l,o]=t,[a,s]=r,d=Math.abs(a-l),c=-Math.abs(s-o),u=l<a?1:-1,h=o<s?1:-1,p=d+c,g=0;for(;g<i&&(Ka(e,l,o,n),g+=1,!(l===a&&o===s));){let e=2*p;e>=c&&(p+=c,l+=u),e<=d&&(p+=d,o+=h)}return g}function rasterizeStrokes(e,t=1){let r=Ga(Ua.width,Ua.height);for(let n of e){let e=[];for(let t of n){let n=Xa(t,r);n!==null&&e.push(n)}if(e.length===0)continue;if(e.length===1){let[n,i]=e[0];Ka(r,n,i,t);continue}let i=Ya;for(let n=1;n<e.length&&i>0;n+=1)i-=Qa(r,e[n-1],e[n],t,i)}return r}var Ja="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,'-",Za="ehhvhhhuhhuhhufgggggfuhhhhhuvgguggvvggugggfggnhhfhhhvhhhv44444v72222ichikokihggggggvhrllhhhhpljhhhehhhhheuhhugggehhhliduhhukihfgge11uv444444hhhhhhehhhhha4hhhllrhhha4ahhhha4444v1248gv00e1fhfgguhhhu00fgggf11fhhhf00ehvgf698s8880fhhf1egguhhhh40c444e20622icggikokic44444e00qllhh00uhhhh00ehhhe0uhhugg0fhhf1100mpggg00fge1u88s889600hhhjd00hhha400hhlla00ha4ah00hhf1e00v248vehjlphe4c4444eeh1248vv2421he26aiv22vgu11he68guhhev124888ehhehheehhf12c00000cc0000c48c480000000v000",es="0123456789abcdefghijklmnopqrstuv",ts=5,rs=7,ns=ts+1;function is(e,t){let r=Ja.indexOf(e);return r<0?0:es.indexOf(Za.charAt(r*rs+t))}function rasterizeTypedName(e){let t=Ga(Ua.width,Ua.height),r=e.trim();if(r.length===0)return t;let n=[...r],i=4;for(;i>1&&(n.length*ns-1)*i>t.width-8;)i-=1;let l=(n.length*ns-1)*i,o=Math.max(0,Math.floor((t.width-l)/2)),a=Math.floor((t.height-rs*i)/2);return n.forEach((e,r)=>{let n=o+r*ns*i;for(let r=0;r<rs;r+=1){let l=is(e,r);for(let e=0;e<ts;e+=1)if((l>>ts-1-e&1)!==0)for(let l=0;l<i;l+=1)for(let o=0;o<i;o+=1){let s=n+e*i+o,d=a+r*i+l;s<t.width&&d<t.height&&(t.pixels[d*t.width+s]=1)}}}),t}var ls=class{constructor(){this.bytes=[];this.acc=0;this.count=0}writeBits(e,t){for(this.acc|=e<<this.count,this.count+=t;this.count>=8;)this.bytes.push(this.acc&255),this.acc>>>=8,this.count-=8}writeCode(e,t){let r=0;for(let n=0;n<t;n+=1)r=r<<1|e>>n&1;this.writeBits(r,t)}finish(){return this.count>0&&this.bytes.push(this.acc&255),Uint8Array.from(this.bytes)}};function os(e,t){t<144?e.writeCode(48+t,8):t<256?e.writeCode(400+(t-144),9):t<280?e.writeCode(t-256,7):e.writeCode(192+(t-280),8)}var as=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],ss=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ds=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],cs=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function us(e,t,r){let n=as.length-1;for(;as[n]>t;)n-=1;os(e,257+n),ss[n]>0&&e.writeBits(t-as[n],ss[n]);let i=ds.length-1;for(;ds[i]>r;)i-=1;e.writeCode(i,5),cs[i]>0&&e.writeBits(r-ds[i],cs[i])}var hs=32768,ps=3,gs=258,fs=15,ms=64;function bs(e){let t=new ls;t.writeBits(1,1),t.writeBits(1,2);let r=new Int32Array(1<<fs).fill(-1),n=new Int32Array(e.length).fill(-1),i=t=>(e[t]<<10^e[t+1]<<5^e[t+2])&(1<<fs)-1,l=t=>{if(t+ps>e.length)return;let l=i(t);n[t]=r[l],r[l]=t},o=0;for(;o<e.length;){let a=0,s=0;if(o+ps<=e.length){let t=r[i(o)],l=0,d=Math.min(gs,e.length-o);for(;t>=0&&l<ms&&o-t<=hs;){let r=0;for(;r<d&&e[t+r]===e[o+r];)r+=1;if(r>a&&(a=r,s=o-t,r===d))break;t=n[t],l+=1}}if(a>=ps){us(t,a,s);for(let e=0;e<a;e+=1)l(o+e);o+=a}else os(t,e[o]),l(o),o+=1}return os(t,256),t.finish()}function ys(e){let t=1,r=0;for(let n of e)t=(t+n)%65521,r=(r+t)%65521;return(r<<16|t)>>>0}var xs=null;function ws(e){if(xs===null){xs=new Uint32Array(256);for(let e=0;e<256;e+=1){let t=e;for(let e=0;e<8;e+=1)t=t&1?3988292384^t>>>1:t>>>1;xs[e]=t>>>0}}let t=4294967295;for(let r of e)t=xs[(t^r)&255]^t>>>8;return(t^4294967295)>>>0}function vs(e){return[e>>>24&255,e>>>16&255,e>>>8&255,e&255]}function ks(e,t){let r=Uint8Array.from([...e].map(e=>e.charCodeAt(0))),n=new Uint8Array(r.length+t.length);return n.set(r,0),n.set(t,r.length),[...vs(t.length),...n,...vs(ws(n))]}var js="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Ss(e){let t="";for(let r=0;r<e.length;r+=3){let n=e[r],i=r+1<e.length?e[r+1]:0,l=r+2<e.length?e[r+2]:0,o=n<<16|i<<8|l;t+=js.charAt(o>>18&63)+js.charAt(o>>12&63),t+=r+1<e.length?js.charAt(o>>6&63):"=",t+=r+2<e.length?js.charAt(o&63):"="}return t}function encodeSignaturePng(e){let{width:t,height:r,pixels:n}=e,i=Math.ceil(t/8)+1,l=new Uint8Array(i*r);for(let e=0;e<r;e+=1){let r=e*i;l[r]=0,l.fill(255,r+1,r+i);for(let i=0;i<t;i+=1)if(n[e*t+i]===1){let e=r+1+(i>>3);l[e]=l[e]&~(128>>(i&7))}}let o=bs(l),a=new Uint8Array(2+o.length+4);a[0]=120,a[1]=1,a.set(o,2),a.set(vs(ys(l)),2+o.length);let s=Uint8Array.from([...vs(t),...vs(r),1,0,0,0,0]),d=Uint8Array.from([137,80,78,71,13,10,26,10,...ks("IHDR",s),...ks("IDAT",a),...ks("IEND",new Uint8Array(0))]);return Ss(d)}var Cs=2.6,Rs="#111111";function Ts(e,t){let r=[];return e.forEach((e,n)=>{let i=r=>{let n=e[r];return[n[0]/t,n[1]/t]};if(e.length===1){let[e,t]=i(0);r.push({key:`${n}-0`,cx:e,cy:t,length:0,angle:0});return}for(let t=1;t<e.length;t+=1){let[e,l]=i(t-1),[o,a]=i(t);r.push({key:`${n}-${t}`,cx:(e+o)/2,cy:(l+a)/2,length:Math.hypot(o-e,a-l),angle:Math.atan2(a-l,o-e)})}}),r}var _s=8,zs=2;function SignaturePad({onChange:t,disabled:i=false,mode:l}){let o=Is(),[a,s]=e.useState("draw"),d=l!==void 0,c=l??a,[u,h]=e.useState(""),[p,g]=e.useState([]),[f,m]=e.useState(0),b=e.useRef([]),y=e.useRef(null),x=f>0?Ua.width/f:1,w=e.useRef(x);w.current=x;let v=e.useRef(i);v.current=i,e.useEffect(()=>{if(c==="type"){br(t,u.trim().length>0?encodeSignaturePng(rasterizeTypedName(u)):null);return}let e=p.reduce((e,t)=>e+t.length,0);br(t,e>=_s?encodeSignaturePng(rasterizeStrokes(p)):null)},[c,u,p,t]);let k=e=>{let{locationX:t,locationY:r}=e.nativeEvent;return[t*w.current,r*w.current]},j=()=>{let e=b.current,t=y.current;b.current=[],y.current=null,g(r=>[...r.filter(e=>e!==t),e])},S=e.useMemo(()=>r.PanResponder.create({onStartShouldSetPanResponder:()=>!v.current,onMoveShouldSetPanResponder:()=>!v.current,onPanResponderTerminationRequest:()=>false,onPanResponderGrant:e=>{b.current=[k(e)]},onPanResponderMove:e=>{let t=k(e),r=b.current[b.current.length-1];if(r!==void 0&&Math.abs(r[0]-t[0])<zs&&Math.abs(r[1]-t[1])<zs)return;b.current=[...b.current,t];let n=y.current,i=b.current;y.current=i,g(e=>[...e.filter(e=>e!==n),i])},onPanResponderRelease:()=>j(),onPanResponderTerminate:()=>j()}),[]),C=e.useCallback(()=>{v.current||(b.current=[],y.current=null,g([]),h(""))},[]),R=e.useCallback(()=>{C(),s(e=>e==="draw"?"type":"draw")},[C]),T=e.useRef(c);e.useEffect(()=>{T.current!==c&&(T.current=c,b.current=[],y.current=null,g([]),h(""))},[c]);let _=e=>m(e.nativeEvent.layout.width),z=p.reduce((e,t)=>e+t.length,0);/* @__PURE__ */
220
220
  return n.jsxs(r.View,{style:o.container,testID:"records-signature-pad",children:[d?null:/* @__PURE__ */n.jsx(Text,{style:o.label,children:c==="draw"?on.draw:on.type}),c==="type"?/* @__PURE__ */n.jsx(tn,{accessibilityLabel:on.type,style:o.input,value:u,maxLength:100,editable:!i,autoComplete:"off",autoCorrect:false,onChangeText:e=>{v.current||h(e)}}):null,
221
221
  /* @__PURE__ */n.jsx(r.View,{onLayout:_,style:[o.canvas,{height:f>0?f/3:120}],accessible:true,accessibilityLabel:on.sign,accessibilityRole:"image",testID:"records-signature-canvas",...c==="draw"?S.panHandlers:{},children:c==="type"?/* @__PURE__ */n.jsx(Text,{style:o.typedPreview,numberOfLines:1,adjustsFontSizeToFit:true,children:u.trim()}):Ts(p,x).map(e=>{let t=e.length+Cs;/* @__PURE__ */
222
222
  return n.jsx(r.View,{pointerEvents:"none",style:[o.segment,{width:t,left:e.cx-t/2,top:e.cy-Cs/2,transform:[{rotate:`${e.angle}rad`}]}]},e.key)})}),
@@ -249,7 +249,7 @@ return n.jsxs(r.View,{style:m.option,accessible:true,accessibilityRole:"text",ac
249
249
  /* @__PURE__ */n.jsx(Pill,{label:on.search,kind:"outline",disabled:!v,onPress:k,testID:"records-batch-search"}),h.query.trim().length>0&&h.clinics.length===0&&!h.searching?/* @__PURE__ */n.jsx(Pill,{label:ja.addClinic,kind:"link",disabled:h.busy,onPress:h.addFreeText,testID:"records-batch-add-typed"}):null,h.searching?/* @__PURE__ */n.jsx(Text,{accessibilityLiveRegion:"polite",style:f.muted,children:fn.loading}):null,h.recent.length>0?/* @__PURE__ */n.jsx(Text,{accessibilityRole:"header",style:f.fieldLabel,children:on.recentlyUsed}):null,h.recent.map(e=>j(`recent-${e.id}`,e)),h.visibleClinics.map(e=>j(e.id,e)),h.hasMoreClinics?/* @__PURE__ */n.jsx(Pill,{label:on.moreClinics,kind:"link",disabled:h.busy,onPress:h.showMoreClinics,testID:"records-clinic-results-more"}):null]})]}),
250
250
  /* @__PURE__ */n.jsxs(r.View,{style:m.scopeCard,accessibilityRole:"summary",testID:"records-batch-scope",children:[
251
251
  /* @__PURE__ */n.jsx(Text,{accessibilityRole:"header",style:m.sectionTitle,children:on.scopeHeading}),h.copy?h.drafts.length>0&&h.ownerName.trim()?/* @__PURE__ */n.jsx(Text,{style:m.scopeText,testID:"records-batch-scope-text",children:h.scopeText??makeEverfurError("internalError").displayMessage}):null:!h.error&&/* @__PURE__ */n.jsx(Text,{accessibilityLiveRegion:"polite",style:f.muted,children:fn.loading})]}),!t.onCaptureSignature&&/* @__PURE__ */n.jsx(SignaturePad,{onChange:d,disabled:h.busy}),!p&&h.ready&&/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",style:f.bodyText,children:on.missingSignature}),h.error&&/* @__PURE__ */n.jsx(r.View,{style:f.errorBanner,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",children:/* @__PURE__ */n.jsx(Text,{style:f.errorText,children:h.error.displayMessage})}),!h.copy&&h.error&&/* @__PURE__ */n.jsx(Pill,{label:fn.retry,kind:"outline",onPress:h.retryCopy})]}),
252
- /* @__PURE__ */n.jsx(RecordsFootnote,{})]}),h.outcome?null:/* @__PURE__ */n.jsx(r.View,{style:[m.footer,{paddingBottom:Math.max(b.bottom,g.space.md)}],testID:"records-batch-footer",children:/* @__PURE__ */n.jsx(Pill,{label:x,disabled:h.busy||!h.ready||!p,busy:h.busy,onPress:()=>{r.Keyboard.dismiss(),h.submit()},testID:"records-batch-send"})})]})]})})}function Ps(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?Es(t):Ol(Es(t),Ls(r)),[t,r])}function Ls(e){return{option:El(e,{paddingHorizontal:e.cardPad,paddingVertical:12,gap:4}),draft:El(e,{gap:8}),scopeCard:El(e,{gap:8}),sectionTitle:e.cardTitle,footer:{backgroundColor:e.ground}}}function Es(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth,a=n.xxl+n.md,s=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",gap:n.md,paddingHorizontal:n.lg,paddingTop:n.xs,paddingBottom:n.md,...rn(e.slots.header)},title:{flex:1,...s(l.size.heading,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),...nn(e.slots.header)},close:{minHeight:a,minWidth:a,alignItems:"center",justifyContent:"center"},closeLabel:s(l.size.body,l.lineHeight.snug,t.linkInk,"bold"),content:{paddingHorizontal:n.lg,paddingBottom:n.xl,gap:n.lg},lead:s(l.size.body,l.lineHeight.normal,t.text.muted),block:{gap:n.sm},sectionTitle:{...s(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold")},option:{minHeight:a,justifyContent:"center",gap:n.xs/2,borderRadius:i.md,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,paddingHorizontal:n.md,paddingVertical:n.sm+n.xs/2,...rn(e.slots.card,1)},optionName:{...s(l.size.body,l.lineHeight.snug,t.text.primary,"bold"),...nn(e.slots.card)},draft:{gap:n.sm,borderRadius:i.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:n.md,...rn(e.slots.card,1)},remove:{alignSelf:"flex-start",minHeight:a,paddingHorizontal:0},scopeCard:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surfaceCream,padding:n.lg,gap:n.sm,...rn(e.slots.card,1)},scopeText:{...s(l.size.bodyTight,l.lineHeight.relaxed,t.text.secondary),...nn(e.slots.card)},footer:{paddingHorizontal:n.lg,paddingTop:n.md,borderTopWidth:o,borderTopColor:t.borderHairlineGreen,backgroundColor:t.background}})}var Os=/* @__PURE__ */Object.freeze({scopeHeading:"What we ask for",scopeBody:"You’re asking your pet’s clinic to release their medical records to Everfur, on your behalf, so we can organize them for you.",whatWeDo:/* @__PURE__ */Object.freeze(["We email the clinic a signed copy of this authorization.","When records arrive, our team reviews them before they appear in your app.","You can revoke this request at any time."]),retentionNote:"We keep the records you receive so you always have them. See our Privacy Policy for how records are stored and used.",authorizeLabel:e=>`I’m ${yn(e)}’s owner. I authorize Everfur to request these records on my behalf.`,missingSignatureError:"Please add your signature before submitting.",missingDraftError:"Something went wrong with your selection. Please go back and pick the clinic again.",newClinicDirectSendNote:"We’ll email this clinic directly to request your pet’s medical records. Clinics usually reply within a week.",titleFreeText:"Check and send",titleDirectory:"Check and send",leadWeb:e=>`The clinic gets a secure request, with your permission to release ${yn(e)}’s records to Everfur.`,leadNative:"The clinic gets a secure request, with your permission.",whatHappensNext:"What happens next",whatHappensNextBody:"Most clinics respond within 3 to 5 business days. We follow up automatically, and you can cancel any time before the records arrive.",noEmailNote:(e,t)=>`We don’t have an email on file for ${t}. Add it so we can request ${yn(e)}’s records.`,emailLabel:"Clinic email for records",emailPlaceholder:"records@clinic.com",emailRequired:"Add the clinic’s records email to send the request.",emailInvalid:"That email doesn’t look right. Check it and try again.",reuseSignature:"Reuse a previous signature",reuseHint:"…or sign again below",reuseTileA11y:"Use this earlier signature",reuseTileSelectedA11y:"Earlier signature, selected",signType:"Type your name to sign",signDraw:"Sign with your finger",clear:"Clear",clearA11y:"Clear signature",fullName:"Your full name",fullNamePlaceholder:"Jane Doe",toType:"Can’t draw? Type your name instead",toDraw:"Draw your signature instead",signatureHint:e=>`Your signature is added to the authorization sent to ${e}.`,submit:"Send request",submitting:"Sending…"});var As="value_text",$s=64,Bs=512;function isFactReviewerLocked(e){return e!==null&&e.httpStatus===409&&!Ve(e)}var Fs=/* @__PURE__ */Object.freeze({num:"value_num",date:"value_date",bool:"value_bool",text:As}),Ms=/^[+-]?(?:\d+\.?\d*|\.\d+)$/,qs=/^\d{4}-\d{2}-\d{2}$/;function inferFactValueKind(e){if(e==null)return"text";let t=e.trim();return Ms.test(t)?"num":qs.test(t)&&!Number.isNaN(Date.parse(t))?"date":t==="true"||t==="false"?"bool":"text"}function factCorrectionFor(e,t){let r=t.trim(),n=inferFactValueKind(e);if(n==="num"&&Ms.test(r)){let e=Number(r);if(Number.isFinite(e))/* @__PURE__ */return Object.freeze({[Fs.num]:e})}return n==="date"&&qs.test(r)&&!Number.isNaN(Date.parse(r))?/* @__PURE__ */Object.freeze({[Fs.date]:r}):/* @__PURE__ */Object.freeze(n==="bool"&&(r==="true"||r==="false")?{[Fs.bool]:r==="true"}:{[Fs.text]:r})}var Ns=/* @__PURE__ */t.z.string().nullish(),Ws=/* @__PURE__ */t.z.number().nullish(),Us=/* @__PURE__ */t.z.object({collected_at:Ns,at:Ns,value:Ws,unit:Ns,qualitative_result:Ns,ref_low:Ws,ref_high:Ws,status:Ns,source_clinic:Ns,source_doc_id:Ns,doc_id:Ns,reviewed:/* @__PURE__ */t.z.boolean().nullish()}),Gs=/* @__PURE__ */t.z.object({collected_at:Ns,at:Ns,value:Ws,unit:Ns,qualitative_result:Ns,status:Ns}),Ks=/* @__PURE__ */t.z.object({marker_id:/* @__PURE__ */t.z.string().min(1),canonical_name:Ns,name:Ns,loinc_code:Ns,canonical_unit:Ns,unit:Ns,panel_name:Ns,panel:Ns,meaning_text:Ns,meaning:Ns,latest:/* @__PURE__ */Gs.nullish(),trajectory:Ns,points:/* @__PURE__ */t.z.array(Us).optional()}),Ys=/* @__PURE__ */t.z.object({total_markers:/* @__PURE__ */t.z.number().int().nonnegative(),in_range_count:/* @__PURE__ */t.z.number().int().nonnegative(),out_of_range_count:/* @__PURE__ */t.z.number().int().nonnegative(),unknown_count:/* @__PURE__ */t.z.number().int().nonnegative()}),Xs=/* @__PURE__ */t.z.object({markers:/* @__PURE__ */t.z.array(Ks).optional(),summary:/* @__PURE__ */Ys.nullish(),disclaimer:/* @__PURE__ */t.z.string().optional(),featured_marker_id:Ns});function Qs(e){/* @__PURE__ */
252
+ /* @__PURE__ */n.jsx(RecordsFootnote,{})]}),h.outcome?null:/* @__PURE__ */n.jsx(r.View,{style:[m.footer,{paddingBottom:Math.max(b.bottom,g.space.md)}],testID:"records-batch-footer",children:/* @__PURE__ */n.jsx(Pill,{label:x,disabled:h.busy||!h.ready||!p,busy:h.busy,onPress:()=>{r.Keyboard.dismiss(),h.submit()},testID:"records-batch-send"})})]})]})})}function Ps(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?Os(t):El(Os(t),Ls(r)),[t,r])}function Ls(e){return{option:Ol(e,{paddingHorizontal:e.cardPad,paddingVertical:12,gap:4}),draft:Ol(e,{gap:8}),scopeCard:Ol(e,{gap:8}),sectionTitle:e.cardTitle,footer:{backgroundColor:e.ground}}}function Os(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth,a=n.xxl+n.md,s=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",gap:n.md,paddingHorizontal:n.lg,paddingTop:n.xs,paddingBottom:n.md,...rn(e.slots.header)},title:{flex:1,...s(l.size.heading,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),...nn(e.slots.header)},close:{minHeight:a,minWidth:a,alignItems:"center",justifyContent:"center"},closeLabel:s(l.size.body,l.lineHeight.snug,t.linkInk,"bold"),content:{paddingHorizontal:n.lg,paddingBottom:n.xl,gap:n.lg},lead:s(l.size.body,l.lineHeight.normal,t.text.muted),block:{gap:n.sm},sectionTitle:{...s(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold")},option:{minHeight:a,justifyContent:"center",gap:n.xs/2,borderRadius:i.md,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,paddingHorizontal:n.md,paddingVertical:n.sm+n.xs/2,...rn(e.slots.card,1)},optionName:{...s(l.size.body,l.lineHeight.snug,t.text.primary,"bold"),...nn(e.slots.card)},draft:{gap:n.sm,borderRadius:i.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:n.md,...rn(e.slots.card,1)},remove:{alignSelf:"flex-start",minHeight:a,paddingHorizontal:0},scopeCard:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surfaceCream,padding:n.lg,gap:n.sm,...rn(e.slots.card,1)},scopeText:{...s(l.size.bodyTight,l.lineHeight.relaxed,t.text.secondary),...nn(e.slots.card)},footer:{paddingHorizontal:n.lg,paddingTop:n.md,borderTopWidth:o,borderTopColor:t.borderHairlineGreen,backgroundColor:t.background}})}var Es=/* @__PURE__ */Object.freeze({scopeHeading:"What we ask for",scopeBody:"You’re asking your pet’s clinic to release their medical records to Everfur, on your behalf, so we can organize them for you.",whatWeDo:/* @__PURE__ */Object.freeze(["We email the clinic a signed copy of this authorization.","When records arrive, our team reviews them before they appear in your app.","You can revoke this request at any time."]),retentionNote:"We keep the records you receive so you always have them. See our Privacy Policy for how records are stored and used.",authorizeLabel:e=>`I’m ${yn(e)}’s owner. I authorize Everfur to request these records on my behalf.`,missingSignatureError:"Please add your signature before submitting.",missingDraftError:"Something went wrong with your selection. Please go back and pick the clinic again.",newClinicDirectSendNote:"We’ll email this clinic directly to request your pet’s medical records. Clinics usually reply within a week.",titleFreeText:"Check and send",titleDirectory:"Check and send",leadWeb:e=>`The clinic gets a secure request, with your permission to release ${yn(e)}’s records to Everfur.`,leadNative:"The clinic gets a secure request, with your permission.",whatHappensNext:"What happens next",whatHappensNextBody:"Most clinics respond within 3 to 5 business days. We follow up automatically, and you can cancel any time before the records arrive.",noEmailNote:(e,t)=>`We don’t have an email on file for ${t}. Add it so we can request ${yn(e)}’s records.`,emailLabel:"Clinic email for records",emailPlaceholder:"records@clinic.com",emailRequired:"Add the clinic’s records email to send the request.",emailInvalid:"That email doesn’t look right. Check it and try again.",reuseSignature:"Reuse a previous signature",reuseHint:"…or sign again below",reuseTileA11y:"Use this earlier signature",reuseTileSelectedA11y:"Earlier signature, selected",signType:"Type your name to sign",signDraw:"Sign with your finger",clear:"Clear",clearA11y:"Clear signature",fullName:"Your full name",fullNamePlaceholder:"Jane Doe",toType:"Can’t draw? Type your name instead",toDraw:"Draw your signature instead",signatureHint:e=>`Your signature is added to the authorization sent to ${e}.`,submit:"Send request",submitting:"Sending…"});var As="value_text",$s=64,Bs=512;function isFactReviewerLocked(e){return e!==null&&e.httpStatus===409&&!Ve(e)}var Fs=/* @__PURE__ */Object.freeze({num:"value_num",date:"value_date",bool:"value_bool",text:As}),Ms=/^[+-]?(?:\d+\.?\d*|\.\d+)$/,qs=/^\d{4}-\d{2}-\d{2}$/;function inferFactValueKind(e){if(e==null)return"text";let t=e.trim();return Ms.test(t)?"num":qs.test(t)&&!Number.isNaN(Date.parse(t))?"date":t==="true"||t==="false"?"bool":"text"}function factCorrectionFor(e,t){let r=t.trim(),n=inferFactValueKind(e);if(n==="num"&&Ms.test(r)){let e=Number(r);if(Number.isFinite(e))/* @__PURE__ */return Object.freeze({[Fs.num]:e})}return n==="date"&&qs.test(r)&&!Number.isNaN(Date.parse(r))?/* @__PURE__ */Object.freeze({[Fs.date]:r}):/* @__PURE__ */Object.freeze(n==="bool"&&(r==="true"||r==="false")?{[Fs.bool]:r==="true"}:{[Fs.text]:r})}var Ns=/* @__PURE__ */t.z.string().nullish(),Ws=/* @__PURE__ */t.z.number().nullish(),Us=/* @__PURE__ */t.z.object({collected_at:Ns,at:Ns,value:Ws,unit:Ns,qualitative_result:Ns,ref_low:Ws,ref_high:Ws,status:Ns,source_clinic:Ns,source_doc_id:Ns,doc_id:Ns,reviewed:/* @__PURE__ */t.z.boolean().nullish()}),Gs=/* @__PURE__ */t.z.object({collected_at:Ns,at:Ns,value:Ws,unit:Ns,qualitative_result:Ns,status:Ns}),Ks=/* @__PURE__ */t.z.object({marker_id:/* @__PURE__ */t.z.string().min(1),canonical_name:Ns,name:Ns,loinc_code:Ns,canonical_unit:Ns,unit:Ns,panel_name:Ns,panel:Ns,meaning_text:Ns,meaning:Ns,latest:/* @__PURE__ */Gs.nullish(),trajectory:Ns,points:/* @__PURE__ */t.z.array(Us).optional()}),Ys=/* @__PURE__ */t.z.object({total_markers:/* @__PURE__ */t.z.number().int().nonnegative(),in_range_count:/* @__PURE__ */t.z.number().int().nonnegative(),out_of_range_count:/* @__PURE__ */t.z.number().int().nonnegative(),unknown_count:/* @__PURE__ */t.z.number().int().nonnegative()}),Xs=/* @__PURE__ */t.z.object({markers:/* @__PURE__ */t.z.array(Ks).optional(),summary:/* @__PURE__ */Ys.nullish(),disclaimer:/* @__PURE__ */t.z.string().optional(),featured_marker_id:Ns});function Qs(e){/* @__PURE__ */
253
253
  return Object.freeze({petRef:e,withheld:true,markers:/* @__PURE__ */Object.freeze([]),summary:null,disclaimer:"",featuredMarkerId:null})}function mapRecordMarkers(petRef,e){let t=Z(e)?e:{},r=typeof t.pet_ref=="string"&&t.pet_ref.length>0?t.pet_ref:petRef;if(t.withheld===true)return Qs(r);let n=Xs.safeParse(t);if(!n.success)return Qs(r);let i=n.data,l=e=>/* @__PURE__ */Object.freeze({at:e.collected_at??e.at??null,value:e.value??null,unit:e.unit??null,qualitativeResult:e.qualitative_result??null,refLow:e.ref_low??null,refHigh:e.ref_high??null,status:e.status??null,sourceClinic:e.source_clinic??null,docId:e.source_doc_id??e.doc_id??null,reviewed:e.reviewed===true}),o=(i.markers??[]).map(e=>/* @__PURE__ */Object.freeze({markerId:e.marker_id,name:e.canonical_name??e.name??e.marker_id,loincCode:e.loinc_code??null,unit:e.canonical_unit??e.unit??null,panel:e.panel_name??e.panel??null,meaning:e.meaning_text??e.meaning??null,latest:e.latest?/* @__PURE__ */Object.freeze({at:e.latest.collected_at??e.latest.at??null,value:e.latest.value??null,unit:e.latest.unit??null,qualitativeResult:e.latest.qualitative_result??null,status:e.latest.status??null}):null,trajectory:e.trajectory??null,points:/* @__PURE__ */Object.freeze((e.points??[]).map(l))}));/* @__PURE__ */
254
254
  return Object.freeze({petRef:r,withheld:false,markers:/* @__PURE__ */Object.freeze(o),summary:i.summary?/* @__PURE__ */Object.freeze({totalMarkers:i.summary.total_markers,inRangeCount:i.summary.in_range_count,outOfRangeCount:i.summary.out_of_range_count,unknownCount:i.summary.unknown_count}):null,disclaimer:i.disclaimer??"",featuredMarkerId:i.featured_marker_id??null})}var Js=/* @__PURE__ */t.z.string().min(1).refine(e=>e.startsWith("https://")),Zs=/* @__PURE__ */t.z.object({source_doc_id:/* @__PURE__ */t.z.string().min(1),file_name:/* @__PURE__ */t.z.string().nullish(),doc_format:/* @__PURE__ */t.z.string().nullish(),byte_size:/* @__PURE__ */t.z.number().int().nonnegative().nullish(),received_at:/* @__PURE__ */t.z.string().nullish(),download_url:Js,expires_in_seconds:/* @__PURE__ */t.z.number().int().nonnegative().nullish()}),ed=/* @__PURE__ */t.z.object({items:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.unknown()).optional()});function td(e){let t=ed.safeParse(e);if(!t.success)return null;let r=[];for(let e of t.data.items??[]){let t=Zs.safeParse(e);t.success&&r.push(
255
255
  /* @__PURE__ */Object.freeze({sourceDocId:t.data.source_doc_id,fileName:t.data.file_name??null,docFormat:t.data.doc_format??null,byteSize:t.data.byte_size??null,receivedAt:t.data.received_at??null,downloadUrl:t.data.download_url,expiresInSeconds:t.data.expires_in_seconds??0}))}/* @__PURE__ */
@@ -258,47 +258,47 @@ return Object.freeze({petRef:e,available:false,withheld:t,labResults:/* @__PURE_
258
258
  return Object.freeze({petRef:r,available:true,withheld:false,labResults:/* @__PURE__ */Object.freeze((i.lab_results??[]).map(e=>/* @__PURE__ */Object.freeze({markerId:e.marker_id,name:e.name,loincCode:e.loinc_code??null,unit:e.unit??null,panel:e.panel??null,meaning:e.meaning??null,latest:/* @__PURE__ */Object.freeze({at:e.latest?.at??null,value:e.latest?.value??null,unit:e.latest?.unit??null,qualitativeResult:e.latest?.qualitative_result??null,status:e.latest?.status??null}),trajectory:e.trajectory??null,points:/* @__PURE__ */Object.freeze((e.points??[]).map(l))}))),encounters:/* @__PURE__ */Object.freeze((i.encounters??[]).map(e=>/* @__PURE__ */Object.freeze({encounterId:e.encounter_id,date:e.date??null,type:e.type??null,clinicName:e.clinic_name??null,veterinarian:e.veterinarian??null,docId:e.doc_id??null}))),clinicianNotes:/* @__PURE__ */Object.freeze((i.clinician_notes??[]).map(e=>/* @__PURE__ */Object.freeze({noteId:e.note_id,encounterId:e.encounter_id??null,observedOn:e.observed_on??null,sections:/* @__PURE__ */Object.freeze((e.sections??[]).map(e=>/* @__PURE__ */Object.freeze({section:e.section,text:e.text})))}))),physicalExams:/* @__PURE__ */Object.freeze((i.physical_exams??[]).map(e=>/* @__PURE__ */Object.freeze({examId:e.exam_id,encounterId:e.encounter_id??null,observedOn:e.observed_on??null,docId:e.doc_id??null,systems:/* @__PURE__ */Object.freeze(Object.entries(e.systems??{}).map(([e,t])=>/* @__PURE__ */Object.freeze({system:e,findingStatus:t.finding_status??null,finding:t.finding??null})))}))),completeness:i.completeness?/* @__PURE__ */Object.freeze({hasLabHistory:i.completeness.has_lab_history===true,hasVaccinationHistory:i.completeness.has_vaccination_history===true,hasWeightHistory:i.completeness.has_weight_history===true,hasVitalsHistory:i.completeness.has_vitals_history===true,hasPhysicalExamHistory:i.completeness.has_physical_exam_history===true,hasProcedureHistory:i.completeness.has_procedure_history===true,hasGeneticHistory:i.completeness.has_genetic_history===true,hasReproductiveHistory:i.completeness.has_reproductive_history===true,hasParasitePreventionHistory:i.completeness.has_parasite_prevention_history===true,earliestRecordAt:i.completeness.earliest_record_at??null,latestRecordAt:i.completeness.latest_record_at??null,documentsIngested:i.completeness.documents_ingested??0,documentsInReview:i.completeness.documents_in_review??0,entitiesPendingReview:/* @__PURE__ */Object.freeze({...i.completeness.entities_pending_review??{}}),heldTotal:i.completeness.held_total??0}):null,conflicts:/* @__PURE__ */Object.freeze((i.conflicts??[]).map(e=>/* @__PURE__ */Object.freeze({conflictId:e.conflict_id,entityType:e.entity_type,field:e.field??null,severity:e.severity??"needs_review",candidates:/* @__PURE__ */Object.freeze((e.candidates??[]).map(e=>/* @__PURE__ */Object.freeze({value:e.value,docId:e.source_doc_id??e.doc_id??null,collectedAt:e.collected_at??null})))})))})}function bd(e){/* @__PURE__ */
259
259
  return Object.freeze({petRef:e,withheld:true,isEmpty:false,visits:/* @__PURE__ */Object.freeze([]),vaccines:/* @__PURE__ */Object.freeze([]),weights:/* @__PURE__ */Object.freeze([]),medications:/* @__PURE__ */Object.freeze([]),disclaimer:""})}function mapRecordsTimeline(petRef,e){let t=Z(e)?e:{},r=fd(t,petRef);if(t.withheld===true)return bd(r);let n=pd.safeParse(t);if(!n.success)return bd(r);let i=n.data,l=i.visits.map(e=>/* @__PURE__ */Object.freeze({visitId:e.visit_id,visitDate:e.visit_date??null,veterinarian:e.veterinarian??null,summary:e.summary??null,docId:e.doc_id??null})),o=i.vaccines.map(e=>/* @__PURE__ */Object.freeze({vaccineId:e.vaccine_id,product:e.product??null,lot:e.lot??null,administeredOn:e.administered_on??null,expiresOn:e.expires_on??null,docId:e.doc_id??null})),a=i.weights.map(e=>/* @__PURE__ */Object.freeze({weightId:e.weight_id,observedOn:e.observed_on??null,weightKg:e.weight_kg??null,docId:e.doc_id??null})),s=i.medications.map(e=>/* @__PURE__ */Object.freeze({medicationId:e.medication_id,drugName:e.drug_name??null,dose:e.dose??null,route:e.route??null,frequency:e.frequency??null,sig:e.sig??null,rxNumber:e.rx_number??null,startedOn:e.started_on??null,stoppedOn:e.stopped_on??null,docId:e.doc_id??null}));/* @__PURE__ */
260
260
  return Object.freeze({petRef:r,withheld:false,isEmpty:l.length===0&&o.length===0&&a.length===0&&s.length===0,visits:/* @__PURE__ */Object.freeze(l),vaccines:/* @__PURE__ */Object.freeze(o),weights:/* @__PURE__ */Object.freeze(a),medications:/* @__PURE__ */Object.freeze(s),disclaimer:i.disclaimer??""})}function mapDocumentContributions(petRef,e){let t=Z(e)?e:{},r=fd(t,petRef),n=()=>/* @__PURE__ */Object.freeze({petRef:r,withheld:true,document:null,contributions:/* @__PURE__ */Object.freeze([]),contributionCount:0});if(t.withheld===true)return n();let i=gd.safeParse(t);if(!i.success)return n();let l=/* @__PURE__ */Object.freeze(i.data.contributions.map(ye));/* @__PURE__ */
261
- return Object.freeze({petRef:r,withheld:false,document:xe(i.data.document),contributions:l,contributionCount:i.data.contribution_count??l.length})}var yd="/widget/v1/records/pets";function createRecordsDepthClient(e){let t=Et(e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})),r=(e,t)=>typeof e=="string"&&e.length>0&&!Dt(e)&&[...e].length<=t,n=async(e,petRef,n,i)=>{if(!r(petRef,Be))return xd();let l=await t.send(e,{method:"GET",path:n});if(!l.ok)return l;let o=i(l.value);return o.petRef===petRef?ok(o):err(makeEverfurError("internalError",{retryable:false}))},i=petRef=>`${yd}/${encodeURIComponent(petRef)}`,l=petRef=>`${i(petRef)}/everfur_record`,o=async(e,r,n)=>{let i=await t.send(e,r,r.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!i.ok)return i;let l=n(i.value);return l===null?err(makeEverfurError("internalError",{retryable:false})):ok(l)},a=(e,t)=>!r(e.entityType,$s)||!r(e.canonicalKey,Bs)||e.idempotencyKey!==void 0&&!r(e.idempotencyKey,$e)||t!==void 0&&Object.keys(t).length===0?null:{entity_type:e.entityType,canonical_key:e.canonicalKey,...t!==void 0?{corrected_fields:t}:{},...e.idempotencyKey!==void 0?{idempotency_key:e.idempotencyKey}:{}};return{getRecordDepth:petRef=>n("records.depth.record",petRef,`${i(petRef)}/record`,e=>mapRecordDepth(petRef,e)),getTimeline:petRef=>n("records.depth.timeline",petRef,`${i(petRef)}/timeline`,e=>mapRecordsTimeline(petRef,e)),getDocumentContributions(petRef,e){return r(e,64)?n("records.depth.contributions",petRef,`${i(petRef)}/documents/${encodeURIComponent(e)}/contributions`,e=>mapDocumentContributions(petRef,e)):xd()},getMarkers:petRef=>n("records.depth.markers",petRef,`${i(petRef)}/markers`,e=>mapRecordMarkers(petRef,e)),createShare(petRef,t){if(!r(petRef,Be))return xd();let n=t?.audience;return n!==void 0&&!P.includes(n)?xd():o("records.share.create",{method:"POST",path:`${l(petRef)}/share`,...n!==void 0?{body:{audience:n}}:{}},t=>mapRecordShareLink(t,e.apiBaseUrl))},emailShare(petRef,e){let t=e.recipientKind,n=typeof e.recipientEmail=="string"?e.recipientEmail.trim():"",i=t==="other"||P.includes(t);return!r(petRef,Be)||!i||!isShareRecipientEmail(n)||Dt(n)?xd():o("records.share.email",{method:"POST",path:`${l(petRef)}/share/email`,body:{recipient_email:n,recipient_kind:t}},mapRecordShareEmailReceipt)},async readFeatures(){try{let e=await t.send("records.getFeatures",{method:"GET",path:"/widget/v1/records/features"});return e.ok?J(e.value):X}catch{return X}},listShares(petRef){return r(petRef,Be)?o("records.share.list",{method:"GET",path:`${l(petRef)}/shares`},mapRecordShareList):xd()},async revokeShare(petRef,e){if(!r(petRef,Be)||!r(e,64))return xd();let n=await t.send("records.share.revoke",{method:"DELETE",path:`${l(petRef)}/shares/${encodeURIComponent(e)}`},{idempotent:false,maxAttempts:1});return n.ok?ok(void 0):n},getPdfLink(petRef){return r(petRef,Be)?o("records.pdf.link",{method:"GET",path:`${l(petRef)}/pdf-link`},mapRecordPdfLink):xd()},async editFact(petRef,e){let n=r(petRef,Be)?a(e,e.correctedFields):null;if(n===null)return xd();let i=await t.send("records.fact.edit",{method:"POST",path:`${l(petRef)}/facts/edit`,body:n},{idempotent:false,maxAttempts:1});return i.ok?ok(void 0):i},async removeFact(petRef,e){let n=r(petRef,Be)?a(e):null;if(n===null)return xd();let i=await t.send("records.fact.remove",{method:"POST",path:`${l(petRef)}/facts/remove`,body:n},{idempotent:false,maxAttempts:1});return i.ok?ok(void 0):i},listRequestDocuments(e){return r(e,64)?o("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(e)}/documents`},td):xd()},listAuthorizationSignatures:()=>o("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},mapSignatureSuggestions)}}function xd(){return Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false})))}function useEverfurRecordsDepthClient(){let{runtime:t,userRef:userRef,scopeEpoch:r}=Xt();return e.useMemo(()=>{let{services:e}=t.registry;return createRecordsDepthClient({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{},...typeof e.apiBaseUrl=="string"?{apiBaseUrl:e.apiBaseUrl}:{}})},[t,userRef,r])}function useRecordsDepthRead(petRef,t,r,n=""){let i=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),l=rr(petRef),o=e.useMemo(()=>({}),[i,petRef,n,l]),[a,s]=e.useState({scope:o,value:null,error:null,loading:true}),d=e.useRef(0),c=e.useCallback(async()=>{let e=d.current+=1;if(s({scope:o,value:null,error:null,loading:true}),userRef===null){s({scope:o,value:null,error:null,loading:false});return}let r=await t(i,petRef);e===d.current&&(r.ok?s({scope:o,value:r.value,error:null,loading:false}):s({scope:o,value:null,error:r.error,loading:false}))},[i,petRef,t,o,userRef]);e.useEffect(()=>(c(),()=>{d.current+=1}),[c]);let u=a.scope===o?a:{value:null,error:null,loading:true},h=e.useCallback(()=>{c()},[c]),p=u.error===null||u.error.httpStatus!==404,g=p?u.error:null,f=u.loading?"loading":g!==null?"error":u.value===null?"empty":u.value.withheld?"populated":r(u.value)?"empty":"populated";return e.useMemo(()=>({status:f,value:u.value,error:g,available:p,refresh:h}),[f,u.value,g,p,h])}function wd(e){return e!==null&&e.httpStatus===404}var vd=(e,petRef)=>e.getMarkers(petRef),kd=e=>e.markers.length===0;function useRecordsMarkers(petRef){let t=useRecordsDepthRead(petRef,vd,kd);return e.useMemo(()=>{let e=t.available&&t.value!==null&&!t.value.withheld?t.value:null;return{status:t.status,markers:e,available:t.available,error:t.error,refresh:t.refresh}},[t])}var jd=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Sd(t){let{clinic:r,controller:n,depthClient:i,capture:l,onCreated:o}=t,a=r.clinic?.name??r.freeText??"",s=r.clinic===null,[d,c]=e.useState(false),[u,h]=e.useState(t.ownerName),[p,g]=e.useState(r.email),[f,m]=e.useState(false),[b,y]=e.useState(null),[x,w]=e.useState(null),[v,k]=e.useState(0),[j,S]=e.useState(null),[C,R]=e.useState(false),[T,_]=e.useState(null),[z,I]=e.useState([]),[D,H]=e.useState(null),[V,P]=e.useState(false),L=e.useRef(false),E=e.useRef(true),O=e.useRef(mt()),A=e.useRef(null);e.useEffect(()=>(E.current=true,()=>{E.current=false,A.current=null}),[n]),e.useEffect(()=>{let e=true;return y(null),A.current=null,n.getAuthorizationCopy().then(t=>{e&&(t.ok?(y(t.value),w(null)):w(t.error))}).catch(()=>{e&&w(makeEverfurError("internalError"))}),()=>{e=false}},[n,v]),e.useEffect(()=>{if(i===void 0)return;let e=true;return i.listAuthorizationSignatures().then(t=>{e&&(t.ok?I(t.value):wd(t.error)||I([]))}).catch(()=>{}),()=>{e=false}},[i]);let $=Ia(r.clinic),B=p.trim().toLowerCase(),F=jd.test(B),M=$&&(f||B.length>0)&&!F?B.length>0?Os.emailInvalid:Os.emailRequired:null,q=u.trim().length>0,N=b&&q?za(b,u.trim(),yn(t.petName),a):null,W=t.hostCapture===true||V||D!==null,U=!!(d&&b&&N&&q&&a&&(!$||F)),G=U&&W,K=e.useCallback(async()=>{if(!(L.current||T!==null||!b||!N)){if(!a){S(Os.missingDraftError);return}if($&&!F){m(true),S(B.length>0?Os.emailInvalid:Os.emailRequired);return}if(!(!d||!u.trim())){L.current=true,R(true),S(null);try{if(A.current===null){let e=D!==null?{signatureId:D}:await l();if(!E.current)return;if(e===null){S(Os.missingSignatureError);return}let n=r.clinic&&(!$||r.clinic.emailStatus==="none")?{clinicId:r.clinic.id}:{clinicFreeText:a};A.current={petRef:t.petRef,ownerName:u.trim(),authorizationVersion:b.authorizationVersion,...n,...$?{clinicEmail:B}:{},...e.signatureId!==void 0?{signatureId:e.signatureId}:{signaturePngBase64:e.signaturePngBase64},idempotencyKey:O.current()}}let e=await n.createClinicRequest(A.current);if(!E.current)return;if(!e.ok){S(e.error.displayMessage);return}if(e.value.petRef!==t.petRef){S(makeEverfurError("internalError").displayMessage);return}_(e.value),A.current=null,o?.(e.value)}catch{E.current&&S(makeEverfurError("internalError").displayMessage)}finally{L.current=false,E.current&&R(false)}}}},[d,l,r.clinic,a,n,b,T,t.petRef,$,B,o,u,D,N,F]),Y=e.useCallback(()=>{A.current=null,S(null)},[]);return{title:s?Os.titleFreeText:Os.titleDirectory,clinicName:a,isFreeText:s,authorized:d,ownerName:u,email:p,emailError:M,needsEmail:$,directoryClinicNoEmail:$&&r.clinic!==null,copy:b,copyError:x,scope:N,error:j,busy:C,created:T,ready:G,signatures:z,reuseSignatureId:D,hasSignature:W,scopeAwaitingName:b!==null&&!q,signatureLastMissing:U&&!W,setAuthorized(e){L.current||(Y(),c(e))},setOwnerName(e){L.current||(Y(),h(e))},setEmail(e){L.current||(Y(),m(false),g(e))},setSigned(e){L.current||(Y(),P(e),e&&H(null))},pickReuseSignature(e){L.current||(Y(),H(e))},retryCopy(){w(null),k(e=>e+1)},submit:K}}function EverfurRecordsConsent(e){let{userRef:userRef,scopeEpoch:t}=Xt();/* @__PURE__ */
262
- return n.jsx(CapabilityGate,{capability:"recordsClinic",style:e.style,...uo(e.onBack,no),children:userRef===null?/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",children:fn.sessionRequired}):/* @__PURE__ */n.jsx(ConsentBody,{...wr(e,["onCreated","onNavigate","onBack"])},JSON.stringify([userRef,t,e.petRef,e.clinic.key]))})}var Cd=r.Platform.OS==="ios";function ConsentBody({petRef:petRef,petName:t,clinic:i,ownerName:l,onCaptureSignature:o,onCreated:a,controller:s,onNavigate:d,onBack:c,style:u}){let h=Yl(),p=Rd(),g=useEverfurTheme(),f=useEverfurRecordsClinic(),m=$i()?Ei.newClinicDirectSendNote:Os.newClinicDirectSendNote,b=useEverfurRecordsDepthClient(),[y,x]=e.useState(null),[w,v]=e.useState("draw"),k=e.useCallback(async()=>y===null?null:{signaturePngBase64:y},[y]),j=Sd({petRef:petRef,petName:t,ownerName:l??"",clinic:i,controller:s??f,depthClient:b,capture:o?()=>o({petRef:petRef,petName:yn(t),ownerName:j.ownerName,clinicName:j.clinicName,authorizationVersion:j.copy?.authorizationVersion??"",scopeText:j.scope??"",signal:(new AbortController).signal}):k,hostCapture:o!==void 0,onCreated:e=>{a?.(e),d?.({name:"dashboard"})}}),S=e.useRef(j);S.current=j;let C=e.useCallback(e=>{x(e),S.current.setSigned(e!==null)},[]),R=j.busy,T=Ba(void 0,Cd);/* @__PURE__ */
261
+ return Object.freeze({petRef:r,withheld:false,document:xe(i.data.document),contributions:l,contributionCount:i.data.contribution_count??l.length})}var yd="/widget/v1/records/pets";function createRecordsDepthClient(e){let t=Ot(e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})),r=(e,t)=>typeof e=="string"&&e.length>0&&!Dt(e)&&[...e].length<=t,n=async(e,petRef,n,i)=>{if(!r(petRef,Be))return xd();let l=await t.send(e,{method:"GET",path:n});if(!l.ok)return l;let o=i(l.value);return o.petRef===petRef?ok(o):err(makeEverfurError("internalError",{retryable:false}))},i=petRef=>`${yd}/${encodeURIComponent(petRef)}`,l=petRef=>`${i(petRef)}/everfur_record`,o=async(e,r,n)=>{let i=await t.send(e,r,r.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!i.ok)return i;let l=n(i.value);return l===null?err(makeEverfurError("internalError",{retryable:false})):ok(l)},a=(e,t)=>!r(e.entityType,$s)||!r(e.canonicalKey,Bs)||e.idempotencyKey!==void 0&&!r(e.idempotencyKey,$e)||t!==void 0&&Object.keys(t).length===0?null:{entity_type:e.entityType,canonical_key:e.canonicalKey,...t!==void 0?{corrected_fields:t}:{},...e.idempotencyKey!==void 0?{idempotency_key:e.idempotencyKey}:{}};return{getRecordDepth:petRef=>n("records.depth.record",petRef,`${i(petRef)}/record`,e=>mapRecordDepth(petRef,e)),getTimeline:petRef=>n("records.depth.timeline",petRef,`${i(petRef)}/timeline`,e=>mapRecordsTimeline(petRef,e)),getDocumentContributions(petRef,e){return r(e,64)?n("records.depth.contributions",petRef,`${i(petRef)}/documents/${encodeURIComponent(e)}/contributions`,e=>mapDocumentContributions(petRef,e)):xd()},getMarkers:petRef=>n("records.depth.markers",petRef,`${i(petRef)}/markers`,e=>mapRecordMarkers(petRef,e)),createShare(petRef,t){if(!r(petRef,Be))return xd();let n=t?.audience;return n!==void 0&&!P.includes(n)?xd():o("records.share.create",{method:"POST",path:`${l(petRef)}/share`,...n!==void 0?{body:{audience:n}}:{}},t=>mapRecordShareLink(t,e.apiBaseUrl))},emailShare(petRef,e){let t=e.recipientKind,n=typeof e.recipientEmail=="string"?e.recipientEmail.trim():"",i=t==="other"||P.includes(t);return!r(petRef,Be)||!i||!isShareRecipientEmail(n)||Dt(n)?xd():o("records.share.email",{method:"POST",path:`${l(petRef)}/share/email`,body:{recipient_email:n,recipient_kind:t}},mapRecordShareEmailReceipt)},async readFeatures(){try{let e=await t.send("records.getFeatures",{method:"GET",path:"/widget/v1/records/features"});return e.ok?J(e.value):X}catch{return X}},listShares(petRef){return r(petRef,Be)?o("records.share.list",{method:"GET",path:`${l(petRef)}/shares`},mapRecordShareList):xd()},async revokeShare(petRef,e){if(!r(petRef,Be)||!r(e,64))return xd();let n=await t.send("records.share.revoke",{method:"DELETE",path:`${l(petRef)}/shares/${encodeURIComponent(e)}`},{idempotent:false,maxAttempts:1});return n.ok?ok(void 0):n},getPdfLink(petRef){return r(petRef,Be)?o("records.pdf.link",{method:"GET",path:`${l(petRef)}/pdf-link`},mapRecordPdfLink):xd()},async editFact(petRef,e){let n=r(petRef,Be)?a(e,e.correctedFields):null;if(n===null)return xd();let i=await t.send("records.fact.edit",{method:"POST",path:`${l(petRef)}/facts/edit`,body:n},{idempotent:false,maxAttempts:1});return i.ok?ok(void 0):i},async removeFact(petRef,e){let n=r(petRef,Be)?a(e):null;if(n===null)return xd();let i=await t.send("records.fact.remove",{method:"POST",path:`${l(petRef)}/facts/remove`,body:n},{idempotent:false,maxAttempts:1});return i.ok?ok(void 0):i},listRequestDocuments(e){return r(e,64)?o("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(e)}/documents`},td):xd()},listAuthorizationSignatures:()=>o("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},mapSignatureSuggestions)}}function xd(){return Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false})))}function useEverfurRecordsDepthClient(){let{runtime:t,userRef:userRef,scopeEpoch:r}=Xt();return e.useMemo(()=>{let{services:e}=t.registry;return createRecordsDepthClient({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{},...typeof e.apiBaseUrl=="string"?{apiBaseUrl:e.apiBaseUrl}:{}})},[t,userRef,r])}function useRecordsDepthRead(petRef,t,r,n=""){let i=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),l=rr(petRef),o=e.useMemo(()=>({}),[i,petRef,n,l]),[a,s]=e.useState({scope:o,value:null,error:null,loading:true}),d=e.useRef(0),c=e.useCallback(async()=>{let e=d.current+=1;if(s({scope:o,value:null,error:null,loading:true}),userRef===null){s({scope:o,value:null,error:null,loading:false});return}let r=await t(i,petRef);e===d.current&&(r.ok?s({scope:o,value:r.value,error:null,loading:false}):s({scope:o,value:null,error:r.error,loading:false}))},[i,petRef,t,o,userRef]);e.useEffect(()=>(c(),()=>{d.current+=1}),[c]);let u=a.scope===o?a:{value:null,error:null,loading:true},h=e.useCallback(()=>{c()},[c]),p=u.error===null||u.error.httpStatus!==404,g=p?u.error:null,f=u.loading?"loading":g!==null?"error":u.value===null?"empty":u.value.withheld?"populated":r(u.value)?"empty":"populated";return e.useMemo(()=>({status:f,value:u.value,error:g,available:p,refresh:h}),[f,u.value,g,p,h])}function wd(e){return e!==null&&e.httpStatus===404}var vd=(e,petRef)=>e.getMarkers(petRef),kd=e=>e.markers.length===0;function useRecordsMarkers(petRef){let t=useRecordsDepthRead(petRef,vd,kd);return e.useMemo(()=>{let e=t.available&&t.value!==null&&!t.value.withheld?t.value:null;return{status:t.status,markers:e,available:t.available,error:t.error,refresh:t.refresh}},[t])}var jd=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Sd(t){let{clinic:r,controller:n,depthClient:i,capture:l,onCreated:o}=t,a=r.clinic?.name??r.freeText??"",s=r.clinic===null,[d,c]=e.useState(false),[u,h]=e.useState(t.ownerName),[p,g]=e.useState(r.email),[f,m]=e.useState(false),[b,y]=e.useState(null),[x,w]=e.useState(null),[v,k]=e.useState(0),[j,S]=e.useState(null),[C,R]=e.useState(false),[T,_]=e.useState(null),[z,I]=e.useState([]),[D,H]=e.useState(null),[V,P]=e.useState(false),L=e.useRef(false),O=e.useRef(true),E=e.useRef(mt()),A=e.useRef(null);e.useEffect(()=>(O.current=true,()=>{O.current=false,A.current=null}),[n]),e.useEffect(()=>{let e=true;return y(null),A.current=null,n.getAuthorizationCopy().then(t=>{e&&(t.ok?(y(t.value),w(null)):w(t.error))}).catch(()=>{e&&w(makeEverfurError("internalError"))}),()=>{e=false}},[n,v]),e.useEffect(()=>{if(i===void 0)return;let e=true;return i.listAuthorizationSignatures().then(t=>{e&&(t.ok?I(t.value):wd(t.error)||I([]))}).catch(()=>{}),()=>{e=false}},[i]);let $=Ia(r.clinic),B=p.trim().toLowerCase(),F=jd.test(B),M=$&&(f||B.length>0)&&!F?B.length>0?Es.emailInvalid:Es.emailRequired:null,q=u.trim().length>0,N=b&&q?za(b,u.trim(),yn(t.petName),a):null,W=t.hostCapture===true||V||D!==null,U=!!(d&&b&&N&&q&&a&&(!$||F)),G=U&&W,K=e.useCallback(async()=>{if(!(L.current||T!==null||!b||!N)){if(!a){S(Es.missingDraftError);return}if($&&!F){m(true),S(B.length>0?Es.emailInvalid:Es.emailRequired);return}if(!(!d||!u.trim())){L.current=true,R(true),S(null);try{if(A.current===null){let e=D!==null?{signatureId:D}:await l();if(!O.current)return;if(e===null){S(Es.missingSignatureError);return}let n=r.clinic&&(!$||r.clinic.emailStatus==="none")?{clinicId:r.clinic.id}:{clinicFreeText:a};A.current={petRef:t.petRef,ownerName:u.trim(),authorizationVersion:b.authorizationVersion,...n,...$?{clinicEmail:B}:{},...e.signatureId!==void 0?{signatureId:e.signatureId}:{signaturePngBase64:e.signaturePngBase64},idempotencyKey:E.current()}}let e=await n.createClinicRequest(A.current);if(!O.current)return;if(!e.ok){S(e.error.displayMessage);return}if(e.value.petRef!==t.petRef){S(makeEverfurError("internalError").displayMessage);return}_(e.value),A.current=null,o?.(e.value)}catch{O.current&&S(makeEverfurError("internalError").displayMessage)}finally{L.current=false,O.current&&R(false)}}}},[d,l,r.clinic,a,n,b,T,t.petRef,$,B,o,u,D,N,F]),Y=e.useCallback(()=>{A.current=null,S(null)},[]);return{title:s?Es.titleFreeText:Es.titleDirectory,clinicName:a,isFreeText:s,authorized:d,ownerName:u,email:p,emailError:M,needsEmail:$,directoryClinicNoEmail:$&&r.clinic!==null,copy:b,copyError:x,scope:N,error:j,busy:C,created:T,ready:G,signatures:z,reuseSignatureId:D,hasSignature:W,scopeAwaitingName:b!==null&&!q,signatureLastMissing:U&&!W,setAuthorized(e){L.current||(Y(),c(e))},setOwnerName(e){L.current||(Y(),h(e))},setEmail(e){L.current||(Y(),m(false),g(e))},setSigned(e){L.current||(Y(),P(e),e&&H(null))},pickReuseSignature(e){L.current||(Y(),H(e))},retryCopy(){w(null),k(e=>e+1)},submit:K}}function EverfurRecordsConsent(e){let{userRef:userRef,scopeEpoch:t}=Xt();/* @__PURE__ */
262
+ return n.jsx(CapabilityGate,{capability:"recordsClinic",style:e.style,...uo(e.onBack,no),children:userRef===null?/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",children:fn.sessionRequired}):/* @__PURE__ */n.jsx(ConsentBody,{...wr(e,["onCreated","onNavigate","onBack"])},JSON.stringify([userRef,t,e.petRef,e.clinic.key]))})}var Cd=r.Platform.OS==="ios";function ConsentBody({petRef:petRef,petName:t,clinic:i,ownerName:l,onCaptureSignature:o,onCreated:a,controller:s,onNavigate:d,onBack:c,style:u}){let h=Yl(),p=Rd(),g=useEverfurTheme(),f=useEverfurRecordsClinic(),m=$i()?Oi.newClinicDirectSendNote:Es.newClinicDirectSendNote,b=useEverfurRecordsDepthClient(),[y,x]=e.useState(null),[w,v]=e.useState("draw"),k=e.useCallback(async()=>y===null?null:{signaturePngBase64:y},[y]),j=Sd({petRef:petRef,petName:t,ownerName:l??"",clinic:i,controller:s??f,depthClient:b,capture:o?()=>o({petRef:petRef,petName:yn(t),ownerName:j.ownerName,clinicName:j.clinicName,authorizationVersion:j.copy?.authorizationVersion??"",scopeText:j.scope??"",signal:(new AbortController).signal}):k,hostCapture:o!==void 0,onCreated:e=>{a?.(e),d?.({name:"dashboard"})}}),S=e.useRef(j);S.current=j;let C=e.useCallback(e=>{x(e),S.current.setSigned(e!==null)},[]),R=j.busy,T=Ba(void 0,Cd);/* @__PURE__ */
263
263
  return n.jsx(r.View,{style:[h.root,u],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
264
264
  /* @__PURE__ */n.jsx(ScreenHeader,{title:j.title,onBack:c,testID:"records-consent-header"}),
265
265
  /* @__PURE__ */n.jsxs(r.KeyboardAvoidingView,{behavior:Cd?"padding":void 0,style:h.body,...T.avoidingProps,children:[
266
266
  /* @__PURE__ */n.jsx(KeyboardOffsetProbe,{probeRef:T.probeRef}),
267
267
  /* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:p.content,keyboardShouldPersistTaps:"handled",keyboardDismissMode:Cd?"interactive":"on-drag",testID:"records-consent",children:[
268
- /* @__PURE__ */n.jsx(Text,{style:p.lead,testID:"records-consent-lead",children:Os.leadWeb(t)}),
268
+ /* @__PURE__ */n.jsx(Text,{style:p.lead,testID:"records-consent-lead",children:Es.leadWeb(t)}),
269
269
  /* @__PURE__ */n.jsxs(r.View,{style:p.scopeCard,accessibilityRole:"summary",children:[
270
- /* @__PURE__ */n.jsx(Text,{style:p.scopeHeading,accessibilityRole:"header",children:Os.scopeHeading}),
271
- /* @__PURE__ */n.jsx(Text,{style:p.scopeBody,children:Os.scopeBody}),
272
- /* @__PURE__ */n.jsx(r.View,{style:p.bullets,children:Os.whatWeDo.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:p.bulletRow,children:[
270
+ /* @__PURE__ */n.jsx(Text,{style:p.scopeHeading,accessibilityRole:"header",children:Es.scopeHeading}),
271
+ /* @__PURE__ */n.jsx(Text,{style:p.scopeBody,children:Es.scopeBody}),
272
+ /* @__PURE__ */n.jsx(r.View,{style:p.bullets,children:Es.whatWeDo.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:p.bulletRow,children:[
273
273
  /* @__PURE__ */n.jsx(Text,{style:p.check,children:"✓"}),
274
274
  /* @__PURE__ */n.jsx(Text,{style:p.bulletText,children:e})]},e))}),
275
- /* @__PURE__ */n.jsx(r.View,{style:p.retentionRow,children:/* @__PURE__ */n.jsx(Text,{style:p.retentionText,children:Os.retentionNote})}),j.copy&&j.scope?/* @__PURE__ */n.jsx(Text,{style:p.serverScope,testID:"records-consent-scope",children:j.scope}):j.scopeAwaitingName?null:j.copyError?/* @__PURE__ */n.jsxs(n.Fragment,{children:[
275
+ /* @__PURE__ */n.jsx(r.View,{style:p.retentionRow,children:/* @__PURE__ */n.jsx(Text,{style:p.retentionText,children:Es.retentionNote})}),j.copy&&j.scope?/* @__PURE__ */n.jsx(Text,{style:p.serverScope,testID:"records-consent-scope",children:j.scope}):j.scopeAwaitingName?null:j.copyError?/* @__PURE__ */n.jsxs(n.Fragment,{children:[
276
276
  /* @__PURE__ */n.jsx(Text,{style:h.errorText,accessibilityRole:"alert",children:j.copyError.displayMessage}),
277
277
  /* @__PURE__ */n.jsx(Pill,{label:fn.retry,kind:"outline",onPress:j.retryCopy,testID:"records-consent-copy-retry"})]}):/* @__PURE__ */n.jsx(Text,{style:h.muted,accessibilityLiveRegion:"polite",children:fn.loading})]}),
278
- /* @__PURE__ */n.jsxs(r.Pressable,{onPress:()=>j.setAuthorized(!j.authorized),accessibilityRole:"checkbox",accessibilityState:{checked:j.authorized},accessibilityLabel:Os.authorizeLabel(t),hitSlop:6,style:[p.toggle,j.authorized?p.toggleChecked:null],testID:"records-authorize-toggle",children:[
278
+ /* @__PURE__ */n.jsxs(r.Pressable,{onPress:()=>j.setAuthorized(!j.authorized),accessibilityRole:"checkbox",accessibilityState:{checked:j.authorized},accessibilityLabel:Es.authorizeLabel(t),hitSlop:6,style:[p.toggle,j.authorized?p.toggleChecked:null],testID:"records-authorize-toggle",children:[
279
279
  /* @__PURE__ */n.jsx(r.View,{style:[p.box,j.authorized?p.boxChecked:null],accessibilityElementsHidden:true,importantForAccessibility:"no",children:j.authorized?/* @__PURE__ */n.jsx(Text,{style:p.boxCheck,children:"✓"}):null}),
280
- /* @__PURE__ */n.jsx(Text,{style:p.toggleLabel,children:Os.authorizeLabel(t)})]}),
280
+ /* @__PURE__ */n.jsx(Text,{style:p.toggleLabel,children:Es.authorizeLabel(t)})]}),
281
281
  /* @__PURE__ */n.jsxs(r.View,{style:p.block,children:[
282
- /* @__PURE__ */n.jsx(Text,{style:h.fieldLabel,children:Os.fullName}),
283
- /* @__PURE__ */n.jsx(tn,{accessibilityLabel:Os.fullName,style:h.field,value:j.ownerName,placeholder:Os.fullNamePlaceholder,placeholderTextColor:g.color.text.placeholder,maxLength:200,editable:!R,autoComplete:"name",autoCapitalize:"words",onChangeText:j.setOwnerName,testID:"records-consent-owner-name"})]}),j.needsEmail?/* @__PURE__ */n.jsxs(r.View,{style:p.block,testID:"records-consent-email-block",children:[j.directoryClinicNoEmail?/* @__PURE__ */n.jsx(r.View,{style:h.cautionNote,testID:"records-consent-no-email-note",children:/* @__PURE__ */n.jsx(Text,{style:h.cautionNoteText,children:Os.noEmailNote(t,j.clinicName)})}):null,
284
- /* @__PURE__ */n.jsx(Text,{style:h.fieldLabel,children:Os.emailLabel}),
285
- /* @__PURE__ */n.jsx(tn,{accessibilityLabel:Os.emailLabel,style:h.field,value:j.email,placeholder:Os.emailPlaceholder,placeholderTextColor:g.color.text.placeholder,maxLength:320,editable:!R,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,onChangeText:j.setEmail,testID:"records-consent-clinic-email"}),j.emailError?/* @__PURE__ */n.jsx(Text,{style:h.errorText,accessibilityRole:"alert",children:j.emailError}):null,
282
+ /* @__PURE__ */n.jsx(Text,{style:h.fieldLabel,children:Es.fullName}),
283
+ /* @__PURE__ */n.jsx(tn,{accessibilityLabel:Es.fullName,style:h.field,value:j.ownerName,placeholder:Es.fullNamePlaceholder,placeholderTextColor:g.color.text.placeholder,maxLength:200,editable:!R,autoComplete:"name",autoCapitalize:"words",onChangeText:j.setOwnerName,testID:"records-consent-owner-name"})]}),j.needsEmail?/* @__PURE__ */n.jsxs(r.View,{style:p.block,testID:"records-consent-email-block",children:[j.directoryClinicNoEmail?/* @__PURE__ */n.jsx(r.View,{style:h.cautionNote,testID:"records-consent-no-email-note",children:/* @__PURE__ */n.jsx(Text,{style:h.cautionNoteText,children:Es.noEmailNote(t,j.clinicName)})}):null,
284
+ /* @__PURE__ */n.jsx(Text,{style:h.fieldLabel,children:Es.emailLabel}),
285
+ /* @__PURE__ */n.jsx(tn,{accessibilityLabel:Es.emailLabel,style:h.field,value:j.email,placeholder:Es.emailPlaceholder,placeholderTextColor:g.color.text.placeholder,maxLength:320,editable:!R,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,onChangeText:j.setEmail,testID:"records-consent-clinic-email"}),j.emailError?/* @__PURE__ */n.jsx(Text,{style:h.errorText,accessibilityRole:"alert",children:j.emailError}):null,
286
286
  /* @__PURE__ */n.jsx(Text,{style:h.muted,testID:"records-consent-review-note",children:m})]}):null,o?null:/* @__PURE__ */n.jsxs(r.View,{style:p.signatureBlock,children:[j.signatures.length>0?/* @__PURE__ */n.jsxs(r.View,{style:p.block,children:[
287
- /* @__PURE__ */n.jsx(Text,{style:h.fieldLabel,children:Os.reuseSignature}),
287
+ /* @__PURE__ */n.jsx(Text,{style:h.fieldLabel,children:Es.reuseSignature}),
288
288
  /* @__PURE__ */n.jsx(r.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:p.gallery,children:j.signatures.map(e=>{let t=j.reuseSignatureId===e.signatureId;/* @__PURE__ */
289
- return n.jsx(r.Pressable,{onPress:()=>j.pickReuseSignature(t?null:e.signatureId),accessibilityRole:"button",accessibilityLabel:t?Os.reuseTileSelectedA11y:Os.reuseTileA11y,style:[p.tile,t?p.tileSelected:null],testID:`records-consent-reuse-${e.signatureId}`,children:/* @__PURE__ */n.jsx(r.Image,{source:{uri:e.previewUrl},style:p.tileImage,resizeMode:"contain",accessibilityIgnoresInvertColors:true})},e.signatureId)})}),
290
- /* @__PURE__ */n.jsx(Text,{style:h.muted,children:Os.reuseHint})]}):null,
289
+ return n.jsx(r.Pressable,{onPress:()=>j.pickReuseSignature(t?null:e.signatureId),accessibilityRole:"button",accessibilityLabel:t?Es.reuseTileSelectedA11y:Es.reuseTileA11y,style:[p.tile,t?p.tileSelected:null],testID:`records-consent-reuse-${e.signatureId}`,children:/* @__PURE__ */n.jsx(r.Image,{source:{uri:e.previewUrl},style:p.tileImage,resizeMode:"contain",accessibilityIgnoresInvertColors:true})},e.signatureId)})}),
290
+ /* @__PURE__ */n.jsx(Text,{style:h.muted,children:Es.reuseHint})]}):null,
291
291
  /* @__PURE__ */n.jsx(r.View,{style:p.signatureHeader,children:/* @__PURE__ */n.jsx(Text,{style:h.fieldLabel,children:w==="type"?on.type:on.draw})}),
292
- /* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>v(e=>e==="draw"?"type":"draw"),disabled:R,accessibilityRole:"button",accessibilityLabel:w==="draw"?Os.toType:Os.toDraw,accessibilityState:{disabled:R},style:p.modeToggle,testID:"records-consent-sign-mode-toggle",children:/* @__PURE__ */n.jsx(Text,{style:p.modeToggleText,children:w==="draw"?Os.toType:Os.toDraw})}),
292
+ /* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>v(e=>e==="draw"?"type":"draw"),disabled:R,accessibilityRole:"button",accessibilityLabel:w==="draw"?Es.toType:Es.toDraw,accessibilityState:{disabled:R},style:p.modeToggle,testID:"records-consent-sign-mode-toggle",children:/* @__PURE__ */n.jsx(Text,{style:p.modeToggleText,children:w==="draw"?Es.toType:Es.toDraw})}),
293
293
  /* @__PURE__ */n.jsx(SignaturePad,{onChange:C,disabled:R,mode:w}),
294
- /* @__PURE__ */n.jsx(Text,{style:h.muted,children:Os.signatureHint(j.clinicName)}),j.signatureLastMissing?/* @__PURE__ */n.jsx(Text,{style:h.muted,testID:"records-consent-signature-required",children:Os.missingSignatureError}):null]}),
294
+ /* @__PURE__ */n.jsx(Text,{style:h.muted,children:Es.signatureHint(j.clinicName)}),j.signatureLastMissing?/* @__PURE__ */n.jsx(Text,{style:h.muted,testID:"records-consent-signature-required",children:Es.missingSignatureError}):null]}),
295
295
  /* @__PURE__ */n.jsxs(r.View,{style:p.nextCard,accessibilityRole:"summary",testID:"records-consent-next",children:[
296
- /* @__PURE__ */n.jsx(Text,{style:p.scopeHeading,accessibilityRole:"header",children:Os.whatHappensNext}),
297
- /* @__PURE__ */n.jsx(Text,{style:p.scopeBody,children:Os.whatHappensNextBody})]}),j.error?/* @__PURE__ */n.jsx(r.View,{style:h.errorBanner,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",children:/* @__PURE__ */n.jsx(Text,{style:h.errorText,children:j.error})}):null,j.created?/* @__PURE__ */n.jsx(Text,{accessibilityLiveRegion:"polite",style:h.bodyText,children:j.created.statusLabel||fn.records}):null]}),
296
+ /* @__PURE__ */n.jsx(Text,{style:p.scopeHeading,accessibilityRole:"header",children:Es.whatHappensNext}),
297
+ /* @__PURE__ */n.jsx(Text,{style:p.scopeBody,children:Es.whatHappensNextBody})]}),j.error?/* @__PURE__ */n.jsx(r.View,{style:h.errorBanner,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",children:/* @__PURE__ */n.jsx(Text,{style:h.errorText,children:j.error})}):null,j.created?/* @__PURE__ */n.jsx(Text,{accessibilityLiveRegion:"polite",style:h.bodyText,children:j.created.statusLabel||fn.records}):null]}),
298
298
  /* @__PURE__ */n.jsxs(r.View,{style:p.footer,testID:"records-consent-footer",children:[c?/* @__PURE__ */n.jsx(Pill,{label:no,kind:"link",disabled:R,onPress:c,style:p.cancel,testID:"records-consent-cancel"}):null,
299
- /* @__PURE__ */n.jsx(Pill,{label:R?Os.submitting:Os.submit,disabled:!j.ready,busy:R,onPress:()=>{r.Keyboard.dismiss(),j.submit()},style:p.submit,testID:"records-consent-submit"})]})]}),
300
- /* @__PURE__ */n.jsx(RecordsFootnote,{})]})})}function Rd(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?_d(t):Ol(_d(t),Td(r)),[t,r])}function Td(e){return{scopeCard:El(e),nextCard:El(e,{gap:8}),scopeHeading:e.cardTitle,footer:{backgroundColor:e.ground},submit:{minHeight:e.button.minHeight}}}function _d(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth,a=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({content:{paddingHorizontal:n.lg,paddingBottom:n.xl+n.xs,gap:n.lg+n.xs/2},lead:a(l.size.body,l.lineHeight.normal,t.text.muted),scopeCard:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surfaceCream,padding:n.lg,gap:n.md,...rn(e.slots.card,1)},nextCard:{borderRadius:i.lg,backgroundColor:t.surfaceSubtle,padding:n.lg,gap:n.sm,...rn(e.slots.card)},scopeHeading:{...a(l.size.subtitle,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),letterSpacing:-.4,...nn(e.slots.card)},scopeBody:{...a(l.size.bodyTight,l.lineHeight.relaxed,t.text.primary),...nn(e.slots.card)},bullets:{gap:n.sm},bulletRow:{flexDirection:"row",alignItems:"flex-start",gap:n.sm},check:{...a(l.size.body,l.lineHeight.normal,t.brandInk,"bold")},bulletText:{flex:1,...a(l.size.bodyTight,l.lineHeight.normal,t.text.primary)},retentionRow:{paddingTop:n.xs,borderTopWidth:1,borderTopColor:t.borderHairlineGreen},retentionText:a(l.size.tiny,l.lineHeight.normal,t.text.muted),serverScope:{...a(l.size.bodyTight,l.lineHeight.relaxed,t.text.secondary),paddingTop:n.xs},toggle:{flexDirection:"row",alignItems:"flex-start",gap:n.md,borderRadius:i.lg-n.xs,borderWidth:o,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md+n.xs/2},toggleChecked:{borderColor:t.brandInk,backgroundColor:t.brandSoft},box:{width:n.xl,height:n.xl,borderRadius:i.xs+1,borderWidth:1.6,borderColor:t.brandInk,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},boxChecked:{backgroundColor:t.brandInk},boxCheck:{...a(l.size.body,l.lineHeight.tight,t.surface,"bold")},toggleLabel:{flex:1,...a(l.size.bodyTight,l.lineHeight.normal,t.text.primary,"bold")},block:{gap:n.sm},signatureBlock:{gap:n.sm},gallery:{gap:n.sm,paddingVertical:n.xs},tile:{width:n.xxl*3+n.lg,height:n.xxl+n.lg+n.sm,borderRadius:i.sm,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,overflow:"hidden"},tileSelected:{borderColor:t.brandInk,borderWidth:2},tileImage:{width:"100%",height:"100%"},signatureHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},modeToggle:{minHeight:n.xxl+n.md,alignItems:"center",justifyContent:"center"},modeToggleText:{...a(l.size.bodyTight,l.lineHeight.snug,t.linkInk,"bold"),textDecorationLine:"underline"},footer:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:n.sm,paddingHorizontal:n.lg,paddingTop:n.md,paddingBottom:n.xxl,borderTopWidth:o,borderTopColor:t.borderHairlineGreen,backgroundColor:t.background},cancel:{flexGrow:0,flexShrink:0},submit:{flexGrow:1,flexShrink:1,flexBasis:n.xxl*4,minWidth:0,minHeight:n.xxl+n.lg+n.xs+n.xs/2}})}function zd(e){let t={uri:e.uri,mimeType:e.mimeType},r=Id(e);return r!==null&&(t.sizeBytes=r),/* @__PURE__ */Object.freeze(t)}function Id(e){let t=e.byteSize??e.sizeBytes;return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}function Dd(e,t){/* @__PURE__ */
301
- return Object.freeze({mode:e})}function Hd(e){return e!=null&&e.isAvailable===true}function Vd(e){return e==="above"||e==="below"?"critical":e==="in_range"?"positive":"neutral"}function Pd(e){switch(e){case"above":return"above the reference range";case"below":return"below the reference range";case"in_range":return"within range";default:return"no reference range on file"}}function Ld(e){return e.refLow!==null&&e.refHigh!==null?`, reference range ${e.refLow} to ${e.refHigh}`:e.refLow!==null?`, reference range at least ${e.refLow}`:e.refHigh!==null?`, reference range up to ${e.refHigh}`:""}function Ed(e,t){let r=t?` ${t}`:"";return e.refLow!==null&&e.refHigh!==null?`${e.refLow}-${e.refHigh}${r}`:e.refLow!==null?`≥ ${e.refLow}${r}`:e.refHigh!==null?`≤ ${e.refHigh}${r}`:"-"}function Od(e,t){let r=t.reviewed?", reviewed by our team":"",n=t.sourceClinic?`, from ${t.sourceClinic}`:"";return`${fo(t.at)}: ${zo(t.value,e.unit,t.qualitativeResult)}, ${Pd(t.status)}${Ld(t)}${n}${r}`}function Ad(e,t){if(!t)return e;let r=e.findIndex(e=>e.markerId===t);return r<=0?e:[e[r],...e.slice(0,r),...e.slice(r+1)]}var $d=7;function Bd(e,t,r=$d){let n=Math.max(0,Math.min(t,r)),i=t<=r?0:Math.max(0,Math.min(e-Math.floor(r/2),t-r));return Array.from({length:n},(e,t)=>i+t)}function Fd(e){return e?.trim()||"my pet"}function Md(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}function qd(e,t){let r=t.canonicalName.trim()||"a lab marker",n=[`I'm looking at ${Fd(e)}'s ${r}`],i=[t.latestValueText?.trim(),t.statusText?.trim(),t.trajectoryText?.trim()].filter(Boolean).join(", ");return n[0]+=i?`: ${i}.`:".",t.meaningText?.trim()&&n.push(Md(t.meaningText)),n.push(`What does this trend tell me, and should I do anything differently for ${Fd(e)}?`),{prompt:n.join(" "),entityRef:{type:"marker",id:t.markerId,payload:{marker:r,...t.statusText?.trim()?{status:t.statusText.trim()}:{}}}}}function Nd(e,t,r){let{totalMarkers:n,inRangeCount:i,outOfRangeCount:l,unknownCount:o}=t;if(n===0)return{prompt:`I'm looking at ${Fd(e)}'s lab markers, but there aren't any on file yet. What lab work is worth running for ${Fd(e)}?`,entityRef:{type:"marker_summary",id:r,payload:{total:0}}};let a=o>0?`, ${o} without a reference range`:"";return{prompt:`I'm looking at ${Fd(e)}'s lab markers: ${n} total, ${i} in range, ${l} out of range${a}. What should I focus on?`,entityRef:{type:"marker_summary",id:r,payload:{total:n,inRange:i,outOfRange:l,unknown:o}}}}function Wd(e,t){let r=t.canonicalName.trim()||"a lab marker",n=[`${r}: ${t.valueText.trim()}`];t.collectedAt?.trim()&&n.push(`collected ${t.collectedAt.trim()}`),t.sourceClinic?.trim()&&n.push(`from ${t.sourceClinic.trim()}`),t.referenceText?.trim()&&n.push(`reference range ${t.referenceText.trim()}`),t.flagged&&n.push(`flagged ${t.flagged}`);let i={marker:r};return t.flagged&&(i.status=t.flagged),t.reviewed!==void 0&&(i.reviewed=t.reviewed),{prompt:`I'm looking at ${Fd(e)}'s ${n.join(", ")}. What does this mean, and should I be concerned?`,entityRef:{type:"lab_reading",id:t.entityId,payload:i}}}function Ud(e,t,r){let n=t.clinicName?.trim(),i=t.heldItemCount??0,l=i>0?`, ${i} fact${i===1?"":"s"} being verified`:"";return{prompt:`I'm looking at ${Fd(e)}'s records request${n?` to ${n}`:""}, status: ${t.statusLabel.trim()}${l}. What does this status mean, and what happens next?`,entityRef:{type:"records_request",id:r,payload:{status:t.status,held:i,...n?{clinic:n}:{}}}}}var Gd=/* @__PURE__ */Object.freeze({vaccination:"vaccine",medication:"medication",body_weight:"weight",vital:"weight"});function Kd(e,t,r,n){let i=t.entityTypeLabel.trim()||"record",l=t.title.trim()||i,o=t.detail?.trim();return{prompt:`I'm looking at ${Fd(e)}'s ${i.toLowerCase()}: ${l}${o?`, ${o}`:""}. What does this mean, and what should I keep on top of for ${Fd(e)}?`,entityRef:{type:Gd[r]??r,id:n,payload:{kind:i,title:l,...o?{detail:o}:{}}}}}function Yd(e,t,r){let n=t.filter(e=>e.label.trim()),i={type:"upcoming_care",id:r};if(n.length===0)return{prompt:`I'm looking at ${Fd(e)}'s upcoming care, but nothing is scheduled yet. What preventive care and checkups should ${Fd(e)} be on?`,entityRef:i};let l=[...n].sort((e,t)=>(e.tone==="overdue"?0:1)-(t.tone==="overdue"?0:1)).slice(0,4).map(e=>e.relativeText.trim()?`${e.label.trim()} (${e.relativeText.trim().toLowerCase()})`:e.label.trim());return{prompt:`I'm looking at ${Fd(e)}'s upcoming care: ${l.join(", ")}. What should I prioritize for ${Fd(e)}, and how do I stay on top of these?`,entityRef:i}}function Xd(e,t,r){let n=[`I'm looking at ${Fd(e)}'s physical exam${t.observedOn?.trim()?` from ${t.observedOn.trim()}`:""}.`],i=t.abnormal.filter(e=>e.system.trim());return i.length>0?(n.push(`Abnormal: ${i.slice(0,6).map(e=>`${e.system.trim()}: ${e.finding.trim()}`).join("; ")}.`),n.push(`What do these findings mean, and what should I follow up on for ${Fd(e)}?`)):n.push(`Everything examined came back normal. What does this tell me about ${Fd(e)}'s health?`),{prompt:n.join(" "),entityRef:{type:"physical_exam",id:r}}}function Qd(e,t,r){let n=[`I'm looking at ${Fd(e)}'s visit notes${t.observedOn?.trim()?` from ${t.observedOn.trim()}`:""}.`];for(let e of t.sections.filter(e=>e.text.trim()).slice(0,3))n.push(`${e.label.trim()||"Note"}: ${Md(e.text)}`);return n.push(`Can you summarize what happened and what I should follow up on for ${Fd(e)}?`),{prompt:n.join(" "),entityRef:{type:"visit",id:r}}}function Jd(e,t,r){let n=t.scopeLabel.trim()||"a detail",i=t.candidates.filter(e=>e.value.trim()),l=i.slice(0,3).map(e=>`"${e.value.trim()}"${e.clinicName?.trim()?` (${e.clinicName.trim()})`:""}`).join(" vs ");return{prompt:`Two of ${Fd(e)}'s documents disagree on ${n}: ${l}. Which is likely correct, and what should I ask my vet?`,entityRef:{type:"conflict",id:r,payload:{field:n,severity:t.severity,values:i.map(e=>e.value.trim()).join(" | ")}}}}var Zd=/* @__PURE__ */Object.freeze({title:"Medical records",subtitle:e=>{let t=e?.trim()??"";return t.length>0?`${t}’s uploads and clinic requests`:"Every upload and clinic request"},requestRecords:"Request records",requestRecordsA11y:"Request records from a clinic",uploadOwn:"I already have the records",ownerUpload:"Records you uploaded",clinicRequest:"Clinic request",meta:(e,t)=>`${e?"Uploaded":"Requested"} ${bo(t)}`,rowA11y:(e,t,r)=>`${e}, ${t}, status ${r}`,allRequests:"Your record requests"}),ec=/* @__PURE__ */Object.freeze({preparing:"Preparing",sent:"Sent",processing:"Processing",done:"Ready"});function tc(e){switch(e){case"awaiting_clinic":return ec.sent;case"received":case"parsing":case"in_review":return ec.processing;case"published":return ec.done;default:return ec.preparing}}function rc(e){let t=e.source==="owner_provided",r=e.clinicName?.trim()||(t?Zd.ownerUpload:Zd.clinicRequest),n=e.statusLabel.trim()||tc(e.status),i=Zd.meta(t,e.createdAt);/* @__PURE__ */
299
+ /* @__PURE__ */n.jsx(Pill,{label:R?Es.submitting:Es.submit,disabled:!j.ready,busy:R,onPress:()=>{r.Keyboard.dismiss(),j.submit()},style:p.submit,testID:"records-consent-submit"})]})]}),
300
+ /* @__PURE__ */n.jsx(RecordsFootnote,{})]})})}function Rd(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?_d(t):El(_d(t),Td(r)),[t,r])}function Td(e){return{scopeCard:Ol(e),nextCard:Ol(e,{gap:8}),scopeHeading:e.cardTitle,footer:{backgroundColor:e.ground},submit:{minHeight:e.button.minHeight}}}function _d(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth,a=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({content:{paddingHorizontal:n.lg,paddingBottom:n.xl+n.xs,gap:n.lg+n.xs/2},lead:a(l.size.body,l.lineHeight.normal,t.text.muted),scopeCard:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surfaceCream,padding:n.lg,gap:n.md,...rn(e.slots.card,1)},nextCard:{borderRadius:i.lg,backgroundColor:t.surfaceSubtle,padding:n.lg,gap:n.sm,...rn(e.slots.card)},scopeHeading:{...a(l.size.subtitle,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),letterSpacing:-.4,...nn(e.slots.card)},scopeBody:{...a(l.size.bodyTight,l.lineHeight.relaxed,t.text.primary),...nn(e.slots.card)},bullets:{gap:n.sm},bulletRow:{flexDirection:"row",alignItems:"flex-start",gap:n.sm},check:{...a(l.size.body,l.lineHeight.normal,t.brandInk,"bold")},bulletText:{flex:1,...a(l.size.bodyTight,l.lineHeight.normal,t.text.primary)},retentionRow:{paddingTop:n.xs,borderTopWidth:1,borderTopColor:t.borderHairlineGreen},retentionText:a(l.size.tiny,l.lineHeight.normal,t.text.muted),serverScope:{...a(l.size.bodyTight,l.lineHeight.relaxed,t.text.secondary),paddingTop:n.xs},toggle:{flexDirection:"row",alignItems:"flex-start",gap:n.md,borderRadius:i.lg-n.xs,borderWidth:o,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md+n.xs/2},toggleChecked:{borderColor:t.brandInk,backgroundColor:t.brandSoft},box:{width:n.xl,height:n.xl,borderRadius:i.xs+1,borderWidth:1.6,borderColor:t.brandInk,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},boxChecked:{backgroundColor:t.brandInk},boxCheck:{...a(l.size.body,l.lineHeight.tight,t.surface,"bold")},toggleLabel:{flex:1,...a(l.size.bodyTight,l.lineHeight.normal,t.text.primary,"bold")},block:{gap:n.sm},signatureBlock:{gap:n.sm},gallery:{gap:n.sm,paddingVertical:n.xs},tile:{width:n.xxl*3+n.lg,height:n.xxl+n.lg+n.sm,borderRadius:i.sm,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,overflow:"hidden"},tileSelected:{borderColor:t.brandInk,borderWidth:2},tileImage:{width:"100%",height:"100%"},signatureHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},modeToggle:{minHeight:n.xxl+n.md,alignItems:"center",justifyContent:"center"},modeToggleText:{...a(l.size.bodyTight,l.lineHeight.snug,t.linkInk,"bold"),textDecorationLine:"underline"},footer:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:n.sm,paddingHorizontal:n.lg,paddingTop:n.md,paddingBottom:n.xxl,borderTopWidth:o,borderTopColor:t.borderHairlineGreen,backgroundColor:t.background},cancel:{flexGrow:0,flexShrink:0},submit:{flexGrow:1,flexShrink:1,flexBasis:n.xxl*4,minWidth:0,minHeight:n.xxl+n.lg+n.xs+n.xs/2}})}function zd(e){let t={uri:e.uri,mimeType:e.mimeType},r=Id(e);return r!==null&&(t.sizeBytes=r),/* @__PURE__ */Object.freeze(t)}function Id(e){let t=e.byteSize??e.sizeBytes;return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}function Dd(e,t){/* @__PURE__ */
301
+ return Object.freeze({mode:e})}function Hd(e){return e!=null&&e.isAvailable===true}function Vd(e){return e==="above"||e==="below"?"critical":e==="in_range"?"positive":"neutral"}function Pd(e){switch(e){case"above":return"above the reference range";case"below":return"below the reference range";case"in_range":return"within range";default:return"no reference range on file"}}function Ld(e){return e.refLow!==null&&e.refHigh!==null?`, reference range ${e.refLow} to ${e.refHigh}`:e.refLow!==null?`, reference range at least ${e.refLow}`:e.refHigh!==null?`, reference range up to ${e.refHigh}`:""}function Od(e,t){let r=t?` ${t}`:"";return e.refLow!==null&&e.refHigh!==null?`${e.refLow}-${e.refHigh}${r}`:e.refLow!==null?`≥ ${e.refLow}${r}`:e.refHigh!==null?`≤ ${e.refHigh}${r}`:"-"}function Ed(e,t){let r=t.reviewed?", reviewed by our team":"",n=t.sourceClinic?`, from ${t.sourceClinic}`:"";return`${fo(t.at)}: ${zo(t.value,e.unit,t.qualitativeResult)}, ${Pd(t.status)}${Ld(t)}${n}${r}`}function Ad(e,t){if(!t)return e;let r=e.findIndex(e=>e.markerId===t);return r<=0?e:[e[r],...e.slice(0,r),...e.slice(r+1)]}var $d=7;function Bd(e,t,r=$d){let n=Math.max(0,Math.min(t,r)),i=t<=r?0:Math.max(0,Math.min(e-Math.floor(r/2),t-r));return Array.from({length:n},(e,t)=>i+t)}function Fd(e){return e?.trim()||"my pet"}function Md(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}function qd(e,t){let r=t.canonicalName.trim()||"a lab marker",n=[`I'm looking at ${Fd(e)}'s ${r}`],i=[t.latestValueText?.trim(),t.statusText?.trim(),t.trajectoryText?.trim()].filter(Boolean).join(", ");return n[0]+=i?`: ${i}.`:".",t.meaningText?.trim()&&n.push(Md(t.meaningText)),n.push(`What does this trend tell me, and should I do anything differently for ${Fd(e)}?`),{prompt:n.join(" "),entityRef:{type:"marker",id:t.markerId,payload:{marker:r,...t.statusText?.trim()?{status:t.statusText.trim()}:{}}}}}function Nd(e,t,r){let{totalMarkers:n,inRangeCount:i,outOfRangeCount:l,unknownCount:o}=t;if(n===0)return{prompt:`I'm looking at ${Fd(e)}'s lab markers, but there aren't any on file yet. What lab work is worth running for ${Fd(e)}?`,entityRef:{type:"marker_summary",id:r,payload:{total:0}}};let a=o>0?`, ${o} without a reference range`:"";return{prompt:`I'm looking at ${Fd(e)}'s lab markers: ${n} total, ${i} in range, ${l} out of range${a}. What should I focus on?`,entityRef:{type:"marker_summary",id:r,payload:{total:n,inRange:i,outOfRange:l,unknown:o}}}}function Wd(e,t){let r=t.canonicalName.trim()||"a lab marker",n=[`${r}: ${t.valueText.trim()}`];t.collectedAt?.trim()&&n.push(`collected ${t.collectedAt.trim()}`),t.sourceClinic?.trim()&&n.push(`from ${t.sourceClinic.trim()}`),t.referenceText?.trim()&&n.push(`reference range ${t.referenceText.trim()}`),t.flagged&&n.push(`flagged ${t.flagged}`);let i={marker:r};return t.flagged&&(i.status=t.flagged),t.reviewed!==void 0&&(i.reviewed=t.reviewed),{prompt:`I'm looking at ${Fd(e)}'s ${n.join(", ")}. What does this mean, and should I be concerned?`,entityRef:{type:"lab_reading",id:t.entityId,payload:i}}}function Ud(e,t,r){let n=t.clinicName?.trim(),i=t.heldItemCount??0,l=i>0?`, ${i} fact${i===1?"":"s"} being verified`:"";return{prompt:`I'm looking at ${Fd(e)}'s records request${n?` to ${n}`:""}, status: ${t.statusLabel.trim()}${l}. What does this status mean, and what happens next?`,entityRef:{type:"records_request",id:r,payload:{status:t.status,held:i,...n?{clinic:n}:{}}}}}var Gd=/* @__PURE__ */Object.freeze({vaccination:"vaccine",medication:"medication",body_weight:"weight",vital:"weight"});function Kd(e,t,r,n){let i=t.entityTypeLabel.trim()||"record",l=t.title.trim()||i,o=t.detail?.trim();return{prompt:`I'm looking at ${Fd(e)}'s ${i.toLowerCase()}: ${l}${o?`, ${o}`:""}. What does this mean, and what should I keep on top of for ${Fd(e)}?`,entityRef:{type:Gd[r]??r,id:n,payload:{kind:i,title:l,...o?{detail:o}:{}}}}}function Yd(e,t,r){let n=t.filter(e=>e.label.trim()),i={type:"upcoming_care",id:r};if(n.length===0)return{prompt:`I'm looking at ${Fd(e)}'s upcoming care, but nothing is scheduled yet. What preventive care and checkups should ${Fd(e)} be on?`,entityRef:i};let l=[...n].sort((e,t)=>(e.tone==="overdue"?0:1)-(t.tone==="overdue"?0:1)).slice(0,4).map(e=>e.relativeText.trim()?`${e.label.trim()} (${e.relativeText.trim().toLowerCase()})`:e.label.trim());return{prompt:`I'm looking at ${Fd(e)}'s upcoming care: ${l.join(", ")}. What should I prioritize for ${Fd(e)}, and how do I stay on top of these?`,entityRef:i}}function Xd(e,t,r){let n=[`I'm looking at ${Fd(e)}'s physical exam${t.observedOn?.trim()?` from ${t.observedOn.trim()}`:""}.`],i=t.abnormal.filter(e=>e.system.trim());return i.length>0?(n.push(`Abnormal: ${i.slice(0,6).map(e=>`${e.system.trim()}: ${e.finding.trim()}`).join("; ")}.`),n.push(`What do these findings mean, and what should I follow up on for ${Fd(e)}?`)):n.push(`Everything examined came back normal. What does this tell me about ${Fd(e)}'s health?`),{prompt:n.join(" "),entityRef:{type:"physical_exam",id:r}}}function Qd(e,t,r){let n=[`I'm looking at ${Fd(e)}'s visit notes${t.observedOn?.trim()?` from ${t.observedOn.trim()}`:""}.`];for(let e of t.sections.filter(e=>e.text.trim()).slice(0,3))n.push(`${e.label.trim()||"Note"}: ${Md(e.text)}`);return n.push(`Can you summarize what happened and what I should follow up on for ${Fd(e)}?`),{prompt:n.join(" "),entityRef:{type:"visit",id:r}}}function Jd(e,t,r){let n=t.scopeLabel.trim()||"a detail",i=t.candidates.filter(e=>e.value.trim()),l=i.slice(0,3).map(e=>`"${e.value.trim()}"${e.clinicName?.trim()?` (${e.clinicName.trim()})`:""}`).join(" vs ");return{prompt:`Two of ${Fd(e)}'s documents disagree on ${n}: ${l}. Which is likely correct, and what should I ask my vet?`,entityRef:{type:"conflict",id:r,payload:{field:n,severity:t.severity,values:i.map(e=>e.value.trim()).join(" | ")}}}}var Zd=/* @__PURE__ */Object.freeze({title:"Medical records",subtitle:e=>{let t=e?.trim()??"";return t.length>0?`${t}’s uploads and clinic requests`:"Every upload and clinic request"},requestRecords:"Request records",requestRecordsA11y:"Request records from a clinic",uploadOwn:"I already have the records",ownerUpload:"Records you uploaded",clinicRequest:"Clinic request",meta:(e,t)=>`${e?"Uploaded":"Requested"} ${bo(t)}`,rowA11y:(e,t,r)=>`${e}, ${t}, status ${r}`,allRequests:"Your record requests"}),ec=/* @__PURE__ */Object.freeze({preparing:"Preparing",sent:"Sent",processing:"Processing",done:"Ready"});function tc(e){switch(e){case"awaiting_clinic":return ec.sent;case"received":case"parsing":case"in_review":return ec.processing;case"published":return ec.done;default:return ec.preparing}}function rc(e){let t=e.source==="owner_provided",r=e.clinicName?.trim()||(t?Zd.ownerUpload:Zd.clinicRequest),n=e.statusLabel.trim()||tc(e.status),i=Zd.meta(t,e.createdAt);/* @__PURE__ */
302
302
  return Object.freeze({source:r,meta:i,status:n,ownerUpload:t,a11yLabel:Zd.rowA11y(r,i,n)})}var nc=/* @__PURE__ */new Set(["records_received","parsing","parsing_failed","in_review","review_email_failed"]),ic=/* @__PURE__ */new Set(["received","parsing","in_review"]);function lc(e){return e.wireStatus!==void 0?nc.has(e.wireStatus):ic.has(e.status)}function oc(e,t,r={}){let n=e.filter(e=>!isTerminalStatus(e.status));if(e.length===0||r.activeOnly===true&&n.length===0)return null;let i=e.filter(lc).length,l=i>0?`${i} document${i===1?"":"s"} being read`:n.length>0?`${n.length} active record request${n.length===1?"":"s"}`:Zd.allRequests,o=i>0?`We’ll add ${i===1?"it":"them"} to ${t}’s records once ready.`:n.length>0?"See each clinic’s status and what happens next.":"See the status of every upload and clinic request.";/* @__PURE__ */
303
303
  return Object.freeze({title:l,subtitle:o,processing:i>0,a11yLabel:`${l}. ${o}`})}function ac(e){return e!==void 0}function sc(e,t){return e??t?.version??""}function dc(e,t){return sc(e,t).length>0}function cc(e,t){return e.denialReason==="consent_required"?t?{kind:"consent_required"}:{kind:"consent_unavailable"}:e.denialReason==="pet_not_found"?{kind:"pet_not_found",error:makeEverfurError("petNotFound",{retryable:false})}:e.denialReason==="entitlement"?{kind:"error",error:makeEverfurError("accessDenied")}:e.denialReason==="session_required"?{kind:"session_required"}:e.withheld?{kind:"withheld"}:e.error===null?{kind:"withheld"}:{kind:"error",error:e.error}}function uc(e){return e.kind==="consent_required"||e.kind==="consent_unavailable"}function selectRequestTitle(e){let t=e.clinicName?.trim()??"";return t.length>0?t:e.source==="owner_provided"?hc.ownerUpload:hc.clinicRequest}var hc=/* @__PURE__ */Object.freeze({ownerUpload:"Records you uploaded",clinicRequest:"Record request"});function pc(e,t){return t===null||t.status!=="awaiting_upload"?null:t}function gc(e){return`${e} ${fn.beingReviewed}`}function selectRequestList(e){let t=[...e].sort((e,t)=>e.updatedAt!==t.updatedAt?e.updatedAt>t.updatedAt?-1:1:e.createdAt!==t.createdAt?e.createdAt>t.createdAt?-1:1:0);/* @__PURE__ */
304
304
  return Object.freeze(t)}function selectPrimaryLabel(e){let t=e.actionNeededLabel?.trim()??"";return t.length>0?t:e.statusLabel}function selectClinicCall(e){if(e.showClinicPhone!==true)return null;let t=e.clinicPhone?.trim()??"";return t.length===0?null:{phone:t,dial:`tel:${t.replace(/[^+\d]/g,"")}`,clinicName:e.clinicName?.trim()||null}}function fc(e){switch(e.wireStatus??e.status){case"published":return"positive";case"failed":case"clinic_declined":return"critical";case"revoked":return"neutral";case"clinic_responded_no_records":case"awaiting_upload":case"records_received":case"parsing":case"parsing_failed":case"in_review":case"review_email_failed":return"warning";default:return"info"}}var mc=200,bc=16;function yc(e,t){let r=e.inRangeCount+e.outOfRangeCount+e.unknownCount;if(!Number.isFinite(r)||r<=0)return[];let n=[{key:"in_range",color:t.inRange,count:e.inRangeCount},{key:"out_of_range",color:t.outOfRange,count:e.outOfRangeCount},{key:"unknown",color:t.unknown,count:e.unknownCount}],i=0,l=[];for(let e of n){if(!(e.count>0))continue;let t=e.count/r*360;if(!Number.isFinite(t))return null;l.push({key:e.key,color:e.color,startDeg:i,sweepDeg:t}),i+=t}return l}function MarkerSummaryCard({summary:t,onAsk:i,testID:l}){let o=xc(),a=useEverfurTheme(),{totalMarkers:s,inRangeCount:d,outOfRangeCount:c,unknownCount:u}=t,h=e.useMemo(()=>yc(t,{inRange:a.color.success,outOfRange:a.color.danger,unknown:a.color.text.muted}),[t,a]),p=h!==null&&h.length>0;/* @__PURE__ */
@@ -321,7 +321,7 @@ return n.jsx(r.View,{style:[a.page,i!==void 0?{width:i}:null],testID:`marker-car
321
321
  /* @__PURE__ */n.jsx(Text,{style:[a.latestValue,d.outOfRange?a.latestValueDanger:null],accessibilityLabel:kn.latestA11y(p,d.label,fo(t.latest.at)),children:p}),
322
322
  /* @__PURE__ */n.jsx(Text,{style:a.latestDate,children:fo(t.latest.at)})]}):null,u?/* @__PURE__ */n.jsx(Text,{style:a.trajectory,accessibilityRole:"text",children:u}):null,h!==null?/* @__PURE__ */n.jsxs(r.View,{style:a.chartWrap,children:[
323
323
  /* @__PURE__ */n.jsxs(r.View,{style:a.plot,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:[h.band?/* @__PURE__ */n.jsx(r.View,{style:[a.band,{top:Rc(h.band.topPct),height:Rc(Math.max(0,h.band.bottomPct-h.band.topPct))}]}):null,h.points.map(e=>/* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>l(t,e.point),hitSlop:12,style:[a.point,e.status==="above"||e.status==="below"?a.pointDanger:null,{left:Rc(e.xPct),top:Rc(e.yPct)}],testID:`marker-point-${t.markerId}-${e.index}`},e.index))]}),
324
- /* @__PURE__ */n.jsx(r.View,{style:a.a11yTable,accessibilityRole:"summary",accessibilityLabel:kn.readingsA11y(t.name),children:t.points.map((e,i)=>/* @__PURE__ */n.jsx(r.View,{accessibilityRole:"text",accessibilityLabel:Od(t,e)},i))}),
324
+ /* @__PURE__ */n.jsx(r.View,{style:a.a11yTable,accessibilityRole:"summary",accessibilityLabel:kn.readingsA11y(t.name),children:t.points.map((e,i)=>/* @__PURE__ */n.jsx(r.View,{accessibilityRole:"text",accessibilityLabel:Ed(t,e)},i))}),
325
325
  /* @__PURE__ */n.jsx(Text,{style:t.points.length===1?a.singleHint:a.tapHint,children:t.points.length===1?kn.singleHint:kn.tapHint})]}):/* @__PURE__ */n.jsx(r.View,{style:a.emptyBody,accessibilityRole:"text",children:/* @__PURE__ */n.jsx(Text,{style:a.emptyText,children:kn.empty})}),o?/* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>o(t),accessibilityRole:"button",accessibilityLabel:kn.askNamed(t.name),style:[s.pill,s.pillAsk],testID:`marker-ask-${t.markerId}`,children:/* @__PURE__ */n.jsx(Text,{style:s.pillAskLabel,children:kn.askNamed(t.name)})}):null]})})}function MarkerTrendCarousel({markers:t,onPointPress:i,onAsk:l,featuredMarkerId:o}){let a=e.useMemo(()=>Ad(t,o),[t,o]),s=Tc(),[d,c]=e.useState(0),[u,h]=e.useState(0),p=e=>c(e.nativeEvent.layout.width),g=e=>{if(d<=0)return;let t=Math.round(e.nativeEvent.contentOffset.x/d);h(Math.max(0,Math.min(t,a.length-1)))},f=a[u]??null;/* @__PURE__ */
326
326
  return n.jsxs(r.View,{style:s.carousel,onLayout:p,testID:"marker-carousel",children:[
327
327
  /* @__PURE__ */n.jsx(r.ScrollView,{horizontal:true,pagingEnabled:true,showsHorizontalScrollIndicator:false,onMomentumScrollEnd:g,snapToAlignment:"start",children:a.map(e=>/* @__PURE__ */n.jsx(MarkerTrendCard,{marker:e,width:d>0?d:void 0,onPointPress:i,onAsk:l},e.markerId))}),
@@ -340,31 +340,31 @@ return n.jsxs(r.Modal,{transparent:true,visible:true,animationType:"slide",onReq
340
340
  /* @__PURE__ */n.jsxs(r.View,{style:o.sheetBody,children:[
341
341
  /* @__PURE__ */n.jsxs(r.View,{style:o.valueRow,children:[
342
342
  /* @__PURE__ */n.jsx(Text,{style:o.sheetName,children:e.name}),
343
- /* @__PURE__ */n.jsx(Text,{style:o.sheetValue,children:zo(t.value,e.unit,t.qualitativeResult)})]}),t.reviewed?/* @__PURE__ */n.jsx(r.View,{style:o.reviewed,accessibilityRole:"text",children:/* @__PURE__ */n.jsx(Text,{style:o.reviewedText,children:jn.reviewed})}):null,d(jn.collected,fo(t.at)),t.sourceClinic?d(jn.clinic,t.sourceClinic):null,d(jn.referenceRange,t.refLow!==null||t.refHigh!==null?Ed(t,e.unit):jn.noRange),t.docId?d(jn.sourceDocument,t.docId):null,t.reviewed?null:/* @__PURE__ */n.jsx(Text,{style:o.unverified,accessibilityRole:"text",children:jn.unverified}),l?/* @__PURE__ */n.jsx(r.Pressable,{onPress:l,accessibilityRole:"button",accessibilityLabel:jn.ask,style:[a.pill,a.pillAsk],testID:"marker-provenance-ask",children:/* @__PURE__ */n.jsx(Text,{style:a.pillAskLabel,children:jn.ask})}):null]})]})]})}function Tc(){let t=useEverfurTheme();return e.useMemo(()=>_c(t),[t])}function _c(e){let{color:t,space:n,radius:i,type:l,slots:o}=e,a=r.StyleSheet.hairlineWidth,s=n.md,d=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n}),c=nn(ln(o)),u=nn(o.dialog),h={...d(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold")},p=d(l.size.verdict+n.xs,l.lineHeight.tight,t.text.primary,"bold");return r.StyleSheet.create({page:{paddingHorizontal:n.sm},card:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,padding:n.lg,gap:n.md,...rn(ln(o),1)},headerRow:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:n.sm+n.xs/2},nameColumn:{flex:1,gap:n.xs/2},markerName:{...h,...c},sheetName:{...h,...u},unit:{...face(e,"mono"),fontSize:l.size.tiny,lineHeight:l.size.body,color:t.text.muted,...c},latestRow:{flexDirection:"row",alignItems:"baseline",justifyContent:"space-between",gap:n.md},latestValue:{...p,...c},sheetValue:{...p,...u},latestValueDanger:{color:t.danger},latestDate:{...d(l.size.caption,l.lineHeight.normal,t.text.muted),...c},trajectory:{...d(l.size.bodyTight,l.lineHeight.normal,t.text.muted),...c},chartWrap:{gap:n.sm},plot:{height:Cc,borderRadius:i.sm,backgroundColor:t.surfaceCream,borderWidth:a,borderColor:t.borderHairlineGreen,overflow:"hidden"},band:{position:"absolute",left:0,right:0,backgroundColor:t.badgeBgPositive},point:{position:"absolute",width:s,height:s,borderRadius:s/2,marginLeft:-s/2,marginTop:-s/2,backgroundColor:t.brand,borderWidth:2,borderColor:t.surface},pointDanger:{backgroundColor:t.danger},a11yTable:{width:1,height:1,overflow:"hidden",position:"absolute"},tapHint:{...d(l.size.tiny,l.lineHeight.normal,t.text.placeholder),textAlign:"center",...c},singleHint:{...d(l.size.caption,l.lineHeight.normal,t.text.muted),textAlign:"center",...c},emptyBody:{alignItems:"center",justifyContent:"center",gap:n.sm,paddingVertical:n.xxl+n.xs},emptyText:{...d(l.size.bodyTight,l.lineHeight.normal,t.text.muted),textAlign:"center",...c},carousel:{height:Sc},footer:{alignItems:"center",gap:n.sm,paddingTop:n.md},dots:{flexDirection:"row",gap:n.xs+n.xs/2},dot:{width:n.xs+n.xs/2,height:n.xs+n.xs/2,borderRadius:n.xs-1,backgroundColor:t.borderHairlineGreen},dotActive:{width:n.lg+n.xs/2,backgroundColor:t.brand},counter:{...face(e,"mono"),fontSize:l.size.tiny,lineHeight:l.size.body,letterSpacing:l.letterSpacing.eyebrow/3,color:t.text.muted},backdrop:{flex:1,backgroundColor:Kl},sheet:{backgroundColor:t.surfaceCream,borderTopLeftRadius:i.xl-n.xs,borderTopRightRadius:i.xl-n.xs,paddingHorizontal:n.lg+n.xs,paddingTop:n.sm,paddingBottom:n.xxl+n.xs,maxHeight:"80%",gap:n.md,...jc(o.dialog)},handle:{alignSelf:"center",width:n.xxl+n.xs,height:n.xs,borderRadius:i.pill,backgroundColor:t.borderRingCream},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.sm},sheetTitle:{flex:1,...d(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...u},closeButton:{width:n.xxl+n.md,height:n.xxl+n.md,alignItems:"center",justifyContent:"center"},closeGlyph:{...d(l.size.verdict,l.lineHeight.tight,t.text.primary),...u},sheetBody:{gap:n.md},valueRow:{flexDirection:"row",alignItems:"baseline",justifyContent:"space-between",gap:n.md},reviewed:{alignSelf:"flex-start",borderRadius:i.pill,paddingHorizontal:n.sm+n.xs/2,paddingVertical:n.xs,backgroundColor:t.badgeBgPositive},reviewedText:{...d(l.size.tiny,l.lineHeight.normal,t.success,"medium")},detailRow:{gap:n.xs/2},detailLabel:{...d(l.size.caption,l.lineHeight.normal,t.text.muted,"medium"),...u},detailValue:{...d(l.size.body,l.lineHeight.normal,t.text.primary),...u},unverified:{...d(l.size.caption,l.lineHeight.normal,t.text.muted),...u}})}var zc=/* @__PURE__ */Object.freeze({vaccination:"Vaccination",medication:"Medication",problem:"Problem",body_weight:"Weight",allergy:"Allergy",vital:"Vital",lab_result:"Lab result",parasite_prevention:"Preventive"}),Ic="Given",Dc=/^\d{4}-\d{2}-\d{2}/,Hc=" · ";function Vc(e){let t=e.filter(e=>e!==null&&e.trim().length>0);return t.length>0?t.join(Hc):null}function Pc(e,t){let r=e.label.trim();if(r.length>0)return r;let n=zc[e.category];return n!==void 0?n:t(e.category)}function Lc(e,t){let r=Pc(e,t.humanize),n=t.formatEntityValue(e.value,e.unit),i=n.trim().length>0?n:null,l=e.observedAt!==null&&e.observedAt.trim().length>0?t.formatRecordsDate(e.observedAt):null,o=l!==null&&l!=="-"?l:null;switch(e.category){case"vaccination":{let n=e.value!==null&&Dc.test(e.value.trim()),l=n?t.formatRecordsDate(e.value):o;return l!==null&&l!=="-"?{title:r,detail:Vc([`${Ic} ${l}`,n?null:i])}:{title:r,detail:Vc([i])}}case"medication":return{title:r,detail:Vc([o])};case"problem":return{title:r,detail:Vc([o])};case"body_weight":return{title:r,detail:Vc([o])};case"allergy":return{title:r,detail:Vc([o])};case"vital":return{title:r,detail:Vc([i,o])};case"lab_result":return{title:r,detail:Vc([i,o])};default:return{title:r,detail:Vc([i,o])}}}var Ec=/* @__PURE__ */Object.freeze({editA11y:e=>`Edit ${e}. Correct or remove this record detail.`,title:e=>`Edit ${e}`,helper:"Corrects your record. Your vet can still review it.",close:"Close",closeEditorA11y:"Close editor",save:"Save changes",saving:"Saving...",remove:"Remove this detail",confirmRemove:"Remove this detail from your record? This can't be undone.",removeConfirm:"Remove",removing:"Removing...",keep:"Keep",noChange:"Change a value before saving.",saved:"Saved.",removed:"Removed.",detail:"record detail"});function Oc(e,t){return Ve(e)?t==="remove"?"Records access for this pet is off, so this detail cannot be removed.":"Records access for this pet is off, so this detail cannot be changed.":isFactReviewerLocked(e)?t==="remove"?"A clinician already reviewed this detail, so it can't be removed here.":"A clinician already reviewed this detail, so it can't be changed here.":t==="remove"?"Couldn't remove that. Please check your connection and try again.":"Couldn't save that. Please check your connection and try again."}var Ac=/* @__PURE__ */Object.freeze({edits:/* @__PURE__ */Object.freeze({}),removed:/* @__PURE__ */Object.freeze([])});function applyFactOverlay(e,t){if(Object.keys(t.edits).length===0&&t.removed.length===0)return e;let r=[];for(let n of e){let e=n.canonicalKey??null;if(e!==null&&t.removed.includes(e))continue;let i=e!==null?t.edits[e]:void 0;r.push(i===void 0?n:/* @__PURE__ */Object.freeze({...n,value:i}))}/* @__PURE__ */
344
- return Object.freeze(r)}function isFactEditable(e){return typeof e.canonicalKey=="string"&&e.canonicalKey.length>0}function $c(){return`records-fact-${Date.now().toString(36)}`}function useRecordFactEdit(petRef,t={}){let r=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),[n,i]=e.useState(Ac),[l,o]=e.useState(false),[a,s]=e.useState(null),d=e.useMemo(()=>({}),[r,petRef,userRef]),[c,u]=e.useState(null),h=e.useCallback(()=>u(d),[d]),[p,g]=e.useState(null);e.useEffect(()=>{if(userRef===null||r.readFeatures===void 0)return;let e=true;return r.readFeatures().then(t=>{e&&t.features.fact_edit===false&&g(d)},()=>{}),()=>{e=false}},[r,userRef,d]);let f=userRef!==null&&c!==d&&p!==d,m=e.useRef(false),b=e.useRef(t.newIdempotencyKey);b.current=t.newIdempotencyKey;let y=e.useCallback(()=>(b.current??$c)(),[]),x=e.useCallback((e,t,r)=>{if(o(false),!e.ok){if(t(),wd(e.error)){h();return}s(Oc(e.error,r))}},[h]),w=e.useCallback(async(e,t)=>{let l=e.canonicalKey??"",a=t.trim();if(m.current||l.length===0||a.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));m.current=true,o(true),s(null);let d=n;i(e=>({...e,edits:{...e.edits,[l]:a}}));let c=await r.editFact(petRef,{entityType:e.category,canonicalKey:l,correctedFields:factCorrectionFor(e.value,a),idempotencyKey:y()});return m.current=false,x(c,()=>i(d),"edit"),c},[r,petRef,n,x,y]),v=e.useCallback(async e=>{let t=e.canonicalKey??"";if(m.current||t.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));m.current=true,o(true),s(null);let l=n;i(e=>({...e,removed:[...e.removed,t]}));let a=await r.removeFact(petRef,{entityType:e.category,canonicalKey:t,idempotencyKey:y()});return m.current=false,x(a,()=>i(l),"remove"),a},[r,petRef,n,x,y]),k=e.useCallback(()=>s(null),[]);return e.useMemo(()=>({overlay:n,busy:l,error:a,available:f,edit:w,remove:v,clearError:k}),[n,l,a,f,w,v,k])}var Bc=/* @__PURE__ */Object.freeze(["vaccination","parasite_prevention"]),Fc="Undated",Mc=/* @__PURE__ */Object.freeze({given:"Given",prevention:"Prevention",overdue:"Overdue",noDate:"No date"}),qc=/* @__PURE__ */Object.freeze({given:"positive",prevention:"neutral",overdue:"critical",noDate:"neutral"});function Nc(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Wc(e){let t=e.status?.toLowerCase()??"";return/overdue|lapsed|expired/.test(t)}function Uc(e){return e.category==="parasite_prevention"?"prevention":Nc(e.observedAt)===null?"noDate":Wc(e)?"overdue":"given"}function Gc(e){let t=Nc(e);return t===null?Fc:String(new Date(t).getUTCFullYear())}function Kc(e){let t=Uc(e),r=[e.value!==null&&e.value.length>0?e.value:null,e.observedAt!==null?fo(e.observedAt):null].filter(e=>e!==null&&e.length>0);return{key:e.key,name:e.label,detail:r.length>0?r.join(" · "):null,statusLabel:Mc[t],tone:t,entity:e}}function Yc(e){let t=/* @__PURE__ */new Map;for(let r of e){if(!Bc.includes(r.category))continue;let e=Gc(r.observedAt),n=t.get(e),i={row:Kc(r),at:r.observedAt};n===void 0?t.set(e,[i]):n.push(i)}let r=[...t.keys()].sort((e,t)=>e===Fc?1:t===Fc?-1:Number(t)-Number(e));/* @__PURE__ */
343
+ /* @__PURE__ */n.jsx(Text,{style:o.sheetValue,children:zo(t.value,e.unit,t.qualitativeResult)})]}),t.reviewed?/* @__PURE__ */n.jsx(r.View,{style:o.reviewed,accessibilityRole:"text",children:/* @__PURE__ */n.jsx(Text,{style:o.reviewedText,children:jn.reviewed})}):null,d(jn.collected,fo(t.at)),t.sourceClinic?d(jn.clinic,t.sourceClinic):null,d(jn.referenceRange,t.refLow!==null||t.refHigh!==null?Od(t,e.unit):jn.noRange),t.docId?d(jn.sourceDocument,t.docId):null,t.reviewed?null:/* @__PURE__ */n.jsx(Text,{style:o.unverified,accessibilityRole:"text",children:jn.unverified}),l?/* @__PURE__ */n.jsx(r.Pressable,{onPress:l,accessibilityRole:"button",accessibilityLabel:jn.ask,style:[a.pill,a.pillAsk],testID:"marker-provenance-ask",children:/* @__PURE__ */n.jsx(Text,{style:a.pillAskLabel,children:jn.ask})}):null]})]})]})}function Tc(){let t=useEverfurTheme();return e.useMemo(()=>_c(t),[t])}function _c(e){let{color:t,space:n,radius:i,type:l,slots:o}=e,a=r.StyleSheet.hairlineWidth,s=n.md,d=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n}),c=nn(ln(o)),u=nn(o.dialog),h={...d(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold")},p=d(l.size.verdict+n.xs,l.lineHeight.tight,t.text.primary,"bold");return r.StyleSheet.create({page:{paddingHorizontal:n.sm},card:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,padding:n.lg,gap:n.md,...rn(ln(o),1)},headerRow:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:n.sm+n.xs/2},nameColumn:{flex:1,gap:n.xs/2},markerName:{...h,...c},sheetName:{...h,...u},unit:{...face(e,"mono"),fontSize:l.size.tiny,lineHeight:l.size.body,color:t.text.muted,...c},latestRow:{flexDirection:"row",alignItems:"baseline",justifyContent:"space-between",gap:n.md},latestValue:{...p,...c},sheetValue:{...p,...u},latestValueDanger:{color:t.danger},latestDate:{...d(l.size.caption,l.lineHeight.normal,t.text.muted),...c},trajectory:{...d(l.size.bodyTight,l.lineHeight.normal,t.text.muted),...c},chartWrap:{gap:n.sm},plot:{height:Cc,borderRadius:i.sm,backgroundColor:t.surfaceCream,borderWidth:a,borderColor:t.borderHairlineGreen,overflow:"hidden"},band:{position:"absolute",left:0,right:0,backgroundColor:t.badgeBgPositive},point:{position:"absolute",width:s,height:s,borderRadius:s/2,marginLeft:-s/2,marginTop:-s/2,backgroundColor:t.brand,borderWidth:2,borderColor:t.surface},pointDanger:{backgroundColor:t.danger},a11yTable:{width:1,height:1,overflow:"hidden",position:"absolute"},tapHint:{...d(l.size.tiny,l.lineHeight.normal,t.text.placeholder),textAlign:"center",...c},singleHint:{...d(l.size.caption,l.lineHeight.normal,t.text.muted),textAlign:"center",...c},emptyBody:{alignItems:"center",justifyContent:"center",gap:n.sm,paddingVertical:n.xxl+n.xs},emptyText:{...d(l.size.bodyTight,l.lineHeight.normal,t.text.muted),textAlign:"center",...c},carousel:{height:Sc},footer:{alignItems:"center",gap:n.sm,paddingTop:n.md},dots:{flexDirection:"row",gap:n.xs+n.xs/2},dot:{width:n.xs+n.xs/2,height:n.xs+n.xs/2,borderRadius:n.xs-1,backgroundColor:t.borderHairlineGreen},dotActive:{width:n.lg+n.xs/2,backgroundColor:t.brand},counter:{...face(e,"mono"),fontSize:l.size.tiny,lineHeight:l.size.body,letterSpacing:l.letterSpacing.eyebrow/3,color:t.text.muted},backdrop:{flex:1,backgroundColor:Kl},sheet:{backgroundColor:t.surfaceCream,borderTopLeftRadius:i.xl-n.xs,borderTopRightRadius:i.xl-n.xs,paddingHorizontal:n.lg+n.xs,paddingTop:n.sm,paddingBottom:n.xxl+n.xs,maxHeight:"80%",gap:n.md,...jc(o.dialog)},handle:{alignSelf:"center",width:n.xxl+n.xs,height:n.xs,borderRadius:i.pill,backgroundColor:t.borderRingCream},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.sm},sheetTitle:{flex:1,...d(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...u},closeButton:{width:n.xxl+n.md,height:n.xxl+n.md,alignItems:"center",justifyContent:"center"},closeGlyph:{...d(l.size.verdict,l.lineHeight.tight,t.text.primary),...u},sheetBody:{gap:n.md},valueRow:{flexDirection:"row",alignItems:"baseline",justifyContent:"space-between",gap:n.md},reviewed:{alignSelf:"flex-start",borderRadius:i.pill,paddingHorizontal:n.sm+n.xs/2,paddingVertical:n.xs,backgroundColor:t.badgeBgPositive},reviewedText:{...d(l.size.tiny,l.lineHeight.normal,t.success,"medium")},detailRow:{gap:n.xs/2},detailLabel:{...d(l.size.caption,l.lineHeight.normal,t.text.muted,"medium"),...u},detailValue:{...d(l.size.body,l.lineHeight.normal,t.text.primary),...u},unverified:{...d(l.size.caption,l.lineHeight.normal,t.text.muted),...u}})}var zc=/* @__PURE__ */Object.freeze({vaccination:"Vaccination",medication:"Medication",problem:"Problem",body_weight:"Weight",allergy:"Allergy",vital:"Vital",lab_result:"Lab result",parasite_prevention:"Preventive"}),Ic="Given",Dc=/^\d{4}-\d{2}-\d{2}/,Hc=" · ";function Vc(e){let t=e.filter(e=>e!==null&&e.trim().length>0);return t.length>0?t.join(Hc):null}function Pc(e,t){let r=e.label.trim();if(r.length>0)return r;let n=zc[e.category];return n!==void 0?n:t(e.category)}function Lc(e,t){let r=Pc(e,t.humanize),n=t.formatEntityValue(e.value,e.unit),i=n.trim().length>0?n:null,l=e.observedAt!==null&&e.observedAt.trim().length>0?t.formatRecordsDate(e.observedAt):null,o=l!==null&&l!=="-"?l:null;switch(e.category){case"vaccination":{let n=e.value!==null&&Dc.test(e.value.trim()),l=n?t.formatRecordsDate(e.value):o;return l!==null&&l!=="-"?{title:r,detail:Vc([`${Ic} ${l}`,n?null:i])}:{title:r,detail:Vc([i])}}case"medication":return{title:r,detail:Vc([o])};case"problem":return{title:r,detail:Vc([o])};case"body_weight":return{title:r,detail:Vc([o])};case"allergy":return{title:r,detail:Vc([o])};case"vital":return{title:r,detail:Vc([i,o])};case"lab_result":return{title:r,detail:Vc([i,o])};default:return{title:r,detail:Vc([i,o])}}}var Oc=/* @__PURE__ */Object.freeze({editA11y:e=>`Edit ${e}. Correct or remove this record detail.`,title:e=>`Edit ${e}`,helper:"Corrects your record. Your vet can still review it.",close:"Close",closeEditorA11y:"Close editor",save:"Save changes",saving:"Saving...",remove:"Remove this detail",confirmRemove:"Remove this detail from your record? This can't be undone.",removeConfirm:"Remove",removing:"Removing...",keep:"Keep",noChange:"Change a value before saving.",saved:"Saved.",removed:"Removed.",detail:"record detail"});function Ec(e,t){return Ve(e)?t==="remove"?"Records access for this pet is off, so this detail cannot be removed.":"Records access for this pet is off, so this detail cannot be changed.":isFactReviewerLocked(e)?t==="remove"?"A clinician already reviewed this detail, so it can't be removed here.":"A clinician already reviewed this detail, so it can't be changed here.":t==="remove"?"Couldn't remove that. Please check your connection and try again.":"Couldn't save that. Please check your connection and try again."}var Ac=/* @__PURE__ */Object.freeze({edits:/* @__PURE__ */Object.freeze({}),removed:/* @__PURE__ */Object.freeze([])});function applyFactOverlay(e,t){if(Object.keys(t.edits).length===0&&t.removed.length===0)return e;let r=[];for(let n of e){let e=n.canonicalKey??null;if(e!==null&&t.removed.includes(e))continue;let i=e!==null?t.edits[e]:void 0;r.push(i===void 0?n:/* @__PURE__ */Object.freeze({...n,value:i}))}/* @__PURE__ */
344
+ return Object.freeze(r)}function isFactEditable(e){return typeof e.canonicalKey=="string"&&e.canonicalKey.length>0}function $c(){return`records-fact-${Date.now().toString(36)}`}function useRecordFactEdit(petRef,t={}){let r=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),[n,i]=e.useState(Ac),[l,o]=e.useState(false),[a,s]=e.useState(null),d=e.useMemo(()=>({}),[r,petRef,userRef]),[c,u]=e.useState(null),h=e.useCallback(()=>u(d),[d]),[p,g]=e.useState(null);e.useEffect(()=>{if(userRef===null||r.readFeatures===void 0)return;let e=true;return r.readFeatures().then(t=>{e&&t.features.fact_edit===false&&g(d)},()=>{}),()=>{e=false}},[r,userRef,d]);let f=userRef!==null&&c!==d&&p!==d,m=e.useRef(false),b=e.useRef(t.newIdempotencyKey);b.current=t.newIdempotencyKey;let y=e.useCallback(()=>(b.current??$c)(),[]),x=e.useCallback((e,t,r)=>{if(o(false),!e.ok){if(t(),wd(e.error)){h();return}s(Ec(e.error,r))}},[h]),w=e.useCallback(async(e,t)=>{let l=e.canonicalKey??"",a=t.trim();if(m.current||l.length===0||a.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));m.current=true,o(true),s(null);let d=n;i(e=>({...e,edits:{...e.edits,[l]:a}}));let c=await r.editFact(petRef,{entityType:e.category,canonicalKey:l,correctedFields:factCorrectionFor(e.value,a),idempotencyKey:y()});return m.current=false,x(c,()=>i(d),"edit"),c},[r,petRef,n,x,y]),v=e.useCallback(async e=>{let t=e.canonicalKey??"";if(m.current||t.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));m.current=true,o(true),s(null);let l=n;i(e=>({...e,removed:[...e.removed,t]}));let a=await r.removeFact(petRef,{entityType:e.category,canonicalKey:t,idempotencyKey:y()});return m.current=false,x(a,()=>i(l),"remove"),a},[r,petRef,n,x,y]),k=e.useCallback(()=>s(null),[]);return e.useMemo(()=>({overlay:n,busy:l,error:a,available:f,edit:w,remove:v,clearError:k}),[n,l,a,f,w,v,k])}var Bc=/* @__PURE__ */Object.freeze(["vaccination","parasite_prevention"]),Fc="Undated",Mc=/* @__PURE__ */Object.freeze({given:"Given",prevention:"Prevention",overdue:"Overdue",noDate:"No date"}),qc=/* @__PURE__ */Object.freeze({given:"positive",prevention:"neutral",overdue:"critical",noDate:"neutral"});function Nc(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Wc(e){let t=e.status?.toLowerCase()??"";return/overdue|lapsed|expired/.test(t)}function Uc(e){return e.category==="parasite_prevention"?"prevention":Nc(e.observedAt)===null?"noDate":Wc(e)?"overdue":"given"}function Gc(e){let t=Nc(e);return t===null?Fc:String(new Date(t).getUTCFullYear())}function Kc(e){let t=Uc(e),r=[e.value!==null&&e.value.length>0?e.value:null,e.observedAt!==null?fo(e.observedAt):null].filter(e=>e!==null&&e.length>0);return{key:e.key,name:e.label,detail:r.length>0?r.join(" · "):null,statusLabel:Mc[t],tone:t,entity:e}}function Yc(e){let t=/* @__PURE__ */new Map;for(let r of e){if(!Bc.includes(r.category))continue;let e=Gc(r.observedAt),n=t.get(e),i={row:Kc(r),at:r.observedAt};n===void 0?t.set(e,[i]):n.push(i)}let r=[...t.keys()].sort((e,t)=>e===Fc?1:t===Fc?-1:Number(t)-Number(e));/* @__PURE__ */
345
345
  return Object.freeze(r.map(e=>{let r=t.get(e)??[],n=e===Fc?r:[...r].sort((e,t)=>(Nc(t.at)??0)-(Nc(e.at)??0));/* @__PURE__ */
346
- return Object.freeze({year:e,items:/* @__PURE__ */Object.freeze(n.map(e=>e.row))})}))}var Xc=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});function FactEditAffordance({entity:t,factEdit:i,children:l}){let o=Qc(),[a,s]=e.useState(false),d=t.label.trim()||Ec.detail;/* @__PURE__ */
346
+ return Object.freeze({year:e,items:/* @__PURE__ */Object.freeze(n.map(e=>e.row))})}))}var Xc=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});function FactEditAffordance({entity:t,factEdit:i,children:l}){let o=Qc(),[a,s]=e.useState(false),d=t.label.trim()||Oc.detail;/* @__PURE__ */
347
347
  return n.jsxs(r.View,{style:o.row,children:[
348
348
  /* @__PURE__ */n.jsx(r.View,{style:o.main,children:l}),
349
- /* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>s(true),accessibilityRole:"button",accessibilityLabel:Ec.editA11y(d),hitSlop:6,style:o.editButton,testID:`fact-edit-open-${t.canonicalKey??t.key}`,children:/* @__PURE__ */n.jsx(r.View,{style:o.pencil,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),a?/* @__PURE__ */n.jsx(FactEditSheet,{entity:t,title:d,factEdit:i,onClose:()=>s(false)}):null]})}function FactEditSheet({entity:t,title:i,factEdit:l,onClose:o}){let a=Qc(),s=ga(),d=Yl(),c=useEverfurTheme(),[u,h]=e.useState(t.value??""),[p,g]=e.useState(null),[f,m]=e.useState(false);e.useEffect(()=>{l.clearError()},[l]);let b=u.trim().length>0&&u.trim()!==(t.value??"").trim(),y=p??l.error,x=l.busy,w=()=>{if(!b){g(Ec.noChange);return}g(null),l.edit(t,u).then(e=>{e.ok&&o()})},v=()=>{g(null),l.remove(t).then(e=>{e.ok?o():m(false)})};/* @__PURE__ */
349
+ /* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>s(true),accessibilityRole:"button",accessibilityLabel:Oc.editA11y(d),hitSlop:6,style:o.editButton,testID:`fact-edit-open-${t.canonicalKey??t.key}`,children:/* @__PURE__ */n.jsx(r.View,{style:o.pencil,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),a?/* @__PURE__ */n.jsx(FactEditSheet,{entity:t,title:d,factEdit:i,onClose:()=>s(false)}):null]})}function FactEditSheet({entity:t,title:i,factEdit:l,onClose:o}){let a=Qc(),s=ga(),d=Yl(),c=useEverfurTheme(),[u,h]=e.useState(t.value??""),[p,g]=e.useState(null),[f,m]=e.useState(false);e.useEffect(()=>{l.clearError()},[l]);let b=u.trim().length>0&&u.trim()!==(t.value??"").trim(),y=p??l.error,x=l.busy,w=()=>{if(!b){g(Oc.noChange);return}g(null),l.edit(t,u).then(e=>{e.ok&&o()})},v=()=>{g(null),l.remove(t).then(e=>{e.ok?o():m(false)})};/* @__PURE__ */
350
350
  return n.jsx(r.Modal,{transparent:true,visible:true,animationType:"slide",onRequestClose:o,children:/* @__PURE__ */n.jsxs(r.KeyboardAvoidingView,{behavior:"padding",style:a.backdrop,children:[
351
- /* @__PURE__ */n.jsx(r.Pressable,{style:Xc,accessibilityRole:"button",accessibilityLabel:Ec.closeEditorA11y,onPress:o}),
351
+ /* @__PURE__ */n.jsx(r.Pressable,{style:Xc,accessibilityRole:"button",accessibilityLabel:Oc.closeEditorA11y,onPress:o}),
352
352
  /* @__PURE__ */n.jsxs(r.View,{style:fa(a.sheet,s),accessibilityViewIsModal:true,testID:"fact-edit-sheet",children:[
353
353
  /* @__PURE__ */n.jsx(r.View,{style:a.handle}),
354
354
  /* @__PURE__ */n.jsxs(r.View,{style:a.header,children:[
355
355
  /* @__PURE__ */n.jsxs(r.View,{style:a.headerText,children:[
356
- /* @__PURE__ */n.jsx(Text,{style:a.title,accessibilityRole:"header",children:Ec.title(i)}),
357
- /* @__PURE__ */n.jsx(Text,{style:[a.helper,y?a.helperError:null],accessibilityLiveRegion:"polite",children:y??Ec.helper})]}),
358
- /* @__PURE__ */n.jsx(r.Pressable,{accessibilityRole:"button",accessibilityLabel:Ec.close,onPress:o,hitSlop:12,style:a.closeButton,testID:"fact-edit-close",children:/* @__PURE__ */n.jsx(Text,{style:a.closeGlyph,children:"×"})})]}),
356
+ /* @__PURE__ */n.jsx(Text,{style:a.title,accessibilityRole:"header",children:Oc.title(i)}),
357
+ /* @__PURE__ */n.jsx(Text,{style:[a.helper,y?a.helperError:null],accessibilityLiveRegion:"polite",children:y??Oc.helper})]}),
358
+ /* @__PURE__ */n.jsx(r.Pressable,{accessibilityRole:"button",accessibilityLabel:Oc.close,onPress:o,hitSlop:12,style:a.closeButton,testID:"fact-edit-close",children:/* @__PURE__ */n.jsx(Text,{style:a.closeGlyph,children:"×"})})]}),
359
359
  /* @__PURE__ */n.jsx(Text,{style:d.fieldLabel,children:t.label}),
360
360
  /* @__PURE__ */n.jsx(tn,{accessibilityLabel:t.label,style:d.field,value:u,onChangeText:e=>{h(e),g(null)},editable:!x,maxLength:512,placeholderTextColor:c.color.text.placeholder,testID:"fact-edit-field"}),f?/* @__PURE__ */n.jsxs(r.View,{style:a.confirmBlock,testID:"fact-edit-confirm-remove",children:[
361
- /* @__PURE__ */n.jsx(Text,{style:a.confirmText,children:Ec.confirmRemove}),
361
+ /* @__PURE__ */n.jsx(Text,{style:a.confirmText,children:Oc.confirmRemove}),
362
362
  /* @__PURE__ */n.jsxs(r.View,{style:a.confirmRow,children:[
363
- /* @__PURE__ */n.jsx(Pill,{label:x?Ec.removing:Ec.removeConfirm,kind:"danger",busy:x,onPress:v,style:a.confirmButton,testID:"fact-edit-remove-confirm"}),
364
- /* @__PURE__ */n.jsx(Pill,{label:Ec.keep,kind:"outline",disabled:x,onPress:()=>m(false),style:a.confirmButton,testID:"fact-edit-remove-cancel"})]})]}):/* @__PURE__ */n.jsxs(r.View,{style:a.actions,children:[
365
- /* @__PURE__ */n.jsx(Pill,{label:x?Ec.saving:Ec.save,busy:x,disabled:!b,onPress:w,testID:"fact-edit-save"}),
366
- /* @__PURE__ */n.jsx(r.Pressable,{accessibilityRole:"button",accessibilityLabel:Ec.remove,disabled:x,onPress:()=>{g(null),m(true)},style:[a.removeButton,x?a.removeDisabled:null],testID:"fact-edit-remove",children:/* @__PURE__ */n.jsx(Text,{style:a.removeText,children:Ec.remove})})]})]})]})})}function Qc(){let t=useEverfurTheme();return e.useMemo(()=>Jc(t),[t])}function Jc(e){let{color:t,space:n,radius:i,type:l}=e,o=n.xxl+n.md,a=e.brightness==="dark"?t.errorRed:t.danger,s=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:n.sm},main:{flex:1},editButton:{width:o,height:o,alignItems:"center",justifyContent:"center"},pencil:{width:n.md+n.xs/2,height:n.xs/2,backgroundColor:t.brandInk,borderRadius:i.pill,transform:[{rotate:"-45deg"}]},backdrop:{flex:1,justifyContent:"flex-end",backgroundColor:Kl},sheet:{backgroundColor:t.surface,borderTopLeftRadius:i.xl-1,borderTopRightRadius:i.xl-1,paddingHorizontal:n.lg+n.xs+n.xs/2,paddingTop:n.md,paddingBottom:i.xl,maxHeight:"88%",gap:n.md,...jc(e.slots.dialog)},handle:{alignSelf:"center",width:n.xxl+n.xs,height:n.xs,borderRadius:i.pill,backgroundColor:t.borderRingCream},header:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:n.sm},headerText:{flex:1,gap:n.xs},title:{...s(l.size.heading,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...nn(e.slots.dialog)},helper:{...s(l.size.bodyTight,l.lineHeight.normal,t.text.muted),...nn(e.slots.dialog)},helperError:{color:a},closeButton:{width:o,height:o,alignItems:"center",justifyContent:"center"},closeGlyph:{...s(l.size.verdict,l.lineHeight.tight,t.text.primary),...nn(e.slots.dialog)},actions:{gap:n.sm},removeButton:{minHeight:o,alignItems:"center",justifyContent:"center"},removeDisabled:{opacity:.5},removeText:{...s(l.size.bodyTight,l.lineHeight.snug,t.danger,"bold")},confirmBlock:{gap:n.sm,padding:n.md,borderRadius:i.md,backgroundColor:t.badgeBgCritical},confirmText:s(l.size.bodyTight,l.lineHeight.normal,t.text.primary),confirmRow:{flexDirection:"row",gap:n.sm},confirmButton:{flex:1}})}function Zc(e){return e.value!==null&&Number.isFinite(e.value)}function eu(e){return e.display!==null&&e.display.length>0?e.display:e.value!==null?String(e.value):""}function tu(e){let t=e.find(e=>e.points.some(Zc));if(t===void 0)return null;let r=t.points.filter(Zc),n=r[0];if(n===void 0)return null;let i=r.map(e=>e.value),l=Math.min(...i),o=Math.max(...i);l===o&&(l-=1,o+=1);let a=(o-l)*.18,s=l-a,d=o+a,c=d-s,u=6,h=r.length,p=r.map((e,t)=>({xPct:h<=1?50:u+t/(h-1)*(100-2*u),yPct:(d-e.value)/c*100})),g=(d-o)/c*100,f=(d-l)/c*100,m=r.reduce((e,t)=>t.value<e.value?t:e,n),b=r.reduce((e,t)=>t.value>e.value?t:e,n),y=r[r.length-1]??n,x=t.points[t.points.length-1]??y,w=eu(x),v=w.length>0?w:eu(y);return{label:t.label,heroDisplay:v,minDisplay:eu(m),maxDisplay:eu(b),firstDate:po(t.points[0]?.at??null),lastDate:po(x.at),points:p,bandTopPct:g,bandBottomPct:f}}function ru(e){let t=e.indexOf(":");return t<=0?null:e.slice(0,t)}function nu(e,t,r){let n=/* @__PURE__ */new Map,i=[];for(let t of e){let e=ru(t.key)??"",r=n.get(e);r===void 0?(n.set(e,[t]),i.push(e)):r.push(t)}let l=t.filter(e=>n.has(e)),o=i.filter(e=>!l.includes(e));/* @__PURE__ */
367
- return Object.freeze([...l,...o].map(e=>/* @__PURE__ */Object.freeze({entityType:e.length>0?e:null,label:e.length>0?r(e):null,series:/* @__PURE__ */Object.freeze([...n.get(e)??[]])})))}function iu(e){return`${e}%`}function CareTimeline({series:t,testID:i}){let l=lu(),o=e.useMemo(()=>nu(t,Eo,Lo),[t]);return o.length===0?null:/* @__PURE__ */n.jsxs(r.View,{style:l.section,testID:i,children:[
363
+ /* @__PURE__ */n.jsx(Pill,{label:x?Oc.removing:Oc.removeConfirm,kind:"danger",busy:x,onPress:v,style:a.confirmButton,testID:"fact-edit-remove-confirm"}),
364
+ /* @__PURE__ */n.jsx(Pill,{label:Oc.keep,kind:"outline",disabled:x,onPress:()=>m(false),style:a.confirmButton,testID:"fact-edit-remove-cancel"})]})]}):/* @__PURE__ */n.jsxs(r.View,{style:a.actions,children:[
365
+ /* @__PURE__ */n.jsx(Pill,{label:x?Oc.saving:Oc.save,busy:x,disabled:!b,onPress:w,testID:"fact-edit-save"}),
366
+ /* @__PURE__ */n.jsx(r.Pressable,{accessibilityRole:"button",accessibilityLabel:Oc.remove,disabled:x,onPress:()=>{g(null),m(true)},style:[a.removeButton,x?a.removeDisabled:null],testID:"fact-edit-remove",children:/* @__PURE__ */n.jsx(Text,{style:a.removeText,children:Oc.remove})})]})]})]})})}function Qc(){let t=useEverfurTheme();return e.useMemo(()=>Jc(t),[t])}function Jc(e){let{color:t,space:n,radius:i,type:l}=e,o=n.xxl+n.md,a=e.brightness==="dark"?t.errorRed:t.danger,s=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:n.sm},main:{flex:1},editButton:{width:o,height:o,alignItems:"center",justifyContent:"center"},pencil:{width:n.md+n.xs/2,height:n.xs/2,backgroundColor:t.brandInk,borderRadius:i.pill,transform:[{rotate:"-45deg"}]},backdrop:{flex:1,justifyContent:"flex-end",backgroundColor:Kl},sheet:{backgroundColor:t.surface,borderTopLeftRadius:i.xl-1,borderTopRightRadius:i.xl-1,paddingHorizontal:n.lg+n.xs+n.xs/2,paddingTop:n.md,paddingBottom:i.xl,maxHeight:"88%",gap:n.md,...jc(e.slots.dialog)},handle:{alignSelf:"center",width:n.xxl+n.xs,height:n.xs,borderRadius:i.pill,backgroundColor:t.borderRingCream},header:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:n.sm},headerText:{flex:1,gap:n.xs},title:{...s(l.size.heading,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...nn(e.slots.dialog)},helper:{...s(l.size.bodyTight,l.lineHeight.normal,t.text.muted),...nn(e.slots.dialog)},helperError:{color:a},closeButton:{width:o,height:o,alignItems:"center",justifyContent:"center"},closeGlyph:{...s(l.size.verdict,l.lineHeight.tight,t.text.primary),...nn(e.slots.dialog)},actions:{gap:n.sm},removeButton:{minHeight:o,alignItems:"center",justifyContent:"center"},removeDisabled:{opacity:.5},removeText:{...s(l.size.bodyTight,l.lineHeight.snug,t.danger,"bold")},confirmBlock:{gap:n.sm,padding:n.md,borderRadius:i.md,backgroundColor:t.badgeBgCritical},confirmText:s(l.size.bodyTight,l.lineHeight.normal,t.text.primary),confirmRow:{flexDirection:"row",gap:n.sm},confirmButton:{flex:1}})}function Zc(e){return e.value!==null&&Number.isFinite(e.value)}function eu(e){return e.display!==null&&e.display.length>0?e.display:e.value!==null?String(e.value):""}function tu(e){let t=e.find(e=>e.points.some(Zc));if(t===void 0)return null;let r=t.points.filter(Zc),n=r[0];if(n===void 0)return null;let i=r.map(e=>e.value),l=Math.min(...i),o=Math.max(...i);l===o&&(l-=1,o+=1);let a=(o-l)*.18,s=l-a,d=o+a,c=d-s,u=6,h=r.length,p=r.map((e,t)=>({xPct:h<=1?50:u+t/(h-1)*(100-2*u),yPct:(d-e.value)/c*100})),g=(d-o)/c*100,f=(d-l)/c*100,m=r.reduce((e,t)=>t.value<e.value?t:e,n),b=r.reduce((e,t)=>t.value>e.value?t:e,n),y=r[r.length-1]??n,x=t.points[t.points.length-1]??y,w=eu(x),v=w.length>0?w:eu(y);return{label:t.label,heroDisplay:v,minDisplay:eu(m),maxDisplay:eu(b),firstDate:po(t.points[0]?.at??null),lastDate:po(x.at),points:p,bandTopPct:g,bandBottomPct:f}}function ru(e){let t=e.indexOf(":");return t<=0?null:e.slice(0,t)}function nu(e,t,r){let n=/* @__PURE__ */new Map,i=[];for(let t of e){let e=ru(t.key)??"",r=n.get(e);r===void 0?(n.set(e,[t]),i.push(e)):r.push(t)}let l=t.filter(e=>n.has(e)),o=i.filter(e=>!l.includes(e));/* @__PURE__ */
367
+ return Object.freeze([...l,...o].map(e=>/* @__PURE__ */Object.freeze({entityType:e.length>0?e:null,label:e.length>0?r(e):null,series:/* @__PURE__ */Object.freeze([...n.get(e)??[]])})))}function iu(e){return`${e}%`}function CareTimeline({series:t,testID:i}){let l=lu(),o=e.useMemo(()=>nu(t,Oo,Lo),[t]);return o.length===0?null:/* @__PURE__ */n.jsxs(r.View,{style:l.section,testID:i,children:[
368
368
  /* @__PURE__ */n.jsxs(r.View,{children:[
369
369
  /* @__PURE__ */n.jsx(Text,{style:l.sectionTitle,accessibilityRole:"header",children:Vo.careTimeline}),
370
370
  /* @__PURE__ */n.jsx(Text,{style:l.sectionSub,children:Vo.careTimelineSub})]}),o.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:l.group,children:[e.label===null?null:/* @__PURE__ */n.jsx(Text,{style:l.groupLabel,numberOfLines:1,children:e.label}),e.series.map(e=>/* @__PURE__ */n.jsx(SeriesCard,{series:e,styles:l},e.key))]},e.entityType??"_"))]})}function SeriesCard({series:t,styles:i}){let l=e.useMemo(()=>tu([t]),[t]);if(l!==null)/* @__PURE__ */return n.jsx(TrendChart,{model:l,styles:i});let o=t.points[t.points.length-1]?.display??null,a=o!==null&&o.length>0?`${t.label}, ${o}`:t.label;/* @__PURE__ */
@@ -377,7 +377,7 @@ return n.jsxs(r.View,{style:t.card,testID:i,children:[
377
377
  /* @__PURE__ */n.jsx(r.View,{style:[t.band,{top:iu(e.bandTopPct),height:iu(o)}]}),e.points.map((i,l)=>{let o=l===e.points.length-1;/* @__PURE__ */
378
378
  return n.jsx(r.View,{style:[t.point,o?t.pointLatest:null,{left:iu(i.xPct),top:iu(i.yPct)}]},`pt-${l}`)}),e.maxDisplay.length>0?/* @__PURE__ */n.jsx(Text,{style:[t.edgeLabel,{top:iu(e.bandTopPct)}],numberOfLines:1,children:e.maxDisplay}):null,e.minDisplay.length>0?/* @__PURE__ */n.jsx(Text,{style:[t.edgeLabel,{top:iu(e.bandBottomPct)}],numberOfLines:1,children:e.minDisplay}):null]}),e.firstDate.length>0||e.lastDate.length>0?/* @__PURE__ */n.jsxs(r.View,{style:t.dates,children:[
379
379
  /* @__PURE__ */n.jsx(Text,{style:t.dateLabel,children:e.firstDate}),
380
- /* @__PURE__ */n.jsx(Text,{style:t.dateLabel,children:e.lastDate})]}):null]})}function lu(){let t=useEverfurTheme();return e.useMemo(()=>ou(t),[t])}function ou(e){let{color:t,space:n,radius:i,type:l,slots:o}=e,{size:a,lineHeight:s,letterSpacing:d}=l,c=(e,t)=>Math.round(e*t),u=r.StyleSheet.hairlineWidth,h=nn(ln(o)),p=n.xxl*3,g=n.sm,f=-(g/2),m=n.xs,b={shadowColor:t.brand,shadowOffset:{width:0,height:n.xs},shadowRadius:n.sm,shadowOpacity:.08,elevation:n.xs};return r.StyleSheet.create({section:{gap:n.lg},sectionTitle:{...headingFace(e,"bold"),fontSize:a.subtitle,lineHeight:c(a.subtitle,s.snug),letterSpacing:-.4,color:t.text.primary},sectionSub:{...face(e,"regular"),marginTop:n.xs,fontSize:a.caption,lineHeight:c(a.caption,s.normal),color:t.text.muted},group:{gap:n.sm},groupLabel:{...face(e,"regular"),fontSize:a.caption,lineHeight:c(a.caption,s.normal),color:t.text.muted,letterSpacing:d.eyebrow,textTransform:"uppercase"},card:{gap:n.sm,padding:n.lg,borderRadius:i.lg,backgroundColor:t.surfaceCream,borderWidth:u,borderColor:t.borderRingCream,...b,...rn(ln(o),u)},eyebrow:{...face(e,"regular"),fontSize:a.caption,lineHeight:c(a.caption,s.normal),color:t.text.muted,letterSpacing:d.eyebrow,textTransform:"uppercase",...h},hero:{...face(e,"bold"),fontSize:a.verdict,lineHeight:c(a.verdict,s.tight),color:t.text.primary,letterSpacing:d.tight,...h},plot:{position:"relative",height:p,marginTop:n.xs},guide:{position:"absolute",top:0,bottom:0,width:u,backgroundColor:t.borderHairlineGreen},band:{position:"absolute",left:m,right:n.xs,borderRadius:i.sm,backgroundColor:t.brandSoft},point:{position:"absolute",width:g,height:g,marginLeft:f,marginTop:f,borderRadius:i.pill,backgroundColor:t.brand,borderWidth:u,borderColor:t.surfaceCream},pointLatest:{backgroundColor:t.accent,borderColor:t.onAccent},edgeLabel:{position:"absolute",right:0,marginTop:-n.sm,...face(e,"medium"),fontSize:a.tiny,lineHeight:c(a.tiny,s.tight),color:t.text.muted,...h},dates:{flexDirection:"row",justifyContent:"space-between"},dateLabel:{...face(e,"regular"),fontSize:a.tiny,lineHeight:c(a.tiny,s.normal),color:t.text.muted,...h}})}function RecordSections({record:t,depth:i,petName:l,showLabs:o=true,onNavigate:a,onAsk:s,factEdit:d,nowMs:c}){let u=Yl(),h=su(),p=c??Date.now(),g=e.useMemo(()=>d?applyFactOverlay(t.entities,d.overlay):t.entities,[t.entities,d]),f=e.useMemo(()=>{let e=[],t=/* @__PURE__ */new Map;for(let r of g){let n=r.category.trim();if(n.length===0||Bc.includes(n))continue;let i=t.get(n);i===void 0?(e.push(n),t.set(n,[r])):i.push(r)}return{order:Oo(e),groups:t}},[g]),m=e.useMemo(()=>Yc(g),[g]),b=e.useMemo(()=>xo(t.documents),[t.documents]),y=(e,t,i)=>s?/* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>{let t=e();s(t.prompt,t.entityRef)},accessibilityRole:"button",accessibilityLabel:t,style:[u.pill,u.pillAsk,h.ask],testID:i,children:/* @__PURE__ */n.jsx(Text,{style:u.pillAskLabel,children:t})}):null,x=d!==void 0&&d.available;/* @__PURE__ */
380
+ /* @__PURE__ */n.jsx(Text,{style:t.dateLabel,children:e.lastDate})]}):null]})}function lu(){let t=useEverfurTheme();return e.useMemo(()=>ou(t),[t])}function ou(e){let{color:t,space:n,radius:i,type:l,slots:o}=e,{size:a,lineHeight:s,letterSpacing:d}=l,c=(e,t)=>Math.round(e*t),u=r.StyleSheet.hairlineWidth,h=nn(ln(o)),p=n.xxl*3,g=n.sm,f=-(g/2),m=n.xs,b={shadowColor:t.brand,shadowOffset:{width:0,height:n.xs},shadowRadius:n.sm,shadowOpacity:.08,elevation:n.xs};return r.StyleSheet.create({section:{gap:n.lg},sectionTitle:{...headingFace(e,"bold"),fontSize:a.subtitle,lineHeight:c(a.subtitle,s.snug),letterSpacing:-.4,color:t.text.primary},sectionSub:{...face(e,"regular"),marginTop:n.xs,fontSize:a.caption,lineHeight:c(a.caption,s.normal),color:t.text.muted},group:{gap:n.sm},groupLabel:{...face(e,"regular"),fontSize:a.caption,lineHeight:c(a.caption,s.normal),color:t.text.muted,letterSpacing:d.eyebrow,textTransform:"uppercase"},card:{gap:n.sm,padding:n.lg,borderRadius:i.lg,backgroundColor:t.surfaceCream,borderWidth:u,borderColor:t.borderRingCream,...b,...rn(ln(o),u)},eyebrow:{...face(e,"regular"),fontSize:a.caption,lineHeight:c(a.caption,s.normal),color:t.text.muted,letterSpacing:d.eyebrow,textTransform:"uppercase",...h},hero:{...face(e,"bold"),fontSize:a.verdict,lineHeight:c(a.verdict,s.tight),color:t.text.primary,letterSpacing:d.tight,...h},plot:{position:"relative",height:p,marginTop:n.xs},guide:{position:"absolute",top:0,bottom:0,width:u,backgroundColor:t.borderHairlineGreen},band:{position:"absolute",left:m,right:n.xs,borderRadius:i.sm,backgroundColor:t.brandSoft},point:{position:"absolute",width:g,height:g,marginLeft:f,marginTop:f,borderRadius:i.pill,backgroundColor:t.brand,borderWidth:u,borderColor:t.surfaceCream},pointLatest:{backgroundColor:t.accent,borderColor:t.onAccent},edgeLabel:{position:"absolute",right:0,marginTop:-n.sm,...face(e,"medium"),fontSize:a.tiny,lineHeight:c(a.tiny,s.tight),color:t.text.muted,...h},dates:{flexDirection:"row",justifyContent:"space-between"},dateLabel:{...face(e,"regular"),fontSize:a.tiny,lineHeight:c(a.tiny,s.normal),color:t.text.muted,...h}})}function RecordSections({record:t,depth:i,petName:l,showLabs:o=true,onNavigate:a,onAsk:s,factEdit:d,nowMs:c}){let u=Yl(),h=su(),p=c??Date.now(),g=e.useMemo(()=>d?applyFactOverlay(t.entities,d.overlay):t.entities,[t.entities,d]),f=e.useMemo(()=>{let e=[],t=/* @__PURE__ */new Map;for(let r of g){let n=r.category.trim();if(n.length===0||Bc.includes(n))continue;let i=t.get(n);i===void 0?(e.push(n),t.set(n,[r])):i.push(r)}return{order:Eo(e),groups:t}},[g]),m=e.useMemo(()=>Yc(g),[g]),b=e.useMemo(()=>xo(t.documents),[t.documents]),y=(e,t,i)=>s?/* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>{let t=e();s(t.prompt,t.entityRef)},accessibilityRole:"button",accessibilityLabel:t,style:[u.pill,u.pillAsk,h.ask],testID:i,children:/* @__PURE__ */n.jsx(Text,{style:u.pillAskLabel,children:t})}):null,x=d!==void 0&&d.available;/* @__PURE__ */
381
381
  return n.jsxs(n.Fragment,{children:[
382
382
  /* @__PURE__ */n.jsxs(r.View,{style:h.sections,children:[i&&i.conflicts.length>0?/* @__PURE__ */n.jsxs(r.View,{style:u.section,testID:"record-section-conflicts",children:[
383
383
  /* @__PURE__ */n.jsx(SectionHeader,{title:Vo.needsAttention,count:i.conflicts.length}),[...i.conflicts].sort((e,t)=>Ao(e.severity).rank-Ao(t.severity).rank).map(e=>{let i=Ao(e.severity),o=jo(e.field??e.entityType);/* @__PURE__ */
@@ -439,7 +439,7 @@ return n.jsxs(r.View,{style:[u.row,t>0?u.rowDivider:null],children:[
439
439
  /* @__PURE__ */n.jsx(r.View,{style:u.card,children:i.encounters.map((e,t)=>{let i=[e.date?fo(e.date):null,e.clinicName,e.veterinarian].filter(e=>e&&e!=="-").join(" · ");/* @__PURE__ */
440
440
  return n.jsx(r.View,{style:[u.row,t>0?u.rowDivider:null],children:/* @__PURE__ */n.jsxs(r.View,{style:u.rowMain,children:[
441
441
  /* @__PURE__ */n.jsx(Text,{style:u.rowTitle,children:e.type?jo(e.type):wo.visit}),i?/* @__PURE__ */n.jsx(Text,{style:u.rowDetail,children:i}):null]})},e.encounterId)})})]}):null]}),
442
- /* @__PURE__ */n.jsx(DisclaimerBand,{disclaimer:t.disclaimer})]})}function au(e,t){return e>0?e:Object.values(t).reduce((e,t)=>e+t,0)}function su(){let t=useEverfurTheme();return e.useMemo(()=>du(t),[t])}function du(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth;return r.StyleSheet.create({sections:{gap:n.lg+n.xs},vaccineGroup:{gap:n.xs+1,marginBottom:n.sm},vaccineYear:{...face(e,"monoMedium"),fontSize:l.size.micro,lineHeight:l.size.micro+n.xs,color:t.text.muted,letterSpacing:l.letterSpacing.eyebrow,textTransform:"uppercase",paddingTop:n.xs+2},ask:{marginTop:n.lg},conflictCard:{borderRadius:i.md,borderWidth:1,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md,gap:n.sm,...rn(ln(e.slots),1)},conflictHead:{flexDirection:"row",alignItems:"center",gap:n.sm},conflictTitle:{flex:1,...headingFace(e,"bold"),fontSize:l.size.body,lineHeight:Math.round(l.size.body*l.lineHeight.snug),color:t.text.primary,...nn(ln(e.slots))},candidate:{borderTopWidth:o,borderTopColor:t.borderHairlineGreen,paddingTop:n.sm},coverageRow:{flexDirection:"row",flexWrap:"wrap",gap:n.sm,paddingVertical:n.md},coveragePill:{borderRadius:i.pill,paddingHorizontal:n.sm+n.xs/2,paddingVertical:n.xs+1},coverageText:{...face(e,"medium"),fontSize:l.size.caption,lineHeight:l.size.caption+n.xs-1},coverageRest:e.slots.chip?.borderRadius===void 0?{}:{borderRadius:e.slots.chip.borderRadius},coverageRestText:{},coverageOnFile:e.slots.chip?.borderRadius===void 0?{}:{borderRadius:e.slots.chip.borderRadius},metaRow:{flexDirection:"row",alignItems:"center",gap:n.sm,paddingBottom:n.md},metaText:{flex:1,...face(e,"regular"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*l.lineHeight.snug),color:t.text.secondary},pendingText:{...face(e,"regular"),fontSize:l.size.caption,lineHeight:Math.round(l.size.caption*l.lineHeight.normal),color:t.text.muted,paddingBottom:n.md},identityLabel:{...face(e,"medium"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*l.lineHeight.snug),color:t.text.secondary},identityValue:{flexShrink:1,textAlign:"right",...face(e,"medium"),fontSize:l.size.body,lineHeight:Math.round(l.size.body*l.lineHeight.snug),color:t.text.primary},cardTitle:{paddingTop:n.sm},noteSection:{paddingVertical:n.md,gap:n.xs},noteLabel:{...face(e,"bold"),fontSize:l.size.bodyTight,color:t.text.secondary,textTransform:"uppercase",letterSpacing:l.letterSpacing.eyebrow/2},noteBody:{...face(e,"regular"),fontSize:l.size.body+1,lineHeight:Math.round((l.size.body+1)*l.lineHeight.relaxed),color:t.text.primary},noteBodyMuted:{...face(e,"regular"),fontSize:l.size.body+1,lineHeight:Math.round((l.size.body+1)*l.lineHeight.relaxed),color:t.text.muted,fontStyle:"italic"}})}var cu=/* @__PURE__ */Object.freeze({heading:"A quick call can help",fallbackPrompt:"Reaching out to the clinic directly often speeds up a slow records request.",call:"Call the clinic",callAt:e=>`Call the clinic at ${e}`});function uu(e){return typeof e=="string"&&e.trim().length>0?e:null}function hu(e,t){return typeof e=="string"&&e.length>0&&uu(t)===null}var pu="[everfur] consentVersion was passed without consentText, so the records consent gate shows no consent text above Allow. Pass the consent text your member agrees to as consentText, next to its consentVersion.",gu=false;function fu(e,t,r){if(gu||!hu(e,t))return;let n=false;try{n=r()===!0}catch{n=false}if(!n)return;gu=true;let i=globalThis.console;try{i?.warn?.(pu)}catch{}}function mu(t,r,n){e.useEffect(()=>{fu(t,r,n)},[t,r,n])}function bu(){let e=r.useColorScheme();return e==="dark"?"dark":e==="light"?"light":null}function yu(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function xu(){let[t,n]=e.useState(false);return e.useEffect(()=>{let e=true,t=r.AccessibilityInfo?.isReduceMotionEnabled;if(typeof t=="function"){let i=t.call(r.AccessibilityInfo);i!=null&&typeof i.then=="function"&&i.then(t=>{e&&n(t===true)},()=>{})}let i=r.AccessibilityInfo?.addEventListener?.("reduceMotionChanged",e=>n(e===true));return()=>{e=false,i?.remove?.()}},[]),t}function wu(){let e=r.PixelRatio?.getFontScale;if(typeof e!="function")return 1;try{let t=e.call(r.PixelRatio);return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}catch{return 1}}function vu(e){let t=r.Dimensions?.addEventListener;if(typeof t!="function")return()=>{};let n=t.call(r.Dimensions,"change",e);return()=>n?.remove?.()}function ku(){return e.useSyncExternalStore(vu,wu,wu)}function ju(){try{let e=r.Platform?.OS;return typeof e=="string"?e:null}catch{return null}}function Su(){return ju()==="android"?{query:"isHighTextContrastEnabled",event:"highTextContrastChanged"}:{query:"isDarkerSystemColorsEnabled",event:"darkerSystemColorsChanged"}}function Cu(){let[t,n]=e.useState(false);return e.useEffect(()=>{let e=true,{query:t,event:i}=Su(),l=r.AccessibilityInfo?.[t];if(typeof l!="function")return()=>{};try{let t=l.call(r.AccessibilityInfo);yu(t)&&Promise.resolve(t).then(t=>{e&&n(t===!0)},()=>{})}catch{}let o=r.AccessibilityInfo?.addEventListener,a=typeof o=="function"?o.call(r.AccessibilityInfo,i,e=>n(e===true)):void 0;return()=>{e=false,a?.remove?.()}},[]),t}function Ru(){return ju()==="ios"?"Menlo":$r}function Tu(){return globalThis.__DEV__!==false}var _u=/* @__PURE__ */new Set;function zu(e){if(!Tu()||_u.has(e))return;_u.add(e);let t=globalThis.console;try{t?.warn?.(`[everfur] The theme names the font face "${e}", which this app has not registered; the SDK renders the platform font at that weight instead. Register the font file (expo-font or your native font assets) or name a registered face.`)}catch{}}function Iu(e){let t=globalThis.expo?.modules?.ExpoFontLoader,r=t?.getLoadedFonts;if(typeof r!="function")return null;let n;try{n=r.call(t)}catch{return null}if(!Array.isArray(n)||n.length===0)return null;let i=n.includes(e);return i||zu(e),i}var Du=/* @__PURE__ */new Set;function Hu(e){let t=[];return e.type.fontSources.length>0&&t.push("fontSources"),Object.values(e.type.fontUrls).some(e=>typeof e=="string"&&e.length>0)&&t.push("fontUrls"),t}var Vu=/* @__PURE__ */Object.freeze({fontSources:"appearance.fonts (font_sources)",fontUrls:"font_urls"});function Pu(e){if(!Tu())return;let t=Hu(e).filter(e=>!Du.has(e));if(t.length===0)return;for(let e of t)Du.add(e);let r=globalThis.console;try{r?.warn?.(`[everfur] The theme sets ${t.map(e=>Vu[e]).join(" and ")}, which only the web SDK loads. React Native does not download fonts: register the font file with expo-font (or your native font assets) and name the family. Until then the SDK renders the family as named, or the platform font when the app reports that family missing.`)}catch{}}function Lu(t){e.useEffect(()=>{try{Pu(t)}catch{}},[t])}var Eu=/* @__PURE__ */Object.freeze({useColorScheme:bu,useReducedMotion:xu,useTextScale:ku,useHighContrast:Cu,scaleTypeSizes:false,typeProfile:"phone",platformMonoFamily:Ru,isFontRegistered:Iu,useResolvedTheme:Lu,isDevelopment:Tu});var Ou=()=>Eu.isDevelopment?.()===true;function Au(e,t){mu(e,t,Ou)}var $u=Math.round(Oe/(1024*1024)),Bu=/* @__PURE__ */Object.freeze({title:e=>`Upload ${yn(e)}’s records`,screenTitle:"Upload a document",subtitle:e=>`Already have lab results, a vet summary, or test reports? Add them here and we’ll read them and pull out ${yn(e)}’s health markers.`,noPet:"Select a pet first, then upload their records.",cardTitle:"Add records",cardSubtitle:`Upload PDF records you already have, up to ${$u} MB each. You can pick several at once. We’ll read them and add the results to your records.`,chooseFiles:"Choose a file",uploading:(e,t)=>`Uploading ${Math.min(e+1,t)} of ${t}…`,cancel:"Cancel",cancelA11y:"Cancel these uploads",received:e=>`${e===1?"Record received.":`${e} records received.`} We’ll read and review ${e===1?"it":"them"}, then add the results to your records, usually within 1-2 business days.`,retryFailed:e=>`Retry ${e} that didn’t upload`,haveMore:"Have more?",addMore:"Upload another document",addMoreA11y:"Upload another document",done:"Done",doneA11y:"Done, view records",errors:/* @__PURE__ */Object.freeze({start:"We couldn’t start that upload. Check your connection and try again.",startPlain:"We couldn’t start that upload. Please try again.",upload:"We couldn’t upload that record. Check your connection and try again."})}),Fu=/* @__PURE__ */Object.freeze({note:"A PDF, or a photo of a paper record. Add them all; we sort them by date.",takePhoto:"Take a photo",takePhotoMeta:"of a paper record",choosePhotos:"Choose from photos",chooseFileMeta:"PDF",haveMoreLead:"PDFs and photos of paper records both work. Add them all; we sort them by date.",unreadable:"We can’t read this kind of file. Upload a PDF or a photo of the record."});function Mu(e,t){return`${e} ${t}`}var qu=Math.round(Oe/(1024*1024)),Nu=/* @__PURE__ */Object.freeze({queued:"Queued",verifying:"Verifying…",done:"Done",failed:"Failed",uploading:(e,t)=>`Uploading ${Math.min(e+1,t)} of ${t} records`,uploaded:(e,t)=>`${e} of ${t} records uploaded`});function Wu(e){let t=Math.round(e.progress*100);switch(e.status){case"done":return Nu.done;case"failed":return Nu.failed;case"uploading":return e.progress>=1?Nu.verifying:`${t}%`;case"queued":return Nu.queued;default:return null}}function Uu(e,t=false){if(e.length===0)return null;let r=e=>{let t=e.map(e=>e.name??"");return t.length<=3?t.join(", "):`${t.slice(0,3).join(", ")} and ${t.length-3} more`},n=e.filter(e=>e.reason==="too_large"),i=e.filter(e=>e.reason==="unsupported");if(t){let e=[];return i.length>0&&e.push(Fu.unreadable),n.length>0&&e.push(`Didn’t upload: ${r(n)} ${n.length>1?"are":"is"} over ${qu} MB.`),e.join(" ")}let l=[];return i.length>0&&l.push(`${r(i)} ${i.length>1?"are not PDFs":"is not a PDF"}`),n.length>0&&l.push(`${r(n)} ${n.length>1?"are":"is"} over ${qu} MB`),`Didn’t upload: ${l.join("; ")}. We can only read PDFs up to ${qu} MB right now.`}function Gu(e){let t=[];for(let r of e)r.status==="skipped"&&r.skipReason!==null&&t.push({name:r.name,reason:r.skipReason});return t}var Ku=/* @__PURE__ */Object.freeze({email:"Clinic email",emailPlaceholder:"records@clinic.com",emailError:"Enter a valid clinic email.",updateEmail:"Update email & resend",retry:"Retry sending",retryA11y:"Retry sending records request",retryHint:"Save the updated email first, then retry.",cancelRequest:"Cancel request",keepRequest:"Keep it",uploadInstead:"Upload instead",cancelQuestion:"Cancel this request?",cancelConsequence:"We’ll stop sending reminders to the clinic. If the clinic has already sent records, they may still arrive. You can start a new request or upload your own records anytime."});function Yu({request:t,onRecovered:r,canUpload:n=false},i){let[l,o]=e.useState(""),[a,s]=e.useState(false),[d,c]=e.useState(null),[u,h]=e.useState(false),[p,g]=e.useState(null),f=e.useRef(false),m=e.useRef(false),b=e.useRef(0);e.useEffect(()=>(m.current=true,()=>{m.current=false,b.current+=1}),[i]);let y=p!==null&&p.before===t.updatedAt?{...p.value,canRetrySend:t.canRetrySend===true&&p.value.canRetrySend===true,canUpdateClinicEmail:t.canUpdateClinicEmail===true&&p.value.canUpdateClinicEmail===true,canRevoke:t.canRevoke===true&&p.value.canRevoke===true,canConvertToUpload:t.canConvertToUpload===true&&p.value.canConvertToUpload===true}:t,x=l.trim(),w=x.length<=320&&!Array.from(x).some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127)&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(x),v=y.canUpdateClinicEmail===true&&x.length>0,k=y.canRetrySend===true&&!a&&!v,j=y.canUpdateClinicEmail===true&&!a&&w,S=y.canConvertToUpload===true&&n,C=async e=>{let n={retry:k,email:j,revoke:y.canRevoke===true&&u,convert:S};if(f.current||!m.current||!n[e])return;f.current=true,s(true),c(null);let l=b.current,a=()=>m.current&&l===b.current;try{let n=e==="retry"?await i.retryRequest(t.id):e==="email"?await i.updateClinicEmail(t.id,x):e==="revoke"?await i.revokeRequest(t.id):await i.convertToUpload(t.id);if(!a())return;if(!n.ok){c(n.error);return}if(n.value.id!==t.id||n.value.petRef!==t.petRef){c(makeEverfurError("internalError"));return}g({before:t.updatedAt,value:n.value}),o(""),h(!1),r()}catch{a()&&c(makeEverfurError("internalError"))}finally{f.current=false,a()&&s(false)}};return{request:y,email:l,busy:a,error:d,canRetry:k,canUpdateEmail:j,canConvert:S,hasEmailEdit:v,confirmingRevoke:u&&y.canRevoke===true,emailInvalid:x.length>0&&!w,setEmail(e){f.current||(o(e),c(null))},retry:()=>C("retry"),updateEmail:()=>C("email"),revoke:()=>C("revoke"),convert:()=>C("convert"),askRevoke(){!f.current&&y.canRevoke===true&&h(true)},keepRequest(){f.current||h(false)}}}var Xu=["requested","sent_to_clinic","awaiting_clinic","records_received","processing","ready"],Qu=["requested","awaiting_upload","records_received","processing","ready"],Ju=["requested","sent_to_clinic","awaiting_clinic","awaiting_upload","records_received","processing","ready"],Zu=/* @__PURE__ */Object.freeze({requested:"Request created",sent_to_clinic:"Sent to the clinic",awaiting_clinic:"Waiting on the clinic",awaiting_upload:"Add your records",records_received:"Records received",processing:"Preparing your records",parsing_failed:"Needs a closer look",manual_review:"Our team is reviewing it",ready:"Ready to view",delivery_failed:"Email could not be delivered",processing_failed:"Could not process the records",clinic_declined:"Clinic declined the request",clinic_no_records:"Clinic replied without your records",no_response:"No response from the clinic",revoked:"You cancelled this request"}),eh=/* @__PURE__ */Object.freeze({requested:"Request sent",sent_to_clinic:"Clinic notified",awaiting_clinic:"Waiting for records…"}),th=/* @__PURE__ */Object.freeze({notified:e=>`A secure request went to ${e}.`,received:"Everfur reads every page: dates, vaccines, labs and prescriptions.",added:e=>`Added to ${e}’s records`}),rh=/* @__PURE__ */Object.freeze({delivered:"Email delivered to the clinic",emailing:"Emailing the clinic",bounced:"The clinic email did not go through",waiting:"Waiting for the clinic to send the records",upload:"Upload the records you already have",ownerAdded:"You added these records",clinicSent:"The clinic sent the records",preparing:"Getting your records ready to view",ready:"Your records are ready to view",parsingFailed:"We couldn’t read this one automatically",manualReview:"Checking these by hand so nothing’s missed",switchedTitle:"Stopped waiting on the clinic",switched:"You switched to uploading your own records"}),nh=/* @__PURE__ */Object.freeze({delivery_failed:"The clinic email could not be delivered",processing_failed:"We could not read these records",clinic_declined:"The clinic declined to release records",clinic_no_records:"The clinic replied without records",no_response:"No reply after repeated reminders",revoked:"You cancelled this request"}),ih=/* @__PURE__ */Object.freeze({requested:"sent",awaiting_clinic:"awaiting_response",awaiting_upload:"awaiting_upload",received:"records_received",parsing:"parsing",in_review:"in_review",published:"published",failed:"failed",revoked:"revoked"});function lh(e){return e.wireStatus??ih[e.status]??"sent"}function oh(e,t){return e!=="awaiting_response"||t<=0?null:`${t} ${t===1?"reminder":"reminders"} sent`}function ah(e){switch(e){case"submitted":case"sent":return 1;case"awaiting_response":return 2;case"records_received":return 3;case"parsing":case"parsing_failed":case"in_review":case"review_email_failed":return 4;case"published":return 5;default:return-1}}function sh(e){switch(e.dispatchStatus){case"sent":return rh.delivered;case"preparing":case"queued":case"sending":return rh.emailing;case"failed":return rh.bounced;default:return null}}function dh(e,t){return oh(t,e.reminderCount??0)??rh.waiting}function ch(e){return e.source==="owner_provided"||!!e.convertedToUploadAt}function uh(e,t,r){let n=ch(t);switch(e){case"sent_to_clinic":return sh(t);case"awaiting_clinic":return dh(t,r);case"awaiting_upload":return rh.upload;case"records_received":return n?rh.ownerAdded:rh.clinicSent;case"processing":return rh.preparing;case"ready":return rh.ready;default:return null}}function hh(e,t){return!!e.reviewStartedAt||t==="parsing_failed"||t==="review_email_failed"}function ph(e,t,r){if(e.key!=="processing"||!hh(t,r))return[e];let n=r==="parsing_failed",i=r==="published",l=i?"done":n?"current":"done",o=i?"done":n?"upcoming":"current";return[{key:"parsing_failed",title:Zu.parsing_failed,detail:rh.parsingFailed,at:null,state:l},{key:"manual_review",title:Zu.manual_review,detail:rh.manualReview,at:t.reviewStartedAt??null,state:o}]}function gh(e){switch(e){case"awaiting_upload":return 3;case"records_received":return 4;case"parsing":case"parsing_failed":case"in_review":case"review_email_failed":return 5;case"published":return 6;default:return 3}}function fh(e){return{key:"awaiting_clinic",title:rh.switchedTitle,detail:rh.switched,at:e.convertedToUploadAt??null,state:"done"}}function mh(e){switch(e){case"submitted":case"sent":return 0;case"awaiting_upload":return 1;case"records_received":return 2;case"parsing":case"parsing_failed":case"in_review":case"review_email_failed":return 3;case"published":return 4;default:return-1}}function bh(e,t,r){switch(e){case"requested":return t.createdAt||null;case"awaiting_clinic":return t.lastReminderAt??null;case"processing":return t.parsingStartedAt??t.reviewStartedAt??null;case"ready":return r==="published"&&t.updatedAt||null;default:return null}}function yh(e,t,r,n){return{key:e,title:Zu[e],detail:uh(e,t,r),at:bh(e,t,r),state:n}}function xh(e,t){return{key:e,title:Zu[e],detail:nh[e]??null,at:t.updatedAt||null,state:"failed"}}function wh(e,t,r,n,i){return e.map((e,l)=>{let o=i?.(e)??null;if(o!==null)return o;let a=n==="published"||l<t?"done":l===t?"current":"upcoming";return yh(e,r,n,a)}).flatMap(e=>ph(e,r,n))}function buildRequestTimeline(e,t={}){return kh(jh(e),e,t.petName??null,t.sandbox===true)}function vh(e){return jh(e)}function kh(e,t,r,n){let i=t.source!=="owner_provided"&&!e.some(e=>e.key==="delivery_failed"),l=t.clinicEmail?.trim()??"";return e.map(e=>{if(e.title!==Zu[e.key])return e;if(e.key==="ready")return{...e,title:th.added(yn(r))};if(!i)return e;if(n&&e.key==="sent_to_clinic")return{...e,title:Ei.clinicNotContacted,detail:l.length>0?Ei.notEmailed(l):null};let o=eh[e.key]??e.title;return e.key==="sent_to_clinic"&&t.dispatchStatus==="sent"&&l.length>0?{...e,title:o,detail:th.notified(l)}:e.key==="records_received"&&!ch(t)?{...e,title:o,detail:th.received}:{...e,title:o}})}function jh(e){let t=lh(e),r=r=>yh(r,e,t,"done");if(t==="revoked")return[r("requested"),xh("revoked",e)];if(e.convertedToUploadAt)return t==="failed"?[r("requested"),r("sent_to_clinic"),fh(e),r("awaiting_upload"),r("records_received"),xh("processing_failed",e)]:wh(Ju,gh(t),e,t,t=>t==="awaiting_clinic"?fh(e):null);if(e.source==="owner_provided"){if(t==="failed"||t==="clinic_declined")return[r("requested"),r("awaiting_upload"),r("records_received"),xh("processing_failed",e)];let n=mh(t);return wh(Qu,n<0?1:n,e,t)}if(t==="clinic_declined")return[r("requested"),r("sent_to_clinic"),r("awaiting_clinic"),xh("clinic_declined",e)];if(t==="clinic_responded_no_records")return[r("requested"),r("sent_to_clinic"),r("awaiting_clinic"),xh("clinic_no_records",e)];if(t==="failed"){let t=e.failureCode??null;return t==="no_response"?[r("requested"),r("sent_to_clinic"),r("awaiting_clinic"),xh("no_response",e)]:t==="hard_bounce"||t==="dispatch_failed"?[r("requested"),xh("delivery_failed",e)]:t==="parse_timeout"||t==="parse_error"||e.dispatchStatus==="sent"?[r("requested"),r("sent_to_clinic"),r("awaiting_clinic"),r("records_received"),xh("processing_failed",e)]:[r("requested"),xh("delivery_failed",e)]}let n=ah(t);return wh(Xu,n<0?1:n,e,t)}var Sh=/* @__PURE__ */Object.freeze({done:"completed",current:"in progress",failed:"needs attention",upcoming:"not started"}),Ch=28,Rh="Now",Th=10;function RequestTimeline({request:e,petName:t}){let i=_h(),l=$i(),o=buildRequestTimeline(e,{petName:t??null,sandbox:l});/* @__PURE__ */
442
+ /* @__PURE__ */n.jsx(DisclaimerBand,{disclaimer:t.disclaimer})]})}function au(e,t){return e>0?e:Object.values(t).reduce((e,t)=>e+t,0)}function su(){let t=useEverfurTheme();return e.useMemo(()=>du(t),[t])}function du(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth;return r.StyleSheet.create({sections:{gap:n.lg+n.xs},vaccineGroup:{gap:n.xs+1,marginBottom:n.sm},vaccineYear:{...face(e,"monoMedium"),fontSize:l.size.micro,lineHeight:l.size.micro+n.xs,color:t.text.muted,letterSpacing:l.letterSpacing.eyebrow,textTransform:"uppercase",paddingTop:n.xs+2},ask:{marginTop:n.lg},conflictCard:{borderRadius:i.md,borderWidth:1,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md,gap:n.sm,...rn(ln(e.slots),1)},conflictHead:{flexDirection:"row",alignItems:"center",gap:n.sm},conflictTitle:{flex:1,...headingFace(e,"bold"),fontSize:l.size.body,lineHeight:Math.round(l.size.body*l.lineHeight.snug),color:t.text.primary,...nn(ln(e.slots))},candidate:{borderTopWidth:o,borderTopColor:t.borderHairlineGreen,paddingTop:n.sm},coverageRow:{flexDirection:"row",flexWrap:"wrap",gap:n.sm,paddingVertical:n.md},coveragePill:{borderRadius:i.pill,paddingHorizontal:n.sm+n.xs/2,paddingVertical:n.xs+1},coverageText:{...face(e,"medium"),fontSize:l.size.caption,lineHeight:l.size.caption+n.xs-1},coverageRest:e.slots.chip?.borderRadius===void 0?{}:{borderRadius:e.slots.chip.borderRadius},coverageRestText:{},coverageOnFile:e.slots.chip?.borderRadius===void 0?{}:{borderRadius:e.slots.chip.borderRadius},metaRow:{flexDirection:"row",alignItems:"center",gap:n.sm,paddingBottom:n.md},metaText:{flex:1,...face(e,"regular"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*l.lineHeight.snug),color:t.text.secondary},pendingText:{...face(e,"regular"),fontSize:l.size.caption,lineHeight:Math.round(l.size.caption*l.lineHeight.normal),color:t.text.muted,paddingBottom:n.md},identityLabel:{...face(e,"medium"),fontSize:l.size.bodyTight,lineHeight:Math.round(l.size.bodyTight*l.lineHeight.snug),color:t.text.secondary},identityValue:{flexShrink:1,textAlign:"right",...face(e,"medium"),fontSize:l.size.body,lineHeight:Math.round(l.size.body*l.lineHeight.snug),color:t.text.primary},cardTitle:{paddingTop:n.sm},noteSection:{paddingVertical:n.md,gap:n.xs},noteLabel:{...face(e,"bold"),fontSize:l.size.bodyTight,color:t.text.secondary,textTransform:"uppercase",letterSpacing:l.letterSpacing.eyebrow/2},noteBody:{...face(e,"regular"),fontSize:l.size.body+1,lineHeight:Math.round((l.size.body+1)*l.lineHeight.relaxed),color:t.text.primary},noteBodyMuted:{...face(e,"regular"),fontSize:l.size.body+1,lineHeight:Math.round((l.size.body+1)*l.lineHeight.relaxed),color:t.text.muted,fontStyle:"italic"}})}var cu=/* @__PURE__ */Object.freeze({heading:"A quick call can help",fallbackPrompt:"Reaching out to the clinic directly often speeds up a slow records request.",call:"Call the clinic",callAt:e=>`Call the clinic at ${e}`});function uu(e){return typeof e=="string"&&e.trim().length>0?e:null}function hu(e,t){return typeof e=="string"&&e.length>0&&uu(t)===null}var pu="[everfur] consentVersion was passed without consentText, so the records consent gate shows no consent text above Allow. Pass the consent text your member agrees to as consentText, next to its consentVersion.",gu=false;function fu(e,t,r){if(gu||!hu(e,t))return;let n=false;try{n=r()===!0}catch{n=false}if(!n)return;gu=true;let i=globalThis.console;try{i?.warn?.(pu)}catch{}}function mu(t,r,n){e.useEffect(()=>{fu(t,r,n)},[t,r,n])}function bu(){let e=r.useColorScheme();return e==="dark"?"dark":e==="light"?"light":null}function yu(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function xu(){let[t,n]=e.useState(false);return e.useEffect(()=>{let e=true,t=r.AccessibilityInfo?.isReduceMotionEnabled;if(typeof t=="function"){let i=t.call(r.AccessibilityInfo);i!=null&&typeof i.then=="function"&&i.then(t=>{e&&n(t===true)},()=>{})}let i=r.AccessibilityInfo?.addEventListener?.("reduceMotionChanged",e=>n(e===true));return()=>{e=false,i?.remove?.()}},[]),t}function wu(){let e=r.PixelRatio?.getFontScale;if(typeof e!="function")return 1;try{let t=e.call(r.PixelRatio);return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}catch{return 1}}function vu(e){let t=r.Dimensions?.addEventListener;if(typeof t!="function")return()=>{};let n=t.call(r.Dimensions,"change",e);return()=>n?.remove?.()}function ku(){return e.useSyncExternalStore(vu,wu,wu)}function ju(){try{let e=r.Platform?.OS;return typeof e=="string"?e:null}catch{return null}}function Su(){return ju()==="android"?{query:"isHighTextContrastEnabled",event:"highTextContrastChanged"}:{query:"isDarkerSystemColorsEnabled",event:"darkerSystemColorsChanged"}}function Cu(){let[t,n]=e.useState(false);return e.useEffect(()=>{let e=true,{query:t,event:i}=Su(),l=r.AccessibilityInfo?.[t];if(typeof l!="function")return()=>{};try{let t=l.call(r.AccessibilityInfo);yu(t)&&Promise.resolve(t).then(t=>{e&&n(t===!0)},()=>{})}catch{}let o=r.AccessibilityInfo?.addEventListener,a=typeof o=="function"?o.call(r.AccessibilityInfo,i,e=>n(e===true)):void 0;return()=>{e=false,a?.remove?.()}},[]),t}function Ru(){return ju()==="ios"?"Menlo":$r}function Tu(){return globalThis.__DEV__!==false}var _u=/* @__PURE__ */new Set;function zu(e){if(!Tu()||_u.has(e))return;_u.add(e);let t=globalThis.console;try{t?.warn?.(`[everfur] The theme names the font face "${e}", which this app has not registered; the SDK renders the platform font at that weight instead. Register the font file (expo-font or your native font assets) or name a registered face.`)}catch{}}function Iu(e){let t=globalThis.expo?.modules?.ExpoFontLoader,r=t?.getLoadedFonts;if(typeof r!="function")return null;let n;try{n=r.call(t)}catch{return null}if(!Array.isArray(n)||n.length===0)return null;let i=n.includes(e);return i||zu(e),i}var Du=/* @__PURE__ */new Set;function Hu(e){let t=[];return e.type.fontSources.length>0&&t.push("fontSources"),Object.values(e.type.fontUrls).some(e=>typeof e=="string"&&e.length>0)&&t.push("fontUrls"),t}var Vu=/* @__PURE__ */Object.freeze({fontSources:"appearance.fonts (font_sources)",fontUrls:"font_urls"});function Pu(e){if(!Tu())return;let t=Hu(e).filter(e=>!Du.has(e));if(t.length===0)return;for(let e of t)Du.add(e);let r=globalThis.console;try{r?.warn?.(`[everfur] The theme sets ${t.map(e=>Vu[e]).join(" and ")}, which only the web SDK loads. React Native does not download fonts: register the font file with expo-font (or your native font assets) and name the family. Until then the SDK renders the family as named, or the platform font when the app reports that family missing.`)}catch{}}function Lu(t){e.useEffect(()=>{try{Pu(t)}catch{}},[t])}var Ou=/* @__PURE__ */Object.freeze({useColorScheme:bu,useReducedMotion:xu,useTextScale:ku,useHighContrast:Cu,scaleTypeSizes:false,typeProfile:"phone",platformMonoFamily:Ru,isFontRegistered:Iu,useResolvedTheme:Lu,isDevelopment:Tu});var Eu=()=>Ou.isDevelopment?.()===true;function Au(e,t){mu(e,t,Eu)}var $u=Math.round(Ee/(1024*1024)),Bu=/* @__PURE__ */Object.freeze({title:e=>`Upload ${yn(e)}’s records`,screenTitle:"Upload a document",subtitle:e=>`Already have lab results, a vet summary, or test reports? Add them here and we’ll read them and pull out ${yn(e)}’s health markers.`,noPet:"Select a pet first, then upload their records.",cardTitle:"Add records",cardSubtitle:`Upload PDF records you already have, up to ${$u} MB each. You can pick several at once. We’ll read them and add the results to your records.`,chooseFiles:"Choose a file",uploading:(e,t)=>`Uploading ${Math.min(e+1,t)} of ${t}…`,cancel:"Cancel",cancelA11y:"Cancel these uploads",received:e=>`${e===1?"Record received.":`${e} records received.`} We’ll read and review ${e===1?"it":"them"}, then add the results to your records, usually within 1-2 business days.`,retryFailed:e=>`Retry ${e} that didn’t upload`,haveMore:"Have more?",addMore:"Upload another document",addMoreA11y:"Upload another document",done:"Done",doneA11y:"Done, view records",errors:/* @__PURE__ */Object.freeze({start:"We couldn’t start that upload. Check your connection and try again.",startPlain:"We couldn’t start that upload. Please try again.",upload:"We couldn’t upload that record. Check your connection and try again."})}),Fu=/* @__PURE__ */Object.freeze({note:"A PDF, or a photo of a paper record. Add them all; we sort them by date.",takePhoto:"Take a photo",takePhotoMeta:"of a paper record",choosePhotos:"Choose from photos",chooseFileMeta:"PDF",haveMoreLead:"PDFs and photos of paper records both work. Add them all; we sort them by date.",unreadable:"We can’t read this kind of file. Upload a PDF or a photo of the record."});function Mu(e,t){return`${e} ${t}`}var qu=Math.round(Ee/(1024*1024)),Nu=/* @__PURE__ */Object.freeze({queued:"Queued",verifying:"Verifying…",done:"Done",failed:"Failed",uploading:(e,t)=>`Uploading ${Math.min(e+1,t)} of ${t} records`,uploaded:(e,t)=>`${e} of ${t} records uploaded`});function Wu(e){let t=Math.round(e.progress*100);switch(e.status){case"done":return Nu.done;case"failed":return Nu.failed;case"uploading":return e.progress>=1?Nu.verifying:`${t}%`;case"queued":return Nu.queued;default:return null}}function Uu(e,t=false){if(e.length===0)return null;let r=e=>{let t=e.map(e=>e.name??"");return t.length<=3?t.join(", "):`${t.slice(0,3).join(", ")} and ${t.length-3} more`},n=e.filter(e=>e.reason==="too_large"),i=e.filter(e=>e.reason==="unsupported");if(t){let e=[];return i.length>0&&e.push(Fu.unreadable),n.length>0&&e.push(`Didn’t upload: ${r(n)} ${n.length>1?"are":"is"} over ${qu} MB.`),e.join(" ")}let l=[];return i.length>0&&l.push(`${r(i)} ${i.length>1?"are not PDFs":"is not a PDF"}`),n.length>0&&l.push(`${r(n)} ${n.length>1?"are":"is"} over ${qu} MB`),`Didn’t upload: ${l.join("; ")}. We can only read PDFs up to ${qu} MB right now.`}function Gu(e){let t=[];for(let r of e)r.status==="skipped"&&r.skipReason!==null&&t.push({name:r.name,reason:r.skipReason});return t}var Ku=/* @__PURE__ */Object.freeze({email:"Clinic email",emailPlaceholder:"records@clinic.com",emailError:"Enter a valid clinic email.",updateEmail:"Update email & resend",retry:"Retry sending",retryA11y:"Retry sending records request",retryHint:"Save the updated email first, then retry.",cancelRequest:"Cancel request",keepRequest:"Keep it",uploadInstead:"Upload instead",cancelQuestion:"Cancel this request?",cancelConsequence:"We’ll stop sending reminders to the clinic. If the clinic has already sent records, they may still arrive. You can start a new request or upload your own records anytime."});function Yu({request:t,onRecovered:r,canUpload:n=false},i){let[l,o]=e.useState(""),[a,s]=e.useState(false),[d,c]=e.useState(null),[u,h]=e.useState(false),[p,g]=e.useState(null),f=e.useRef(false),m=e.useRef(false),b=e.useRef(0);e.useEffect(()=>(m.current=true,()=>{m.current=false,b.current+=1}),[i]);let y=p!==null&&p.before===t.updatedAt?{...p.value,canRetrySend:t.canRetrySend===true&&p.value.canRetrySend===true,canUpdateClinicEmail:t.canUpdateClinicEmail===true&&p.value.canUpdateClinicEmail===true,canRevoke:t.canRevoke===true&&p.value.canRevoke===true,canConvertToUpload:t.canConvertToUpload===true&&p.value.canConvertToUpload===true}:t,x=l.trim(),w=x.length<=320&&!Array.from(x).some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127)&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(x),v=y.canUpdateClinicEmail===true&&x.length>0,k=y.canRetrySend===true&&!a&&!v,j=y.canUpdateClinicEmail===true&&!a&&w,S=y.canConvertToUpload===true&&n,C=async e=>{let n={retry:k,email:j,revoke:y.canRevoke===true&&u,convert:S};if(f.current||!m.current||!n[e])return;f.current=true,s(true),c(null);let l=b.current,a=()=>m.current&&l===b.current;try{let n=e==="retry"?await i.retryRequest(t.id):e==="email"?await i.updateClinicEmail(t.id,x):e==="revoke"?await i.revokeRequest(t.id):await i.convertToUpload(t.id);if(!a())return;if(!n.ok){c(n.error);return}if(n.value.id!==t.id||n.value.petRef!==t.petRef){c(makeEverfurError("internalError"));return}g({before:t.updatedAt,value:n.value}),o(""),h(!1),r()}catch{a()&&c(makeEverfurError("internalError"))}finally{f.current=false,a()&&s(false)}};return{request:y,email:l,busy:a,error:d,canRetry:k,canUpdateEmail:j,canConvert:S,hasEmailEdit:v,confirmingRevoke:u&&y.canRevoke===true,emailInvalid:x.length>0&&!w,setEmail(e){f.current||(o(e),c(null))},retry:()=>C("retry"),updateEmail:()=>C("email"),revoke:()=>C("revoke"),convert:()=>C("convert"),askRevoke(){!f.current&&y.canRevoke===true&&h(true)},keepRequest(){f.current||h(false)}}}var Xu=["requested","sent_to_clinic","awaiting_clinic","records_received","processing","ready"],Qu=["requested","awaiting_upload","records_received","processing","ready"],Ju=["requested","sent_to_clinic","awaiting_clinic","awaiting_upload","records_received","processing","ready"],Zu=/* @__PURE__ */Object.freeze({requested:"Request created",sent_to_clinic:"Sent to the clinic",awaiting_clinic:"Waiting on the clinic",awaiting_upload:"Add your records",records_received:"Records received",processing:"Preparing your records",parsing_failed:"Needs a closer look",manual_review:"Our team is reviewing it",ready:"Ready to view",delivery_failed:"Email could not be delivered",processing_failed:"Could not process the records",clinic_declined:"Clinic declined the request",clinic_no_records:"Clinic replied without your records",no_response:"No response from the clinic",revoked:"You cancelled this request"}),eh=/* @__PURE__ */Object.freeze({requested:"Request sent",sent_to_clinic:"Clinic notified",awaiting_clinic:"Waiting for records…"}),th=/* @__PURE__ */Object.freeze({notified:e=>`A secure request went to ${e}.`,received:"Everfur reads every page: dates, vaccines, labs and prescriptions.",added:e=>`Added to ${e}’s records`}),rh=/* @__PURE__ */Object.freeze({delivered:"Email delivered to the clinic",emailing:"Emailing the clinic",bounced:"The clinic email did not go through",waiting:"Waiting for the clinic to send the records",upload:"Upload the records you already have",ownerAdded:"You added these records",clinicSent:"The clinic sent the records",preparing:"Getting your records ready to view",ready:"Your records are ready to view",parsingFailed:"We couldn’t read this one automatically",manualReview:"Checking these by hand so nothing’s missed",switchedTitle:"Stopped waiting on the clinic",switched:"You switched to uploading your own records"}),nh=/* @__PURE__ */Object.freeze({delivery_failed:"The clinic email could not be delivered",processing_failed:"We could not read these records",clinic_declined:"The clinic declined to release records",clinic_no_records:"The clinic replied without records",no_response:"No reply after repeated reminders",revoked:"You cancelled this request"}),ih=/* @__PURE__ */Object.freeze({requested:"sent",awaiting_clinic:"awaiting_response",awaiting_upload:"awaiting_upload",received:"records_received",parsing:"parsing",in_review:"in_review",published:"published",failed:"failed",revoked:"revoked"});function lh(e){return e.wireStatus??ih[e.status]??"sent"}function oh(e,t){return e!=="awaiting_response"||t<=0?null:`${t} ${t===1?"reminder":"reminders"} sent`}function ah(e){switch(e){case"submitted":case"sent":return 1;case"awaiting_response":return 2;case"records_received":return 3;case"parsing":case"parsing_failed":case"in_review":case"review_email_failed":return 4;case"published":return 5;default:return-1}}function sh(e){switch(e.dispatchStatus){case"sent":return rh.delivered;case"preparing":case"queued":case"sending":return rh.emailing;case"failed":return rh.bounced;default:return null}}function dh(e,t){return oh(t,e.reminderCount??0)??rh.waiting}function ch(e){return e.source==="owner_provided"||!!e.convertedToUploadAt}function uh(e,t,r){let n=ch(t);switch(e){case"sent_to_clinic":return sh(t);case"awaiting_clinic":return dh(t,r);case"awaiting_upload":return rh.upload;case"records_received":return n?rh.ownerAdded:rh.clinicSent;case"processing":return rh.preparing;case"ready":return rh.ready;default:return null}}function hh(e,t){return!!e.reviewStartedAt||t==="parsing_failed"||t==="review_email_failed"}function ph(e,t,r){if(e.key!=="processing"||!hh(t,r))return[e];let n=r==="parsing_failed",i=r==="published",l=i?"done":n?"current":"done",o=i?"done":n?"upcoming":"current";return[{key:"parsing_failed",title:Zu.parsing_failed,detail:rh.parsingFailed,at:null,state:l},{key:"manual_review",title:Zu.manual_review,detail:rh.manualReview,at:t.reviewStartedAt??null,state:o}]}function gh(e){switch(e){case"awaiting_upload":return 3;case"records_received":return 4;case"parsing":case"parsing_failed":case"in_review":case"review_email_failed":return 5;case"published":return 6;default:return 3}}function fh(e){return{key:"awaiting_clinic",title:rh.switchedTitle,detail:rh.switched,at:e.convertedToUploadAt??null,state:"done"}}function mh(e){switch(e){case"submitted":case"sent":return 0;case"awaiting_upload":return 1;case"records_received":return 2;case"parsing":case"parsing_failed":case"in_review":case"review_email_failed":return 3;case"published":return 4;default:return-1}}function bh(e,t,r){switch(e){case"requested":return t.createdAt||null;case"awaiting_clinic":return t.lastReminderAt??null;case"processing":return t.parsingStartedAt??t.reviewStartedAt??null;case"ready":return r==="published"&&t.updatedAt||null;default:return null}}function yh(e,t,r,n){return{key:e,title:Zu[e],detail:uh(e,t,r),at:bh(e,t,r),state:n}}function xh(e,t){return{key:e,title:Zu[e],detail:nh[e]??null,at:t.updatedAt||null,state:"failed"}}function wh(e,t,r,n,i){return e.map((e,l)=>{let o=i?.(e)??null;if(o!==null)return o;let a=n==="published"||l<t?"done":l===t?"current":"upcoming";return yh(e,r,n,a)}).flatMap(e=>ph(e,r,n))}function buildRequestTimeline(e,t={}){return kh(jh(e),e,t.petName??null,t.sandbox===true)}function vh(e){return jh(e)}function kh(e,t,r,n){let i=t.source!=="owner_provided"&&!e.some(e=>e.key==="delivery_failed"),l=t.clinicEmail?.trim()??"";return e.map(e=>{if(e.title!==Zu[e.key])return e;if(e.key==="ready")return{...e,title:th.added(yn(r))};if(!i)return e;if(n&&e.key==="sent_to_clinic")return{...e,title:Oi.clinicNotContacted,detail:l.length>0?Oi.notEmailed(l):null};let o=eh[e.key]??e.title;return e.key==="sent_to_clinic"&&t.dispatchStatus==="sent"&&l.length>0?{...e,title:o,detail:th.notified(l)}:e.key==="records_received"&&!ch(t)?{...e,title:o,detail:th.received}:{...e,title:o}})}function jh(e){let t=lh(e),r=r=>yh(r,e,t,"done");if(t==="revoked")return[r("requested"),xh("revoked",e)];if(e.convertedToUploadAt)return t==="failed"?[r("requested"),r("sent_to_clinic"),fh(e),r("awaiting_upload"),r("records_received"),xh("processing_failed",e)]:wh(Ju,gh(t),e,t,t=>t==="awaiting_clinic"?fh(e):null);if(e.source==="owner_provided"){if(t==="failed"||t==="clinic_declined")return[r("requested"),r("awaiting_upload"),r("records_received"),xh("processing_failed",e)];let n=mh(t);return wh(Qu,n<0?1:n,e,t)}if(t==="clinic_declined")return[r("requested"),r("sent_to_clinic"),r("awaiting_clinic"),xh("clinic_declined",e)];if(t==="clinic_responded_no_records")return[r("requested"),r("sent_to_clinic"),r("awaiting_clinic"),xh("clinic_no_records",e)];if(t==="failed"){let t=e.failureCode??null;return t==="no_response"?[r("requested"),r("sent_to_clinic"),r("awaiting_clinic"),xh("no_response",e)]:t==="hard_bounce"||t==="dispatch_failed"?[r("requested"),xh("delivery_failed",e)]:t==="parse_timeout"||t==="parse_error"||e.dispatchStatus==="sent"?[r("requested"),r("sent_to_clinic"),r("awaiting_clinic"),r("records_received"),xh("processing_failed",e)]:[r("requested"),xh("delivery_failed",e)]}let n=ah(t);return wh(Xu,n<0?1:n,e,t)}var Sh=/* @__PURE__ */Object.freeze({done:"completed",current:"in progress",failed:"needs attention",upcoming:"not started"}),Ch=28,Rh="Now",Th=10;function RequestTimeline({request:e,petName:t}){let i=_h(),l=$i(),o=buildRequestTimeline(e,{petName:t??null,sandbox:l});/* @__PURE__ */
443
443
  return n.jsx(r.View,{style:i.container,accessibilityRole:"summary",children:o.map((e,t)=>/* @__PURE__ */n.jsx(TimelineRow,{event:e,isLast:t===o.length-1,styles:i},e.key))})}function TimelineRow({event:e,isLast:t,styles:i}){let l=e.at?bo(e.at):null,o=[e.title,e.detail,l,Sh[e.state]].filter(Boolean);/* @__PURE__ */
444
444
  return n.jsxs(r.View,{style:i.row,accessible:true,accessibilityRole:"text",accessibilityLabel:o.join(", "),testID:`records-timeline-${e.key}`,children:[
445
445
  /* @__PURE__ */n.jsxs(r.View,{style:i.railColumn,children:[
@@ -451,15 +451,15 @@ return n.jsx(ConsentRequiredState,{onGrant:t,consentText:i,consentScope:e.consen
451
451
  return n.jsx(ConsentUnavailableState,{});case"session_required":/* @__PURE__ */
452
452
  return n.jsx(SessionRequiredState,{});case"withheld":/* @__PURE__ */
453
453
  return n.jsx(WithheldState,{});case"pet_not_found":case"error":/* @__PURE__ */
454
- return n.jsx(ErrorState,{error:o.error,onRetry:e.refresh});default:return assertNever(o)}}function Vh(e,t){return()=>{let r=sc(t,e.consent);if(r.length===0)return;let n=`records-consent-${Date.now().toString(36)}`;return e.grantConsent(r,n)}}function UploadQueue({records:e}){let t=Oh(),i=e.uploadQueue;if(i.length===0)return null;let l=i.filter(e=>e.status!=="skipped"),o=l.filter(e=>e.status==="done").length,a=Uu(Gu(i));/* @__PURE__ */
454
+ return n.jsx(ErrorState,{error:o.error,onRetry:e.refresh});default:return assertNever(o)}}function Vh(e,t){return()=>{let r=sc(t,e.consent);if(r.length===0)return;let n=`records-consent-${Date.now().toString(36)}`;return e.grantConsent(r,n)}}function UploadQueue({records:e}){let t=Eh(),i=e.uploadQueue;if(i.length===0)return null;let l=i.filter(e=>e.status!=="skipped"),o=l.filter(e=>e.status==="done").length,a=Uu(Gu(i));/* @__PURE__ */
455
455
  return n.jsxs(r.View,{style:t.timeline,testID:"records-upload-queue",children:[a!==null?/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",style:t.errorText,children:a}):null,l.length>0?/* @__PURE__ */n.jsx(r.View,{accessibilityLiveRegion:"polite",accessibilityLabel:e.isUploading?Nu.uploading(o,l.length):Nu.uploaded(o,l.length),children:l.map(e=>{let i=Math.round(e.progress*100);
456
456
  /* @__PURE__ */
457
457
  return n.jsxs(r.View,{style:t.uploadRow,testID:`records-upload-file-${e.status}`,children:[
458
458
  /* @__PURE__ */n.jsxs(r.View,{style:t.uploadRowHead,children:[
459
459
  /* @__PURE__ */n.jsx(Text,{style:t.rowLabel,children:e.name??""}),
460
- /* @__PURE__ */n.jsx(Text,{style:t.rowValue,children:Wu(e)})]}),e.status==="uploading"?/* @__PURE__ */n.jsx(r.View,{style:t.progressTrack,accessibilityRole:"progressbar",accessibilityValue:{min:0,max:100,now:i},children:/* @__PURE__ */n.jsx(r.View,{style:[t.progressFill,{width:`${i}%`}]})}):null,e.status==="failed"&&e.error?/* @__PURE__ */n.jsx(Text,{style:t.timelineMeta,children:e.error.displayMessage}):null]},e.key)})}):null]})}function ConsentRequiredState({onGrant:t,consentText:i,consentScope:l,inSheet:o=false}){let a=Oh(),s=Xl(),d=uu(i),{pending:c,error:u,grant:h}=Dh(t),p=l==="all_pets";e.useEffect(()=>{r.AccessibilityInfo.announceForAccessibility?.(fn.consentRequired)},[]);let g=s===null?null:Lh(s),f=g===null?c?a.disabledButton:a.primaryButton:[s.button,s.buttonInk,c?{opacity:.5}:null],m=g===null?c?a.disabledLabel:a.primaryLabel:s.buttonInkLabel,b=/* @__PURE__ */n.jsxs(r.View,{style:g===null?a.centered:g.card,testID:"records-consent-gate",children:[
460
+ /* @__PURE__ */n.jsx(Text,{style:t.rowValue,children:Wu(e)})]}),e.status==="uploading"?/* @__PURE__ */n.jsx(r.View,{style:t.progressTrack,accessibilityRole:"progressbar",accessibilityValue:{min:0,max:100,now:i},children:/* @__PURE__ */n.jsx(r.View,{style:[t.progressFill,{width:`${i}%`}]})}):null,e.status==="failed"&&e.error?/* @__PURE__ */n.jsx(Text,{style:t.timelineMeta,children:e.error.displayMessage}):null]},e.key)})}):null]})}function ConsentRequiredState({onGrant:t,consentText:i,consentScope:l,inSheet:o=false}){let a=Eh(),s=Xl(),d=uu(i),{pending:c,error:u,grant:h}=Dh(t),p=l==="all_pets";e.useEffect(()=>{r.AccessibilityInfo.announceForAccessibility?.(fn.consentRequired)},[]);let g=s===null?null:Lh(s),f=g===null?c?a.disabledButton:a.primaryButton:[s.button,s.buttonInk,c?{opacity:.5}:null],m=g===null?c?a.disabledLabel:a.primaryLabel:s.buttonInkLabel,b=/* @__PURE__ */n.jsxs(r.View,{style:g===null?a.centered:g.card,testID:"records-consent-gate",children:[
461
461
  /* @__PURE__ */n.jsx(Text,{style:g===null?a.askText:g.title,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",children:fn.consentRequired}),d!==null?/* @__PURE__ */n.jsx(Text,{style:g===null?a.disclaimer:g.body,testID:"records-consent-gate-body",children:d}):null,p?/* @__PURE__ */n.jsx(Text,{style:g===null?a.disclaimer:g.body,testID:"records-consent-gate-all-pets",children:fn.allPetsConsent}):null,
462
- /* @__PURE__ */n.jsx(r.Pressable,{onPress:h,disabled:c,accessibilityRole:"button",accessibilityLabel:fn.allow,accessibilityHint:p?fn.allPetsConsent:void 0,accessibilityState:{disabled:c,busy:c},style:f,testID:"records-consent-allow",children:/* @__PURE__ */n.jsx(Text,{style:m,children:fn.allow})}),u!==null?/* @__PURE__ */n.jsx(Text,{style:g===null?a.errorText:g.error,accessibilityRole:"alert",testID:"records-consent-grant-error",children:u.displayMessage}):null]});return g===null||o?b:/* @__PURE__ */n.jsx(r.View,{style:g.inset,children:b})}var Ph=/* @__PURE__ */new WeakMap;function Lh(e){let t=Ph.get(e);return t===void 0&&(t=Eh(e),Ph.set(e,t)),t}function Eh(e){return r.StyleSheet.create({inset:{padding:16},card:El(e,{alignItems:"stretch"}),title:e.cardTitle,body:e.body,error:{...e.body,color:e.look.alert}})}function AlertState({label:t,glyph:i}){let l=Oh();return e.useEffect(()=>{r.AccessibilityInfo.announceForAccessibility?.(t)},[t]),/* @__PURE__ */n.jsxs(r.View,{style:l.centered,accessible:true,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:t,children:[
462
+ /* @__PURE__ */n.jsx(r.Pressable,{onPress:h,disabled:c,accessibilityRole:"button",accessibilityLabel:fn.allow,accessibilityHint:p?fn.allPetsConsent:void 0,accessibilityState:{disabled:c,busy:c},style:f,testID:"records-consent-allow",children:/* @__PURE__ */n.jsx(Text,{style:m,children:fn.allow})}),u!==null?/* @__PURE__ */n.jsx(Text,{style:g===null?a.errorText:g.error,accessibilityRole:"alert",testID:"records-consent-grant-error",children:u.displayMessage}):null]});return g===null||o?b:/* @__PURE__ */n.jsx(r.View,{style:g.inset,children:b})}var Ph=/* @__PURE__ */new WeakMap;function Lh(e){let t=Ph.get(e);return t===void 0&&(t=Oh(e),Ph.set(e,t)),t}function Oh(e){return r.StyleSheet.create({inset:{padding:16},card:Ol(e,{alignItems:"stretch"}),title:e.cardTitle,body:e.body,error:{...e.body,color:e.look.alert}})}function AlertState({label:t,glyph:i}){let l=Eh();return e.useEffect(()=>{r.AccessibilityInfo.announceForAccessibility?.(t)},[t]),/* @__PURE__ */n.jsxs(r.View,{style:l.centered,accessible:true,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:t,children:[
463
463
  /* @__PURE__ */n.jsx(r.View,{style:i==="withheld"?l.withheldGlyph:l.emptyGlyph}),
464
464
  /* @__PURE__ */n.jsx(Text,{style:l.errorText,children:t})]})}function ConsentUnavailableState(){/* @__PURE__ */
465
465
  return n.jsx(AlertState,{label:fn.consentRequired,glyph:"empty"})}function SessionRequiredState(){/* @__PURE__ */
@@ -467,12 +467,12 @@ return n.jsx(AlertState,{label:fn.sessionRequired,glyph:"empty"})}function Sessi
467
467
  return n.jsxs(r.View,{style:[i.root,e],testID:t,children:[
468
468
  /* @__PURE__ */n.jsx(r.View,{style:i.body,children:/* @__PURE__ */n.jsx(SessionRequiredState,{})}),
469
469
  /* @__PURE__ */n.jsx(RecordsFootnote,{})]})}function WithheldState(){/* @__PURE__ */
470
- return n.jsx(AlertState,{label:fn.recordUnavailable,glyph:"withheld"})}function ErrorState({error:t,onRetry:i}){let l=Oh();return e.useEffect(()=>{r.AccessibilityInfo.announceForAccessibility?.(t.displayMessage)},[t.displayMessage]),/* @__PURE__ */n.jsxs(r.View,{style:l.centered,accessible:true,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",children:[
471
- /* @__PURE__ */n.jsx(Text,{style:l.errorText,children:t.displayMessage}),t.retryable?/* @__PURE__ */n.jsx(r.Pressable,{onPress:i,accessibilityRole:"button",accessibilityLabel:fn.retry,style:l.primaryButton,children:/* @__PURE__ */n.jsx(Text,{style:l.primaryLabel,children:fn.retry})}):null]})}function ClinicCallCard({call:e,prompt:t}){let i=Oh(),l=t.trim().length>0?t:cu.fallbackPrompt;/* @__PURE__ */
470
+ return n.jsx(AlertState,{label:fn.recordUnavailable,glyph:"withheld"})}function ErrorState({error:t,onRetry:i}){let l=Eh();return e.useEffect(()=>{r.AccessibilityInfo.announceForAccessibility?.(t.displayMessage)},[t.displayMessage]),/* @__PURE__ */n.jsxs(r.View,{style:l.centered,accessible:true,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",children:[
471
+ /* @__PURE__ */n.jsx(Text,{style:l.errorText,children:t.displayMessage}),t.retryable?/* @__PURE__ */n.jsx(r.Pressable,{onPress:i,accessibilityRole:"button",accessibilityLabel:fn.retry,style:l.primaryButton,children:/* @__PURE__ */n.jsx(Text,{style:l.primaryLabel,children:fn.retry})}):null]})}function ClinicCallCard({call:e,prompt:t}){let i=Eh(),l=t.trim().length>0?t:cu.fallbackPrompt;/* @__PURE__ */
472
472
  return n.jsxs(r.View,{style:i.callCard,accessibilityRole:"summary",children:[
473
473
  /* @__PURE__ */n.jsx(Text,{style:i.timelineLabel,children:cu.heading}),
474
474
  /* @__PURE__ */n.jsx(Text,{style:i.timelineMeta,children:l}),
475
- /* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>{r.Linking?.openURL?.(e.dial)},accessibilityRole:"button",accessibilityLabel:cu.callAt(e.phone),style:i.linkButton,testID:"records-call-clinic",children:/* @__PURE__ */n.jsx(Text,{style:i.linkLabel,children:cu.call})})]})}function Oh(){let t=useEverfurTheme();return e.useMemo(()=>Ah(t),[t])}function Ah(e){let{color:t,space:n,radius:i,type:l,slots:o}=e,{size:a,lineHeight:s,letterSpacing:d}=l,c=rn(ln(o),r.StyleSheet.hairlineWidth),u=nn(ln(o)),h=(e,t)=>Math.round(e*t),p=r.StyleSheet.hairlineWidth,g=n.xxl*3+n.xl,f=n.xxl+n.md,m=n.xxl+n.sm,b=e.brightness==="dark"?t.errorRed:t.danger,y={shadowColor:t.brand,shadowOffset:{width:0,height:n.xs},shadowRadius:n.sm,shadowOpacity:.08,elevation:n.xs};return r.StyleSheet.create({container:{flex:1,minHeight:g,backgroundColor:t.background},body:{flex:1},centered:{minHeight:g,flexGrow:1,alignItems:"center",justifyContent:"center",padding:n.xl,gap:n.lg},emptyGlyph:{width:m,height:m,borderRadius:i.lg,backgroundColor:t.brandSoft,borderWidth:p,borderColor:t.brandBorder},withheldGlyph:{width:m,height:m,borderRadius:i.sm,backgroundColor:t.badgeBgCaution,borderWidth:p,borderColor:t.cautionAccent},errorText:{...face(e,"regular"),fontSize:a.subtitle,lineHeight:h(a.subtitle,s.snug),color:b,textAlign:"center",marginBottom:n.md},askText:{...headingFace(e,"bold"),fontSize:a.subtitle,lineHeight:h(a.subtitle,s.snug),color:t.text.primary,textAlign:"center",marginBottom:n.md},primaryButton:{minHeight:f,minWidth:f,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xl,paddingVertical:n.md,borderRadius:i.pill,backgroundColor:t.primary,...y,...rn(o.primaryButton)},primaryLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:a.body,letterSpacing:d.tight,...nn(o.primaryButton)},linkButton:{minHeight:f,minWidth:f,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xl,paddingVertical:n.md,borderRadius:i.pill,backgroundColor:t.primary,...y,...rn(o.primaryButton)},linkLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:a.body,letterSpacing:d.tight,...nn(o.primaryButton)},disabledButton:{minHeight:f,minWidth:f,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xl,paddingVertical:n.md,borderRadius:i.pill,backgroundColor:t.surfaceSubtle,borderWidth:p,borderColor:t.brandBorder},disabledLabel:{...face(e,"bold"),color:t.text.muted,fontSize:a.body,letterSpacing:d.tight},list:{flex:1},listContent:{padding:n.lg,gap:n.md},timeline:{paddingVertical:n.md,paddingHorizontal:n.lg,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:p,borderColor:t.brandBorder,gap:n.xs,...y,...c},timelineTitle:{...headingFace(e,"bold"),fontSize:a.heading,lineHeight:h(a.heading,s.snug),color:t.text.primary,letterSpacing:d.tight,...u},timelineLabel:{...headingFace(e,"bold"),fontSize:a.subtitle,lineHeight:h(a.subtitle,s.snug),color:t.text.secondary,letterSpacing:d.tight,...u},callCard:{gap:n.sm,padding:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:p,borderColor:t.brandBorder,...c},timelineMeta:{...face(e,"regular"),fontSize:a.bodyTight,lineHeight:h(a.bodyTight,s.normal),color:t.text.muted,...u},recordBlock:{gap:n.sm,padding:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:p,borderColor:t.brandBorder,...y,...c},row:{flexDirection:"row",justifyContent:"space-between",gap:n.md,paddingVertical:n.xs,borderBottomWidth:p,borderBottomColor:t.borderHairlineGreen},rowLabel:{...face(e,"regular"),fontSize:a.body,lineHeight:h(a.body,s.normal),color:t.text.muted,flexShrink:1,...u},rowValue:{...face(e,"medium"),fontSize:a.body,lineHeight:h(a.body,s.normal),color:t.text.primary,textAlign:"right",flexShrink:1,...u},disclaimer:{...face(e,"regular"),fontSize:a.caption,lineHeight:h(a.caption,s.normal),color:t.text.muted,marginTop:n.md},uploadRow:{gap:n.xs,paddingVertical:n.xs,borderBottomWidth:p,borderBottomColor:t.borderHairlineGreen},uploadRowHead:{flexDirection:"row",justifyContent:"space-between",gap:n.md},progressTrack:{height:n.xs,borderRadius:i.pill,backgroundColor:t.brandSofter,overflow:"hidden",width:"100%"},progressFill:{height:"100%",backgroundColor:t.brand}})}var $h=/* @__PURE__ */Object.freeze({download:"Download",downloadA11y:e=>`Download, ${e}`,listA11y:"You added these records"});function formatBytes(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Bh(e){let t=e?.trim();return t?t.toUpperCase():null}function requestDocumentRows(e){/* @__PURE__ */
475
+ /* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>{r.Linking?.openURL?.(e.dial)},accessibilityRole:"button",accessibilityLabel:cu.callAt(e.phone),style:i.linkButton,testID:"records-call-clinic",children:/* @__PURE__ */n.jsx(Text,{style:i.linkLabel,children:cu.call})})]})}function Eh(){let t=useEverfurTheme();return e.useMemo(()=>Ah(t),[t])}function Ah(e){let{color:t,space:n,radius:i,type:l,slots:o}=e,{size:a,lineHeight:s,letterSpacing:d}=l,c=rn(ln(o),r.StyleSheet.hairlineWidth),u=nn(ln(o)),h=(e,t)=>Math.round(e*t),p=r.StyleSheet.hairlineWidth,g=n.xxl*3+n.xl,f=n.xxl+n.md,m=n.xxl+n.sm,b=e.brightness==="dark"?t.errorRed:t.danger,y={shadowColor:t.brand,shadowOffset:{width:0,height:n.xs},shadowRadius:n.sm,shadowOpacity:.08,elevation:n.xs};return r.StyleSheet.create({container:{flex:1,minHeight:g,backgroundColor:t.background},body:{flex:1},centered:{minHeight:g,flexGrow:1,alignItems:"center",justifyContent:"center",padding:n.xl,gap:n.lg},emptyGlyph:{width:m,height:m,borderRadius:i.lg,backgroundColor:t.brandSoft,borderWidth:p,borderColor:t.brandBorder},withheldGlyph:{width:m,height:m,borderRadius:i.sm,backgroundColor:t.badgeBgCaution,borderWidth:p,borderColor:t.cautionAccent},errorText:{...face(e,"regular"),fontSize:a.subtitle,lineHeight:h(a.subtitle,s.snug),color:b,textAlign:"center",marginBottom:n.md},askText:{...headingFace(e,"bold"),fontSize:a.subtitle,lineHeight:h(a.subtitle,s.snug),color:t.text.primary,textAlign:"center",marginBottom:n.md},primaryButton:{minHeight:f,minWidth:f,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xl,paddingVertical:n.md,borderRadius:i.pill,backgroundColor:t.primary,...y,...rn(o.primaryButton)},primaryLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:a.body,letterSpacing:d.tight,...nn(o.primaryButton)},linkButton:{minHeight:f,minWidth:f,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xl,paddingVertical:n.md,borderRadius:i.pill,backgroundColor:t.primary,...y,...rn(o.primaryButton)},linkLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:a.body,letterSpacing:d.tight,...nn(o.primaryButton)},disabledButton:{minHeight:f,minWidth:f,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xl,paddingVertical:n.md,borderRadius:i.pill,backgroundColor:t.surfaceSubtle,borderWidth:p,borderColor:t.brandBorder},disabledLabel:{...face(e,"bold"),color:t.text.muted,fontSize:a.body,letterSpacing:d.tight},list:{flex:1},listContent:{padding:n.lg,gap:n.md},timeline:{paddingVertical:n.md,paddingHorizontal:n.lg,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:p,borderColor:t.brandBorder,gap:n.xs,...y,...c},timelineTitle:{...headingFace(e,"bold"),fontSize:a.heading,lineHeight:h(a.heading,s.snug),color:t.text.primary,letterSpacing:d.tight,...u},timelineLabel:{...headingFace(e,"bold"),fontSize:a.subtitle,lineHeight:h(a.subtitle,s.snug),color:t.text.secondary,letterSpacing:d.tight,...u},callCard:{gap:n.sm,padding:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:p,borderColor:t.brandBorder,...c},timelineMeta:{...face(e,"regular"),fontSize:a.bodyTight,lineHeight:h(a.bodyTight,s.normal),color:t.text.muted,...u},recordBlock:{gap:n.sm,padding:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:p,borderColor:t.brandBorder,...y,...c},row:{flexDirection:"row",justifyContent:"space-between",gap:n.md,paddingVertical:n.xs,borderBottomWidth:p,borderBottomColor:t.borderHairlineGreen},rowLabel:{...face(e,"regular"),fontSize:a.body,lineHeight:h(a.body,s.normal),color:t.text.muted,flexShrink:1,...u},rowValue:{...face(e,"medium"),fontSize:a.body,lineHeight:h(a.body,s.normal),color:t.text.primary,textAlign:"right",flexShrink:1,...u},disclaimer:{...face(e,"regular"),fontSize:a.caption,lineHeight:h(a.caption,s.normal),color:t.text.muted,marginTop:n.md},uploadRow:{gap:n.xs,paddingVertical:n.xs,borderBottomWidth:p,borderBottomColor:t.borderHairlineGreen},uploadRowHead:{flexDirection:"row",justifyContent:"space-between",gap:n.md},progressTrack:{height:n.xs,borderRadius:i.pill,backgroundColor:t.brandSofter,overflow:"hidden",width:"100%"},progressFill:{height:"100%",backgroundColor:t.brand}})}var $h=/* @__PURE__ */Object.freeze({download:"Download",downloadA11y:e=>`Download, ${e}`,listA11y:"You added these records"});function formatBytes(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Bh(e){let t=e?.trim();return t?t.toUpperCase():null}function requestDocumentRows(e){/* @__PURE__ */
476
476
  return Object.freeze(e.map(e=>{let t=Bh(e.docFormat),r=e.receivedAt?bo(e.receivedAt):null,n=e.fileName??t??r??e.sourceDocId,i=[e.fileName!==null&&t!==null&&e.fileName.toUpperCase().endsWith(`.${t}`)||n===t?null:t,e.byteSize!==null?formatBytes(e.byteSize):null,n===r?null:r].filter(e=>!!e).join(" · ");/* @__PURE__ */
477
477
  return Object.freeze({key:e.sourceDocId,title:n,meta:i||null,downloadUrl:e.downloadUrl})}))}function useRequestDocuments(t,r={}){let n=r.enabled??true,i=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),[l,o]=e.useState(null),[a,s]=e.useState(n),[d,c]=e.useState(null),u=e.useRef(0),h=e.useRef(true),p=e.useCallback(async()=>{let e=u.current+=1;if(!n||userRef===null){o(null),c(null),s(false);return}s(true),c(null);let r=await i.listRequestDocuments(t);e!==u.current||!h.current||(r.ok?o(r.value):(o(null),c(r.error)),s(false))},[i,n,t,userRef]);e.useEffect(()=>(h.current=true,p(),()=>{h.current=false,u.current+=1}),[p]);let g=e.useMemo(()=>l===null?[]:requestDocumentRows(l),[l]),f=e.useCallback(()=>{p()},[p]),m=a?"loading":d!==null?"error":g.length===0?"empty":"populated";return e.useMemo(()=>({status:m,rows:g,error:d,refresh:f}),[m,g,d,f])}function Fh(e){if(!(r.Platform.OS!=="ios"||e===""))try{let t=r.AccessibilityInfo?.announceForAccessibility;typeof t=="function"&&t.call(r.AccessibilityInfo,e)}catch{}}function AnnounceLine({line:t}){return e.useEffect(()=>{Fh(t)},[t]),null}async function Mh(e){await r.Share.share({message:Fo.shareMessage(e),url:e})}async function qh(e){await r.Share.share(r.Platform.OS==="ios"?{url:e}:{message:e})}function RequestDocumentsList({requestId:t,open:i=true,onOpenUrl:l,testID:o="records-request-documents"}){let a=Yl(),s=Nh(),d=useEverfurTheme(),c=useRequestDocuments(t,{enabled:i}),u=useEverfurRecordsDepthClient(),[h,p]=e.useState(null),[g,f]=e.useState(null),m=e.useRef(true),b=e.useRef(null);e.useEffect(()=>(m.current=true,()=>{m.current=false}),[]);let y=async e=>{if(b.current!==null)return;b.current=e.key,p(e.key),f(null);let r=true;try{let n=await u.listRequestDocuments(t),i=n.ok?n.value.find(t=>t.sourceDocId===e.key)??null:null;r=i===null,i!==null&&m.current&&(l?await vr(l,i.downloadUrl,"request_document"):r=!await qh(i.downloadUrl).then(()=>!0,()=>!1))}catch{r=true}finally{b.current=null,m.current&&(p(null),r&&f(e.key))}};return i?c.status==="loading"?/* @__PURE__ */n.jsx(r.View,{style:s.loading,accessibilityState:{busy:true},testID:`${o}-loading`,children:/* @__PURE__ */n.jsx(SkeletonBlock,{width:"100%",height:d.space.lg+d.space.md})}):c.status==="error"&&Ve(c.error)?null:c.status==="error"?/* @__PURE__ */n.jsxs(r.View,{style:s.errorRow,testID:`${o}-error`,children:[
478
478
  /* @__PURE__ */n.jsx(Text,{style:a.muted,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:c.error?.displayMessage??""}),
@@ -498,8 +498,8 @@ return n.jsxs(r.View,{style:a.row,testID:`records-request-row-${e.id}`,children:
498
498
  /* @__PURE__ */n.jsxs(r.View,{style:o.cardText,children:[
499
499
  /* @__PURE__ */n.jsx(Text,{style:o.cardTitle,children:a.title}),
500
500
  /* @__PURE__ */n.jsx(Text,{style:o.cardSubtitle,children:a.subtitle})]}),
501
- /* @__PURE__ */n.jsx(Chevron,{})]})}function Uh(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?Kh(t):Ol(Kh(t),Gh(r)),[t,r])}function Gh(e){return{row:El(e,{paddingHorizontal:e.cardPad,paddingVertical:12,gap:8}),card:El(e,{flexDirection:"row",alignItems:"center",paddingHorizontal:e.cardPad,paddingVertical:12}),cardTitle:{...e.cardTitle,fontSize:16,lineHeight:20,letterSpacing:-.2},source:{color:e.look.ink}}}function Kh(e){let{color:t,space:n,radius:i,type:l}=e,o=(e,t)=>Math.round(e*t),a=n.xxl+n.xs/2;return r.StyleSheet.create({subtitle:{...face(e,"regular"),fontSize:l.size.caption,lineHeight:o(l.size.caption,l.lineHeight.normal),color:t.text.muted,paddingHorizontal:n.lg,paddingBottom:n.md},list:{paddingHorizontal:n.lg,paddingBottom:n.xl,gap:n.md},row:{borderRadius:i.lg,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md,gap:n.sm},rowInner:{flexDirection:"row",alignItems:"center",gap:n.md},bubble:{width:a,height:a,borderRadius:a/2},copy:{flex:1,gap:n.xs+1},source:{...face(e,"bold"),fontSize:l.size.body,lineHeight:o(l.size.body,l.lineHeight.snug),color:t.text.primary},meta:{...face(e,"regular"),fontSize:l.size.tiny,lineHeight:o(l.size.tiny,l.lineHeight.normal),color:t.text.muted},footer:{paddingHorizontal:n.lg,paddingTop:n.sm+n.xs/2,paddingBottom:n.lg,gap:n.sm+n.xs/2,borderTopWidth:1,borderTopColor:t.borderHairlineGreen},card:{flexDirection:"row",alignItems:"center",gap:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,paddingHorizontal:n.md+n.xs,paddingVertical:n.md,...rn(ln(e.slots),1)},cardBubble:{width:n.xl+n.xs/2,height:n.xl+n.xs/2,borderRadius:i.pill,borderWidth:2,borderColor:t.brandInk},cardBubbleProcessing:{borderColor:t.warningStrong,backgroundColor:t.badgeBgCaution},cardText:{flex:1,gap:2},cardTitle:{...headingFace(e,"bold"),fontSize:l.size.bodyTight,lineHeight:o(l.size.bodyTight,l.lineHeight.snug),color:t.brandInk,...nn(ln(e.slots))},cardSubtitle:{...face(e,"regular"),fontSize:l.size.caption,lineHeight:o(l.size.caption,l.lineHeight.normal),color:t.text.muted,...nn(ln(e.slots))}})}var Yh=(e,petRef)=>e.getRecordDepth(petRef),Xh=e=>!e.available;function EverfurRecordsDashboard(e){let{style:t,renderPending:r,...i}=wr(e,["onNavigate","onBack","onAsk"]),{alwaysShowWays:l,...o}=i,{userRef:userRef}=Xt();/* @__PURE__ */
502
- return n.jsx(Pl,{value:"legacy",children:/* @__PURE__ */n.jsx(CapabilityGate,{capability:"records",style:t,...r?{renderPending:r}:{},...uo(o.onBack,no),children:userRef===null?/* @__PURE__ */n.jsx(SessionRequiredScreen,{style:t,testID:"dashboard-session-required"}):/* @__PURE__ */n.jsx(DashboardBody,{...o,style:t})})})}function DashboardBody({petRef:petRef,petName:t,controller:i,consentVersion:l,consentScope:o,consentText:a,onNavigate:s,onBack:d,onAsk:c,style:u}){let h=Yl(),p=Jh(),g=useEverfurRecords({petRef:petRef,readUploadFeatures:true,...i?{controller:i}:{},...o?{consentScope:o}:{}}),{runtime:f}=Xt(),m=acceptsPhotos(g.uploadContentTypes)&&Hd(f.registry.services.camera),b=useRecordsMarkers(petRef),y=useRecordsDepthRead(petRef,Yh,Xh),[x,w]=e.useState(null),v=e.useCallback((e,t)=>w({marker:e,point:t}),[]);Au(l,a);let k=e.useMemo(()=>dc(l,g.consent),[l,g.consent]),j=e.useMemo(()=>Vh(g,l),[g,l]),S=useCapability("recordsClinic"),C=S.enabled||S.isPending,R=b.markers?.markers??[],T=R.length>0,_=g.record!==null&&!g.record.isEmpty&&!g.record.withheld,z=pickPetRecordsRequest(g.requests,petRef),I=g.requests.filter(e=>e.petRef===petRef),D=s?()=>s({name:"requests"}):void 0,H=g.status==="error"?cc(g,k):null,V=H!==null&&uc(H),P=deriveRecordsDashboardState({hasMarkers:T&&!V,requests:g.requests,petRef:petRef}),L=V?selectDashboardView({recordLoading:false,hasFullRecord:false,recordError:false,markersLoading:false,markersError:false,hasMarkers:false,requestsLoading:false,dashboardState:P,drivingRequest:z}):selectDashboardView({recordLoading:g.status==="loading",hasFullRecord:_,recordError:g.status==="error",markersLoading:b.status==="loading",markersError:b.status==="error",hasMarkers:T,requestsLoading:g.status==="loading",dashboardState:P,drivingRequest:z}),E=H?.kind==="consent_required"?/* @__PURE__ */n.jsx(r.View,{testID:"dashboard-consent",children:Hh(g,j,k,a)}):null,O=b.markers?.disclaimer??g.record?.disclaimer??"",A=()=>{g.refresh(),b.refresh(),y.refresh()},$=y.value!==null&&!y.value.withheld&&y.value.available?y.value:null,B=yn(t),F=c&&b.markers?.summary?()=>{let e=Nd(t,b.markers?.summary??{totalMarkers:0,inRangeCount:0,outOfRangeCount:0,unknownCount:0},petRef);c(e.prompt,e.entityRef)}:void 0,M=c?e=>{let r=qd(t,{canonicalName:e.name,markerId:e.markerId,latestValueText:e.latest?zo(e.latest.value,e.unit,e.latest.qualitativeResult):null,statusText:e.latest?vo(e.latest.status).label:null,trajectoryText:ko(e.trajectory,e.points.length),meaningText:e.meaning});c(r.prompt,r.entityRef)}:void 0,q=c&&x?()=>{let{marker:e,point:r}=x,n=Wd(t,{canonicalName:e.name,valueText:zo(r.value,e.unit,r.qualitativeResult),collectedAt:fo(r.at),sourceClinic:r.sourceClinic,referenceText:r.refLow!==null||r.refHigh!==null?Ed(r,e.unit):null,flagged:r.status==="above"?"above":r.status==="below"?"below":null,reviewed:r.reviewed,entityId:r.docId??e.markerId});w(null),c(n.prompt,n.entityRef)}:void 0,N=/* @__PURE__ */n.jsxs(n.Fragment,{children:[b.markers?.summary?/* @__PURE__ */n.jsx(r.View,{style:h.inset,children:/* @__PURE__ */n.jsx(MarkerSummaryCard,{summary:b.markers.summary,onAsk:F,testID:"dashboard-marker-summary"})}):null,
501
+ /* @__PURE__ */n.jsx(Chevron,{})]})}function Uh(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?Kh(t):El(Kh(t),Gh(r)),[t,r])}function Gh(e){return{row:Ol(e,{paddingHorizontal:e.cardPad,paddingVertical:12,gap:8}),card:Ol(e,{flexDirection:"row",alignItems:"center",paddingHorizontal:e.cardPad,paddingVertical:12}),cardTitle:{...e.cardTitle,fontSize:16,lineHeight:20,letterSpacing:-.2},source:{color:e.look.ink}}}function Kh(e){let{color:t,space:n,radius:i,type:l}=e,o=(e,t)=>Math.round(e*t),a=n.xxl+n.xs/2;return r.StyleSheet.create({subtitle:{...face(e,"regular"),fontSize:l.size.caption,lineHeight:o(l.size.caption,l.lineHeight.normal),color:t.text.muted,paddingHorizontal:n.lg,paddingBottom:n.md},list:{paddingHorizontal:n.lg,paddingBottom:n.xl,gap:n.md},row:{borderRadius:i.lg,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:n.md+n.xs/2,paddingVertical:n.md,gap:n.sm},rowInner:{flexDirection:"row",alignItems:"center",gap:n.md},bubble:{width:a,height:a,borderRadius:a/2},copy:{flex:1,gap:n.xs+1},source:{...face(e,"bold"),fontSize:l.size.body,lineHeight:o(l.size.body,l.lineHeight.snug),color:t.text.primary},meta:{...face(e,"regular"),fontSize:l.size.tiny,lineHeight:o(l.size.tiny,l.lineHeight.normal),color:t.text.muted},footer:{paddingHorizontal:n.lg,paddingTop:n.sm+n.xs/2,paddingBottom:n.lg,gap:n.sm+n.xs/2,borderTopWidth:1,borderTopColor:t.borderHairlineGreen},card:{flexDirection:"row",alignItems:"center",gap:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,paddingHorizontal:n.md+n.xs,paddingVertical:n.md,...rn(ln(e.slots),1)},cardBubble:{width:n.xl+n.xs/2,height:n.xl+n.xs/2,borderRadius:i.pill,borderWidth:2,borderColor:t.brandInk},cardBubbleProcessing:{borderColor:t.warningStrong,backgroundColor:t.badgeBgCaution},cardText:{flex:1,gap:2},cardTitle:{...headingFace(e,"bold"),fontSize:l.size.bodyTight,lineHeight:o(l.size.bodyTight,l.lineHeight.snug),color:t.brandInk,...nn(ln(e.slots))},cardSubtitle:{...face(e,"regular"),fontSize:l.size.caption,lineHeight:o(l.size.caption,l.lineHeight.normal),color:t.text.muted,...nn(ln(e.slots))}})}var Yh=(e,petRef)=>e.getRecordDepth(petRef),Xh=e=>!e.available;function EverfurRecordsDashboard(e){let{style:t,renderPending:r,...i}=wr(e,["onNavigate","onBack","onAsk"]),{alwaysShowWays:l,...o}=i,{userRef:userRef}=Xt();/* @__PURE__ */
502
+ return n.jsx(Pl,{value:"legacy",children:/* @__PURE__ */n.jsx(CapabilityGate,{capability:"records",style:t,...r?{renderPending:r}:{},...uo(o.onBack,no),children:userRef===null?/* @__PURE__ */n.jsx(SessionRequiredScreen,{style:t,testID:"dashboard-session-required"}):/* @__PURE__ */n.jsx(DashboardBody,{...o,style:t})})})}function DashboardBody({petRef:petRef,petName:t,controller:i,consentVersion:l,consentScope:o,consentText:a,onNavigate:s,onBack:d,onAsk:c,style:u}){let h=Yl(),p=Jh(),g=useEverfurRecords({petRef:petRef,readUploadFeatures:true,...i?{controller:i}:{},...o?{consentScope:o}:{}}),{runtime:f}=Xt(),m=acceptsPhotos(g.uploadContentTypes)&&Hd(f.registry.services.camera),b=useRecordsMarkers(petRef),y=useRecordsDepthRead(petRef,Yh,Xh),[x,w]=e.useState(null),v=e.useCallback((e,t)=>w({marker:e,point:t}),[]);Au(l,a);let k=e.useMemo(()=>dc(l,g.consent),[l,g.consent]),j=e.useMemo(()=>Vh(g,l),[g,l]),S=useCapability("recordsClinic"),C=S.enabled||S.isPending,R=b.markers?.markers??[],T=R.length>0,_=g.record!==null&&!g.record.isEmpty&&!g.record.withheld,z=pickPetRecordsRequest(g.requests,petRef),I=g.requests.filter(e=>e.petRef===petRef),D=s?()=>s({name:"requests"}):void 0,H=g.status==="error"?cc(g,k):null,V=H!==null&&uc(H),P=deriveRecordsDashboardState({hasMarkers:T&&!V,requests:g.requests,petRef:petRef}),L=V?selectDashboardView({recordLoading:false,hasFullRecord:false,recordError:false,markersLoading:false,markersError:false,hasMarkers:false,requestsLoading:false,dashboardState:P,drivingRequest:z}):selectDashboardView({recordLoading:g.status==="loading",hasFullRecord:_,recordError:g.status==="error",markersLoading:b.status==="loading",markersError:b.status==="error",hasMarkers:T,requestsLoading:g.status==="loading",dashboardState:P,drivingRequest:z}),O=H?.kind==="consent_required"?/* @__PURE__ */n.jsx(r.View,{testID:"dashboard-consent",children:Hh(g,j,k,a)}):null,E=b.markers?.disclaimer??g.record?.disclaimer??"",A=()=>{g.refresh(),b.refresh(),y.refresh()},$=y.value!==null&&!y.value.withheld&&y.value.available?y.value:null,B=yn(t),F=c&&b.markers?.summary?()=>{let e=Nd(t,b.markers?.summary??{totalMarkers:0,inRangeCount:0,outOfRangeCount:0,unknownCount:0},petRef);c(e.prompt,e.entityRef)}:void 0,M=c?e=>{let r=qd(t,{canonicalName:e.name,markerId:e.markerId,latestValueText:e.latest?zo(e.latest.value,e.unit,e.latest.qualitativeResult):null,statusText:e.latest?vo(e.latest.status).label:null,trajectoryText:ko(e.trajectory,e.points.length),meaningText:e.meaning});c(r.prompt,r.entityRef)}:void 0,q=c&&x?()=>{let{marker:e,point:r}=x,n=Wd(t,{canonicalName:e.name,valueText:zo(r.value,e.unit,r.qualitativeResult),collectedAt:fo(r.at),sourceClinic:r.sourceClinic,referenceText:r.refLow!==null||r.refHigh!==null?Od(r,e.unit):null,flagged:r.status==="above"?"above":r.status==="below"?"below":null,reviewed:r.reviewed,entityId:r.docId??e.markerId});w(null),c(n.prompt,n.entityRef)}:void 0,N=/* @__PURE__ */n.jsxs(n.Fragment,{children:[b.markers?.summary?/* @__PURE__ */n.jsx(r.View,{style:h.inset,children:/* @__PURE__ */n.jsx(MarkerSummaryCard,{summary:b.markers.summary,onAsk:F,testID:"dashboard-marker-summary"})}):null,
503
503
  /* @__PURE__ */n.jsx(Text,{style:h.lead,children:xn.lead(t)}),
504
504
  /* @__PURE__ */n.jsx(MarkerTrendCarousel,{markers:R,featuredMarkerId:b.markers?.featuredMarkerId??null,onPointPress:v,onAsk:M})]}),W=e=>s?/* @__PURE__ */n.jsxs(r.View,{style:[h.inset,p.actions],children:[e?/* @__PURE__ */n.jsx(ActionRow,{glyph:"record",label:xn.viewFullRecord,onPress:()=>s({name:"record"}),testID:"dashboard-full-record-action"}):null,
505
505
  /* @__PURE__ */n.jsx(ActionRow,{glyph:"timeline",label:xn.viewTimeline,onPress:()=>s({name:"timeline"}),testID:"dashboard-timeline-action"}),
@@ -508,8 +508,8 @@ return n.jsx(Pl,{value:"legacy",children:/* @__PURE__ */n.jsx(CapabilityGate,{ca
508
508
  /* @__PURE__ */n.jsx(r.View,{style:h.inset,children:g.record?/* @__PURE__ */n.jsx(RecordSections,{record:g.record,depth:$,petName:t,showLabs:!T,onNavigate:s,onAsk:c}):null}),
509
509
  /* @__PURE__ */n.jsx(r.View,{style:h.inset,children:/* @__PURE__ */n.jsx(RecordsRequestsStatusCard,{requests:I,petName:t,activeOnly:true,onOpen:D})}),U(),W(true)]});break;case"error":G=/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(b.error??g.error),message:(b.error??g.error)?.displayMessage,onAction:(b.error??g.error)?.retryable?A:void 0,testID:"dashboard-error"});break;case"in_progress":G=/* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:h.content,testID:"dashboard-in-progress",children:[z?/* @__PURE__ */n.jsx(InProgressCard,{request:z,petName:B,onOpen:s?()=>s({name:"request",requestId:z.id}):void 0,onAsk:c?()=>{let e=Ud(t,{clinicName:z.clinicName??null,statusLabel:selectPrimaryLabel(z),status:z.status,heldItemCount:z.heldItemCount},z.id);c(e.prompt,e.entityRef)}:void 0}):null,
510
510
  /* @__PURE__ */n.jsx(RecordsRequestsStatusCard,{requests:I,petName:t,onOpen:D}),s?/* @__PURE__ */n.jsxs(r.View,{style:p.ways,testID:"dashboard-ways",children:[C?/* @__PURE__ */n.jsx(WayCard,{title:Sn.anotherClinic,sub:Sn.anotherClinicSub,onPress:()=>s({name:"clinicPicker"}),testID:"dashboard-way-clinic"}):null,
511
- /* @__PURE__ */n.jsx(WayCard,{title:Cn.uploadDocument,...m?{sub:Sn.uploadDocumentPhotoSub}:{},dashed:true,onPress:()=>s({name:"upload"}),testID:"dashboard-way-upload"})]}):null,E,
512
- /* @__PURE__ */n.jsx(DisclaimerBand,{disclaimer:O})]});break;case"none":G=/* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:h.content,testID:"dashboard-request-prompt",children:[
511
+ /* @__PURE__ */n.jsx(WayCard,{title:Cn.uploadDocument,...m?{sub:Sn.uploadDocumentPhotoSub}:{},dashed:true,onPress:()=>s({name:"upload"}),testID:"dashboard-way-upload"})]}):null,O,
512
+ /* @__PURE__ */n.jsx(DisclaimerBand,{disclaimer:E})]});break;case"none":G=/* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:h.content,testID:"dashboard-request-prompt",children:[
513
513
  /* @__PURE__ */n.jsxs(r.View,{style:p.promptCard,children:[
514
514
  /* @__PURE__ */n.jsxs(r.View,{style:p.promptHeader,children:[
515
515
  /* @__PURE__ */n.jsx(r.View,{style:p.promptGlyph,accessibilityElementsHidden:true,importantForAccessibility:"no"}),
@@ -517,10 +517,10 @@ return n.jsx(Pl,{value:"legacy",children:/* @__PURE__ */n.jsx(CapabilityGate,{ca
517
517
  /* @__PURE__ */n.jsx(Text,{style:p.promptBody,children:Cn.body}),s?/* @__PURE__ */n.jsxs(n.Fragment,{children:[
518
518
  /* @__PURE__ */n.jsx(Pill,{label:Cn.requestFromClinic,onPress:()=>s({name:"clinicPicker"}),style:p.promptCta,testID:"dashboard-request-prompt-clinic"}),
519
519
  /* @__PURE__ */n.jsx(Pill,{label:Cn.uploadDocument,kind:"outline",onPress:()=>s({name:"upload"}),style:p.promptCtaSecondary,testID:"dashboard-request-prompt-upload"})]}):null]}),
520
- /* @__PURE__ */n.jsx(RecordsRequestsStatusCard,{requests:I,petName:t,onOpen:D}),E,
521
- /* @__PURE__ */n.jsx(DisclaimerBand,{disclaimer:O})]});break;case"labs_only":G=/* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:h.contentTight,testID:"dashboard-labs-only",children:[N,
520
+ /* @__PURE__ */n.jsx(RecordsRequestsStatusCard,{requests:I,petName:t,onOpen:D}),O,
521
+ /* @__PURE__ */n.jsx(DisclaimerBand,{disclaimer:E})]});break;case"labs_only":G=/* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:h.contentTight,testID:"dashboard-labs-only",children:[N,
522
522
  /* @__PURE__ */n.jsx(r.View,{style:h.inset,children:/* @__PURE__ */n.jsx(RecordsRequestsStatusCard,{requests:I,petName:t,activeOnly:true,onOpen:D})}),U(),
523
- /* @__PURE__ */n.jsx(r.View,{style:h.inset,children:/* @__PURE__ */n.jsx(DisclaimerBand,{disclaimer:O})}),W(false)]});break;default:G=assertNever(L)}/* @__PURE__ */
523
+ /* @__PURE__ */n.jsx(r.View,{style:h.inset,children:/* @__PURE__ */n.jsx(DisclaimerBand,{disclaimer:E})}),W(false)]});break;default:G=assertNever(L)}/* @__PURE__ */
524
524
  return n.jsx(r.View,{style:[h.root,u],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
525
525
  /* @__PURE__ */n.jsx(ScreenHeader,{title:xn.titleNative(t),onBack:d,testID:"dashboard-header",right:s?/* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>s({name:"timeline"}),accessibilityRole:"button",accessibilityLabel:xn.openTimeline,hitSlop:12,style:p.headerButton,testID:"dashboard-timeline-link",children:/* @__PURE__ */n.jsx(ListGlyph2,{})}):void 0}),
526
526
  /* @__PURE__ */n.jsx(r.View,{style:h.body,children:G}),
@@ -557,7 +557,7 @@ return n.jsxs(r.ScrollView,{style:t.list,contentContainerStyle:t.timelineContent
557
557
  return n.jsxs(r.ScrollView,{style:t.list,contentContainerStyle:t.listContent,accessibilityLabel:fn.records,children:[e.document?.receivedAt?/* @__PURE__ */n.jsx(Text,{style:t.rowDetail,children:bo(e.document.receivedAt)}):null,
558
558
  /* @__PURE__ */n.jsx(r.View,{style:t.card,children:e.contributions.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:t.row,accessible:true,accessibilityRole:"text",children:[
559
559
  /* @__PURE__ */n.jsx(Text,{style:t.rowTitle,children:e.label}),
560
- /* @__PURE__ */n.jsx(Text,{style:t.rowValue,children:ho(e.value,e.unit)}),e.observedAt?/* @__PURE__ */n.jsx(Text,{style:t.rowDetail,children:fo(e.observedAt)}):null]},e.key))})]})}function ap(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?dp(t):Ol(dp(t),sp(r)),[t,r])}function sp(e){return{container:{backgroundColor:e.ground},card:El(e,{padding:e.cardPad,gap:8}),heading:e.cardTitle,primaryButton:{...e.button,...e.buttonInk},primaryLabel:e.buttonInkLabel}}function dp(e){let{color:t,space:n,radius:i,type:l,slots:o}=e,{size:a,lineHeight:s}=l,d=(e,t)=>Math.round(e*t),c=r.StyleSheet.hairlineWidth,u=n.xxl*3+n.xl,h=n.xxl+n.md,p=e.brightness==="dark"?t.errorRed:t.danger,g=nn(ln(o)),f=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:d(t,r),color:n}),m=(e,t,r,n="regular")=>({...f(e,t,r,n),...g});return r.StyleSheet.create({container:{flex:1,minHeight:u,backgroundColor:t.background},body:{flex:1},centered:{minHeight:u,flexGrow:1,alignItems:"center",justifyContent:"center",padding:n.xl,gap:n.lg},emptyGlyph:{width:n.xxl+n.sm,height:n.xxl+n.sm,borderRadius:i.lg,backgroundColor:t.brandSoft,borderWidth:c,borderColor:t.brandBorder},errorText:{...f(a.subtitle,s.snug,p),textAlign:"center",marginBottom:n.md},primaryButton:{minHeight:h,minWidth:h,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xl,paddingVertical:n.md,borderRadius:i.pill,backgroundColor:t.primary,...rn(o.primaryButton)},primaryLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:a.body,...nn(o.primaryButton)},list:{flex:1},listContent:{padding:n.lg,gap:n.md},section:{gap:n.sm},heading:{...f(a.heading,s.snug,t.text.primary,"bold"),...headingFace(e,"bold")},card:{gap:n.sm,padding:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:c,borderColor:t.brandBorder,...rn(ln(o),c)},row:{gap:n.xs,paddingVertical:n.xs,borderBottomWidth:c,borderBottomColor:t.borderHairlineGreen},topLine:{flexDirection:"row",justifyContent:"space-between",gap:n.md},kindLabel:{...m(a.caption,s.normal,t.text.muted,"medium")},date:m(a.caption,s.normal,t.text.muted),rowTitle:{...m(a.body,s.normal,t.text.primary,"bold"),...headingFace(e,"bold")},rowValue:{...m(a.body,s.normal,t.text.primary,"medium")},rowDetail:m(a.bodyTight,s.normal,t.text.muted),rowMuted:{...m(a.bodyTight,s.normal,t.text.muted),opacity:.7},chip:{...f(a.caption,s.normal,t.text.primary),alignSelf:"flex-start",paddingHorizontal:n.sm,paddingVertical:n.xs,borderRadius:i.pill},chipNeutral:{backgroundColor:t.badgeBgNeutral},chipCaution:{backgroundColor:t.badgeBgCaution},chipCritical:{backgroundColor:t.badgeBgCritical},disclaimer:{...f(a.caption,s.normal,t.text.muted),marginTop:n.md},timelineContent:{paddingBottom:n.xxl},timelineBand:{flexDirection:"row",gap:n.sm,borderRadius:i.md-n.xs/2,padding:n.md,backgroundColor:t.brandSoft,marginHorizontal:n.lg,marginTop:n.xs,marginBottom:n.md},timelineBandText:{flex:1,...f(a.caption,s.normal,t.text.secondary)},timelineSeparator:{height:c,backgroundColor:t.brandBorder,marginLeft:ia},timelineRow:{flexDirection:"row",gap:n.md,paddingHorizontal:n.lg,paddingVertical:n.md+n.xs/2},timelineBubble:{width:n.xxl+n.xs/2,height:n.xxl+n.xs/2,borderRadius:i.pill,backgroundColor:t.brandSoft,borderWidth:c,borderColor:t.brandBorder},timelineBody:{flex:1,gap:n.xs-1},timelineKind:{...face(e,"mono"),fontSize:a.micro,lineHeight:a.bodyTight,letterSpacing:l.letterSpacing.eyebrow/3,textTransform:"uppercase",color:t.text.secondary},timelineTitle:{...f(a.body,s.normal,t.text.primary,"medium")}})}function useRecordShares(petRef,t={}){let r=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),n=t.now??Date.now,[i,l]=e.useState(null),[o,a]=e.useState(true),[s,d]=e.useState(null),[c,u]=e.useState(null),h=c===true,[p,g]=e.useState({}),[f,m]=e.useState(false),[b,y]=e.useState(null),[x,w]=e.useState(false),[v,k]=e.useState(false),[j,S]=e.useState(false),[C,R]=e.useState(null),T=C!==null&&C.client===r?C.value:X,_=T.shareAudiences,z=rr(petRef),I=e.useRef(0),D=e.useRef(true),H=e.useCallback(async()=>{let e=I.current+=1;if(a(true),d(null),userRef===null){l(null),a(false);return}let t=await r.listShares(petRef);e!==I.current||!D.current||(t.ok?(l(t.value),u(true)):wd(t.error)?(l(null),u(false)):(l(null),d(t.error),cp(t)&&u(true)),a(false))},[r,petRef,userRef]);e.useEffect(()=>(D.current=true,H(),()=>{D.current=false,I.current+=1}),[H]),e.useEffect(()=>{if(userRef===null||r.readFeatures===void 0)return;let e=true;return r.readFeatures().then(t=>{e&&R({client:r,value:t})},()=>{}),()=>{e=false}},[r,userRef]);let V=e.useRef(z);e.useEffect(()=>{V.current!==z&&(V.current=z,g({}),k(true),H())},[z,H]);let P=e.useCallback(async e=>{m(true);let t=await(e!==void 0&&_.some(t=>t.audience===e)?r.createShare(petRef,{audience:e}):r.createShare(petRef));return D.current&&(m(false),t.ok?(g(e=>({...e,[t.value.shareId]:t.value.shareUrl})),H()):wd(t.error)?u(false):Ve(t.error)&&k(true)),t},[r,petRef,H,_]),L=e.useCallback(async e=>{S(true);let t=await r.emailShare(petRef,e);return D.current&&(S(false),t.ok?H():wd(t.error)?u(false):Ve(t.error)?k(true):t.error.httpStatus===502&&H()),t},[r,petRef,H]),E=e.useCallback(async e=>{y(e);let t=await r.revokeShare(petRef,e);return D.current&&(y(null),H()),t},[r,petRef,H]),O=e.useCallback(async()=>{w(true);let e=await r.getPdfLink(petRef);return D.current&&(w(false),!e.ok&&Ve(e.error)&&k(true)),e},[r,petRef]),A=e.useCallback(()=>{k(false),H()},[H]),$=e.useMemo(()=>Go(i??[],p,n()),[i,p,n]),B=o?"loading":s!==null?"error":$.length===0?"empty":"populated",F=T.features;return e.useMemo(()=>({status:B,rows:$,available:h,consentRequired:v,error:s,creating:f,revokingId:b,preparingPdf:x,shareAudiences:_,features:F,sending:j,createLink:P,sendEmail:L,revoke:E,pdfLink:O,refresh:A}),[B,$,h,v,s,f,b,x,_,F,j,P,L,E,O,A])}function cp(e){return e.ok||e.error.httpStatus!==void 0&&e.error.httpStatus!==404}function up(e){return e.available||e.status!=="empty"}function hp(petRef){let t=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),r=e.useMemo(()=>({}),[t,petRef,userRef]),[n,i]=e.useState({scope:r,lit:null});e.useEffect(()=>{if(userRef===null)return;let e=true;return t.listShares(petRef).then(t=>{e&&(!t.ok&&wd(t.error)?i({scope:r,lit:false}):cp(t)&&i({scope:r,lit:true}))},()=>{}),()=>{e=false}},[t,petRef,userRef,r]);let l=n.scope===r?n.lit:null;return e.useMemo(()=>({lit:l}),[l])}function useRecordPdfLink(petRef){let t=useEverfurRecordsDepthClient(),r=hp(petRef).lit===true,[n,i]=e.useState(false),[l,o]=e.useState(null),a=e.useRef(true);e.useEffect(()=>(a.current=true,()=>{a.current=false}),[]);let s=e.useCallback(async()=>{i(true),o(null);let e=await t.getPdfLink(petRef);return a.current&&(i(false),e.ok||o(e.error)),e},[t,petRef]);return e.useMemo(()=>({preparing:n,available:r,error:l,pdfLink:s}),[n,r,l,s])}var pp=Vo.document,gp=/* @__PURE__ */Object.freeze(["medication","vaccination","problem","allergy","procedure","body_weight","vital"]),fp=(e,petRef)=>e.getRecordDepth(petRef),mp=e=>!e.available;function EverfurRecordDocument(e){let{style:t,renderPending:r,...i}=wr(e,["onBack"]),{userRef:userRef}=Xt();/* @__PURE__ */
560
+ /* @__PURE__ */n.jsx(Text,{style:t.rowValue,children:ho(e.value,e.unit)}),e.observedAt?/* @__PURE__ */n.jsx(Text,{style:t.rowDetail,children:fo(e.observedAt)}):null]},e.key))})]})}function ap(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?dp(t):El(dp(t),sp(r)),[t,r])}function sp(e){return{container:{backgroundColor:e.ground},card:Ol(e,{padding:e.cardPad,gap:8}),heading:e.cardTitle,primaryButton:{...e.button,...e.buttonInk},primaryLabel:e.buttonInkLabel}}function dp(e){let{color:t,space:n,radius:i,type:l,slots:o}=e,{size:a,lineHeight:s}=l,d=(e,t)=>Math.round(e*t),c=r.StyleSheet.hairlineWidth,u=n.xxl*3+n.xl,h=n.xxl+n.md,p=e.brightness==="dark"?t.errorRed:t.danger,g=nn(ln(o)),f=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:d(t,r),color:n}),m=(e,t,r,n="regular")=>({...f(e,t,r,n),...g});return r.StyleSheet.create({container:{flex:1,minHeight:u,backgroundColor:t.background},body:{flex:1},centered:{minHeight:u,flexGrow:1,alignItems:"center",justifyContent:"center",padding:n.xl,gap:n.lg},emptyGlyph:{width:n.xxl+n.sm,height:n.xxl+n.sm,borderRadius:i.lg,backgroundColor:t.brandSoft,borderWidth:c,borderColor:t.brandBorder},errorText:{...f(a.subtitle,s.snug,p),textAlign:"center",marginBottom:n.md},primaryButton:{minHeight:h,minWidth:h,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xl,paddingVertical:n.md,borderRadius:i.pill,backgroundColor:t.primary,...rn(o.primaryButton)},primaryLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:a.body,...nn(o.primaryButton)},list:{flex:1},listContent:{padding:n.lg,gap:n.md},section:{gap:n.sm},heading:{...f(a.heading,s.snug,t.text.primary,"bold"),...headingFace(e,"bold")},card:{gap:n.sm,padding:n.md,borderRadius:i.md,backgroundColor:t.surfaceCream,borderWidth:c,borderColor:t.brandBorder,...rn(ln(o),c)},row:{gap:n.xs,paddingVertical:n.xs,borderBottomWidth:c,borderBottomColor:t.borderHairlineGreen},topLine:{flexDirection:"row",justifyContent:"space-between",gap:n.md},kindLabel:{...m(a.caption,s.normal,t.text.muted,"medium")},date:m(a.caption,s.normal,t.text.muted),rowTitle:{...m(a.body,s.normal,t.text.primary,"bold"),...headingFace(e,"bold")},rowValue:{...m(a.body,s.normal,t.text.primary,"medium")},rowDetail:m(a.bodyTight,s.normal,t.text.muted),rowMuted:{...m(a.bodyTight,s.normal,t.text.muted),opacity:.7},chip:{...f(a.caption,s.normal,t.text.primary),alignSelf:"flex-start",paddingHorizontal:n.sm,paddingVertical:n.xs,borderRadius:i.pill},chipNeutral:{backgroundColor:t.badgeBgNeutral},chipCaution:{backgroundColor:t.badgeBgCaution},chipCritical:{backgroundColor:t.badgeBgCritical},disclaimer:{...f(a.caption,s.normal,t.text.muted),marginTop:n.md},timelineContent:{paddingBottom:n.xxl},timelineBand:{flexDirection:"row",gap:n.sm,borderRadius:i.md-n.xs/2,padding:n.md,backgroundColor:t.brandSoft,marginHorizontal:n.lg,marginTop:n.xs,marginBottom:n.md},timelineBandText:{flex:1,...f(a.caption,s.normal,t.text.secondary)},timelineSeparator:{height:c,backgroundColor:t.brandBorder,marginLeft:ia},timelineRow:{flexDirection:"row",gap:n.md,paddingHorizontal:n.lg,paddingVertical:n.md+n.xs/2},timelineBubble:{width:n.xxl+n.xs/2,height:n.xxl+n.xs/2,borderRadius:i.pill,backgroundColor:t.brandSoft,borderWidth:c,borderColor:t.brandBorder},timelineBody:{flex:1,gap:n.xs-1},timelineKind:{...face(e,"mono"),fontSize:a.micro,lineHeight:a.bodyTight,letterSpacing:l.letterSpacing.eyebrow/3,textTransform:"uppercase",color:t.text.secondary},timelineTitle:{...f(a.body,s.normal,t.text.primary,"medium")}})}function useRecordShares(petRef,t={}){let r=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),n=t.now??Date.now,[i,l]=e.useState(null),[o,a]=e.useState(true),[s,d]=e.useState(null),[c,u]=e.useState(null),h=c===true,[p,g]=e.useState({}),[f,m]=e.useState(false),[b,y]=e.useState(null),[x,w]=e.useState(false),[v,k]=e.useState(false),[j,S]=e.useState(false),[C,R]=e.useState(null),T=C!==null&&C.client===r?C.value:X,_=T.shareAudiences,z=rr(petRef),I=e.useRef(0),D=e.useRef(true),H=e.useCallback(async()=>{let e=I.current+=1;if(a(true),d(null),userRef===null){l(null),a(false);return}let t=await r.listShares(petRef);e!==I.current||!D.current||(t.ok?(l(t.value),u(true)):wd(t.error)?(l(null),u(false)):(l(null),d(t.error),cp(t)&&u(true)),a(false))},[r,petRef,userRef]);e.useEffect(()=>(D.current=true,H(),()=>{D.current=false,I.current+=1}),[H]),e.useEffect(()=>{if(userRef===null||r.readFeatures===void 0)return;let e=true;return r.readFeatures().then(t=>{e&&R({client:r,value:t})},()=>{}),()=>{e=false}},[r,userRef]);let V=e.useRef(z);e.useEffect(()=>{V.current!==z&&(V.current=z,g({}),k(true),H())},[z,H]);let P=e.useCallback(async e=>{m(true);let t=await(e!==void 0&&_.some(t=>t.audience===e)?r.createShare(petRef,{audience:e}):r.createShare(petRef));return D.current&&(m(false),t.ok?(g(e=>({...e,[t.value.shareId]:t.value.shareUrl})),H()):wd(t.error)?u(false):Ve(t.error)&&k(true)),t},[r,petRef,H,_]),L=e.useCallback(async e=>{S(true);let t=await r.emailShare(petRef,e);return D.current&&(S(false),t.ok?H():wd(t.error)?u(false):Ve(t.error)?k(true):t.error.httpStatus===502&&H()),t},[r,petRef,H]),O=e.useCallback(async e=>{y(e);let t=await r.revokeShare(petRef,e);return D.current&&(y(null),H()),t},[r,petRef,H]),E=e.useCallback(async()=>{w(true);let e=await r.getPdfLink(petRef);return D.current&&(w(false),!e.ok&&Ve(e.error)&&k(true)),e},[r,petRef]),A=e.useCallback(()=>{k(false),H()},[H]),$=e.useMemo(()=>Go(i??[],p,n()),[i,p,n]),B=o?"loading":s!==null?"error":$.length===0?"empty":"populated",F=T.features;return e.useMemo(()=>({status:B,rows:$,available:h,consentRequired:v,error:s,creating:f,revokingId:b,preparingPdf:x,shareAudiences:_,features:F,sending:j,createLink:P,sendEmail:L,revoke:O,pdfLink:E,refresh:A}),[B,$,h,v,s,f,b,x,_,F,j,P,L,O,E,A])}function cp(e){return e.ok||e.error.httpStatus!==void 0&&e.error.httpStatus!==404}function up(e){return e.available||e.status!=="empty"}function hp(petRef){let t=useEverfurRecordsDepthClient(),{userRef:userRef}=Xt(),r=e.useMemo(()=>({}),[t,petRef,userRef]),[n,i]=e.useState({scope:r,lit:null});e.useEffect(()=>{if(userRef===null)return;let e=true;return t.listShares(petRef).then(t=>{e&&(!t.ok&&wd(t.error)?i({scope:r,lit:false}):cp(t)&&i({scope:r,lit:true}))},()=>{}),()=>{e=false}},[t,petRef,userRef,r]);let l=n.scope===r?n.lit:null;return e.useMemo(()=>({lit:l}),[l])}function useRecordPdfLink(petRef){let t=useEverfurRecordsDepthClient(),r=hp(petRef).lit===true,[n,i]=e.useState(false),[l,o]=e.useState(null),a=e.useRef(true);e.useEffect(()=>(a.current=true,()=>{a.current=false}),[]);let s=e.useCallback(async()=>{i(true),o(null);let e=await t.getPdfLink(petRef);return a.current&&(i(false),e.ok||o(e.error)),e},[t,petRef]);return e.useMemo(()=>({preparing:n,available:r,error:l,pdfLink:s}),[n,r,l,s])}var pp=Vo.document,gp=/* @__PURE__ */Object.freeze(["medication","vaccination","problem","allergy","procedure","body_weight","vital"]),fp=(e,petRef)=>e.getRecordDepth(petRef),mp=e=>!e.available;function EverfurRecordDocument(e){let{style:t,renderPending:r,...i}=wr(e,["onBack"]),{userRef:userRef}=Xt();/* @__PURE__ */
561
561
  return n.jsx(CapabilityGate,{capability:"records",style:t,...r?{renderPending:r}:{},...uo(i.onBack,no),children:userRef===null?/* @__PURE__ */n.jsx(SessionRequiredScreen,{style:t,testID:"records-document-session-required"}):/* @__PURE__ */n.jsx(DocumentBody,{...i,style:t})})}function bp(e,t){return e.identity.length===0&&e.entities.length===0&&e.forwardLooking.length===0&&(t===null||t.labResults.length===0&&t.physicalExams.length===0&&t.clinicianNotes.length===0)}function DocumentBody({petRef:petRef,petName:t,controller:i,consentVersion:l,consentScope:o,consentText:a,onBack:s,onOpenUrl:d,style:c}){let u=Yl(),h=yp(),p=useEverfurTheme(),g=useEverfurRecords({petRef:petRef,...i?{controller:i}:{},...o?{consentScope:o}:{}}),f=useRecordsDepthRead(petRef,fp,mp),m=useRecordPdfLink(petRef);Au(l,a);let b=e.useMemo(()=>dc(l,g.consent),[l,g.consent]),y=e.useMemo(()=>Vh(g,l),[g,l]),x=f.value!==null&&!f.value.withheld&&f.value.available?f.value:null,w=g.record,[v,k]=e.useState(false),j=()=>{k(false),m.pdfLink().then(e=>{if(!e.ok)return;vr(d??(e=>qh(e)),e.value.downloadUrl,"record_pdf").then(e=>{!e.ok&&!d&&k(true)})})},S,C=false;if(g.status==="loading"||f.status==="loading"&&w!==null)S=/* @__PURE__ */n.jsx(DocumentSkeleton,{testID:"record-document-loading"});else if(g.status==="error"){let e=cc(g,b);S=e.kind==="error"||e.kind==="pet_not_found"?/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(e.error),message:e.error.displayMessage,onAction:e.error.retryable?()=>{g.refresh(),f.refresh()}:void 0,testID:"record-document-error"}):Hh(g,y,b,a)}else w===null||bp(w,x)?S=/* @__PURE__ */n.jsx(r.View,{style:h.centered,testID:"record-document-empty",children:/* @__PURE__ */n.jsx(Text,{style:h.emptyText,children:pp.empty})}):(C=true,S=/* @__PURE__ */n.jsx(RecordDocument,{record:w,depth:x,petName:t,wordmark:p.meta.displayName})/* @__PURE__ */);return n.jsx(r.View,{style:[u.root,h.root,c],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
562
562
  /* @__PURE__ */n.jsx(ScreenHeader,{title:pp.titleFor(t),variant:"document",onBack:s,testID:"record-document-header",right:m.available&&C?/* @__PURE__ */n.jsx(r.Pressable,{onPress:j,disabled:m.preparing,accessibilityRole:"button",accessibilityLabel:pp.download,accessibilityState:{disabled:m.preparing,busy:m.preparing},hitSlop:8,style:h.download,testID:"record-document-download",children:m.preparing?/* @__PURE__ */n.jsx(r.ActivityIndicator,{size:"small",color:p.slots.header?.textColor??p.color.brandInk}):/* @__PURE__ */n.jsx(DownloadGlyph,{})}):void 0}),m.error?/* @__PURE__ */n.jsx(Text,{style:[u.errorText,h.inset],accessibilityRole:"alert",children:m.error.displayMessage}):v?/* @__PURE__ */n.jsx(Text,{style:[u.errorText,h.inset],accessibilityRole:"alert",testID:"record-document-share-failed",children:Fo.toasts.pdfShareSheet}):null,
563
563
  /* @__PURE__ */n.jsx(r.View,{style:u.body,children:S}),
@@ -588,7 +588,7 @@ return n.jsxs(r.View,{style:[a.row,t>0?a.rowDivider:null],children:[
588
588
  /* @__PURE__ */n.jsx(Text,{style:a.fieldLabel,children:Co(e.system)}),
589
589
  /* @__PURE__ */n.jsx(Text,{style:a.fieldValue,children:e.finding})]},e.system))]},e.examId)),"record-document-exams"):null,i&&i.clinicianNotes.length>0?c(pp.clinicianNotes,i.clinicianNotes.map((e,t)=>/* @__PURE__ */n.jsxs(r.View,{style:[a.block,t>0?a.rowDivider:null],children:[e.observedOn?/* @__PURE__ */n.jsx(Text,{style:a.blockDate,children:fo(e.observedOn)}):null,e.sections.filter(e=>e.text).map((e,t)=>/* @__PURE__ */n.jsxs(r.View,{style:a.noteSection,children:[
590
590
  /* @__PURE__ */n.jsx(Text,{style:a.noteLabel,children:To(e.section)}),
591
- /* @__PURE__ */n.jsx(Text,{style:a.noteBody,children:e.text})]},`${e.section}-${t}`))]},e.noteId)),"record-document-notes"):null,ql(t.disclaimer)?null:/* @__PURE__ */n.jsx(r.View,{style:a.disclaimer,children:/* @__PURE__ */n.jsx(Text,{style:a.disclaimerText,children:t.disclaimer})})]})}function yp(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?wp(t):Ol(wp(t),xp(r)),[t,r])}function xp(e){return{root:{backgroundColor:e.ground}}}function wp(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth,a=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n}),s=(t,r)=>({...face(e,"mono"),fontSize:t,lineHeight:t+n.xs-1,color:r,letterSpacing:l.letterSpacing.eyebrow/2,textTransform:"uppercase"});return r.StyleSheet.create({root:{backgroundColor:t.surface},inset:{paddingHorizontal:n.lg},download:{width:n.xxl+n.xs+n.xs/2,height:n.xxl+n.xs+n.xs/2,borderRadius:i.pill,alignItems:"center",justifyContent:"center"},centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xxl,minHeight:n.xxl*3+n.xl},emptyText:{...a(l.size.body,l.lineHeight.normal,t.text.muted,"medium"),textAlign:"center"},page:{paddingHorizontal:n.lg+n.xs,paddingBottom:n.xxl+n.lg},letterhead:{alignItems:"center",paddingTop:n.md,paddingBottom:n.lg+n.xs+n.xs/2,borderBottomWidth:2,borderBottomColor:t.brandInk,gap:n.xs+n.xs/2,marginBottom:n.sm},wordmark:{...a(l.size.heading,l.lineHeight.snug,t.brandInk,"bold"),letterSpacing:l.letterSpacing.headerBrand},docTitle:{...s(l.size.caption,t.brandInk),marginTop:n.sm+n.xs/2,letterSpacing:l.letterSpacing.eyebrow+.4},petName:a(l.size.verdict+n.xs/2,l.lineHeight.tight,t.text.primary),generated:{...s(l.size.tiny,t.text.muted),textTransform:"none"},section:{marginTop:n.lg+n.xs+n.xs/2},sectionHeader:{flexDirection:"row",alignItems:"center",gap:n.sm+n.xs/2,marginBottom:n.sm},sectionTitle:s(l.size.tiny,t.brandInk),rule:{flex:1,height:o,backgroundColor:t.borderHairlineGreen},row:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:n.md+n.xs/2,paddingVertical:n.sm+1},rowDivider:{borderTopWidth:o,borderTopColor:t.borderHairlineGreen},rowFlag:{backgroundColor:t.badgeBgCritical,marginHorizontal:-n.sm,paddingHorizontal:n.sm,borderRadius:i.xs},rowMain:{flexShrink:1},rowRight:{alignItems:"flex-end",gap:n.xs/2},rowLabel:{flexShrink:1,...a(l.size.body,l.lineHeight.normal,t.text.primary,"medium")},rowValue:{...a(l.size.body,l.lineHeight.normal,t.text.primary,"bold"),textAlign:"right"},rowValueAlert:{color:t.danger},rowMeta:{marginTop:n.xs/2,...face(e,"mono"),fontSize:l.size.tiny,lineHeight:l.size.body,color:t.text.muted},markerStatus:s(l.size.micro,t.text.muted),block:{paddingVertical:n.sm+n.xs/2},blockDate:{...s(l.size.tiny,t.text.muted),marginBottom:n.xs+n.xs/2},fieldRow:{flexDirection:"row",alignItems:"flex-start",gap:n.md+n.xs/2,paddingVertical:n.xs-1},fieldLabel:{width:120,...a(l.size.bodyTight,l.lineHeight.normal,t.text.muted,"medium")},fieldValue:{flex:1,...a(l.size.bodyTight,l.lineHeight.normal,t.text.primary,"medium")},noteSection:{marginTop:n.sm},noteLabel:{...s(l.size.tiny,t.brandInk),marginBottom:n.xs/2},noteBody:a(l.size.bodyTight,l.lineHeight.relaxed,t.text.primary),disclaimer:{marginTop:i.xl,paddingTop:n.md+n.xs/2,borderTopWidth:o,borderTopColor:t.borderHairlineGreen},disclaimerText:a(l.size.tiny,l.lineHeight.relaxed,t.text.muted)})}function ShareSheet({petRef:petRef,petName:t,onClose:i,onNavigate:l,onOpenUrl:o,onCopy:a}){let s=vp(),d=ga(),c=Yl(),u=useRecordShares(petRef),[h,p]=e.useState(null),[g,f]=e.useState(null),[m,b]=e.useState("vet"),[y,x]=e.useState(""),w=u.available&&!u.consentRequired,v=u.features.sharing!==false,k=w&&v,j=u.shareAudiences.length>0,S=u.shareAudiences.find(e=>e.audience===m)??null,C=S!==null?No(S,u.features):[],R=(e,t)=>{let r=o??((e,t)=>t==="share_link"?Mh(e):qh(e)),n=t==="share_link"?Fo.toasts.shareSheet:Fo.toasts.pdfShareSheet;vr(r,e,t).then(e=>{e.ok||p(n)})},T=()=>{p(null),u.createLink(j?m:void 0).then(e=>{e.ok?R(e.value.shareUrl,"share_link"):p(Ko(e.error,"create"))})},_=()=>{if(u.sending)return;p(null);let e=y.trim();if(e.length===0){p(Fo.addEmailFor(t));return}if(!isShareRecipientEmail(e)){p(Fo.emailInvalid);return}u.sendEmail({recipientEmail:e,recipientKind:m}).then(t=>{t.ok?(x(""),p(Fo.toasts.sentTo(e))):p(Ko(t.error,"email"))})},z=()=>{p(null),u.pdfLink().then(e=>{e.ok?R(e.value.downloadUrl,"record_pdf"):p(Ko(e.error,"download"))})},I=e=>{if(!a||e.shareUrl===null)return;let t=e.shareUrl;vr(a,t).then(e=>p(e.ok?Fo.toasts.copiedNative:Fo.toasts.copyFailedNative(t)))},D=e=>{u.revoke(e).then(e=>{f(null),p(e.ok?Fo.toasts.turnedOff:Ko(e.error,"revoke"))})};/* @__PURE__ */
591
+ /* @__PURE__ */n.jsx(Text,{style:a.noteBody,children:e.text})]},`${e.section}-${t}`))]},e.noteId)),"record-document-notes"):null,ql(t.disclaimer)?null:/* @__PURE__ */n.jsx(r.View,{style:a.disclaimer,children:/* @__PURE__ */n.jsx(Text,{style:a.disclaimerText,children:t.disclaimer})})]})}function yp(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?wp(t):El(wp(t),xp(r)),[t,r])}function xp(e){return{root:{backgroundColor:e.ground}}}function wp(e){let{color:t,space:n,radius:i,type:l}=e,o=r.StyleSheet.hairlineWidth,a=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n}),s=(t,r)=>({...face(e,"mono"),fontSize:t,lineHeight:t+n.xs-1,color:r,letterSpacing:l.letterSpacing.eyebrow/2,textTransform:"uppercase"});return r.StyleSheet.create({root:{backgroundColor:t.surface},inset:{paddingHorizontal:n.lg},download:{width:n.xxl+n.xs+n.xs/2,height:n.xxl+n.xs+n.xs/2,borderRadius:i.pill,alignItems:"center",justifyContent:"center"},centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:n.xxl,minHeight:n.xxl*3+n.xl},emptyText:{...a(l.size.body,l.lineHeight.normal,t.text.muted,"medium"),textAlign:"center"},page:{paddingHorizontal:n.lg+n.xs,paddingBottom:n.xxl+n.lg},letterhead:{alignItems:"center",paddingTop:n.md,paddingBottom:n.lg+n.xs+n.xs/2,borderBottomWidth:2,borderBottomColor:t.brandInk,gap:n.xs+n.xs/2,marginBottom:n.sm},wordmark:{...a(l.size.heading,l.lineHeight.snug,t.brandInk,"bold"),letterSpacing:l.letterSpacing.headerBrand},docTitle:{...s(l.size.caption,t.brandInk),marginTop:n.sm+n.xs/2,letterSpacing:l.letterSpacing.eyebrow+.4},petName:a(l.size.verdict+n.xs/2,l.lineHeight.tight,t.text.primary),generated:{...s(l.size.tiny,t.text.muted),textTransform:"none"},section:{marginTop:n.lg+n.xs+n.xs/2},sectionHeader:{flexDirection:"row",alignItems:"center",gap:n.sm+n.xs/2,marginBottom:n.sm},sectionTitle:s(l.size.tiny,t.brandInk),rule:{flex:1,height:o,backgroundColor:t.borderHairlineGreen},row:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:n.md+n.xs/2,paddingVertical:n.sm+1},rowDivider:{borderTopWidth:o,borderTopColor:t.borderHairlineGreen},rowFlag:{backgroundColor:t.badgeBgCritical,marginHorizontal:-n.sm,paddingHorizontal:n.sm,borderRadius:i.xs},rowMain:{flexShrink:1},rowRight:{alignItems:"flex-end",gap:n.xs/2},rowLabel:{flexShrink:1,...a(l.size.body,l.lineHeight.normal,t.text.primary,"medium")},rowValue:{...a(l.size.body,l.lineHeight.normal,t.text.primary,"bold"),textAlign:"right"},rowValueAlert:{color:t.danger},rowMeta:{marginTop:n.xs/2,...face(e,"mono"),fontSize:l.size.tiny,lineHeight:l.size.body,color:t.text.muted},markerStatus:s(l.size.micro,t.text.muted),block:{paddingVertical:n.sm+n.xs/2},blockDate:{...s(l.size.tiny,t.text.muted),marginBottom:n.xs+n.xs/2},fieldRow:{flexDirection:"row",alignItems:"flex-start",gap:n.md+n.xs/2,paddingVertical:n.xs-1},fieldLabel:{width:120,...a(l.size.bodyTight,l.lineHeight.normal,t.text.muted,"medium")},fieldValue:{flex:1,...a(l.size.bodyTight,l.lineHeight.normal,t.text.primary,"medium")},noteSection:{marginTop:n.sm},noteLabel:{...s(l.size.tiny,t.brandInk),marginBottom:n.xs/2},noteBody:a(l.size.bodyTight,l.lineHeight.relaxed,t.text.primary),disclaimer:{marginTop:i.xl,paddingTop:n.md+n.xs/2,borderTopWidth:o,borderTopColor:t.borderHairlineGreen},disclaimerText:a(l.size.tiny,l.lineHeight.relaxed,t.text.muted)})}function ShareSheet({petRef:petRef,petName:t,onClose:i,onNavigate:l,onOpenUrl:o,onCopy:a}){let s=vp(),d=ga(),c=Yl(),u=useRecordShares(petRef),[h,p]=e.useState(null),[g,f]=e.useState(null),[m,b]=e.useState("vet"),[y,x]=e.useState(""),w=u.available&&!u.consentRequired,v=u.features.sharing!==false,k=w&&v,j=u.shareAudiences.length>0,S=u.shareAudiences.find(e=>e.audience===m)??null,C=S!==null?No(S,u.features):[],R=(e,t)=>{let r=o??((e,t)=>t==="share_link"?Mh(e):qh(e)),n=t==="share_link"?Fo.toasts.shareSheet:Fo.toasts.pdfShareSheet;vr(r,e,t).then(e=>{e.ok||p(n)})},T=()=>{p(null),u.createLink(j?m:void 0).then(e=>{e.ok?R(e.value.shareUrl,"share_link"):p(Ko(e.error,"create"))})},_=()=>{if(u.sending)return;p(null);let e=y.trim();if(e.length===0){p(Fo.addEmailFor(t));return}if(!isShareRecipientEmail(e)){p(Fo.emailInvalid);return}u.sendEmail({recipientEmail:e,recipientKind:m}).then(t=>{t.ok?(x(""),p(Fo.toasts.sentTo(e))):p(Ko(t.error,"email"))})},z=()=>{p(null),u.pdfLink().then(e=>{e.ok?R(e.value.downloadUrl,"record_pdf"):p(Ko(e.error,"download"))})},I=e=>{if(!a||e.shareUrl===null)return;let t=e.shareUrl;vr(a,t).then(e=>p(e.ok?Fo.toasts.copiedNative:Fo.toasts.copyFailedNative(t)))},D=e=>{u.revoke(e).then(e=>{f(null),p(e.ok?Fo.toasts.turnedOff:Ko(e.error,"revoke"))})};/* @__PURE__ */
592
592
  return n.jsx(r.Modal,{transparent:true,visible:true,animationType:"slide",onRequestClose:i,children:/* @__PURE__ */n.jsxs(r.View,{style:s.backdrop,children:[
593
593
  /* @__PURE__ */n.jsx(r.Pressable,{style:Xc,accessibilityRole:"button",accessibilityLabel:Fo.closeSheetA11y,onPress:i}),
594
594
  /* @__PURE__ */n.jsxs(r.View,{style:fa(s.sheet,d),accessibilityViewIsModal:true,testID:"share-record-sheet",children:[
@@ -705,7 +705,7 @@ return n.jsx(r.View,{style:{paddingTop:wl(".ph-askbar","paddingTop"),paddingRigh
705
705
  return n.jsxs(r.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:e,style:({pressed:e})=>[{position:"absolute",right:wl(".ask-pill","right"),bottom:wl(".ask-pill","bottom"),zIndex:3,flexDirection:"row",alignItems:"center",gap:wl(".ask-pill","gap"),minHeight:wl(".ask-pill","minHeight"),paddingRight:wl(".ask-pill","paddingRight"),paddingLeft:wl(".ask-pill","paddingLeft"),borderRadius:999,backgroundColor:l,shadowColor:fl.topInk,shadowOpacity:.45,shadowRadius:10,shadowOffset:{width:0,height:8},elevation:6,transform:[{scale:e?.96:1}]},a],testID:s,children:[
706
706
  /* @__PURE__ */n.jsx(r.View,{...Lp,children:i??/* @__PURE__ */n.jsx(ChatBubbleGlyph,{size:wl(".ask-pill svg","width"),color:o})}),
707
707
  /* @__PURE__ */n.jsx(Text,{tier:"compact",style:{...face(d,"bold"),fontSize:wl(".ask-pill","fontSize"),lineHeight:wl(".ask-pill","fontSize")*1.2,color:o},children:e})]})}function EverfurRecordsUpload(e){let{style:t,renderPending:r,...i}=wr(e,["onNavigate","onBack"]);/* @__PURE__ */
708
- return n.jsx(CapabilityGate,{capability:"records",style:t,...r?{renderPending:r}:{},...uo(i.onBack,no),children:/* @__PURE__ */n.jsx(UploadBody,{...i,style:t})})}function UploadBody({petRef:petRef,petName:e,controller:t,onPickDocument:i,onPickPhotos:l,uploadTransport:o,onNavigate:a,onBack:s,style:d}){let c=Yl(),u=Ep(),h=useEverfurTheme(),{runtime:p}=Xt(),g=useEverfurRecords(t?{petRef:petRef,controller:t,readUploadFeatures:true}:o?{petRef:petRef,uploadTransport:o,readUploadFeatures:true}:{petRef:petRef,readUploadFeatures:true}),f=ac(i)&&(t!==void 0||o!==void 0||Le(p.registry.services.uploadTransport));/* @__PURE__ */
708
+ return n.jsx(CapabilityGate,{capability:"records",style:t,...r?{renderPending:r}:{},...uo(i.onBack,no),children:/* @__PURE__ */n.jsx(UploadBody,{...i,style:t})})}function UploadBody({petRef:petRef,petName:e,controller:t,onPickDocument:i,onPickPhotos:l,uploadTransport:o,onNavigate:a,onBack:s,style:d}){let c=Yl(),u=Op(),h=useEverfurTheme(),{runtime:p}=Xt(),g=useEverfurRecords(t?{petRef:petRef,controller:t,readUploadFeatures:true}:o?{petRef:petRef,uploadTransport:o,readUploadFeatures:true}:{petRef:petRef,readUploadFeatures:true}),f=ac(i)&&(t!==void 0||o!==void 0||Le(p.registry.services.uploadTransport));/* @__PURE__ */
709
709
  return n.jsx(r.View,{style:[c.root,d],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
710
710
  /* @__PURE__ */n.jsx(ScreenHeader,{title:"",onBack:s,testID:"upload-header"}),
711
711
  /* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:u.content,testID:"upload-screen",children:[
@@ -714,7 +714,7 @@ return n.jsx(r.View,{style:[c.root,d],children:/* @__PURE__ */n.jsxs(SdkTabletCo
714
714
  /* @__PURE__ */n.jsx(Text,{style:u.title,accessibilityRole:"header",children:Bu.screenTitle}),
715
715
  /* @__PURE__ */n.jsx(Text,{style:u.subtitle,children:Bu.subtitle(e)})]}),
716
716
  /* @__PURE__ */n.jsx(UploadRecordCard,{records:g,requestId:null,onPickDocument:i,onPickPhotos:l,canUpload:f,onDone:a?e=>a({name:"request",requestId:e}):void 0})]}),
717
- /* @__PURE__ */n.jsx(RecordsFootnote,{})]})})}function UploadRecordCard({records:t,requestId:i,onPickDocument:l,onPickPhotos:o,canUpload:a,onDone:s}){let d=Yl(),c=Ep(),{runtime:u}=Xt(),h=u.registry.services.camera,p=t.uploadContentTypes,g=acceptsPhotos(p),f=g&&Hd(h),m=g&&o!==void 0,b=f||m,[y,x]=e.useState(null),[w,v]=e.useState(0),k=e.useRef(i),j=e.useRef([]),S=t.uploadQueue.filter(e=>e.status!=="skipped"),C=S.filter(e=>e.status==="done").length,R=S.filter(e=>e.status==="failed").length,T=!t.isUploading&&w>0,_=e.useCallback(async e=>{let{uploadable:r,skipped:n}=ar(e,p),i=Uu(n,b);if(r.length===0){i!==null&&x(i);return}x(i);let l=k.current;if(l===null){let e=await t.createRequest(`records-upload-${Date.now().toString(36)}`);if(!e.ok){x(Bu.errors.start);return}l=e.value.id,k.current=l}v(e=>e+1);let o=await t.uploadDocuments(l,r);j.current=o.flatMap((e,t)=>e.status==="failed"&&r[t]!==void 0?[r[t]]:[])},[t,p,b]),z=e.useCallback(e=>{!e||!a||vr(e).then(e=>{if(!e.ok){x(Bu.errors.startPlain);return}let t=e.value;t!==null&&_(Array.isArray(t)?t:[t])})},[a,_]),I=e.useCallback(()=>{z(l)},[z,l]),D=e.useCallback(()=>{z(o)},[z,o]),H=e.useCallback(()=>{!f||!a||vr(()=>h.capture(Dd("photo"))).then(e=>{if(!e.ok)return;let t=zd(e.value);if(t.sizeBytes===void 0){x(Bu.errors.startPlain);return}_([t])})},[h,f,a,_]),V=e.useCallback(()=>{_(j.current)},[_]);/* @__PURE__ */
717
+ /* @__PURE__ */n.jsx(RecordsFootnote,{})]})})}function UploadRecordCard({records:t,requestId:i,onPickDocument:l,onPickPhotos:o,canUpload:a,onDone:s}){let d=Yl(),c=Op(),{runtime:u}=Xt(),h=u.registry.services.camera,p=t.uploadContentTypes,g=acceptsPhotos(p),f=g&&Hd(h),m=g&&o!==void 0,b=f||m,[y,x]=e.useState(null),[w,v]=e.useState(0),k=e.useRef(i),j=e.useRef([]),S=t.uploadQueue.filter(e=>e.status!=="skipped"),C=S.filter(e=>e.status==="done").length,R=S.filter(e=>e.status==="failed").length,T=!t.isUploading&&w>0,_=e.useCallback(async e=>{let{uploadable:r,skipped:n}=ar(e,p),i=Uu(n,b);if(r.length===0){i!==null&&x(i);return}x(i);let l=k.current;if(l===null){let e=await t.createRequest(`records-upload-${Date.now().toString(36)}`);if(!e.ok){x(Bu.errors.start);return}l=e.value.id,k.current=l}v(e=>e+1);let o=await t.uploadDocuments(l,r);j.current=o.flatMap((e,t)=>e.status==="failed"&&r[t]!==void 0?[r[t]]:[])},[t,p,b]),z=e.useCallback(e=>{!e||!a||vr(e).then(e=>{if(!e.ok){x(Bu.errors.startPlain);return}let t=e.value;t!==null&&_(Array.isArray(t)?t:[t])})},[a,_]),I=e.useCallback(()=>{z(l)},[z,l]),D=e.useCallback(()=>{z(o)},[z,o]),H=e.useCallback(()=>{!f||!a||vr(()=>h.capture(Dd("photo"))).then(e=>{if(!e.ok)return;let t=zd(e.value);if(t.sizeBytes===void 0){x(Bu.errors.startPlain);return}_([t])})},[h,f,a,_]),V=e.useCallback(()=>{_(j.current)},[_]);/* @__PURE__ */
718
718
  return n.jsxs(r.View,{style:c.card,testID:"records-upload-card",children:[
719
719
  /* @__PURE__ */n.jsx(Text,{style:c.cardTitle,accessibilityRole:"header",children:Bu.cardTitle}),
720
720
  /* @__PURE__ */n.jsx(Text,{style:c.cardSubtitle,children:b?Fu.note:Bu.cardSubtitle}),y?/* @__PURE__ */n.jsx(r.View,{style:d.errorBanner,accessibilityRole:"alert",children:/* @__PURE__ */n.jsx(Text,{style:d.errorText,children:y})}):null,
@@ -726,11 +726,11 @@ return n.jsxs(r.View,{style:c.card,testID:"records-upload-card",children:[
726
726
  /* @__PURE__ */n.jsx(Text,{style:c.actionMeta,children:Fu.takePhotoMeta})]}):null,m?/* @__PURE__ */n.jsx(r.View,{style:c.action,children:/* @__PURE__ */n.jsx(Pill,{label:Fu.choosePhotos,kind:"outline",disabled:!a,onPress:D,testID:"records-upload-choose-photos"})}):null,
727
727
  /* @__PURE__ */n.jsxs(r.View,{style:c.action,children:[
728
728
  /* @__PURE__ */n.jsx(Pill,{label:Bu.chooseFiles,disabled:!a,onPress:I,testID:"records-upload-choose"}),
729
- /* @__PURE__ */n.jsx(Text,{style:c.actionMeta,children:Fu.chooseFileMeta})]})]}):/* @__PURE__ */n.jsx(Pill,{label:Bu.chooseFiles,disabled:!a,onPress:I,testID:"records-upload-choose"})]})}function Ep(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?$p(t):Ol($p(t),Op(r)),[t,r])}function Op(e){return{card:El(e),cardTitle:e.cardTitle,title:{...e.title,textAlign:"center"}}}var Ap=24;function $p(e){let{color:t,space:n,radius:i,type:l}=e,o=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({content:{padding:n.lg+n.xs,gap:n.lg+n.xs},header:{gap:n.sm,alignItems:"center"},iconBubble:{width:n.xxl+n.lg+n.xs,height:n.xxl+n.lg+n.xs,borderRadius:i.pill,alignItems:"center",justifyContent:"center",marginBottom:n.xs},title:{...o(l.size.heading+n.xs/2,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),textAlign:"center"},subtitle:{...o(l.size.body,l.lineHeight.normal,t.text.muted),textAlign:"center",maxWidth:340},card:{borderRadius:i.lg,backgroundColor:t.surface,borderWidth:1,borderColor:t.borderRingCream,padding:n.lg,gap:n.md,...rn(e.slots.card,1)},cardTitle:{...o(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...nn(e.slots.card)},cardSubtitle:{...o(l.size.bodyTight,l.lineHeight.normal,t.text.muted),...nn(e.slots.card)},uploadingRow:{flexDirection:"row",alignItems:"center",gap:n.sm},progressText:{flex:1,...o(l.size.bodyTight,l.lineHeight.normal,t.text.secondary)},settled:{gap:n.sm},success:o(l.size.bodyTight,l.lineHeight.normal,t.text.primary),settledActions:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:n.sm},actions:{gap:n.md},action:{gap:n.xs},actionMeta:o(l.size.bodyTight,l.lineHeight.normal,t.text.muted)})}function EverfurRecordsRequest(e){let{style:t,renderPending:r,...i}=wr(e,["onNavigate","onBack"]),{userRef:userRef}=Xt();/* @__PURE__ */
729
+ /* @__PURE__ */n.jsx(Text,{style:c.actionMeta,children:Fu.chooseFileMeta})]})]}):/* @__PURE__ */n.jsx(Pill,{label:Bu.chooseFiles,disabled:!a,onPress:I,testID:"records-upload-choose"})]})}function Op(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?$p(t):El($p(t),Ep(r)),[t,r])}function Ep(e){return{card:Ol(e),cardTitle:e.cardTitle,title:{...e.title,textAlign:"center"}}}var Ap=24;function $p(e){let{color:t,space:n,radius:i,type:l}=e,o=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({content:{padding:n.lg+n.xs,gap:n.lg+n.xs},header:{gap:n.sm,alignItems:"center"},iconBubble:{width:n.xxl+n.lg+n.xs,height:n.xxl+n.lg+n.xs,borderRadius:i.pill,alignItems:"center",justifyContent:"center",marginBottom:n.xs},title:{...o(l.size.heading+n.xs/2,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),textAlign:"center"},subtitle:{...o(l.size.body,l.lineHeight.normal,t.text.muted),textAlign:"center",maxWidth:340},card:{borderRadius:i.lg,backgroundColor:t.surface,borderWidth:1,borderColor:t.borderRingCream,padding:n.lg,gap:n.md,...rn(e.slots.card,1)},cardTitle:{...o(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold"),...nn(e.slots.card)},cardSubtitle:{...o(l.size.bodyTight,l.lineHeight.normal,t.text.muted),...nn(e.slots.card)},uploadingRow:{flexDirection:"row",alignItems:"center",gap:n.sm},progressText:{flex:1,...o(l.size.bodyTight,l.lineHeight.normal,t.text.secondary)},settled:{gap:n.sm},success:o(l.size.bodyTight,l.lineHeight.normal,t.text.primary),settledActions:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:n.sm},actions:{gap:n.md},action:{gap:n.xs},actionMeta:o(l.size.bodyTight,l.lineHeight.normal,t.text.muted)})}function EverfurRecordsRequest(e){let{style:t,renderPending:r,...i}=wr(e,["onNavigate","onBack"]),{userRef:userRef}=Xt();/* @__PURE__ */
730
730
  return n.jsx(CapabilityGate,{capability:"records",style:t,...r?{renderPending:r}:{},...uo(i.onBack,no),children:userRef===null?/* @__PURE__ */n.jsx(SessionRequiredScreen,{style:t,testID:"records-request-session-required"}):/* @__PURE__ */n.jsx(RequestBody,{...i,style:t})})}function RequestBody({petRef:petRef,petName:e,requestId:t,controller:i,onPickDocument:l,onPickPhotos:o,uploadTransport:a,onNavigate:s,onBack:d,onOpenUrl:c,onAsk:u,style:h,nowMs:p}){let g=Yl(),f=Xl(),{runtime:m,userRef:userRef,scopeEpoch:b}=Xt(),y=useEverfurRecords(i?{petRef:petRef,controller:i,readUploadFeatures:true}:a?{petRef:petRef,uploadTransport:a,readUploadFeatures:true}:{petRef:petRef,readUploadFeatures:true}),x=y.requests.find(e=>e.id===t)??null,w=ac(l)&&(i!==void 0||a!==void 0||Le(m.registry.services.uploadTransport)),v=x?selectRequestTitle(x):"",k=Tp(y.refresh,"records-request-refresh"),j;y.status==="loading"&&x===null?j=/* @__PURE__ */n.jsx(RequestSkeleton,{testID:"records-request-loading"}):y.status==="error"&&y.error?j=/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(y.error),message:y.error.displayMessage,onAction:y.error.retryable?y.refresh:void 0,testID:"records-request-error"}):x===null&&(j=/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:"no_requests",testID:"records-request-missing"}));let S=x!==null&&j===void 0,C=f!==null&&u!==void 0&&x!==null&&S?()=>{let t=Ud(e,{clinicName:x.clinicName??null,statusLabel:selectPrimaryLabel(x),status:x.status,heldItemCount:x.heldItemCount},x.id);u(t.prompt,t.entityRef)}:null;return S&&(j=/* @__PURE__ */n.jsx(RequestDetail,{petName:e,request:x,records:y,canUpload:w,onPickDocument:l,onPickPhotos:o,onNavigate:s,onOpenUrl:c,nowMs:p,refreshControl:k,askRoom:C!==null},JSON.stringify([userRef,b,x.id]))),/* @__PURE__ */n.jsx(r.View,{style:[g.root,h],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
731
731
  /* @__PURE__ */n.jsx(ScreenHeader,{title:v,onBack:d,testID:"records-request-header"}),
732
732
  /* @__PURE__ */n.jsxs(r.KeyboardAvoidingView,{behavior:"padding",style:g.body,children:[j,C!==null?/* @__PURE__ */n.jsx(RecordsAskPill,{label:Sn.ask,onPress:C,testID:"records-request-ask-pill"}):null]}),
733
- /* @__PURE__ */n.jsx(RecordsFootnote,{})]})})}var Bp=wl(".ask-pill","minHeight")+wl(".ask-pill","bottom")*2;function RequestDetail({petName:t,request:i,records:l,canUpload:o,onPickDocument:a,onPickPhotos:s,onNavigate:d,onOpenUrl:c,nowMs:u,refreshControl:h,askRoom:p=false}){let g=Yl(),f=Fp(),m=useEverfurTheme(),b=Yu({request:i,onRecovered:l.refresh,canUpload:o},useEverfurRecordsClinic()),[y,x]=e.useState(null),[w,v]=e.useState(false),[k,j]=e.useState(null),S=e.useRef(true);e.useEffect(()=>(S.current=true,()=>{S.current=false}),[]);let C=b.request,R=u??Date.now(),T=C.status==="published",_=C.status==="published"||C.status==="failed"||C.status==="revoked",z=En(C),I=C.wireStatus==="clinic_responded_no_records",D=Ln(C,R),H=Vn(C,R),V=_?null:C.waitingExpectation?.trim()||null,P=selectClinicCall(C),L=On(C),E=b.canConvert,O=_&&!T,A=b.error!==null&&y!==null&&y!=="start"?y==="revoke"?zn.errors.cancel:zn.errors[y]:null,$=(e,t)=>{x(e),t()},B=()=>{w||(v(true),j(null),l.createRequest(`records-upload-${Date.now().toString(36)}`).then(e=>{if(S.current){if(v(false),!e.ok){j(zn.errors.start);return}d?.({name:"request",requestId:e.value.id})}}))},F=C.clinicName?.trim()??"",M=!ch(C)&&F.length>0,q=M&&(C.status==="requested"||C.status==="awaiting_clinic"),N=bo(C.createdAt);/* @__PURE__ */
733
+ /* @__PURE__ */n.jsx(RecordsFootnote,{})]})})}var Bp=wl(".ask-pill","minHeight")+wl(".ask-pill","bottom")*2;function RequestDetail({petName:t,request:i,records:l,canUpload:o,onPickDocument:a,onPickPhotos:s,onNavigate:d,onOpenUrl:c,nowMs:u,refreshControl:h,askRoom:p=false}){let g=Yl(),f=Fp(),m=useEverfurTheme(),b=Yu({request:i,onRecovered:l.refresh,canUpload:o},useEverfurRecordsClinic()),[y,x]=e.useState(null),[w,v]=e.useState(false),[k,j]=e.useState(null),S=e.useRef(true);e.useEffect(()=>(S.current=true,()=>{S.current=false}),[]);let C=b.request,R=u??Date.now(),T=C.status==="published",_=C.status==="published"||C.status==="failed"||C.status==="revoked",z=On(C),I=C.wireStatus==="clinic_responded_no_records",D=Ln(C,R),H=Vn(C,R),V=_?null:C.waitingExpectation?.trim()||null,P=selectClinicCall(C),L=En(C),O=b.canConvert,E=_&&!T,A=b.error!==null&&y!==null&&y!=="start"?y==="revoke"?zn.errors.cancel:zn.errors[y]:null,$=(e,t)=>{x(e),t()},B=()=>{w||(v(true),j(null),l.createRequest(`records-upload-${Date.now().toString(36)}`).then(e=>{if(S.current){if(v(false),!e.ok){j(zn.errors.start);return}d?.({name:"request",requestId:e.value.id})}}))},F=C.clinicName?.trim()??"",M=!ch(C)&&F.length>0,q=M&&(C.status==="requested"||C.status==="awaiting_clinic"),N=bo(C.createdAt);/* @__PURE__ */
734
734
  return n.jsxs(r.ScrollView,{contentContainerStyle:[f.content,p?{paddingBottom:Bp}:null],keyboardShouldPersistTaps:"handled",refreshControl:h,testID:`records-request-${C.id}`,children:[q?/* @__PURE__ */n.jsxs(r.View,{style:f.sent,testID:"records-request-sent",children:[
735
735
  /* @__PURE__ */n.jsx(Text,{style:f.cardTitle,accessibilityRole:"header",children:zn.sentTitle}),
736
736
  /* @__PURE__ */n.jsx(Text,{style:g.bodyText,children:zn.sentLeadWeb(F,yn(t))})]}):null,
@@ -747,158 +747,159 @@ return n.jsxs(r.ScrollView,{contentContainerStyle:[f.content,p?{paddingBottom:Bp
747
747
  /* @__PURE__ */n.jsx(Text,{style:g.fieldLabel,children:Ku.email}),
748
748
  /* @__PURE__ */n.jsx(tn,{style:g.field,accessibilityLabel:Ku.email,placeholder:Ku.emailPlaceholder,placeholderTextColor:m.color.text.placeholder,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,maxLength:320,value:b.email,editable:!b.busy,onChangeText:b.setEmail,testID:"records-failure-clinic-email"}),b.emailInvalid?/* @__PURE__ */n.jsx(Text,{style:g.errorText,accessibilityRole:"alert",children:zn.errors.invalidEmail}):null,
749
749
  /* @__PURE__ */n.jsx(Pill,{label:Ku.updateEmail,disabled:!b.canUpdateEmail,busy:b.busy&&y==="email",onPress:()=>$("email",b.updateEmail),testID:"records-failure-update-email"})]}):null,C.canRetrySend===true?/* @__PURE__ */n.jsx(Pill,{label:Ku.retry,kind:"outline",accessibilityLabel:Ku.retryA11y,disabled:!b.canRetry,busy:b.busy&&y==="retry",onPress:()=>$("retry",b.retry),testID:"records-failure-retry-send"}):null,C.canRetrySend===true&&b.hasEmailEdit?/* @__PURE__ */n.jsx(Text,{style:g.rowDetail,children:Ku.retryHint}):null,A&&(y==="email"||y==="retry")?/* @__PURE__ */n.jsx(r.View,{style:g.errorBanner,accessibilityRole:"alert",children:/* @__PURE__ */n.jsx(Text,{style:g.errorText,children:A})}):null]}):null,(z||I)&&d?/* @__PURE__ */n.jsx(Pill,{label:zn.tryAnotherClinic,kind:"outline",onPress:()=>d({name:"clinicPicker"}),testID:"records-request-try-another-clinic"}):null,P!==null?/* @__PURE__ */n.jsxs(r.View,{style:f.callBlock,children:[
750
- /* @__PURE__ */n.jsx(ClinicCallCard,{call:P,prompt:C.statusLabel}),C.canRetrySend===true?/* @__PURE__ */n.jsx(Pill,{label:b.busy&&y==="retry"?zn.resending:zn.resend,kind:"outline",disabled:!b.canRetry,onPress:()=>$("retry",b.retry),testID:"records-resend-authorization"}):null]}):null,E?/* @__PURE__ */n.jsxs(r.View,{style:f.block,children:[
750
+ /* @__PURE__ */n.jsx(ClinicCallCard,{call:P,prompt:C.statusLabel}),C.canRetrySend===true?/* @__PURE__ */n.jsx(Pill,{label:b.busy&&y==="retry"?zn.resending:zn.resend,kind:"outline",disabled:!b.canRetry,onPress:()=>$("retry",b.retry),testID:"records-resend-authorization"}):null]}):null,O?/* @__PURE__ */n.jsxs(r.View,{style:f.block,children:[
751
751
  /* @__PURE__ */n.jsx(Pill,{label:b.busy&&y==="convert"?zn.converting:zn.convert,busy:b.busy&&y==="convert",onPress:()=>$("convert",b.convert),testID:"records-convert-upload"}),
752
- /* @__PURE__ */n.jsx(Text,{style:g.muted,children:zn.convertHint}),A&&y==="convert"?/* @__PURE__ */n.jsx(r.View,{style:g.errorBanner,accessibilityRole:"alert",children:/* @__PURE__ */n.jsx(Text,{style:g.errorText,children:A})}):null]}):null,O?/* @__PURE__ */n.jsxs(r.View,{style:f.block,children:[
752
+ /* @__PURE__ */n.jsx(Text,{style:g.muted,children:zn.convertHint}),A&&y==="convert"?/* @__PURE__ */n.jsx(r.View,{style:g.errorBanner,accessibilityRole:"alert",children:/* @__PURE__ */n.jsx(Text,{style:g.errorText,children:A})}):null]}):null,E?/* @__PURE__ */n.jsxs(r.View,{style:f.block,children:[
753
753
  /* @__PURE__ */n.jsx(Pill,{label:w?zn.freshUploadStarting:zn.freshUpload,kind:z||I?"outline":"primary",busy:w,onPress:B,testID:"records-upload-own-fresh"}),k?/* @__PURE__ */n.jsx(r.View,{style:g.errorBanner,accessibilityRole:"alert",children:/* @__PURE__ */n.jsx(Text,{style:g.errorText,children:k})}):null]}):null,A&&y==="revoke"?/* @__PURE__ */n.jsx(r.View,{style:g.errorBanner,accessibilityRole:"alert",children:/* @__PURE__ */n.jsx(Text,{style:g.errorText,children:A})}):null,C.canRevoke===true?b.confirmingRevoke?/* @__PURE__ */n.jsxs(r.View,{style:f.block,testID:"records-revoke-confirm",children:[
754
754
  /* @__PURE__ */n.jsx(Text,{style:f.confirmTitle,accessibilityRole:"header",children:Ku.cancelQuestion}),
755
755
  /* @__PURE__ */n.jsx(Text,{style:g.bodyText,children:Ku.cancelConsequence}),
756
756
  /* @__PURE__ */n.jsx(Pill,{label:b.busy&&y==="revoke"?zn.cancelling:zn.cancel,kind:"danger",busy:b.busy&&y==="revoke",onPress:()=>$("revoke",b.revoke),testID:"records-revoke-do"}),
757
- /* @__PURE__ */n.jsx(Pill,{label:Ku.keepRequest,kind:"outline",disabled:b.busy,onPress:b.keepRequest,testID:"records-revoke-keep"})]}):/* @__PURE__ */n.jsx(Pill,{label:zn.cancel,kind:"danger",disabled:b.busy,onPress:b.askRevoke,testID:"records-revoke"}):null]})}function Fp(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?qp(t):Ol(qp(t),Mp(r)),[t,r])}function Mp(e){return{card:El(e),cardTitle:e.cardTitle,confirmTitle:e.cardTitle,readyCta:{minHeight:e.button.minHeight}}}function qp(e){let{color:t,space:n,radius:i,type:l}=e,o=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({content:{paddingHorizontal:n.lg,paddingBottom:n.xxl,gap:n.lg+n.xs/2},readyCta:{minHeight:n.xxl+n.lg+n.xs/2},sent:{gap:n.xs},card:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,padding:n.lg,gap:n.md,...rn(ln(e.slots),1)},cardTitle:{...o(l.size.subtitle,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),letterSpacing:-.4,...nn(ln(e.slots))},detailRow:{flexDirection:"row",alignItems:"baseline",justifyContent:"space-between",gap:n.lg},detailValue:{flexShrink:1,textAlign:"right",...o(l.size.body,l.lineHeight.normal,t.text.primary)},failureCard:{borderRadius:i.lg-n.xs,borderWidth:1,padding:n.md+n.xs/2,gap:n.md},failureCritical:{borderColor:t.badgeBgCritical,backgroundColor:t.badgeBgCritical},failureCaution:{borderColor:t.badgeBgCaution,backgroundColor:t.badgeBgCaution},failureTitle:{...o(l.size.body,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold")},failureTitleCritical:{color:t.danger},failureTitleCaution:{color:t.warningStrong},emailBlock:{gap:n.sm},callBlock:{gap:n.sm},block:{gap:n.sm},statusRow:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:n.sm},confirmTitle:{...o(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold")}})}var Np=(e,t=4e3)=>typeof e=="string"&&e.trim().length>0&&e.length<=t?e.trim():null;function Wp(e){let t=Np(e,2048);return t===null?null:/^https:\/\/[^\s]+$/i.test(t)?t:null}var Up=6;function Gp(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=400?e:null}function Kp(e,t,r){if(!Array.isArray(e))/* @__PURE__ */return Object.freeze([]);let n=[];for(let i of e){if(n.length>=r)break;if(i===null||typeof i!="object"||Array.isArray(i))continue;let e=t(i);e!==null&&n.push(e)}/* @__PURE__ */
757
+ /* @__PURE__ */n.jsx(Pill,{label:Ku.keepRequest,kind:"outline",disabled:b.busy,onPress:b.keepRequest,testID:"records-revoke-keep"})]}):/* @__PURE__ */n.jsx(Pill,{label:zn.cancel,kind:"danger",disabled:b.busy,onPress:b.askRevoke,testID:"records-revoke"}):null]})}function Fp(){let t=useEverfurTheme(),r=Xl();return e.useMemo(()=>r===null?qp(t):El(qp(t),Mp(r)),[t,r])}function Mp(e){return{card:Ol(e),cardTitle:e.cardTitle,confirmTitle:e.cardTitle,readyCta:{minHeight:e.button.minHeight}}}function qp(e){let{color:t,space:n,radius:i,type:l}=e,o=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:Math.round(t*r),color:n});return r.StyleSheet.create({content:{paddingHorizontal:n.lg,paddingBottom:n.xxl,gap:n.lg+n.xs/2},readyCta:{minHeight:n.xxl+n.lg+n.xs/2},sent:{gap:n.xs},card:{borderRadius:i.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,padding:n.lg,gap:n.md,...rn(ln(e.slots),1)},cardTitle:{...o(l.size.subtitle,l.lineHeight.snug,t.brandInk,"bold"),...headingFace(e,"bold"),letterSpacing:-.4,...nn(ln(e.slots))},detailRow:{flexDirection:"row",alignItems:"baseline",justifyContent:"space-between",gap:n.lg},detailValue:{flexShrink:1,textAlign:"right",...o(l.size.body,l.lineHeight.normal,t.text.primary)},failureCard:{borderRadius:i.lg-n.xs,borderWidth:1,padding:n.md+n.xs/2,gap:n.md},failureCritical:{borderColor:t.badgeBgCritical,backgroundColor:t.badgeBgCritical},failureCaution:{borderColor:t.badgeBgCaution,backgroundColor:t.badgeBgCaution},failureTitle:{...o(l.size.body,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold")},failureTitleCritical:{color:t.danger},failureTitleCaution:{color:t.warningStrong},emailBlock:{gap:n.sm},callBlock:{gap:n.sm},block:{gap:n.sm},statusRow:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:n.sm},confirmTitle:{...o(l.size.subtitle,l.lineHeight.snug,t.text.primary,"bold"),...headingFace(e,"bold")}})}var Np=(e,t=4e3)=>typeof e=="string"&&e.trim().length>0&&e.length<=t?e.trim():null;function Wp(e){let t=Np(e,2048);return t===null?null:/^https:\/\/[^\s]+$/i.test(t)?t:null}var Up=6;function Gp(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=400?e:null}function Kp(e,t,r){if(!Array.isArray(e))/* @__PURE__ */return Object.freeze([]);let n=[];for(let i of e){if(n.length>=r)break;if(i===null||typeof i!="object"||Array.isArray(i))continue;let e=t(i);e!==null&&n.push(e)}/* @__PURE__ */
758
758
  return Object.freeze(n)}function Yp(e){let t=Np(e.title,80),r=Np(e.body,600);return t===null||r===null?null:/* @__PURE__ */Object.freeze({title:t,body:r})}function Xp(e){if(e===null||typeof e!="object"||Array.isArray(e))return;let t=e,r=[];if(Array.isArray(t.gallery))for(let e of t.gallery){let t=Wp(e);t!==null&&r.length<Up&&r.push(t)}let n=Kp(t.doses,e=>{let t=Np(e.label,60),r=Np(e.amount,60);return t===null||r===null?null:/* @__PURE__ */Object.freeze({label:t,amount:r,minLb:Gp(e.minLb??e.min_lb),maxLb:Gp(e.maxLb??e.max_lb)})},Up),i=Kp(t.details,Yp,Up),l=t.fit,o=l!==null&&typeof l=="object"&&!Array.isArray(l)?Yp(l):null,a=o!==null&&l.pet===true?/* @__PURE__ */Object.freeze({...o,pet:true}):o,s=/* @__PURE__ */Object.freeze({kicker:Np(t.kicker,80),gallery:/* @__PURE__ */Object.freeze(r),doses:n,details:i,fine:Np(t.fine,300),fit:a});return s.kicker===null&&r.length===0&&n.length===0&&i.length===0&&s.fine===null&&a===null?void 0:s}var Qp=128;var Jp=/* @__PURE__ */new Set(["shield","arrow","check","star","truck","refresh","card","alert","x","chat","repeat","calendar","flame","box","cart","minus","plus","chev","pulse","file","kit","dna","heart","bottle","harness","ramp"]),Zp=/* @__PURE__ */new Set(["y","c","g","r"]),eg=/* @__PURE__ */new Set(["done","now","next"]),tg=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null,rg=(e,t=1e3)=>typeof e=="string"&&e.trim().length>0&&e.length<=t?e.trim():null,ng=e=>typeof e=="string"&&/^[A-Za-z0-9_-]{1,40}$/.test(e)?e:null,ig=e=>typeof e=="string"&&Jp.has(e)?e:null;function lg(e){let t=rg(e,2048);return t===null||/\s/.test(t)?null:/^https:\/\/[^/]/i.test(t)||/^\/(?![/\\])/.test(t)?t:null}var og=e=>typeof e=="number"&&Number.isInteger(e)?String(e):rg(e,Qp);function ag(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:null}function sg(e){/* @__PURE__ */
759
759
  return Object.freeze(Object.fromEntries(Object.entries(e).filter(([,e])=>e!=null)))}function dg(e,t,r=20){if(!Array.isArray(e))return null;let n=[];for(let i of e){if(n.length>=r)break;let e=t(i);e!==null&&n.push(e)}return n.length===0?null:/* @__PURE__ */Object.freeze(n)}var cg=(e,t=12,r=300)=>dg(e,e=>rg(e,r),t);function ug(e){let t=tg(e),r=rg(t?.kicker,120),n=rg(t?.title,300);if(t===null||r===null||n===null)return null;let i=tg(t.risk),l=tg(t.odds),o=tg(t.quote),a=tg(t.jump);return sg({kicker:r,title:n,sources:dg(t.sources,e=>{let t=rg(tg(e)?.label,60);return t===null?null:sg({label:t,kind:ng(tg(e)?.kind)})},6),risk:rg(i?.lead,300)===null?null:sg({lead:rg(i?.lead,300),body:rg(i?.body),kind:ng(i?.kind)}),odds:rg(l?.label,120)===null||rg(l?.from,20)===null||rg(l?.to,20)===null?null:sg({label:rg(l?.label,120),tag:rg(l?.tag,40),from:rg(l?.from,20),to:rg(l?.to,20),toLabel:rg(l?.toLabel,120)}),quote:rg(o?.text)===null?null:sg({kicker:rg(o?.kicker,120),tag:rg(o?.tag,40),text:rg(o?.text)}),jump:rg(a?.title,300)===null||rg(a?.go,60)===null?null:sg({title:rg(a?.title,300),go:rg(a?.go,60)}),report:hg(t.report)})}function hg(e){let t=tg(e),r=rg(t?.label,120),n=rg(t?.text,1200);return r===null||n===null?null:sg({label:r,text:n,actions:cg(t?.actions,5,300)})}function pg(e){let t=tg(e),r=rg(t?.title,300),n=dg(t?.steps,e=>{let t=tg(e),r=rg(t?.title,300),n=t?.tone;return r===null?null:sg({title:r,body:rg(t?.body),source:rg(t?.source,200),tone:typeof n=="string"&&Zp.has(n)?n:null,icon:ig(t?.icon),fromVet:t?.fromVet===true?true:null})});return r===null||n===null?null:sg({title:r,label:rg(t?.label,60),steps:n})}function gg(e){let t=tg(e),r=rg(t?.title,300);if(t===null||r===null)return null;let n=tg(t.rating),i=tg(t.reviews),l=tg(t.why),o=tg(l?.score),a=tg(t.dose),s=tg(t.ingredients),d=dg(i?.items,e=>{let t=tg(e),r=t?.stars,n=rg(t?.text),i=rg(t?.by,80);return typeof r!="number"||!Number.isFinite(r)||r<1||r>5||n===null||i===null?null:sg({stars:Math.round(r),text:n,by:i})},5),c=dg(l?.rows,e=>{let t=tg(e),r=rg(t?.chip,40),n=rg(t?.title,300);return r===null||n===null?null:sg({chip:r,kind:ng(t?.kind),title:n,body:rg(t?.body)})}),u=dg(a?.stats,e=>{let t=tg(e),r=rg(t?.value,40),n=rg(t?.label,120),i=t?.kind;return r===null||n===null?null:sg({value:r,label:n,kind:i==="weight"||i==="dose"||i==="days"?i:null})},6),h=cg(s?.items,12,80);return sg({title:r,none:t.none===true?true:null,hidden:t.none===true&&t.hidden===true?true:null,productId:og(t.productId),partnerSku:rg(t.partnerSku,200),rating:rg(n?.value,20)===null?null:sg({value:rg(n?.value,20),label:rg(n?.label,120)}),line:rg(t.line),reviews:rg(i?.label,200)===null||d===null?null:sg({label:rg(i?.label,200),items:d}),checkoutLine:rg(t.checkoutLine,300),why:rg(l?.title,200)===null||c===null?null:sg({title:rg(l?.title,200),rows:c,score:rg(o?.text,200)===null||rg(o?.value,20)===null?null:sg({text:rg(o?.text,200),value:rg(o?.value,20)})}),dose:rg(a?.title,200)===null||u===null?null:sg({title:rg(a?.title,200),stats:u,note:rg(a?.note)}),doseLabel:rg(t.doseLabel,120),ingredients:h===null?null:sg({label:rg(s?.label,200),items:h}),proof:rg(t.proof,300),trust:dg(t.trust,e=>{let t=tg(e),r=ig(t?.icon),n=rg(t?.label,120);return r===null||n===null?null:sg({icon:r,label:n})},6),more:rg(t.more,120),fine:rg(t.fine),checkin:rg(t.checkin,200),detail:Xp(t.detail)??null})}function fg(e){let t=tg(e),r=rg(t?.title,200),n=dg(t?.items,e=>{let t=tg(e),r=rg(t?.title,300),n=rg(t?.body);return r===null||n===null?null:sg({title:r,body:n,urgent:t?.urgent===true?true:null,callVet:t?.callVet===true?true:null})});return r===null||n===null?null:sg({title:r,items:n})}function mg(e){let t=tg(e),r=rg(t?.title,200),n=cg(t?.questions,12,300),i=rg(t?.add,80),l=rg(t?.added,80);return r===null||n===null||i===null||l===null?null:sg({title:r,questions:n,add:i,added:l})}function bg(e){let t=tg(e),r=rg(t?.title,200),n=dg(t?.items,e=>{let t=tg(e),r=rg(t?.key,Qp),n=rg(t?.title,300),i=rg(t?.action,80),l=og(t?.productId),o=rg(t?.added,80)??(l!==null?i:null);return r===null||n===null||i===null||o===null?null:sg({key:r,productId:l,title:n,body:rg(t?.body),price:rg(t?.price,40),was:rg(t?.was,40),tag:rg(t?.tag,40),imageUrl:lg(t?.imageUrl),icon:ig(t?.icon),kind:ng(t?.kind),action:i,added:o,owned:t?.owned===true?true:null,detail:Xp(t?.detail)??null})},6);return r===null||n===null?null:sg({title:r,items:n})}function yg(e){let t=tg(e),r=rg(t?.kicker,120),n=rg(t?.title,120);return t===null||r===null||n===null?null:sg({kicker:r,title:n,icon:ig(t.icon),track:dg(t.track,e=>{let t=tg(e),r=rg(t?.title,120),n=t?.state;return r===null?null:sg({title:r,detail:rg(t?.detail,120),state:typeof n=="string"&&eg.has(n)?n:null,tag:rg(t?.tag,40)})},6),heading:rg(t.heading,200),rows:dg(t.rows,e=>{let t=tg(e),r=ig(t?.icon),n=rg(t?.label,120);if(r===null||n===null)return null;if(t?.fromVet===true)return sg({icon:r,label:n,text:"",fromVet:true});let i=rg(t?.text,300);return i===null?null:sg({icon:r,label:n,text:i})},6),note:rg(t.note,300),action:rg(t.action,80)})}function healthPlanFocusDesignFromWire(e){let t=tg(e),r=rg(t?.title,300),n=gg(t?.pick);if(t===null||r===null||n===null)return null;let i=tg(t.byline);return sg({eyebrow:rg(t.eyebrow,120),title:r,subtitle:rg(t.subtitle,300),subtitleNoRecords:rg(t.subtitleNoRecords,300),headImageUrl:lg(t.headImageUrl),byline:rg(i?.name,120)===null?null:sg({name:rg(i?.name,120),role:rg(i?.role,120),imageUrl:lg(i?.imageUrl),shortName:rg(i?.shortName,60)}),focus:ug(t.focus),routine:pg(t.routine),pick:n,signs:fg(t.signs),checkup:mg(t.checkup),extras:bg(t.extras),wait:yg(t.wait),fine:rg(t.fine),checkoutRows:dg(t.checkoutRows,e=>{let t=tg(e),r=ig(t?.icon),n=rg(t?.label,60),i=rg(t?.value,200);return r===null||n===null||i===null?null:sg({icon:r,label:n,value:i})},6)})}function healthPlanPageFromWire(e,petRef){let t=tg(e);if(t===null||!("page"in t))return null;let r=tg(t.pet),n=r?.sex;/* @__PURE__ */
760
- return Object.freeze({petRef:rg(t.pet_ref,Qp)??petRef,pet:/* @__PURE__ */Object.freeze({name:rg(r?.name,120),species:rg(r?.species,60),sex:n==="female"||n==="male"?n:null,breed:rg(r?.breed,120),weightKg:ag(r?.weight_kg),weightLb:ag(r?.weight_lb)}),checkout:t.checkout==="everfur_stripe"?"everfur_stripe":"partner",page:healthPlanFocusDesignFromWire(t.page),vetReviewed:t.vet_reviewed===true,trackingTextsEnabled:t.tracking_texts_enabled===true})}function xg(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function wg(e){return makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:`${e}: the response was not the expected shape`})}function vg(e){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${e} was called after unmount`})}var kg=e=>typeof e=="string"&&e.length>0&&e.length<=Qp;function jg(petRef){return`/widget/v1/pets/${encodeURIComponent(petRef)}/plan`}async function Sg(e,petRef,t){if(!kg(petRef))return err(xg("petRef must be 1..128 characters"));let r=await e.send("healthPlan.page.read",{method:"GET",path:`${jg(petRef)}/page`,...t?.signal?{signal:t.signal}:{}});if(!r.ok)return err(r.error);let n=healthPlanPageFromWire(r.value,petRef);return n===null?err(wg("healthPlan.page.read")):ok(n)}var Cg=/* @__PURE__ */new WeakMap;function Rg(e){let t=Cg.get(e);if(t!==void 0)return t;let r=Tg(e);return Cg.set(e,r),r}function Tg(e){return{getPage:(petRef,t)=>{if(e.isDisposed)return Promise.resolve(err(vg("getPage")));let{services:r}=e.registry,n=Et(createRequestFunnel({auth:r.authFor(null),...r.errorPolicy?{errorPolicy:r.errorPolicy}:{}}));return Sg(n,petRef,t)}}}var _g=6e4;function zg({lifecycle:t,refreshKey:r,readyAt:n,revalidate:i,refresh:l,now:o=Date.now}){let a=e.useRef({readyAt:n,revalidate:i,refresh:l??i,now:o});a.current={readyAt:n,revalidate:i,refresh:l??i,now:o},e.useEffect(()=>{if(t==null)return;let e=br(()=>t.onForeground(()=>{let{readyAt:e,revalidate:t,now:r}=a.current;e!==null&&r()-e>=_g&&t()}));return()=>{typeof e=="function"&&br(e)}},[t]);let s=e.useRef(r);e.useEffect(()=>{Object.is(s.current,r)||(s.current=r,a.current.refresh())},[r])}var Ig=_g,Dg=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanPageReads@v1");function Hg(){let e=globalThis,t=e[Dg];if(t instanceof WeakMap)return t;let r=/* @__PURE__ */new WeakMap;return e[Dg]=r,r}function Vg(e,t,userRef,petRef,r){let n=Hg(),i=n.get(t);i===void 0&&(i=/* @__PURE__ */new Map,n.set(t,i));let l=i,o=`${userRef}\0${petRef}`,a=l.get(o);if(!r&&a!==void 0&&(a.at===null||Date.now()-a.at<Ig))return a.promise;let s={at:null,promise:e.getPage(petRef).then(e=>(l.get(o)===s&&(e.ok||Vt(e.error)?s.at=Date.now():l.delete(o)),e))};return l.set(o,s),s.promise}function useHealthPlanPage(t){let{userRef:userRef,runtime:r}=Xt(),n=e.useMemo(()=>Rg(r),[r]),i=t.repository,l=i??n,o=e.useCallback((e,t)=>i!==void 0||userRef==null?l.getPage(e):Vg(n,r,userRef,e,t),[i,l,n,r,userRef]),{petRef:petRef}=t,a=t.enabled!==false&&userRef!=null&&petRef!==null,[s,d]=e.useState({phase:"idle",petRef:null,page:null,error:null}),c=e.useRef(0),u=e.useRef(0),h=e.useCallback(async e=>{let t=++c.current;if(!a||petRef===null){d(e=>e.phase==="idle"&&e.petRef===null?e:{phase:"idle",petRef:null,page:null,error:null});return}d(e=>({phase:"loading",petRef:petRef,page:e.petRef===petRef?e.page:null,error:null}));let r=await o(petRef,e);t===c.current&&(r.ok?d({phase:"ready",petRef:petRef,page:r.value,error:null,readyAt:Date.now()}):Vt(r.error)?d({phase:"ready",petRef:petRef,page:null,error:null,missing:true,readyAt:Date.now()}):d({phase:"failed",petRef:petRef,page:null,error:r.error}))},[a,petRef,o]),p=e.useCallback(()=>h(true),[h]),g=s.phase==="ready"&&s.petRef===petRef,f=e.useCallback(async()=>{if(!a||petRef===null||!g)return;let e=c.current,t=++u.current,r=await o(petRef,true);e!==c.current||t!==u.current||!r.ok||d(e=>e.phase==="ready"&&e.petRef===petRef?{phase:"ready",petRef:petRef,page:r.value,error:null,readyAt:Date.now()}:e)},[a,petRef,g,o]);zg({lifecycle:t.lifecycle,refreshKey:t.refreshKey,readyAt:g?s.readyAt??null:null,revalidate:()=>{f()},refresh:()=>{g?f():p()}}),e.useEffect(()=>(h(false),()=>{c.current+=1}),[h]);let m=a&&s.petRef!==petRef;return e.useMemo(()=>({phase:m?"loading":s.phase,page:m?null:s.page,error:m?null:s.error,missing:!m&&s.missing===true,refresh:p}),[m,s,p])}var Pg=/* @__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(Pg,t)?Pg[t]:null}var Lg=50,Eg=128,Og=120,Ag=120,$g=2e3,Bg=120,Fg=80,Mg=/* @__PURE__ */new Set(["male","female","unknown"]),qg=/* @__PURE__ */new Set(["day","month","year"]),Ng=/* @__PURE__ */new Set(["low","medium","high","athletic"]),Wg=/* @__PURE__ */new Set(["indoor","outdoor","both"]),Ug=/* @__PURE__ */new Set(["mild","moderate","severe"]),Gg=/^(\d{4})-(\d{2})-(\d{2})$/,Kg=[["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"]],Yg=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...Kg,...Yg].map(([e])=>e));function Xg(e){let t=Gg.exec(e);if(t===null)return false;let[r,n,i]=[Number(t[1]),Number(t[2]),Number(t[3])],l=new Date(Date.UTC(r,n-1,i));return l.getUTCFullYear()===r&&l.getUTCMonth()===n-1&&l.getUTCDate()===i}var Qg=e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,Jg=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Zg=(e,t)=>typeof t=="string"&&Xg(t)?null:`${e} must be a real date written YYYY-MM-DD`,ef=(e,t={})=>(r,n)=>{if(typeof n!="string")return`${r} must be a string`;if(Dt(n))return`${r} contains an unpaired surrogate and cannot be encoded`;let i=t.trimmed?n.trim():n;if(t.required&&i.length===0)return`${r} is required and must not be blank`;let l=Ht(i);return l<=e?null:`${r} is ${l} characters; the server accepts at most ${e}`},tf={sex:Qg(Mg),spayedNeutered:Jg,birthDate:Zg,birthDatePrecision:Qg(qg),activityLevel:Qg(Ng),indoorOutdoor:Qg(Wg),foodBrand:ef(Bg),foodType:ef(Bg),microchipId:ef(Fg)},rf=["ref","ref",false,ef(Eg,{required:true,trimmed:true})],nf=["notes","notes",false,ef($g,{trimmed:true})],lf=[rf,["name","name",true,ef(Og,{required:true,trimmed:true})],["dose","dose",false,ef(Ag,{trimmed:true})],["frequency","frequency",false,ef(Ag,{trimmed:true})],["startDate","start_date",false,Zg],["endDate","end_date",false,Zg],nf],of={allergies:[rf,["allergen","allergen",true,ef(Og,{required:true,trimmed:true})],["severity","severity",false,Qg(Ug)],nf],medications:lf,supplements:lf,conditions:[rf,["conditionName","condition_name",true,ef(Og,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Zg],nf]};function af(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return{error:`${n} must be an object`};let i=r,l={};for(let[t,r,o,a]of of[e]){let e=i[t];if(e==null){if(o)return{error:`${n}.${t} is required`};e===null&&(l[r]=null);continue}let s=a(`${n}.${t}`,e);if(s!==null)return{error:s};l[r]=e}let o=l.start_date,a=l.end_date;return typeof o=="string"&&typeof a=="string"&&a<o?{error:`${n}.endDate must not be before startDate`}:{item:l}}function sf(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>Lg)return{error:`${e} has ${t.length} items; the server accepts at most ${Lg}`};let r=[],n=/* @__PURE__ */new Set;for(let i=0;i<t.length;i+=1){let l=af(e,i,t[i]);if("error"in l)return l;let o=l.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(l.item)}return{items:r}}function df(e,t){let r=e,n={};for(let[e,t]of Kg){let i=r[e];if(i!==void 0){if(i!==null){let t=tf[e](e,i);if(t!==null)return{error:t}}n[t]=i}}let i=r.birthDate!==void 0,l=r.birthDatePrecision!==void 0;if(i!==l||i&&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 Yg){let i=r[e];if(i===void 0)continue;let l=sf(e,i);if("error"in l)return l;n[t]=l.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 cf=e=>typeof e=="string"?e:null,uf=(e,t)=>typeof t=="string"&&e.has(t)?t:null,hf=e=>typeof e=="boolean"?e:null;function pf(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 gf(e){let t=cf(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:cf(e.ref),name:t,dose:cf(e.dose),frequency:cf(e.frequency),startDate:cf(e.start_date),endDate:cf(e.end_date),notes:cf(e.notes)})}function ff(e){let t=e.profile_version;/* @__PURE__ */
760
+ return Object.freeze({petRef:rg(t.pet_ref,Qp)??petRef,pet:/* @__PURE__ */Object.freeze({name:rg(r?.name,120),species:rg(r?.species,60),sex:n==="female"||n==="male"?n:null,breed:rg(r?.breed,120),weightKg:ag(r?.weight_kg),weightLb:ag(r?.weight_lb)}),checkout:t.checkout==="everfur_stripe"?"everfur_stripe":"partner",page:healthPlanFocusDesignFromWire(t.page),vetReviewed:t.vet_reviewed===true,trackingTextsEnabled:t.tracking_texts_enabled===true})}function xg(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function wg(e){return makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:`${e}: the response was not the expected shape`})}function vg(e){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${e} was called after unmount`})}var kg=e=>typeof e=="string"&&e.length>0&&e.length<=Qp;function jg(petRef){return`/widget/v1/pets/${encodeURIComponent(petRef)}/plan`}async function Sg(e,petRef,t){if(!kg(petRef))return err(xg("petRef must be 1..128 characters"));let r=await e.send("healthPlan.page.read",{method:"GET",path:`${jg(petRef)}/page`,...t?.signal?{signal:t.signal}:{}});if(!r.ok)return err(r.error);let n=healthPlanPageFromWire(r.value,petRef);return n===null?err(wg("healthPlan.page.read")):ok(n)}var Cg=/* @__PURE__ */new WeakMap;function Rg(e){let t=Cg.get(e);if(t!==void 0)return t;let r=Tg(e);return Cg.set(e,r),r}function Tg(e){return{getPage:(petRef,t)=>{if(e.isDisposed)return Promise.resolve(err(vg("getPage")));let{services:r}=e.registry,n=Ot(createRequestFunnel({auth:r.authFor(null),...r.errorPolicy?{errorPolicy:r.errorPolicy}:{}}));return Sg(n,petRef,t)}}}var _g=6e4;function zg({lifecycle:t,refreshKey:r,readyAt:n,revalidate:i,refresh:l,now:o=Date.now}){let a=e.useRef({readyAt:n,revalidate:i,refresh:l??i,now:o});a.current={readyAt:n,revalidate:i,refresh:l??i,now:o},e.useEffect(()=>{if(t==null)return;let e=br(()=>t.onForeground(()=>{let{readyAt:e,revalidate:t,now:r}=a.current;e!==null&&r()-e>=_g&&t()}));return()=>{typeof e=="function"&&br(e)}},[t]);let s=e.useRef(r);e.useEffect(()=>{Object.is(s.current,r)||(s.current=r,a.current.refresh())},[r])}var Ig=_g,Dg=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanPageReads@v1");function Hg(){let e=globalThis,t=e[Dg];if(t instanceof WeakMap)return t;let r=/* @__PURE__ */new WeakMap;return e[Dg]=r,r}function Vg(e,t,userRef,petRef,r){let n=Hg(),i=n.get(t);i===void 0&&(i=/* @__PURE__ */new Map,n.set(t,i));let l=i,o=`${userRef}\0${petRef}`,a=l.get(o);if(!r&&a!==void 0&&(a.at===null||Date.now()-a.at<Ig))return a.promise;let s={at:null,promise:e.getPage(petRef).then(e=>(l.get(o)===s&&(e.ok||Vt(e.error)?s.at=Date.now():l.delete(o)),e))};return l.set(o,s),s.promise}function useHealthPlanPage(t){let{userRef:userRef,runtime:r}=Xt(),n=e.useMemo(()=>Rg(r),[r]),i=t.repository,l=i??n,o=e.useCallback((e,t)=>i!==void 0||userRef==null?l.getPage(e):Vg(n,r,userRef,e,t),[i,l,n,r,userRef]),{petRef:petRef}=t,a=t.enabled!==false&&userRef!=null&&petRef!==null,[s,d]=e.useState({phase:"idle",petRef:null,page:null,error:null}),c=e.useRef(0),u=e.useRef(0),h=e.useCallback(async e=>{let t=++c.current;if(!a||petRef===null){d(e=>e.phase==="idle"&&e.petRef===null?e:{phase:"idle",petRef:null,page:null,error:null});return}d(e=>({phase:"loading",petRef:petRef,page:e.petRef===petRef?e.page:null,error:null}));let r=await o(petRef,e);t===c.current&&(r.ok?d({phase:"ready",petRef:petRef,page:r.value,error:null,readyAt:Date.now()}):Vt(r.error)?d({phase:"ready",petRef:petRef,page:null,error:null,missing:true,readyAt:Date.now()}):d({phase:"failed",petRef:petRef,page:null,error:r.error}))},[a,petRef,o]),p=e.useCallback(()=>h(true),[h]),g=s.phase==="ready"&&s.petRef===petRef,f=e.useCallback(async()=>{if(!a||petRef===null||!g)return;let e=c.current,t=++u.current,r=await o(petRef,true);e!==c.current||t!==u.current||!r.ok||d(e=>e.phase==="ready"&&e.petRef===petRef?{phase:"ready",petRef:petRef,page:r.value,error:null,readyAt:Date.now()}:e)},[a,petRef,g,o]);zg({lifecycle:t.lifecycle,refreshKey:t.refreshKey,readyAt:g?s.readyAt??null:null,revalidate:()=>{f()},refresh:()=>{g?f():p()}}),e.useEffect(()=>(h(false),()=>{c.current+=1}),[h]);let m=a&&s.petRef!==petRef;return e.useMemo(()=>({phase:m?"loading":s.phase,page:m?null:s.page,error:m?null:s.error,missing:!m&&s.missing===true,refresh:p}),[m,s,p])}var Pg=/* @__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(Pg,t)?Pg[t]:null}var Lg=50,Og=128,Eg=120,Ag=120,$g=2e3,Bg=120,Fg=80,Mg=/* @__PURE__ */new Set(["male","female","unknown"]),qg=/* @__PURE__ */new Set(["day","month","year"]),Ng=/* @__PURE__ */new Set(["low","medium","high","athletic"]),Wg=/* @__PURE__ */new Set(["indoor","outdoor","both"]),Ug=/* @__PURE__ */new Set(["mild","moderate","severe"]),Gg=/^(\d{4})-(\d{2})-(\d{2})$/,Kg=[["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"]],Yg=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...Kg,...Yg].map(([e])=>e));function Xg(e){let t=Gg.exec(e);if(t===null)return false;let[r,n,i]=[Number(t[1]),Number(t[2]),Number(t[3])],l=new Date(Date.UTC(r,n-1,i));return l.getUTCFullYear()===r&&l.getUTCMonth()===n-1&&l.getUTCDate()===i}var Qg=e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,Jg=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Zg=(e,t)=>typeof t=="string"&&Xg(t)?null:`${e} must be a real date written YYYY-MM-DD`,ef=(e,t={})=>(r,n)=>{if(typeof n!="string")return`${r} must be a string`;if(Dt(n))return`${r} contains an unpaired surrogate and cannot be encoded`;let i=t.trimmed?n.trim():n;if(t.required&&i.length===0)return`${r} is required and must not be blank`;let l=Ht(i);return l<=e?null:`${r} is ${l} characters; the server accepts at most ${e}`},tf={sex:Qg(Mg),spayedNeutered:Jg,birthDate:Zg,birthDatePrecision:Qg(qg),activityLevel:Qg(Ng),indoorOutdoor:Qg(Wg),foodBrand:ef(Bg),foodType:ef(Bg),microchipId:ef(Fg)},rf=["ref","ref",false,ef(Og,{required:true,trimmed:true})],nf=["notes","notes",false,ef($g,{trimmed:true})],lf=[rf,["name","name",true,ef(Eg,{required:true,trimmed:true})],["dose","dose",false,ef(Ag,{trimmed:true})],["frequency","frequency",false,ef(Ag,{trimmed:true})],["startDate","start_date",false,Zg],["endDate","end_date",false,Zg],nf],of={allergies:[rf,["allergen","allergen",true,ef(Eg,{required:true,trimmed:true})],["severity","severity",false,Qg(Ug)],nf],medications:lf,supplements:lf,conditions:[rf,["conditionName","condition_name",true,ef(Eg,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Zg],nf]};function af(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return{error:`${n} must be an object`};let i=r,l={};for(let[t,r,o,a]of of[e]){let e=i[t];if(e==null){if(o)return{error:`${n}.${t} is required`};e===null&&(l[r]=null);continue}let s=a(`${n}.${t}`,e);if(s!==null)return{error:s};l[r]=e}let o=l.start_date,a=l.end_date;return typeof o=="string"&&typeof a=="string"&&a<o?{error:`${n}.endDate must not be before startDate`}:{item:l}}function sf(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>Lg)return{error:`${e} has ${t.length} items; the server accepts at most ${Lg}`};let r=[],n=/* @__PURE__ */new Set;for(let i=0;i<t.length;i+=1){let l=af(e,i,t[i]);if("error"in l)return l;let o=l.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(l.item)}return{items:r}}function df(e,t){let r=e,n={};for(let[e,t]of Kg){let i=r[e];if(i!==void 0){if(i!==null){let t=tf[e](e,i);if(t!==null)return{error:t}}n[t]=i}}let i=r.birthDate!==void 0,l=r.birthDatePrecision!==void 0;if(i!==l||i&&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 Yg){let i=r[e];if(i===void 0)continue;let l=sf(e,i);if("error"in l)return l;n[t]=l.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 cf=e=>typeof e=="string"?e:null,uf=(e,t)=>typeof t=="string"&&e.has(t)?t:null,hf=e=>typeof e=="boolean"?e:null;function pf(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 gf(e){let t=cf(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:cf(e.ref),name:t,dose:cf(e.dose),frequency:cf(e.frequency),startDate:cf(e.start_date),endDate:cf(e.end_date),notes:cf(e.notes)})}function ff(e){let t=e.profile_version;/* @__PURE__ */
761
761
  return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:uf(Mg,e.sex),spayedNeutered:hf(e.spayed_neutered),birthDate:cf(e.birth_date),birthDatePrecision:uf(qg,e.birth_date_precision),activityLevel:uf(Ng,e.activity_level),indoorOutdoor:uf(Wg,e.indoor_outdoor),foodBrand:cf(e.food_brand),foodType:cf(e.food_type),microchipId:cf(e.microchip_id),allergies:pf(e.allergies,e=>{let t=cf(e.allergen);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:cf(e.ref),allergen:t,severity:uf(Ug,e.severity),notes:cf(e.notes)})}),medications:pf(e.medications,gf),supplements:pf(e.supplements,gf),conditions:pf(e.conditions,e=>{let t=cf(e.condition_name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:cf(e.ref),conditionName:t,diagnosedDate:cf(e.diagnosed_date),notes:cf(e.notes)})})})}var mf=100,bf=50,yf=100,xf=50,wf=500,vf=128,kf=6e4;function jf(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function Sf(e,t,r){if(typeof t!="string")return jf(`${e} must be a string`);let n=Ht(t);return n<=r?null:jf(`${e} is ${n} characters; the server accepts at most ${r}`)}function Cf(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:jf(`${e} must be a finite number between 0 and ${r}`)}function Rf(petRef,e){if(typeof petRef!="string")return jf("pet_ref must be a string");if(petRef.trim().length===0)return jf("pet_ref must not be blank");if(Dt(petRef))return jf("pet_ref contains an unpaired surrogate and cannot be encoded");if(e!=null&&typeof e!="object")return jf("profile must be an object");let t=[Sf("pet_ref",petRef,vf)];return e?.name!==void 0&&t.push(Sf("name",e.name,mf)),e?.species!==void 0&&t.push(Sf("species",e.species,bf)),e?.breed!==void 0&&t.push(Sf("breed",e.breed,yf)),e?.ageYears!==void 0&&t.push(Cf("age_years",e.ageYears,xf)),e?.weightKg!==void 0&&t.push(Cf("weight_kg",e.weightKg,wf)),t.find(e=>e!==null)??null}function Tf(e,t){let r=df(e,t);return"error"in r?{error:jf(r.error)}:r}function _f(e){if(typeof e!="object"||e===null)return{error:jf("patch must be an object")};let t=e,r=[["name","name",e=>Sf("name",e,mf)],["species","species",e=>Sf("species",e,bf)],["breed","breed",e=>Sf("breed",e,yf)],["ageYears","age_years",e=>Cf("age_years",e,xf)],["weightKg","weight_kg",e=>Cf("weight_kg",e,wf)]],n={};for(let[e,i,l]of r){let r=t[e];if(r!==void 0){if(r!==null){let e=l(r);if(e!==null)return{error:e}}n[i]=r}}let i=Tf(t,t.species);return"error"in i?i:(Object.assign(n,i.body),Object.keys(n).length===0?{error:jf("patch must change at least one field")}:{body:n})}function zf(e){if(e==null)return{body:{}};let t=Tf(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 If=e=>typeof e=="string"?e:null,Df=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function Hf(e,petRef){let t=typeof e=="object"&&e!==null?e:{};/* @__PURE__ */
762
762
  return Object.freeze({petRef:If(t.pet_ref)??petRef,name:If(t.name),species:If(t.species),breed:If(t.breed),ageYears:Df(t.age_years),weightKg:Df(t.weight_kg)})}function widgetPetFromWire(e){if(typeof e!="object"||e===null)return null;let t=e,petRef=If(t.pet_ref);return petRef===null||petRef.length===0?null:/* @__PURE__ */Object.freeze({petId:If(t.pet_id),petRef:petRef,name:If(t.name),species:If(t.species),breed:If(t.breed),ageYears:Df(t.age_years),weightKg:Df(t.weight_kg),updatedAt:If(t.updated_at)})}function Vf(e){let t=widgetPetFromWire(e);return t===null?null:/* @__PURE__ */Object.freeze({...t,...ff(e)})}function Pf(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];/* @__PURE__ */
763
- return Object.freeze(t.flatMap(e=>{let t=widgetPetFromWire(e);return t===null?[]:[t]}))}function createPetsRepository(e){return Lf(createRequestFunnel({auth:e}),createRequestFunnel({auth:e,unaryTimeoutMs:kf}))}function Lf(e,t=e){let r=(e,t)=>t?{...e,signal:t}:e,n=petRef=>Rf(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(Pf(n.value)):err(n.error)},async registerPet(petRef,t,r){let n=Rf(petRef,t);if(n!==null)return err(n);let i=zf(t);if("error"in i)return err(i.error);let l={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:i.body},o=await e.send("pets.registerPet",r?.signal?{...l,signal:r.signal}:l);return o.ok?ok(Hf(o.value,petRef)):err(o.error)},async updatePet(petRef,t,i){let l=n(petRef);if(typeof l!="string")return err(l);let o=_f(t);if("error"in o)return err(o.error);let a=await e.send("pets.updatePet",r({method:"PATCH",path:l,body:o.body},i?.signal));return a.ok?ok(Hf(a.value,petRef)):err(a.error)},async getPetProfile(petRef,t){let i=n(petRef);if(typeof i!="string")return err(i);let l=await e.send("pets.getPetProfile",r({method:"GET",path:`${i}/profile`},t?.signal));if(!l.ok)return err(l.error);let o=Vf(l.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 i=n(petRef);if(typeof i!="string")return err(i);let l=await e.send("pets.deletePet",r({method:"DELETE",path:i},t?.signal));return l.ok?ok(void 0):err(l.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 Ef=/* @__PURE__ */new WeakMap;function Of(e,t){let r=Ef.get(e);return r===void 0&&(r=/* @__PURE__ */new Set,Ef.set(e,r)),r.add(t),()=>{r?.delete(t)}}function useEverfurPets(){let{runtime:t,userRef:userRef,activePet:r,scopeEpoch:n}=Xt(),i=e.useMemo(()=>createPetsRepository(t.registry.services.authFor(userRef)),[t,userRef,n]),[l,o]=e.useState({repository:i,pets:[],loading:true,error:null}),a=l.repository===i?l:{pets:[],loading:true,error:null},s=e.useRef(0),d=e.useCallback(async()=>{let e=++s.current;o(e=>({...e,repository:i,loading:true,error:null,pets:e.repository===i?e.pets:[]}));let t=await i.list();e===s.current&&o(t.ok?{repository:i,pets:t.value,loading:false,error:null}:e=>({repository:i,pets:e.repository===i?e.pets:[],loading:false,error:t.error}))},[i]);e.useEffect(()=>(d(),()=>{s.current+=1}),[d]),e.useEffect(()=>Of(t,()=>{d()}),[t,d]);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:d}),[a.pets,a.loading,a.error,c,d])}var Af=()=>()=>{},$f=()=>null;function Bf(t,r){return e.useSyncExternalStore(r?.subscribe??Af,r?.get??$f,r?.get??$f)??t}var Ff=/* @__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}),Mf=/* @__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"}),qf=Object.keys(Mf),Nf="presentation",Wf="presentation.";var Uf={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"]},Gf=/* @__PURE__ */new Set(["chatFollowUpsExcludeTelevet","chatComposerMic","chatComposerUpload","recordsTopRiskLine","recordsClearResultsFilter","chatGeneralBanner","chatTextingAsk","serverSlots"]);function Kf(e,t){if(t==null)return;let r=Uf[e];return r!==void 0?typeof t=="string"&&r.includes(t)?t:void 0:Gf.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 qf){let n=Mf[e],i=Object.prototype.hasOwnProperty.call(t,n)?t[n]:t[e],l=Kf(e,i);l!==void 0&&(r[e]=l)}return Object.keys(r).length===0?null:/* @__PURE__ */Object.freeze(r)}function isPresentationFieldLocked(e,t){if(t==null)return false;let r=`${Wf}${Mf[e]}`;for(let e of t)if(e===Nf||e===r)return true;return false}function resolvePresentation(e){let t=parsePresentation(e?.server??null)??{},{safetyDisclaimerPlacement:r,...n}=t,i=r==="none"||r===void 0?n:{...n,safetyDisclaimerPlacement:r},l=parsePresentation(e?.client??null)??{},o=e?.locked?[...e.locked]:null,a={};for(let e of qf){let t=i[e],r=isPresentationFieldLocked(e,o)?void 0:l[e];a[e]=r??t??Ff[e]}/* @__PURE__ */
764
- return Object.freeze(a)}var Yf=/* @__PURE__ */Object.freeze({branding:null}),Xf=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>Yf});function Qf(e){return e?Object.keys(e).sort().map(t=>`${t}=${String(e[t])}`).join("&"):""}function useEverfurPresentation(e){return Jf(e).presentation}function Jf(t){let{runtime:r}=Xt(),n=r?.entitlements??Xf,i=e.useCallback(()=>n.getSnapshot()?.branding??null,[n]),l=Bf(e.useSyncExternalStore(n.subscribe,i,i),r?.sdkConfigHost?.branding),o=Qf(t);return e.useMemo(()=>{let e=l?.lockedFields??null;return{presentation:resolvePresentation({server:l?.presentation??null,locked:e,client:t??null}),isLocked:t=>isPresentationFieldLocked(t,e)}},[l,o])}var Zf=3600*1e3;function em(t,r=true){let[n,i]=e.useState(()=>t??Date.now()),l=e.useRef(true);return e.useEffect(()=>{if(l.current){l.current=false;return}t===void 0&&r&&i(Date.now())},[t,r]),e.useEffect(()=>{if(t!==void 0||!r)return;let e=setInterval(()=>i(Date.now()),Zf),n=()=>{document.visibilityState==="visible"&&i(Date.now())},l=typeof document<"u"&&typeof document.addEventListener=="function"?document:null;return l?.addEventListener("visibilitychange",n),()=>{clearInterval(e),l?.removeEventListener("visibilitychange",n)}},[t,r]),t??n}var tm=e=>e.charAt(0).toUpperCase()+e.slice(1);function rm(e,t){let r=e.trim(),n=r.length>0?r:bn,i=tm(n);return t==="her"?{name:n,Name:i,poss:"her",Poss:"Her",subj:"she"}:t==="his"?{name:n,Name:i,poss:"his",Poss:"His",subj:"he"}:{name:n,Name:i,poss:`${n}'s`,Poss:`${i}'s`,subj:n}}var nm=/* @__PURE__ */Object.freeze({vitalsFrom:(e,t,r)=>`Vitals from ${e.poss} ${t}, ${r}`,vitalsSource:e=>`Where ${e.name}'s vitals come from`,temperature:"Temperature",heartRate:"Heart rate",breathing:"Breathing",upcomingCare:"Upcoming care",overdueBy:e=>`Overdue · due by ${e}`,dueSoon:"Due soon",later:"Later",noDate:"No date",dueIn:(e,t)=>`Due ${e} · in ${t} ${t===1?"day":"days"}`,dueToday:e=>`Due ${e} · today`,overdueByDays:(e,t)=>`Overdue by ${t} ${t===1?"day":"days"} · due ${e}`,recordsHistory:"Records & history",labs:"Labs & bloodwork",results:"results",screenings:"Screenings",screeningsClear:"All clear",screeningsToReview:e=>`${e} to review`,noScreenings:"No screenings yet",visits:"Visits & records",timeline:"Timeline",events:e=>`${e} ${e===1?"event":"events"}`,weight:"Weight",vetVisits:e=>`${e} vet ${e===1?"visit":"visits"}`,history:"History",theirClinic:e=>`${e.Poss} clinic`,bloodPanel:"Blood panel",aboveRange:"above range",belowRange:"below range",othersInRange:"Other values in range.",addRecords:e=>`Add ${e.name}'s records`,moreThanOneClinic:"Records can come from more than one clinic over a lifetime.",visitsCount:e=>`${e} ${e===1?"visit":"visits"}`,panelsCount:e=>`${e} blood ${e===1?"panel":"panels"}`,requestFromClinic:"Request from a clinic",uploadDocument:"Upload a document",onFileNow:"On file now",firstRecord:e=>`Add ${e.name}'s first record`,firstLead:e=>`Records can come from more than one clinic over a lifetime. Start with the one ${e.subj} sees most, and this page fills in from there.`,requestFromTheirClinic:e=>`Request from ${e.poss} clinic`,requestDetail:"We send a secure request and read every page they send back.",uploadDetail:"A PDF, or a photo of a paper record.",findClinic:e=>`Find ${e.name}'s clinic`,chooseFile:"Choose a file",sayBeats:/* @__PURE__ */Object.freeze(["Hmmm","I wonder","what I may be","hiding"]),sayStill:"I wonder what I may be hiding",sample:"Sample",peekLead:e=>`A sneak peek at how ${e.name}'s records will read. Every number links back to the page it came from.`,sampleNote:e=>`Sample data until ${e.poss} records arrive.`,onTheWay:e=>`${e.Name}'s records are on the way`,clinicsTake:"Clinics usually take 2 to 5 days.",anotherClinic:"Another clinic",anotherClinicDetail:"Seen more than one vet? We ask each one.",noDueDate:"No due date on file",noLabs:e=>`No lab results on file for ${e.name} yet. They show up here when a record includes a blood or urine panel.`,noVisits:e=>`No visits in ${e.name}'s records yet. They show up here when a record includes one.`,oneReading:"One reading so far: we'll plot a trend as more come in.",takingNow:"Taking now",noCurrentMeds:"No current medications on file.",noVetTitle:e=>`When ${e.name} has a vet, start here.`,requestedFrom:e=>`Requested from ${e}. Clinics usually take 2 to 5 days.`,onTheWayFrom:(e,t)=>`${e.Name}'s records from ${t} are on the way.`,readingUpload:"We're reading the document you uploaded.",seeWhereItStands:"See where it stands",topRisk:e=>`${e.Poss} top risk`,seePlan:e=>`See ${e.poss} Health Plan`,panelOn:e=>`${e} blood panel`,latestReading:"Latest reading",rangeLine:(e,t,r)=>`range ${e} to ${t}${r?` ${r}`:""}`,noRange:"No range on the report",above:"Above",inRange:"In range",below:"Below",high:"High",belowRangePill:"Below range",changeUp:(e,t)=>`Up ${e}${t?` ${t}`:""}`,changeDown:(e,t)=>`Down ${e}${t?` ${t}`:""}`,changeSince:(e,t)=>` since ${e}, about ${t}%.`,whatIs:e=>`What ${e} is`,otherValues:e=>`Other ${e} values`,panelTitle:(e,t)=>`${e} · ${t}`,askAboutThis:"Ask about this"});var im=864e5,lm=30,om=2.20462,am=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function sm(e){if(e==null||e.length===0)return null;let t=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00Z`:e);return Number.isNaN(t)?null:t}function dm(e){let t=new Date(e);return`${am[t.getUTCMonth()]??""} ${t.getUTCDate()}`}function cm(e){return`${dm(e)}, ${new Date(e).getUTCFullYear()}`}function um(e){let t=new Date(e);return`${t.getUTCMonth()+1}/${String(t.getUTCFullYear()%100).padStart(2,"0")}`}var hm=e=>new Date(e).toISOString().slice(0,10);function pm(e){return String(Math.round(e*100)/100)}var gm=e=>Math.round(e*om*10)/10;function fm(e){let t=e.trim();return t.length<2||t[1]===t[1]?.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)}function mm(e){return/temp/i.test(e)?"temp":/heart|pulse/i.test(e)?"heart":/resp|breath/i.test(e)?"breath":null}var bm=["temp","heart","breath"],ym={temp:nm.temperature,heart:nm.heartRate,breath:nm.breathing};function xm(e){if(e===null||e.withheld)return{vitals:[],observedMs:null};let t=/* @__PURE__ */new Map;for(let r of e.entities){if(r.category!=="vital"||r.value===null||r.value.trim().length===0)continue;let e=mm(`${r.canonicalKey??""} ${r.key} ${r.label}`);if(e===null)continue;let n=sm(r.observedAt)??0,i=t.get(e);(i===void 0||n>i.ms)&&t.set(e,{value:r.value.trim(),unit:r.unit,ms:n})}let r=bm.flatMap(e=>{let r=t.get(e);return r===void 0?[]:[{kind:e,value:r.value,unit:r.unit,label:ym[e]}]}),n=[...t.values()].map(e=>e.ms).filter(e=>e>0);return{vitals:r,observedMs:n.length>0?Math.max(...n):null}}function wm(e,t){let r=hm(t);return e.find(e=>{let t=sm(e.date);return t!==null&&hm(t)===r})??null}function vm(e){return/vaccin|rabies|dhpp|booster|bordetella|lepto|lyme|parvo|distemper/i.test(e)?"efi-shield":/\b(alt|alp|lab|labs|blood|panel|bloodwork|urinalysis|chemistry|cbc)\b/i.test(e)?"efi-flask-sm":"efi-calendar"}function km(e,t){return e.map(e=>{let r=sm(e.dueAt),n=vm(e.title);if(r!==null&&r<t-im+1)return{item:e,title:e.title,when:nm.overdueBy(dm(r)),tone:"alert",pill:null,icon:n};let i=e.detail??(r===null?nm.noDueDate:cm(r));if(r===null)return{item:e,title:e.title,when:i,tone:"none",pill:null,icon:n};let l=r-t<=lm*im;return{item:e,title:e.title,when:i,tone:l?"watch":"later",pill:l?nm.dueSoon:nm.later,icon:n}})}function jm(e){return e==null?null:/above|high/i.test(e)?"above":/below|low/i.test(e)?"below":/in_range|normal|in range/i.test(e)?"in":null}var Sm=e=>Math.round(e*10)/10;function Cm(e,t){let r=`${pm(gm(e))} lb`,n=`${pm(Sm(e))} kg`;return t==="kg"?{main:n,other:r}:{main:r,other:n}}function Rm(e,t){if(e===null||e.withheld)return null;let r=e.weights.flatMap(e=>{let t=sm(e.observedOn);return t===null||e.weightKg===null?[]:[{ms:t,kg:e.weightKg}]}).sort((e,t)=>e.ms-t.ms),n=r[r.length-1];if(n===void 0)return null;let i=r.map(e=>gm(e.kg)),l=Math.min(...i),o=Math.max(...i),a=r[0]?.ms??n.ms,s=n.ms-a,d=r.map((e,r)=>({x:s>0?Math.round((3.55+93.45*(e.ms-a)/s)*100)/100:50,y:o>l?Math.round((75-50*((i[r]??l)-l)/(o-l))*10)/10:50,lb:i[r]??0,value:t==="kg"?Sm(e.kg):i[r]??0,ms:e.ms})),c=d.length<=4?d:[d[0],d[d.length-1]].filter(e=>e!==void 0),u=Cm(n.kg,t);return{latest:u.main,sub:`${u.other} · ${dm(n.ms)}`,single:d.length===1,points:d,ticks:c.map(e=>({x:e.x,label:um(e.ms)})),vetCount:d.length}}function Tm(e){let t=/* @__PURE__ */new Map;if(e===null||e.withheld)return t;for(let r of e.markers)for(let e of r.points){let n=sm(e.at);if(n===null)continue;let i=hm(n),l=t.get(i)??{ms:n,flagged:[],total:0,inRange:0,clinics:/* @__PURE__ */new Set};l.total+=1;let o=jm(e.status);o==="in"&&(l.inRange+=1),(o==="above"||o==="below")&&l.flagged.push({marker:r,point:e,ms:n,flag:o}),e.sourceClinic&&l.clinics.add(e.sourceClinic),t.set(i,l)}return t}function _m(e,t){let r=[];for(let[e,n]of t)n.flagged.forEach((t,i)=>{let l=t.point.value===null?t.point.qualitativeResult??"":pm(t.point.value),o=t.point.unit??t.marker.unit,a=n.flagged.length===1&&n.inRange===n.total-1&&n.total>1;r.push({key:`lab-${e}-${t.marker.markerId}-${i}`,ms:n.ms,date:`${dm(n.ms)} · ${nm.bloodPanel}`,title:`${t.marker.name} ${l}${o?` ${o}`:""}, ${t.flag==="above"?nm.aboveRange:nm.belowRange}`,text:a?nm.othersInRange:null,alert:true,markerId:t.marker.markerId,order:0})});let n=e.depth?.withheld===false?e.depth.encounters:[],i=e.timeline?.withheld===false?e.timeline.visits:[],l=/* @__PURE__ */new Set;n.forEach((e,t)=>{let n=sm(e.date);if(n===null)return;let o=i.find(t=>e.docId!==null&&t.docId===e.docId||sm(t.visitDate)!==null&&hm(sm(t.visitDate)??0)===hm(n))??null;o!==null&&l.add(o.visitId);let a=o?.summary?.trim()||null,s=e.type?.trim()||null,d=a??s;d!==null&&r.push({key:`enc-${e.encounterId}-${t}`,ms:n,date:a!==null&&s!==null?`${dm(n)} · ${s}`:dm(n),title:d,text:null,alert:false,markerId:null,order:1})});for(let e of i){let t=sm(e.visitDate),n=e.summary?.trim()||null;l.has(e.visitId)||t===null||n===null||r.push({key:`visit-${e.visitId}`,ms:t,date:dm(t),title:n,text:null,alert:false,markerId:null,order:1})}r.sort((e,t)=>t.ms-e.ms||e.order-t.order);let o=[];for(let e of r){let t={key:e.key,ms:e.ms,date:e.date,title:e.title,text:e.text,alert:e.alert,markerId:e.markerId},r=String(new Date(t.ms).getUTCFullYear()),n=o[o.length-1];n!==void 0&&n.year===r?n.items.push(t):o.push({year:r,items:[t]})}return{years:o,count:r.length}}function zm(e,t){let r=e.depth?.withheld===false?e.depth.encounters:[],n=t=>t?.trim()||nm.theirClinic(e.words),i=/* @__PURE__ */new Map;for(let e of r)i.set(n(e.clinicName),(i.get(n(e.clinicName))??0)+1);let l=/* @__PURE__ */new Map,o=i.size===1?[...i.keys()][0]:void 0;for(let r of t.values()){let t=r.clinics.size>0?[...r.clinics].map(n):[o??nm.theirClinic(e.words)];for(let e of t)l.set(e,(l.get(e)??0)+1)}return[.../* @__PURE__ */new Set([...i.keys(),...l.keys()])].map(e=>({label:e,detail:[(i.get(e)??0)>0?nm.visitsCount(i.get(e)??0):null,(l.get(e)??0)>0?nm.panelsCount(l.get(e)??0):null].filter(e=>e!==null).join(" · ")}))}var Im={requested:15,awaiting_clinic:35,awaiting_upload:35,received:60,parsing:75,in_review:90};function Dm(e){let t=e.filter(e=>!isTerminalStatus(e.status)).sort((e,t)=>(sm(t.updatedAt)??0)-(sm(e.updatedAt)??0))[0];if(t===void 0)return null;let r=(t.waitingExpectation?.trim()||t.statusLabel).trim();return r.length===0?null:{step:r,pct:Im[t.status]??15}}var Hm=e=>[...e].sort((e,t)=>(sm(t.updatedAt)??0)-(sm(e.updatedAt)??0)),Vm=e=>/[.!?]$/.test(e)?e:`${e}.`;function Pm(e,t){let r=Hm(t).filter(e=>!isTerminalStatus(e.status)),n=r.filter(e=>e.status==="awaiting_upload"),i=r.filter(e=>e.status!=="awaiting_upload"),l=[],o=/* @__PURE__ */new Map;for(let e of i){let t=e.clinicName?.trim()??"";e.source!=="clinic_request"||t===""||o.has(t)||o.set(t,e)}for(let[t,r]of o)l.push({key:`clinic-${t}`,text:nm.onTheWayFrom(e,t),requestId:r.id});let a=i.find(e=>e.source==="owner_provided");a!==void 0&&l.push({key:"upload",text:nm.readingUpload,requestId:a.id});let s=n[0],d=s?.statusLabel.trim()??"";return s!==void 0&&d!==""&&l.push({key:"awaiting-upload",text:Vm(d),requestId:s.id}),l}function Lm(e){return Hm(e).find(e=>!isTerminalStatus(e.status)&&e.status!=="awaiting_upload"&&e.source==="clinic_request"&&(e.clinicName?.trim()??"")!=="")?.clinicName?.trim()??null}function Em(e){if(e===null||e.withheld)return null;let t=e.medications.filter(e=>(e.drugName?.trim()??"")!=="");return t.length===0?null:{current:t.filter(e=>(e.stoppedOn?.trim()??"")==="").map(e=>{let t=[e.dose,e.frequency,e.route].map(e=>e?.trim()??"").filter(e=>e!==""),r=e.sig?.trim()||(t.length>0?t.join(" · "):null);return{key:e.medicationId,name:(e.drugName??"").trim(),detail:r}})}}function Om(e){if(e.some(e=>!isTerminalStatus(e.status)))return null;let t=[...e].sort((e,t)=>(sm(t.updatedAt)??0)-(sm(e.updatedAt)??0))[0];if(t===void 0||t.status!=="failed")return null;let r=t.statusLabel.trim();return r.length>0?r:null}function Am(e,t,r){return e!==null&&!e.withheld&&!e.isEmpty||t!==null&&!t.withheld&&t.markers.length>0?true:r!==null&&!r.withheld&&r.encounters.length>0}function $m(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;let t=Math.floor(e*12+1e-9),r=Math.floor(t/12),n=t%12;return r<=0?`${n}M`:n>0?`${r}Y ${n}M`:`${r}Y`}function Bm(e){let{record:t,depth:r,markers:n,nowMs:i}=e,l=Am(t,n,r),o=Dm(e.requests),a=Tm(n),{vitals:s,observedMs:d}=xm(t),c=r?.withheld===false?r.encounters:[],u=d===null?null:wm(c,d),h=d!==null&&u?.type?nm.vitalsFrom(e.words,fm(u.type),dm(d)):null,p=e.weightUnit??"lb",g=Rm(e.timeline,p),f=g!==null?null:e.petWeightKg,m=[e.breed?.trim()||null,$m(e.petAgeYears),g?.latest??(f!==null?Cm(f,p).main:null)].filter(e=>e!==null),b=e.timeline?.withheld===false?e.timeline.visits.length:0,y=_m(e,a),x=c.map(e=>sm(e.date)).filter(e=>e!==null),w=n?.withheld===false?n.markers:[],v=n?.featuredMarkerId??w.find(e=>jm(e.latest?.status)==="above"||jm(e.latest?.status)==="below")?.markerId??w[0]?.markerId??null;return{state:l?"full":o!==null?"onTheWay":"none",meta:m.length>0?m.join(" · "):null,vitals:s,vitalsFrom:h,due:t!==null&&!t.withheld?km(t.forwardLooking,i):[],labsCount:n?.withheld===false?n.summary?.totalMarkers??n.markers.length:0,featuredMarkerId:v,latestVisit:x.length>0?cm(Math.max(...x)):null,weight:g,history:y.years,historyCount:y.count,sources:zm(e,a),pull:o,hasVisits:c.length>0||b>0,medications:Em(e.timeline),failedRequest:o===null?Om(e.requests):null,inFlight:Pm(e.words,e.requests),requestedClinic:Lm(e.requests)}}function Fm(e){let t=e.points.filter(e=>e.value!==null);return t[t.length-1]??e.points[e.points.length-1]??null}function Mm(e){return e===null||e.refLow===null||e.refHigh===null||!Number.isFinite(e.refLow)||!Number.isFinite(e.refHigh)||e.refHigh<=e.refLow?null:{low:e.refLow,high:e.refHigh}}function qm(e,t=Fm(e)){let r=Mm(t),n=t?.unit??e.unit,i=t?.value??null;return{markerId:e.markerId,name:e.name,value:i===null?t?.qualitativeResult??"":pm(i),unit:n,range:r===null?null:`${pm(r.low)} to ${pm(r.high)}${n?` ${n}`:""}`,at:r===null||i===null?null:Math.round(Math.min(100,Math.max(0,20+60*(i-r.low)/(r.high-r.low)))),flag:jm(t?.status??e.latest?.status??null)}}function Nm(e){return e==="above"?nm.high:e==="below"?nm.belowRangePill:e==="in"?nm.inRange:null}var Wm=e=>{let t=e.replace(/\s+panel$/i,"").trim()||e;return t.length>1&&t[1]===t[1]?.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)};function Um(e,t){let r=e.markers.find(e=>e.markerId===t);if(r===void 0)return null;let n=Fm(r),i=qm(r,n),l=sm(n?.at??r.latest?.at??null),o=Mm(n),a=[l===null?null:dm(l),o===null?nm.noRange:nm.rangeLine(pm(o.low),pm(o.high),i.unit)].filter(e=>e!==null).join(" · "),s=r.points.flatMap(e=>{let t=sm(e.at);return e.value===null||t===null?[]:[{p:e,ms:t,v:e.value}]}),d=[];if(s.length>0){let e=s.map(e=>e.v),t=o?.low??Math.min(...e),r=o?.high??Math.max(...e);d=s.map((e,n)=>({x:s.length===1?50:Math.round((18+64*n/(s.length-1))*100)/100,y:r>t?Math.min(98,Math.max(2,Math.round((75-50*(e.v-t)/(r-t))*10)/10)):50,label:pm(e.v),out:jm(e.p.status)==="above"||jm(e.p.status)==="below",tick:dm(e.ms)}))}let c=s[0],u=s[s.length-1],h=null;if(c!==void 0&&u!==void 0&&s.length>=2&&u.v!==c.v){let e=Math.abs(u.v-c.v),t=c.v!==0?Math.round(e/Math.abs(c.v)*100):null,r=u.v>c.v?nm.changeUp(pm(e),i.unit):nm.changeDown(pm(e),i.unit);h=t===null?null:{lead:r,rest:nm.changeSince(dm(c.ms),t)}}let p=[],g=l===null?null:hm(l),f=e.markers.filter(e=>e.markerId!==r.markerId),m=f.filter(e=>e.panel!==null&&e.panel===r.panel);if(m.length>0&&r.panel!==null){let e=m.map(e=>qm(e));p.push({title:nm.otherValues(Wm(r.panel)),allInRange:e.every(e=>e.flag==="in"),rows:e})}if(g!==null&&l!==null){let e=/* @__PURE__ */new Map;for(let t of f){if(t.panel===null||t.panel===r.panel)continue;let n=[...t.points].reverse().find(e=>{let t=sm(e.at);return t!==null&&hm(t)===g});n!==void 0&&e.set(t.panel,[...e.get(t.panel)??[],qm(t,n)])}for(let[t,r]of e)p.push({title:nm.panelTitle(t,dm(l)),allInRange:r.every(e=>e.flag==="in"),rows:r})}return{markerId:r.markerId,name:r.name,meta:l===null?null:nm.panelOn(cm(l)),pill:Nm(i.flag),flagged:i.flag==="above"||i.flag==="below",latest:`${i.value}${i.unit?` ${i.unit}`:""}`,latestSub:a,hasRange:o!==null,chart:d,change:h,meaning:(r.meaning??"").split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e.length>0),groups:p}}var Gm=/* @__PURE__ */Object.freeze({vitalsFromLabel:e=>`Where ${e}’s vitals come from`,vitalsFrom:(e,t)=>`From ${e}’s exam, ${t}. `,examNotes:"Exam notes",onTheWayFrom:(e,t)=>`${e}’s records from ${t} are on the way.`,readingUpload:"We’re reading the document you uploaded.",uploadFormatHint:"Upload PDF records you already have, up to 25 MB each. You can pick several at once. We'll read them and add the results to your records.",uploadLimitHint:"PDFs up to 25 MB each. You can pick several at once.",results:e=>e===1?"result":"results",noScreenings:"No screenings yet",screeningsToReview:e=>`${e} to review`,screeningsClear:"All clear",noVisits:"No visits yet",oneReading:"One reading so far: we’ll plot a trend as more come in.",uploadedDocument:"Uploaded document"}),Km=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ym(e){let t=new Date(e);return`${Km[t.getUTCMonth()]??""} ${t.getUTCDate()}, ${t.getUTCFullYear()}`}function Xm(e){let t=Gm,r=e.filter(e=>(e.latest?.qualitativeResult??"").trim().length>0);if(r.length===0)return null;let n=r.filter(e=>Qm(e.latest?.status??null,e.latest?.qualitativeResult??"")),i=n[0]??r[0];return n.length>0?{label:t.screeningsToReview(n.length),flagged:true,markerId:i.markerId}:{label:t.screeningsClear,flagged:false,markerId:i.markerId}}function Qm(e,t){return e==="in_range"?false:e==="above"||e==="below"?true:/negative|not detected|clear|none/i.test(t)?false:/positive|detected|present|reactive/i.test(t)}function Jm(e){let t=e.replace(/_/g," ").trim();return t.length>0?t.charAt(0).toUpperCase()+t.slice(1):e}function Zm(e,t){if(e===null||e.withheld)return[];let r=/* @__PURE__ */new Map;if(t!==null&&!t.withheld)for(let e of t.encounters){let t=e.clinicName?.trim();e.docId!==null&&t&&r.set(e.docId,t)}return Object.values(e.documents).sort((e,t)=>(sm(t.receivedAt)??0)-(sm(e.receivedAt)??0)).slice(0,4).reverse().map(e=>{let t=sm(e.receivedAt);return{key:e.docId,name:r.get(e.docId)??Gm.uploadedDocument,meta:[e.documentClass?Jm(e.documentClass):null,t!==null?Ym(t):null].filter(e=>e!==null).join(" · ")}})}var eb=["January","February","March","April","May","June","July","August","September","October","November","December"];function tb(e){let t=new Date(e);return`${eb[t.getUTCMonth()]??""} ${t.getUTCDate()}`}function rb(e,t){if(t===null||e===null||e.withheld)return null;let r=new Date(t).toISOString().slice(0,10),n=e.encounters.find(e=>{let t=sm(e.date);return t!==null&&new Date(t).toISOString().slice(0,10)===r}),i=n?.veterinarian?.trim(),l=sm(n?.date);return i&&l!==null?{vet:i,date:tb(l)}:null}function nb(e,t){let r=Gm;return Pm(rm(e,null),t).map(t=>t.key==="upload"?{...t,text:r.readingUpload}:t.key.startsWith("clinic-")?{...t,text:r.onTheWayFrom(e,t.key.slice(7))}:t)}function ib(e){let t={url:e.url,kind:e.kind,expiresAt:e.expires_at};return typeof e.loop_duration_ms=="number"&&(t.loopDurationMs=e.loop_duration_ms),typeof e.cache_key=="string"&&e.cache_key.length>0&&(t.cacheKey=e.cache_key),/* @__PURE__ */Object.freeze(t)}function mapPetStateResponse(e){let t={};e.tiers.animation&&(t.animation=ib(e.tiers.animation)),e.tiers.image&&(t.image=ib(e.tiers.image));let r={};e.overlays.weather_alert&&(r.weatherAlert=ib(e.overlays.weather_alert));let n={category:e.category,tiers:/* @__PURE__ */Object.freeze(t),overlays:/* @__PURE__ */Object.freeze(r),idle:"bundled",ttlSeconds:e.ttl_seconds,degraded:e.degraded};return typeof e.cache_epoch=="number"&&(n.cacheEpoch=e.cache_epoch),/* @__PURE__ */Object.freeze(n)}var lb=/* @__PURE__ */t.z.enum(["webp","video"]),ob=/* @__PURE__ */t.z.enum(["health","attention","moment","activity","mood","idle"]),ab=/* @__PURE__ */t.z.object({url:/* @__PURE__ */t.z.string(),kind:/* @__PURE__ */lb.default("webp"),loop_duration_ms:/* @__PURE__ */t.z.number().nullish(),expires_at:/* @__PURE__ */t.z.string(),cache_key:/* @__PURE__ */t.z.string().nullish()}),sb=/* @__PURE__ */t.z.object({category:ob,tiers:/* @__PURE__ */t.z.object({animation:/* @__PURE__ */ab.nullish(),image:/* @__PURE__ */ab.nullish()}).default({}),overlays:/* @__PURE__ */t.z.object({weather_alert:/* @__PURE__ */ab.nullish()}).default({}),idle:/* @__PURE__ */t.z.literal("bundled").default("bundled"),ttl_seconds:/* @__PURE__ */t.z.number(),degraded:/* @__PURE__ */t.z.boolean().default(false),cache_epoch:/* @__PURE__ */t.z.number().default(0)});function parsePetStateWire(e){let t=sb.safeParse(e);return t.success?t.data:null}function createPetStateRepository(e){return db(createRequestFunnel({auth:e}))}function db(e){return{async getState(petRef,t){if(Dt(petRef))return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"pet_ref contains an unpaired surrogate and cannot be encoded"}));let r=`/widget/v1/pets/${encodeURIComponent(petRef)}/state`,n=await e.send("animations.getState",t?.signal?{method:"GET",path:r,signal:t.signal}:{method:"GET",path:r},t?.maxAttempts!==void 0?{maxAttempts:t.maxAttempts}:void 0);if(n.ok){let e=parsePetStateWire(n.value);return e===null?err(makeEverfurError("internalError",{retryable:true})):ok(mapPetStateResponse(e))}return n.error.httpStatus===404?ok(null):err(n.error)}}}var cb=/* @__PURE__ */Object.freeze({status:"loading"}),ub=/* @__PURE__ */Object.freeze({status:"none"}),hb=3e4,pb=/* @__PURE__ */Object.freeze([2e3,6e3]),gb=/* @__PURE__ */Object.freeze({animation:false,image:false});function fb(e,t,r){if(e.kind==="pending")return cb;if(e.kind==="failed"||e.value===null)return ub;let{animation:n,image:i}=e.value.tiers;return n!==void 0&&n.kind==="webp"&&!r&&!t.animation?{status:"art",url:n.url,key:n.cacheKey??n.url,animated:true}:i!==void 0&&i.kind==="webp"&&!t.image?{status:"art",url:i.url,key:i.cacheKey??i.url,animated:false}:ub}function mb(petRef,t){let r=e.useContext(Yt),n=r?.runtime??null,userRef=r?.userRef??null,i=n!==null&&userRef!==null&&petRef!==null?`${userRef}|${petRef}`:null,[l,o]=e.useState({scope:i,read:{kind:"pending"}}),[a,s]=e.useState({scope:i,failed:gb}),[d,c]=e.useState({scope:i,at:0}),u=l.scope===i?l.read:{kind:"pending"},h=u.kind==="answer"&&u.value===null,p=e.useRef({scope:i,n:0});e.useEffect(()=>{if(i===null||n===null||userRef===null||petRef===null||!t.isFocused||h)return;let e=d.scope===i?d.at:0,r=true,l=typeof AbortController=="function"?new AbortController:null,a=()=>{createPetStateRepository(n.registry.services.authFor(userRef)).getState(petRef,l?{signal:l.signal,maxAttempts:1}:{maxAttempts:1}).then(e=>{if(!r)return;if(e.ok){p.current={scope:i,n:0};let t=e.value;o(e=>t!==null&&t.degraded&&e.scope===i&&e.read.kind==="answer"&&e.read.value!==null?e:{scope:i,read:{kind:"answer",value:t}}),t!==null&&(t.degraded||s({scope:i,failed:gb}),c({scope:i,at:Date.now()+Math.max(30,t.ttlSeconds)*1e3}));return}if(e.error.httpStatus===403){o({scope:i,read:{kind:"answer",value:null}});return}let t=p.current.scope===i?p.current.n:0,n=pb[t];p.current={scope:i,n:t+1},o(e=>e.scope===i&&e.read.kind==="answer"?e:n!==void 0?{scope:i,read:{kind:"pending"}}:{scope:i,read:{kind:"failed"}}),c({scope:i,at:Date.now()+(n??hb)})})},u=Math.max(0,e-Date.now()),g=u===0?null:setTimeout(a,u);return g===null&&a(),()=>{r=false,g!==null&&clearTimeout(g),l?.abort()}},[i,n,userRef,petRef,t.isFocused,h,d]);let g=a.scope===i?a.failed:gb,f=e.useMemo(()=>i===null?ub:fb(u,g,t.reducedMotion),[i,u,g,t.reducedMotion]),m=e.useCallback(()=>{f.status==="art"&&s(e=>{let t=e.scope===i?e.failed:gb;return{scope:i,failed:f.animated?{...t,animation:true}:{...t,image:true}}})},[f,i]);return e.useMemo(()=>({art:f,onError:m}),[f,m])}var bb=/* @__PURE__ */Object.freeze({temperature:"Temperature",heartRate:"Heart rate",breathing:"Breathing",vitalsLabel:e=>`Vitals at ${e}’s last exam`,vitalLabel:(e,t,r,n=true)=>`${e}, ${t} ${r}.${n?" More about it":""}`,sayLine:"I wonder what I may be hiding",sayPhrases:["Hmmm","I wonder","what I may be","hiding"],upcomingCare:"Upcoming Care",viewAll:"View all →",dueSoon:"Due soon",later:"Later",nothingDue:e=>`Nothing due for ${e} right now.`,overdueBy:e=>`Overdue by ${e} ${e===1?"day":"days"}`,dueToday:"Due today",dueIn:e=>`Due in ${e} ${e===1?"day":"days"}`,noDueDate:"No due date on file",withDue:(e,t)=>`${e} · due ${t}`,dueOn:e=>`Due ${e}`,thisDay:(e,t)=>`${e} · this ${t}`,inWeeks:(e,t)=>`${e} · in ${t} ${t===1?"week":"weeks"}`,recordsHistory:"Records & History",labs:"Labs & bloodwork",labsA11y:(e,t)=>`Labs and bloodwork, ${e} ${t}`,labsA11yUnknown:"Labs and bloodwork",labsCountUnknown:"--",screenings:"Screenings",screeningsA11y:e=>`Screenings${e!==null?`, ${e}`:""}`,toReview:e=>`${e} to review`,allClear:"All clear",visits:"Visits & records",visitsA11y:e=>`Visits and records${e!==null?`, latest ${e}`:""}`,timeline:"Timeline",events:e=>`${e} events`,timelineA11y:e=>`Timeline${e>0?`, ${e} events`:""}`,weight:"Weight",estimatedRange:"Estimated Optimal Adult Range",noWeights:e=>`No weights on file yet. They show up here from ${e}’s vet visits.`,legendOver:["OVER","WEIGHT"],legendStable:["STABLE"],legendUnder:["UNDER","WEIGHT"],trendSummary:(e,t,r,n,i)=>`${e===1?"1 reading":`${e} readings`}, latest ${t}${e===1?"":`, trend ${r}`}.${n!==null&&i!==null?` Healthy range ${n} to ${i}.`:""}`,pointLabel:(e,t,r)=>e!==null?`${e}, ${t} ${r}`:`${t} ${r}`,addRecords:e=>`Add ${e}’s records`,moreThanOneClinic:"Records can come from more than one clinic over a lifetime.",onFileNow:"On file now",videoVisit:"Everfur video visit",requestFromClinic:"Request from a clinic",uploadDocument:"Upload a document",onTheWay:e=>`${e}’s records are on the way`,clinicsTake:"Clinics usually take 2 to 5 days.",requestSentTo:e=>e!==null?`Request sent to ${e}`:"Request sent",signedRelease:e=>`${e} · you signed the release`,waitingFor:e=>`Waiting for ${e} records`,inHealthTab:e=>`In ${e} Health tab`,everyPageRead:"Every page read: vaccines, labs, visits, meds",today:"Today",anotherClinic:"Another clinic",anotherClinicText:"Seen more than one vet? We ask each one.",uploadText:"A PDF, or a photo of a paper record.",requestTitle:e=>`${e}’s records request`,requestA11y:(e,t)=>`Records request for ${e}. ${t}`,sample:"Sample",peekLead:e=>`A sneak peek at how ${e}’s records will read. Every number links back to the page it came from.`,previousGroup:"Previous group",nextGroup:"Next group",markerGroups:"Marker groups",sampleNotTheirs:e=>`This is a sample, not ${e}’s result.`,sampleNote:e=>` Add ${e} records to see ${e} own numbers. Anything outside the range gets flagged like this, with what it measures and what to ask ${e} vet.`,columns:["Test","Result","Unit","Range"],slideOf:(e,t,r)=>`${e}, ${t} of ${r}`,high:"High",legal:mn,noVetTitle:e=>`When ${e.name} has a vet, start here.`});function yb(e){let t=Math.floor(e/12),r=e%12;return t<=0?`${r}m`:r>0?`${t}y ${r}m`:`${t}y`}var xb={cap:"Read from the lab report, page 2",who:"Chemistry panel",page:"p. 2 of 12"},wb=/* @__PURE__ */Object.freeze([{key:"liver",chip:"Liver",lead:"What the liver makes and clears.",markers:[{name:"ALT",flag:"High",what:"An enzyme found mostly in liver cells.",at:92,value:"118",unit:"U/L"},{name:"ALP",what:"An enzyme from the liver and bones.",at:33,value:"64",unit:"U/L"},{name:"GGT",what:"An enzyme tied to the liver’s bile ducts.",at:36,value:"3",unit:"U/L"},{name:"Total bilirubin",what:"A yellow pigment the liver clears.",at:33,value:"0.2",unit:"mg/dL"}],from:{...xb,rows:[{test:"ALB",result:"3.2",unit:"g/dL",range:"2.3-4.0"},{test:"ALP",result:"64",unit:"U/L",range:"23-212",lit:true},{test:"ALT",result:"118 H",unit:"U/L",range:"10-100",lit:true},{test:"BUN",result:"18",unit:"mg/dL",range:"7-27"},{test:"GGT",result:"3",unit:"U/L",range:"0-11",lit:true},{test:"T. BILI",result:"0.2",unit:"mg/dL",range:"0.0-0.9",lit:true}]}},{key:"kidney",chip:"Kidney",lead:"What the kidneys filter out and keep in balance.",markers:[{name:"BUN",what:"Protein waste the kidneys filter out.",at:53,value:"18",unit:"mg/dL"},{name:"Creatinine",what:"Muscle waste the kidneys filter out.",at:48,value:"1.1",unit:"mg/dL"},{name:"SDMA",what:"Another measure of kidney filtering.",at:59,value:"9",unit:"µg/dL"},{name:"Phosphorus",what:"A mineral the kidneys keep in balance.",at:42,value:"4.1",unit:"mg/dL"}],from:{...xb,rows:[{test:"ALT",result:"45",unit:"U/L",range:"10-100"},{test:"BUN",result:"18",unit:"mg/dL",range:"7-27",lit:true},{test:"CA",result:"10.1",unit:"mg/dL",range:"7.9-12.0"},{test:"CREA",result:"1.1",unit:"mg/dL",range:"0.5-1.8",lit:true},{test:"PHOS",result:"4.1",unit:"mg/dL",range:"2.5-6.8",lit:true},{test:"SDMA",result:"9",unit:"µg/dL",range:"0-14",lit:true}]}},{key:"blood",chip:"Blood cells",lead:"The cells that carry oxygen, fight infection and help blood clot.",markers:[{name:"Red blood cells",what:"Cells that carry oxygen around the body.",at:43,value:"6.9",unit:"M/µL"},{name:"Hemoglobin",what:"The part of red cells that holds oxygen.",at:42,value:"15.8",unit:"g/dL"},{name:"White blood cells",what:"Cells that fight infection.",at:44,value:"9.8",unit:"K/µL"},{name:"Platelets",what:"Cell fragments that help blood clot.",at:41,value:"265",unit:"K/µL"}],from:{cap:"Read from the lab report, page 3",who:"Complete blood count",page:"p. 3 of 12",rows:[{test:"HCT",result:"46",unit:"%",range:"37.3-61.7"},{test:"HGB",result:"15.8",unit:"g/dL",range:"13.1-20.5",lit:true},{test:"NEUT",result:"6.1",unit:"K/µL",range:"2.95-11.64"},{test:"PLT",result:"265",unit:"K/µL",range:"148-484",lit:true},{test:"RBC",result:"6.9",unit:"M/µL",range:"5.65-8.87",lit:true},{test:"WBC",result:"9.8",unit:"K/µL",range:"5.05-16.76",lit:true}]}},{key:"sugar",chip:"Sugar and salts",lead:"Fuel, and the salts that keep fluids, nerves and muscles steady.",markers:[{name:"Glucose",what:"Blood sugar, the body’s main fuel.",at:41,value:"96",unit:"mg/dL"},{name:"Sodium",what:"A salt that keeps fluids in balance.",at:31,value:"147",unit:"mmol/L"},{name:"Potassium",what:"A salt that helps nerves and muscles work.",at:49,value:"4.6",unit:"mmol/L"},{name:"Calcium",what:"A mineral for bones, muscles and nerves.",at:52,value:"10.1",unit:"mg/dL"}],from:{...xb,rows:[{test:"CA",result:"10.1",unit:"mg/dL",range:"7.9-12.0",lit:true},{test:"CL",result:"112",unit:"mmol/L",range:"109-122"},{test:"GLU",result:"96",unit:"mg/dL",range:"70-143",lit:true},{test:"K",result:"4.6",unit:"mmol/L",range:"3.5-5.8",lit:true},{test:"NA",result:"147",unit:"mmol/L",range:"144-160",lit:true},{test:"PHOS",result:"4.1",unit:"mg/dL",range:"2.5-6.8"}]}}]),vb=/* @__PURE__ */Object.freeze([{key:"screenings",title:"Screenings",tint:"pink",lead:"Tests that look for common problems early, and what came back.",rows:[{title:"Heartworm test",pill:"Negative",tone:"clear"},{title:"Tick panel (4Dx)",pill:"Negative",tone:"clear"}]},{key:"visits",title:"Visits & records",tint:"blue",lead:"Every visit, with the vet’s notes and the pages they came from.",rows:[{title:"Wellness exam",text:"38 pages"},{title:"Everfur video visit",text:"3 pages"}]},{key:"timeline",title:"Timeline",tint:"yellow",lead:"Her whole history in order, with what’s due next.",rows:[{title:"Rabies vaccine",pill:"Due soon",tone:"soon"},{title:"Heartworm test",text:"Apr 18"}]}]);var kb=/* @__PURE__ */Object.freeze({ink:"#10462E",go:"#07C168",muted:"#6B6B6B",line:"#E4E4E4",text:"#000000",bg:"#FFFFFF",white:"#FFFFFF",mist:"#F1F5F2",charcoal:"#3D3D3D",alert:"#C03410",alertDeep:"#6D1D14",pink:"#FFC3BC",yellow:"#F2C763",skyBlue:"#4E98C9",tintSage:"#E6ECE8",tintPink:"#FFEAE8",tintPinkSoft:"#FFF6F5",tintBlue:"#EAEEF6",tintYellow:"#FCF0D6",tintYellowEdge:"#F6D892",tintRed:"#FBF1EE",tintGo:"#DCF6EA",icoGrey:"#6B6B6B",icoSage:"#819E90",icoBlue:"#4E98C9",barTrack:"#ECECEC",pillPlainEdge:"rgba(16, 70, 46, 0.2)"}),jb=/* @__PURE__ */Object.freeze({screenTitle:/* @__PURE__ */Object.freeze({size:22,lineHeight:26.4,face:"medium",color:"ink",letterSpacing:-.33}),cardTitle:/* @__PURE__ */Object.freeze({size:18,lineHeight:22.5,face:"bold",color:"ink",letterSpacing:-.36}),body:/* @__PURE__ */Object.freeze({size:17,lineHeight:26.35,face:"regular",color:"text",letterSpacing:0}),bodySm:/* @__PURE__ */Object.freeze({size:15,lineHeight:21.75,face:"regular",color:"text",letterSpacing:0}),bodySmBold:/* @__PURE__ */Object.freeze({size:15,lineHeight:21.75,face:"bold",color:"ink",letterSpacing:0}),fine:/* @__PURE__ */Object.freeze({size:13,lineHeight:18.2,face:"regular",color:"muted",letterSpacing:0}),labelMono:/* @__PURE__ */Object.freeze({size:12,lineHeight:16.8,face:"monoBold",color:"muted",letterSpacing:.72,upper:true}),pill:/* @__PURE__ */Object.freeze({size:12,lineHeight:14.4,face:"monoBold",color:"ink",letterSpacing:.72,upper:true}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:18,face:"bold",color:"ink",letterSpacing:0}),buttonRow:/* @__PURE__ */Object.freeze({size:14,lineHeight:16.8,face:"bold",color:"ink",letterSpacing:0}),chip:/* @__PURE__ */Object.freeze({size:14,lineHeight:16.8,face:"medium",color:"ink",letterSpacing:0}),hand:/* @__PURE__ */Object.freeze({size:22,lineHeight:26.4,face:"hand",color:"ink",letterSpacing:0})}),Sb=/* @__PURE__ */Object.freeze({surface:"#FFFFFF",textPrimary:"#111111",textMuted:"#6E6660",border:"#C8BEB4",brand:"#10462E",brandSoft:"rgba(16, 70, 46, 0.1)",danger:"#B91C1C"}),Cb=/* @__PURE__ */Object.freeze({dot:24,check:12,core:10,ring:2,rowGap:12,bodyBottom:18,bodyGap:2,titleGap:8,rail:2,railMin:22,railGap:2,titleSize:14,titleLineHeight:18,dateSize:12,dateLineHeight:16,detailSize:13,detailLineHeight:17,upcomingOpacity:.7});var Rb=/* @__PURE__ */Object.freeze({screen:{gap:12,padX:16,padBottom:24,legalTop:20},hero:{nameSize:22,nameLineHeight:26,nameTracking:-.44,metaTop:2,metaLineHeight:18,metaTracking:.26,stageHeight:280,stageTop:4,grassFraction:.46,petBottom:40,petBoxHeight:224,petTop:16,sayWidth:230,sayHeight:61,sayFontSize:22,sayArcPath:"M 12 60 Q 120 -4 228 60",sayViewBox:[240,64],vitalsTop:8,vitalsLeft:8,vitalMinHeight:40,vitalPadX:8,vitalGap:6,vitalIcon:22,vitalValueSize:17,vitalUnitSize:13,lawnOverlap:26,lawnRadius:28},card:{pad:16,radius:20,border:1,headGap:8,headBottom:12},button:{md:52,sm:46,row:36,padMd:24,padSm:16,padRow:14,iconMd:22,iconSm:20,iconRow:17,edge:1.5,gap:8,mdLabel:17,textGap:6,textMinHeight:24},pill:{minHeight:24,padX:10,edgeThin:1.25,edgeThick:1.5},upcoming:{listGap:4,bleed:8,rowPadY:10,rowPadX:8,rowGap:12,rowRadius:10,icon:20,maxRows:4},tiles:{top:8,titleBottom:12,gap:12,pad:16,radius:20,innerGap:8,icon:22,chevron:20,titleLineHeight:19,footMinHeight:28,numSize:20,numLineHeight:22,numTracking:-.4,countGap:8},weight:{headGap:4,headBottom:16,numSize:32,numLineHeight:34,numTracking:-.64,numGap:8},chart:{height:176,plotTop:24,axisBand:20,rightInset:14,indicatorWidth:8,plotLeft:62,dataLeft:76,dot:6,dotRing:1.5,lineWidth:2,labelGap:7,labelMax:12,labelMin:9,labelCharWidth:.62,edgePad:4,legendX:14,legendLine:14.4,legendSize:12,legendTracking:.24,monthY:172,monthSize:12,maxTicks:5,maxValues:8,bandFrom:.3,bandTo:.7,reach:.88,bandPct:.1,lineColor:"#111111",gridColor:"#EAEAEA",bandColor:"#D8F3E3"},add:{gap:12,headGap:8,icon:26,sourcesGap:6,sourcesTop:4,sourcePadY:10,sourcePadX:14,sourceRadius:10,sourceColumnGap:12,actsGap:12,actsTop:4},peek:{top:12,headGap:12,leadTop:8,labsTop:16,chipsTop:10,chipsGap:8,slideTop:16,slideGap:4,slideLeadTop:2,slideLeadBottom:8,markerPad:12,markerGap:8,markerRadius:10,markerTopGap:12,barHeight:8,barDot:12,barDotRing:2,valueGap:4,fromMinHeight:40,fromGap:6,fromIcon:16,fromChevron:18,moreGap:12,moreTop:16,morePad:16,moreInnerGap:12,moreRadius:20,moreIcon:22,moreHeadGap:8,rowsGap:6,rowMinHeight:44,rowPadY:8,rowPadX:14,rowRadius:10,roundButton:36,chipHeight:36,chipPadX:14},onTheWay:{dot:28,titleSize:22,titleLineHeight:25,titleTracking:-.44,wayIcon:26,wayPad:16,wayRadius:20},inProgress:{radius:18,pad:18,gap:16,titleSize:16,titleLineHeight:20,statusRadius:14,statusPad:14,statusSize:13,statusLineHeight:19}});var Tb=/* @__PURE__ */new WeakMap;function _b(e){let t=Tb.get(e);if(t!==void 0)return t;let r=e.slots.primaryButton,n=/* @__PURE__ */Object.freeze({card:{borderRadius:e.radius.lg,...rn(ln(e.slots),1)},button:r===void 0?null:rn(r),buttonInk:r?.textColor,radius:r?.borderRadius===void 0?null:{borderRadius:r.borderRadius}});return Tb.set(e,n),n}function zb(){let t=useEverfurTheme();return e.useMemo(()=>_b(t),[t])}function Ib(e){let t=recordsSheetLook(e);if(t.dark)/* @__PURE__ */
765
- return Object.freeze({dark:true,bg:t.ground,white:t.card,text:t.text,muted:t.muted,line:t.line,charcoal:t.muted,ink:t.ink,fill:t.fill,onFill:t.onFill,accentOnFill:t.accentOnFill,go:t.go,alert:t.alert,alertDeep:t.alertDeep,yellow:t.watch,tintSage:t.tintSage,tintPink:t.tintPartner,tintPinkSoft:t.card,tintBlue:t.tintBlue,tintYellow:t.tintYellow,tintYellowEdge:t.watch,tintRed:t.alertTint,tintGo:t.goTint,icoGrey:t.muted,icoSage:t.chevron,icoBlue:t.wind,barTrack:t.barTrack,pillPlainEdge:t.plainEdge,chartLine:t.text,chartGrid:t.line,chartBand:t.goTint,legacyText:t.text,legacyMuted:t.muted,legacyBorder:t.line,brand:t.ink,brandSoft:al(t.ink,.1)??t.tintSage,watch:t.watch,tintPartner:t.tintPartner,mist:t.rowGround});let r=zl(e),n=r?kb.ink:t.ink;/* @__PURE__ */
766
- return Object.freeze({dark:false,bg:kb.bg,white:kb.white,text:kb.text,muted:kb.muted,line:kb.line,charcoal:kb.charcoal,ink:n,fill:r?kb.ink:t.fill,onFill:r?kb.white:t.onFill,accentOnFill:r?kb.go:t.accentOnFill,go:kb.go,alert:kb.alert,alertDeep:kb.alertDeep,yellow:kb.yellow,tintSage:r?kb.tintSage:t.tintSage,tintPink:r||!Il(e)?kb.tintPink:t.tintPartner,tintPinkSoft:kb.tintPinkSoft,tintBlue:kb.tintBlue,tintYellow:kb.tintYellow,tintYellowEdge:kb.tintYellowEdge,tintRed:kb.tintRed,tintGo:kb.tintGo,icoGrey:kb.icoGrey,icoSage:r?kb.icoSage:t.chevron,icoBlue:kb.icoBlue,barTrack:kb.barTrack,pillPlainEdge:r?kb.pillPlainEdge:t.plainEdge,chartLine:Rb.chart.lineColor,chartGrid:Rb.chart.gridColor,chartBand:Rb.chart.bandColor,legacyText:Sb.textPrimary,legacyMuted:Sb.textMuted,legacyBorder:Sb.border,brand:r?Sb.brand:n,brandSoft:r?Sb.brandSoft:al(n,.1)??t.tintSage,watch:t.watch,tintPartner:t.tintPartner,mist:t.rowGround})}var Db=e.createContext(null);function Hb(e,t){let r=Ib(e),n=r=>r==="hand"?t!==null?{fontFamily:t}:face(e,"regular"):face(e,r),i=/* @__PURE__ */new Map;return{theme:e,look:r,type:e=>{let t=i.get(e);if(t!==void 0)return t;let l=jb[e],o={...n(l.face),fontSize:l.size,lineHeight:l.lineHeight,color:r[l.color],...l.letterSpacing!==0?{letterSpacing:l.letterSpacing}:{},...l.upper===true?{textTransform:"uppercase"}:{}};return i.set(e,o),o},face:n}}function HubKitProvider({handFamily:t,theme:r,children:i}){let l=useEverfurTheme(),o=r??l,a=e.useMemo(()=>Hb(o,t),[o,t]);/* @__PURE__ */
767
- return n.jsx(Db.Provider,{value:a,children:i})}function Vb(){let t=useEverfurTheme(),r=e.useMemo(()=>Hb(t,null),[t]);return e.useContext(Db)??r}function HubText({variant:e="bodySm",color:t,style:r,children:i,tier:l,...o}){let{type:a}=Vb();/* @__PURE__ */
768
- return n.jsx(Text,{tier:l??(e==="screenTitle"||e==="cardTitle"?"heading":e==="button"||e==="buttonRow"?"control":e==="pill"||e==="labelMono"||e==="chip"?"compact":"content"),...o,style:[a(e),t!==void 0?{color:t}:null,r],children:i})}var Pb={accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",pointerEvents:"none"};function HubIcon({name:e,size:t=24,color:i,style:l}){let{look:o}=Vb(),a=i??o.ink,s;switch(e){case"flask":s=/* @__PURE__ */n.jsx(FlaskGlyph,{size:t,color:a});break;case"flask-sm":s=/* @__PURE__ */n.jsx(FlaskGlyph,{size:t,color:a});break;case"syringe":s=/* @__PURE__ */n.jsx(SyringeGlyph,{size:t,color:a});break;case"calendar":s=/* @__PURE__ */n.jsx(CalendarGlyph,{size:t,color:a});break;case"shield":s=/* @__PURE__ */n.jsx(ShieldGlyph,{size:t,color:a});break;case"folder":s=/* @__PURE__ */n.jsx(FolderGlyph,{size:t,color:a});break;case"clock":s=/* @__PURE__ */n.jsx(ClockFaceGlyph,{size:t,color:a});break;case"clip":s=/* @__PURE__ */n.jsx(ClipboardGlyph,{size:t,color:a});break;case"download":s=/* @__PURE__ */n.jsx(DownloadGlyph2,{size:t,color:a});break;case"upload":s=/* @__PURE__ */n.jsx(UploadArrowGlyph,{size:t,color:a});break;case"thermo":s=/* @__PURE__ */n.jsx(ThermoGlyph,{size:t,color:a});break;case"heart":s=/* @__PURE__ */n.jsx(HeartGlyph,{size:t,color:a});break;case"wind":s=/* @__PURE__ */n.jsx(WindGlyph,{size:t,color:a});break;case"file":s=/* @__PURE__ */n.jsx(FileGlyph,{size:t,color:a});break;case"check":s=/* @__PURE__ */n.jsx(CheckGlyph,{size:t,color:a});break;case"chevron":s=/* @__PURE__ */n.jsx(ChevronGlyph,{size:t,color:a,direction:"right"});break;default:s=null}/* @__PURE__ */
769
- return n.jsx(r.View,{style:[{width:t,height:t,alignItems:"center",justifyContent:"center"},l],...Pb,children:s})}function HubCard({title:e,titleEnd:t,style:i,children:l,testID:o}){let{look:a}=Vb(),s=zb();/* @__PURE__ */
770
- return n.jsxs(r.View,{style:[{padding:wl(".efh-card","paddingTop"),backgroundColor:a.white,borderRadius:wl(".efh-card","borderRadius"),shadowColor:"#000000",shadowOpacity:a.dark?0:.09,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:a.dark?0:1,borderWidth:a.dark?Rb.card.border:0,borderColor:a.line},s.card,i],testID:o,children:[e!==void 0?/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:Rb.card.headGap,marginBottom:Rb.card.headBottom},children:[
771
- /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",style:{flexGrow:1,flexShrink:1},children:e}),t]}):null,l]})}function HubPill({label:e,tone:t="plain",small:i=false,testID:l}){let{look:o}=Vb(),a={stable:{bg:o.tintGo,fg:o.ink},overdue:{bg:o.white,fg:o.alert,edge:o.alert,w:Rb.pill.edgeThin},soon:{bg:o.white,fg:o.ink,edge:o.tintYellowEdge,w:Rb.pill.edgeThin},later:{bg:o.white,fg:o.muted,edge:o.line,w:Rb.pill.edgeThin},clear:{bg:o.white,fg:o.go,edge:o.go,w:Rb.pill.edgeThick},plain:{bg:o.white,fg:o.ink,edge:o.pillPlainEdge,w:Rb.pill.edgeThick},high:{bg:o.white,fg:o.alert,edge:o.alert,w:Rb.pill.edgeThin},watch:{bg:o.watch,fg:o.ink}}[t],s=i?wl(".efh-tile__foot .efh-pill","fontSize"):wl(".efh-pill","fontSize");/* @__PURE__ */
772
- return n.jsx(r.View,{testID:l,style:[{alignSelf:"flex-start",maxWidth:"100%",borderRadius:999,justifyContent:"center",backgroundColor:a.bg,minHeight:i?wl(".efh-tile__foot .efh-pill","minHeight"):wl(".efh-pill","minHeight"),paddingHorizontal:i?wl(".efh-tile__foot .efh-pill","paddingLeft"):wl(".efh-pill","paddingLeft")},a.edge!==void 0?{borderWidth:a.w,borderColor:a.edge}:null],children:/* @__PURE__ */n.jsx(HubText,{variant:"pill",color:a.fg,numberOfLines:1,style:{fontSize:s,lineHeight:s,letterSpacing:i?wl(".efh-tile__foot .efh-pill","letterSpacing"):wl(".efh-pill","letterSpacing")},children:e})})}function HubButton({label:e,onPress:t,variant:i="primary",size:l="md",icon:o,block:a=false,bold:s=false,style:d,accessibilityLabel:c,accessibilityHint:u,testID:h}){let{look:p,face:g}=Vb(),f=zb(),m=i==="text",b=i==="primary"?f.buttonInk??p.onFill:p.ink,y=l==="md"?Rb.button.md:l==="sm"?Rb.button.sm:l==="lg"?wl(".efh-btn","minHeight"):wl(".efh-btn--row","minHeight"),x=l==="md"?Rb.button.padMd:l==="sm"?Rb.button.padSm:l==="lg"?wl(".efh-btn","paddingLeft"):wl(".efh-btn--row","paddingLeft"),w=l==="row"?Rb.button.iconRow:l==="sm"?Rb.button.iconSm:Rb.button.iconMd,v=m?{flexDirection:"row",alignItems:"center",gap:Rb.button.textGap,minHeight:Rb.button.textMinHeight}:[{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:Rb.button.gap,borderRadius:999,minHeight:y,paddingHorizontal:x},i==="primary"?[l==="row"||l==="lg"?{backgroundColor:p.fill}:{backgroundColor:p.fill,borderWidth:Rb.button.edge,borderColor:p.white},f.button]:[{backgroundColor:"transparent",borderWidth:Rb.button.edge,borderColor:p.ink},f.radius]];/* @__PURE__ */
763
+ return Object.freeze(t.flatMap(e=>{let t=widgetPetFromWire(e);return t===null?[]:[t]}))}function createPetsRepository(e){return Lf(createRequestFunnel({auth:e}),createRequestFunnel({auth:e,unaryTimeoutMs:kf}))}function Lf(e,t=e){let r=(e,t)=>t?{...e,signal:t}:e,n=petRef=>Rf(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(Pf(n.value)):err(n.error)},async registerPet(petRef,t,r){let n=Rf(petRef,t);if(n!==null)return err(n);let i=zf(t);if("error"in i)return err(i.error);let l={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:i.body},o=await e.send("pets.registerPet",r?.signal?{...l,signal:r.signal}:l);return o.ok?ok(Hf(o.value,petRef)):err(o.error)},async updatePet(petRef,t,i){let l=n(petRef);if(typeof l!="string")return err(l);let o=_f(t);if("error"in o)return err(o.error);let a=await e.send("pets.updatePet",r({method:"PATCH",path:l,body:o.body},i?.signal));return a.ok?ok(Hf(a.value,petRef)):err(a.error)},async getPetProfile(petRef,t){let i=n(petRef);if(typeof i!="string")return err(i);let l=await e.send("pets.getPetProfile",r({method:"GET",path:`${i}/profile`},t?.signal));if(!l.ok)return err(l.error);let o=Vf(l.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 i=n(petRef);if(typeof i!="string")return err(i);let l=await e.send("pets.deletePet",r({method:"DELETE",path:i},t?.signal));return l.ok?ok(void 0):err(l.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 Of=/* @__PURE__ */new WeakMap;function Ef(e,t){let r=Of.get(e);return r===void 0&&(r=/* @__PURE__ */new Set,Of.set(e,r)),r.add(t),()=>{r?.delete(t)}}function useEverfurPets(){let{runtime:t,userRef:userRef,activePet:r,scopeEpoch:n}=Xt(),i=e.useMemo(()=>createPetsRepository(t.registry.services.authFor(userRef)),[t,userRef,n]),[l,o]=e.useState({repository:i,pets:[],loading:true,error:null}),a=l.repository===i?l:{pets:[],loading:true,error:null},s=e.useRef(0),d=e.useCallback(async()=>{let e=++s.current;o(e=>({...e,repository:i,loading:true,error:null,pets:e.repository===i?e.pets:[]}));let t=await i.list();e===s.current&&o(t.ok?{repository:i,pets:t.value,loading:false,error:null}:e=>({repository:i,pets:e.repository===i?e.pets:[],loading:false,error:t.error}))},[i]);e.useEffect(()=>(d(),()=>{s.current+=1}),[d]),e.useEffect(()=>Ef(t,()=>{d()}),[t,d]);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:d}),[a.pets,a.loading,a.error,c,d])}var Af=()=>()=>{},$f=()=>null;function Bf(t,r){return e.useSyncExternalStore(r?.subscribe??Af,r?.get??$f,r?.get??$f)??t}var Ff=/* @__PURE__ */Object.freeze(["ask","vet","plan","records"]),Mf=/* @__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,shellTabs:null,shellHeader:"classic"}),qf=/* @__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",shellTabs:"shell_tabs",shellHeader:"shell_header"}),Nf=Object.keys(qf),Wf="presentation",Uf="presentation.";var Gf={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"],shellHeader:["classic","tabs_bar"]};function Kf(e){if(!Array.isArray(e)||e.length===0)return;let t=/* @__PURE__ */new Set;for(let r of e){if(typeof r!="string"||!Ff.includes(r)||t.has(r))return;t.add(r)}/* @__PURE__ */
764
+ return Object.freeze([...e])}var Yf=/* @__PURE__ */new Set(["chatFollowUpsExcludeTelevet","chatComposerMic","chatComposerUpload","recordsTopRiskLine","recordsClearResultsFilter","chatGeneralBanner","chatTextingAsk","serverSlots"]);function Xf(e,t){if(t==null)return;if(e==="shellTabs")return Kf(t);let r=Gf[e];return r!==void 0?typeof t=="string"&&r.includes(t)?t:void 0:Yf.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 Nf){let n=qf[e],i=Object.prototype.hasOwnProperty.call(t,n)?t[n]:t[e],l=Xf(e,i);l!==void 0&&(r[e]=l)}return Object.keys(r).length===0?null:/* @__PURE__ */Object.freeze(r)}function isPresentationFieldLocked(e,t){if(t==null)return false;let r=`${Uf}${qf[e]}`;for(let e of t)if(e===Wf||e===r)return true;return false}function resolvePresentation(e){let t=parsePresentation(e?.server??null)??{},{safetyDisclaimerPlacement:r,...n}=t,i=r==="none"||r===void 0?n:{...n,safetyDisclaimerPlacement:r},l=parsePresentation(e?.client??null)??{},o=e?.locked?[...e.locked]:null,a={};for(let e of Nf){let t=i[e],r=isPresentationFieldLocked(e,o)?void 0:l[e];a[e]=r??t??Mf[e]}/* @__PURE__ */
765
+ return Object.freeze(a)}var Qf=/* @__PURE__ */Object.freeze({branding:null}),Jf=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>Qf});function Zf(e){return e?Object.keys(e).sort().map(t=>`${t}=${String(e[t])}`).join("&"):""}function useEverfurPresentation(e){return em(e).presentation}function em(t){let{runtime:r}=Xt(),n=r?.entitlements??Jf,i=e.useCallback(()=>n.getSnapshot()?.branding??null,[n]),l=Bf(e.useSyncExternalStore(n.subscribe,i,i),r?.sdkConfigHost?.branding),o=Zf(t);return e.useMemo(()=>{let e=l?.lockedFields??null;return{presentation:resolvePresentation({server:l?.presentation??null,locked:e,client:t??null}),isLocked:t=>isPresentationFieldLocked(t,e)}},[l,o])}var tm=3600*1e3;function rm(t,r=true){let[n,i]=e.useState(()=>t??Date.now()),l=e.useRef(true);return e.useEffect(()=>{if(l.current){l.current=false;return}t===void 0&&r&&i(Date.now())},[t,r]),e.useEffect(()=>{if(t!==void 0||!r)return;let e=setInterval(()=>i(Date.now()),tm),n=()=>{document.visibilityState==="visible"&&i(Date.now())},l=typeof document<"u"&&typeof document.addEventListener=="function"?document:null;return l?.addEventListener("visibilitychange",n),()=>{clearInterval(e),l?.removeEventListener("visibilitychange",n)}},[t,r]),t??n}var nm=e=>e.charAt(0).toUpperCase()+e.slice(1);function im(e,t){let r=e.trim(),n=r.length>0?r:bn,i=nm(n);return t==="her"?{name:n,Name:i,poss:"her",Poss:"Her",subj:"she"}:t==="his"?{name:n,Name:i,poss:"his",Poss:"His",subj:"he"}:{name:n,Name:i,poss:`${n}'s`,Poss:`${i}'s`,subj:n}}var lm=/* @__PURE__ */Object.freeze({vitalsFrom:(e,t,r)=>`Vitals from ${e.poss} ${t}, ${r}`,vitalsSource:e=>`Where ${e.name}'s vitals come from`,temperature:"Temperature",heartRate:"Heart rate",breathing:"Breathing",upcomingCare:"Upcoming care",overdueBy:e=>`Overdue · due by ${e}`,dueSoon:"Due soon",later:"Later",noDate:"No date",dueIn:(e,t)=>`Due ${e} · in ${t} ${t===1?"day":"days"}`,dueToday:e=>`Due ${e} · today`,overdueByDays:(e,t)=>`Overdue by ${t} ${t===1?"day":"days"} · due ${e}`,recordsHistory:"Records & history",labs:"Labs & bloodwork",results:"results",screenings:"Screenings",screeningsClear:"All clear",screeningsToReview:e=>`${e} to review`,noScreenings:"No screenings yet",visits:"Visits & records",timeline:"Timeline",events:e=>`${e} ${e===1?"event":"events"}`,weight:"Weight",vetVisits:e=>`${e} vet ${e===1?"visit":"visits"}`,history:"History",theirClinic:e=>`${e.Poss} clinic`,bloodPanel:"Blood panel",aboveRange:"above range",belowRange:"below range",othersInRange:"Other values in range.",addRecords:e=>`Add ${e.name}'s records`,moreThanOneClinic:"Records can come from more than one clinic over a lifetime.",visitsCount:e=>`${e} ${e===1?"visit":"visits"}`,panelsCount:e=>`${e} blood ${e===1?"panel":"panels"}`,requestFromClinic:"Request from a clinic",uploadDocument:"Upload a document",onFileNow:"On file now",firstRecord:e=>`Add ${e.name}'s first record`,firstLead:e=>`Records can come from more than one clinic over a lifetime. Start with the one ${e.subj} sees most, and this page fills in from there.`,requestFromTheirClinic:e=>`Request from ${e.poss} clinic`,requestDetail:"We send a secure request and read every page they send back.",uploadDetail:"A PDF, or a photo of a paper record.",findClinic:e=>`Find ${e.name}'s clinic`,chooseFile:"Choose a file",sayBeats:/* @__PURE__ */Object.freeze(["Hmmm","I wonder","what I may be","hiding"]),sayStill:"I wonder what I may be hiding",sample:"Sample",peekLead:e=>`A sneak peek at how ${e.name}'s records will read. Every number links back to the page it came from.`,sampleNote:e=>`Sample data until ${e.poss} records arrive.`,onTheWay:e=>`${e.Name}'s records are on the way`,clinicsTake:"Clinics usually take 2 to 5 days.",anotherClinic:"Another clinic",anotherClinicDetail:"Seen more than one vet? We ask each one.",noDueDate:"No due date on file",noLabs:e=>`No lab results on file for ${e.name} yet. They show up here when a record includes a blood or urine panel.`,noVisits:e=>`No visits in ${e.name}'s records yet. They show up here when a record includes one.`,oneReading:"One reading so far: we'll plot a trend as more come in.",takingNow:"Taking now",noCurrentMeds:"No current medications on file.",noVetTitle:e=>`When ${e.name} has a vet, start here.`,requestedFrom:e=>`Requested from ${e}. Clinics usually take 2 to 5 days.`,onTheWayFrom:(e,t)=>`${e.Name}'s records from ${t} are on the way.`,readingUpload:"We're reading the document you uploaded.",seeWhereItStands:"See where it stands",topRisk:e=>`${e.Poss} top risk`,seePlan:e=>`See ${e.poss} Health Plan`,panelOn:e=>`${e} blood panel`,latestReading:"Latest reading",rangeLine:(e,t,r)=>`range ${e} to ${t}${r?` ${r}`:""}`,noRange:"No range on the report",above:"Above",inRange:"In range",below:"Below",high:"High",belowRangePill:"Below range",changeUp:(e,t)=>`Up ${e}${t?` ${t}`:""}`,changeDown:(e,t)=>`Down ${e}${t?` ${t}`:""}`,changeSince:(e,t)=>` since ${e}, about ${t}%.`,whatIs:e=>`What ${e} is`,otherValues:e=>`Other ${e} values`,panelTitle:(e,t)=>`${e} · ${t}`,askAboutThis:"Ask about this"});var om=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function am(e){if(e==null||e.length===0)return null;let t=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00Z`:e);return Number.isNaN(t)?null:t}function sm(e){let t=new Date(e);return`${om[t.getUTCMonth()]??""} ${t.getUTCDate()}`}var dm=864e5,cm=30,um=2.20462;function hm(e){return`${sm(e)}, ${new Date(e).getUTCFullYear()}`}function pm(e){let t=new Date(e);return`${t.getUTCMonth()+1}/${String(t.getUTCFullYear()%100).padStart(2,"0")}`}var gm=e=>new Date(e).toISOString().slice(0,10);function fm(e){return String(Math.round(e*100)/100)}var mm=e=>Math.round(e*um*10)/10;function bm(e){let t=e.trim();return t.length<2||t[1]===t[1]?.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)}function ym(e){return/temp/i.test(e)?"temp":/heart|pulse/i.test(e)?"heart":/resp|breath/i.test(e)?"breath":null}var xm=["temp","heart","breath"],wm={temp:lm.temperature,heart:lm.heartRate,breath:lm.breathing};function vm(e){if(e===null||e.withheld)return{vitals:[],observedMs:null};let t=/* @__PURE__ */new Map;for(let r of e.entities){if(r.category!=="vital"||r.value===null||r.value.trim().length===0)continue;let e=ym(`${r.canonicalKey??""} ${r.key} ${r.label}`);if(e===null)continue;let n=am(r.observedAt)??0,i=t.get(e);(i===void 0||n>i.ms)&&t.set(e,{value:r.value.trim(),unit:r.unit,ms:n})}let r=xm.flatMap(e=>{let r=t.get(e);return r===void 0?[]:[{kind:e,value:r.value,unit:r.unit,label:wm[e]}]}),n=[...t.values()].map(e=>e.ms).filter(e=>e>0);return{vitals:r,observedMs:n.length>0?Math.max(...n):null}}function km(e,t){let r=gm(t);return e.find(e=>{let t=am(e.date);return t!==null&&gm(t)===r})??null}function jm(e){return/vaccin|rabies|dhpp|booster|bordetella|lepto|lyme|parvo|distemper/i.test(e)?"efi-shield":/\b(alt|alp|lab|labs|blood|panel|bloodwork|urinalysis|chemistry|cbc)\b/i.test(e)?"efi-flask-sm":"efi-calendar"}function Sm(e,t){return e.map(e=>{let r=am(e.dueAt),n=jm(e.title);if(r!==null&&r<t-dm+1)return{item:e,title:e.title,when:lm.overdueBy(sm(r)),tone:"alert",pill:null,icon:n};let i=e.detail??(r===null?lm.noDueDate:hm(r));if(r===null)return{item:e,title:e.title,when:i,tone:"none",pill:null,icon:n};let l=r-t<=cm*dm;return{item:e,title:e.title,when:i,tone:l?"watch":"later",pill:l?lm.dueSoon:lm.later,icon:n}})}function Cm(e){return e==null?null:/above|high/i.test(e)?"above":/below|low/i.test(e)?"below":/in_range|normal|in range/i.test(e)?"in":null}var Rm=e=>Math.round(e*10)/10;function Tm(e,t){let r=`${fm(mm(e))} lb`,n=`${fm(Rm(e))} kg`;return t==="kg"?{main:n,other:r}:{main:r,other:n}}function _m(e,t){if(e===null||e.withheld)return null;let r=e.weights.flatMap(e=>{let t=am(e.observedOn);return t===null||e.weightKg===null?[]:[{ms:t,kg:e.weightKg}]}).sort((e,t)=>e.ms-t.ms),n=r[r.length-1];if(n===void 0)return null;let i=r.map(e=>mm(e.kg)),l=Math.min(...i),o=Math.max(...i),a=r[0]?.ms??n.ms,s=n.ms-a,d=r.map((e,r)=>({x:s>0?Math.round((3.55+93.45*(e.ms-a)/s)*100)/100:50,y:o>l?Math.round((75-50*((i[r]??l)-l)/(o-l))*10)/10:50,lb:i[r]??0,value:t==="kg"?Rm(e.kg):i[r]??0,ms:e.ms})),c=d.length<=4?d:[d[0],d[d.length-1]].filter(e=>e!==void 0),u=Tm(n.kg,t);return{latest:u.main,sub:`${u.other} · ${sm(n.ms)}`,single:d.length===1,points:d,ticks:c.map(e=>({x:e.x,label:pm(e.ms)})),vetCount:d.length}}function zm(e){let t=/* @__PURE__ */new Map;if(e===null||e.withheld)return t;for(let r of e.markers)for(let e of r.points){let n=am(e.at);if(n===null)continue;let i=gm(n),l=t.get(i)??{ms:n,flagged:[],total:0,inRange:0,clinics:/* @__PURE__ */new Set};l.total+=1;let o=Cm(e.status);o==="in"&&(l.inRange+=1),(o==="above"||o==="below")&&l.flagged.push({marker:r,point:e,ms:n,flag:o}),e.sourceClinic&&l.clinics.add(e.sourceClinic),t.set(i,l)}return t}function Im(e,t){let r=[];for(let[e,n]of t)n.flagged.forEach((t,i)=>{let l=t.point.value===null?t.point.qualitativeResult??"":fm(t.point.value),o=t.point.unit??t.marker.unit,a=n.flagged.length===1&&n.inRange===n.total-1&&n.total>1;r.push({key:`lab-${e}-${t.marker.markerId}-${i}`,ms:n.ms,date:`${sm(n.ms)} · ${lm.bloodPanel}`,title:`${t.marker.name} ${l}${o?` ${o}`:""}, ${t.flag==="above"?lm.aboveRange:lm.belowRange}`,text:a?lm.othersInRange:null,alert:true,markerId:t.marker.markerId,order:0})});let n=e.depth?.withheld===false?e.depth.encounters:[],i=e.timeline?.withheld===false?e.timeline.visits:[],l=/* @__PURE__ */new Set;n.forEach((e,t)=>{let n=am(e.date);if(n===null)return;let o=i.find(t=>e.docId!==null&&t.docId===e.docId||am(t.visitDate)!==null&&gm(am(t.visitDate)??0)===gm(n))??null;o!==null&&l.add(o.visitId);let a=o?.summary?.trim()||null,s=e.type?.trim()||null,d=a??s;d!==null&&r.push({key:`enc-${e.encounterId}-${t}`,ms:n,date:a!==null&&s!==null?`${sm(n)} · ${s}`:sm(n),title:d,text:null,alert:false,markerId:null,order:1})});for(let e of i){let t=am(e.visitDate),n=e.summary?.trim()||null;l.has(e.visitId)||t===null||n===null||r.push({key:`visit-${e.visitId}`,ms:t,date:sm(t),title:n,text:null,alert:false,markerId:null,order:1})}r.sort((e,t)=>t.ms-e.ms||e.order-t.order);let o=[];for(let e of r){let t={key:e.key,ms:e.ms,date:e.date,title:e.title,text:e.text,alert:e.alert,markerId:e.markerId},r=String(new Date(t.ms).getUTCFullYear()),n=o[o.length-1];n!==void 0&&n.year===r?n.items.push(t):o.push({year:r,items:[t]})}return{years:o,count:r.length}}function Dm(e,t){let r=e.depth?.withheld===false?e.depth.encounters:[],n=t=>t?.trim()||lm.theirClinic(e.words),i=/* @__PURE__ */new Map;for(let e of r)i.set(n(e.clinicName),(i.get(n(e.clinicName))??0)+1);let l=/* @__PURE__ */new Map,o=i.size===1?[...i.keys()][0]:void 0;for(let r of t.values()){let t=r.clinics.size>0?[...r.clinics].map(n):[o??lm.theirClinic(e.words)];for(let e of t)l.set(e,(l.get(e)??0)+1)}return[.../* @__PURE__ */new Set([...i.keys(),...l.keys()])].map(e=>({label:e,detail:[(i.get(e)??0)>0?lm.visitsCount(i.get(e)??0):null,(l.get(e)??0)>0?lm.panelsCount(l.get(e)??0):null].filter(e=>e!==null).join(" · ")}))}var Hm={requested:15,awaiting_clinic:35,awaiting_upload:35,received:60,parsing:75,in_review:90};function Vm(e){let t=e.filter(e=>!isTerminalStatus(e.status)).sort((e,t)=>(am(t.updatedAt)??0)-(am(e.updatedAt)??0))[0];if(t===void 0)return null;let r=(t.waitingExpectation?.trim()||t.statusLabel).trim();return r.length===0?null:{step:r,pct:Hm[t.status]??15}}var Pm=e=>[...e].sort((e,t)=>(am(t.updatedAt)??0)-(am(e.updatedAt)??0)),Lm=e=>/[.!?]$/.test(e)?e:`${e}.`;function Om(e,t){let r=Pm(t).filter(e=>!isTerminalStatus(e.status)),n=r.filter(e=>e.status==="awaiting_upload"),i=r.filter(e=>e.status!=="awaiting_upload"),l=[],o=/* @__PURE__ */new Map;for(let e of i){let t=e.clinicName?.trim()??"";e.source!=="clinic_request"||t===""||o.has(t)||o.set(t,e)}for(let[t,r]of o)l.push({key:`clinic-${t}`,text:lm.onTheWayFrom(e,t),requestId:r.id});let a=i.find(e=>e.source==="owner_provided");a!==void 0&&l.push({key:"upload",text:lm.readingUpload,requestId:a.id});let s=n[0],d=s?.statusLabel.trim()??"";return s!==void 0&&d!==""&&l.push({key:"awaiting-upload",text:Lm(d),requestId:s.id}),l}function Em(e){return Pm(e).find(e=>!isTerminalStatus(e.status)&&e.status!=="awaiting_upload"&&e.source==="clinic_request"&&(e.clinicName?.trim()??"")!=="")?.clinicName?.trim()??null}function Am(e){if(e===null||e.withheld)return null;let t=e.medications.filter(e=>(e.drugName?.trim()??"")!=="");return t.length===0?null:{current:t.filter(e=>(e.stoppedOn?.trim()??"")==="").map(e=>{let t=[e.dose,e.frequency,e.route].map(e=>e?.trim()??"").filter(e=>e!==""),r=e.sig?.trim()||(t.length>0?t.join(" · "):null);return{key:e.medicationId,name:(e.drugName??"").trim(),detail:r}})}}function $m(e){if(e.some(e=>!isTerminalStatus(e.status)))return null;let t=[...e].sort((e,t)=>(am(t.updatedAt)??0)-(am(e.updatedAt)??0))[0];if(t===void 0||t.status!=="failed")return null;let r=t.statusLabel.trim();return r.length>0?r:null}function Bm(e,t,r){return e!==null&&!e.withheld&&!e.isEmpty||t!==null&&!t.withheld&&t.markers.length>0?true:r!==null&&!r.withheld&&r.encounters.length>0}function Fm(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;let t=Math.floor(e*12+1e-9),r=Math.floor(t/12),n=t%12;return r<=0?`${n}M`:n>0?`${r}Y ${n}M`:`${r}Y`}function Mm(e){let{record:t,depth:r,markers:n,nowMs:i}=e,l=Bm(t,n,r),o=Vm(e.requests),a=zm(n),{vitals:s,observedMs:d}=vm(t),c=r?.withheld===false?r.encounters:[],u=d===null?null:km(c,d),h=d!==null&&u?.type?lm.vitalsFrom(e.words,bm(u.type),sm(d)):null,p=e.weightUnit??"lb",g=_m(e.timeline,p),f=g!==null?null:e.petWeightKg,m=[e.breed?.trim()||null,Fm(e.petAgeYears),g?.latest??(f!==null?Tm(f,p).main:null)].filter(e=>e!==null),b=e.timeline?.withheld===false?e.timeline.visits.length:0,y=Im(e,a),x=c.map(e=>am(e.date)).filter(e=>e!==null),w=n?.withheld===false?n.markers:[],v=n?.featuredMarkerId??w.find(e=>Cm(e.latest?.status)==="above"||Cm(e.latest?.status)==="below")?.markerId??w[0]?.markerId??null;return{state:l?"full":o!==null?"onTheWay":"none",meta:m.length>0?m.join(" · "):null,vitals:s,vitalsFrom:h,due:t!==null&&!t.withheld?Sm(t.forwardLooking,i):[],labsCount:n?.withheld===false?n.summary?.totalMarkers??n.markers.length:0,featuredMarkerId:v,latestVisit:x.length>0?hm(Math.max(...x)):null,weight:g,history:y.years,historyCount:y.count,sources:Dm(e,a),pull:o,hasVisits:c.length>0||b>0,medications:Am(e.timeline),failedRequest:o===null?$m(e.requests):null,inFlight:Om(e.words,e.requests),requestedClinic:Em(e.requests)}}function qm(e){let t=e.points.filter(e=>e.value!==null);return t[t.length-1]??e.points[e.points.length-1]??null}function Nm(e){return e===null||e.refLow===null||e.refHigh===null||!Number.isFinite(e.refLow)||!Number.isFinite(e.refHigh)||e.refHigh<=e.refLow?null:{low:e.refLow,high:e.refHigh}}function Wm(e,t=qm(e)){let r=Nm(t),n=t?.unit??e.unit,i=t?.value??null;return{markerId:e.markerId,name:e.name,value:i===null?t?.qualitativeResult??"":fm(i),unit:n,range:r===null?null:`${fm(r.low)} to ${fm(r.high)}${n?` ${n}`:""}`,at:r===null||i===null?null:Math.round(Math.min(100,Math.max(0,20+60*(i-r.low)/(r.high-r.low)))),flag:Cm(t?.status??e.latest?.status??null)}}function Um(e){return e==="above"?lm.high:e==="below"?lm.belowRangePill:e==="in"?lm.inRange:null}var Gm=e=>{let t=e.replace(/\s+panel$/i,"").trim()||e;return t.length>1&&t[1]===t[1]?.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)};function Km(e,t){let r=e.markers.find(e=>e.markerId===t);if(r===void 0)return null;let n=qm(r),i=Wm(r,n),l=am(n?.at??r.latest?.at??null),o=Nm(n),a=[l===null?null:sm(l),o===null?lm.noRange:lm.rangeLine(fm(o.low),fm(o.high),i.unit)].filter(e=>e!==null).join(" · "),s=r.points.flatMap(e=>{let t=am(e.at);return e.value===null||t===null?[]:[{p:e,ms:t,v:e.value}]}),d=[];if(s.length>0){let e=s.map(e=>e.v),t=o?.low??Math.min(...e),r=o?.high??Math.max(...e);d=s.map((e,n)=>({x:s.length===1?50:Math.round((18+64*n/(s.length-1))*100)/100,y:r>t?Math.min(98,Math.max(2,Math.round((75-50*(e.v-t)/(r-t))*10)/10)):50,label:fm(e.v),out:Cm(e.p.status)==="above"||Cm(e.p.status)==="below",tick:sm(e.ms)}))}let c=s[0],u=s[s.length-1],h=null;if(c!==void 0&&u!==void 0&&s.length>=2&&u.v!==c.v){let e=Math.abs(u.v-c.v),t=c.v!==0?Math.round(e/Math.abs(c.v)*100):null,r=u.v>c.v?lm.changeUp(fm(e),i.unit):lm.changeDown(fm(e),i.unit);h=t===null?null:{lead:r,rest:lm.changeSince(sm(c.ms),t)}}let p=[],g=l===null?null:gm(l),f=e.markers.filter(e=>e.markerId!==r.markerId),m=f.filter(e=>e.panel!==null&&e.panel===r.panel);if(m.length>0&&r.panel!==null){let e=m.map(e=>Wm(e));p.push({title:lm.otherValues(Gm(r.panel)),allInRange:e.every(e=>e.flag==="in"),rows:e})}if(g!==null&&l!==null){let e=/* @__PURE__ */new Map;for(let t of f){if(t.panel===null||t.panel===r.panel)continue;let n=[...t.points].reverse().find(e=>{let t=am(e.at);return t!==null&&gm(t)===g});n!==void 0&&e.set(t.panel,[...e.get(t.panel)??[],Wm(t,n)])}for(let[t,r]of e)p.push({title:lm.panelTitle(t,sm(l)),allInRange:r.every(e=>e.flag==="in"),rows:r})}return{markerId:r.markerId,name:r.name,meta:l===null?null:lm.panelOn(hm(l)),pill:Um(i.flag),flagged:i.flag==="above"||i.flag==="below",latest:`${i.value}${i.unit?` ${i.unit}`:""}`,latestSub:a,hasRange:o!==null,chart:d,change:h,meaning:(r.meaning??"").split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e.length>0),groups:p}}var Ym=/* @__PURE__ */Object.freeze({vitalsFromLabel:e=>`Where ${e}’s vitals come from`,vitalsFrom:(e,t)=>`From ${e}’s exam, ${t}. `,examNotes:"Exam notes",onTheWayFrom:(e,t)=>`${e}’s records from ${t} are on the way.`,readingUpload:"We’re reading the document you uploaded.",uploadFormatHint:"Upload PDF records you already have, up to 25 MB each. You can pick several at once. We'll read them and add the results to your records.",uploadLimitHint:"PDFs up to 25 MB each. You can pick several at once.",results:e=>e===1?"result":"results",noScreenings:"No screenings yet",screeningsToReview:e=>`${e} to review`,screeningsClear:"All clear",noVisits:"No visits yet",oneReading:"One reading so far: we’ll plot a trend as more come in.",uploadedDocument:"Uploaded document"}),Xm=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Qm(e){let t=new Date(e);return`${Xm[t.getUTCMonth()]??""} ${t.getUTCDate()}, ${t.getUTCFullYear()}`}function Jm(e){let t=Ym,r=e.filter(e=>(e.latest?.qualitativeResult??"").trim().length>0);if(r.length===0)return null;let n=r.filter(e=>Zm(e.latest?.status??null,e.latest?.qualitativeResult??"")),i=n[0]??r[0];return n.length>0?{label:t.screeningsToReview(n.length),flagged:true,markerId:i.markerId}:{label:t.screeningsClear,flagged:false,markerId:i.markerId}}function Zm(e,t){return e==="in_range"?false:e==="above"||e==="below"?true:/negative|not detected|clear|none/i.test(t)?false:/positive|detected|present|reactive/i.test(t)}function eb(e){let t=e.replace(/_/g," ").trim();return t.length>0?t.charAt(0).toUpperCase()+t.slice(1):e}function tb(e,t){if(e===null||e.withheld)return[];let r=/* @__PURE__ */new Map;if(t!==null&&!t.withheld)for(let e of t.encounters){let t=e.clinicName?.trim();e.docId!==null&&t&&r.set(e.docId,t)}return Object.values(e.documents).sort((e,t)=>(am(t.receivedAt)??0)-(am(e.receivedAt)??0)).slice(0,4).reverse().map(e=>{let t=am(e.receivedAt);return{key:e.docId,name:r.get(e.docId)??Ym.uploadedDocument,meta:[e.documentClass?eb(e.documentClass):null,t!==null?Qm(t):null].filter(e=>e!==null).join(" · ")}})}var rb=["January","February","March","April","May","June","July","August","September","October","November","December"];function nb(e){let t=new Date(e);return`${rb[t.getUTCMonth()]??""} ${t.getUTCDate()}`}function ib(e,t){if(t===null||e===null||e.withheld)return null;let r=new Date(t).toISOString().slice(0,10),n=e.encounters.find(e=>{let t=am(e.date);return t!==null&&new Date(t).toISOString().slice(0,10)===r}),i=n?.veterinarian?.trim(),l=am(n?.date);return i&&l!==null?{vet:i,date:nb(l)}:null}function lb(e,t){let r=Ym;return Om(im(e,null),t).map(t=>t.key==="upload"?{...t,text:r.readingUpload}:t.key.startsWith("clinic-")?{...t,text:r.onTheWayFrom(e,t.key.slice(7))}:t)}function ob(e){let t={url:e.url,kind:e.kind,expiresAt:e.expires_at};return typeof e.loop_duration_ms=="number"&&(t.loopDurationMs=e.loop_duration_ms),typeof e.cache_key=="string"&&e.cache_key.length>0&&(t.cacheKey=e.cache_key),/* @__PURE__ */Object.freeze(t)}function mapPetStateResponse(e){let t={};e.tiers.animation&&(t.animation=ob(e.tiers.animation)),e.tiers.image&&(t.image=ob(e.tiers.image));let r={};e.overlays.weather_alert&&(r.weatherAlert=ob(e.overlays.weather_alert));let n={category:e.category,tiers:/* @__PURE__ */Object.freeze(t),overlays:/* @__PURE__ */Object.freeze(r),idle:"bundled",ttlSeconds:e.ttl_seconds,degraded:e.degraded};return typeof e.cache_epoch=="number"&&(n.cacheEpoch=e.cache_epoch),/* @__PURE__ */Object.freeze(n)}var ab=/* @__PURE__ */t.z.enum(["webp","video"]),sb=/* @__PURE__ */t.z.enum(["health","attention","moment","activity","mood","idle"]),db=/* @__PURE__ */t.z.object({url:/* @__PURE__ */t.z.string(),kind:/* @__PURE__ */ab.default("webp"),loop_duration_ms:/* @__PURE__ */t.z.number().nullish(),expires_at:/* @__PURE__ */t.z.string(),cache_key:/* @__PURE__ */t.z.string().nullish()}),cb=/* @__PURE__ */t.z.object({category:sb,tiers:/* @__PURE__ */t.z.object({animation:/* @__PURE__ */db.nullish(),image:/* @__PURE__ */db.nullish()}).default({}),overlays:/* @__PURE__ */t.z.object({weather_alert:/* @__PURE__ */db.nullish()}).default({}),idle:/* @__PURE__ */t.z.literal("bundled").default("bundled"),ttl_seconds:/* @__PURE__ */t.z.number(),degraded:/* @__PURE__ */t.z.boolean().default(false),cache_epoch:/* @__PURE__ */t.z.number().default(0)});function parsePetStateWire(e){let t=cb.safeParse(e);return t.success?t.data:null}function createPetStateRepository(e){return ub(createRequestFunnel({auth:e}))}function ub(e){return{async getState(petRef,t){if(Dt(petRef))return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"pet_ref contains an unpaired surrogate and cannot be encoded"}));let r=`/widget/v1/pets/${encodeURIComponent(petRef)}/state`,n=await e.send("animations.getState",t?.signal?{method:"GET",path:r,signal:t.signal}:{method:"GET",path:r},t?.maxAttempts!==void 0?{maxAttempts:t.maxAttempts}:void 0);if(n.ok){let e=parsePetStateWire(n.value);return e===null?err(makeEverfurError("internalError",{retryable:true})):ok(mapPetStateResponse(e))}return n.error.httpStatus===404?ok(null):err(n.error)}}}var hb=/* @__PURE__ */Object.freeze({status:"loading"}),pb=/* @__PURE__ */Object.freeze({status:"none"}),gb=3e4,fb=/* @__PURE__ */Object.freeze([2e3,6e3]),mb=/* @__PURE__ */Object.freeze({animation:false,image:false});function bb(e,t,r){if(e.kind==="pending")return hb;if(e.kind==="failed"||e.value===null)return pb;let{animation:n,image:i}=e.value.tiers;return n!==void 0&&n.kind==="webp"&&!r&&!t.animation?{status:"art",url:n.url,key:n.cacheKey??n.url,animated:true}:i!==void 0&&i.kind==="webp"&&!t.image?{status:"art",url:i.url,key:i.cacheKey??i.url,animated:false}:pb}function yb(petRef,t){let r=e.useContext(Yt),n=r?.runtime??null,userRef=r?.userRef??null,i=n!==null&&userRef!==null&&petRef!==null?`${userRef}|${petRef}`:null,[l,o]=e.useState({scope:i,read:{kind:"pending"}}),[a,s]=e.useState({scope:i,failed:mb}),[d,c]=e.useState({scope:i,at:0}),u=l.scope===i?l.read:{kind:"pending"},h=u.kind==="answer"&&u.value===null,p=e.useRef({scope:i,n:0});e.useEffect(()=>{if(i===null||n===null||userRef===null||petRef===null||!t.isFocused||h)return;let e=d.scope===i?d.at:0,r=true,l=typeof AbortController=="function"?new AbortController:null,a=()=>{createPetStateRepository(n.registry.services.authFor(userRef)).getState(petRef,l?{signal:l.signal,maxAttempts:1}:{maxAttempts:1}).then(e=>{if(!r)return;if(e.ok){p.current={scope:i,n:0};let t=e.value;o(e=>t!==null&&t.degraded&&e.scope===i&&e.read.kind==="answer"&&e.read.value!==null?e:{scope:i,read:{kind:"answer",value:t}}),t!==null&&(t.degraded||s({scope:i,failed:mb}),c({scope:i,at:Date.now()+Math.max(30,t.ttlSeconds)*1e3}));return}if(e.error.httpStatus===403){o({scope:i,read:{kind:"answer",value:null}});return}let t=p.current.scope===i?p.current.n:0,n=fb[t];p.current={scope:i,n:t+1},o(e=>e.scope===i&&e.read.kind==="answer"?e:n!==void 0?{scope:i,read:{kind:"pending"}}:{scope:i,read:{kind:"failed"}}),c({scope:i,at:Date.now()+(n??gb)})})},u=Math.max(0,e-Date.now()),g=u===0?null:setTimeout(a,u);return g===null&&a(),()=>{r=false,g!==null&&clearTimeout(g),l?.abort()}},[i,n,userRef,petRef,t.isFocused,h,d]);let g=a.scope===i?a.failed:mb,f=e.useMemo(()=>i===null?pb:bb(u,g,t.reducedMotion),[i,u,g,t.reducedMotion]),m=e.useCallback(()=>{f.status==="art"&&s(e=>{let t=e.scope===i?e.failed:mb;return{scope:i,failed:f.animated?{...t,animation:true}:{...t,image:true}}})},[f,i]);return e.useMemo(()=>({art:f,onError:m}),[f,m])}var xb=/* @__PURE__ */Object.freeze({temperature:"Temperature",heartRate:"Heart rate",breathing:"Breathing",vitalsLabel:e=>`Vitals at ${e}’s last exam`,vitalLabel:(e,t,r,n=true)=>`${e}, ${t} ${r}.${n?" More about it":""}`,sayLine:"I wonder what I may be hiding",sayPhrases:["Hmmm","I wonder","what I may be","hiding"],upcomingCare:"Upcoming Care",viewAll:"View all →",dueSoon:"Due soon",later:"Later",nothingDue:e=>`Nothing due for ${e} right now.`,overdueBy:e=>`Overdue by ${e} ${e===1?"day":"days"}`,dueToday:"Due today",dueIn:e=>`Due in ${e} ${e===1?"day":"days"}`,noDueDate:"No due date on file",withDue:(e,t)=>`${e} · due ${t}`,dueOn:e=>`Due ${e}`,thisDay:(e,t)=>`${e} · this ${t}`,inWeeks:(e,t)=>`${e} · in ${t} ${t===1?"week":"weeks"}`,recordsHistory:"Records & History",labs:"Labs & bloodwork",labsA11y:(e,t)=>`Labs and bloodwork, ${e} ${t}`,labsA11yUnknown:"Labs and bloodwork",labsCountUnknown:"--",screenings:"Screenings",screeningsA11y:e=>`Screenings${e!==null?`, ${e}`:""}`,toReview:e=>`${e} to review`,allClear:"All clear",visits:"Visits & records",visitsA11y:e=>`Visits and records${e!==null?`, latest ${e}`:""}`,timeline:"Timeline",events:e=>`${e} events`,timelineA11y:e=>`Timeline${e>0?`, ${e} events`:""}`,weight:"Weight",estimatedRange:"Estimated Optimal Adult Range",noWeights:e=>`No weights on file yet. They show up here from ${e}’s vet visits.`,legendOver:["OVER","WEIGHT"],legendStable:["STABLE"],legendUnder:["UNDER","WEIGHT"],trendSummary:(e,t,r,n,i)=>`${e===1?"1 reading":`${e} readings`}, latest ${t}${e===1?"":`, trend ${r}`}.${n!==null&&i!==null?` Healthy range ${n} to ${i}.`:""}`,pointLabel:(e,t,r)=>e!==null?`${e}, ${t} ${r}`:`${t} ${r}`,addRecords:e=>`Add ${e}’s records`,moreThanOneClinic:"Records can come from more than one clinic over a lifetime.",onFileNow:"On file now",videoVisit:"Everfur video visit",requestFromClinic:"Request from a clinic",uploadDocument:"Upload a document",onTheWay:e=>`${e}’s records are on the way`,clinicsTake:"Clinics usually take 2 to 5 days.",requestSentTo:e=>e!==null?`Request sent to ${e}`:"Request sent",signedRelease:e=>`${e} · you signed the release`,waitingFor:e=>`Waiting for ${e} records`,inHealthTab:e=>`In ${e} Health tab`,everyPageRead:"Every page read: vaccines, labs, visits, meds",today:"Today",anotherClinic:"Another clinic",anotherClinicText:"Seen more than one vet? We ask each one.",uploadText:"A PDF, or a photo of a paper record.",requestTitle:e=>`${e}’s records request`,requestA11y:(e,t)=>`Records request for ${e}. ${t}`,sample:"Sample",peekLead:e=>`A sneak peek at how ${e}’s records will read. Every number links back to the page it came from.`,previousGroup:"Previous group",nextGroup:"Next group",markerGroups:"Marker groups",sampleNotTheirs:e=>`This is a sample, not ${e}’s result.`,sampleNote:e=>` Add ${e} records to see ${e} own numbers. Anything outside the range gets flagged like this, with what it measures and what to ask ${e} vet.`,columns:["Test","Result","Unit","Range"],slideOf:(e,t,r)=>`${e}, ${t} of ${r}`,high:"High",legal:mn,noVetTitle:e=>`When ${e.name} has a vet, start here.`});function wb(e){let t=Math.floor(e/12),r=e%12;return t<=0?`${r}m`:r>0?`${t}y ${r}m`:`${t}y`}var vb={cap:"Read from the lab report, page 2",who:"Chemistry panel",page:"p. 2 of 12"},kb=/* @__PURE__ */Object.freeze([{key:"liver",chip:"Liver",lead:"What the liver makes and clears.",markers:[{name:"ALT",flag:"High",what:"An enzyme found mostly in liver cells.",at:92,value:"118",unit:"U/L"},{name:"ALP",what:"An enzyme from the liver and bones.",at:33,value:"64",unit:"U/L"},{name:"GGT",what:"An enzyme tied to the liver’s bile ducts.",at:36,value:"3",unit:"U/L"},{name:"Total bilirubin",what:"A yellow pigment the liver clears.",at:33,value:"0.2",unit:"mg/dL"}],from:{...vb,rows:[{test:"ALB",result:"3.2",unit:"g/dL",range:"2.3-4.0"},{test:"ALP",result:"64",unit:"U/L",range:"23-212",lit:true},{test:"ALT",result:"118 H",unit:"U/L",range:"10-100",lit:true},{test:"BUN",result:"18",unit:"mg/dL",range:"7-27"},{test:"GGT",result:"3",unit:"U/L",range:"0-11",lit:true},{test:"T. BILI",result:"0.2",unit:"mg/dL",range:"0.0-0.9",lit:true}]}},{key:"kidney",chip:"Kidney",lead:"What the kidneys filter out and keep in balance.",markers:[{name:"BUN",what:"Protein waste the kidneys filter out.",at:53,value:"18",unit:"mg/dL"},{name:"Creatinine",what:"Muscle waste the kidneys filter out.",at:48,value:"1.1",unit:"mg/dL"},{name:"SDMA",what:"Another measure of kidney filtering.",at:59,value:"9",unit:"µg/dL"},{name:"Phosphorus",what:"A mineral the kidneys keep in balance.",at:42,value:"4.1",unit:"mg/dL"}],from:{...vb,rows:[{test:"ALT",result:"45",unit:"U/L",range:"10-100"},{test:"BUN",result:"18",unit:"mg/dL",range:"7-27",lit:true},{test:"CA",result:"10.1",unit:"mg/dL",range:"7.9-12.0"},{test:"CREA",result:"1.1",unit:"mg/dL",range:"0.5-1.8",lit:true},{test:"PHOS",result:"4.1",unit:"mg/dL",range:"2.5-6.8",lit:true},{test:"SDMA",result:"9",unit:"µg/dL",range:"0-14",lit:true}]}},{key:"blood",chip:"Blood cells",lead:"The cells that carry oxygen, fight infection and help blood clot.",markers:[{name:"Red blood cells",what:"Cells that carry oxygen around the body.",at:43,value:"6.9",unit:"M/µL"},{name:"Hemoglobin",what:"The part of red cells that holds oxygen.",at:42,value:"15.8",unit:"g/dL"},{name:"White blood cells",what:"Cells that fight infection.",at:44,value:"9.8",unit:"K/µL"},{name:"Platelets",what:"Cell fragments that help blood clot.",at:41,value:"265",unit:"K/µL"}],from:{cap:"Read from the lab report, page 3",who:"Complete blood count",page:"p. 3 of 12",rows:[{test:"HCT",result:"46",unit:"%",range:"37.3-61.7"},{test:"HGB",result:"15.8",unit:"g/dL",range:"13.1-20.5",lit:true},{test:"NEUT",result:"6.1",unit:"K/µL",range:"2.95-11.64"},{test:"PLT",result:"265",unit:"K/µL",range:"148-484",lit:true},{test:"RBC",result:"6.9",unit:"M/µL",range:"5.65-8.87",lit:true},{test:"WBC",result:"9.8",unit:"K/µL",range:"5.05-16.76",lit:true}]}},{key:"sugar",chip:"Sugar and salts",lead:"Fuel, and the salts that keep fluids, nerves and muscles steady.",markers:[{name:"Glucose",what:"Blood sugar, the body’s main fuel.",at:41,value:"96",unit:"mg/dL"},{name:"Sodium",what:"A salt that keeps fluids in balance.",at:31,value:"147",unit:"mmol/L"},{name:"Potassium",what:"A salt that helps nerves and muscles work.",at:49,value:"4.6",unit:"mmol/L"},{name:"Calcium",what:"A mineral for bones, muscles and nerves.",at:52,value:"10.1",unit:"mg/dL"}],from:{...vb,rows:[{test:"CA",result:"10.1",unit:"mg/dL",range:"7.9-12.0",lit:true},{test:"CL",result:"112",unit:"mmol/L",range:"109-122"},{test:"GLU",result:"96",unit:"mg/dL",range:"70-143",lit:true},{test:"K",result:"4.6",unit:"mmol/L",range:"3.5-5.8",lit:true},{test:"NA",result:"147",unit:"mmol/L",range:"144-160",lit:true},{test:"PHOS",result:"4.1",unit:"mg/dL",range:"2.5-6.8"}]}}]),jb=/* @__PURE__ */Object.freeze([{key:"screenings",title:"Screenings",tint:"pink",lead:"Tests that look for common problems early, and what came back.",rows:[{title:"Heartworm test",pill:"Negative",tone:"clear"},{title:"Tick panel (4Dx)",pill:"Negative",tone:"clear"}]},{key:"visits",title:"Visits & records",tint:"blue",lead:"Every visit, with the vet’s notes and the pages they came from.",rows:[{title:"Wellness exam",text:"38 pages"},{title:"Everfur video visit",text:"3 pages"}]},{key:"timeline",title:"Timeline",tint:"yellow",lead:"Her whole history in order, with what’s due next.",rows:[{title:"Rabies vaccine",pill:"Due soon",tone:"soon"},{title:"Heartworm test",text:"Apr 18"}]}]);var Sb=/* @__PURE__ */Object.freeze({ink:"#10462E",go:"#07C168",muted:"#6B6B6B",line:"#E4E4E4",text:"#000000",bg:"#FFFFFF",white:"#FFFFFF",mist:"#F1F5F2",charcoal:"#3D3D3D",alert:"#C03410",alertDeep:"#6D1D14",pink:"#FFC3BC",yellow:"#F2C763",skyBlue:"#4E98C9",tintSage:"#E6ECE8",tintPink:"#FFEAE8",tintPinkSoft:"#FFF6F5",tintBlue:"#EAEEF6",tintYellow:"#FCF0D6",tintYellowEdge:"#F6D892",tintRed:"#FBF1EE",tintGo:"#DCF6EA",icoGrey:"#6B6B6B",icoSage:"#819E90",icoBlue:"#4E98C9",barTrack:"#ECECEC",pillPlainEdge:"rgba(16, 70, 46, 0.2)"}),Cb=/* @__PURE__ */Object.freeze({screenTitle:/* @__PURE__ */Object.freeze({size:22,lineHeight:26.4,face:"medium",color:"ink",letterSpacing:-.33}),cardTitle:/* @__PURE__ */Object.freeze({size:18,lineHeight:22.5,face:"bold",color:"ink",letterSpacing:-.36}),body:/* @__PURE__ */Object.freeze({size:17,lineHeight:26.35,face:"regular",color:"text",letterSpacing:0}),bodySm:/* @__PURE__ */Object.freeze({size:15,lineHeight:21.75,face:"regular",color:"text",letterSpacing:0}),bodySmBold:/* @__PURE__ */Object.freeze({size:15,lineHeight:21.75,face:"bold",color:"ink",letterSpacing:0}),fine:/* @__PURE__ */Object.freeze({size:13,lineHeight:18.2,face:"regular",color:"muted",letterSpacing:0}),labelMono:/* @__PURE__ */Object.freeze({size:12,lineHeight:16.8,face:"monoBold",color:"muted",letterSpacing:.72,upper:true}),pill:/* @__PURE__ */Object.freeze({size:12,lineHeight:14.4,face:"monoBold",color:"ink",letterSpacing:.72,upper:true}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:18,face:"bold",color:"ink",letterSpacing:0}),buttonRow:/* @__PURE__ */Object.freeze({size:14,lineHeight:16.8,face:"bold",color:"ink",letterSpacing:0}),chip:/* @__PURE__ */Object.freeze({size:14,lineHeight:16.8,face:"medium",color:"ink",letterSpacing:0}),hand:/* @__PURE__ */Object.freeze({size:22,lineHeight:26.4,face:"hand",color:"ink",letterSpacing:0})}),Rb=/* @__PURE__ */Object.freeze({surface:"#FFFFFF",textPrimary:"#111111",textMuted:"#6E6660",border:"#C8BEB4",brand:"#10462E",brandSoft:"rgba(16, 70, 46, 0.1)",danger:"#B91C1C"}),Tb=/* @__PURE__ */Object.freeze({dot:24,check:12,core:10,ring:2,rowGap:12,bodyBottom:18,bodyGap:2,titleGap:8,rail:2,railMin:22,railGap:2,titleSize:14,titleLineHeight:18,dateSize:12,dateLineHeight:16,detailSize:13,detailLineHeight:17,upcomingOpacity:.7});var _b=/* @__PURE__ */Object.freeze({screen:{gap:12,padX:16,padBottom:24,legalTop:20},hero:{nameSize:22,nameLineHeight:26,nameTracking:-.44,metaTop:2,metaLineHeight:18,metaTracking:.26,stageHeight:280,stageTop:4,grassFraction:.46,petBottom:40,petBoxHeight:224,petTop:16,sayWidth:230,sayHeight:61,sayFontSize:22,sayArcPath:"M 12 60 Q 120 -4 228 60",sayViewBox:[240,64],vitalsTop:8,vitalsLeft:8,vitalMinHeight:40,vitalPadX:8,vitalGap:6,vitalIcon:22,vitalValueSize:17,vitalUnitSize:13,lawnOverlap:26,lawnRadius:28},card:{pad:16,radius:20,border:1,headGap:8,headBottom:12},button:{md:52,sm:46,row:36,padMd:24,padSm:16,padRow:14,iconMd:22,iconSm:20,iconRow:17,edge:1.5,gap:8,mdLabel:17,textGap:6,textMinHeight:24},pill:{minHeight:24,padX:10,edgeThin:1.25,edgeThick:1.5},upcoming:{listGap:4,bleed:8,rowPadY:10,rowPadX:8,rowGap:12,rowRadius:10,icon:20,maxRows:4},tiles:{top:8,titleBottom:12,gap:12,pad:16,radius:20,innerGap:8,icon:22,chevron:20,titleLineHeight:19,footMinHeight:28,numSize:20,numLineHeight:22,numTracking:-.4,countGap:8},weight:{headGap:4,headBottom:16,numSize:32,numLineHeight:34,numTracking:-.64,numGap:8},chart:{height:176,plotTop:24,axisBand:20,rightInset:14,indicatorWidth:8,plotLeft:62,dataLeft:76,dot:6,dotRing:1.5,lineWidth:2,labelGap:7,labelMax:12,labelMin:9,labelCharWidth:.62,edgePad:4,legendX:14,legendLine:14.4,legendSize:12,legendTracking:.24,monthY:172,monthSize:12,maxTicks:5,maxValues:8,bandFrom:.3,bandTo:.7,reach:.88,bandPct:.1,lineColor:"#111111",gridColor:"#EAEAEA",bandColor:"#D8F3E3"},add:{gap:12,headGap:8,icon:26,sourcesGap:6,sourcesTop:4,sourcePadY:10,sourcePadX:14,sourceRadius:10,sourceColumnGap:12,actsGap:12,actsTop:4},peek:{top:12,headGap:12,leadTop:8,labsTop:16,chipsTop:10,chipsGap:8,slideTop:16,slideGap:4,slideLeadTop:2,slideLeadBottom:8,markerPad:12,markerGap:8,markerRadius:10,markerTopGap:12,barHeight:8,barDot:12,barDotRing:2,valueGap:4,fromMinHeight:40,fromGap:6,fromIcon:16,fromChevron:18,moreGap:12,moreTop:16,morePad:16,moreInnerGap:12,moreRadius:20,moreIcon:22,moreHeadGap:8,rowsGap:6,rowMinHeight:44,rowPadY:8,rowPadX:14,rowRadius:10,roundButton:36,chipHeight:36,chipPadX:14},onTheWay:{dot:28,titleSize:22,titleLineHeight:25,titleTracking:-.44,wayIcon:26,wayPad:16,wayRadius:20},inProgress:{radius:18,pad:18,gap:16,titleSize:16,titleLineHeight:20,statusRadius:14,statusPad:14,statusSize:13,statusLineHeight:19}});var zb=/* @__PURE__ */new WeakMap;function Ib(e){let t=zb.get(e);if(t!==void 0)return t;let r=e.slots.primaryButton,n=/* @__PURE__ */Object.freeze({card:{borderRadius:e.radius.lg,...rn(ln(e.slots),1)},button:r===void 0?null:rn(r),buttonInk:r?.textColor,radius:r?.borderRadius===void 0?null:{borderRadius:r.borderRadius}});return zb.set(e,n),n}function Db(){let t=useEverfurTheme();return e.useMemo(()=>Ib(t),[t])}function Hb(e){let t=recordsSheetLook(e);if(t.dark)/* @__PURE__ */
766
+ return Object.freeze({dark:true,bg:t.ground,white:t.card,text:t.text,muted:t.muted,line:t.line,charcoal:t.muted,ink:t.ink,fill:t.fill,onFill:t.onFill,accentOnFill:t.accentOnFill,go:t.go,alert:t.alert,alertDeep:t.alertDeep,yellow:t.watch,tintSage:t.tintSage,tintPink:t.tintPartner,tintPinkSoft:t.card,tintBlue:t.tintBlue,tintYellow:t.tintYellow,tintYellowEdge:t.watch,tintRed:t.alertTint,tintGo:t.goTint,icoGrey:t.muted,icoSage:t.chevron,icoBlue:t.wind,barTrack:t.barTrack,pillPlainEdge:t.plainEdge,chartLine:t.text,chartGrid:t.line,chartBand:t.goTint,legacyText:t.text,legacyMuted:t.muted,legacyBorder:t.line,brand:t.ink,brandSoft:al(t.ink,.1)??t.tintSage,watch:t.watch,tintPartner:t.tintPartner,mist:t.rowGround});let r=zl(e),n=r?Sb.ink:t.ink;/* @__PURE__ */
767
+ return Object.freeze({dark:false,bg:Sb.bg,white:Sb.white,text:Sb.text,muted:Sb.muted,line:Sb.line,charcoal:Sb.charcoal,ink:n,fill:r?Sb.ink:t.fill,onFill:r?Sb.white:t.onFill,accentOnFill:r?Sb.go:t.accentOnFill,go:Sb.go,alert:Sb.alert,alertDeep:Sb.alertDeep,yellow:Sb.yellow,tintSage:r?Sb.tintSage:t.tintSage,tintPink:r||!Il(e)?Sb.tintPink:t.tintPartner,tintPinkSoft:Sb.tintPinkSoft,tintBlue:Sb.tintBlue,tintYellow:Sb.tintYellow,tintYellowEdge:Sb.tintYellowEdge,tintRed:Sb.tintRed,tintGo:Sb.tintGo,icoGrey:Sb.icoGrey,icoSage:r?Sb.icoSage:t.chevron,icoBlue:Sb.icoBlue,barTrack:Sb.barTrack,pillPlainEdge:r?Sb.pillPlainEdge:t.plainEdge,chartLine:_b.chart.lineColor,chartGrid:_b.chart.gridColor,chartBand:_b.chart.bandColor,legacyText:Rb.textPrimary,legacyMuted:Rb.textMuted,legacyBorder:Rb.border,brand:r?Rb.brand:n,brandSoft:r?Rb.brandSoft:al(n,.1)??t.tintSage,watch:t.watch,tintPartner:t.tintPartner,mist:t.rowGround})}var Vb=/* @__PURE__ */Symbol.for("everfur.sdk.rn.recordsHubKit.v1"),Pb=globalThis[Vb]??=e.createContext(null);function Lb(e,t){let r=Hb(e),n=r=>r==="hand"?t!==null?{fontFamily:t}:face(e,"regular"):face(e,r),i=/* @__PURE__ */new Map;return{theme:e,look:r,type:e=>{let t=i.get(e);if(t!==void 0)return t;let l=Cb[e],o={...n(l.face),fontSize:l.size,lineHeight:l.lineHeight,color:r[l.color],...l.letterSpacing!==0?{letterSpacing:l.letterSpacing}:{},...l.upper===true?{textTransform:"uppercase"}:{}};return i.set(e,o),o},face:n}}function HubKitProvider({handFamily:t,theme:r,children:i}){let l=useEverfurTheme(),o=r??l,a=e.useMemo(()=>Lb(o,t),[o,t]);/* @__PURE__ */
768
+ return n.jsx(Pb.Provider,{value:a,children:i})}function Ob(){let t=useEverfurTheme(),r=e.useMemo(()=>Lb(t,null),[t]);return e.useContext(Pb)??r}function HubText({variant:e="bodySm",color:t,style:r,children:i,tier:l,...o}){let{type:a}=Ob();/* @__PURE__ */
769
+ return n.jsx(Text,{tier:l??(e==="screenTitle"||e==="cardTitle"?"heading":e==="button"||e==="buttonRow"?"control":e==="pill"||e==="labelMono"||e==="chip"?"compact":"content"),...o,style:[a(e),t!==void 0?{color:t}:null,r],children:i})}var Eb={accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",pointerEvents:"none"};function HubIcon({name:e,size:t=24,color:i,style:l}){let{look:o}=Ob(),a=i??o.ink,s;switch(e){case"flask":s=/* @__PURE__ */n.jsx(FlaskGlyph,{size:t,color:a});break;case"flask-sm":s=/* @__PURE__ */n.jsx(FlaskGlyph,{size:t,color:a});break;case"syringe":s=/* @__PURE__ */n.jsx(SyringeGlyph,{size:t,color:a});break;case"calendar":s=/* @__PURE__ */n.jsx(CalendarGlyph,{size:t,color:a});break;case"shield":s=/* @__PURE__ */n.jsx(ShieldGlyph,{size:t,color:a});break;case"folder":s=/* @__PURE__ */n.jsx(FolderGlyph,{size:t,color:a});break;case"clock":s=/* @__PURE__ */n.jsx(ClockFaceGlyph,{size:t,color:a});break;case"clip":s=/* @__PURE__ */n.jsx(ClipboardGlyph,{size:t,color:a});break;case"download":s=/* @__PURE__ */n.jsx(DownloadGlyph2,{size:t,color:a});break;case"upload":s=/* @__PURE__ */n.jsx(UploadArrowGlyph,{size:t,color:a});break;case"thermo":s=/* @__PURE__ */n.jsx(ThermoGlyph,{size:t,color:a});break;case"heart":s=/* @__PURE__ */n.jsx(HeartGlyph,{size:t,color:a});break;case"wind":s=/* @__PURE__ */n.jsx(WindGlyph,{size:t,color:a});break;case"file":s=/* @__PURE__ */n.jsx(FileGlyph,{size:t,color:a});break;case"check":s=/* @__PURE__ */n.jsx(CheckGlyph,{size:t,color:a});break;case"chevron":s=/* @__PURE__ */n.jsx(ChevronGlyph,{size:t,color:a,direction:"right"});break;default:s=null}/* @__PURE__ */
770
+ return n.jsx(r.View,{style:[{width:t,height:t,alignItems:"center",justifyContent:"center"},l],...Eb,children:s})}function HubCard({title:e,titleEnd:t,style:i,children:l,testID:o}){let{look:a}=Ob(),s=Db();/* @__PURE__ */
771
+ return n.jsxs(r.View,{style:[{padding:wl(".efh-card","paddingTop"),backgroundColor:a.white,borderRadius:wl(".efh-card","borderRadius"),shadowColor:"#000000",shadowOpacity:a.dark?0:.09,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:a.dark?0:1,borderWidth:a.dark?_b.card.border:0,borderColor:a.line},s.card,i],testID:o,children:[e!==void 0?/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:_b.card.headGap,marginBottom:_b.card.headBottom},children:[
772
+ /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",style:{flexGrow:1,flexShrink:1},children:e}),t]}):null,l]})}function HubPill({label:e,tone:t="plain",small:i=false,testID:l}){let{look:o}=Ob(),a={stable:{bg:o.tintGo,fg:o.ink},overdue:{bg:o.white,fg:o.alert,edge:o.alert,w:_b.pill.edgeThin},soon:{bg:o.white,fg:o.ink,edge:o.tintYellowEdge,w:_b.pill.edgeThin},later:{bg:o.white,fg:o.muted,edge:o.line,w:_b.pill.edgeThin},clear:{bg:o.white,fg:o.go,edge:o.go,w:_b.pill.edgeThick},plain:{bg:o.white,fg:o.ink,edge:o.pillPlainEdge,w:_b.pill.edgeThick},high:{bg:o.white,fg:o.alert,edge:o.alert,w:_b.pill.edgeThin},watch:{bg:o.watch,fg:o.ink}}[t],s=i?wl(".efh-tile__foot .efh-pill","fontSize"):wl(".efh-pill","fontSize");/* @__PURE__ */
773
+ return n.jsx(r.View,{testID:l,style:[{alignSelf:"flex-start",maxWidth:"100%",borderRadius:999,justifyContent:"center",backgroundColor:a.bg,minHeight:i?wl(".efh-tile__foot .efh-pill","minHeight"):wl(".efh-pill","minHeight"),paddingHorizontal:i?wl(".efh-tile__foot .efh-pill","paddingLeft"):wl(".efh-pill","paddingLeft")},a.edge!==void 0?{borderWidth:a.w,borderColor:a.edge}:null],children:/* @__PURE__ */n.jsx(HubText,{variant:"pill",color:a.fg,numberOfLines:1,style:{fontSize:s,lineHeight:s,letterSpacing:i?wl(".efh-tile__foot .efh-pill","letterSpacing"):wl(".efh-pill","letterSpacing")},children:e})})}function HubButton({label:e,onPress:t,variant:i="primary",size:l="md",icon:o,block:a=false,bold:s=false,style:d,accessibilityLabel:c,accessibilityHint:u,testID:h}){let{look:p,face:g}=Ob(),f=Db(),m=i==="text",b=i==="primary"?f.buttonInk??p.onFill:p.ink,y=l==="md"?_b.button.md:l==="sm"?_b.button.sm:l==="lg"?wl(".efh-btn","minHeight"):wl(".efh-btn--row","minHeight"),x=l==="md"?_b.button.padMd:l==="sm"?_b.button.padSm:l==="lg"?wl(".efh-btn","paddingLeft"):wl(".efh-btn--row","paddingLeft"),w=l==="row"?_b.button.iconRow:l==="sm"?_b.button.iconSm:_b.button.iconMd,v=m?{flexDirection:"row",alignItems:"center",gap:_b.button.textGap,minHeight:_b.button.textMinHeight}:[{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:_b.button.gap,borderRadius:999,minHeight:y,paddingHorizontal:x},i==="primary"?[l==="row"||l==="lg"?{backgroundColor:p.fill}:{backgroundColor:p.fill,borderWidth:_b.button.edge,borderColor:p.white},f.button]:[{backgroundColor:"transparent",borderWidth:_b.button.edge,borderColor:p.ink},f.radius]];/* @__PURE__ */
773
774
  return n.jsxs(r.Pressable,{onPress:t,disabled:t===void 0,accessibilityRole:"button",accessibilityLabel:c??e,...u!==void 0?{accessibilityHint:u}:{},hitSlop:l==="row"||m?4:void 0,style:[a?{alignSelf:"stretch"}:null,v,d],testID:h,children:[o!==void 0?/* @__PURE__ */n.jsx(HubIcon,{name:o,size:w,color:b}):null,
774
- /* @__PURE__ */n.jsx(HubText,{variant:l==="row"?"buttonRow":"button",color:b,numberOfLines:1,style:[l==="md"&&!m?{fontSize:Rb.button.mdLabel}:null,l==="row"?{fontSize:wl(".efh-btn--row","fontSize"),lineHeight:wl(".efh-btn--row","fontSize")*1.2}:null,l==="lg"?{fontSize:wl(".efh-btn","fontSize"),lineHeight:wl(".efh-btn","fontSize")*1.2}:null,i==="secondary"&&!s?g("regular"):null],children:e})]})}function HubChip({label:e,selected:t,onPress:i,testID:l}){let{look:o}=Vb();/* @__PURE__ */
775
- return n.jsx(r.Pressable,{onPress:i,hitSlop:4,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{selected:t},style:{flexDirection:"row",alignItems:"center",gap:6,borderRadius:999,minHeight:Rb.peek.chipHeight,paddingHorizontal:Rb.peek.chipPadX,borderWidth:1.5,borderColor:t?o.fill:o.line,backgroundColor:t?o.fill:o.white},testID:l,children:/* @__PURE__ */n.jsx(HubText,{variant:"chip",color:t?o.onFill:o.ink,numberOfLines:1,children:e})})}function HubRound({icon:e,rotate:t=0,label:i,disabled:l,onPress:o,testID:a}){let{look:s}=Vb(),d=Rb.peek.roundButton;/* @__PURE__ */
776
- return n.jsx(r.Pressable,{onPress:o,disabled:l,hitSlop:4,accessibilityRole:"button",accessibilityLabel:i,accessibilityState:{disabled:l},style:{width:d,height:d,borderRadius:d/2,alignItems:"center",justifyContent:"center",borderWidth:1.5,borderColor:s.ink,backgroundColor:s.white},testID:a,children:/* @__PURE__ */n.jsx(HubIcon,{name:e,size:18,style:t!==0?{transform:[{rotate:`${t}deg`}]}:void 0})})}var Lb=864e5,Eb=30,Ob=60,Ab=2.20462,$b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Bb=["January","February","March","April","May","June","July","August","September","October","November","December"],Fb=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Mb(e){if(e==null||e.trim()==="")return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function qb(e){let t=Mb(e);if(t===null)return null;let r=new Date(t),n=r.getUTCFullYear(),i=r.getUTCMonth(),l=r.getUTCDate();return{y:n,m:i,d:l,ms:Date.UTC(n,i,l)}}function Nb(e){let t=new Date(e);return{y:t.getFullYear(),ms:Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),weekday:t.getDay()}}function Wb(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function Ub(e,t,r){let n=typeof t=="number"&&Number.isFinite(t)&&t>0?yb(Math.floor(t*12+1e-9)):null,i=[e?.trim()||null,n,r?.primary??null].filter(e=>e!==null);return i.length>0?i.join(" · "):null}var Gb=/* @__PURE__ */Object.freeze({dhpp:"DHPP",dhlpp:"DHLPP",dhppi:"DHPPi",dapp:"DAPP",dap:"DAP",fvrcp:"FVRCP",felv:"FeLV",fiv:"FIV",hw:"HW",bcs:"BCS","4dx":"4DX"});function Kb(e){return e.split(/[_\s]+/).filter(Boolean).map(e=>Gb[e.toLowerCase()]??e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Yb(e){let t=e.toLowerCase();return t.includes("vacc")||t.includes("booster")||t.includes("rabies")||t.includes("dhpp")?"syringe":t.includes("test")||t.includes("screen")||t.includes("fecal")||t.includes("heartworm")||t.includes("worm")?"flask-sm":"calendar"}function Xb(e,t){let r=/* @__PURE__ */new Map;for(let t of e){let e=t.careItemKey?.trim()||t.title,n=r.get(e),i=Mb(t.dueAt),l=n===void 0?null:Mb(n.dueAt);(n===void 0||i!==null&&(l===null||i<l))&&r.set(e,t)}let n=Nb(t);return[...r.entries()].map(([e,r])=>{let i=qb(r.dueAt),l=r.careItemKey?.trim()?Kb(r.careItemKey.trim()):r.title;if(i===null)return{at:Number.POSITIVE_INFINITY,row:{key:e,label:l,when:bb.noDueDate,tone:"upcoming",icon:Yb(e),pill:{label:bb.later,tone:"later"}}};let o=Math.round((Mb(r.dueAt)-t)/Lb),a=o<0?"overdue":o<=Eb?"dueSoon":"upcoming",s=o<0?bb.overdueBy(-o):o===0?bb.dueToday:bb.dueIn(o),d=`${$b[i.m]} ${i.d}`,c=Math.round((i.ms-n.ms)/Lb),u;a==="overdue"||c<0?u=bb.withDue(s,d):c===0?u=s:c<=6?u=new Date(i.ms).getUTCDay()>n.weekday?bb.thisDay(bb.dueOn(d),Fb[new Date(i.ms).getUTCDay()]):bb.dueOn(d):c<Ob?u=bb.inWeeks(bb.dueOn(d),Math.round(c/7)):u=bb.dueOn(i.y===n.y?Bb[i.m]:`${Bb[i.m]} ${i.y}`);let h=a==="dueSoon"?{label:bb.dueSoon,tone:"watch"}:a==="upcoming"?{label:bb.later,tone:"later"}:null;return{at:i.ms,row:{key:e,label:l,when:u,tone:a,icon:Yb(e),pill:h}}}).sort((e,t)=>e.at-t.at).slice(0,Rb.upcoming.maxRows).map(e=>e.row)}function Qb(e,t,r,n){let i=t!==null&&!t.withheld,l=i?t.summary?.totalMarkers??t.markers.length:0,o=Gm.results(l),a=Xm(i?t.markers:[]),s=a!==null?{label:a.label,tone:a.flagged?"high":"clear",markerId:a.markerId}:null,d=r!==null&&!r.withheld?r.encounters:[],c=n!==null&&!n.withheld?n.visits:[],u=[...d.map(e=>qb(e.date)),...d.length>0?[]:c.map(e=>qb(e.visitDate))].filter(e=>e!==null).sort((e,t)=>t.ms-e.ms)[0]??null,h=u===null?null:`${String(u.m+1).padStart(2,"0")}.${String(u.d).padStart(2,"0")}.${u.y}`,p=n!==null&&!n.withheld?n.visits.length+n.vaccines.length+n.weights.length+n.medications.length:0,g=e!==null&&!e.withheld?e.entitySeries.filter(e=>/^(medication|problem)[:|]/.test(e.key)&&e.points.length>0).length:0;return{labsTotal:l,labsNoun:o,screeningsPill:s,visitDate:h,timelineCount:p+g}}function Jb(e,t,r){let n=t!==null&&!t.withheld?t.weights.filter(e=>e.weightKg!==null&&Number.isFinite(e.weightKg)).map(e=>({kg:e.weightKg,date:e.observedOn})):[],i=e!==null&&!e.withheld?e.entities.filter(e=>e.category==="body_weight"&&e.value!==null).map(e=>{let t=Number(e.value);return{kg:/lb/i.test(e.unit??"")?t/Ab:t,date:e.observedAt}}).filter(e=>Number.isFinite(e.kg)&&e.kg>0):[],l=(n.length>0?n:i).slice().sort((e,t)=>(Mb(e.date)??0)-(Mb(t.date)??0));if(l.length===0)return null;let o=l.map(e=>e.kg),a=null;if(o.length>=2){let e=o.slice().sort((e,t)=>e-t),t=Math.floor(e.length/2),r=e.length%2===1?e[t]:(e[t-1]+e[t])/2;r>0&&(a={lowKg:r*(1-Rb.chart.bandPct),highKg:r*(1+Rb.chart.bandPct)})}let s=l.map(e=>({...e,status:a===null?null:e.kg>a.highKg?"over":e.kg<a.lowKg?"under":"in"})),d=o[o.length-1],c=`${Wb(d*Ab)} lb`,u=`${Wb(d)} kg`,h=l.length===1?sm(l[0].date):null;return{primary:r==="kg"?u:c,secondary:r==="kg"?c:u,unit:r,points:s,band:a,date:h!==null?Ym(h):null}}function Zb(e){let t=Mb(e);if(t===null)return null;let r=new Date(t);return`${r.getUTCMonth()+1}/${String(r.getUTCFullYear()%100).padStart(2,"0")}`}function ey(e){let t=Mb(e);if(t===null)return null;let r=new Date(t);return`${r.getUTCMonth()+1}/${r.getUTCFullYear()}`}var ty=(e,t,r)=>Math.max(t,Math.min(r,e));function ry(e,t,r,n,i){return r==="start"?ty(e,n,Math.max(n,i-t)):r==="end"?ty(e,Math.min(i,n+t),i):ty(e,n+t/2,Math.max(n+t/2,i-t/2))}function ny(e,t){if(e<=0)return[];if(e<=t)return Array.from({length:e},(e,t)=>t);let r=/* @__PURE__ */new Set;for(let n=0;n<t;n+=1)r.add(Math.round(n*(e-1)/(t-1)));return[...r]}var iy=8,ly=.82,oy=2,ay=.6;function sy(e,t){let r=Rb.chart,n=r.plotTop,i=r.height-r.axisBand,l=i-n,o=t=>e.unit==="kg"?t:t*Ab,a=e.points.slice(-36),s=a.map(e=>e.kg),d,c=0,u=0,h=e.band,p=h!==null&&h.highKg>h.lowKg;if(p){let e=(h.highKg+h.lowKg)/2,t=(h.highKg-h.lowKg)/2,i=s.reduce((t,r)=>Math.max(t,Math.abs(r-e)),0),o=Math.max(t/(r.bandTo-r.bandFrom),i/r.reach),a=e+o;d=e=>n+(a-e)/(2*o)*l,c=d(h.highKg),u=d(h.lowKg)}else{let e=Math.min(...s),t=Math.max(...s);e===t&&(e-=1,t+=1);let r=(t-e)*.15;e-=r,t+=r,d=r=>i-(r-e)/(t-e)*l}let g=p?r.dataLeft:64,f=p?r.plotLeft:12,m=t-r.rightInset,b=a.length,y=e=>b<=1?(g+m)/2:g+e/(b-1)*(m-g),x=a.map(e=>Wb(o(e.kg))),w=x.reduce((e,t)=>Math.max(e,t.length),1),v=b>1?(m-g)/(b-1):m-g,k=ty(Math.min(r.labelMax,(v-r.edgePad)/(w*r.labelCharWidth)),r.labelMin,r.labelMax),j=a.map((n,l)=>{let o=y(l),a=d(n.kg),s=x[l],c=l===0?"start":l===b-1?"end":"middle",u=k*ly,h=i-2,p=a+r.dot+r.labelGap+u,g=n.status==="under"&&p<=h,f=ty(g?p:a-r.dot-r.labelGap,oy+u,h),m=ry(o,s.length*r.labelCharWidth*k,c,r.edgePad,t-r.edgePad);return{x:o,y:a,status:n.status,label:s,labelX:m,labelAnchor:c,labelBaseline:f,spoken:bb.pointLabel(ey(n.date),s,e.unit)}}),S=ny(b,r.maxTicks).flatMap(e=>{let n=p?Zb(a[e].date):ey(a[e].date);if(n===null)return[];let i=e===0?"start":e===b-1?"end":"middle";return[{x:ry(y(e),n.length*ay*r.monthSize,i,r.edgePad,t-r.edgePad),anchor:i,label:n}]}),C=r.legendLine,R=(e,t,n)=>{let l=e*C,o=ty((t+n)/2-l/2,0,Math.max(0,i-l));return Array.from({length:e},(e,t)=>o+t*C+C/2+r.legendSize*.35)},T=p?[{zone:"over",lines:bb.legendOver,top:n,bottom:c},{zone:"in",lines:bb.legendStable,top:c,bottom:u},{zone:"under",lines:bb.legendUnder,top:u,bottom:i}].map(e=>({zone:e.zone,lines:e.lines,baselines:R(e.lines.length,e.top,e.bottom)})):[],_=s.map(o),z=_[_.length-1]??0,I=_[0]??0,D=z>I?"rising":z<I?"falling":"steady",H=bb.trendSummary(_.length,Wb(z),D,p?Wb(o(h.lowKg)):null,p?Wb(o(h.highKg)):null);return{width:t,hasBand:p,yBandTop:c,yBandBottom:u,plotTop:n,plotBottom:i,plotLeft:f,dataRight:m,cols:a.map((e,t)=>y(t)),dots:j,showValues:b<=iy,valueFont:k,months:S,legend:T,summary:H}}var dy=3.55,cy=97,uy=3;function hy(e){let t=t=>e.unit==="kg"?t:t*Ab,r=e.points.slice(-36),n=r.map(e=>e.kg),i=e.band,l=i!==null&&i.highKg>i.lowKg,o;if(l){let e=(i.highKg+i.lowKg)/2,t=(i.highKg-i.lowKg)/2;o=r=>50-(r-e)/(2*t)*50}else{let e=Math.min(...n),t=Math.max(...n);e===t&&(e-=1,t+=1),o=r=>90-(r-e)/(t-e)*80}let a=r.length,s=e=>a<=1?50:dy+e/(a-1)*(cy-dy),d=e=>a<=1?null:e===0?"start":e===a-1?"end":null,c=r.map(e=>e.status==="over"||e.status==="under"||l&&(e.kg>i.highKg||e.kg<i.lowKg)),u=n.map(t),h=u[u.length-1]??0,p=u[0]??0,g=h>p?"rising":h<p?"falling":"steady";return{hasBand:l,points:r.map((e,r)=>({x:s(r),y:ty(o(e.kg),uy,100-uy),label:Wb(t(e.kg)),out:c[r],edge:d(r)})),allValues:a<=iy,ticks:ny(a,Rb.chart.maxTicks).flatMap(e=>{let t=Zb(r[e].date);return t===null?[]:[{x:s(e),label:t,edge:d(e)}]}),legend:[bb.legendOver.join(" "),bb.legendStable.join(" "),bb.legendUnder.join(" ")],summary:bb.trendSummary(u.length,Wb(h),g,l?Wb(t(i.lowKg)):null,l?Wb(t(i.highKg)):null)}}function py(e,t){return Zm(e,t).map(e=>({key:e.key,name:e.name,meta:e.meta.length>0?e.meta:null}))}function gy(e){let t=Mb(e);if(t===null)return null;let r=new Date(t);return`${$b[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`}var fy=typeof __EVERFUR_SDK_VERSION__=="string"&&__EVERFUR_SDK_VERSION__.length>0?__EVERFUR_SDK_VERSION__:ot,my=typeof __EVERFUR_CDN_ORIGIN__=="string"&&__EVERFUR_CDN_ORIGIN__.length>0?__EVERFUR_CDN_ORIGIN__:"https://sdk.everfur.com",by=`${my}/${fy}/assets/grass.webp`;var yy=/* @__PURE__ */Object.freeze({uri:by}),xy=null,EASE_OUT=e=>(xy??=r.Easing.bezier(.23,1,.32,1))(e);function wy(t,n){let i=n?1:0,l=e.useRef(new r.Animated.Value(i)).current,o=e.useRef(new r.Animated.Value(i)).current,a=e.useRef(new r.Animated.Value(i)).current,s=e.useRef(new r.Animated.Value(i)).current,d=e.useRef(n);e.useEffect(()=>{if(n){for(let e of[l,o,a,s])e.setValue(1);return}if(d.current)return;d.current=true;let e=(e,t,n=0)=>r.Animated.timing(e,{toValue:1,duration:t,delay:n,easing:EASE_OUT,useNativeDriver:true}),t=r.Animated.parallel([e(l,400,60),e(o,700,60),e(a,820),e(s,360)]);return t.start(),()=>t.stop()},[n,l,o,a,s]);let c=e.useRef(null);if(c.current===null||c.current.pet.opacity!==l){let e=a.interpolate({inputRange:[0,1],outputRange:[.35,1]}),r=a.interpolate({inputRange:[0,1],outputRange:[t*.65/2,0]});c.current={pet:{opacity:l,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[16,0]})}]},grass:{opacity:s,transform:[{translateY:r},{scaleY:e}]}}}return c.current}function RiseIn({index:t,reduced:i,children:l}){let o=e.useRef(new r.Animated.Value(i?1:0)).current;return e.useEffect(()=>{if(i){o.setValue(1);return}let e=r.Animated.timing(o,{toValue:1,duration:400,delay:t*60,easing:EASE_OUT,useNativeDriver:true});return e.start(),()=>e.stop()},[i,t,o]),/* @__PURE__ */n.jsx(r.Animated.View,{style:{opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[8,0]})}]},children:l})}function HubPetArt({art:e,onError:t,reduced:r}){return e.status!=="art"?null:/* @__PURE__ */n.jsx(PetImage,{url:e.url,onError:t,reduced:r},e.key)}function PetImage({url:t,onError:i,reduced:l}){let o=e.useRef(new r.Animated.Value(0)).current,a=()=>{if(l){o.setValue(1);return}r.Animated.timing(o,{toValue:1,duration:200,easing:EASE_OUT,useNativeDriver:true}).start()};/* @__PURE__ */
777
- return n.jsx(r.View,{style:{width:"100%",height:"100%"},testID:"everfur-records-sheet-pet-art",children:/* @__PURE__ */n.jsx(r.Animated.Image,{source:{uri:t},onLoad:a,onError:i,resizeMode:"contain",style:{width:"100%",height:"100%",opacity:o}})})}var vy=/* @__PURE__ */Object.freeze({reveal:480,revealFade:320,revealStagger:60,revealMaxSteps:8,revealRiseBlock:14,rollDigits:900,rollDigitStagger:55,chartDraw:850,slideTravel:48,slideMs:320}),ky=null,HUB_EASE_OUT=e=>(ky??=r.Easing.bezier(.23,1,.32,1))(e);function jy(e){return Math.min(Math.max(0,e),vy.revealMaxSteps-1)*vy.revealStagger}function HubReveal({index:t,reduced:i,style:l,testID:o,children:a}){let s=e.useRef(new r.Animated.Value(i?1:0)).current,d=e.useRef(new r.Animated.Value(i?1:0)).current,c=e.useRef(i);e.useEffect(()=>{if(i){s.setValue(1),d.setValue(1);return}if(c.current)return;let e=jy(t),n=r.Animated.parallel([r.Animated.timing(s,{toValue:1,duration:vy.reveal,delay:e,easing:HUB_EASE_OUT,useNativeDriver:true}),r.Animated.timing(d,{toValue:1,duration:vy.revealFade,delay:e,easing:HUB_EASE_OUT,useNativeDriver:true})]);return n.start(({finished:e})=>{e&&(c.current=true)}),()=>n.stop()},[i,t,s,d]);let u={opacity:d,transform:[{translateY:s.interpolate({inputRange:[0,1],outputRange:[vy.revealRiseBlock,0]})}]};/* @__PURE__ */
778
- return n.jsx(r.Animated.View,{style:[l,u],testID:o,children:a})}function Sy(t,n){let i=e.useRef(new r.Animated.Value(n?1:0)).current,l=e.useRef(n);return e.useEffect(()=>{if(n){i.setValue(1);return}if(!t||l.current)return;let e=r.Animated.timing(i,{toValue:1,duration:vy.chartDraw,easing:HUB_EASE_OUT,useNativeDriver:true});return e.start(({finished:e})=>{e&&(l.current=true)}),()=>e.stop()},[t,n,i]),i}function Cy(e){let t=e.slice(1).map((t,r)=>Math.hypot(t.x-e[r].x,t.y-e[r].y)),r=t.reduce((e,t)=>e+t,0),n=0;return t.map(e=>{let t=r>0?n/r:0;return n+=e,[t,r>0?n/r:1]})}function Ry(e,t,r){let[n,i]=t,l=i>n?i:n+1e-4,o=e.interpolate({inputRange:[n,l],outputRange:[1e-4,1],extrapolate:"clamp"});return{translateX:e.interpolate({inputRange:[n,l],outputRange:[-r/2,0],extrapolate:"clamp"}),scaleX:o}}function Ty(e,t){return t<=0?0:e[t-1]?.[1]??1}function _y(e,t){return e.interpolate({inputRange:[t-.0011,t-.001],outputRange:[0,1],extrapolate:"clamp"})}function zy(t,n){let i=e.useRef(t),l=e.useRef(new r.Animated.Value(0)).current,o=e.useRef(new r.Animated.Value(1)).current;return e.useEffect(()=>{let e=Math.sign(t-i.current);if(i.current=t,e===0||n)return;l.setValue(e*vy.slideTravel),o.setValue(0);let a=r.Animated.parallel([r.Animated.timing(l,{toValue:0,duration:vy.slideMs,easing:HUB_EASE_OUT,useNativeDriver:true}),r.Animated.timing(o,{toValue:1,duration:vy.slideMs,easing:HUB_EASE_OUT,useNativeDriver:true})]);return a.start(),()=>a.stop()},[t,n,l,o]),e.useRef({opacity:o,transform:[{translateX:l}]}).current}function Iy(e){return Array.from(e,e=>({char:e,digit:/\d/.test(e)?Number(e):null}))}function Dy(e){let t=Math.min(1,Math.max(0,e));return 1-Math.pow(1-t,3)}function HubRollingDigits({text:t,reduced:i,renderText:l,testID:o}){let[a,s]=e.useState(()=>!i&&/\d/.test(t)),d=e.useRef(t);return e.useEffect(()=>{d.current!==t&&s(false)},[t]),e.useEffect(()=>{i&&s(false)},[i]),a?/* @__PURE__ */n.jsxs(r.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:t,children:[
775
+ /* @__PURE__ */n.jsx(HubText,{variant:l==="row"?"buttonRow":"button",color:b,numberOfLines:1,style:[l==="md"&&!m?{fontSize:_b.button.mdLabel}:null,l==="row"?{fontSize:wl(".efh-btn--row","fontSize"),lineHeight:wl(".efh-btn--row","fontSize")*1.2}:null,l==="lg"?{fontSize:wl(".efh-btn","fontSize"),lineHeight:wl(".efh-btn","fontSize")*1.2}:null,i==="secondary"&&!s?g("regular"):null],children:e})]})}function HubChip({label:e,selected:t,onPress:i,testID:l}){let{look:o}=Ob();/* @__PURE__ */
776
+ return n.jsx(r.Pressable,{onPress:i,hitSlop:4,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{selected:t},style:{flexDirection:"row",alignItems:"center",gap:6,borderRadius:999,minHeight:_b.peek.chipHeight,paddingHorizontal:_b.peek.chipPadX,borderWidth:1.5,borderColor:t?o.fill:o.line,backgroundColor:t?o.fill:o.white},testID:l,children:/* @__PURE__ */n.jsx(HubText,{variant:"chip",color:t?o.onFill:o.ink,numberOfLines:1,children:e})})}function HubRound({icon:e,rotate:t=0,label:i,disabled:l,onPress:o,testID:a}){let{look:s}=Ob(),d=_b.peek.roundButton;/* @__PURE__ */
777
+ return n.jsx(r.Pressable,{onPress:o,disabled:l,hitSlop:4,accessibilityRole:"button",accessibilityLabel:i,accessibilityState:{disabled:l},style:{width:d,height:d,borderRadius:d/2,alignItems:"center",justifyContent:"center",borderWidth:1.5,borderColor:s.ink,backgroundColor:s.white},testID:a,children:/* @__PURE__ */n.jsx(HubIcon,{name:e,size:18,style:t!==0?{transform:[{rotate:`${t}deg`}]}:void 0})})}var Ab=864e5,$b=30,Bb=60,Fb=2.20462,Mb=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],qb=["January","February","March","April","May","June","July","August","September","October","November","December"],Nb=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Wb(e){if(e==null||e.trim()==="")return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Ub(e){let t=Wb(e);if(t===null)return null;let r=new Date(t),n=r.getUTCFullYear(),i=r.getUTCMonth(),l=r.getUTCDate();return{y:n,m:i,d:l,ms:Date.UTC(n,i,l)}}function Gb(e){let t=new Date(e);return{y:t.getFullYear(),ms:Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),weekday:t.getDay()}}function Kb(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function Yb(e,t,r){let n=typeof t=="number"&&Number.isFinite(t)&&t>0?wb(Math.floor(t*12+1e-9)):null,i=[e?.trim()||null,n,r?.primary??null].filter(e=>e!==null);return i.length>0?i.join(" · "):null}var Xb=/* @__PURE__ */Object.freeze({dhpp:"DHPP",dhlpp:"DHLPP",dhppi:"DHPPi",dapp:"DAPP",dap:"DAP",fvrcp:"FVRCP",felv:"FeLV",fiv:"FIV",hw:"HW",bcs:"BCS","4dx":"4DX"});function Qb(e){return e.split(/[_\s]+/).filter(Boolean).map(e=>Xb[e.toLowerCase()]??e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Jb(e){let t=e.toLowerCase();return t.includes("vacc")||t.includes("booster")||t.includes("rabies")||t.includes("dhpp")?"syringe":t.includes("test")||t.includes("screen")||t.includes("fecal")||t.includes("heartworm")||t.includes("worm")?"flask-sm":"calendar"}function Zb(e,t){let r=/* @__PURE__ */new Map;for(let t of e){let e=t.careItemKey?.trim()||t.title,n=r.get(e),i=Wb(t.dueAt),l=n===void 0?null:Wb(n.dueAt);(n===void 0||i!==null&&(l===null||i<l))&&r.set(e,t)}let n=Gb(t);return[...r.entries()].map(([e,r])=>{let i=Ub(r.dueAt),l=r.careItemKey?.trim()?Qb(r.careItemKey.trim()):r.title;if(i===null)return{at:Number.POSITIVE_INFINITY,row:{key:e,label:l,when:xb.noDueDate,tone:"upcoming",icon:Jb(e),pill:{label:xb.later,tone:"later"}}};let o=Math.round((Wb(r.dueAt)-t)/Ab),a=o<0?"overdue":o<=$b?"dueSoon":"upcoming",s=o<0?xb.overdueBy(-o):o===0?xb.dueToday:xb.dueIn(o),d=`${Mb[i.m]} ${i.d}`,c=Math.round((i.ms-n.ms)/Ab),u;a==="overdue"||c<0?u=xb.withDue(s,d):c===0?u=s:c<=6?u=new Date(i.ms).getUTCDay()>n.weekday?xb.thisDay(xb.dueOn(d),Nb[new Date(i.ms).getUTCDay()]):xb.dueOn(d):c<Bb?u=xb.inWeeks(xb.dueOn(d),Math.round(c/7)):u=xb.dueOn(i.y===n.y?qb[i.m]:`${qb[i.m]} ${i.y}`);let h=a==="dueSoon"?{label:xb.dueSoon,tone:"watch"}:a==="upcoming"?{label:xb.later,tone:"later"}:null;return{at:i.ms,row:{key:e,label:l,when:u,tone:a,icon:Jb(e),pill:h}}}).sort((e,t)=>e.at-t.at).slice(0,_b.upcoming.maxRows).map(e=>e.row)}function ey(e,t,r,n){let i=t!==null&&!t.withheld,l=i?t.summary?.totalMarkers??t.markers.length:0,o=Ym.results(l),a=Jm(i?t.markers:[]),s=a!==null?{label:a.label,tone:a.flagged?"high":"clear",markerId:a.markerId}:null,d=r!==null&&!r.withheld?r.encounters:[],c=n!==null&&!n.withheld?n.visits:[],u=[...d.map(e=>Ub(e.date)),...d.length>0?[]:c.map(e=>Ub(e.visitDate))].filter(e=>e!==null).sort((e,t)=>t.ms-e.ms)[0]??null,h=u===null?null:`${String(u.m+1).padStart(2,"0")}.${String(u.d).padStart(2,"0")}.${u.y}`,p=n!==null&&!n.withheld?n.visits.length+n.vaccines.length+n.weights.length+n.medications.length:0,g=e!==null&&!e.withheld?e.entitySeries.filter(e=>/^(medication|problem)[:|]/.test(e.key)&&e.points.length>0).length:0;return{labsTotal:l,labsNoun:o,screeningsPill:s,visitDate:h,timelineCount:p+g}}function ty(e,t,r){let n=t!==null&&!t.withheld?t.weights.filter(e=>e.weightKg!==null&&Number.isFinite(e.weightKg)).map(e=>({kg:e.weightKg,date:e.observedOn})):[],i=e!==null&&!e.withheld?e.entities.filter(e=>e.category==="body_weight"&&e.value!==null).map(e=>{let t=Number(e.value);return{kg:/lb/i.test(e.unit??"")?t/Fb:t,date:e.observedAt}}).filter(e=>Number.isFinite(e.kg)&&e.kg>0):[],l=(n.length>0?n:i).slice().sort((e,t)=>(Wb(e.date)??0)-(Wb(t.date)??0));if(l.length===0)return null;let o=l.map(e=>e.kg),a=null;if(o.length>=2){let e=o.slice().sort((e,t)=>e-t),t=Math.floor(e.length/2),r=e.length%2===1?e[t]:(e[t-1]+e[t])/2;r>0&&(a={lowKg:r*(1-_b.chart.bandPct),highKg:r*(1+_b.chart.bandPct)})}let s=l.map(e=>({...e,status:a===null?null:e.kg>a.highKg?"over":e.kg<a.lowKg?"under":"in"})),d=o[o.length-1],c=`${Kb(d*Fb)} lb`,u=`${Kb(d)} kg`,h=l.length===1?am(l[0].date):null;return{primary:r==="kg"?u:c,secondary:r==="kg"?c:u,unit:r,points:s,band:a,date:h!==null?Qm(h):null}}function ry(e){let t=Wb(e);if(t===null)return null;let r=new Date(t);return`${r.getUTCMonth()+1}/${String(r.getUTCFullYear()%100).padStart(2,"0")}`}function ny(e){let t=Wb(e);if(t===null)return null;let r=new Date(t);return`${r.getUTCMonth()+1}/${r.getUTCFullYear()}`}var iy=(e,t,r)=>Math.max(t,Math.min(r,e));function ly(e,t,r,n,i){return r==="start"?iy(e,n,Math.max(n,i-t)):r==="end"?iy(e,Math.min(i,n+t),i):iy(e,n+t/2,Math.max(n+t/2,i-t/2))}function oy(e,t){if(e<=0)return[];if(e<=t)return Array.from({length:e},(e,t)=>t);let r=/* @__PURE__ */new Set;for(let n=0;n<t;n+=1)r.add(Math.round(n*(e-1)/(t-1)));return[...r]}var ay=8,sy=.82,dy=2,cy=.6;function uy(e,t){let r=_b.chart,n=r.plotTop,i=r.height-r.axisBand,l=i-n,o=t=>e.unit==="kg"?t:t*Fb,a=e.points.slice(-36),s=a.map(e=>e.kg),d,c=0,u=0,h=e.band,p=h!==null&&h.highKg>h.lowKg;if(p){let e=(h.highKg+h.lowKg)/2,t=(h.highKg-h.lowKg)/2,i=s.reduce((t,r)=>Math.max(t,Math.abs(r-e)),0),o=Math.max(t/(r.bandTo-r.bandFrom),i/r.reach),a=e+o;d=e=>n+(a-e)/(2*o)*l,c=d(h.highKg),u=d(h.lowKg)}else{let e=Math.min(...s),t=Math.max(...s);e===t&&(e-=1,t+=1);let r=(t-e)*.15;e-=r,t+=r,d=r=>i-(r-e)/(t-e)*l}let g=p?r.dataLeft:64,f=p?r.plotLeft:12,m=t-r.rightInset,b=a.length,y=e=>b<=1?(g+m)/2:g+e/(b-1)*(m-g),x=a.map(e=>Kb(o(e.kg))),w=x.reduce((e,t)=>Math.max(e,t.length),1),v=b>1?(m-g)/(b-1):m-g,k=iy(Math.min(r.labelMax,(v-r.edgePad)/(w*r.labelCharWidth)),r.labelMin,r.labelMax),j=a.map((n,l)=>{let o=y(l),a=d(n.kg),s=x[l],c=l===0?"start":l===b-1?"end":"middle",u=k*sy,h=i-2,p=a+r.dot+r.labelGap+u,g=n.status==="under"&&p<=h,f=iy(g?p:a-r.dot-r.labelGap,dy+u,h),m=ly(o,s.length*r.labelCharWidth*k,c,r.edgePad,t-r.edgePad);return{x:o,y:a,status:n.status,label:s,labelX:m,labelAnchor:c,labelBaseline:f,spoken:xb.pointLabel(ny(n.date),s,e.unit)}}),S=oy(b,r.maxTicks).flatMap(e=>{let n=p?ry(a[e].date):ny(a[e].date);if(n===null)return[];let i=e===0?"start":e===b-1?"end":"middle";return[{x:ly(y(e),n.length*cy*r.monthSize,i,r.edgePad,t-r.edgePad),anchor:i,label:n}]}),C=r.legendLine,R=(e,t,n)=>{let l=e*C,o=iy((t+n)/2-l/2,0,Math.max(0,i-l));return Array.from({length:e},(e,t)=>o+t*C+C/2+r.legendSize*.35)},T=p?[{zone:"over",lines:xb.legendOver,top:n,bottom:c},{zone:"in",lines:xb.legendStable,top:c,bottom:u},{zone:"under",lines:xb.legendUnder,top:u,bottom:i}].map(e=>({zone:e.zone,lines:e.lines,baselines:R(e.lines.length,e.top,e.bottom)})):[],_=s.map(o),z=_[_.length-1]??0,I=_[0]??0,D=z>I?"rising":z<I?"falling":"steady",H=xb.trendSummary(_.length,Kb(z),D,p?Kb(o(h.lowKg)):null,p?Kb(o(h.highKg)):null);return{width:t,hasBand:p,yBandTop:c,yBandBottom:u,plotTop:n,plotBottom:i,plotLeft:f,dataRight:m,cols:a.map((e,t)=>y(t)),dots:j,showValues:b<=ay,valueFont:k,months:S,legend:T,summary:H}}var hy=3.55,py=97,gy=3;function fy(e){let t=t=>e.unit==="kg"?t:t*Fb,r=e.points.slice(-36),n=r.map(e=>e.kg),i=e.band,l=i!==null&&i.highKg>i.lowKg,o;if(l){let e=(i.highKg+i.lowKg)/2,t=(i.highKg-i.lowKg)/2;o=r=>50-(r-e)/(2*t)*50}else{let e=Math.min(...n),t=Math.max(...n);e===t&&(e-=1,t+=1),o=r=>90-(r-e)/(t-e)*80}let a=r.length,s=e=>a<=1?50:hy+e/(a-1)*(py-hy),d=e=>a<=1?null:e===0?"start":e===a-1?"end":null,c=r.map(e=>e.status==="over"||e.status==="under"||l&&(e.kg>i.highKg||e.kg<i.lowKg)),u=n.map(t),h=u[u.length-1]??0,p=u[0]??0,g=h>p?"rising":h<p?"falling":"steady";return{hasBand:l,points:r.map((e,r)=>({x:s(r),y:iy(o(e.kg),gy,100-gy),label:Kb(t(e.kg)),out:c[r],edge:d(r)})),allValues:a<=ay,ticks:oy(a,_b.chart.maxTicks).flatMap(e=>{let t=ry(r[e].date);return t===null?[]:[{x:s(e),label:t,edge:d(e)}]}),legend:[xb.legendOver.join(" "),xb.legendStable.join(" "),xb.legendUnder.join(" ")],summary:xb.trendSummary(u.length,Kb(h),g,l?Kb(t(i.lowKg)):null,l?Kb(t(i.highKg)):null)}}function my(e,t){return tb(e,t).map(e=>({key:e.key,name:e.name,meta:e.meta.length>0?e.meta:null}))}function by(e){let t=Wb(e);if(t===null)return null;let r=new Date(t);return`${Mb[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`}var yy=typeof __EVERFUR_SDK_VERSION__=="string"&&__EVERFUR_SDK_VERSION__.length>0?__EVERFUR_SDK_VERSION__:ot,xy=typeof __EVERFUR_CDN_ORIGIN__=="string"&&__EVERFUR_CDN_ORIGIN__.length>0?__EVERFUR_CDN_ORIGIN__:"https://sdk.everfur.com",wy=`${xy}/${yy}/assets/grass.webp`;var vy=/* @__PURE__ */Object.freeze({uri:wy}),ky=null,EASE_OUT=e=>(ky??=r.Easing.bezier(.23,1,.32,1))(e);function jy(t,n){let i=n?1:0,l=e.useRef(new r.Animated.Value(i)).current,o=e.useRef(new r.Animated.Value(i)).current,a=e.useRef(new r.Animated.Value(i)).current,s=e.useRef(new r.Animated.Value(i)).current,d=e.useRef(n);e.useEffect(()=>{if(n){for(let e of[l,o,a,s])e.setValue(1);return}if(d.current)return;d.current=true;let e=(e,t,n=0)=>r.Animated.timing(e,{toValue:1,duration:t,delay:n,easing:EASE_OUT,useNativeDriver:true}),t=r.Animated.parallel([e(l,400,60),e(o,700,60),e(a,820),e(s,360)]);return t.start(),()=>t.stop()},[n,l,o,a,s]);let c=e.useRef(null);if(c.current===null||c.current.pet.opacity!==l){let e=a.interpolate({inputRange:[0,1],outputRange:[.35,1]}),r=a.interpolate({inputRange:[0,1],outputRange:[t*.65/2,0]});c.current={pet:{opacity:l,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[16,0]})}]},grass:{opacity:s,transform:[{translateY:r},{scaleY:e}]}}}return c.current}function RiseIn({index:t,reduced:i,children:l}){let o=e.useRef(new r.Animated.Value(i?1:0)).current;return e.useEffect(()=>{if(i){o.setValue(1);return}let e=r.Animated.timing(o,{toValue:1,duration:400,delay:t*60,easing:EASE_OUT,useNativeDriver:true});return e.start(),()=>e.stop()},[i,t,o]),/* @__PURE__ */n.jsx(r.Animated.View,{style:{opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[8,0]})}]},children:l})}function HubPetArt({art:e,onError:t,reduced:r}){return e.status!=="art"?null:/* @__PURE__ */n.jsx(PetImage,{url:e.url,onError:t,reduced:r},e.key)}function PetImage({url:t,onError:i,reduced:l}){let o=e.useRef(new r.Animated.Value(0)).current,a=()=>{if(l){o.setValue(1);return}r.Animated.timing(o,{toValue:1,duration:200,easing:EASE_OUT,useNativeDriver:true}).start()};/* @__PURE__ */
778
+ return n.jsx(r.View,{style:{width:"100%",height:"100%"},testID:"everfur-records-sheet-pet-art",children:/* @__PURE__ */n.jsx(r.Animated.Image,{source:{uri:t},onLoad:a,onError:i,resizeMode:"contain",style:{width:"100%",height:"100%",opacity:o}})})}var Sy=/* @__PURE__ */Object.freeze({reveal:480,revealFade:320,revealStagger:60,revealMaxSteps:8,revealRiseBlock:14,rollDigits:900,rollDigitStagger:55,chartDraw:850,slideTravel:48,slideMs:320}),Cy=null,HUB_EASE_OUT=e=>(Cy??=r.Easing.bezier(.23,1,.32,1))(e);function Ry(e){return Math.min(Math.max(0,e),Sy.revealMaxSteps-1)*Sy.revealStagger}function HubReveal({index:t,reduced:i,style:l,testID:o,children:a}){let s=e.useRef(new r.Animated.Value(i?1:0)).current,d=e.useRef(new r.Animated.Value(i?1:0)).current,c=e.useRef(i);e.useEffect(()=>{if(i){s.setValue(1),d.setValue(1);return}if(c.current)return;let e=Ry(t),n=r.Animated.parallel([r.Animated.timing(s,{toValue:1,duration:Sy.reveal,delay:e,easing:HUB_EASE_OUT,useNativeDriver:true}),r.Animated.timing(d,{toValue:1,duration:Sy.revealFade,delay:e,easing:HUB_EASE_OUT,useNativeDriver:true})]);return n.start(({finished:e})=>{e&&(c.current=true)}),()=>n.stop()},[i,t,s,d]);let u={opacity:d,transform:[{translateY:s.interpolate({inputRange:[0,1],outputRange:[Sy.revealRiseBlock,0]})}]};/* @__PURE__ */
779
+ return n.jsx(r.Animated.View,{style:[l,u],testID:o,children:a})}function Ty(t,n){let i=e.useRef(new r.Animated.Value(n?1:0)).current,l=e.useRef(n);return e.useEffect(()=>{if(n){i.setValue(1);return}if(!t||l.current)return;let e=r.Animated.timing(i,{toValue:1,duration:Sy.chartDraw,easing:HUB_EASE_OUT,useNativeDriver:true});return e.start(({finished:e})=>{e&&(l.current=true)}),()=>e.stop()},[t,n,i]),i}function _y(e){let t=e.slice(1).map((t,r)=>Math.hypot(t.x-e[r].x,t.y-e[r].y)),r=t.reduce((e,t)=>e+t,0),n=0;return t.map(e=>{let t=r>0?n/r:0;return n+=e,[t,r>0?n/r:1]})}function zy(e,t,r){let[n,i]=t,l=i>n?i:n+1e-4,o=e.interpolate({inputRange:[n,l],outputRange:[1e-4,1],extrapolate:"clamp"});return{translateX:e.interpolate({inputRange:[n,l],outputRange:[-r/2,0],extrapolate:"clamp"}),scaleX:o}}function Iy(e,t){return t<=0?0:e[t-1]?.[1]??1}function Dy(e,t){return e.interpolate({inputRange:[t-.0011,t-.001],outputRange:[0,1],extrapolate:"clamp"})}function Hy(t,n){let i=e.useRef(t),l=e.useRef(new r.Animated.Value(0)).current,o=e.useRef(new r.Animated.Value(1)).current;return e.useEffect(()=>{let e=Math.sign(t-i.current);if(i.current=t,e===0||n)return;l.setValue(e*Sy.slideTravel),o.setValue(0);let a=r.Animated.parallel([r.Animated.timing(l,{toValue:0,duration:Sy.slideMs,easing:HUB_EASE_OUT,useNativeDriver:true}),r.Animated.timing(o,{toValue:1,duration:Sy.slideMs,easing:HUB_EASE_OUT,useNativeDriver:true})]);return a.start(),()=>a.stop()},[t,n,l,o]),e.useRef({opacity:o,transform:[{translateX:l}]}).current}function Vy(e){return Array.from(e,e=>({char:e,digit:/\d/.test(e)?Number(e):null}))}function Py(e){let t=Math.min(1,Math.max(0,e));return 1-Math.pow(1-t,3)}function HubRollingDigits({text:t,reduced:i,renderText:l,testID:o}){let[a,s]=e.useState(()=>!i&&/\d/.test(t)),d=e.useRef(t);return e.useEffect(()=>{d.current!==t&&s(false)},[t]),e.useEffect(()=>{i&&s(false)},[i]),a?/* @__PURE__ */n.jsxs(r.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:t,children:[
779
780
  /* @__PURE__ */n.jsx(r.View,{style:{opacity:0},importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:true,children:l(t,o!==void 0?{testID:o}:{})}),
780
- /* @__PURE__ */n.jsx(RollOverlay,{text:t,renderText:l,onDone:()=>s(false)})]}):l(t,o!==void 0?{testID:o}:{})}function RollOverlay({text:t,renderText:i,onDone:l}){let o=Iy(t),a=o.filter(e=>e.digit!==null).length,s=vy.rollDigits+Math.max(0,a-1)*vy.rollDigitStagger,d=e.useRef(new r.Animated.Value(0)).current,c=e.useRef(l);c.current=l,e.useEffect(()=>{let e=r.Animated.timing(d,{toValue:s,duration:s,easing:r.Easing.linear,useNativeDriver:true});return e.start(({finished:e})=>{e&&c.current()}),()=>e.stop()},[d,s]);let u=-1;/* @__PURE__ */
781
- return n.jsx(r.View,{style:{position:"absolute",left:0,top:0,right:0,bottom:0,flexDirection:"row",alignItems:"flex-end"},pointerEvents:"none",importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:true,children:o.map((e,t)=>e.digit===null?/* @__PURE__ */n.jsx(r.View,{children:i(e.char)},t):(u+=1,/* @__PURE__ */n.jsx(RollCell,{cell:e,t:d,delay:u*vy.rollDigitStagger,renderText:i},t)))})}var Hy=[0,1,2,3,4,5,6,7,8,9],Vy=24;function RollCell({cell:t,t:i,delay:l,renderText:o}){let[a,s]=e.useState(0),d=e=>{let t=e.nativeEvent.layout.height;t>0&&t!==a&&s(t)},c=t.digit??0,u=[],h=[];for(let e=0;e<=Vy;e+=1){let t=e/Vy;u.push(l+t*vy.rollDigits),h.push(-c*a*Dy(t))}let p=i.interpolate({inputRange:u,outputRange:h,extrapolate:"clamp"});/* @__PURE__ */
781
+ /* @__PURE__ */n.jsx(RollOverlay,{text:t,renderText:l,onDone:()=>s(false)})]}):l(t,o!==void 0?{testID:o}:{})}function RollOverlay({text:t,renderText:i,onDone:l}){let o=Vy(t),a=o.filter(e=>e.digit!==null).length,s=Sy.rollDigits+Math.max(0,a-1)*Sy.rollDigitStagger,d=e.useRef(new r.Animated.Value(0)).current,c=e.useRef(l);c.current=l,e.useEffect(()=>{let e=r.Animated.timing(d,{toValue:s,duration:s,easing:r.Easing.linear,useNativeDriver:true});return e.start(({finished:e})=>{e&&c.current()}),()=>e.stop()},[d,s]);let u=-1;/* @__PURE__ */
782
+ return n.jsx(r.View,{style:{position:"absolute",left:0,top:0,right:0,bottom:0,flexDirection:"row",alignItems:"flex-end"},pointerEvents:"none",importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:true,children:o.map((e,t)=>e.digit===null?/* @__PURE__ */n.jsx(r.View,{children:i(e.char)},t):(u+=1,/* @__PURE__ */n.jsx(RollCell,{cell:e,t:d,delay:u*Sy.rollDigitStagger,renderText:i},t)))})}var Ly=[0,1,2,3,4,5,6,7,8,9],Oy=24;function RollCell({cell:t,t:i,delay:l,renderText:o}){let[a,s]=e.useState(0),d=e=>{let t=e.nativeEvent.layout.height;t>0&&t!==a&&s(t)},c=t.digit??0,u=[],h=[];for(let e=0;e<=Oy;e+=1){let t=e/Oy;u.push(l+t*Sy.rollDigits),h.push(-c*a*Py(t))}let p=i.interpolate({inputRange:u,outputRange:h,extrapolate:"clamp"});/* @__PURE__ */
782
783
  return n.jsxs(r.View,{style:{overflow:"hidden"},onLayout:d,children:[
783
- /* @__PURE__ */n.jsx(r.View,{style:{opacity:0},children:o(t.char)}),a>0?/* @__PURE__ */n.jsx(r.Animated.View,{style:{position:"absolute",left:0,right:0,top:0,transform:[{translateY:p}]},children:Hy.map(e=>/* @__PURE__ */n.jsx(r.View,{style:{height:a},children:o(String(e))},e))}):null]})}function Py(e){return e===void 0||!("grassSrc"in e)?e:{grassSource:{uri:e.grassSrc},petSource:{uri:e.petSrc},...e.head!==void 0?{head:e.head}:{},...e.handFontFamily!==void 0?{handFontFamily:e.handFontFamily}:{}}}function Ly(e){let t=e/(bl.viewBox[2]-bl.viewBox[0]),r=bl.fontSize*t,n=Math.round(r*1.25),{x0:i,y0:l,cx:o,cy:a,x1:s,y1:d}=bl.path,c=e=>{let r=1-e;return[(r*r*i+2*r*e*o+e*e*s)*t,(r*r*l+2*r*e*a+e*e*d)*t]},u=120,h=[{len:0,t:0}],[p,g]=c(0),f=0;for(let e=1;e<=u;e+=1){let t=e/u,[r,n]=c(t);f+=Math.hypot(r-p,n-g),h.push({len:f,t:t}),p=r,g=n}let m=e=>{let t=Math.min(f,Math.max(0,e)),r=1;for(;r<h.length-1&&h[r].len<t;)r+=1;let n=h[r-1],u=h[r],p=n.t+(u.t-n.t)*((t-n.len)/Math.max(1e-6,u.len-n.len)),[g,m]=c(p),b=1-p,y=2*b*(o-i)+2*p*(s-o),x=2*b*(a-l)+2*p*(d-a);return{x:g,y:m,angle:Math.atan2(x,y)}};return{width:e,boxH:(bl.viewBox[3]-bl.viewBox[1])*t,font:r,line:n,baseline:(n-r)/2+r*.8,length:f,at:m}}var Ey=Ly(bl.width);function Oy(e){return e===bl.width?Ey:Ly(e)}function ArcLine({line:t,text:i,geom:l,opacity:o}){let a=e.useMemo(()=>Array.from(t),[t]),[s,d]=e.useState(()=>a.map(()=>null)),c=e=>t=>{let r=t.nativeEvent.layout.width;d(t=>t[e]===r?t:t.map((t,n)=>n===e?r:t))},u=s.every(e=>e!==null),h=null;if(u){let e=s,t=e.reduce((e,t)=>e+t,0),r=l.length/2-t/2;h=a.map((t,o)=>{let a=e[o],s=l.at(r+a/2);r+=a;let d=l.baseline-l.line/2,c=s.x+Math.sin(s.angle)*d,u=s.y-Math.cos(s.angle)*d;/* @__PURE__ */
784
+ /* @__PURE__ */n.jsx(r.View,{style:{opacity:0},children:o(t.char)}),a>0?/* @__PURE__ */n.jsx(r.Animated.View,{style:{position:"absolute",left:0,right:0,top:0,transform:[{translateY:p}]},children:Ly.map(e=>/* @__PURE__ */n.jsx(r.View,{style:{height:a},children:o(String(e))},e))}):null]})}function Ey(e){return e===void 0||!("grassSrc"in e)?e:{grassSource:{uri:e.grassSrc},petSource:{uri:e.petSrc},...e.head!==void 0?{head:e.head}:{},...e.handFontFamily!==void 0?{handFontFamily:e.handFontFamily}:{}}}function Ay(e){let t=e/(bl.viewBox[2]-bl.viewBox[0]),r=bl.fontSize*t,n=Math.round(r*1.25),{x0:i,y0:l,cx:o,cy:a,x1:s,y1:d}=bl.path,c=e=>{let r=1-e;return[(r*r*i+2*r*e*o+e*e*s)*t,(r*r*l+2*r*e*a+e*e*d)*t]},u=120,h=[{len:0,t:0}],[p,g]=c(0),f=0;for(let e=1;e<=u;e+=1){let t=e/u,[r,n]=c(t);f+=Math.hypot(r-p,n-g),h.push({len:f,t:t}),p=r,g=n}let m=e=>{let t=Math.min(f,Math.max(0,e)),r=1;for(;r<h.length-1&&h[r].len<t;)r+=1;let n=h[r-1],u=h[r],p=n.t+(u.t-n.t)*((t-n.len)/Math.max(1e-6,u.len-n.len)),[g,m]=c(p),b=1-p,y=2*b*(o-i)+2*p*(s-o),x=2*b*(a-l)+2*p*(d-a);return{x:g,y:m,angle:Math.atan2(x,y)}};return{width:e,boxH:(bl.viewBox[3]-bl.viewBox[1])*t,font:r,line:n,baseline:(n-r)/2+r*.8,length:f,at:m}}var $y=Ay(bl.width);function By(e){return e===bl.width?$y:Ay(e)}function ArcLine({line:t,text:i,geom:l,opacity:o}){let a=e.useMemo(()=>Array.from(t),[t]),[s,d]=e.useState(()=>a.map(()=>null)),c=e=>t=>{let r=t.nativeEvent.layout.width;d(t=>t[e]===r?t:t.map((t,n)=>n===e?r:t))},u=s.every(e=>e!==null),h=null;if(u){let e=s,t=e.reduce((e,t)=>e+t,0),r=l.length/2-t/2;h=a.map((t,o)=>{let a=e[o],s=l.at(r+a/2);r+=a;let d=l.baseline-l.line/2,c=s.x+Math.sin(s.angle)*d,u=s.y-Math.cos(s.angle)*d;/* @__PURE__ */
784
785
  return n.jsx(Text,{allowFontScaling:false,style:[i,{position:"absolute",left:c-a/2,top:u-l.line/2,width:a,textAlign:"center",transform:[{rotate:`${s.angle}rad`}]}],children:t},o)})}/* @__PURE__ */
785
786
  return n.jsxs(r.Animated.View,{style:{position:"absolute",left:0,top:0,right:0,bottom:0,opacity:o},children:[
786
- /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:0,top:0,width:l.width*4,flexDirection:"row",opacity:0},children:a.map((e,t)=>/* @__PURE__ */n.jsx(Text,{allowFontScaling:false,style:[i,{flexShrink:0}],onLayout:c(t),children:e},t))}),h]})}var Ay={accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",pointerEvents:"none"},$y=wl(".efh-stage","height")*kl(".efh-stage__pet","height");function SheetIcon({kind:e,size:t=jl.icon,color:i}){let l;switch(e){case"flask":l=/* @__PURE__ */n.jsx(FlaskGlyph,{size:t,color:i});break;case"thermo":l=/* @__PURE__ */n.jsx(ThermoGlyph,{size:t,color:i});break;case"heart":l=/* @__PURE__ */n.jsx(HeartGlyph,{size:t,color:i});break;case"wind":l=/* @__PURE__ */n.jsx(WindGlyph,{size:t,color:i});break;case"shield":l=/* @__PURE__ */n.jsx(ShieldGlyph,{size:t,color:i});break;case"folder":l=/* @__PURE__ */n.jsx(FolderGlyph,{size:t,color:i});break;case"clip":l=/* @__PURE__ */n.jsx(ClipboardGlyph,{size:t,color:i});break;case"clock":l=/* @__PURE__ */n.jsx(ClockFaceGlyph,{size:t,color:i});break;case"calendar":l=/* @__PURE__ */n.jsx(CalendarGlyph,{size:t,color:i});break;case"chevron":l=/* @__PURE__ */n.jsx(ChevronGlyph,{size:t,color:i,direction:"right"});break;case"upload":l=/* @__PURE__ */n.jsx(UploadArrowGlyph,{size:t,color:i});break;case"download":l=/* @__PURE__ */n.jsx(DownloadGlyph2,{size:t,color:i});break;default:l=null}/* @__PURE__ */
787
- return n.jsx(r.View,{style:{width:t,height:t,alignItems:"center",justifyContent:"center"},...Ay,children:l})}var By=e.createContext(null);function Fy(t){let r=useEverfurTheme(),n=t??r;return e.useMemo(()=>{let e=recordsSheetLook(n);return{theme:n,look:e,s:Wy(n,e)}},[n])}function My(t,r){let n=useEverfurTheme(),i=r?.font,l=r?.mono;return e.useMemo(()=>Hl(n,t,{...i!==void 0?{font:i}:{},...l!==void 0?{mono:l}:{}}),[n,t,i,l])}var qy=By.Provider;function Ny(){let t=Fy();return e.useContext(By)??t}function SheetPill({label:e,tone:t,small:i=false,style:l,testID:o}){let{s:a,look:s}=Ny();if(e.trim().length===0)return null;let d=i?7:10,c=(e,t)=>({backgroundColor:s.card,borderWidth:e,borderColor:t,paddingHorizontal:d-e}),u={watch:{backgroundColor:s.watch},stable:{backgroundColor:s.goTint},later:c(1.25,s.line),clear:c(1.5,s.go),plain:c(1.5,s.plainEdge),high:c(1.25,s.alert)},h=t==="later"?s.muted:t==="clear"?s.go:t==="high"?s.alert:s.ink;/* @__PURE__ */
788
- return n.jsx(r.View,{style:[a.pill,i?a.pillSmall:null,u[t],l],testID:o,children:/* @__PURE__ */n.jsx(Text,{tier:"compact",style:[a.pillText,i?a.pillTextSmall:null,{color:h}],children:e})})}function SheetCard({children:e,style:t,testID:i}){let{s:l}=Ny(),o=zb();/* @__PURE__ */
789
- return n.jsx(r.View,{style:[l.card,o.card,t],testID:i,children:e})}function SheetMarkerRow({name:e,value:t,unit:i,range:l,at:o,pill:a,testID:s}){let{s:d,look:c}=Ny();/* @__PURE__ */
787
+ /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:0,top:0,width:l.width*4,flexDirection:"row",opacity:0},children:a.map((e,t)=>/* @__PURE__ */n.jsx(Text,{allowFontScaling:false,style:[i,{flexShrink:0}],onLayout:c(t),children:e},t))}),h]})}var Fy={accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",pointerEvents:"none"},My=wl(".efh-stage","height")*kl(".efh-stage__pet","height");function SheetIcon({kind:e,size:t=jl.icon,color:i}){let l;switch(e){case"flask":l=/* @__PURE__ */n.jsx(FlaskGlyph,{size:t,color:i});break;case"thermo":l=/* @__PURE__ */n.jsx(ThermoGlyph,{size:t,color:i});break;case"heart":l=/* @__PURE__ */n.jsx(HeartGlyph,{size:t,color:i});break;case"wind":l=/* @__PURE__ */n.jsx(WindGlyph,{size:t,color:i});break;case"shield":l=/* @__PURE__ */n.jsx(ShieldGlyph,{size:t,color:i});break;case"folder":l=/* @__PURE__ */n.jsx(FolderGlyph,{size:t,color:i});break;case"clip":l=/* @__PURE__ */n.jsx(ClipboardGlyph,{size:t,color:i});break;case"clock":l=/* @__PURE__ */n.jsx(ClockFaceGlyph,{size:t,color:i});break;case"calendar":l=/* @__PURE__ */n.jsx(CalendarGlyph,{size:t,color:i});break;case"chevron":l=/* @__PURE__ */n.jsx(ChevronGlyph,{size:t,color:i,direction:"right"});break;case"upload":l=/* @__PURE__ */n.jsx(UploadArrowGlyph,{size:t,color:i});break;case"download":l=/* @__PURE__ */n.jsx(DownloadGlyph2,{size:t,color:i});break;default:l=null}/* @__PURE__ */
788
+ return n.jsx(r.View,{style:{width:t,height:t,alignItems:"center",justifyContent:"center"},...Fy,children:l})}var qy=e.createContext(null);function Ny(t){let r=useEverfurTheme(),n=t??r;return e.useMemo(()=>{let e=recordsSheetLook(n);return{theme:n,look:e,s:Ky(n,e)}},[n])}function Wy(t,r){let n=useEverfurTheme(),i=r?.font,l=r?.mono;return e.useMemo(()=>Hl(n,t,{...i!==void 0?{font:i}:{},...l!==void 0?{mono:l}:{}}),[n,t,i,l])}var Uy=qy.Provider;function Gy(){let t=Ny();return e.useContext(qy)??t}function SheetPill({label:e,tone:t,small:i=false,style:l,testID:o}){let{s:a,look:s}=Gy();if(e.trim().length===0)return null;let d=i?7:10,c=(e,t)=>({backgroundColor:s.card,borderWidth:e,borderColor:t,paddingHorizontal:d-e}),u={watch:{backgroundColor:s.watch},stable:{backgroundColor:s.goTint},later:c(1.25,s.line),clear:c(1.5,s.go),plain:c(1.5,s.plainEdge),high:c(1.25,s.alert)},h=t==="later"?s.muted:t==="clear"?s.go:t==="high"?s.alert:s.ink;/* @__PURE__ */
789
+ return n.jsx(r.View,{style:[a.pill,i?a.pillSmall:null,u[t],l],testID:o,children:/* @__PURE__ */n.jsx(Text,{tier:"compact",style:[a.pillText,i?a.pillTextSmall:null,{color:h}],children:e})})}function SheetCard({children:e,style:t,testID:i}){let{s:l}=Gy(),o=Db();/* @__PURE__ */
790
+ return n.jsx(r.View,{style:[l.card,o.card,t],testID:i,children:e})}function SheetMarkerRow({name:e,value:t,unit:i,range:l,at:o,pill:a,testID:s}){let{s:d,look:c}=Gy();/* @__PURE__ */
790
791
  return n.jsxs(r.View,{style:d.mk,testID:s,children:[
791
792
  /* @__PURE__ */n.jsxs(r.View,{style:d.mkText,children:[
792
793
  /* @__PURE__ */n.jsxs(r.View,{style:d.mkNameRow,children:[
793
794
  /* @__PURE__ */n.jsx(Text,{style:d.mkName,children:e}),a!==null?/* @__PURE__ */n.jsx(SheetPill,{label:a,tone:"high"}):null]}),
794
795
  /* @__PURE__ */n.jsxs(r.View,{style:d.mkLine,children:[
795
- /* @__PURE__ */n.jsx(Text,{style:d.mkValue,children:t}),i?/* @__PURE__ */n.jsx(Text,{style:d.mkLineText,children:i}):null,l!==null?/* @__PURE__ */n.jsx(Text,{style:d.mkLineText,children:`· ${l}`}):null]})]}),o!==null?/* @__PURE__ */n.jsxs(r.View,{style:d.mkBar,...Ay,children:[
796
+ /* @__PURE__ */n.jsx(Text,{style:d.mkValue,children:t}),i?/* @__PURE__ */n.jsx(Text,{style:d.mkLineText,children:i}):null,l!==null?/* @__PURE__ */n.jsx(Text,{style:d.mkLineText,children:`· ${l}`}):null]})]}),o!==null?/* @__PURE__ */n.jsxs(r.View,{style:d.mkBar,...Fy,children:[
796
797
  /* @__PURE__ */n.jsx(r.View,{style:[d.mkBarIn,{backgroundColor:c.go}]}),
797
798
  /* @__PURE__ */n.jsx(r.View,{style:[d.mkBarDot,{left:`${o}%`,backgroundColor:c.ink,borderColor:c.card}]})]}):null]})}function ChartLine({points:t,color:i}){let[l,o]=e.useState(null),a=e=>{let{width:t,height:r}=e.nativeEvent.layout;(l===null||l.w!==t||l.h!==r)&&o({w:t,h:r})},s=l===null?[]:t.slice(1).map((e,r)=>{let n=t[r]??e,i=n.x/100*l.w,o=n.y/100*l.h,a=e.x/100*l.w,s=e.y/100*l.h,d=Math.hypot(a-i,s-o),c=Math.atan2(s-o,a-i)*180/Math.PI;return{key:r,left:(i+a)/2-d/2,top:(o+s)/2-.75,length:d,angle:c}});/* @__PURE__ */
798
- return n.jsx(r.View,{style:Xc,onLayout:a,...Ay,children:s.map(e=>/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:e.left,top:e.top,width:e.length,height:1.5,backgroundColor:i,transform:[{rotate:`${e.angle}deg`}]}},e.key))})}function Wy(e,t){let n=face(e,"regular"),i=face(e,"bold"),l=headingFace(e,"bold"),o=face(e,"mono"),a=face(e,"monoBold"),s=(e,t)=>Ky(e*t);return r.StyleSheet.create({scroll:{flexGrow:1},topSlot:{paddingHorizontal:jl.sheetPadX},sheet:{flexGrow:1,gap:jl.gap,paddingTop:jl.sheetPadTop,paddingHorizontal:jl.sheetPadX,paddingBottom:jl.sheetPadBottom,borderTopLeftRadius:jl.sheetRadius,borderTopRightRadius:jl.sheetRadius,backgroundColor:t.ground},sheetUnderSlot:{marginTop:jl.sheetGap},card:{padding:jl.cardPad,backgroundColor:t.card,borderRadius:jl.cardRadius,shadowColor:"#000000",shadowOpacity:t.dark?0:.09,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:t.dark?0:1,borderWidth:t.dark?1:0,borderColor:t.line},cardHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:12},cardTitle:{...i,fontSize:jl.cardTitle,lineHeight:s(jl.cardTitle,1.25),letterSpacing:-.36,color:t.ink},cardTitleGap:{marginBottom:12},sec:{marginTop:8,marginBottom:12},head:{marginBottom:wl(".efh-head","marginBottom")},name:{...l,fontSize:jl.name,lineHeight:s(jl.name,1.2),letterSpacing:-.44,color:t.ink,flexShrink:1},meta:{...n,marginTop:2,fontSize:jl.small,lineHeight:s(jl.small,1.4),letterSpacing:.26,textTransform:"uppercase",color:t.muted},label:{...a,marginTop:wl(".efh-head__from","marginTop"),fontSize:jl.mono,lineHeight:s(jl.mono,1.4),letterSpacing:.72,textTransform:"uppercase",color:t.muted},vitals:{flexDirection:"row",gap:8,marginTop:8},stage:{position:"relative",height:wl(".efh-stage","height"),marginTop:wl(".efh-stage","marginTop"),marginHorizontal:wl(".efh-stage","marginLeft"),overflow:"hidden"},stageGrass:{position:"absolute",left:0,right:0,bottom:0,height:`${kl(".efh-stage__grass","height")*100}%`,overflow:"hidden"},stagePet:{position:"absolute",left:`${kl(".efh-stage__pet","left")*100}%`,bottom:wl(".efh-stage__pet","bottom"),height:$y},stageVitals:{position:"absolute",top:wl(".efh-stage .efh-vitals","top"),left:wl(".efh-stage .efh-vitals","left"),gap:wl(".efh-stage .efh-vitals","gap")},vital:{flex:1,minWidth:0},vitalTop:{flexDirection:"row",alignItems:"center",gap:6},vitalValue:{...i,fontSize:17,lineHeight:s(17,1.2),color:t.ink},vitalUnit:{...n,fontSize:jl.small,color:t.muted},vitalLabel:{...n,marginTop:2,fontSize:jl.small,lineHeight:s(jl.small,1.4),color:t.muted},due:{gap:4,marginHorizontal:-12},dueRow:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:jl.rowRadius},dueText:{flex:1,minWidth:0,gap:2},duePill:{alignSelf:"center"},dueTitle:{...i,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.3),color:t.ink},dueWhen:{...n,fontSize:jl.small,lineHeight:s(jl.small,1.4),color:t.muted},pill:{minHeight:jl.pill,paddingHorizontal:10,borderRadius:999,alignItems:"center",justifyContent:"center",alignSelf:"flex-start"},pillSmall:{minHeight:22,paddingHorizontal:7},pillText:{...a,fontSize:jl.mono,lineHeight:jl.mono+2,letterSpacing:.72,textTransform:"uppercase"},pillTextSmall:{fontSize:10.5,letterSpacing:.21},tiles:{flexDirection:"row",flexWrap:"wrap",gap:jl.tileGap},tile:{flexGrow:1,flexBasis:"45%",minWidth:0,gap:8,padding:16,borderRadius:jl.cardRadius},tileTop:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between"},tileTitle:{...i,fontSize:jl.body,lineHeight:s(jl.body,1.25),letterSpacing:-.15,color:t.ink},tileFoot:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:8,minHeight:28},tileNum:{...i,fontSize:jl.tileNum,lineHeight:jl.tileNum+2,letterSpacing:-.4,color:t.ink},tileUnit:{...n,fontSize:jl.small,color:t.muted},emptyLine:{...n,fontSize:jl.small,lineHeight:s(jl.small,1.5),color:t.muted},wt:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:8},wtValue:{...i,fontSize:jl.big,lineHeight:wl(".efh-wt b","lineHeight"),letterSpacing:-.64,color:t.ink},wtSub:{...n,fontSize:jl.body,color:t.muted},chart:{marginTop:20},plot:{position:"relative",height:jl.plot},point:{position:"absolute",width:12,height:12,marginLeft:-6,marginTop:-6,borderRadius:6,borderWidth:1.5,borderColor:t.card},pointLabel:{...face(e,"medium"),position:"absolute",width:46,marginLeft:-23,textAlign:"center",fontSize:jl.mono,lineHeight:jl.mono+2,color:t.dark?t.text:Uy},xAxis:{position:"relative",height:18,marginTop:8},xTick:{...o,position:"absolute",top:0,width:56,marginLeft:-28,textAlign:"center",fontSize:jl.mono,lineHeight:s(jl.mono,1.3),color:t.muted},key:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:6,marginTop:12},keyDot:{width:12,height:12,borderRadius:6,backgroundColor:t.ink},keyText:{...n,fontSize:jl.small,lineHeight:s(jl.small,1.4),color:t.muted},tlKey:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},tlKeyDot:{width:10,height:10,borderRadius:5,borderWidth:2.5,borderColor:t.ink,backgroundColor:t.card},tlYear:{...a,marginTop:20,marginBottom:12,marginLeft:40,fontSize:jl.mono,lineHeight:s(jl.mono,1.4),letterSpacing:.72,textTransform:"uppercase",color:t.muted},tlItem:{position:"relative",flexDirection:"row",gap:16,paddingBottom:24},tlItemLast:{paddingBottom:0},tlRail:{position:"absolute",left:11,top:22,bottom:-2,width:2,borderRadius:1,backgroundColor:t.line},tlRailEnd:{bottom:12},tlDot:{width:16,height:16,marginTop:3,marginHorizontal:4,borderRadius:8,borderWidth:3,borderColor:t.ink,backgroundColor:t.card},tlBody:{flex:1,minWidth:0},tlBtn:{marginTop:-8,marginHorizontal:-8,paddingVertical:8,paddingLeft:8,paddingRight:36,borderRadius:jl.rowRadius,backgroundColor:t.alertTint},tlChevron:{position:"absolute",right:8,top:"50%",marginTop:-10},tlDate:{...o,fontSize:jl.mono,lineHeight:s(jl.mono,1.4),letterSpacing:.48,textTransform:"uppercase",color:t.muted},tlTitle:{...i,marginTop:2,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.3),color:t.ink},tlText:{...n,marginTop:2,fontSize:jl.body,lineHeight:s(jl.body,1.5),color:t.text},pull:{paddingTop:4,paddingBottom:24,paddingLeft:40},pullStep:{...i,fontSize:jl.body,lineHeight:s(jl.body,1.4),color:t.ink},pullBar:{height:6,marginTop:10,overflow:"hidden",borderRadius:999,backgroundColor:t.line},pullFill:{height:"100%",backgroundColor:t.accent},failed:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:jl.rowRadius,backgroundColor:t.alertTint},failedText:{...i,flex:1,fontSize:jl.body,lineHeight:s(jl.body,1.4),color:t.alertDeep},add:{gap:12},addHead:{flexDirection:"row",alignItems:"center",gap:8},addLead:{...n,fontSize:jl.body,lineHeight:s(jl.body,1.5),color:t.text},sources:{gap:6},source:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",columnGap:12,paddingVertical:10,paddingHorizontal:14,borderRadius:jl.rowRadius,backgroundColor:t.rowGround},sourceLabel:{...n,fontSize:jl.body,lineHeight:s(jl.body,1.4),color:t.text},sourceDetail:{...n,fontSize:jl.small,color:t.muted},addActs:{gap:12,paddingTop:4},button:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,minHeight:jl.button,paddingHorizontal:20,borderRadius:999},buttonRow:{minHeight:jl.rowButton,paddingHorizontal:16},buttonText:{...i,fontSize:16,lineHeight:20},buttonTextRow:{fontSize:jl.body},noneWithScene:{paddingTop:wl(".efh-none","paddingTop")},scene:{position:"relative",height:yl.height,marginHorizontal:wl(".efh-none__scene","marginLeft"),marginBottom:wl(".efh-none__scene","marginBottom"),overflow:"hidden",borderTopLeftRadius:jl.cardRadius,borderTopRightRadius:jl.cardRadius},sceneGrass:{position:"absolute",left:0,right:0,bottom:0,height:yl.grassHeight,overflow:"hidden"},scenePet:{position:"absolute",left:"50%",bottom:yl.petBottom,height:yl.petHeight},noneTitle:{...l,fontSize:wl(".efh-none__t","fontSize"),lineHeight:wl(".efh-none__t","lineHeight"),letterSpacing:wl(".efh-none__t","letterSpacing"),color:t.ink},noneLead:{...n,marginTop:wl(".efh-none__lead","marginTop"),fontSize:wl(".efh-none__lead","fontSize"),lineHeight:wl(".efh-none__lead","lineHeight"),color:t.text},noneLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",columnGap:4,marginTop:wl(".efh-none__lead","marginTop")},noneLineText:{...n,fontSize:wl(".efh-none__lead","fontSize"),lineHeight:wl(".efh-none__lead","lineHeight"),color:t.text},noneLink:{...i,fontSize:wl(".efh-none__lead","fontSize"),lineHeight:wl(".efh-none__lead","lineHeight"),color:t.ink,textDecorationLine:"underline"},repeatLine:{...i,marginTop:wl(".efh-ways","gap"),fontSize:wl(".efh-none__lead","fontSize"),lineHeight:wl(".efh-none__lead","lineHeight"),color:t.ink},ways:{gap:wl(".efh-ways","gap"),marginTop:wl(".efh-ways","marginTop")},way:{flexDirection:"row",alignItems:"center",gap:wl(".efh-way","columnGap"),padding:wl(".efh-way","paddingTop"),borderRadius:wl(".efh-way","borderRadius")},wayText:{flex:1,minWidth:0,gap:wl(".efh-way__w","gap")},wayTitle:{...i,fontSize:wl(".efh-way__t","fontSize"),lineHeight:wl(".efh-way__t","lineHeight")},wayDetail:{...n,fontSize:wl(".efh-way__x","fontSize"),lineHeight:wl(".efh-way__x","lineHeight")},tracker:{marginTop:16},step:{flexDirection:"row",gap:16,paddingBottom:20},stepLast:{paddingBottom:0},stepRail:{position:"absolute",left:Gy/2-1,top:Gy+2,bottom:2,width:2,borderRadius:1,backgroundColor:t.line},stepRailDone:{backgroundColor:t.ink},stepDot:{width:Gy,height:Gy,borderRadius:Gy/2,borderWidth:2,borderColor:t.line,backgroundColor:t.card,alignItems:"center",justifyContent:"center"},stepDotOn:{borderColor:t.ink},stepDotDone:{backgroundColor:t.fill,borderColor:t.fill},stepNow:{width:10,height:10,borderRadius:5,backgroundColor:t.accent},stepText:{flex:1,minWidth:0,paddingTop:3,gap:2},stepTitle:{...i,fontSize:wl(".efh-mk__name","fontSize"),lineHeight:22,color:t.ink},stepWhen:{...n,fontSize:wl(".efh-mk__line","fontSize"),lineHeight:wl(".efh-mk__line","lineHeight"),color:t.muted},peek:{gap:12,marginTop:12},peekHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:12},peekLead:{...n,marginTop:-4,fontSize:jl.body,lineHeight:s(jl.body,1.5),color:t.text},peekLabsTitle:{marginBottom:wl(".efh-peek__labs .efh-card__title","marginBottom")},peekGroup:{marginBottom:wl(".efh-peek__g","marginBottom")},peekGroupTitle:{...i,fontSize:wl(".efh-peek__g b","fontSize"),lineHeight:Ky(wl(".efh-peek__g b","fontSize")*(wl(".efh-peek__g","lineHeight")/wl(".efh-peek__g","fontSize"))),color:t.ink},peekGroupLead:{...n,fontSize:wl(".efh-peek__g","fontSize"),lineHeight:wl(".efh-peek__g","lineHeight"),color:t.muted},more:{gap:10},moreCard:{gap:10,padding:16,borderRadius:jl.cardRadius},moreHead:{flexDirection:"row",alignItems:"center",gap:8},moreTitle:{...i,fontSize:16,lineHeight:s(16,1.3),color:t.ink},moreLead:{...n,fontSize:jl.body,lineHeight:s(jl.body,1.5),color:t.text},moreRows:{gap:6},moreRow:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:44,paddingVertical:8,paddingHorizontal:14,borderRadius:jl.rowRadius,backgroundColor:t.card},moreRowLabel:{...n,flexShrink:1,fontSize:jl.body,lineHeight:s(jl.body,1.4),color:t.text},moreWhen:{...o,fontSize:jl.mono,letterSpacing:.24,color:t.muted},note:{...n,marginTop:wl(".efh-sheet .rec-note","marginTop"),fontSize:wl(".rec-note","fontSize"),textAlign:"center",color:t.muted},mks:{gap:2,marginHorizontal:-8},mk:{flexDirection:"row",alignItems:"center",gap:12,paddingVertical:10,paddingHorizontal:8},mkText:{flex:1,minWidth:0},mkNameRow:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:8},mkName:{...i,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.3),color:t.ink},mkLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",rowGap:wl(".efh-mk__line","rowGap"),columnGap:wl(".efh-mk__line","columnGap"),marginTop:wl(".efh-mk__line","marginTop")},mkLineText:{...n,fontSize:wl(".efh-mk__line","fontSize"),lineHeight:wl(".efh-mk__line","lineHeight"),color:t.muted,fontVariant:["tabular-nums"]},mkValue:{...i,fontSize:wl(".efh-mk__line b","fontSize"),lineHeight:Ky(wl(".efh-mk__line b","fontSize")*(wl(".efh-mk__line","lineHeight")/wl(".efh-mk__line","fontSize"))),color:t.text,fontVariant:["tabular-nums"]},mkBar:{position:"relative",width:96,height:6,borderRadius:999,backgroundColor:t.barTrack},mkBarIn:{position:"absolute",top:0,bottom:0,left:"20%",right:"20%",borderRadius:999},mkBarDot:{position:"absolute",top:-2,width:10,height:10,marginLeft:-5,borderRadius:5,borderWidth:2},topRisk:{gap:wl(".rec-top","gap"),paddingTop:wl(".rec-top","paddingTop"),paddingRight:wl(".rec-top","paddingRight"),paddingBottom:wl(".rec-top","paddingBottom"),paddingLeft:wl(".rec-top","paddingLeft"),backgroundColor:t.topFill,borderRadius:wl(".rec-top","borderRadius"),borderWidth:0,shadowOpacity:0,elevation:0},topRiskKicker:{flexDirection:"row",alignItems:"center",gap:wl(".rec-top__k","gap")},topRiskDot:{width:8,height:8,borderRadius:4,backgroundColor:t.alert},topRiskK:{...o,fontSize:wl(".rec-top__k","fontSize"),lineHeight:wl(".rec-top__k","fontSize")*1.5,letterSpacing:wl(".rec-top__k","letterSpacing"),textTransform:"uppercase",color:t.topKicker},topRiskText:{...i,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.35),color:t.topInk},disclaimer:{...n,fontSize:jl.small,lineHeight:s(jl.small,1.5),textAlign:"center",color:t.muted},lab:{gap:jl.gap,paddingTop:8,paddingHorizontal:16,paddingBottom:32,backgroundColor:t.ground},labTitle:{...face(e,"medium"),fontSize:jl.name,lineHeight:s(jl.name,1.2),letterSpacing:-.33,color:t.ink},labMeta:{...o,fontSize:jl.small,lineHeight:s(jl.small,1.45),color:t.muted},latest:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:4},latestSub:{...n,fontSize:jl.body,color:t.muted},change:{...n,marginTop:12,fontSize:jl.body,color:t.text},changeLead:{...i,color:t.ink},ctx:{gap:12},ctxText:{...n,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.55),color:t.text},labBody:{flexDirection:"row",gap:8},rail:{width:8,height:jl.plot,overflow:"hidden",borderRadius:2},legend:{width:82,height:jl.plot,position:"relative"},range:{...a,position:"absolute",left:0,right:0,fontSize:jl.mono,lineHeight:s(jl.mono,1.2),letterSpacing:.24,textTransform:"uppercase",color:t.dark?t.text:Uy},band:{position:"absolute",left:0,right:0,top:"25%",height:"50%",backgroundColor:t.goTint}})}var Uy="#3D3D3D",Gy=28,Ky=e=>Math.round(e*100)/100;var Yy={accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",pointerEvents:"none"},Xy=Oy(Rb.hero.sayWidth),Qy=wl(".efh-stage","height"),Jy=Qy*kl(".efh-stage__grass","height");function Zy(e){let t=Number(e);return e.trim()!==""&&Number.isFinite(t)?String(t):e}var ex=44e3,tx=1100,rx=1188,nx=1200,ix=3600;function SayPhrase({text:t,index:i,family:l}){let{look:o}=Vb(),a=e.useRef(new r.Animated.Value(0)).current;return e.useEffect(()=>{a.setValue(0);let e=r.Easing.inOut(r.Easing.ease),t=r.Animated.sequence([r.Animated.delay(nx+i*ix),r.Animated.loop(r.Animated.sequence([r.Animated.timing(a,{toValue:1,duration:tx,easing:e,useNativeDriver:true}),r.Animated.delay(rx),r.Animated.timing(a,{toValue:0,duration:tx,easing:e,useNativeDriver:true}),r.Animated.delay(ex-tx*2-rx)]))]);return t.start(),()=>t.stop()},[i,a]),/* @__PURE__ */n.jsx(ArcLine,{line:t,geom:Xy,opacity:a,text:{fontFamily:l,fontWeight:"500",fontSize:Xy.font,lineHeight:Xy.line,color:o.ink}})}function HubSay({family:e}){let{look:t}=Vb();return useEverfurTheme().motion.reducedMotion?/* @__PURE__ */n.jsx(ArcLine,{line:bb.sayLine,geom:Xy,opacity:1,text:{fontFamily:e,fontWeight:"500",fontSize:Xy.font,lineHeight:Xy.line,color:t.ink}}):/* @__PURE__ */n.jsx(n.Fragment,{children:bb.sayPhrases.map((t,r)=>/* @__PURE__ */n.jsx(SayPhrase,{text:t,index:r,family:e},t))})}function HubHero({name:t,meta:i,stage:l,art:o,handFontFamily:a,say:s,vitals:d,vitalsName:c,renderStage:u,exam:h,onOpenExam:p,headPill:g,fromLine:f}){let{look:m,face:b}=Vb(),y=useEverfurTheme().motion.reducedMotion,[x,w]=e.useState(false),v=h!=null,k=l!==void 0||u===void 0,j=wy(Jy,y),S=l?.grassSource??yy,[C,R]=e.useState(null),T=dx(S),_=d.length>0?/* @__PURE__ */n.jsx(r.View,{style:k?{position:"absolute",top:wl(".efh-stage .efh-vitals","top"),left:wl(".efh-stage .efh-vitals","left"),gap:wl(".efh-stage .efh-vitals","gap")}:{paddingHorizontal:Rb.screen.padX,marginTop:4,gap:wl(".efh-stage .efh-vitals","gap")},accessibilityLabel:bb.vitalsLabel(c),testID:"everfur-records-sheet-vitals",children:d.map((e,t)=>{let i=Zy(e.value),l=e.kind==="temp"?bb.temperature:e.kind==="heart"?bb.heartRate:bb.breathing,o=e.kind==="temp"?"thermo":e.kind==="heart"?"heart":"wind",a=e.kind==="temp"?m.ink:e.kind==="heart"?m.alert:m.icoBlue;/* @__PURE__ */
799
- return n.jsx(RiseIn,{index:t,reduced:y,children:/* @__PURE__ */n.jsxs(r.Pressable,{disabled:!v,onPress:()=>w(e=>!e),accessible:true,...v?{accessibilityRole:"button",accessibilityState:{expanded:x}}:{},accessibilityLabel:bb.vitalLabel(l,i,e.unit??"",v),hitSlop:6,style:{flexDirection:"row",alignItems:"center",gap:Rb.hero.vitalGap},testID:`everfur-records-sheet-vital-${e.kind}`,children:[
800
- /* @__PURE__ */n.jsx(HubIcon,{name:o,size:Rb.hero.vitalIcon,color:a}),
801
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",tier:"compact",color:m.ink,style:{fontSize:Rb.hero.vitalValueSize,lineHeight:Rb.hero.vitalValueSize*1.2},children:i}),e.unit?/* @__PURE__ */n.jsx(HubText,{variant:"fine",tier:"compact",style:{fontSize:Rb.hero.vitalUnitSize},children:e.unit}):null]})},e.kind)})}):null,z=v&&x?/* @__PURE__ */n.jsxs(r.View,{accessibilityLiveRegion:"polite",style:{marginTop:8,marginHorizontal:Rb.screen.padX,padding:Rb.card.pad,borderRadius:Rb.card.radius,backgroundColor:m.white,borderWidth:1,borderColor:m.line},testID:"everfur-records-sheet-vitals-from",children:[
802
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:Gm.vitalsFrom(h.vet,h.date)}),
803
- /* @__PURE__ */n.jsx(AnnounceLine,{line:Gm.vitalsFrom(h.vet,h.date)}),p!==void 0?/* @__PURE__ */n.jsx(HubButton,{label:Gm.examNotes,variant:"text",onPress:p,testID:"everfur-records-sheet-vitals-exam-notes"}):null]}):null,I=a;/* @__PURE__ */
804
- return n.jsxs(r.View,{style:{marginTop:4,marginHorizontal:-Rb.screen.padX},testID:"everfur-records-hub-hero",children:[
805
- /* @__PURE__ */n.jsxs(r.View,{style:[{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:Rb.screen.padX},s?null:{minHeight:Rb.peek.roundButton}],testID:"everfur-records-sheet-head",children:[
806
- /* @__PURE__ */n.jsx(HubText,{variant:"screenTitle",accessibilityRole:"header",numberOfLines:1,testID:"everfur-records-sheet-name",style:[b("bold"),{flexShrink:1,fontSize:Rb.hero.nameSize,lineHeight:Rb.hero.nameSize*1.2,letterSpacing:Rb.hero.nameTracking}],children:t}),g!=null?/* @__PURE__ */n.jsx(HubPill,{label:g.label,tone:g.tone,testID:"everfur-records-sheet-head-pill"}):null]}),i!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",testID:"everfur-records-sheet-meta",style:{marginTop:Rb.hero.metaTop,paddingHorizontal:Rb.screen.padX,lineHeight:Rb.hero.metaLineHeight,textTransform:"uppercase",letterSpacing:Rb.hero.metaTracking},children:i}):null,k?/* @__PURE__ */n.jsxs(r.View,{style:{height:Qy,marginTop:wl(".efh-stage","marginTop"),overflow:"hidden"},testID:"everfur-records-sheet-stage",children:[
807
- /* @__PURE__ */n.jsx(r.Animated.View,{style:[{position:"absolute",left:0,right:0,bottom:0,height:Jy,overflow:"hidden"},j.grass],...Yy,children:C===T?null:/* @__PURE__ */n.jsx(r.Image,{source:S,onError:()=>R(T),style:{position:"absolute",top:0,left:0,right:0,height:"100%"},resizeMode:"cover",testID:"everfur-records-sheet-grass"})}),
808
- /* @__PURE__ */n.jsx(r.Animated.View,{style:[{position:"absolute",left:`${(2*kl(".efh-stage__pet","left")-1)*100}%`,right:0,bottom:wl(".efh-stage__pet","bottom"),alignItems:"center"},s?{top:Rb.hero.sayHeight-4}:{height:`${kl(".efh-stage__pet","height")*100}%`},j.pet],...Yy,children:l!==void 0?/* @__PURE__ */n.jsx(r.Image,{source:l.petSource,style:{width:"100%",height:"100%"},resizeMode:"contain"}):/* @__PURE__ */n.jsx(HubPetArt,{art:o.art,onError:o.onError,reduced:y})}),s&&I!==null?/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",top:0,left:"50%",width:Rb.hero.sayWidth,height:Rb.hero.sayHeight,marginLeft:-Rb.hero.sayWidth/2},testID:"everfur-records-sheet-say",...Yy,children:/* @__PURE__ */n.jsx(HubSay,{family:I})}):null,_]}):/* @__PURE__ */n.jsxs(n.Fragment,{children:[u!==void 0?/* @__PURE__ */n.jsx(HostRender,{render:u,fallback:null,resetKey:t}):null,_]}),f!=null&&f.trim().length>0&&d.length>0?/* @__PURE__ */n.jsx(HubText,{variant:"labelMono",testID:"everfur-records-sheet-vitals-line",style:{marginTop:wl(".efh-head__from","marginTop"),paddingHorizontal:Rb.screen.padX},children:f}):null,z]})}function HubPrompt({title:e,canAct:t,canRequest:i,onRequest:l,onUpload:o,note:a}){let s=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
799
+ return n.jsx(r.View,{style:Xc,onLayout:a,...Fy,children:s.map(e=>/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:e.left,top:e.top,width:e.length,height:1.5,backgroundColor:i,transform:[{rotate:`${e.angle}deg`}]}},e.key))})}function Ky(e,t){let n=face(e,"regular"),i=face(e,"bold"),l=headingFace(e,"bold"),o=face(e,"mono"),a=face(e,"monoBold"),s=(e,t)=>Qy(e*t);return r.StyleSheet.create({scroll:{flexGrow:1},topSlot:{paddingHorizontal:jl.sheetPadX},sheet:{flexGrow:1,gap:jl.gap,paddingTop:jl.sheetPadTop,paddingHorizontal:jl.sheetPadX,paddingBottom:jl.sheetPadBottom,borderTopLeftRadius:jl.sheetRadius,borderTopRightRadius:jl.sheetRadius,backgroundColor:t.ground},sheetUnderSlot:{marginTop:jl.sheetGap},card:{padding:jl.cardPad,backgroundColor:t.card,borderRadius:jl.cardRadius,shadowColor:"#000000",shadowOpacity:t.dark?0:.09,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:t.dark?0:1,borderWidth:t.dark?1:0,borderColor:t.line},cardHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:12},cardTitle:{...i,fontSize:jl.cardTitle,lineHeight:s(jl.cardTitle,1.25),letterSpacing:-.36,color:t.ink},cardTitleGap:{marginBottom:12},sec:{marginTop:8,marginBottom:12},head:{marginBottom:wl(".efh-head","marginBottom")},name:{...l,fontSize:jl.name,lineHeight:s(jl.name,1.2),letterSpacing:-.44,color:t.ink,flexShrink:1},meta:{...n,marginTop:2,fontSize:jl.small,lineHeight:s(jl.small,1.4),letterSpacing:.26,textTransform:"uppercase",color:t.muted},label:{...a,marginTop:wl(".efh-head__from","marginTop"),fontSize:jl.mono,lineHeight:s(jl.mono,1.4),letterSpacing:.72,textTransform:"uppercase",color:t.muted},vitals:{flexDirection:"row",gap:8,marginTop:8},stage:{position:"relative",height:wl(".efh-stage","height"),marginTop:wl(".efh-stage","marginTop"),marginHorizontal:wl(".efh-stage","marginLeft"),overflow:"hidden"},stageGrass:{position:"absolute",left:0,right:0,bottom:0,height:`${kl(".efh-stage__grass","height")*100}%`,overflow:"hidden"},stagePet:{position:"absolute",left:`${kl(".efh-stage__pet","left")*100}%`,bottom:wl(".efh-stage__pet","bottom"),height:My},stageVitals:{position:"absolute",top:wl(".efh-stage .efh-vitals","top"),left:wl(".efh-stage .efh-vitals","left"),gap:wl(".efh-stage .efh-vitals","gap")},vital:{flex:1,minWidth:0},vitalTop:{flexDirection:"row",alignItems:"center",gap:6},vitalValue:{...i,fontSize:17,lineHeight:s(17,1.2),color:t.ink},vitalUnit:{...n,fontSize:jl.small,color:t.muted},vitalLabel:{...n,marginTop:2,fontSize:jl.small,lineHeight:s(jl.small,1.4),color:t.muted},due:{gap:4,marginHorizontal:-12},dueRow:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:jl.rowRadius},dueText:{flex:1,minWidth:0,gap:2},duePill:{alignSelf:"center"},dueTitle:{...i,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.3),color:t.ink},dueWhen:{...n,fontSize:jl.small,lineHeight:s(jl.small,1.4),color:t.muted},pill:{minHeight:jl.pill,paddingHorizontal:10,borderRadius:999,alignItems:"center",justifyContent:"center",alignSelf:"flex-start"},pillSmall:{minHeight:22,paddingHorizontal:7},pillText:{...a,fontSize:jl.mono,lineHeight:jl.mono+2,letterSpacing:.72,textTransform:"uppercase"},pillTextSmall:{fontSize:10.5,letterSpacing:.21},tiles:{flexDirection:"row",flexWrap:"wrap",gap:jl.tileGap},tile:{flexGrow:1,flexBasis:"45%",minWidth:0,gap:8,padding:16,borderRadius:jl.cardRadius},tileTop:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between"},tileTitle:{...i,fontSize:jl.body,lineHeight:s(jl.body,1.25),letterSpacing:-.15,color:t.ink},tileFoot:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:8,minHeight:28},tileNum:{...i,fontSize:jl.tileNum,lineHeight:jl.tileNum+2,letterSpacing:-.4,color:t.ink},tileUnit:{...n,fontSize:jl.small,color:t.muted},emptyLine:{...n,fontSize:jl.small,lineHeight:s(jl.small,1.5),color:t.muted},wt:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:8},wtValue:{...i,fontSize:jl.big,lineHeight:wl(".efh-wt b","lineHeight"),letterSpacing:-.64,color:t.ink},wtSub:{...n,fontSize:jl.body,color:t.muted},chart:{marginTop:20},plot:{position:"relative",height:jl.plot},point:{position:"absolute",width:12,height:12,marginLeft:-6,marginTop:-6,borderRadius:6,borderWidth:1.5,borderColor:t.card},pointLabel:{...face(e,"medium"),position:"absolute",width:46,marginLeft:-23,textAlign:"center",fontSize:jl.mono,lineHeight:jl.mono+2,color:t.dark?t.text:Yy},xAxis:{position:"relative",height:18,marginTop:8},xTick:{...o,position:"absolute",top:0,width:56,marginLeft:-28,textAlign:"center",fontSize:jl.mono,lineHeight:s(jl.mono,1.3),color:t.muted},key:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:6,marginTop:12},keyDot:{width:12,height:12,borderRadius:6,backgroundColor:t.ink},keyText:{...n,fontSize:jl.small,lineHeight:s(jl.small,1.4),color:t.muted},tlKey:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},tlKeyDot:{width:10,height:10,borderRadius:5,borderWidth:2.5,borderColor:t.ink,backgroundColor:t.card},tlYear:{...a,marginTop:20,marginBottom:12,marginLeft:40,fontSize:jl.mono,lineHeight:s(jl.mono,1.4),letterSpacing:.72,textTransform:"uppercase",color:t.muted},tlItem:{position:"relative",flexDirection:"row",gap:16,paddingBottom:24},tlItemLast:{paddingBottom:0},tlRail:{position:"absolute",left:11,top:22,bottom:-2,width:2,borderRadius:1,backgroundColor:t.line},tlRailEnd:{bottom:12},tlDot:{width:16,height:16,marginTop:3,marginHorizontal:4,borderRadius:8,borderWidth:3,borderColor:t.ink,backgroundColor:t.card},tlBody:{flex:1,minWidth:0},tlBtn:{marginTop:-8,marginHorizontal:-8,paddingVertical:8,paddingLeft:8,paddingRight:36,borderRadius:jl.rowRadius,backgroundColor:t.alertTint},tlChevron:{position:"absolute",right:8,top:"50%",marginTop:-10},tlDate:{...o,fontSize:jl.mono,lineHeight:s(jl.mono,1.4),letterSpacing:.48,textTransform:"uppercase",color:t.muted},tlTitle:{...i,marginTop:2,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.3),color:t.ink},tlText:{...n,marginTop:2,fontSize:jl.body,lineHeight:s(jl.body,1.5),color:t.text},pull:{paddingTop:4,paddingBottom:24,paddingLeft:40},pullStep:{...i,fontSize:jl.body,lineHeight:s(jl.body,1.4),color:t.ink},pullBar:{height:6,marginTop:10,overflow:"hidden",borderRadius:999,backgroundColor:t.line},pullFill:{height:"100%",backgroundColor:t.accent},failed:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:jl.rowRadius,backgroundColor:t.alertTint},failedText:{...i,flex:1,fontSize:jl.body,lineHeight:s(jl.body,1.4),color:t.alertDeep},add:{gap:12},addHead:{flexDirection:"row",alignItems:"center",gap:8},addLead:{...n,fontSize:jl.body,lineHeight:s(jl.body,1.5),color:t.text},sources:{gap:6},source:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",columnGap:12,paddingVertical:10,paddingHorizontal:14,borderRadius:jl.rowRadius,backgroundColor:t.rowGround},sourceLabel:{...n,fontSize:jl.body,lineHeight:s(jl.body,1.4),color:t.text},sourceDetail:{...n,fontSize:jl.small,color:t.muted},addActs:{gap:12,paddingTop:4},button:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,minHeight:jl.button,paddingHorizontal:20,borderRadius:999},buttonRow:{minHeight:jl.rowButton,paddingHorizontal:16},buttonText:{...i,fontSize:16,lineHeight:20},buttonTextRow:{fontSize:jl.body},noneWithScene:{paddingTop:wl(".efh-none","paddingTop")},scene:{position:"relative",height:yl.height,marginHorizontal:wl(".efh-none__scene","marginLeft"),marginBottom:wl(".efh-none__scene","marginBottom"),overflow:"hidden",borderTopLeftRadius:jl.cardRadius,borderTopRightRadius:jl.cardRadius},sceneGrass:{position:"absolute",left:0,right:0,bottom:0,height:yl.grassHeight,overflow:"hidden"},scenePet:{position:"absolute",left:"50%",bottom:yl.petBottom,height:yl.petHeight},noneTitle:{...l,fontSize:wl(".efh-none__t","fontSize"),lineHeight:wl(".efh-none__t","lineHeight"),letterSpacing:wl(".efh-none__t","letterSpacing"),color:t.ink},noneLead:{...n,marginTop:wl(".efh-none__lead","marginTop"),fontSize:wl(".efh-none__lead","fontSize"),lineHeight:wl(".efh-none__lead","lineHeight"),color:t.text},noneLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",columnGap:4,marginTop:wl(".efh-none__lead","marginTop")},noneLineText:{...n,fontSize:wl(".efh-none__lead","fontSize"),lineHeight:wl(".efh-none__lead","lineHeight"),color:t.text},noneLink:{...i,fontSize:wl(".efh-none__lead","fontSize"),lineHeight:wl(".efh-none__lead","lineHeight"),color:t.ink,textDecorationLine:"underline"},repeatLine:{...i,marginTop:wl(".efh-ways","gap"),fontSize:wl(".efh-none__lead","fontSize"),lineHeight:wl(".efh-none__lead","lineHeight"),color:t.ink},ways:{gap:wl(".efh-ways","gap"),marginTop:wl(".efh-ways","marginTop")},way:{flexDirection:"row",alignItems:"center",gap:wl(".efh-way","columnGap"),padding:wl(".efh-way","paddingTop"),borderRadius:wl(".efh-way","borderRadius")},wayText:{flex:1,minWidth:0,gap:wl(".efh-way__w","gap")},wayTitle:{...i,fontSize:wl(".efh-way__t","fontSize"),lineHeight:wl(".efh-way__t","lineHeight")},wayDetail:{...n,fontSize:wl(".efh-way__x","fontSize"),lineHeight:wl(".efh-way__x","lineHeight")},tracker:{marginTop:16},step:{flexDirection:"row",gap:16,paddingBottom:20},stepLast:{paddingBottom:0},stepRail:{position:"absolute",left:Xy/2-1,top:Xy+2,bottom:2,width:2,borderRadius:1,backgroundColor:t.line},stepRailDone:{backgroundColor:t.ink},stepDot:{width:Xy,height:Xy,borderRadius:Xy/2,borderWidth:2,borderColor:t.line,backgroundColor:t.card,alignItems:"center",justifyContent:"center"},stepDotOn:{borderColor:t.ink},stepDotDone:{backgroundColor:t.fill,borderColor:t.fill},stepNow:{width:10,height:10,borderRadius:5,backgroundColor:t.accent},stepText:{flex:1,minWidth:0,paddingTop:3,gap:2},stepTitle:{...i,fontSize:wl(".efh-mk__name","fontSize"),lineHeight:22,color:t.ink},stepWhen:{...n,fontSize:wl(".efh-mk__line","fontSize"),lineHeight:wl(".efh-mk__line","lineHeight"),color:t.muted},peek:{gap:12,marginTop:12},peekHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:12},peekLead:{...n,marginTop:-4,fontSize:jl.body,lineHeight:s(jl.body,1.5),color:t.text},peekLabsTitle:{marginBottom:wl(".efh-peek__labs .efh-card__title","marginBottom")},peekGroup:{marginBottom:wl(".efh-peek__g","marginBottom")},peekGroupTitle:{...i,fontSize:wl(".efh-peek__g b","fontSize"),lineHeight:Qy(wl(".efh-peek__g b","fontSize")*(wl(".efh-peek__g","lineHeight")/wl(".efh-peek__g","fontSize"))),color:t.ink},peekGroupLead:{...n,fontSize:wl(".efh-peek__g","fontSize"),lineHeight:wl(".efh-peek__g","lineHeight"),color:t.muted},more:{gap:10},moreCard:{gap:10,padding:16,borderRadius:jl.cardRadius},moreHead:{flexDirection:"row",alignItems:"center",gap:8},moreTitle:{...i,fontSize:16,lineHeight:s(16,1.3),color:t.ink},moreLead:{...n,fontSize:jl.body,lineHeight:s(jl.body,1.5),color:t.text},moreRows:{gap:6},moreRow:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:44,paddingVertical:8,paddingHorizontal:14,borderRadius:jl.rowRadius,backgroundColor:t.card},moreRowLabel:{...n,flexShrink:1,fontSize:jl.body,lineHeight:s(jl.body,1.4),color:t.text},moreWhen:{...o,fontSize:jl.mono,letterSpacing:.24,color:t.muted},note:{...n,marginTop:wl(".efh-sheet .rec-note","marginTop"),fontSize:wl(".rec-note","fontSize"),textAlign:"center",color:t.muted},mks:{gap:2,marginHorizontal:-8},mk:{flexDirection:"row",alignItems:"center",gap:12,paddingVertical:10,paddingHorizontal:8},mkText:{flex:1,minWidth:0},mkNameRow:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:8},mkName:{...i,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.3),color:t.ink},mkLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",rowGap:wl(".efh-mk__line","rowGap"),columnGap:wl(".efh-mk__line","columnGap"),marginTop:wl(".efh-mk__line","marginTop")},mkLineText:{...n,fontSize:wl(".efh-mk__line","fontSize"),lineHeight:wl(".efh-mk__line","lineHeight"),color:t.muted,fontVariant:["tabular-nums"]},mkValue:{...i,fontSize:wl(".efh-mk__line b","fontSize"),lineHeight:Qy(wl(".efh-mk__line b","fontSize")*(wl(".efh-mk__line","lineHeight")/wl(".efh-mk__line","fontSize"))),color:t.text,fontVariant:["tabular-nums"]},mkBar:{position:"relative",width:96,height:6,borderRadius:999,backgroundColor:t.barTrack},mkBarIn:{position:"absolute",top:0,bottom:0,left:"20%",right:"20%",borderRadius:999},mkBarDot:{position:"absolute",top:-2,width:10,height:10,marginLeft:-5,borderRadius:5,borderWidth:2},topRisk:{gap:wl(".rec-top","gap"),paddingTop:wl(".rec-top","paddingTop"),paddingRight:wl(".rec-top","paddingRight"),paddingBottom:wl(".rec-top","paddingBottom"),paddingLeft:wl(".rec-top","paddingLeft"),backgroundColor:t.topFill,borderRadius:wl(".rec-top","borderRadius"),borderWidth:0,shadowOpacity:0,elevation:0},topRiskKicker:{flexDirection:"row",alignItems:"center",gap:wl(".rec-top__k","gap")},topRiskDot:{width:8,height:8,borderRadius:4,backgroundColor:t.alert},topRiskK:{...o,fontSize:wl(".rec-top__k","fontSize"),lineHeight:wl(".rec-top__k","fontSize")*1.5,letterSpacing:wl(".rec-top__k","letterSpacing"),textTransform:"uppercase",color:t.topKicker},topRiskText:{...i,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.35),color:t.topInk},disclaimer:{...n,fontSize:jl.small,lineHeight:s(jl.small,1.5),textAlign:"center",color:t.muted},lab:{gap:jl.gap,paddingTop:8,paddingHorizontal:16,paddingBottom:32,backgroundColor:t.ground},labTitle:{...face(e,"medium"),fontSize:jl.name,lineHeight:s(jl.name,1.2),letterSpacing:-.33,color:t.ink},labMeta:{...o,fontSize:jl.small,lineHeight:s(jl.small,1.45),color:t.muted},latest:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:4},latestSub:{...n,fontSize:jl.body,color:t.muted},change:{...n,marginTop:12,fontSize:jl.body,color:t.text},changeLead:{...i,color:t.ink},ctx:{gap:12},ctxText:{...n,fontSize:jl.rowTitle,lineHeight:s(jl.rowTitle,1.55),color:t.text},labBody:{flexDirection:"row",gap:8},rail:{width:8,height:jl.plot,overflow:"hidden",borderRadius:2},legend:{width:82,height:jl.plot,position:"relative"},range:{...a,position:"absolute",left:0,right:0,fontSize:jl.mono,lineHeight:s(jl.mono,1.2),letterSpacing:.24,textTransform:"uppercase",color:t.dark?t.text:Yy},band:{position:"absolute",left:0,right:0,top:"25%",height:"50%",backgroundColor:t.goTint}})}var Yy="#3D3D3D",Xy=28,Qy=e=>Math.round(e*100)/100;var Jy={accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",pointerEvents:"none"},Zy=By(_b.hero.sayWidth),ex=wl(".efh-stage","height"),tx=ex*kl(".efh-stage__grass","height");function rx(e){let t=Number(e);return e.trim()!==""&&Number.isFinite(t)?String(t):e}var nx=44e3,ix=1100,lx=1188,ox=1200,ax=3600;function SayPhrase({text:t,index:i,family:l}){let{look:o}=Ob(),a=e.useRef(new r.Animated.Value(0)).current;return e.useEffect(()=>{a.setValue(0);let e=r.Easing.inOut(r.Easing.ease),t=r.Animated.sequence([r.Animated.delay(ox+i*ax),r.Animated.loop(r.Animated.sequence([r.Animated.timing(a,{toValue:1,duration:ix,easing:e,useNativeDriver:true}),r.Animated.delay(lx),r.Animated.timing(a,{toValue:0,duration:ix,easing:e,useNativeDriver:true}),r.Animated.delay(nx-ix*2-lx)]))]);return t.start(),()=>t.stop()},[i,a]),/* @__PURE__ */n.jsx(ArcLine,{line:t,geom:Zy,opacity:a,text:{fontFamily:l,fontWeight:"500",fontSize:Zy.font,lineHeight:Zy.line,color:o.ink}})}function HubSay({family:e}){let{look:t}=Ob();return useEverfurTheme().motion.reducedMotion?/* @__PURE__ */n.jsx(ArcLine,{line:xb.sayLine,geom:Zy,opacity:1,text:{fontFamily:e,fontWeight:"500",fontSize:Zy.font,lineHeight:Zy.line,color:t.ink}}):/* @__PURE__ */n.jsx(n.Fragment,{children:xb.sayPhrases.map((t,r)=>/* @__PURE__ */n.jsx(SayPhrase,{text:t,index:r,family:e},t))})}function HubHero({name:t,meta:i,stage:l,art:o,handFontFamily:a,say:s,vitals:d,vitalsName:c,renderStage:u,exam:h,onOpenExam:p,headPill:g,fromLine:f}){let{look:m,face:b}=Ob(),y=useEverfurTheme().motion.reducedMotion,[x,w]=e.useState(false),v=h!=null,k=l!==void 0||u===void 0,j=jy(tx,y),S=l?.grassSource??vy,[C,R]=e.useState(null),T=hx(S),_=d.length>0?/* @__PURE__ */n.jsx(r.View,{style:k?{position:"absolute",top:wl(".efh-stage .efh-vitals","top"),left:wl(".efh-stage .efh-vitals","left"),gap:wl(".efh-stage .efh-vitals","gap")}:{paddingHorizontal:_b.screen.padX,marginTop:4,gap:wl(".efh-stage .efh-vitals","gap")},accessibilityLabel:xb.vitalsLabel(c),testID:"everfur-records-sheet-vitals",children:d.map((e,t)=>{let i=rx(e.value),l=e.kind==="temp"?xb.temperature:e.kind==="heart"?xb.heartRate:xb.breathing,o=e.kind==="temp"?"thermo":e.kind==="heart"?"heart":"wind",a=e.kind==="temp"?m.ink:e.kind==="heart"?m.alert:m.icoBlue;/* @__PURE__ */
800
+ return n.jsx(RiseIn,{index:t,reduced:y,children:/* @__PURE__ */n.jsxs(r.Pressable,{disabled:!v,onPress:()=>w(e=>!e),accessible:true,...v?{accessibilityRole:"button",accessibilityState:{expanded:x}}:{},accessibilityLabel:xb.vitalLabel(l,i,e.unit??"",v),hitSlop:6,style:{flexDirection:"row",alignItems:"center",gap:_b.hero.vitalGap},testID:`everfur-records-sheet-vital-${e.kind}`,children:[
801
+ /* @__PURE__ */n.jsx(HubIcon,{name:o,size:_b.hero.vitalIcon,color:a}),
802
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",tier:"compact",color:m.ink,style:{fontSize:_b.hero.vitalValueSize,lineHeight:_b.hero.vitalValueSize*1.2},children:i}),e.unit?/* @__PURE__ */n.jsx(HubText,{variant:"fine",tier:"compact",style:{fontSize:_b.hero.vitalUnitSize},children:e.unit}):null]})},e.kind)})}):null,z=v&&x?/* @__PURE__ */n.jsxs(r.View,{accessibilityLiveRegion:"polite",style:{marginTop:8,marginHorizontal:_b.screen.padX,padding:_b.card.pad,borderRadius:_b.card.radius,backgroundColor:m.white,borderWidth:1,borderColor:m.line},testID:"everfur-records-sheet-vitals-from",children:[
803
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:Ym.vitalsFrom(h.vet,h.date)}),
804
+ /* @__PURE__ */n.jsx(AnnounceLine,{line:Ym.vitalsFrom(h.vet,h.date)}),p!==void 0?/* @__PURE__ */n.jsx(HubButton,{label:Ym.examNotes,variant:"text",onPress:p,testID:"everfur-records-sheet-vitals-exam-notes"}):null]}):null,I=a;/* @__PURE__ */
805
+ return n.jsxs(r.View,{style:{marginTop:4,marginHorizontal:-_b.screen.padX},testID:"everfur-records-hub-hero",children:[
806
+ /* @__PURE__ */n.jsxs(r.View,{style:[{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:_b.screen.padX},s?null:{minHeight:_b.peek.roundButton}],testID:"everfur-records-sheet-head",children:[
807
+ /* @__PURE__ */n.jsx(HubText,{variant:"screenTitle",accessibilityRole:"header",numberOfLines:1,testID:"everfur-records-sheet-name",style:[b("bold"),{flexShrink:1,fontSize:_b.hero.nameSize,lineHeight:_b.hero.nameSize*1.2,letterSpacing:_b.hero.nameTracking}],children:t}),g!=null?/* @__PURE__ */n.jsx(HubPill,{label:g.label,tone:g.tone,testID:"everfur-records-sheet-head-pill"}):null]}),i!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",testID:"everfur-records-sheet-meta",style:{marginTop:_b.hero.metaTop,paddingHorizontal:_b.screen.padX,lineHeight:_b.hero.metaLineHeight,textTransform:"uppercase",letterSpacing:_b.hero.metaTracking},children:i}):null,k?/* @__PURE__ */n.jsxs(r.View,{style:{height:ex,marginTop:wl(".efh-stage","marginTop"),overflow:"hidden"},testID:"everfur-records-sheet-stage",children:[
808
+ /* @__PURE__ */n.jsx(r.Animated.View,{style:[{position:"absolute",left:0,right:0,bottom:0,height:tx,overflow:"hidden"},j.grass],...Jy,children:C===T?null:/* @__PURE__ */n.jsx(r.Image,{source:S,onError:()=>R(T),style:{position:"absolute",top:0,left:0,right:0,height:"100%"},resizeMode:"cover",testID:"everfur-records-sheet-grass"})}),
809
+ /* @__PURE__ */n.jsx(r.Animated.View,{style:[{position:"absolute",left:`${(2*kl(".efh-stage__pet","left")-1)*100}%`,right:0,bottom:wl(".efh-stage__pet","bottom"),alignItems:"center"},s?{top:_b.hero.sayHeight-4}:{height:`${kl(".efh-stage__pet","height")*100}%`},j.pet],...Jy,children:l!==void 0?/* @__PURE__ */n.jsx(r.Image,{source:l.petSource,style:{width:"100%",height:"100%"},resizeMode:"contain"}):/* @__PURE__ */n.jsx(HubPetArt,{art:o.art,onError:o.onError,reduced:y})}),s&&I!==null?/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",top:0,left:"50%",width:_b.hero.sayWidth,height:_b.hero.sayHeight,marginLeft:-_b.hero.sayWidth/2},testID:"everfur-records-sheet-say",...Jy,children:/* @__PURE__ */n.jsx(HubSay,{family:I})}):null,_]}):/* @__PURE__ */n.jsxs(n.Fragment,{children:[u!==void 0?/* @__PURE__ */n.jsx(HostRender,{render:u,fallback:null,resetKey:t}):null,_]}),f!=null&&f.trim().length>0&&d.length>0?/* @__PURE__ */n.jsx(HubText,{variant:"labelMono",testID:"everfur-records-sheet-vitals-line",style:{marginTop:wl(".efh-head__from","marginTop"),paddingHorizontal:_b.screen.padX},children:f}):null,z]})}function HubPrompt({title:e,canAct:t,canRequest:i,onRequest:l,onUpload:o,note:a}){let s=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
809
810
  return n.jsx(HubReveal,{index:1,reduced:s,children:/* @__PURE__ */n.jsxs(HubCard,{title:e,testID:"everfur-records-records-prompt",children:[
810
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:bb.moreThanOneClinic}),t&&i?/* @__PURE__ */n.jsx(HubButton,{label:bb.requestFromClinic,icon:"download",block:true,onPress:l,style:{marginTop:12},testID:"everfur-records-sheet-none-request"}):null,t&&i&&a?/* @__PURE__ */n.jsx(r.View,{style:{marginTop:12},children:a}):null,t?/* @__PURE__ */n.jsx(HubButton,{label:bb.uploadDocument,icon:"upload",variant:"secondary",block:true,onPress:o,style:{marginTop:12},testID:"everfur-records-sheet-none-upload"}):null]})})}function HubUpcoming({rows:e,items:t,onViewAll:i,renderAction:l,actionLabel:o,onAction:a}){let{look:s}=Vb(),d=Rb.upcoming,c=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
811
- return n.jsx(HubCard,{title:bb.upcomingCare,titleEnd:i!==void 0?/* @__PURE__ */n.jsx(HubButton,{label:bb.viewAll,variant:"text",onPress:i,testID:"everfur-records-sheet-upcoming-all"}):void 0,testID:"everfur-records-hub-upcoming",children:/* @__PURE__ */n.jsx(r.View,{style:{gap:d.listGap,marginHorizontal:wl(".efh-due","marginLeft")},children:e.map((e,i)=>{let u=e.tone==="overdue",h=t.get(e.key);/* @__PURE__ */
811
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:xb.moreThanOneClinic}),t&&i?/* @__PURE__ */n.jsx(HubButton,{label:xb.requestFromClinic,icon:"download",block:true,onPress:l,style:{marginTop:12},testID:"everfur-records-sheet-none-request"}):null,t&&i&&a?/* @__PURE__ */n.jsx(r.View,{style:{marginTop:12},children:a}):null,t?/* @__PURE__ */n.jsx(HubButton,{label:xb.uploadDocument,icon:"upload",variant:"secondary",block:true,onPress:o,style:{marginTop:12},testID:"everfur-records-sheet-none-upload"}):null]})})}function HubUpcoming({rows:e,items:t,onViewAll:i,renderAction:l,actionLabel:o,onAction:a}){let{look:s}=Ob(),d=_b.upcoming,c=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
812
+ return n.jsx(HubCard,{title:xb.upcomingCare,titleEnd:i!==void 0?/* @__PURE__ */n.jsx(HubButton,{label:xb.viewAll,variant:"text",onPress:i,testID:"everfur-records-sheet-upcoming-all"}):void 0,testID:"everfur-records-hub-upcoming",children:/* @__PURE__ */n.jsx(r.View,{style:{gap:d.listGap,marginHorizontal:wl(".efh-due","marginLeft")},children:e.map((e,i)=>{let u=e.tone==="overdue",h=t.get(e.key);/* @__PURE__ */
812
813
  return n.jsx(RiseIn,{index:i,reduced:c,children:/* @__PURE__ */n.jsxs(r.View,{style:[{flexDirection:"row",alignItems:"center",gap:wl(".efh-due li","gap"),padding:wl(".efh-due li","paddingTop"),borderRadius:wl(".efh-due li","borderRadius")},u?{backgroundColor:s.tintRed}:null],testID:`everfur-records-sheet-due-${i}`,children:[
813
814
  /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,flexDirection:"row",alignItems:"center",gap:d.rowGap},accessible:true,accessibilityLabel:`${e.label}, ${e.when}`,children:[
814
815
  /* @__PURE__ */n.jsx(HubIcon,{name:e.icon,size:d.icon,color:u?s.alert:s.icoGrey}),
815
816
  /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,minWidth:0},children:[
816
817
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",numberOfLines:2,style:{fontSize:wl(".efh-due__title","fontSize"),lineHeight:wl(".efh-due__title","lineHeight")},children:e.label}),
817
818
  /* @__PURE__ */n.jsx(HubText,{variant:"fine",children:e.when})]})]}),u&&l!==void 0&&h!==void 0?/* @__PURE__ */n.jsx(HostRender,{render:()=>l(h),fallback:null,resetKey:h}):u&&a!==void 0&&o!==void 0?/* @__PURE__ */n.jsx(HubButton,{label:o,size:"row",onPress:()=>a(e),accessibilityLabel:`${o}, ${e.label}`,testID:`everfur-records-sheet-due-${i}-action`}):e.pill!==null?/* @__PURE__ */n.jsx(HubPill,{label:e.pill.label,tone:e.pill.tone}):null]})},e.key)})})})}function HubUpcomingEmpty({name:e}){/* @__PURE__ */
818
- return n.jsx(HubCard,{title:bb.upcomingCare,testID:"everfur-records-hub-upcoming-empty",children:/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:bb.nothingDue(e)})})}function Tile({index:e,tint:t,icon:i,title:l,label:o,foot:a,footGap:s=wl(".efh-tile__foot","gap"),onOpen:d,testID:c}){let{look:u}=Vb(),h=Rb.tiles,p=/* @__PURE__ */n.jsxs(n.Fragment,{children:[
819
+ return n.jsx(HubCard,{title:xb.upcomingCare,testID:"everfur-records-hub-upcoming-empty",children:/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:xb.nothingDue(e)})})}function Tile({index:e,tint:t,icon:i,title:l,label:o,foot:a,footGap:s=wl(".efh-tile__foot","gap"),onOpen:d,testID:c}){let{look:u}=Ob(),h=_b.tiles,p=/* @__PURE__ */n.jsxs(n.Fragment,{children:[
819
820
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[
820
821
  /* @__PURE__ */n.jsx(HubIcon,{name:i,size:h.icon}),d!==void 0?/* @__PURE__ */n.jsx(HubIcon,{name:"chevron",size:h.chevron,color:u.icoSage}):null]}),
821
822
  /* @__PURE__ */n.jsx(r.View,{style:{flexGrow:1,justifyContent:"flex-end"},children:/* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",style:{fontSize:wl(".efh-tile__title","fontSize"),lineHeight:wl(".efh-tile__title","lineHeight"),letterSpacing:wl(".efh-tile__title","letterSpacing")},children:l})}),
822
823
  /* @__PURE__ */n.jsx(r.View,{style:{minHeight:wl(".efh-tile__foot","minHeight"),flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:s},children:a})]}),g={flexGrow:1,padding:wl(".efh-tile","paddingTop"),borderRadius:wl(".efh-tile","borderRadius"),gap:wl(".efh-tile","gap"),backgroundColor:t},f=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
823
- return n.jsx(HubReveal,{index:e,reduced:f,style:{width:"48%",flexGrow:1,flexDirection:"column"},children:d!==void 0?/* @__PURE__ */n.jsx(r.Pressable,{onPress:d,accessibilityRole:"button",accessibilityLabel:o,style:g,testID:c,children:p}):/* @__PURE__ */n.jsx(r.View,{style:g,accessible:true,accessibilityLabel:o,testID:c,children:p})})}function HubTilesSection({tiles:e,labsUnknown:t,onOpenLabs:i,onOpenScreenings:l,onOpenVisits:o,onOpenTimeline:a,screeningsPills:s}){let{look:d}=Vb(),c=Rb.tiles,u=[...s??[],...e.screeningsPill!==null?[e.screeningsPill]:[]];/* @__PURE__ */
824
+ return n.jsx(HubReveal,{index:e,reduced:f,style:{width:"48%",flexGrow:1,flexDirection:"column"},children:d!==void 0?/* @__PURE__ */n.jsx(r.Pressable,{onPress:d,accessibilityRole:"button",accessibilityLabel:o,style:g,testID:c,children:p}):/* @__PURE__ */n.jsx(r.View,{style:g,accessible:true,accessibilityLabel:o,testID:c,children:p})})}function HubTilesSection({tiles:e,labsUnknown:t,onOpenLabs:i,onOpenScreenings:l,onOpenVisits:o,onOpenTimeline:a,screeningsPills:s}){let{look:d}=Ob(),c=_b.tiles,u=[...s??[],...e.screeningsPill!==null?[e.screeningsPill]:[]];/* @__PURE__ */
824
825
  return n.jsxs(r.View,{style:{marginTop:wl(".efh-sec","marginTop")},testID:"everfur-records-hub-records",children:[
825
- /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",style:{marginBottom:wl(".efh-sec","marginBottom")},children:bb.recordsHistory}),
826
+ /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",style:{marginBottom:wl(".efh-sec","marginBottom")},children:xb.recordsHistory}),
826
827
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",gap:wl(".efh-tiles","gap")},children:[
827
- /* @__PURE__ */n.jsx(Tile,{index:0,tint:d.tintSage,icon:"flask",title:bb.labs,label:t?bb.labsA11yUnknown:bb.labsA11y(e.labsTotal,e.labsNoun),onOpen:i,testID:"everfur-records-sheet-tile-labs",foot:/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:c.countGap},children:[
828
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",testID:"everfur-records-sheet-labs-count",style:{fontSize:wl(".efh-tile__num","fontSize"),lineHeight:wl(".efh-tile__num","lineHeight"),letterSpacing:wl(".efh-tile__num","letterSpacing")},children:t?bb.labsCountUnknown:String(e.labsTotal)}),t?null:/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:e.labsNoun})]})}),
829
- /* @__PURE__ */n.jsx(Tile,{index:1,tint:d.tintPartner,icon:"shield",title:bb.screenings,onOpen:l,testID:"everfur-records-sheet-tile-screenings",label:bb.screeningsA11y(u.length>0?u.map(e=>e.label).join(", "):null),footGap:u.length>1?wl(".efh-tile__foot:has(.efh-pill + .efh-pill)","gap"):void 0,foot:u.length>0?u.map((e,t)=>/* @__PURE__ */n.jsx(HubPill,{small:true,label:e.label,tone:e.tone,testID:`everfur-records-sheet-screenings-pill-${t}`},`${e.label}${t}`)):/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:Gm.noScreenings})}),
830
- /* @__PURE__ */n.jsx(Tile,{index:2,tint:d.tintBlue,icon:"folder",title:bb.visits,label:bb.visitsA11y(e.visitDate),onOpen:o,testID:"everfur-records-sheet-tile-record",foot:e.visitDate!==null?/* @__PURE__ */n.jsx(HubPill,{small:true,label:e.visitDate,tone:"plain"}):/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:Gm.noVisits})}),
831
- /* @__PURE__ */n.jsx(Tile,{index:3,tint:d.tintYellow,icon:"clock",title:bb.timeline,label:bb.timelineA11y(e.timelineCount),onOpen:a,testID:"everfur-records-sheet-tile-timeline",foot:e.timelineCount>0?/* @__PURE__ */n.jsx(HubPill,{small:true,label:bb.events(e.timelineCount),tone:"plain"}):null})]})]})}var lx=.85;function ChartText({x:e,y:t,anchor:r,size:i,style:l,children:o}){let a=t-i*lx,s=160,d=r==="start"?{left:e}:r==="end"?{left:e-s,width:s,textAlign:"right"}:{left:e-s/2,width:s,textAlign:"center"};/* @__PURE__ */
832
- return n.jsx(Text,{allowFontScaling:false,numberOfLines:1,style:[l,{position:"absolute",top:a,fontSize:i,lineHeight:i},d],children:o})}function WeightChart({weight:t}){let{look:i,face:l}=Vb(),[o,a]=e.useState(0),[s,d]=e.useState(null),c=useEverfurTheme().motion.reducedMotion,u=Sy(o>0,c),h=e=>{let t=Math.round(e.nativeEvent.layout.width);t>0&&t!==o&&a(t)},p=Rb.chart;if(o===0)/* @__PURE__ */return n.jsx(r.View,{onLayout:h,style:{height:p.height}});let g=sy(t,o),f=p.dot+p.dotRing/2,m=g.cols.length>1?g.cols[1]-g.cols[0]:g.dataRight-(g.cols[0]??0),b=s!==null?g.dots[s]??null:null,y=Cy(g.dots);/* @__PURE__ */
828
+ /* @__PURE__ */n.jsx(Tile,{index:0,tint:d.tintSage,icon:"flask",title:xb.labs,label:t?xb.labsA11yUnknown:xb.labsA11y(e.labsTotal,e.labsNoun),onOpen:i,testID:"everfur-records-sheet-tile-labs",foot:/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:c.countGap},children:[
829
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",testID:"everfur-records-sheet-labs-count",style:{fontSize:wl(".efh-tile__num","fontSize"),lineHeight:wl(".efh-tile__num","lineHeight"),letterSpacing:wl(".efh-tile__num","letterSpacing")},children:t?xb.labsCountUnknown:String(e.labsTotal)}),t?null:/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:e.labsNoun})]})}),
830
+ /* @__PURE__ */n.jsx(Tile,{index:1,tint:d.tintPartner,icon:"shield",title:xb.screenings,onOpen:l,testID:"everfur-records-sheet-tile-screenings",label:xb.screeningsA11y(u.length>0?u.map(e=>e.label).join(", "):null),footGap:u.length>1?wl(".efh-tile__foot:has(.efh-pill + .efh-pill)","gap"):void 0,foot:u.length>0?u.map((e,t)=>/* @__PURE__ */n.jsx(HubPill,{small:true,label:e.label,tone:e.tone,testID:`everfur-records-sheet-screenings-pill-${t}`},`${e.label}${t}`)):/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:Ym.noScreenings})}),
831
+ /* @__PURE__ */n.jsx(Tile,{index:2,tint:d.tintBlue,icon:"folder",title:xb.visits,label:xb.visitsA11y(e.visitDate),onOpen:o,testID:"everfur-records-sheet-tile-record",foot:e.visitDate!==null?/* @__PURE__ */n.jsx(HubPill,{small:true,label:e.visitDate,tone:"plain"}):/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:Ym.noVisits})}),
832
+ /* @__PURE__ */n.jsx(Tile,{index:3,tint:d.tintYellow,icon:"clock",title:xb.timeline,label:xb.timelineA11y(e.timelineCount),onOpen:a,testID:"everfur-records-sheet-tile-timeline",foot:e.timelineCount>0?/* @__PURE__ */n.jsx(HubPill,{small:true,label:xb.events(e.timelineCount),tone:"plain"}):null})]})]})}var sx=.85;function ChartText({x:e,y:t,anchor:r,size:i,style:l,children:o}){let a=t-i*sx,s=160,d=r==="start"?{left:e}:r==="end"?{left:e-s,width:s,textAlign:"right"}:{left:e-s/2,width:s,textAlign:"center"};/* @__PURE__ */
833
+ return n.jsx(Text,{allowFontScaling:false,numberOfLines:1,style:[l,{position:"absolute",top:a,fontSize:i,lineHeight:i},d],children:o})}function WeightChart({weight:t}){let{look:i,face:l}=Ob(),[o,a]=e.useState(0),[s,d]=e.useState(null),c=useEverfurTheme().motion.reducedMotion,u=Ty(o>0,c),h=e=>{let t=Math.round(e.nativeEvent.layout.width);t>0&&t!==o&&a(t)},p=_b.chart;if(o===0)/* @__PURE__ */return n.jsx(r.View,{onLayout:h,style:{height:p.height}});let g=uy(t,o),f=p.dot+p.dotRing/2,m=g.cols.length>1?g.cols[1]-g.cols[0]:g.dataRight-(g.cols[0]??0),b=s!==null?g.dots[s]??null:null,y=_y(g.dots);/* @__PURE__ */
833
834
  return n.jsxs(r.View,{onLayout:h,style:{height:p.height},children:[
834
835
  /* @__PURE__ */n.jsxs(r.View,{accessible:true,accessibilityRole:"image",accessibilityLabel:g.summary,style:{position:"absolute",left:0,top:0,right:0,bottom:0},children:[g.hasBand?/* @__PURE__ */n.jsxs(n.Fragment,{children:[
835
836
  /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:0,top:g.plotTop,width:p.indicatorWidth,height:g.plotBottom-g.plotTop,borderRadius:p.indicatorWidth/2,backgroundColor:i.chartGrid}}),
836
837
  /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:0,top:g.yBandTop,width:p.indicatorWidth,height:Math.max(0,g.yBandBottom-g.yBandTop),borderRadius:p.indicatorWidth/2,backgroundColor:i.go}}),
837
- /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:g.plotLeft,top:g.yBandTop,width:Math.max(0,g.dataRight-g.plotLeft),height:Math.max(0,g.yBandBottom-g.yBandTop),backgroundColor:i.chartBand}})]}):null,g.cols.map((e,t)=>/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:e-.5,top:g.plotTop,width:1,height:g.plotBottom-g.plotTop,backgroundColor:i.chartGrid}},`g-${t}`)),g.hasBand?[g.yBandTop,g.yBandBottom].map((e,t)=>/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:g.plotLeft,top:e-.5,width:Math.max(0,g.dataRight-g.plotLeft),height:1,backgroundColor:i.line}},`e-${t}`)):null,g.dots.slice(1).map((e,t)=>{let l=g.dots[t],o=Math.hypot(e.x-l.x,e.y-l.y),a=p.lineWidth,s=Ry(u,y[t],o+a);/* @__PURE__ */
838
- return n.jsx(r.Animated.View,{style:{position:"absolute",left:(l.x+e.x)/2-(o+a)/2,top:(l.y+e.y)/2-a/2,width:o+a,height:a,borderRadius:a/2,backgroundColor:i.chartLine,transform:[{rotate:`${Math.atan2(e.y-l.y,e.x-l.x)}rad`},{translateX:s.translateX},{scaleX:s.scaleX}]}},`l-${t}`)}),g.dots.map((e,t)=>/* @__PURE__ */n.jsx(r.Animated.View,{style:{position:"absolute",left:e.x-f,top:e.y-f,width:f*2,height:f*2,borderRadius:f,borderWidth:p.dotRing,borderColor:i.white,backgroundColor:e.status==="over"||e.status==="under"?i.yellow:i.go,opacity:_y(u,Ty(y,t))}},`d-${t}`)),g.showValues?g.dots.map((e,t)=>/* @__PURE__ */n.jsx(ChartText,{x:e.labelX,y:e.labelBaseline,anchor:e.labelAnchor,size:g.valueFont,style:[l("bold"),{color:i.text}],children:e.label},`v-${t}`)):null,g.legend.flatMap(e=>e.lines.map((t,r)=>/* @__PURE__ */n.jsx(ChartText,{x:p.legendX,y:e.baselines[r],anchor:"start",size:p.legendSize,style:[l("monoBold"),{color:i.charcoal,letterSpacing:p.legendTracking}],children:t},`k-${e.zone}-${r}`))),g.months.map((e,t)=>/* @__PURE__ */n.jsx(ChartText,{x:e.x,y:p.monthY,anchor:e.anchor,size:p.monthSize,style:[l("mono"),{color:i.muted}],children:e.label},`m-${t}`))]}),g.dots.map((e,t)=>{let i=m/2;/* @__PURE__ */
838
+ /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:g.plotLeft,top:g.yBandTop,width:Math.max(0,g.dataRight-g.plotLeft),height:Math.max(0,g.yBandBottom-g.yBandTop),backgroundColor:i.chartBand}})]}):null,g.cols.map((e,t)=>/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:e-.5,top:g.plotTop,width:1,height:g.plotBottom-g.plotTop,backgroundColor:i.chartGrid}},`g-${t}`)),g.hasBand?[g.yBandTop,g.yBandBottom].map((e,t)=>/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:g.plotLeft,top:e-.5,width:Math.max(0,g.dataRight-g.plotLeft),height:1,backgroundColor:i.line}},`e-${t}`)):null,g.dots.slice(1).map((e,t)=>{let l=g.dots[t],o=Math.hypot(e.x-l.x,e.y-l.y),a=p.lineWidth,s=zy(u,y[t],o+a);/* @__PURE__ */
839
+ return n.jsx(r.Animated.View,{style:{position:"absolute",left:(l.x+e.x)/2-(o+a)/2,top:(l.y+e.y)/2-a/2,width:o+a,height:a,borderRadius:a/2,backgroundColor:i.chartLine,transform:[{rotate:`${Math.atan2(e.y-l.y,e.x-l.x)}rad`},{translateX:s.translateX},{scaleX:s.scaleX}]}},`l-${t}`)}),g.dots.map((e,t)=>/* @__PURE__ */n.jsx(r.Animated.View,{style:{position:"absolute",left:e.x-f,top:e.y-f,width:f*2,height:f*2,borderRadius:f,borderWidth:p.dotRing,borderColor:i.white,backgroundColor:e.status==="over"||e.status==="under"?i.yellow:i.go,opacity:Dy(u,Iy(y,t))}},`d-${t}`)),g.showValues?g.dots.map((e,t)=>/* @__PURE__ */n.jsx(ChartText,{x:e.labelX,y:e.labelBaseline,anchor:e.labelAnchor,size:g.valueFont,style:[l("bold"),{color:i.text}],children:e.label},`v-${t}`)):null,g.legend.flatMap(e=>e.lines.map((t,r)=>/* @__PURE__ */n.jsx(ChartText,{x:p.legendX,y:e.baselines[r],anchor:"start",size:p.legendSize,style:[l("monoBold"),{color:i.charcoal,letterSpacing:p.legendTracking}],children:t},`k-${e.zone}-${r}`))),g.months.map((e,t)=>/* @__PURE__ */n.jsx(ChartText,{x:e.x,y:p.monthY,anchor:e.anchor,size:p.monthSize,style:[l("mono"),{color:i.muted}],children:e.label},`m-${t}`))]}),g.dots.map((e,t)=>{let i=m/2;/* @__PURE__ */
839
840
  return n.jsx(r.Pressable,{onPress:()=>d(e=>e===t?null:t),accessibilityRole:"button",accessibilityLabel:e.spoken,style:{position:"absolute",left:Math.max(0,e.x-i),top:g.plotTop,width:Math.max(1,i*2),height:Math.max(1,g.plotBottom-g.plotTop)}},`t-${t}`)}),b!==null?
840
- /* @__PURE__ */n.jsx(r.View,{pointerEvents:"none",style:{position:"absolute",width:92,height:40,borderRadius:8,paddingHorizontal:8,paddingVertical:5,backgroundColor:i.chartLine,alignItems:"center",justifyContent:"center",left:Math.min(Math.max(b.x-46,p.edgePad),Math.max(p.edgePad,o-92-p.edgePad)),top:b.y-40-p.dot-4>=0?b.y-40-p.dot-4:b.y+p.dot+4},children:/* @__PURE__ */n.jsx(Text,{style:[l("bold"),{fontSize:13,color:i.white}],children:`${b.label} ${t.unit}`})}):null]})}function PhoneWeightChart({weight:e}){let{s:t,look:i}=Ny(),l=hy(e),o=12,a=i.dark?i.text:i.ink,s=-(4+(t.pointLabel.lineHeight??14)),d=[{top:"0%",height:"25%",word:l.legend[0]},{top:"25%",height:"50%",word:l.legend[1]},{top:"75%",height:"25%",word:l.legend[2]}];/* @__PURE__ */
841
+ /* @__PURE__ */n.jsx(r.View,{pointerEvents:"none",style:{position:"absolute",width:92,height:40,borderRadius:8,paddingHorizontal:8,paddingVertical:5,backgroundColor:i.chartLine,alignItems:"center",justifyContent:"center",left:Math.min(Math.max(b.x-46,p.edgePad),Math.max(p.edgePad,o-92-p.edgePad)),top:b.y-40-p.dot-4>=0?b.y-40-p.dot-4:b.y+p.dot+4},children:/* @__PURE__ */n.jsx(Text,{style:[l("bold"),{fontSize:13,color:i.white}],children:`${b.label} ${t.unit}`})}):null]})}function PhoneWeightChart({weight:e}){let{s:t,look:i}=Gy(),l=fy(e),o=12,a=i.dark?i.text:i.ink,s=-(4+(t.pointLabel.lineHeight??14)),d=[{top:"0%",height:"25%",word:l.legend[0]},{top:"25%",height:"50%",word:l.legend[1]},{top:"75%",height:"25%",word:l.legend[2]}];/* @__PURE__ */
841
842
  return n.jsxs(r.View,{testID:"everfur-records-sheet-weight-chart",children:[
842
843
  /* @__PURE__ */n.jsxs(r.View,{style:t.labBody,children:[l.hasBand?/* @__PURE__ */n.jsxs(n.Fragment,{children:[
843
- /* @__PURE__ */n.jsxs(r.View,{style:t.rail,...Yy,children:[
844
+ /* @__PURE__ */n.jsxs(r.View,{style:t.rail,...Jy,children:[
844
845
  /* @__PURE__ */n.jsx(r.View,{style:{flex:1,backgroundColor:i.line}}),
845
846
  /* @__PURE__ */n.jsx(r.View,{style:{flex:2,backgroundColor:i.go}}),
846
847
  /* @__PURE__ */n.jsx(r.View,{style:{flex:1,backgroundColor:i.line}})]}),
847
- /* @__PURE__ */n.jsx(r.View,{style:t.legend,...Yy,children:d.map(e=>/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:0,right:0,top:e.top,height:e.height,justifyContent:"center"},children:/* @__PURE__ */n.jsx(Text,{style:[t.range,{position:"relative"}],maxFontSizeMultiplier:1,children:e.word})},e.word))})]}):null,
848
- /* @__PURE__ */n.jsxs(r.View,{style:[t.plot,{flex:1,minWidth:0}],accessible:true,accessibilityRole:"image",accessibilityLabel:l.summary,children:[l.hasBand?/* @__PURE__ */n.jsx(r.View,{style:t.band,...Yy}):null,l.points.length>1?/* @__PURE__ */n.jsx(ChartLine,{points:l.points,color:i.dark?i.text:fl.efBlack}):null,l.points.map((e,l)=>/* @__PURE__ */n.jsx(r.View,{...Yy,style:[t.point,{left:`${e.x}%`,top:`${e.y}%`,width:o,height:o,marginLeft:-o/2,marginTop:-o/2,borderRadius:o/2,backgroundColor:e.out?i.alert:a}]},`d${l}`)),l.points.map((e,r)=>l.allValues||r===l.points.length-1?/* @__PURE__ */n.jsx(Text,{maxFontSizeMultiplier:1,...Yy,style:[t.pointLabel,e.edge==="end"?{left:void 0,right:`${100-e.x}%`,marginLeft:0,marginRight:-4,textAlign:"right"}:e.edge==="start"?{left:`${e.x}%`,marginLeft:-4,textAlign:"left"}:{left:`${e.x}%`},{top:`${e.y}%`,marginTop:s-o/2},e.out?{color:i.alert,fontWeight:"700"}:null],children:e.label},`v${r}`):null)]})]}),
849
- /* @__PURE__ */n.jsx(r.View,{style:[t.xAxis,l.hasBand?{marginLeft:106}:null],...Yy,children:l.ticks.map((e,r)=>/* @__PURE__ */n.jsx(Text,{maxFontSizeMultiplier:1,style:[t.xTick,e.edge==="end"?{left:void 0,right:`${100-e.x}%`,marginLeft:0,marginRight:-4,textAlign:"right"}:e.edge==="start"?{left:`${e.x}%`,marginLeft:-4,textAlign:"left"}:{left:`${e.x}%`}],children:e.label},r))})]})}var ox={textTransform:"uppercase",letterSpacing:Rb.hero.metaTracking,lineHeight:Rb.hero.metaLineHeight};function HubWeightCard({weight:e,name:t,extras:i,chart:l="phone"}){let{look:o}=Vb(),a=Rb.weight,s=useEverfurTheme().motion.reducedMotion;if(e===null)/* @__PURE__ */
850
- return n.jsx(HubReveal,{index:3,reduced:s,children:/* @__PURE__ */n.jsx(HubCard,{title:bb.weight,testID:"everfur-records-hub-weight",children:/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:bb.noWeights(t)})})});let d={fontSize:wl(".efh-wt b","fontSize"),lineHeight:wl(".efh-wt b","lineHeight"),letterSpacing:wl(".efh-wt b","letterSpacing")},c=i?.status??null,u=i?.prediction??null,h=i?.key??[];/* @__PURE__ */
851
- return n.jsx(HubReveal,{index:3,reduced:s,children:/* @__PURE__ */n.jsxs(HubCard,{title:bb.weight,titleEnd:c!==null?/* @__PURE__ */n.jsx(HubPill,{label:c.label,tone:c.tone,testID:"everfur-records-sheet-weight-status"}):void 0,testID:"everfur-records-hub-weight",children:[
848
+ /* @__PURE__ */n.jsx(r.View,{style:t.legend,...Jy,children:d.map(e=>/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:0,right:0,top:e.top,height:e.height,justifyContent:"center"},children:/* @__PURE__ */n.jsx(Text,{style:[t.range,{position:"relative"}],maxFontSizeMultiplier:1,children:e.word})},e.word))})]}):null,
849
+ /* @__PURE__ */n.jsxs(r.View,{style:[t.plot,{flex:1,minWidth:0}],accessible:true,accessibilityRole:"image",accessibilityLabel:l.summary,children:[l.hasBand?/* @__PURE__ */n.jsx(r.View,{style:t.band,...Jy}):null,l.points.length>1?/* @__PURE__ */n.jsx(ChartLine,{points:l.points,color:i.dark?i.text:fl.efBlack}):null,l.points.map((e,l)=>/* @__PURE__ */n.jsx(r.View,{...Jy,style:[t.point,{left:`${e.x}%`,top:`${e.y}%`,width:o,height:o,marginLeft:-o/2,marginTop:-o/2,borderRadius:o/2,backgroundColor:e.out?i.alert:a}]},`d${l}`)),l.points.map((e,r)=>l.allValues||r===l.points.length-1?/* @__PURE__ */n.jsx(Text,{maxFontSizeMultiplier:1,...Jy,style:[t.pointLabel,e.edge==="end"?{left:void 0,right:`${100-e.x}%`,marginLeft:0,marginRight:-4,textAlign:"right"}:e.edge==="start"?{left:`${e.x}%`,marginLeft:-4,textAlign:"left"}:{left:`${e.x}%`},{top:`${e.y}%`,marginTop:s-o/2},e.out?{color:i.alert,fontWeight:"700"}:null],children:e.label},`v${r}`):null)]})]}),
850
+ /* @__PURE__ */n.jsx(r.View,{style:[t.xAxis,l.hasBand?{marginLeft:106}:null],...Jy,children:l.ticks.map((e,r)=>/* @__PURE__ */n.jsx(Text,{maxFontSizeMultiplier:1,style:[t.xTick,e.edge==="end"?{left:void 0,right:`${100-e.x}%`,marginLeft:0,marginRight:-4,textAlign:"right"}:e.edge==="start"?{left:`${e.x}%`,marginLeft:-4,textAlign:"left"}:{left:`${e.x}%`}],children:e.label},r))})]})}var dx={textTransform:"uppercase",letterSpacing:_b.hero.metaTracking,lineHeight:_b.hero.metaLineHeight};function HubWeightCard({weight:e,name:t,extras:i,chart:l="phone"}){let{look:o}=Ob(),a=_b.weight,s=useEverfurTheme().motion.reducedMotion;if(e===null)/* @__PURE__ */
851
+ return n.jsx(HubReveal,{index:3,reduced:s,children:/* @__PURE__ */n.jsx(HubCard,{title:xb.weight,testID:"everfur-records-hub-weight",children:/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:xb.noWeights(t)})})});let d={fontSize:wl(".efh-wt b","fontSize"),lineHeight:wl(".efh-wt b","lineHeight"),letterSpacing:wl(".efh-wt b","letterSpacing")},c=i?.status??null,u=i?.prediction??null,h=i?.key??[];/* @__PURE__ */
852
+ return n.jsx(HubReveal,{index:3,reduced:s,children:/* @__PURE__ */n.jsxs(HubCard,{title:xb.weight,titleEnd:c!==null?/* @__PURE__ */n.jsx(HubPill,{label:c.label,tone:c.tone,testID:"everfur-records-sheet-weight-status"}):void 0,testID:"everfur-records-hub-weight",children:[
852
853
  /* @__PURE__ */n.jsx(r.View,{style:{gap:a.headGap},children:/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:wl(".efh-wt","gap")},children:[
853
- /* @__PURE__ */n.jsx(HubRollingDigits,{text:e.primary,reduced:s,testID:"everfur-records-sheet-weight-latest",renderText:(e,t)=>/* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",style:[d,t?.style],...t?.testID!==void 0?{testID:t.testID}:{},children:e})}),e.secondary!==null?/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",color:o.muted,style:{lineHeight:wl(".efh","fontSize")*1.5},children:e.secondary}):null]})}),u!==null&&u.text.trim().length>0?/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:wl(".efh-emb","gap"),marginTop:wl(".efh-emb","marginTop")},testID:"everfur-records-sheet-weight-prediction",children:[u.icon!==void 0?/* @__PURE__ */n.jsx(r.View,{...Yy,children:u.icon}):null,
854
+ /* @__PURE__ */n.jsx(HubRollingDigits,{text:e.primary,reduced:s,testID:"everfur-records-sheet-weight-latest",renderText:(e,t)=>/* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",style:[d,t?.style],...t?.testID!==void 0?{testID:t.testID}:{},children:e})}),e.secondary!==null?/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",color:o.muted,style:{lineHeight:wl(".efh","fontSize")*1.5},children:e.secondary}):null]})}),u!==null&&u.text.trim().length>0?/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:wl(".efh-emb","gap"),marginTop:wl(".efh-emb","marginTop")},testID:"everfur-records-sheet-weight-prediction",children:[u.icon!==void 0?/* @__PURE__ */n.jsx(r.View,{...Jy,children:u.icon}):null,
854
855
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{flex:1,minWidth:0,fontSize:wl(".efh-emb","fontSize"),lineHeight:wl(".efh-emb","lineHeight")},children:u.text})]}):null,e.points.length>=2?/* @__PURE__ */n.jsxs(r.View,{style:{marginTop:wl(".efh-wchart","marginTop")},children:[l==="app"?/* @__PURE__ */n.jsx(WeightChart,{weight:e}):/* @__PURE__ */n.jsx(PhoneWeightChart,{weight:e}),h.length>0?/* @__PURE__ */n.jsx(r.View,{style:{flexDirection:"row",flexWrap:"wrap",rowGap:wl(".efh-wkey","rowGap"),columnGap:wl(".efh-wkey","columnGap"),marginTop:wl(".efh-wkey","marginTop")},testID:"everfur-records-sheet-weight-key",children:h.map(e=>{let t=e.kind==="vet"?12:7;/* @__PURE__ */
855
856
  return n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:wl(".efh-wkey span","gap")},children:[
856
857
  /* @__PURE__ */n.jsx(r.View,{style:{width:t,height:t,borderRadius:t/2,backgroundColor:e.kind==="vet"?o.ink:o.go}}),
857
- /* @__PURE__ */n.jsx(HubText,{variant:"fine",style:{fontSize:wl(".efh-wkey","fontSize"),lineHeight:wl(".efh-wkey","lineHeight")},children:e.label})]},e.label)})}):e.band!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:bb.estimatedRange}):null]}):e.points.length===1?
858
- /* @__PURE__ */n.jsxs(r.View,{style:{gap:8,marginTop:a.headBottom},children:[e.date!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",style:ox,testID:"everfur-records-sheet-weight-date",children:e.date}):null,
859
- /* @__PURE__ */n.jsx(HubText,{variant:"fine",style:ox,testID:"everfur-records-sheet-weight-single",children:Gm.oneReading})]}):null]})})}function SeeWhereItStands({onPress:e,testID:t="everfur-records-sheet-on-the-way-go"}){/* @__PURE__ */
860
- return n.jsx(HubButton,{label:nm.seeWhereItStands,variant:"secondary",size:"sm",icon:"chevron",onPress:e,style:{alignSelf:"flex-start"},testID:t})}function HubInFlight({lines:e,onOpenRequest:t}){return e.length===0?null:/* @__PURE__ */n.jsx(r.View,{style:{gap:12},testID:"everfur-records-sheet-in-flight",children:e.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:{gap:8,alignItems:"flex-start"},testID:"everfur-records-sheet-on-the-way",children:[
861
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:e.text}),t!==void 0?/* @__PURE__ */n.jsx(SeeWhereItStands,{onPress:()=>t(e.requestId)}):null]},e.key))})}function HubAddRecords({words:e,sources:t,canRequest:i,onRequest:l,onUpload:o,note:a,inFlight:s=[],onOpenRequest:d,uploadHint:c}){let{look:u}=Vb(),h=Rb.add,p=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
858
+ /* @__PURE__ */n.jsx(HubText,{variant:"fine",style:{fontSize:wl(".efh-wkey","fontSize"),lineHeight:wl(".efh-wkey","lineHeight")},children:e.label})]},e.label)})}):e.band!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:xb.estimatedRange}):null]}):e.points.length===1?
859
+ /* @__PURE__ */n.jsxs(r.View,{style:{gap:8,marginTop:a.headBottom},children:[e.date!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",style:dx,testID:"everfur-records-sheet-weight-date",children:e.date}):null,
860
+ /* @__PURE__ */n.jsx(HubText,{variant:"fine",style:dx,testID:"everfur-records-sheet-weight-single",children:Ym.oneReading})]}):null]})})}function SeeWhereItStands({onPress:e,testID:t="everfur-records-sheet-on-the-way-go"}){/* @__PURE__ */
861
+ return n.jsx(HubButton,{label:lm.seeWhereItStands,variant:"secondary",size:"sm",icon:"chevron",onPress:e,style:{alignSelf:"flex-start"},testID:t})}function HubInFlight({lines:e,onOpenRequest:t}){return e.length===0?null:/* @__PURE__ */n.jsx(r.View,{style:{gap:12},testID:"everfur-records-sheet-in-flight",children:e.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:{gap:8,alignItems:"flex-start"},testID:"everfur-records-sheet-on-the-way",children:[
862
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:e.text}),t!==void 0?/* @__PURE__ */n.jsx(SeeWhereItStands,{onPress:()=>t(e.requestId)}):null]},e.key))})}function HubAddRecords({words:e,sources:t,canRequest:i,onRequest:l,onUpload:o,note:a,inFlight:s=[],onOpenRequest:d,uploadHint:c}){let{look:u}=Ob(),h=_b.add,p=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
862
863
  return n.jsx(HubReveal,{index:4,reduced:p,children:/* @__PURE__ */n.jsx(HubCard,{testID:"everfur-records-hub-add-records",children:/* @__PURE__ */n.jsxs(r.View,{style:{gap:wl(".efh-add","gap")},children:[
863
864
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:h.headGap},children:[
864
865
  /* @__PURE__ */n.jsx(HubIcon,{name:"clip",size:h.icon,color:u.alert}),
865
- /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",style:{flex:1},children:bb.addRecords(e.name)})]}),
866
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{lineHeight:wl(".efh-add > p","lineHeight")},children:bb.moreThanOneClinic}),
867
- /* @__PURE__ */n.jsx(HubInFlight,{lines:s,onOpenRequest:d}),t.length>0?/* @__PURE__ */n.jsx(r.View,{style:{gap:h.sourcesGap,marginTop:h.sourcesTop},accessibilityLabel:bb.onFileNow,testID:"everfur-records-sheet-sources",children:t.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",columnGap:h.sourceColumnGap,paddingVertical:h.sourcePadY,paddingHorizontal:h.sourcePadX,borderRadius:h.sourceRadius,backgroundColor:u.mist},children:[
866
+ /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",style:{flex:1},children:xb.addRecords(e.name)})]}),
867
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{lineHeight:wl(".efh-add > p","lineHeight")},children:xb.moreThanOneClinic}),
868
+ /* @__PURE__ */n.jsx(HubInFlight,{lines:s,onOpenRequest:d}),t.length>0?/* @__PURE__ */n.jsx(r.View,{style:{gap:h.sourcesGap,marginTop:h.sourcesTop},accessibilityLabel:xb.onFileNow,testID:"everfur-records-sheet-sources",children:t.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",columnGap:h.sourceColumnGap,paddingVertical:h.sourcePadY,paddingHorizontal:h.sourcePadX,borderRadius:h.sourceRadius,backgroundColor:u.mist},children:[
868
869
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{flexShrink:1,lineHeight:wl(".efh-add > p","fontSize")*1.4},children:e.name}),e.meta!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:e.meta}):null]},e.key))}):null,
869
- /* @__PURE__ */n.jsxs(r.View,{style:{gap:h.actsGap,paddingTop:h.actsTop},children:[i?/* @__PURE__ */n.jsx(HubButton,{label:bb.requestFromClinic,icon:"download",size:"lg",block:true,onPress:l,testID:"everfur-records-sheet-request"}):null,i?a:null,
870
- /* @__PURE__ */n.jsx(HubButton,{label:bb.uploadDocument,icon:"upload",size:"lg",variant:"secondary",bold:true,block:true,onPress:o,...c!==void 0?{accessibilityHint:c}:{},style:{backgroundColor:u.white,borderRadius:999},testID:"everfur-records-sheet-upload"})]})]})})})}function Step({state:e,title:t,when:i,last:l=false,testID:o}){let{look:a}=Vb(),s=Rb.onTheWay.dot;/* @__PURE__ */
870
+ /* @__PURE__ */n.jsxs(r.View,{style:{gap:h.actsGap,paddingTop:h.actsTop},children:[i?/* @__PURE__ */n.jsx(HubButton,{label:xb.requestFromClinic,icon:"download",size:"lg",block:true,onPress:l,testID:"everfur-records-sheet-request"}):null,i?a:null,
871
+ /* @__PURE__ */n.jsx(HubButton,{label:xb.uploadDocument,icon:"upload",size:"lg",variant:"secondary",bold:true,block:true,onPress:o,...c!==void 0?{accessibilityHint:c}:{},style:{backgroundColor:u.white,borderRadius:999},testID:"everfur-records-sheet-upload"})]})]})})})}function Step({state:e,title:t,when:i,last:l=false,testID:o}){let{look:a}=Ob(),s=_b.onTheWay.dot;/* @__PURE__ */
871
872
  return n.jsxs(r.View,{style:{flexDirection:"row",gap:16,paddingBottom:l?0:20},accessible:true,accessibilityLabel:i!==null?`${t}. ${i}`:t,testID:`${o}-${e}`,children:[l?null:/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:s/2-1,top:s+2,bottom:2,width:2,borderRadius:1,backgroundColor:e==="done"?a.ink:a.line}}),
872
873
  /* @__PURE__ */n.jsxs(r.View,{style:{width:s,height:s,borderRadius:s/2,borderWidth:2,borderColor:e!=="next"?a.ink:a.line,backgroundColor:e==="done"?a.fill:a.white,alignItems:"center",justifyContent:"center"},children:[e==="done"?/* @__PURE__ */n.jsx(CheckGlyph,{size:16,color:a.onFill}):null,e==="now"?/* @__PURE__ */n.jsx(r.View,{style:{width:10,height:10,borderRadius:5,backgroundColor:a.go}}):null]}),
873
874
  /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,minWidth:0,paddingTop:3,gap:2},children:[
874
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",color:e==="next"?a.muted:void 0,style:{fontSize:17,lineHeight:22},children:t}),i!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:i}):null]})]})}function Way({ink:e,icon:t,title:i,text:l,onPress:o,testID:a}){let{look:s}=Vb(),d=e?s.onFill:s.ink,c=Rb.onTheWay;/* @__PURE__ */
875
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",color:e==="next"?a.muted:void 0,style:{fontSize:17,lineHeight:22},children:t}),i!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:i}):null]})]})}function Way({ink:e,icon:t,title:i,text:l,onPress:o,testID:a}){let{look:s}=Ob(),d=e?s.onFill:s.ink,c=_b.onTheWay;/* @__PURE__ */
875
876
  return n.jsxs(r.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:`${i}. ${l}`,style:[{flexDirection:"row",alignItems:"center",gap:12,padding:c.wayPad,borderRadius:c.wayRadius},e?{backgroundColor:s.fill}:{borderWidth:1.5,borderStyle:"dashed",borderColor:s.ink,backgroundColor:s.white}],testID:a,children:[
876
877
  /* @__PURE__ */n.jsx(HubIcon,{name:t,size:c.wayIcon,color:d}),
877
878
  /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,minWidth:0,gap:2},children:[
878
879
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",color:d,style:{fontSize:17,lineHeight:22},children:i}),
879
880
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",color:d,children:l})]}),
880
- /* @__PURE__ */n.jsx(HubIcon,{name:"chevron",size:20,color:e?s.accentOnFill:s.ink})]})}function HubOnTheWay({words:e,request:t,steps:i,sentWhen:l,canAct:o,canRequest:a,onAnotherClinic:s,onUpload:d,onOpenRequest:c}){let u=e.poss==="her"||e.poss==="his"?e.poss:`${e.name}’s`,h=Rb.onTheWay,[p,g,f]=i,m=t.clinicName?.trim()||null,b=t.statusLabel.trim()||null,y=t.waitingExpectation?.trim()||(g==="now"?b:null),x=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
881
+ /* @__PURE__ */n.jsx(HubIcon,{name:"chevron",size:20,color:e?s.accentOnFill:s.ink})]})}function HubOnTheWay({words:e,request:t,steps:i,sentWhen:l,canAct:o,canRequest:a,onAnotherClinic:s,onUpload:d,onOpenRequest:c}){let u=e.poss==="her"||e.poss==="his"?e.poss:`${e.name}’s`,h=_b.onTheWay,[p,g,f]=i,m=t.clinicName?.trim()||null,b=t.statusLabel.trim()||null,y=t.waitingExpectation?.trim()||(g==="now"?b:null),x=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
881
882
  return n.jsx(HubReveal,{index:1,reduced:x,children:/* @__PURE__ */n.jsxs(HubCard,{testID:"everfur-records-hub-on-the-way",children:[
882
- /* @__PURE__ */n.jsx(HubText,{variant:"screenTitle",accessibilityRole:"header",style:{fontSize:h.titleSize,lineHeight:h.titleLineHeight,letterSpacing:h.titleTracking},children:bb.onTheWay(e.Name)}),
883
- /* @__PURE__ */n.jsx(HubText,{variant:"body",style:{marginTop:8},children:bb.clinicsTake}),
883
+ /* @__PURE__ */n.jsx(HubText,{variant:"screenTitle",accessibilityRole:"header",style:{fontSize:h.titleSize,lineHeight:h.titleLineHeight,letterSpacing:h.titleTracking},children:xb.onTheWay(e.Name)}),
884
+ /* @__PURE__ */n.jsx(HubText,{variant:"body",style:{marginTop:8},children:xb.clinicsTake}),
884
885
  /* @__PURE__ */n.jsxs(r.View,{style:{marginTop:16},accessibilityRole:"list",testID:"everfur-records-sheet-tracker",children:[
885
- /* @__PURE__ */n.jsx(Step,{state:p,title:bb.requestSentTo(m),when:l!==null?bb.signedRelease(l):null,testID:"everfur-records-sheet-step-sent"}),
886
- /* @__PURE__ */n.jsx(Step,{state:g,title:bb.waitingFor(u),when:y,testID:"everfur-records-sheet-step-waiting"}),
887
- /* @__PURE__ */n.jsx(Step,{state:f,last:true,title:bb.inHealthTab(u),when:f==="now"?b:bb.everyPageRead,testID:"everfur-records-sheet-step-ready"})]}),c!==void 0?/* @__PURE__ */n.jsx(r.View,{style:{marginTop:16},children:/* @__PURE__ */n.jsx(SeeWhereItStands,{onPress:c})}):null,o?/* @__PURE__ */n.jsxs(r.View,{style:{gap:12,marginTop:16},testID:"everfur-records-sheet-none-ways",children:[a?/* @__PURE__ */n.jsx(Way,{ink:true,icon:"download",title:bb.anotherClinic,text:bb.anotherClinicText,onPress:s,testID:"everfur-records-sheet-another-clinic"}):null,
888
- /* @__PURE__ */n.jsx(Way,{ink:false,icon:"upload",title:bb.uploadDocument,text:bb.uploadText,onPress:d,testID:"everfur-records-sheet-none-upload"})]}):null]})})}function RailDot({state:e}){let{look:t}=Vb(),i={width:Cb.dot,height:Cb.dot,borderRadius:Cb.dot/2,alignItems:"center",justifyContent:"center"};return e==="done"?/* @__PURE__ */n.jsx(r.View,{style:[i,{backgroundColor:t.brand}],...Yy,children:/* @__PURE__ */n.jsx(CheckGlyph,{size:Cb.check,color:t.white})}):e==="failed"?/* @__PURE__ */n.jsxs(r.View,{style:[i,{backgroundColor:t.alert}],...Yy,children:[
886
+ /* @__PURE__ */n.jsx(Step,{state:p,title:xb.requestSentTo(m),when:l!==null?xb.signedRelease(l):null,testID:"everfur-records-sheet-step-sent"}),
887
+ /* @__PURE__ */n.jsx(Step,{state:g,title:xb.waitingFor(u),when:y,testID:"everfur-records-sheet-step-waiting"}),
888
+ /* @__PURE__ */n.jsx(Step,{state:f,last:true,title:xb.inHealthTab(u),when:f==="now"?b:xb.everyPageRead,testID:"everfur-records-sheet-step-ready"})]}),c!==void 0?/* @__PURE__ */n.jsx(r.View,{style:{marginTop:16},children:/* @__PURE__ */n.jsx(SeeWhereItStands,{onPress:c})}):null,o?/* @__PURE__ */n.jsxs(r.View,{style:{gap:12,marginTop:16},testID:"everfur-records-sheet-none-ways",children:[a?/* @__PURE__ */n.jsx(Way,{ink:true,icon:"download",title:xb.anotherClinic,text:xb.anotherClinicText,onPress:s,testID:"everfur-records-sheet-another-clinic"}):null,
889
+ /* @__PURE__ */n.jsx(Way,{ink:false,icon:"upload",title:xb.uploadDocument,text:xb.uploadText,onPress:d,testID:"everfur-records-sheet-none-upload"})]}):null]})})}function RailDot({state:e}){let{look:t}=Ob(),i={width:Tb.dot,height:Tb.dot,borderRadius:Tb.dot/2,alignItems:"center",justifyContent:"center"};return e==="done"?/* @__PURE__ */n.jsx(r.View,{style:[i,{backgroundColor:t.brand}],...Jy,children:/* @__PURE__ */n.jsx(CheckGlyph,{size:Tb.check,color:t.white})}):e==="failed"?/* @__PURE__ */n.jsxs(r.View,{style:[i,{backgroundColor:t.alert}],...Jy,children:[
889
890
  /* @__PURE__ */n.jsx(r.View,{style:{width:2,height:6,borderRadius:1,backgroundColor:t.white}}),
890
- /* @__PURE__ */n.jsx(r.View,{style:{width:2,height:2,borderRadius:1,marginTop:1.5,backgroundColor:t.white}})]}):e==="current"?/* @__PURE__ */n.jsx(r.View,{style:[i,{borderWidth:Cb.ring,borderColor:t.brand,backgroundColor:t.white}],...Yy,children:/* @__PURE__ */n.jsx(r.View,{style:{width:Cb.core,height:Cb.core,borderRadius:Cb.core/2,backgroundColor:t.brand}})}):/* @__PURE__ */n.jsx(r.View,{style:[i,{borderWidth:Cb.ring,borderColor:t.legacyBorder,backgroundColor:t.white}],...Yy})}function HubInProgress({words:e,request:t,onOpenRequest:i}){let{look:l,face:o}=Vb(),a=Rb.inProgress,s=vh(t),d=t.clinicName?.trim()||bb.requestTitle(e.Name),c=t.statusLabel.trim(),u=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
891
- return n.jsx(HubReveal,{index:1,reduced:u,children:/* @__PURE__ */n.jsxs(r.View,{style:{borderRadius:a.radius,backgroundColor:l.white,padding:a.pad,gap:a.gap},accessibilityRole:"summary",accessibilityLabel:bb.requestA11y(e.name,c),testID:"everfur-records-records-in-progress",children:[
891
+ /* @__PURE__ */n.jsx(r.View,{style:{width:2,height:2,borderRadius:1,marginTop:1.5,backgroundColor:t.white}})]}):e==="current"?/* @__PURE__ */n.jsx(r.View,{style:[i,{borderWidth:Tb.ring,borderColor:t.brand,backgroundColor:t.white}],...Jy,children:/* @__PURE__ */n.jsx(r.View,{style:{width:Tb.core,height:Tb.core,borderRadius:Tb.core/2,backgroundColor:t.brand}})}):/* @__PURE__ */n.jsx(r.View,{style:[i,{borderWidth:Tb.ring,borderColor:t.legacyBorder,backgroundColor:t.white}],...Jy})}function HubInProgress({words:e,request:t,onOpenRequest:i}){let{look:l,face:o}=Ob(),a=_b.inProgress,s=vh(t),d=t.clinicName?.trim()||xb.requestTitle(e.Name),c=t.statusLabel.trim(),u=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
892
+ return n.jsx(HubReveal,{index:1,reduced:u,children:/* @__PURE__ */n.jsxs(r.View,{style:{borderRadius:a.radius,backgroundColor:l.white,padding:a.pad,gap:a.gap},accessibilityRole:"summary",accessibilityLabel:xb.requestA11y(e.name,c),testID:"everfur-records-records-in-progress",children:[
892
893
  /* @__PURE__ */n.jsx(r.View,{style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8},children:/* @__PURE__ */n.jsx(Text,{style:[o("bold"),{flex:1,fontSize:a.titleSize,lineHeight:a.titleLineHeight,color:l.legacyText}],children:d})}),
893
- /* @__PURE__ */n.jsx(r.View,{accessibilityRole:"summary",testID:"everfur-records-sheet-rail",children:s.map((e,t)=>{let i=e.at!==null?gy(e.at):null,a=e.state==="done"?"completed":e.state==="current"?"in progress":e.state==="failed"?"needs attention":"not started",d=e.state==="upcoming";/* @__PURE__ */
894
- return n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"flex-start",gap:Cb.rowGap},accessibilityRole:"text",accessibilityLabel:[e.title,e.detail,i,a].filter(Boolean).join(", "),testID:`everfur-records-sheet-rail-${e.key}`,children:[
895
- /* @__PURE__ */n.jsxs(r.View,{style:{alignItems:"center",width:Cb.dot,alignSelf:"stretch"},children:[
896
- /* @__PURE__ */n.jsx(RailDot,{state:e.state}),t<s.length-1?/* @__PURE__ */n.jsx(r.View,{style:{width:Cb.rail,flex:1,minHeight:Cb.railMin,marginVertical:Cb.railGap,backgroundColor:e.state==="done"?l.brand:l.legacyBorder},...Yy}):null]}),
897
- /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,paddingBottom:Cb.bodyBottom,gap:Cb.bodyGap},children:[
898
- /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:Cb.titleGap},children:[
899
- /* @__PURE__ */n.jsx(Text,{style:[o(d?"regular":"bold"),{flex:1,fontSize:Cb.titleSize,lineHeight:Cb.titleLineHeight,color:e.state==="current"?l.brand:e.state==="failed"?l.alert:d?l.legacyMuted:l.legacyText}],children:e.title}),i!==null?/* @__PURE__ */n.jsx(Text,{style:[o("regular"),{fontSize:Cb.dateSize,lineHeight:Cb.dateLineHeight,color:l.legacyMuted}],children:i}):null]}),e.detail!==null?/* @__PURE__ */n.jsx(Text,{style:[o("regular"),{fontSize:Cb.detailSize,lineHeight:Cb.detailLineHeight,color:l.legacyMuted},d?{opacity:Cb.upcomingOpacity}:null],children:e.detail}):null]})]},e.key)})}),c.length>0?/* @__PURE__ */n.jsx(r.View,{style:{borderRadius:a.statusRadius,backgroundColor:l.brandSoft,padding:a.statusPad},children:/* @__PURE__ */n.jsx(Text,{style:[o("regular"),{fontSize:a.statusSize,lineHeight:a.statusLineHeight,color:l.legacyText}],children:c})}):null,i!==void 0?/* @__PURE__ */n.jsx(SeeWhereItStands,{onPress:i}):null]})})}function HubMedications({medications:e}){let{look:t}=Vb(),i=useEverfurTheme().motion.reducedMotion;return e===null?null:/* @__PURE__ */n.jsx(HubReveal,{index:5,reduced:i,children:/* @__PURE__ */n.jsx(HubCard,{title:nm.takingNow,testID:"everfur-records-sheet-meds",children:e.current.length===0?/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:nm.noCurrentMeds}):/* @__PURE__ */n.jsx(r.View,{accessibilityRole:"list",style:{gap:Rb.upcoming.listGap},children:e.current.map((e,i)=>/* @__PURE__ */n.jsxs(r.View,{style:[{paddingVertical:Rb.upcoming.rowPadY},i===0?null:{borderTopWidth:1,borderTopColor:t.line}],testID:`everfur-records-sheet-med-${e.key}`,children:[
900
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",style:{fontSize:17,lineHeight:22},children:e.name}),e.detail!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:e.detail}):null]},e.key))})})})}function ax(e,t){let r=[...e.flatMap(e=>e.items.map(e=>({...e,source:"clinic"}))),...t.map(e=>({key:`host-${e.key}`,ms:e.ms,date:e.date,title:e.title,text:e.text??null,alert:false,markerId:null,source:e.source,...e.onPress!==void 0?{onPress:e.onPress}:{}}))].sort((e,t)=>t.ms-e.ms),n=[];for(let e of r){let t=String(new Date(e.ms).getUTCFullYear()),r=n[n.length-1];r!==void 0&&r.year===t?r.items.push(e):n.push({year:t,items:[e]})}return n}function HubHistory({words:e,history:t,onOpenMarker:i,sourceKey:l,extra:o=[]}){let{look:a,face:s}=Vb(),d=useEverfurTheme().motion.reducedMotion,c=ax(t,o);if(c.length===0)return null;let u=e=>e==="everfur"?a.go:e==="partner"?fl.embTealInk:a.ink,h=[["clinic",l?.clinic??nm.theirClinic(e)],...["everfur","partner"].flatMap(e=>l?.[e]!==void 0?[[e,l[e]]]:[])],p={...s("mono"),fontSize:wl(".efh-tl__date","fontSize"),lineHeight:wl(".efh-tl__date","lineHeight"),letterSpacing:wl(".efh-tl__date","letterSpacing"),textTransform:"uppercase",color:a.muted};/* @__PURE__ */
901
- return n.jsx(HubReveal,{index:6,reduced:d,children:/* @__PURE__ */n.jsxs(HubCard,{title:nm.history,testID:"everfur-records-sheet-history",children:[
894
+ /* @__PURE__ */n.jsx(r.View,{accessibilityRole:"summary",testID:"everfur-records-sheet-rail",children:s.map((e,t)=>{let i=e.at!==null?by(e.at):null,a=e.state==="done"?"completed":e.state==="current"?"in progress":e.state==="failed"?"needs attention":"not started",d=e.state==="upcoming";/* @__PURE__ */
895
+ return n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"flex-start",gap:Tb.rowGap},accessibilityRole:"text",accessibilityLabel:[e.title,e.detail,i,a].filter(Boolean).join(", "),testID:`everfur-records-sheet-rail-${e.key}`,children:[
896
+ /* @__PURE__ */n.jsxs(r.View,{style:{alignItems:"center",width:Tb.dot,alignSelf:"stretch"},children:[
897
+ /* @__PURE__ */n.jsx(RailDot,{state:e.state}),t<s.length-1?/* @__PURE__ */n.jsx(r.View,{style:{width:Tb.rail,flex:1,minHeight:Tb.railMin,marginVertical:Tb.railGap,backgroundColor:e.state==="done"?l.brand:l.legacyBorder},...Jy}):null]}),
898
+ /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,paddingBottom:Tb.bodyBottom,gap:Tb.bodyGap},children:[
899
+ /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:Tb.titleGap},children:[
900
+ /* @__PURE__ */n.jsx(Text,{style:[o(d?"regular":"bold"),{flex:1,fontSize:Tb.titleSize,lineHeight:Tb.titleLineHeight,color:e.state==="current"?l.brand:e.state==="failed"?l.alert:d?l.legacyMuted:l.legacyText}],children:e.title}),i!==null?/* @__PURE__ */n.jsx(Text,{style:[o("regular"),{fontSize:Tb.dateSize,lineHeight:Tb.dateLineHeight,color:l.legacyMuted}],children:i}):null]}),e.detail!==null?/* @__PURE__ */n.jsx(Text,{style:[o("regular"),{fontSize:Tb.detailSize,lineHeight:Tb.detailLineHeight,color:l.legacyMuted},d?{opacity:Tb.upcomingOpacity}:null],children:e.detail}):null]})]},e.key)})}),c.length>0?/* @__PURE__ */n.jsx(r.View,{style:{borderRadius:a.statusRadius,backgroundColor:l.brandSoft,padding:a.statusPad},children:/* @__PURE__ */n.jsx(Text,{style:[o("regular"),{fontSize:a.statusSize,lineHeight:a.statusLineHeight,color:l.legacyText}],children:c})}):null,i!==void 0?/* @__PURE__ */n.jsx(SeeWhereItStands,{onPress:i}):null]})})}function HubMedications({medications:e}){let{look:t}=Ob(),i=useEverfurTheme().motion.reducedMotion;return e===null?null:/* @__PURE__ */n.jsx(HubReveal,{index:5,reduced:i,children:/* @__PURE__ */n.jsx(HubCard,{title:lm.takingNow,testID:"everfur-records-sheet-meds",children:e.current.length===0?/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:lm.noCurrentMeds}):/* @__PURE__ */n.jsx(r.View,{accessibilityRole:"list",style:{gap:_b.upcoming.listGap},children:e.current.map((e,i)=>/* @__PURE__ */n.jsxs(r.View,{style:[{paddingVertical:_b.upcoming.rowPadY},i===0?null:{borderTopWidth:1,borderTopColor:t.line}],testID:`everfur-records-sheet-med-${e.key}`,children:[
901
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",style:{fontSize:17,lineHeight:22},children:e.name}),e.detail!==null?/* @__PURE__ */n.jsx(HubText,{variant:"fine",children:e.detail}):null]},e.key))})})})}function cx(e,t){let r=[...e.flatMap(e=>e.items.map(e=>({...e,source:"clinic"}))),...t.map(e=>({key:`host-${e.key}`,ms:e.ms,date:e.date,title:e.title,text:e.text??null,alert:false,markerId:null,source:e.source,...e.onPress!==void 0?{onPress:e.onPress}:{}}))].sort((e,t)=>t.ms-e.ms),n=[];for(let e of r){let t=String(new Date(e.ms).getUTCFullYear()),r=n[n.length-1];r!==void 0&&r.year===t?r.items.push(e):n.push({year:t,items:[e]})}return n}function HubHistory({words:e,history:t,onOpenMarker:i,sourceKey:l,extra:o=[]}){let{look:a,face:s}=Ob(),d=useEverfurTheme().motion.reducedMotion,c=cx(t,o);if(c.length===0)return null;let u=e=>e==="everfur"?a.go:e==="partner"?fl.embTealInk:a.ink,h=[["clinic",l?.clinic??lm.theirClinic(e)],...["everfur","partner"].flatMap(e=>l?.[e]!==void 0?[[e,l[e]]]:[])],p={...s("mono"),fontSize:wl(".efh-tl__date","fontSize"),lineHeight:wl(".efh-tl__date","lineHeight"),letterSpacing:wl(".efh-tl__date","letterSpacing"),textTransform:"uppercase",color:a.muted};/* @__PURE__ */
902
+ return n.jsx(HubReveal,{index:6,reduced:d,children:/* @__PURE__ */n.jsxs(HubCard,{title:lm.history,testID:"everfur-records-sheet-history",children:[
902
903
  /* @__PURE__ */n.jsx(r.View,{style:{flexDirection:"row",flexWrap:"wrap",rowGap:wl(".efh-key","rowGap"),columnGap:wl(".efh-key","columnGap"),marginBottom:16},testID:"everfur-records-sheet-history-key",children:h.map(([e,t])=>/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:wl(".efh-key span","gap")},children:[
903
904
  /* @__PURE__ */n.jsx(r.View,{style:{width:wl(".efh-key span::before","width"),height:wl(".efh-key span::before","width"),borderRadius:999,borderWidth:2.5,borderColor:u(e),backgroundColor:a.white}}),
904
905
  /* @__PURE__ */n.jsx(HubText,{variant:"fine",style:{fontSize:wl(".efh-key","fontSize"),lineHeight:wl(".efh-key","lineHeight")},children:t})]},e))}),c.map((e,t)=>/* @__PURE__ */n.jsxs(r.View,{children:[
@@ -906,24 +907,24 @@ return n.jsx(HubReveal,{index:6,reduced:d,children:/* @__PURE__ */n.jsxs(HubCard
906
907
  /* @__PURE__ */n.jsx(HubText,{variant:"fine",style:p,children:t.date}),
907
908
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",color:c?a.alertDeep:void 0,style:{marginTop:wl(".efh-tl__title","marginTop"),fontSize:wl(".efh-tl__title","fontSize"),lineHeight:wl(".efh-tl__title","lineHeight")},children:t.title}),t.text!==null?/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{marginTop:wl(".efh-tl__text","marginTop"),lineHeight:wl(".efh-tl__text","lineHeight")},children:t.text}):null]}),f=s!==null?`everfur-records-sheet-history-marker-${s}`:`everfur-records-sheet-history-${t.key}`;/* @__PURE__ */
908
909
  return n.jsxs(r.View,{style:{flexDirection:"row",gap:wl(".efh-tl__item","gap"),paddingBottom:o?0:wl(".efh-tl__item","paddingBottom")},children:[
909
- /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:wl(".efh-tl__item::before","left"),top:wl(".efh-tl__item::before","top"),bottom:o?12:wl(".efh-tl__item::before","bottom"),width:2,borderRadius:1,backgroundColor:a.line},...Yy}),
910
- /* @__PURE__ */n.jsx(r.View,{style:{width:24,alignItems:"center"},...Yy,children:/* @__PURE__ */n.jsx(r.View,{style:{width:wl(".efh-tl__dot","width"),height:wl(".efh-tl__dot","width"),marginTop:wl(".efh-tl__dot","marginTop"),borderRadius:999,borderWidth:3,borderColor:t.alert?a.alert:u(t.source),backgroundColor:a.white},testID:`everfur-records-sheet-history-dot-${t.key}`})}),d!==void 0?/* @__PURE__ */n.jsxs(r.Pressable,{onPress:d,accessibilityRole:"button",accessibilityLabel:h,testID:f,style:({pressed:e})=>[{flex:1,minWidth:0},c?{marginTop:-8,paddingVertical:8,paddingRight:28}:null,e?{transform:[{scale:.98}]}:null],children:[c?/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",top:0,bottom:0,left:-8,right:-8,borderRadius:10,backgroundColor:a.tintRed},...Yy}):null,g,
911
- /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",right:0,top:"50%",marginTop:-10},...Yy,children:/* @__PURE__ */n.jsx(HubIcon,{name:"chevron",size:20,color:c?a.alert:a.icoSage})})]}):/* @__PURE__ */n.jsx(r.View,{style:{flex:1,minWidth:0},accessible:true,accessibilityLabel:h,testID:f,children:g})]},t.key)})]},e.year))]})})}function MarkerLine({marker:e}){let{look:t}=Vb(),i=Rb.peek,l=e.flag!==void 0;/* @__PURE__ */
910
+ /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",left:wl(".efh-tl__item::before","left"),top:wl(".efh-tl__item::before","top"),bottom:o?12:wl(".efh-tl__item::before","bottom"),width:2,borderRadius:1,backgroundColor:a.line},...Jy}),
911
+ /* @__PURE__ */n.jsx(r.View,{style:{width:24,alignItems:"center"},...Jy,children:/* @__PURE__ */n.jsx(r.View,{style:{width:wl(".efh-tl__dot","width"),height:wl(".efh-tl__dot","width"),marginTop:wl(".efh-tl__dot","marginTop"),borderRadius:999,borderWidth:3,borderColor:t.alert?a.alert:u(t.source),backgroundColor:a.white},testID:`everfur-records-sheet-history-dot-${t.key}`})}),d!==void 0?/* @__PURE__ */n.jsxs(r.Pressable,{onPress:d,accessibilityRole:"button",accessibilityLabel:h,testID:f,style:({pressed:e})=>[{flex:1,minWidth:0},c?{marginTop:-8,paddingVertical:8,paddingRight:28}:null,e?{transform:[{scale:.98}]}:null],children:[c?/* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",top:0,bottom:0,left:-8,right:-8,borderRadius:10,backgroundColor:a.tintRed},...Jy}):null,g,
912
+ /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",right:0,top:"50%",marginTop:-10},...Jy,children:/* @__PURE__ */n.jsx(HubIcon,{name:"chevron",size:20,color:c?a.alert:a.icoSage})})]}):/* @__PURE__ */n.jsx(r.View,{style:{flex:1,minWidth:0},accessible:true,accessibilityLabel:h,testID:f,children:g})]},t.key)})]},e.year))]})})}function MarkerLine({marker:e}){let{look:t}=Ob(),i=_b.peek,l=e.flag!==void 0;/* @__PURE__ */
912
913
  return n.jsxs(n.Fragment,{children:[
913
914
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:i.markerTopGap},children:[
914
915
  /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,minWidth:0},children:[
915
916
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:8},children:[
916
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",style:{fontSize:17,lineHeight:22},children:e.name}),l?/* @__PURE__ */n.jsx(HubPill,{label:bb.high,tone:"high"}):null]}),
917
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",style:{fontSize:17,lineHeight:22},children:e.name}),l?/* @__PURE__ */n.jsx(HubPill,{label:xb.high,tone:"high"}):null]}),
917
918
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",color:t.muted,children:e.what})]}),
918
919
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"baseline",gap:i.valueGap},children:[
919
920
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",color:l?t.alert:void 0,style:{fontSize:17,lineHeight:22},children:e.value}),
920
921
  /* @__PURE__ */n.jsx(HubText,{variant:"fine",color:t.muted,children:e.unit})]})]}),
921
- /* @__PURE__ */n.jsxs(r.View,{style:{height:i.barHeight,borderRadius:999,backgroundColor:t.barTrack},...Yy,children:[
922
+ /* @__PURE__ */n.jsxs(r.View,{style:{height:i.barHeight,borderRadius:999,backgroundColor:t.barTrack},...Jy,children:[
922
923
  /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",top:0,bottom:0,left:"20%",right:"20%",borderRadius:999,backgroundColor:t.go}}),
923
- /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",top:-(i.barDot-i.barHeight)/2,left:`${e.at}%`,width:i.barDot,height:i.barDot,marginLeft:-i.barDot/2,borderRadius:i.barDot/2,borderWidth:i.barDotRing,borderColor:t.white,backgroundColor:l?t.alert:t.ink}})]})]})}function FlaggedMarker({marker:t,name:i,poss:l}){let{look:o}=Vb(),a=Rb.peek,[s,d]=e.useState(false);/* @__PURE__ */
924
+ /* @__PURE__ */n.jsx(r.View,{style:{position:"absolute",top:-(i.barDot-i.barHeight)/2,left:`${e.at}%`,width:i.barDot,height:i.barDot,marginLeft:-i.barDot/2,borderRadius:i.barDot/2,borderWidth:i.barDotRing,borderColor:t.white,backgroundColor:l?t.alert:t.ink}})]})]})}function FlaggedMarker({marker:t,name:i,poss:l}){let{look:o}=Ob(),a=_b.peek,[s,d]=e.useState(false);/* @__PURE__ */
924
925
  return n.jsxs(r.View,{style:[{borderRadius:a.markerRadius},s?{backgroundColor:o.tintRed}:null],children:[
925
926
  /* @__PURE__ */n.jsx(r.Pressable,{onPress:()=>d(e=>!e),accessibilityRole:"button",accessibilityState:{expanded:s},style:{gap:a.markerGap,padding:a.markerPad,borderRadius:a.markerRadius,backgroundColor:o.tintRed},testID:`everfur-records-sheet-sample-flag-${t.name}`,children:/* @__PURE__ */n.jsx(MarkerLine,{marker:t})}),s?/* @__PURE__ */n.jsx(r.View,{style:{gap:8,paddingHorizontal:a.markerPad,paddingBottom:a.markerPad,alignItems:"flex-start"},testID:"everfur-records-sheet-sample-flag-note",children:/* @__PURE__ */n.jsxs(HubText,{variant:"bodySm",children:[
926
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",color:o.alertDeep,children:bb.sampleNotTheirs(i)}),bb.sampleNote(l)]})}):null]})}function FromPage({from:t}){let{look:i,face:l}=Vb(),o=Rb.peek,[a,s]=e.useState(false),d=[l("mono"),{color:i.muted}];/* @__PURE__ */
927
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",color:o.alertDeep,children:xb.sampleNotTheirs(i)}),xb.sampleNote(l)]})}):null]})}function FromPage({from:t}){let{look:i,face:l}=Ob(),o=_b.peek,[a,s]=e.useState(false),d=[l("mono"),{color:i.muted}];/* @__PURE__ */
927
928
  return n.jsxs(r.View,{style:{marginTop:8},testID:"everfur-records-sheet-sample-from",children:[
928
929
  /* @__PURE__ */n.jsxs(r.Pressable,{onPress:()=>s(e=>!e),accessibilityRole:"button",accessibilityLabel:t.cap,accessibilityState:{expanded:a},style:[{flexDirection:"row",alignItems:"center",gap:o.fromGap,minHeight:o.fromMinHeight,alignSelf:"flex-start"},a?{marginBottom:8}:null],testID:"everfur-records-sheet-sample-from-cap",children:[
929
930
  /* @__PURE__ */n.jsx(HubIcon,{name:"file",size:o.fromIcon,color:i.icoSage}),
@@ -932,30 +933,30 @@ return n.jsxs(r.View,{style:{marginTop:8},testID:"everfur-records-sheet-sample-f
932
933
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:8},children:[
933
934
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",children:t.who}),
934
935
  /* @__PURE__ */n.jsx(Text,{style:[d,{fontSize:12,lineHeight:18}],children:t.page})]}),
935
- /* @__PURE__ */n.jsx(r.View,{style:{flexDirection:"row"},children:bb.columns.map((e,t)=>/* @__PURE__ */n.jsx(Text,{style:[d,{flex:t===0?1.1:1,paddingHorizontal:8,paddingBottom:2,fontSize:12,lineHeight:16,letterSpacing:.48,textTransform:"uppercase"}],children:e},e))}),t.rows.map(e=>/* @__PURE__ */n.jsx(r.View,{style:[{flexDirection:"row",marginTop:3,borderRadius:6},e.lit===true?{backgroundColor:i.tintYellow}:null],children:[e.test,e.result,e.unit,e.range].map((e,t)=>/* @__PURE__ */n.jsx(Text,{numberOfLines:1,style:[l("mono"),{flex:t===0?1.1:1,paddingHorizontal:8,paddingVertical:5,fontSize:13,lineHeight:18,color:i.text,fontVariant:["tabular-nums"]}],children:e},t))},e.test))]}):null]})}var sx=/heartworm|4dx/i;function HubSamplePeek({name:t,poss:i="her",species:l}){let{look:o}=Vb(),a=Rb.peek,[s,d]=e.useState(0),c=wb.length-1,u=wb[s],h=l!==null&&/^(dog|canine)$/i.test(l.trim()),p={pink:o.tintPink,blue:o.tintBlue,yellow:o.tintYellow},g={screenings:"shield",visits:"folder",timeline:"clock"},f=useEverfurTheme().motion.reducedMotion,m=zy(s,f);/* @__PURE__ */
936
+ /* @__PURE__ */n.jsx(r.View,{style:{flexDirection:"row"},children:xb.columns.map((e,t)=>/* @__PURE__ */n.jsx(Text,{style:[d,{flex:t===0?1.1:1,paddingHorizontal:8,paddingBottom:2,fontSize:12,lineHeight:16,letterSpacing:.48,textTransform:"uppercase"}],children:e},e))}),t.rows.map(e=>/* @__PURE__ */n.jsx(r.View,{style:[{flexDirection:"row",marginTop:3,borderRadius:6},e.lit===true?{backgroundColor:i.tintYellow}:null],children:[e.test,e.result,e.unit,e.range].map((e,t)=>/* @__PURE__ */n.jsx(Text,{numberOfLines:1,style:[l("mono"),{flex:t===0?1.1:1,paddingHorizontal:8,paddingVertical:5,fontSize:13,lineHeight:18,color:i.text,fontVariant:["tabular-nums"]}],children:e},t))},e.test))]}):null]})}var ux=/heartworm|4dx/i;function HubSamplePeek({name:t,poss:i="her",species:l}){let{look:o}=Ob(),a=_b.peek,[s,d]=e.useState(0),c=kb.length-1,u=kb[s],h=l!==null&&/^(dog|canine)$/i.test(l.trim()),p={pink:o.tintPink,blue:o.tintBlue,yellow:o.tintYellow},g={screenings:"shield",visits:"folder",timeline:"clock"},f=useEverfurTheme().motion.reducedMotion,m=Hy(s,f);/* @__PURE__ */
936
937
  return n.jsxs(r.View,{style:{marginTop:a.top},testID:"everfur-records-sample-peek",children:[
937
938
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:a.headGap},children:[
938
- /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",children:bb.recordsHistory}),
939
- /* @__PURE__ */n.jsx(HubPill,{label:bb.sample,tone:"plain"})]}),
940
- /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{marginTop:a.leadTop},children:bb.peekLead(t)}),
939
+ /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",children:xb.recordsHistory}),
940
+ /* @__PURE__ */n.jsx(HubPill,{label:xb.sample,tone:"plain"})]}),
941
+ /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{marginTop:a.leadTop},children:xb.peekLead(t)}),
941
942
  /* @__PURE__ */n.jsx(HubReveal,{index:0,reduced:f,style:{marginTop:a.labsTop},children:/* @__PURE__ */n.jsxs(HubCard,{testID:"everfur-records-sheet-sample-labs",children:[
942
943
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:6},children:[
943
- /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",style:{flex:1},children:bb.labs}),
944
- /* @__PURE__ */n.jsx(r.View,{style:s===0?{opacity:.35}:null,children:/* @__PURE__ */n.jsx(HubRound,{icon:"chevron",rotate:180,label:bb.previousGroup,disabled:s===0,onPress:()=>d(e=>Math.max(0,e-1)),testID:"everfur-records-sheet-sample-prev"})}),
945
- /* @__PURE__ */n.jsx(r.View,{style:s===c?{opacity:.35}:null,children:/* @__PURE__ */n.jsx(HubRound,{icon:"chevron",label:bb.nextGroup,disabled:s===c,onPress:()=>d(e=>Math.min(c,e+1)),testID:"everfur-records-sheet-sample-next"})})]}),
946
- /* @__PURE__ */n.jsx(r.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,style:{marginTop:a.chipsTop,flexGrow:0},contentContainerStyle:{flexDirection:"row",gap:a.chipsGap},accessibilityLabel:bb.markerGroups,children:wb.map((e,t)=>/* @__PURE__ */n.jsx(HubChip,{label:e.chip,selected:t===s,onPress:()=>d(t),testID:`everfur-records-sheet-sample-group-${e.key}`},e.key))}),
947
- /* @__PURE__ */n.jsxs(r.Animated.View,{style:[{marginTop:a.slideTop,gap:a.slideGap},m],accessibilityLabel:bb.slideOf(u.chip,s+1,wb.length),testID:"everfur-records-sheet-sample-slide",children:[
944
+ /* @__PURE__ */n.jsx(HubText,{variant:"cardTitle",accessibilityRole:"header",style:{flex:1},children:xb.labs}),
945
+ /* @__PURE__ */n.jsx(r.View,{style:s===0?{opacity:.35}:null,children:/* @__PURE__ */n.jsx(HubRound,{icon:"chevron",rotate:180,label:xb.previousGroup,disabled:s===0,onPress:()=>d(e=>Math.max(0,e-1)),testID:"everfur-records-sheet-sample-prev"})}),
946
+ /* @__PURE__ */n.jsx(r.View,{style:s===c?{opacity:.35}:null,children:/* @__PURE__ */n.jsx(HubRound,{icon:"chevron",label:xb.nextGroup,disabled:s===c,onPress:()=>d(e=>Math.min(c,e+1)),testID:"everfur-records-sheet-sample-next"})})]}),
947
+ /* @__PURE__ */n.jsx(r.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,style:{marginTop:a.chipsTop,flexGrow:0},contentContainerStyle:{flexDirection:"row",gap:a.chipsGap},accessibilityLabel:xb.markerGroups,children:kb.map((e,t)=>/* @__PURE__ */n.jsx(HubChip,{label:e.chip,selected:t===s,onPress:()=>d(t),testID:`everfur-records-sheet-sample-group-${e.key}`},e.key))}),
948
+ /* @__PURE__ */n.jsxs(r.Animated.View,{style:[{marginTop:a.slideTop,gap:a.slideGap},m],accessibilityLabel:xb.slideOf(u.chip,s+1,kb.length),testID:"everfur-records-sheet-sample-slide",children:[
948
949
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",style:{fontSize:17,lineHeight:22},children:u.chip}),
949
950
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{marginTop:a.slideLeadTop,marginBottom:a.slideLeadBottom},children:u.lead}),u.markers.map(e=>e.flag!==void 0?/* @__PURE__ */n.jsx(FlaggedMarker,{marker:e,name:t,poss:i},e.name):/* @__PURE__ */n.jsx(r.View,{style:{gap:a.markerGap,padding:a.markerPad,borderRadius:a.markerRadius},children:/* @__PURE__ */n.jsx(MarkerLine,{marker:e})},e.name)),
950
951
  /* @__PURE__ */n.jsx(FromPage,{from:u.from},u.key)]})]})}),
951
- /* @__PURE__ */n.jsx(r.View,{style:{gap:a.moreGap,marginTop:a.moreTop},testID:"everfur-records-sheet-sample-more",children:vb.map((e,t)=>{let i=h?e.rows:e.rows.filter(e=>!sx.test(e.title));return i.length===0?null:/* @__PURE__ */n.jsx(HubReveal,{index:t+1,reduced:f,children:/* @__PURE__ */n.jsxs(r.View,{style:{gap:a.moreInnerGap,padding:a.morePad,borderRadius:a.moreRadius,backgroundColor:p[e.tint]},testID:`everfur-records-sheet-sample-${e.key}`,children:[
952
+ /* @__PURE__ */n.jsx(r.View,{style:{gap:a.moreGap,marginTop:a.moreTop},testID:"everfur-records-sheet-sample-more",children:jb.map((e,t)=>{let i=h?e.rows:e.rows.filter(e=>!ux.test(e.title));return i.length===0?null:/* @__PURE__ */n.jsx(HubReveal,{index:t+1,reduced:f,children:/* @__PURE__ */n.jsxs(r.View,{style:{gap:a.moreInnerGap,padding:a.morePad,borderRadius:a.moreRadius,backgroundColor:p[e.tint]},testID:`everfur-records-sheet-sample-${e.key}`,children:[
952
953
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:a.moreHeadGap},children:[
953
954
  /* @__PURE__ */n.jsx(HubIcon,{name:g[e.key],size:a.moreIcon}),
954
955
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySmBold",accessibilityRole:"header",style:{fontSize:17,lineHeight:22},children:e.title})]}),
955
956
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",children:e.lead}),
956
957
  /* @__PURE__ */n.jsx(r.View,{style:{gap:a.rowsGap},children:i.map(e=>/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:a.rowMinHeight,paddingVertical:a.rowPadY,paddingHorizontal:a.rowPadX,borderRadius:a.rowRadius,backgroundColor:o.white},children:[
957
958
  /* @__PURE__ */n.jsx(HubText,{variant:"bodySm",style:{flexShrink:1},children:e.title}),e.pill!==void 0?/* @__PURE__ */n.jsx(HubPill,{label:e.pill,tone:e.tone??"plain"}):/* @__PURE__ */n.jsx(HubText,{variant:"labelMono",color:o.muted,children:e.text??""})]},e.title))})]})},e.key)})})]})}function HubLegal(){let e=useEverfurTheme().motion.reducedMotion;/* @__PURE__ */
958
- return n.jsx(HubReveal,{index:5,reduced:e,children:/* @__PURE__ */n.jsx(r.View,{style:{marginTop:Rb.screen.legalTop},testID:"everfur-records-hub-legal",children:/* @__PURE__ */n.jsx(HubText,{variant:"fine",style:{textAlign:"center"},accessibilityRole:"text",testID:"records-footnote",children:bb.legal})})})}function dx(e){return e!==null&&typeof e=="object"&&typeof e.uri=="string"?e.uri:e}var cx=3;function ux(){let e=wl(".efh-tile__title","fontSize")*1.25*2;return wl(".efh-tile","paddingTop")*2+20+wl(".efh-tile","gap")*2+e+wl(".efh-tile__foot","minHeight")}function HubSkeleton({testID:e="everfur-records-sheet-loading"}){let t=wl(".efh-due li","paddingLeft"),i=ux(),l=e=>/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",gap:wl(".efh-tiles","gap")},children:[
959
+ return n.jsx(HubReveal,{index:5,reduced:e,children:/* @__PURE__ */n.jsx(r.View,{style:{marginTop:_b.screen.legalTop},testID:"everfur-records-hub-legal",children:/* @__PURE__ */n.jsx(HubText,{variant:"fine",style:{textAlign:"center"},accessibilityRole:"text",testID:"records-footnote",children:xb.legal})})})}function hx(e){return e!==null&&typeof e=="object"&&typeof e.uri=="string"?e.uri:e}var px=3;function gx(){let e=wl(".efh-tile__title","fontSize")*1.25*2;return wl(".efh-tile","paddingTop")*2+20+wl(".efh-tile","gap")*2+e+wl(".efh-tile__foot","minHeight")}function HubSkeleton({testID:e="everfur-records-sheet-loading"}){let t=wl(".efh-due li","paddingLeft"),i=gx(),l=e=>/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",gap:wl(".efh-tiles","gap")},children:[
959
960
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:"48%",height:i,radius:wl(".efh-tile","borderRadius"),style:{flex:1}}),
960
961
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:"48%",height:i,radius:wl(".efh-tile","borderRadius"),style:{flex:1}})]},e);/* @__PURE__ */
961
962
  return n.jsxs(r.View,{accessible:true,accessibilityRole:"progressbar",accessibilityLabel:xn.loading,testID:e,style:{paddingTop:20,gap:16},children:[
@@ -964,7 +965,7 @@ return n.jsxs(r.View,{accessible:true,accessibilityRole:"progressbar",accessibil
964
965
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:160,height:wl(".efh-meta","fontSize"),radius:6})]}),
965
966
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:"100%",height:wl(".efh-stage","height"),radius:0}),
966
967
  /* @__PURE__ */n.jsxs(r.View,{style:{marginHorizontal:16,gap:4},children:[
967
- /* @__PURE__ */n.jsx(SkeletonBlock,{width:140,height:18,radius:6,style:{marginBottom:8}}),Array.from({length:cx},(e,i)=>/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:wl(".efh-due li","gap"),padding:t},children:[
968
+ /* @__PURE__ */n.jsx(SkeletonBlock,{width:140,height:18,radius:6,style:{marginBottom:8}}),Array.from({length:px},(e,i)=>/* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:wl(".efh-due li","gap"),padding:t},children:[
968
969
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:20,height:20,radius:10}),
969
970
  /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,gap:6},children:[
970
971
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:"60%",height:16,radius:6}),
@@ -975,26 +976,26 @@ return n.jsxs(r.View,{accessible:true,accessibilityRole:"progressbar",accessibil
975
976
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:90,height:wl(".efh-title","fontSize"),radius:6}),
976
977
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:"70%",height:wl(".efh-smeta","fontSize"),radius:6})]}),
977
978
  /* @__PURE__ */n.jsx(SkeletonBlock,{width:"100%",height:260,radius:20}),
978
- /* @__PURE__ */n.jsx(SkeletonBlock,{width:"100%",height:120,radius:20})]})}function EverfurRecordsLabDetail({palette:e,fonts:t,...r}){return e===void 0&&t===void 0?/* @__PURE__ */n.jsx(LabDetail,{...r}):/* @__PURE__ */n.jsx(LabKit,{palette:e,fonts:t,children:/* @__PURE__ */n.jsx(LabDetail,{...r})})}function LabKit({palette:e,fonts:t,children:r}){let i=My(e,t),l=Fy(i);/* @__PURE__ */
979
- return n.jsx(qy,{value:l,children:r})}function LabDetail({petRef:petRef,petName:e,markerId:t,renderExtra:r,renderVetNote:i,askIcon:l,onAsk:o,renderAskButton:a,style:s}){let d=useRecordsMarkers(petRef),c=d.markers,u=c===null||c.withheld?null:Um(c,t);if(u===null)return d.status==="loading"?/* @__PURE__ */n.jsx(LabSkeleton,{}):d.status==="error"?/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(d.error),onAction:d.refresh,testID:"everfur-records-lab-error"}):/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:"no_records",testID:"everfur-records-lab-empty"});let h=c?.markers.find(e=>e.markerId===t)??null;/* @__PURE__ */
980
- return n.jsx(LabBody,{model:u,renderExtra:r,renderVetNote:i,askIcon:l,ask:o!==void 0&&h!==null?()=>{let t=qd(e,{canonicalName:h.name,markerId:h.markerId,latestValueText:u.latest,statusText:u.pill,trajectoryText:null,meaningText:h.meaning});o(t.prompt,t.entityRef)}:void 0,renderAskButton:a,style:s})}function LabBody({model:e,renderExtra:t,renderVetNote:i,askIcon:l,ask:o,renderAskButton:a,style:s}){let{s:d,look:c}=Ny(),u=o!==void 0&&a===void 0;/* @__PURE__ */
979
+ /* @__PURE__ */n.jsx(SkeletonBlock,{width:"100%",height:120,radius:20})]})}function EverfurRecordsLabDetail({palette:e,fonts:t,...r}){return e===void 0&&t===void 0?/* @__PURE__ */n.jsx(LabDetail,{...r}):/* @__PURE__ */n.jsx(LabKit,{palette:e,fonts:t,children:/* @__PURE__ */n.jsx(LabDetail,{...r})})}function LabKit({palette:e,fonts:t,children:r}){let i=Wy(e,t),l=Ny(i);/* @__PURE__ */
980
+ return n.jsx(Uy,{value:l,children:r})}function LabDetail({petRef:petRef,petName:e,markerId:t,renderExtra:r,renderVetNote:i,askIcon:l,onAsk:o,renderAskButton:a,style:s}){let d=useRecordsMarkers(petRef),c=d.markers,u=c===null||c.withheld?null:Km(c,t);if(u===null)return d.status==="loading"?/* @__PURE__ */n.jsx(LabSkeleton,{}):d.status==="error"?/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(d.error),onAction:d.refresh,testID:"everfur-records-lab-error"}):/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:"no_records",testID:"everfur-records-lab-empty"});let h=c?.markers.find(e=>e.markerId===t)??null;/* @__PURE__ */
981
+ return n.jsx(LabBody,{model:u,renderExtra:r,renderVetNote:i,askIcon:l,ask:o!==void 0&&h!==null?()=>{let t=qd(e,{canonicalName:h.name,markerId:h.markerId,latestValueText:u.latest,statusText:u.pill,trajectoryText:null,meaningText:h.meaning});o(t.prompt,t.entityRef)}:void 0,renderAskButton:a,style:s})}function LabBody({model:e,renderExtra:t,renderVetNote:i,askIcon:l,ask:o,renderAskButton:a,style:s}){let{s:d,look:c}=Gy(),u=o!==void 0&&a===void 0;/* @__PURE__ */
981
982
  return n.jsxs(r.View,{style:{flex:1},children:[
982
983
  /* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:[d.lab,u?{paddingBottom:wl(".efh-lab","paddingBottom")}:null,s],testID:`everfur-records-lab-${e.markerId}`,children:[
983
984
  /* @__PURE__ */n.jsxs(r.View,{children:[
984
985
  /* @__PURE__ */n.jsx(Text,{style:d.labTitle,accessibilityRole:"header",children:e.name}),e.meta!==null?/* @__PURE__ */n.jsx(Text,{style:d.labMeta,children:e.meta}):null]}),
985
986
  /* @__PURE__ */n.jsxs(SheetCard,{children:[
986
987
  /* @__PURE__ */n.jsxs(r.View,{style:d.cardHead,children:[
987
- /* @__PURE__ */n.jsx(Text,{style:d.cardTitle,accessibilityRole:"header",children:nm.latestReading}),e.pill!==null?/* @__PURE__ */n.jsx(SheetPill,{label:e.pill,tone:e.flagged?"high":"clear"}):null]}),
988
+ /* @__PURE__ */n.jsx(Text,{style:d.cardTitle,accessibilityRole:"header",children:lm.latestReading}),e.pill!==null?/* @__PURE__ */n.jsx(SheetPill,{label:e.pill,tone:e.flagged?"high":"clear"}):null]}),
988
989
  /* @__PURE__ */n.jsxs(r.View,{style:d.latest,children:[
989
990
  /* @__PURE__ */n.jsx(Text,{style:[d.wtValue,{color:e.flagged?c.alert:c.ink}],children:e.latest}),
990
991
  /* @__PURE__ */n.jsx(Text,{style:d.latestSub,children:e.latestSub})]}),
991
992
  /* @__PURE__ */n.jsx(LabChart,{model:e}),e.change!==null?/* @__PURE__ */n.jsxs(Text,{style:d.change,children:[
992
993
  /* @__PURE__ */n.jsx(Text,{style:d.changeLead,children:e.change.lead}),e.change.rest]}):null]}),t!==void 0?/* @__PURE__ */n.jsx(HostRender,{render:()=>t(e.markerId),fallback:null,resetKey:e.markerId}):null,i!==void 0?/* @__PURE__ */n.jsx(HostRender,{render:()=>i(e.markerId),fallback:null,resetKey:`${e.markerId}-note`}):null,e.meaning.length>0?/* @__PURE__ */n.jsxs(SheetCard,{children:[
993
- /* @__PURE__ */n.jsx(Text,{style:[d.cardTitle,d.cardTitleGap],accessibilityRole:"header",children:nm.whatIs(e.name)}),
994
+ /* @__PURE__ */n.jsx(Text,{style:[d.cardTitle,d.cardTitleGap],accessibilityRole:"header",children:lm.whatIs(e.name)}),
994
995
  /* @__PURE__ */n.jsx(r.View,{style:d.ctx,children:e.meaning.map((e,t)=>/* @__PURE__ */n.jsx(Text,{style:d.ctxText,children:e},t))})]}):null,e.groups.map((e,t)=>/* @__PURE__ */n.jsxs(SheetCard,{children:[
995
996
  /* @__PURE__ */n.jsxs(r.View,{style:d.cardHead,children:[
996
- /* @__PURE__ */n.jsx(Text,{style:d.cardTitle,accessibilityRole:"header",children:e.title}),e.allInRange?/* @__PURE__ */n.jsx(SheetPill,{label:nm.inRange,tone:"clear"}):null]}),
997
- /* @__PURE__ */n.jsx(r.View,{style:d.mks,children:e.rows.map(e=>/* @__PURE__ */n.jsx(SheetMarkerRow,{name:e.name,value:e.value,unit:e.unit,range:e.range,at:e.at,pill:e.flag==="above"?nm.high:e.flag==="below"?nm.belowRangePill:null},e.markerId))})]},`${e.title}-${t}`)),o!==void 0&&a!==void 0?/* @__PURE__ */n.jsx(HostRender,{render:()=>a(o,nm.askAboutThis),fallback:null,resetKey:e.markerId}):null]}),u?/* @__PURE__ */n.jsx(RecordsAskPill,{label:nm.askAboutThis,onPress:o,...l!==void 0?{icon:l}:{},testID:"everfur-records-lab-ask"}):null]})}function LabChart({model:e}){let{s:t,look:i}=Ny();if(e.chart.length===0)return null;let l=e.hasRange;/* @__PURE__ */
997
+ /* @__PURE__ */n.jsx(Text,{style:d.cardTitle,accessibilityRole:"header",children:e.title}),e.allInRange?/* @__PURE__ */n.jsx(SheetPill,{label:lm.inRange,tone:"clear"}):null]}),
998
+ /* @__PURE__ */n.jsx(r.View,{style:d.mks,children:e.rows.map(e=>/* @__PURE__ */n.jsx(SheetMarkerRow,{name:e.name,value:e.value,unit:e.unit,range:e.range,at:e.at,pill:e.flag==="above"?lm.high:e.flag==="below"?lm.belowRangePill:null},e.markerId))})]},`${e.title}-${t}`)),o!==void 0&&a!==void 0?/* @__PURE__ */n.jsx(HostRender,{render:()=>a(o,lm.askAboutThis),fallback:null,resetKey:e.markerId}):null]}),u?/* @__PURE__ */n.jsx(RecordsAskPill,{label:lm.askAboutThis,onPress:o,...l!==void 0?{icon:l}:{},testID:"everfur-records-lab-ask"}):null]})}function LabChart({model:e}){let{s:t,look:i}=Gy();if(e.chart.length===0)return null;let l=e.hasRange;/* @__PURE__ */
998
999
  return n.jsxs(r.View,{style:t.chart,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:[
999
1000
  /* @__PURE__ */n.jsxs(r.View,{style:t.labBody,children:[l?/* @__PURE__ */n.jsxs(n.Fragment,{children:[
1000
1001
  /* @__PURE__ */n.jsxs(r.View,{style:t.rail,children:[
@@ -1002,54 +1003,62 @@ return n.jsxs(r.View,{style:t.chart,accessibilityElementsHidden:true,importantFo
1002
1003
  /* @__PURE__ */n.jsx(r.View,{style:{flex:2,backgroundColor:i.go}}),
1003
1004
  /* @__PURE__ */n.jsx(r.View,{style:{flex:1,backgroundColor:i.line}})]}),
1004
1005
  /* @__PURE__ */n.jsxs(r.View,{style:t.legend,children:[
1005
- /* @__PURE__ */n.jsx(Text,{style:[t.range,{top:"6%"}],children:nm.above}),
1006
- /* @__PURE__ */n.jsx(Text,{style:[t.range,{top:"44%"}],children:nm.inRange}),
1007
- /* @__PURE__ */n.jsx(Text,{style:[t.range,{top:"82%"}],children:nm.below})]})]}):null,
1006
+ /* @__PURE__ */n.jsx(Text,{style:[t.range,{top:"6%"}],children:lm.above}),
1007
+ /* @__PURE__ */n.jsx(Text,{style:[t.range,{top:"44%"}],children:lm.inRange}),
1008
+ /* @__PURE__ */n.jsx(Text,{style:[t.range,{top:"82%"}],children:lm.below})]})]}):null,
1008
1009
  /* @__PURE__ */n.jsxs(r.View,{style:[t.plot,{flex:1}],children:[l?/* @__PURE__ */n.jsx(r.View,{style:t.band}):null,e.chart.length>1?/* @__PURE__ */n.jsx(ChartLine,{points:e.chart,color:i.ink}):null,e.chart.map((e,o)=>/* @__PURE__ */n.jsx(r.View,{style:[t.point,{left:`${e.x}%`,top:`${e.y}%`,backgroundColor:e.out?i.alert:l?i.go:i.ink}]},o)),e.chart.map((e,r)=>/* @__PURE__ */n.jsx(Text,{style:[t.pointLabel,{left:`${e.x}%`,top:`${e.y}%`,marginTop:-(10+(t.pointLabel.lineHeight??14))},e.out?{color:i.alert}:null],children:e.label},`v${r}`))]})]}),
1009
1010
  /* @__PURE__ */n.jsx(r.View,{style:[t.xAxis,l?{marginLeft:106}:null],children:e.chart.map((r,i)=>{let l=e.chart.length>1&&i===e.chart.length-1?"end":e.chart.length>1&&i===0?"start":null;/* @__PURE__ */
1010
- return n.jsx(Text,{style:[t.xTick,l==="end"?{right:`${100-r.x}%`,marginLeft:0,marginRight:-4,textAlign:"right"}:l==="start"?{left:`${r.x}%`,marginLeft:-4,textAlign:"left"}:{left:`${r.x}%`}],children:r.tick},i)})})]})}function hx(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function px(e){return e==="female"?"her":e==="male"?"his":null}function gx(e,t){let r=e?.trim()??"",n=r.length>0?r:bn,i=rm(n,t);/* @__PURE__ */
1011
- return Object.freeze({...i,Poss:hx(i.Poss)})}function fx(e){let t=e?.trim()??"";return t.length>0?t:Vo.document.namelessPet}var mx=/* @__PURE__ */Object.freeze({topRiskKicker:e=>`${e.Poss} top risk`,seePlan:e=>`See ${e.poss} Health Plan`,startPlan:e=>`Start ${e.poss} Health Plan`,labsTitle:e=>`${e.Poss} labs`,askRecords:e=>`Ask about ${e.name}'s records…`,askField:e=>`Ask about ${e.name}`,askAdd:"Add a photo or file",askSend:"Send",speakToVet:"Speak to vet",today:"Today"});function bx(e,petRef){return e.filter(e=>e.petRef===petRef&&!isTerminalStatus(e.status)).sort((e,t)=>(sm(t.updatedAt)??0)-(sm(e.updatedAt)??0))[0]??null}function yx(e,petRef){return bx(e.filter(e=>!xx(e)),petRef)}function xx(e){return e.source==="owner_provided"}function wx(e){switch(e){case"received":case"parsing":case"in_review":case"published":return["done","done","now"];case"awaiting_clinic":return["done","now","next"];default:return["now","next","next"]}}var vx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function kx(e,t){let r=sm(e);if(r===null)return null;let n=new Date(r),i=new Date(t),l=n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate(),o=n.getHours(),a=`${o%12===0?12:o%12}:${String(n.getMinutes()).padStart(2,"0")} ${o<12?"AM":"PM"}`;return`${l?mx.today:`${vx[n.getMonth()]??""} ${n.getDate()}`}, ${a}`}var jx=/* @__PURE__ */Object.freeze({undatedPill:""});function Sx(e,petRef){let t=e.filter(e=>e.petRef===petRef);if(t.some(e=>!isTerminalStatus(e.status)))return null;let r=[...t].sort((e,t)=>(sm(t.updatedAt)??0)-(sm(e.updatedAt)??0))[0];if(r===void 0||r.status!=="failed"&&r.status!=="revoked")return null;let n=selectPrimaryLabel(r).trim();return n.length>0?{id:r.id,label:n}:null}function Cx(e){if(e==null)return null;let t=[e.risk?.lead?.trim()??"",e.risk?.body?.trim()??""].filter(e=>e.length>0).join(" ");if(t.length>0)return t;let r=e.title.trim();return r.length>0?r:null}function Rx(e){return e?.sex??null}function Tx(e){if(e==null||e.withheld)return null;let t=e.identity.find(e=>e.label.trim().toLowerCase()==="sex")?.value.trim().toLowerCase()??"";return t.length===0?null:/\bfemale\b/.test(t)||/^(f|fs)$/.test(t)?"female":/\bmale\b/.test(t)||/^(m|mn)$/.test(t)?"male":null}var _x=e=>{let t=(e??[]).filter(e=>e.label.trim().length>0).map((e,t)=>({key:`host-${t}`,name:e.label.trim(),meta:e.detail?.trim()||null}));return t.length>0?t:null},zx=e=>e==null||e.label.trim().length===0?null:{label:e.label,tone:e.tone??"watch"},Ix=(e,petRef)=>e.getRecordDepth(petRef),Dx=e=>!e.available,Hx=(e,petRef)=>e.getTimeline(petRef),Vx=e=>e.isEmpty,Px=/* @__PURE__ */Object.freeze({});function Lx(e){let t=Dl(e?.fonts?.hand);return e?.stage!==void 0?e.stage.handFontFamily??t:e?.handFontFamily!==void 0?e.handFontFamily:t!==null?t:r.Platform.OS==="android"||r.Platform.OS==="web"?"cursive":null}function EverfurRecordsSheet(e){let{style:t,renderPending:i,...l}=wr(e,["onNavigate","onBack","onAsk"]),o=My(l.options?.palette,l.options?.fonts),a=Fy(o),{userRef:userRef}=Xt();/* @__PURE__ */
1012
- return n.jsx(CapabilityGate,{capability:"records",style:t,...i?{renderPending:i}:{},...uo(l.onBack,no),children:/* @__PURE__ */n.jsx(qy,{value:a,children:/* @__PURE__ */n.jsx(HubKitProvider,{handFamily:Lx(l.options),theme:o,children:userRef===null?
1011
+ return n.jsx(Text,{style:[t.xTick,l==="end"?{right:`${100-r.x}%`,marginLeft:0,marginRight:-4,textAlign:"right"}:l==="start"?{left:`${r.x}%`,marginLeft:-4,textAlign:"left"}:{left:`${r.x}%`}],children:r.tick},i)})})]})}var fx=/* @__PURE__ */Symbol.for("everfur.sdk.tabsBar.v1");function mx(){return globalThis[fx]??null}function bx(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function yx(e){return e==="female"?"her":e==="male"?"his":null}function xx(e,t){let r=e?.trim()??"",n=r.length>0?r:bn,i=im(n,t);/* @__PURE__ */
1012
+ return Object.freeze({...i,Poss:bx(i.Poss)})}function wx(e){let t="";return t.length>0?t:Vo.document.namelessPet}var vx=/* @__PURE__ */Object.freeze({topRiskKicker:e=>`${e.Poss} top risk`,seePlan:e=>`See ${e.poss} Health Plan`,startPlan:e=>`Start ${e.poss} Health Plan`,labsTitle:e=>`${e.Poss} labs`,askRecords:e=>`Ask about ${e.name}'s records…`,askField:e=>`Ask about ${e.name}`,askAdd:"Add a photo or file",askSend:"Send",speakToVet:"Speak to vet",today:"Today"});function kx(e,petRef){return e.filter(e=>e.petRef===petRef&&!isTerminalStatus(e.status)).sort((e,t)=>(am(t.updatedAt)??0)-(am(e.updatedAt)??0))[0]??null}function jx(e,petRef){return kx(e.filter(e=>!Sx(e)),petRef)}function Sx(e){return e.source==="owner_provided"}function Cx(e){switch(e){case"received":case"parsing":case"in_review":case"published":return["done","done","now"];case"awaiting_clinic":return["done","now","next"];default:return["now","next","next"]}}var Rx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Tx(e,t){let r=am(e);if(r===null)return null;let n=new Date(r),i=new Date(t),l=n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate(),o=n.getHours(),a=`${o%12===0?12:o%12}:${String(n.getMinutes()).padStart(2,"0")} ${o<12?"AM":"PM"}`;return`${l?vx.today:`${Rx[n.getMonth()]??""} ${n.getDate()}`}, ${a}`}var _x=/* @__PURE__ */Object.freeze({undatedPill:""});function zx(e,petRef){let t=e.filter(e=>e.petRef===petRef);if(t.some(e=>!isTerminalStatus(e.status)))return null;let r=[...t].sort((e,t)=>(am(t.updatedAt)??0)-(am(e.updatedAt)??0))[0];if(r===void 0||r.status!=="failed"&&r.status!=="revoked")return null;let n=selectPrimaryLabel(r).trim();return n.length>0?{id:r.id,label:n}:null}function Ix(e){if(e==null)return null;let t=[e.risk?.lead?.trim()??"",e.risk?.body?.trim()??""].filter(e=>e.length>0).join(" ");if(t.length>0)return t;let r=e.title.trim();return r.length>0?r:null}function Dx(e){return e?.sex??null}function Hx(e){if(e==null||e.withheld)return null;let t=e.identity.find(e=>e.label.trim().toLowerCase()==="sex")?.value.trim().toLowerCase()??"";return t.length===0?null:/\bfemale\b/.test(t)||/^(f|fs)$/.test(t)?"female":/\bmale\b/.test(t)||/^(m|mn)$/.test(t)?"male":null}var Vx=e=>{let t=(e??[]).filter(e=>e.label.trim().length>0).map((e,t)=>({key:`host-${t}`,name:e.label.trim(),meta:e.detail?.trim()||null}));return t.length>0?t:null},Px=e=>e==null||e.label.trim().length===0?null:{label:e.label,tone:e.tone??"watch"},Lx=(e,petRef)=>e.getRecordDepth(petRef),Ox=e=>!e.available,Ex=(e,petRef)=>e.getTimeline(petRef),Ax=e=>e.isEmpty,$x=/* @__PURE__ */Object.freeze({});function Bx(e){let t=Dl(e?.fonts?.hand);return e?.stage!==void 0?e.stage.handFontFamily??t:e?.handFontFamily!==void 0?e.handFontFamily:t!==null?t:r.Platform.OS==="android"||r.Platform.OS==="web"?"cursive":null}function EverfurRecordsSheet(e){let{style:t,renderPending:i,...l}=wr(e,["onNavigate","onBack","onAsk"]),o=Wy(l.options?.palette,l.options?.fonts),a=Ny(o),{userRef:userRef}=Xt();/* @__PURE__ */
1013
+ return n.jsx(CapabilityGate,{capability:"records",style:t,...i?{renderPending:i}:{},...uo(l.onBack,no),children:/* @__PURE__ */n.jsx(Uy,{value:a,children:/* @__PURE__ */n.jsx(HubKitProvider,{handFamily:Bx(l.options),theme:o,children:userRef===null?
1013
1014
  /* @__PURE__ */n.jsxs(r.View,{style:[{flex:1},t],testID:"everfur-records-sheet-session-required",children:[
1014
1015
  /* @__PURE__ */n.jsx(SessionRequiredState,{}),
1015
- /* @__PURE__ */n.jsx(RecordsFootnote,{})]}):/* @__PURE__ */n.jsx(SheetScreen,{...l,style:t})})})})}function SheetScreen({petRef:petRef,petName:t,controller:i,consentVersion:l,consentScope:o,consentText:a,onNavigate:s,onBack:d,onAsk:c,options:u=Px,style:h}){let{s:p,look:g}=Ny(),f=Vb(),m=useEverfurRecords({petRef:petRef,readUploadFeatures:true,...i?{controller:i}:{},...o?{consentScope:o}:{}}),b=useRecordsMarkers(petRef),y=useRecordsDepthRead(petRef,Ix,Dx),x=useRecordsDepthRead(petRef,Hx,Vx),{pets:w}=useEverfurPets(),v=w.find(e=>e.petRef===petRef)??null,k=e.useMemo(()=>u.topRiskLine===void 0?u.presentation??null:{...u.presentation,recordsTopRiskLine:u.topRiskLine},[u.presentation,u.topRiskLine]),j=useEverfurPresentation(k),S=e.useMemo(()=>Py(u.stage),[u.stage]);Au(l,a);let C=e.useMemo(()=>dc(l,m.consent),[l,m.consent]),R=e.useMemo(()=>Vh(m,l),[m,l]),T=useCapability("recordsClinic"),_=T.enabled||T.isPending,[z,I]=e.useState(null),D=u.active??true,[H,V]=e.useState(()=>r.AppState.currentState!=="background");e.useEffect(()=>{let e=r.AppState.addEventListener("change",e=>V(e==="active"));return()=>e.remove()},[]);let P=em(u.nowMs,D&&H),L=useEverfurTheme().motion.reducedMotion,E=mb(S===void 0&&u.renderStage===void 0?petRef:null,{reducedMotion:L,isFocused:D&&H}),O=u.pronoun??px(u.sex)??px(Tx(m.record))??null,A=O===null&&m.status!=="loading",$=useCapability("healthPlan"),B=useHealthPlanPage({petRef:petRef,enabled:$.enabled&&(j.recordsTopRiskLine||A)}),F=B.page?.pet??null,M=O??px(Rx(F)),q=t?.trim()||v?.name?.trim()||F?.name?.trim()||"",N=u.species??v?.species??F?.species??null,W=u.weightUnit??"lb",U=gx(q,M),G=v?.breed??F?.breed??null,K=e.useMemo(()=>Bm({words:U,record:m.record,depth:y.value,markers:b.markers,timeline:x.value,requests:m.requests,breed:G,petWeightKg:v?.weightKg??F?.weightKg??null,nowMs:P}),[q,M,m.record,m.requests,y.value,b.markers,x.value,v,F,P]),Y=e.useMemo(()=>Jb(m.record,x.value,W),[m.record,x.value,W]),X=e.useRef(null),Q=e.useRef(0),J=e.useRef(0),Z=Ub(G,v?.ageYears??null,Y),ee=Sx(m.requests,petRef),te=j.recordsTopRiskLine?Cx(B.page?.page?.focus):null,re=[b.markers?.disclaimer,m.record?.disclaimer,x.value?.disclaimer].map(e=>e?.trim()??"").find(e=>e.length>0)??"";e.useEffect(()=>{if(z===null||!D)return;let e=r.BackHandler.addEventListener("hardwareBackPress",()=>(I(null),true));return()=>{e.remove()}},[z,D]);let ne=e=>{u.onOpenMarker!==void 0?u.onOpenMarker(e):I(e)},ie=bx(m.requests,petRef),le=s!==void 0,oe={request:()=>{if(u.onRequestFromClinic!==void 0){let e=u.onRequestFromClinic({petRef:petRef});e!==void 0&&typeof e.then=="function"&&e.then(()=>m.refresh(),()=>m.refresh()).then(void 0,()=>{})}else s?.({name:"clinicPicker"})},upload:()=>s?.({name:"upload"}),record:()=>s?.({name:"record"})},ae=K.history.length>0?()=>X.current?.scrollTo({y:Math.max(0,Q.current+J.current),animated:!L}):le?oe.record:void 0,se=le?e=>s?.({name:"request",requestId:e}):void 0,de=()=>Promise.all([m.refresh(),b.refresh(),y.refresh(),x.refresh()].map(e=>Promise.resolve(e).then(void 0,()=>{}))).then(()=>{}),ce=Tp(de,"everfur-records-sheet-refresh"),ue=e.useMemo(()=>m.requests.filter(e=>e.petRef===petRef),[m.requests,petRef]),he=e.useMemo(()=>nb(q,ue),[q,ue]),pe=acceptsPhotos(m.uploadContentTypes)?nm.uploadDetail:Gm.uploadFormatHint,ge=rb(y.value,m.record!==null?xm(m.record).observedMs:null),fe=Ox(),me=yx(m.requests,petRef)?.clinicName?.trim()||null,be=me!==null?fe.show:oe.request,ye=me!==null&&fe.on?/* @__PURE__ */n.jsx(RequestedNote,{clinic:me},fe.shown):null;if(z!==null)/* @__PURE__ */
1016
- return n.jsx(r.View,{style:[{flex:1,backgroundColor:g.ground},h],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
1017
- /* @__PURE__ */n.jsx(RecordsPushHeader,{title:mx.labsTitle(U),onBack:()=>I(null),look:g,testID:"everfur-records-lab-header"}),
1018
- /* @__PURE__ */n.jsx(EverfurRecordsLabDetail,{petRef:petRef,markerId:z,...q.length>0?{petName:q}:{},...c?{onAsk:c}:{}}),
1019
- /* @__PURE__ */n.jsx(RecordsFootnote,{})]})});let xe,we="full",ve=true,ke=ee!==null?/* @__PURE__ */n.jsx(FailedLine,{label:ee.label,onPress:le?()=>s?.({name:"request",requestId:ee.id}):void 0}):null,je=u.renderTopSlot!==void 0?/* @__PURE__ */n.jsx(r.View,{testID:"everfur-records-sheet-top-slot",children:/* @__PURE__ */n.jsx(HostRender,{render:()=>u.renderTopSlot?.({clearResultsFilter:j.recordsClearResultsFilter})??null,fallback:null,resetKey:petRef})}):null,Se=te!==null?/* @__PURE__ */n.jsx(TopRisk,{words:U,text:te,onOpenPlan:u.onOpenPlan,start:u.topRiskPlanAction==="start"}):null,Ce=(...e)=>{let t=e.filter(e=>e!=null&&e!==false);return t.length===0?null:/* @__PURE__ */n.jsx(r.View,{style:{paddingTop:wl(".rec","paddingTop"),paddingHorizontal:wl(".rec","paddingLeft"),gap:wl(".rec-dna","marginTop")},testID:"everfur-records-sheet-paper",children:t})},Re=e=>[p.sheet,{backgroundColor:f.look.bg,gap:Rb.screen.gap},e?{marginTop:wl(".efh-sheet","marginTop")}:{borderTopLeftRadius:0,borderTopRightRadius:0}],Te=c,_e=Te!==void 0&&u.askBar!==false?/* @__PURE__ */n.jsx(RecordsAskBar,{placeholder:mx.askRecords(U),label:mx.askField(U),sendLabel:mx.askSend,addLabel:mx.askAdd,...le?{onAdd:oe.upload}:{},onSend:e=>Te(e,{type:"records",id:petRef}),ground:g.paper,ink:g.dark?g.text:fl.topInk,muted:g.dark?g.muted:fl.embInk3,field:g.card}):null,ze=u.renderUpcomingCareAction===void 0?u.onSpeakToVet:void 0,Ie=re.length>0&&!ql(re)?/* @__PURE__ */n.jsx(HubDisclaimer,{text:re}):null,De=u.vitalsLine!==void 0?u.vitalsLine?.trim()||null:ge!==null?Gm.vitalsFrom(ge.vet,ge.date).trim():null,He=e=>/* @__PURE__ */n.jsx(HubHero,{headPill:e?null:zx(u.headPill),fromLine:e?null:De,name:q.length>0?U.Name:fx(q),meta:Z,stage:S,art:E,handFontFamily:Lx(u),say:e,vitals:e?[]:K.vitals,vitalsName:U.name,renderStage:u.renderStage,exam:e?null:ge,onOpenExam:le?oe.record:void 0});if(m.status==="loading"&&m.record===null)xe=/* @__PURE__ */n.jsx(HubSkeleton,{}),we="loading",ve=false;else if(m.status==="error"){let e=cc(m,C);uc(e)?(we="consent",xe=/* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:{flexGrow:1},refreshControl:ce,children:[Ce(Se,je),
1020
- /* @__PURE__ */n.jsxs(r.View,{style:Re(Se!==null||je!==null),testID:"everfur-records-sheet-content",children:[Hh(m,R,C,a,true),le?/* @__PURE__ */n.jsx(HubAddRecords,{words:U,sources:[],canRequest:_,onRequest:be,onUpload:oe.upload,note:ye,uploadHint:pe}):null,
1021
- /* @__PURE__ */n.jsx(HubLegal,{})]})]})):e.kind==="error"||e.kind==="pet_not_found"?(we="error",ve=false,xe=/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(e.error),message:e.error.displayMessage,onAction:e.error.retryable?de:void 0,testID:"everfur-records-sheet-error"})):(we=e.kind,ve=false,xe=Hh(m,R,C,a))}else if(K.state!=="full")we=ie===null?"none":xx(ie)?"processing":"onTheWay",xe=/* @__PURE__ */n.jsx(r.ScrollView,{contentContainerStyle:{flexGrow:1},refreshControl:ce,children:/* @__PURE__ */n.jsxs(r.View,{testID:"everfur-records-sheet-content",style:[{flexGrow:1},u.style],children:[Ce(Se,je,ke),
1022
- /* @__PURE__ */n.jsxs(r.View,{style:Re(Se!==null||je!==null||ke!==null),children:[He(true),we==="onTheWay"&&ie!==null?/* @__PURE__ */n.jsx(HubOnTheWay,{words:U,request:ie,steps:wx(ie.status),sentWhen:kx(ie.createdAt,P),canAct:le,canRequest:_,onAnotherClinic:oe.request,onUpload:oe.upload,onOpenRequest:se!==void 0?()=>se(ie.id):void 0}):we==="processing"&&ie!==null?/* @__PURE__ */n.jsx(HubInProgress,{words:U,request:ie,onOpenRequest:se!==void 0?()=>se(ie.id):void 0}):/* @__PURE__ */n.jsx(HubPrompt,{title:u.noVet===true?bb.noVetTitle(U):bb.addRecords(U.name),canAct:le,canRequest:_,onRequest:be,onUpload:oe.upload,note:ye}),Y!==null?/* @__PURE__ */n.jsx(HubWeightCard,{weight:Y,name:U.name,chart:u.weightChart??"phone"}):null,
1023
- /* @__PURE__ */n.jsx(HubSamplePeek,{name:U.name,poss:U.poss,species:N}),Ie,
1024
- /* @__PURE__ */n.jsx(HubLegal,{})]})]})});else{let e=Xb(m.record?.forwardLooking??[],P),t=new Map((m.record?.forwardLooking??[]).map(e=>[e.careItemKey?.trim()||e.title,e])),i=Qb(m.record,b.markers,y.value,x.value),l=K.featuredMarkerId,o=i.screeningsPill?.markerId??null,a=b.status==="error"||x.status==="error",s=(b.status==="error"?b.error:null)??(x.status==="error"?x.error:null);xe=/* @__PURE__ */n.jsx(r.ScrollView,{ref:X,contentContainerStyle:{flexGrow:1},refreshControl:ce,children:/* @__PURE__ */n.jsxs(r.View,{testID:"everfur-records-sheet-content",style:[{flexGrow:1},u.style],children:[Ce(Se,je,ke),
1025
- /* @__PURE__ */n.jsxs(r.View,{style:Re(Se!==null||je!==null||ke!==null),onLayout:e=>{Q.current=e.nativeEvent.layout.y},children:[He(false),a?
1026
- /* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(s),onAction:de,testID:"everfur-records-sheet-partial-error"}):null,e.length>0?/* @__PURE__ */n.jsx(HubUpcoming,{rows:e,items:t,onViewAll:ae,renderAction:u.renderUpcomingCareAction,...ze!==void 0?{actionLabel:mx.speakToVet,onAction:ze}:{}}):/* @__PURE__ */n.jsx(HubUpcomingEmpty,{name:U.name}),
1027
- /* @__PURE__ */n.jsx(HubTilesSection,{tiles:i,labsUnknown:b.status==="loading"||b.status==="error",onOpenLabs:l!==null?()=>ne(l):le?oe.record:void 0,onOpenScreenings:u.onOpenScreenings??(o!==null?()=>ne(o):le?oe.record:void 0),onOpenVisits:le?oe.record:void 0,onOpenTimeline:ae,...u.screeningsPills!==void 0?{screeningsPills:u.screeningsPills.map(zx).filter(e=>e!==null)}:{}}),
1028
- /* @__PURE__ */n.jsx(HubWeightCard,{weight:Y,name:U.name,chart:u.weightChart??"phone",extras:{status:zx(u.weightStatus),prediction:u.weightPrediction??null,...u.weightKey!==void 0?{key:u.weightKey}:{}}}),
1029
- /* @__PURE__ */n.jsx(HubMedications,{medications:K.medications}),K.history.length>0||(u.historyItems?.length??0)>0?/* @__PURE__ */n.jsx(r.View,{onLayout:e=>{J.current=e.nativeEvent.layout.y},testID:"everfur-records-sheet-history-anchor",children:/* @__PURE__ */n.jsx(HubHistory,{words:U,history:K.history,onOpenMarker:ne,...u.historySources!==void 0?{sourceKey:u.historySources}:{},...u.historyItems!==void 0?{extra:u.historyItems}:{}})}):null,le?/* @__PURE__ */n.jsx(HubAddRecords,{words:U,sources:_x(u.onFileRows)??py(m.record,y.value),canRequest:_,onRequest:be,onUpload:oe.upload,note:ye,inFlight:he,onOpenRequest:se,uploadHint:pe}):null,Ie,
1016
+ /* @__PURE__ */n.jsx(RecordsFootnote,{})]}):/* @__PURE__ */n.jsx(SheetScreen,{...l,style:t})})})})}function SheetScreen({petRef:petRef,petName:t,controller:i,consentVersion:l,consentScope:o,consentText:a,onNavigate:s,onBack:d,onAsk:c,onOpenUrl:u,onCopy:h,options:p=$x,style:g}){let{s:f,look:m}=Gy(),b=Ob(),y=useEverfurRecords({petRef:petRef,readUploadFeatures:true,...i?{controller:i}:{},...o?{consentScope:o}:{}}),x=useRecordsMarkers(petRef),w=useRecordsDepthRead(petRef,Lx,Ox),v=useRecordsDepthRead(petRef,Ex,Ax),{pets:k}=useEverfurPets(),j=k.find(e=>e.petRef===petRef)??null,S=e.useMemo(()=>p.topRiskLine===void 0?p.presentation??null:{...p.presentation,recordsTopRiskLine:p.topRiskLine},[p.presentation,p.topRiskLine]),C=useEverfurPresentation(S),R=mx()?.records??null,T=R!==null&&(p.layout??(C.shellHeader==="tabs_bar"?"tabs_bar":"hub"))==="tabs_bar",_=e.useMemo(()=>Ey(p.stage),[p.stage]);Au(l,a);let z=e.useMemo(()=>dc(l,y.consent),[l,y.consent]),I=e.useMemo(()=>Vh(y,l),[y,l]),D=useCapability("recordsClinic"),H=D.enabled||D.isPending,[V,P]=e.useState(null),[L,O]=e.useState(false),[E,A]=e.useState(false),$=p.active??true,[B,F]=e.useState(()=>r.AppState.currentState!=="background");e.useEffect(()=>{let e=r.AppState.addEventListener("change",e=>F(e==="active"));return()=>e.remove()},[]);let M=rm(p.nowMs,$&&B),q=useEverfurTheme().motion.reducedMotion,N=yb(_===void 0&&p.renderStage===void 0?petRef:null,{reducedMotion:q,isFocused:$&&B}),W=p.pronoun??yx(p.sex)??yx(Hx(y.record))??null,U=W===null&&y.status!=="loading",G=useCapability("healthPlan"),K=useHealthPlanPage({petRef:petRef,enabled:G.enabled&&(C.recordsTopRiskLine||U)}),Y=K.page?.pet??null,X=W??yx(Dx(Y)),Q=t?.trim()||j?.name?.trim()||Y?.name?.trim()||"",J=p.species??j?.species??Y?.species??null,Z=p.weightUnit??"lb",ee=xx(Q,X),te=Q.length>0?ee.Name:wx(),re=j?.breed??Y?.breed??null,ne=e.useMemo(()=>Mm({words:ee,record:y.record,depth:w.value,markers:x.markers,timeline:v.value,requests:y.requests,breed:re,petWeightKg:j?.weightKg??Y?.weightKg??null,nowMs:M}),[Q,X,y.record,y.requests,w.value,x.markers,v.value,j,Y,M]),ie=e.useMemo(()=>ty(y.record,v.value,Z),[y.record,v.value,Z]),le=e.useRef(null),oe=e.useRef(0),ae=e.useRef(0),se=Yb(re,j?.ageYears??null,ie),de=zx(y.requests,petRef),ce=C.recordsTopRiskLine?Ix(K.page?.page?.focus):null,ue=[x.markers?.disclaimer,y.record?.disclaimer,v.value?.disclaimer].map(e=>e?.trim()??"").find(e=>e.length>0)??"";e.useEffect(()=>{if(V===null&&!L||!$)return;let e=r.BackHandler.addEventListener("hardwareBackPress",()=>(V!==null?P(null):O(false),true));return()=>{e.remove()}},[V,L,$]);let he=e=>{p.onOpenMarker!==void 0?p.onOpenMarker(e):P(e)},pe=kx(y.requests,petRef),ge=s!==void 0,fe={request:()=>{if(p.onRequestFromClinic!==void 0){let e=p.onRequestFromClinic({petRef:petRef});e!==void 0&&typeof e.then=="function"&&e.then(()=>y.refresh(),()=>y.refresh()).then(void 0,()=>{})}else s?.({name:"clinicPicker"})},upload:()=>s?.({name:"upload"}),record:()=>s?.({name:"record"})},me=ne.history.length>0?()=>le.current?.scrollTo({y:Math.max(0,oe.current+ae.current),animated:!q}):ge?fe.record:void 0,be=ge?e=>s?.({name:"request",requestId:e}):void 0,ye=()=>Promise.all([y.refresh(),x.refresh(),w.refresh(),v.refresh()].map(e=>Promise.resolve(e).then(void 0,()=>{}))).then(()=>{}),xe=Tp(ye,"everfur-records-sheet-refresh"),we=e.useMemo(()=>y.requests.filter(e=>e.petRef===petRef),[y.requests,petRef]),ve=e.useMemo(()=>lb(Q,we),[Q,we]),ke=acceptsPhotos(y.uploadContentTypes)?lm.uploadDetail:Ym.uploadFormatHint,je=ib(w.value,y.record!==null?vm(y.record).observedMs:null),Se=Mx(),Ce=jx(y.requests,petRef)?.clinicName?.trim()||null,Re=Ce!==null?Se.show:fe.request,Te=Ce!==null&&Se.on?/* @__PURE__ */n.jsx(RequestedNote,{clinic:Ce},Se.shown):null;if(T&&R!==null&&(V!==null||L))/* @__PURE__ */
1017
+ return n.jsx(r.View,{style:[{flex:1},g],children:/* @__PURE__ */n.jsx(SdkTabletColumn,{children:/* @__PURE__ */n.jsx(R.TabsDeepScreen,{petRef:petRef,petName:Q,markerId:V,title:vx.labsTitle(ee),onBack:()=>V!==null?P(null):O(false),onOpenMarker:he,shellPush:$?p.shellPush:void 0,vetNote:p.labVetNote,foot:/* @__PURE__ */n.jsx(RecordsFootnote,{})})})});if(V!==null)/* @__PURE__ */
1018
+ return n.jsx(r.View,{style:[{flex:1,backgroundColor:m.ground},g],children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[
1019
+ /* @__PURE__ */n.jsx(RecordsPushHeader,{title:vx.labsTitle(ee),onBack:()=>P(null),look:m,testID:"everfur-records-lab-header"}),
1020
+ /* @__PURE__ */n.jsx(EverfurRecordsLabDetail,{petRef:petRef,markerId:V,...Q.length>0?{petName:Q}:{},...c?{onAsk:c}:{}}),
1021
+ /* @__PURE__ */n.jsx(RecordsFootnote,{})]})});let _e,ze="full",Ie=true,De=de!==null?/* @__PURE__ */n.jsx(FailedLine,{label:de.label,onPress:ge?()=>s?.({name:"request",requestId:de.id}):void 0}):null,He=p.renderTopSlot!==void 0?/* @__PURE__ */n.jsx(r.View,{testID:"everfur-records-sheet-top-slot",children:/* @__PURE__ */n.jsx(HostRender,{render:()=>p.renderTopSlot?.({clearResultsFilter:C.recordsClearResultsFilter})??null,fallback:null,resetKey:petRef})}):null,Ve=ce!==null?/* @__PURE__ */n.jsx(TopRisk,{words:ee,text:ce,onOpenPlan:p.onOpenPlan,start:p.topRiskPlanAction==="start"}):null,Pe=(...e)=>{let t=e.filter(e=>e!=null&&e!==false);return t.length===0?null:/* @__PURE__ */n.jsx(r.View,{style:{paddingTop:wl(".rec","paddingTop"),paddingHorizontal:wl(".rec","paddingLeft"),gap:wl(".rec-dna","marginTop")},testID:"everfur-records-sheet-paper",children:t})},Le=e=>[f.sheet,{backgroundColor:b.look.bg,gap:_b.screen.gap},e?{marginTop:wl(".efh-sheet","marginTop")}:{borderTopLeftRadius:0,borderTopRightRadius:0}],Oe=c,Ee=Oe!==void 0&&p.askBar!==false?/* @__PURE__ */n.jsx(RecordsAskBar,{placeholder:vx.askRecords(ee),label:vx.askField(ee),sendLabel:vx.askSend,addLabel:vx.askAdd,...ge?{onAdd:fe.upload}:{},onSend:e=>Oe(e,{type:"records",id:petRef}),ground:m.paper,ink:m.dark?m.text:fl.topInk,muted:m.dark?m.muted:fl.embInk3,field:m.card}):null,Ae=p.renderUpcomingCareAction===void 0?p.onSpeakToVet:void 0,$e=ue.length>0&&!ql(ue)?/* @__PURE__ */n.jsx(HubDisclaimer,{text:ue}):null,Be=p.vitalsLine!==void 0?p.vitalsLine?.trim()||null:je!==null?Ym.vitalsFrom(je.vet,je.date).trim():null,Fe=e=>/* @__PURE__ */n.jsx(HubHero,{headPill:e?null:Px(p.headPill),fromLine:e?null:Be,name:te,meta:se,stage:_,art:N,handFontFamily:Bx(p),say:e,vitals:e?[]:ne.vitals,vitalsName:ee.name,renderStage:p.renderStage,exam:e?null:je,onOpenExam:ge?fe.record:void 0});if(y.status==="loading"&&y.record===null)_e=/* @__PURE__ */n.jsx(HubSkeleton,{}),ze="loading",Ie=false;else if(y.status==="error"){let e=cc(y,z);uc(e)?(ze="consent",_e=/* @__PURE__ */n.jsxs(r.ScrollView,{contentContainerStyle:{flexGrow:1},refreshControl:xe,children:[Pe(Ve,He),
1022
+ /* @__PURE__ */n.jsxs(r.View,{style:Le(Ve!==null||He!==null),testID:"everfur-records-sheet-content",children:[Hh(y,I,z,a,true),ge?/* @__PURE__ */n.jsx(HubAddRecords,{words:ee,sources:[],canRequest:H,onRequest:Re,onUpload:fe.upload,note:Te,uploadHint:ke}):null,
1023
+ /* @__PURE__ */n.jsx(HubLegal,{})]})]})):e.kind==="error"||e.kind==="pet_not_found"?(ze="error",Ie=false,_e=/* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(e.error),message:e.error.displayMessage,onAction:e.error.retryable?ye:void 0,testID:"everfur-records-sheet-error"})):(ze=e.kind,Ie=false,_e=Hh(y,I,z,a))}else if(ne.state!=="full")ze=pe===null?"none":Sx(pe)?"processing":"onTheWay",_e=/* @__PURE__ */n.jsx(r.ScrollView,{contentContainerStyle:{flexGrow:1},refreshControl:xe,children:/* @__PURE__ */n.jsxs(r.View,{testID:"everfur-records-sheet-content",style:[{flexGrow:1},p.style],children:[Pe(Ve,He,De),
1024
+ /* @__PURE__ */n.jsxs(r.View,{style:Le(Ve!==null||He!==null||De!==null),children:[Fe(true),ze==="onTheWay"&&pe!==null?/* @__PURE__ */n.jsx(HubOnTheWay,{words:ee,request:pe,steps:Cx(pe.status),sentWhen:Tx(pe.createdAt,M),canAct:ge,canRequest:H,onAnotherClinic:fe.request,onUpload:fe.upload,onOpenRequest:be!==void 0?()=>be(pe.id):void 0}):ze==="processing"&&pe!==null?/* @__PURE__ */n.jsx(HubInProgress,{words:ee,request:pe,onOpenRequest:be!==void 0?()=>be(pe.id):void 0}):/* @__PURE__ */n.jsx(HubPrompt,{title:p.noVet===true?xb.noVetTitle(ee):xb.addRecords(ee.name),canAct:ge,canRequest:H,onRequest:Re,onUpload:fe.upload,note:Te}),ie!==null?/* @__PURE__ */n.jsx(HubWeightCard,{weight:ie,name:ee.name,chart:p.weightChart??"phone"}):null,
1025
+ /* @__PURE__ */n.jsx(HubSamplePeek,{name:ee.name,poss:ee.poss,species:J}),$e,
1026
+ /* @__PURE__ */n.jsx(HubLegal,{})]})]})});else{let e=Zb(y.record?.forwardLooking??[],M),i=new Map((y.record?.forwardLooking??[]).map(e=>[e.careItemKey?.trim()||e.title,e])),l=ey(y.record,x.markers,w.value,v.value),o=ne.featuredMarkerId,a=l.screeningsPill?.markerId??null,s=x.status==="error"||v.status==="error",d=(x.status==="error"?x.error:null)??(v.status==="error"?v.error:null),c=s?
1027
+ /* @__PURE__ */n.jsx(RecordsEmptyState,{variant:_n(d),onAction:ye,testID:"everfur-records-sheet-partial-error"}):null,u=ne.history.length>0||(p.historyItems?.length??0)>0?/* @__PURE__ */n.jsx(r.View,{onLayout:e=>{ae.current=e.nativeEvent.layout.y},testID:"everfur-records-sheet-history-anchor",children:/* @__PURE__ */n.jsx(HubHistory,{words:ee,history:ne.history,onOpenMarker:he,...p.historySources!==void 0?{sourceKey:p.historySources}:{},...p.historyItems!==void 0?{extra:p.historyItems}:{}})}):null,h=ge?/* @__PURE__ */n.jsx(HubAddRecords,{words:ee,sources:Vx(p.onFileRows)??my(y.record,w.value),canRequest:H,onRequest:Re,onUpload:fe.upload,note:Te,inFlight:ve,onOpenRequest:be,uploadHint:ke}):null,g=y.record!==null?vm(y.record).observedMs:null,f=p.renderUpcomingCareAction;_e=T&&R!==null?/* @__PURE__ */n.jsx(r.ScrollView,{ref:le,contentContainerStyle:{flexGrow:1},refreshControl:xe,children:/* @__PURE__ */n.jsxs(r.View,{testID:"everfur-records-sheet-content",style:[{flexGrow:1,backgroundColor:m.card},p.style],children:[Pe(He,De),
1028
+ /* @__PURE__ */n.jsxs(r.View,{style:[Le(He!==null||De!==null),{borderTopLeftRadius:0,borderTopRightRadius:0,backgroundColor:m.card}],onLayout:e=>{oe.current=e.nativeEvent.layout.y},testID:"everfur-records-sheet-tabs",children:[
1029
+ /* @__PURE__ */n.jsx(R.TabsPetHead,{petRef:petRef,name:te,meta:se,pill:Px(p.headPill),photoUrl:p.petPhotoUrl??null,onShare:ge?()=>A(true):void 0,shareLabel:Fo.openA11yFor(t)}),c,
1030
+ /* @__PURE__ */n.jsx(R.TabsVitals,{title:p.vitalsLine!==void 0?p.vitalsLine?.trim()||null:g!==null?R.vitalsFrom(ee.poss,sm(g)):null,vitals:ne.vitals}),
1031
+ /* @__PURE__ */n.jsx(R.TabsTiles,{tiles:l,labsUnknown:x.status==="loading"||x.status==="error",screeningsWords:p.screeningsPills?.[0]?.label??null,onOpenLabs:(x.markers?.markers.length??0)>0?()=>O(true):ge?fe.record:void 0,onOpenScreenings:p.onOpenScreenings??(a!==null?()=>he(a):ge?fe.record:void 0),onOpenVisits:ge?fe.record:void 0,onOpenTimeline:me}),
1032
+ /* @__PURE__ */n.jsx(R.TabsUpcoming,{rows:e,emptyText:xb.nothingDue(ee.name),onViewAll:me,renderAction:f!==void 0?e=>{let t=i.get(e.key);return e.tone==="overdue"&&t!==void 0?/* @__PURE__ */n.jsx(HostRender,{render:()=>f(t),fallback:null,resetKey:t}):null}:void 0}),
1033
+ /* @__PURE__ */n.jsx(HubMedications,{medications:ne.medications}),u,h,$e,
1034
+ /* @__PURE__ */n.jsx(HubLegal,{})]})]})}):/* @__PURE__ */n.jsx(r.ScrollView,{ref:le,contentContainerStyle:{flexGrow:1},refreshControl:xe,children:/* @__PURE__ */n.jsxs(r.View,{testID:"everfur-records-sheet-content",style:[{flexGrow:1},p.style],children:[Pe(Ve,He,De),
1035
+ /* @__PURE__ */n.jsxs(r.View,{style:Le(Ve!==null||He!==null||De!==null),onLayout:e=>{oe.current=e.nativeEvent.layout.y},children:[Fe(false),c,e.length>0?/* @__PURE__ */n.jsx(HubUpcoming,{rows:e,items:i,onViewAll:me,renderAction:p.renderUpcomingCareAction,...Ae!==void 0?{actionLabel:vx.speakToVet,onAction:Ae}:{}}):/* @__PURE__ */n.jsx(HubUpcomingEmpty,{name:ee.name}),
1036
+ /* @__PURE__ */n.jsx(HubTilesSection,{tiles:l,labsUnknown:x.status==="loading"||x.status==="error",onOpenLabs:o!==null?()=>he(o):ge?fe.record:void 0,onOpenScreenings:p.onOpenScreenings??(a!==null?()=>he(a):ge?fe.record:void 0),onOpenVisits:ge?fe.record:void 0,onOpenTimeline:me,...p.screeningsPills!==void 0?{screeningsPills:p.screeningsPills.map(Px).filter(e=>e!==null)}:{}}),
1037
+ /* @__PURE__ */n.jsx(HubWeightCard,{weight:ie,name:ee.name,chart:p.weightChart??"phone",extras:{status:Px(p.weightStatus),prediction:p.weightPrediction??null,...p.weightKey!==void 0?{key:p.weightKey}:{}}}),
1038
+ /* @__PURE__ */n.jsx(HubMedications,{medications:ne.medications}),u,h,$e,
1030
1039
  /* @__PURE__ */n.jsx(HubLegal,{})]})]})})}/* @__PURE__ */
1031
- return n.jsx(r.View,{style:[{flex:1,backgroundColor:ve?g.paper:g.ground},h],testID:"everfur-records-sheet",children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[d!==void 0?/* @__PURE__ */n.jsx(Pl,{value:"legacy",children:/* @__PURE__ */n.jsx(ScreenHeader,{title:xn.titleNative(t),onBack:d,testID:"everfur-records-sheet-header"})}):null,
1032
- /* @__PURE__ */n.jsx(r.View,{style:{flex:1},testID:`everfur-records-sheet-state-${we}`,children:xe}),ve?_e:/* @__PURE__ */n.jsx(RecordsFootnote,{})]})})}var Ex=2600;function Ox(){let[t,r]=e.useState(false),[n,i]=e.useState(0),l=e.useRef(null);e.useEffect(()=>()=>{l.current!==null&&clearTimeout(l.current)},[]);let o=e.useCallback(()=>{l.current!==null&&clearTimeout(l.current),r(true),i(e=>e+1),l.current=setTimeout(()=>{l.current=null,r(false)},Ex)},[]);return{on:t,shown:n,show:o}}function RequestedNote({clinic:e}){let{look:t}=Vb();/* @__PURE__ */
1033
- return n.jsx(r.View,{accessibilityLiveRegion:"polite",style:{paddingVertical:Rb.upcoming.rowPadY,paddingHorizontal:Rb.card.pad,borderRadius:Rb.card.radius,backgroundColor:t.fill},testID:"everfur-records-sheet-requested-note",children:/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",color:t.onFill,children:nm.requestedFrom(e)})})}function HubDisclaimer({text:e}){let{type:t}=Vb();/* @__PURE__ */
1034
- return n.jsx(Text,{style:[t("fine"),{textAlign:"center",marginTop:Rb.screen.legalTop}],testID:"everfur-records-sheet-disclaimer",children:e})}function TopRisk({words:e,text:t,onOpenPlan:i,start:l}){let{s:o,look:a}=Ny(),s=l?mx.startPlan(e):mx.seePlan(e);/* @__PURE__ */
1040
+ return n.jsx(r.View,{style:[{flex:1,backgroundColor:Ie?m.paper:m.ground},g],testID:"everfur-records-sheet",children:/* @__PURE__ */n.jsxs(SdkTabletColumn,{children:[d!==void 0?/* @__PURE__ */n.jsx(Pl,{value:"legacy",children:/* @__PURE__ */n.jsx(ScreenHeader,{title:xn.titleNative(t),onBack:d,testID:"everfur-records-sheet-header"})}):null,
1041
+ /* @__PURE__ */n.jsx(r.View,{style:{flex:1},testID:`everfur-records-sheet-state-${ze}`,children:_e}),Ie?Ee:/* @__PURE__ */n.jsx(RecordsFootnote,{}),E?/* @__PURE__ */n.jsx(ShareSheet,{petRef:petRef,petName:t,onClose:()=>A(false),onNavigate:s,...u?{onOpenUrl:u}:{},...h?{onCopy:h}:{}}):null]})})}var Fx=2600;function Mx(){let[t,r]=e.useState(false),[n,i]=e.useState(0),l=e.useRef(null);e.useEffect(()=>()=>{l.current!==null&&clearTimeout(l.current)},[]);let o=e.useCallback(()=>{l.current!==null&&clearTimeout(l.current),r(true),i(e=>e+1),l.current=setTimeout(()=>{l.current=null,r(false)},Fx)},[]);return{on:t,shown:n,show:o}}function RequestedNote({clinic:e}){let{look:t}=Ob();/* @__PURE__ */
1042
+ return n.jsx(r.View,{accessibilityLiveRegion:"polite",style:{paddingVertical:_b.upcoming.rowPadY,paddingHorizontal:_b.card.pad,borderRadius:_b.card.radius,backgroundColor:t.fill},testID:"everfur-records-sheet-requested-note",children:/* @__PURE__ */n.jsx(HubText,{variant:"bodySm",color:t.onFill,children:lm.requestedFrom(e)})})}function HubDisclaimer({text:e}){let{type:t}=Ob();/* @__PURE__ */
1043
+ return n.jsx(Text,{style:[t("fine"),{textAlign:"center",marginTop:_b.screen.legalTop}],testID:"everfur-records-sheet-disclaimer",children:e})}function TopRisk({words:e,text:t,onOpenPlan:i,start:l}){let{s:o,look:a}=Gy(),s=l?vx.startPlan(e):vx.seePlan(e);/* @__PURE__ */
1035
1044
  return n.jsxs(SheetCard,{style:o.topRisk,testID:"everfur-records-sheet-top-risk",children:[
1036
1045
  /* @__PURE__ */n.jsxs(r.View,{style:o.topRiskKicker,children:[
1037
1046
  /* @__PURE__ */n.jsx(r.View,{style:o.topRiskDot}),
1038
- /* @__PURE__ */n.jsx(Text,{style:o.topRiskK,children:mx.topRiskKicker(e)})]}),
1047
+ /* @__PURE__ */n.jsx(Text,{style:o.topRiskK,children:vx.topRiskKicker(e)})]}),
1039
1048
  /* @__PURE__ */n.jsx(Text,{style:o.topRiskText,children:t}),i!==void 0?
1040
- /* @__PURE__ */n.jsx(r.Pressable,{onPress:i,accessibilityRole:"button",accessibilityLabel:s,style:({pressed:e})=>[o.button,o.buttonRow,{alignSelf:"flex-start",marginTop:wl(".rec-top .emb-btn","marginTop"),backgroundColor:a.topInk},e?{transform:[{scale:.97}]}:null],testID:"everfur-records-sheet-top-risk-plan",children:/* @__PURE__ */n.jsx(Text,{tier:"control",style:[o.buttonText,o.buttonTextRow,{color:gl(a.topInk,[fl.efWhite,fl.topInk])}],children:s})}):null]})}function FailedLine({label:e,onPress:t}){let{s:i,look:l}=Ny(),o=/* @__PURE__ */n.jsxs(n.Fragment,{children:[
1041
- /* @__PURE__ */n.jsx(Text,{style:i.failedText,children:e}),t!==void 0?/* @__PURE__ */n.jsx(SheetIcon,{kind:"chevron",size:20,color:l.alertDeep}):null]});return t!==void 0?/* @__PURE__ */n.jsx(r.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:e,style:i.failed,testID:"everfur-records-sheet-failed",children:o}):/* @__PURE__ */n.jsx(r.View,{style:i.failed,testID:"everfur-records-sheet-failed",children:o})}function EverfurRecordsFlow(t){let{petRef:petRef,petName:i,controller:l,clinicController:o,onPickDocument:a,onPickPhotos:s,uploadTransport:d,consentVersion:c,consentScope:u,consentText:h,ownerName:p,onCaptureSignature:g,initialScreen:f,onExit:m,style:b,renderPending:y,onOpenUrl:x,onCopy:w,onAsk:v,location:k,sheet:j=true,onNavigate:S,alwaysShowWays:C,renderUpcomingCareAction:R,noVet:T,weightUnit:_,onOpenPlan:z,onSpeakToVet:I,onOpenScreenings:D,onRequestFromClinic:H}=wr(t,["onExit","onNavigate"]),V=e.useMemo(()=>j===false?null:{...gr({renderUpcomingCareAction:R,noVet:T,weightUnit:_,onOpenPlan:z,onSpeakToVet:I,onOpenScreenings:D,onRequestFromClinic:H}),...typeof j=="object"?gr(j):{}},[j,R,T,_,z,I,D,H]),[P,L]=e.useReducer(recordsNavReducer,f,initialRecordsNav),E=currentRecordsScreen(P),O=P.stack.length;e.useEffect(()=>{let e=()=>O<=1?false:(L({type:"pop"}),true),t=r.BackHandler.addEventListener("hardwareBackPress",e);return()=>{t.remove()}},[O]);let A=e.useCallback(e=>{S?S(e):L({type:"navigate",screen:e})},[S]),$=e.useMemo(()=>popRecordsNav(P).handled?()=>L({type:"pop"}):m,[P,m]),B={onNavigate:A,...$?{onBack:$}:{},...i!==void 0?{petName:i}:{},...x?{onOpenUrl:x}:{},...w?{onCopy:w}:{},...v?{onAsk:v}:{},...k?{location:k}:{}},F={...l?{controller:l}:{},...c!==void 0?{consentVersion:c}:{},...u!==void 0?{consentScope:u}:{},...h!==void 0?{consentText:h}:{}},M={...a?{onPickDocument:a}:{},...s?{onPickPhotos:s}:{},...d?{uploadTransport:d}:{}},q=y?{renderPending:y}:{};/* @__PURE__ */
1042
- return n.jsx(Pl,{value:V===null?"legacy":"sheet",children:N()});function N(){switch(E.name){case"dashboard":return V!==null?/* @__PURE__ */n.jsx(EverfurRecordsSheet,{petRef:petRef,...B,...F,...q,options:V,style:b}):/* @__PURE__ */n.jsx(EverfurRecordsDashboard,{petRef:petRef,...B,...F,...q,...C===true?{alwaysShowWays:C}:{},style:b});case"request":/* @__PURE__ */
1043
- return n.jsx(EverfurRecordsRequest,{petRef:petRef,requestId:E.requestId,...B,...F,...M,...q,style:b});case"timeline":/* @__PURE__ */
1049
+ /* @__PURE__ */n.jsx(r.Pressable,{onPress:i,accessibilityRole:"button",accessibilityLabel:s,style:({pressed:e})=>[o.button,o.buttonRow,{alignSelf:"flex-start",marginTop:wl(".rec-top .emb-btn","marginTop"),backgroundColor:a.topInk},e?{transform:[{scale:.97}]}:null],testID:"everfur-records-sheet-top-risk-plan",children:/* @__PURE__ */n.jsx(Text,{tier:"control",style:[o.buttonText,o.buttonTextRow,{color:gl(a.topInk,[fl.efWhite,fl.topInk])}],children:s})}):null]})}function FailedLine({label:e,onPress:t}){let{s:i,look:l}=Gy(),o=/* @__PURE__ */n.jsxs(n.Fragment,{children:[
1050
+ /* @__PURE__ */n.jsx(Text,{style:i.failedText,children:e}),t!==void 0?/* @__PURE__ */n.jsx(SheetIcon,{kind:"chevron",size:20,color:l.alertDeep}):null]});return t!==void 0?/* @__PURE__ */n.jsx(r.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:e,style:i.failed,testID:"everfur-records-sheet-failed",children:o}):/* @__PURE__ */n.jsx(r.View,{style:i.failed,testID:"everfur-records-sheet-failed",children:o})}function EverfurRecordsFlow(t){let{petRef:petRef,petName:i,controller:l,clinicController:o,onPickDocument:a,onPickPhotos:s,uploadTransport:d,consentVersion:c,consentScope:u,consentText:h,ownerName:p,onCaptureSignature:g,initialScreen:f,onExit:m,style:b,renderPending:y,onOpenUrl:x,onCopy:w,onAsk:v,location:k,sheet:j=true,onNavigate:S,alwaysShowWays:C,renderUpcomingCareAction:R,noVet:T,weightUnit:_,onOpenPlan:z,onSpeakToVet:I,onOpenScreenings:D,onRequestFromClinic:H}=wr(t,["onExit","onNavigate"]),V=e.useMemo(()=>j===false?null:{...gr({renderUpcomingCareAction:R,noVet:T,weightUnit:_,onOpenPlan:z,onSpeakToVet:I,onOpenScreenings:D,onRequestFromClinic:H}),...typeof j=="object"?gr(j):{}},[j,R,T,_,z,I,D,H]),[P,L]=e.useReducer(recordsNavReducer,f,initialRecordsNav),O=currentRecordsScreen(P),E=P.stack.length;e.useEffect(()=>{let e=()=>E<=1?false:(L({type:"pop"}),true),t=r.BackHandler.addEventListener("hardwareBackPress",e);return()=>{t.remove()}},[E]);let A=e.useCallback(e=>{S?S(e):L({type:"navigate",screen:e})},[S]),$=e.useMemo(()=>popRecordsNav(P).handled?()=>L({type:"pop"}):m,[P,m]),B={onNavigate:A,...$?{onBack:$}:{},...i!==void 0?{petName:i}:{},...x?{onOpenUrl:x}:{},...w?{onCopy:w}:{},...v?{onAsk:v}:{},...k?{location:k}:{}},F={...l?{controller:l}:{},...c!==void 0?{consentVersion:c}:{},...u!==void 0?{consentScope:u}:{},...h!==void 0?{consentText:h}:{}},M={...a?{onPickDocument:a}:{},...s?{onPickPhotos:s}:{},...d?{uploadTransport:d}:{}},q=y?{renderPending:y}:{};/* @__PURE__ */
1051
+ return n.jsx(Pl,{value:V===null?"legacy":"sheet",children:N()});function N(){switch(O.name){case"dashboard":return V!==null?/* @__PURE__ */n.jsx(EverfurRecordsSheet,{petRef:petRef,...B,...F,...q,options:V,style:b}):/* @__PURE__ */n.jsx(EverfurRecordsDashboard,{petRef:petRef,...B,...F,...q,...C===true?{alwaysShowWays:C}:{},style:b});case"request":/* @__PURE__ */
1052
+ return n.jsx(EverfurRecordsRequest,{petRef:petRef,requestId:O.requestId,...B,...F,...M,...q,style:b});case"timeline":/* @__PURE__ */
1044
1053
  return n.jsx(EverfurRecordsTimeline,{petRef:petRef,...B,style:b});case"record":/* @__PURE__ */
1045
1054
  return n.jsx(EverfurRecordDetail,{petRef:petRef,...B,...F,...q,style:b});case"document":/* @__PURE__ */
1046
1055
  return n.jsx(EverfurRecordDocument,{petRef:petRef,...B,...F,...q,style:b});case"contributions":/* @__PURE__ */
1047
- return n.jsx(EverfurDocumentContributions,{petRef:petRef,docId:E.docId,...B,style:b});case"clinicPicker":/* @__PURE__ */
1056
+ return n.jsx(EverfurDocumentContributions,{petRef:petRef,docId:O.docId,...B,style:b});case"clinicPicker":/* @__PURE__ */
1048
1057
  return n.jsx(EverfurClinicPicker,{petRef:petRef,...B,...o?{controller:o}:{},...l?{recordsController:l}:{},style:b});case"clinicBatch":/* @__PURE__ */
1049
1058
  return n.jsx(EverfurClinicRequestBatch,{petRef:petRef,petName:i??"",ownerName:p??"",onClose:$??(()=>L({type:"navigate",screen:{name:"dashboard"}})),...g?{onCaptureSignature:g}:{},...o?{controller:o}:{},style:b});case"consent":/* @__PURE__ */
1050
- return n.jsx(EverfurRecordsConsent,{petRef:petRef,clinic:E.clinic,...B,...p!==void 0?{ownerName:p}:{},...g?{onCaptureSignature:g}:{},...o?{controller:o}:{},style:b});case"upload":/* @__PURE__ */
1059
+ return n.jsx(EverfurRecordsConsent,{petRef:petRef,clinic:O.clinic,...B,...p!==void 0?{ownerName:p}:{},...g?{onCaptureSignature:g}:{},...o?{controller:o}:{},style:b});case"upload":/* @__PURE__ */
1051
1060
  return n.jsx(EverfurRecordsUpload,{petRef:petRef,...B,...l?{controller:l}:{},...M,...q,style:b});case"requests":/* @__PURE__ */
1052
- return n.jsx(EverfurRecordsRequests,{petRef:petRef,...B,...l?{controller:l}:{},...q,style:b});default:return assertNever(E)}}}var Ax=EverfurRecordsFlow;function EverfurClinicRequest(e){let{userRef:userRef,scopeEpoch:t}=Xt();/* @__PURE__ */
1061
+ return n.jsx(EverfurRecordsRequests,{petRef:petRef,...B,...l?{controller:l}:{},...q,style:b});default:return assertNever(O)}}}var qx=EverfurRecordsFlow;function EverfurClinicRequest(e){let{userRef:userRef,scopeEpoch:t}=Xt();/* @__PURE__ */
1053
1062
  return n.jsx(CapabilityGate,{capability:"recordsClinic",...uo(e.onClose,on.cancel),children:userRef===null?/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",children:fn.sessionRequired}):/* @__PURE__ */n.jsx(ClinicRequestBody,{...wr(e,["onClose","onCreated"])},JSON.stringify([userRef,t,e.petRef,e.petName]))})}function ClinicRequestBody(t){let i=useEverfurRecordsClinic(),[l,o]=e.useState(null),a=e.useCallback(async()=>l===null?null:{signaturePngBase64:l},[l]),s=Da(t,t.controller??i,t.onCaptureSignature??a),d=t.onCaptureSignature!==void 0||l!==null,c=useEverfurTheme(),u={minHeight:44,padding:c.space.sm,borderWidth:1,borderColor:c.color.borderHairlineGreen,borderRadius:c.radius.sm,color:c.color.text.primary,backgroundColor:c.color.surface},h={...u,...rn(c.slots.input,1),...nn(c.slots.input)},p={color:c.color.text.primary,fontSize:c.type.size.body},g=(e,t,i=false,l)=>/* @__PURE__ */n.jsx(r.Pressable,{accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:i},disabled:i,onPress:t,...l?{testID:l}:{},style:[u,{justifyContent:"center",opacity:i?.5:1}],children:/* @__PURE__ */n.jsx(Text,{style:p,children:e})});/* @__PURE__ */
1054
1063
  return n.jsxs(r.View,{accessibilityLabel:on.title,style:[{backgroundColor:c.color.surface,padding:c.space.lg,gap:c.space.md,borderRadius:c.radius.lg,minHeight:120},t.style],children:[
1055
1064
  /* @__PURE__ */n.jsx(Text,{accessibilityRole:"header",style:[p,{...headingFace(c,"bold"),fontSize:c.type.size.heading}],children:on.title}),
@@ -1061,21 +1070,21 @@ return n.jsxs(r.View,{accessibilityLabel:on.title,style:[{backgroundColor:c.colo
1061
1070
  /* @__PURE__ */n.jsx(Text,{style:p,children:on.email}),
1062
1071
  /* @__PURE__ */n.jsx(tn,{accessibilityLabel:on.email,style:h,value:s.email,placeholder:on.emailPlaceholder,placeholderTextColor:c.color.text.placeholder,maxLength:320,editable:!s.busy,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,onChangeText:s.setEmail})]}),
1063
1072
  /* @__PURE__ */n.jsx(Text,{accessibilityRole:"header",style:p,children:on.scopeHeading}),s.copy?/* @__PURE__ */n.jsx(Text,{style:p,children:s.query.trim()&&s.ownerName.trim()?s.scope??makeEverfurError("internalError").displayMessage:fn.consentRequired}):!s.error&&/* @__PURE__ */n.jsx(Text,{accessibilityLiveRegion:"polite",style:p,children:fn.loading}),!t.onCaptureSignature&&/* @__PURE__ */n.jsx(SignaturePad,{onChange:o,disabled:s.busy}),!d&&s.ready&&/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",style:p,children:on.missingSignature}),s.error&&/* @__PURE__ */n.jsx(Text,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:p,children:s.error.displayMessage}),!s.copy&&s.error&&g(fn.retry,s.retryCopy),g(s.busy?on.sending:on.send,()=>{s.submit()},s.busy||!s.ready||!d)]}),t.onClose&&g(on.cancel,t.onClose,s.busy),
1064
- /* @__PURE__ */n.jsx(RecordsFootnote,{})]})}var $x=[fl.embB1,fl.embB2,fl.embB3,fl.embB4],Bx={accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function Fx(e){return`${Number.isFinite(e)?Number(e.toFixed(1)):0}%`}function RecordsDnaCard({title:e,subtitle:t,breeds:i=[],result:l,clear:o,icon:a,style:s,testID:d="everfur-records-dna-card"}){let c=useEverfurTheme(),u=face(c,"regular"),h=face(c,"mono"),p=face(c,"bold"),g=wl(".emb-tile","width"),f=i.filter(e=>e.percent>0),m=f.map(e=>`${e.name} ${Fx(e.percent)}`).join(", "),b=(e,t)=>e.color??$x[t%$x.length]??fl.embB1,y=wl(".mixlegend","columnGap");/* @__PURE__ */
1073
+ /* @__PURE__ */n.jsx(RecordsFootnote,{})]})}var Nx=[fl.embB1,fl.embB2,fl.embB3,fl.embB4],Wx={accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function Ux(e){return`${Number.isFinite(e)?Number(e.toFixed(1)):0}%`}function RecordsDnaCard({title:e,subtitle:t,breeds:i=[],result:l,clear:o,icon:a,style:s,testID:d="everfur-records-dna-card"}){let c=useEverfurTheme(),u=face(c,"regular"),h=face(c,"mono"),p=face(c,"bold"),g=wl(".emb-tile","width"),f=i.filter(e=>e.percent>0),m=f.map(e=>`${e.name} ${Ux(e.percent)}`).join(", "),b=(e,t)=>e.color??Nx[t%Nx.length]??fl.embB1,y=wl(".mixlegend","columnGap");/* @__PURE__ */
1065
1074
  return n.jsxs(r.View,{style:[{padding:wl(".rec-dna","paddingTop"),borderRadius:wl(".emb-card","borderRadius"),backgroundColor:fl.efWhite,shadowColor:fl.topInk,shadowOpacity:.06,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:1},s],testID:d,children:[
1066
1075
  /* @__PURE__ */n.jsxs(r.View,{style:{flexDirection:"row",alignItems:"center",gap:wl(".rec-dna__top","gap"),marginBottom:wl(".rec-dna__top","marginBottom")},children:[
1067
- /* @__PURE__ */n.jsx(r.View,{style:{width:g,height:wl(".emb-tile","height"),borderRadius:wl(".emb-tile","borderRadius"),backgroundColor:fl.embCyan1,alignItems:"center",justifyContent:"center"},...Bx,children:a??/* @__PURE__ */n.jsx(DnaGlyph,{size:23,color:fl.embTealInk})}),
1076
+ /* @__PURE__ */n.jsx(r.View,{style:{width:g,height:wl(".emb-tile","height"),borderRadius:wl(".emb-tile","borderRadius"),backgroundColor:fl.embCyan1,alignItems:"center",justifyContent:"center"},...Wx,children:a??/* @__PURE__ */n.jsx(DnaGlyph,{size:23,color:fl.embTealInk})}),
1068
1077
  /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,minWidth:0},children:[
1069
1078
  /* @__PURE__ */n.jsx(Text,{accessibilityRole:"header",style:{...p,fontSize:wl(".rec-dna__top h3","fontSize"),lineHeight:wl(".rec-dna__top h3","fontSize")*1.15,color:fl.topInk},children:e}),t!==void 0&&t.trim().length>0?/* @__PURE__ */n.jsx(Text,{style:{...h,marginTop:wl(".rec-dna__top p","marginTop"),fontSize:wl(".rec-dna__top p","fontSize"),lineHeight:wl(".rec-dna__top p","fontSize")*1.5,letterSpacing:wl(".rec-dna__top p","letterSpacing"),textTransform:"uppercase",color:fl.embInk3},children:t}):null]})]}),f.length>0?/* @__PURE__ */n.jsxs(n.Fragment,{children:[
1070
1079
  /* @__PURE__ */n.jsx(r.View,{accessible:true,accessibilityRole:"image",accessibilityLabel:m,style:{flexDirection:"row",gap:wl(".mixbar","gap"),height:wl(".mixbar","height"),borderRadius:999,overflow:"hidden"},testID:`${d}-mix`,children:f.map((e,t)=>/* @__PURE__ */n.jsx(r.View,{style:{flexGrow:e.percent,flexShrink:0,flexBasis:0,backgroundColor:b(e,t)}},`${e.name}${t}`))}),
1071
- /* @__PURE__ */n.jsx(r.View,{style:{flexDirection:"row",flexWrap:"wrap",columnGap:y,rowGap:wl(".mixlegend","rowGap"),marginTop:wl(".mixlegend","marginTop")},...Bx,children:f.map((e,t)=>/* @__PURE__ */n.jsxs(r.View,{style:{flexBasis:"45%",flexGrow:1,minWidth:0,flexDirection:"row",alignItems:"center",gap:wl(".mixlegend li","gap")},children:[
1080
+ /* @__PURE__ */n.jsx(r.View,{style:{flexDirection:"row",flexWrap:"wrap",columnGap:y,rowGap:wl(".mixlegend","rowGap"),marginTop:wl(".mixlegend","marginTop")},...Wx,children:f.map((e,t)=>/* @__PURE__ */n.jsxs(r.View,{style:{flexBasis:"45%",flexGrow:1,minWidth:0,flexDirection:"row",alignItems:"center",gap:wl(".mixlegend li","gap")},children:[
1072
1081
  /* @__PURE__ */n.jsx(r.View,{style:{width:wl(".mixlegend i","width"),height:wl(".mixlegend i","width"),borderRadius:999,backgroundColor:b(e,t)}}),
1073
1082
  /* @__PURE__ */n.jsx(Text,{style:{...u,flex:1,minWidth:0,fontSize:wl(".mixlegend","fontSize"),lineHeight:wl(".mixlegend","fontSize")*1.5,color:fl.topInk},children:e.name}),
1074
- /* @__PURE__ */n.jsx(Text,{style:{...h,fontSize:wl(".mixlegend b","fontSize"),lineHeight:wl(".mixlegend b","fontSize")*1.5,color:fl.embInk2},children:Fx(e.percent)})]},`${e.name}${t}`))})]}):null,l!==void 0?/* @__PURE__ */n.jsx(DnaResult,{result:l}):null,o!==void 0?/* @__PURE__ */n.jsxs(r.Pressable,{onPress:o.onPress,disabled:o.onPress===void 0,accessibilityRole:o.onPress!==void 0?"button":"text",accessibilityLabel:o.label,style:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:wl(".rec-dna__clear","gap"),minHeight:wl(".rec-dna__clear","minHeight"),marginTop:wl(".rec-dna__clear","marginTop"),paddingHorizontal:wl(".rec-dna__clear","paddingLeft")},testID:`${d}-clear`,children:[
1083
+ /* @__PURE__ */n.jsx(Text,{style:{...h,fontSize:wl(".mixlegend b","fontSize"),lineHeight:wl(".mixlegend b","fontSize")*1.5,color:fl.embInk2},children:Ux(e.percent)})]},`${e.name}${t}`))})]}):null,l!==void 0?/* @__PURE__ */n.jsx(DnaResult,{result:l}):null,o!==void 0?/* @__PURE__ */n.jsxs(r.Pressable,{onPress:o.onPress,disabled:o.onPress===void 0,accessibilityRole:o.onPress!==void 0?"button":"text",accessibilityLabel:o.label,style:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:wl(".rec-dna__clear","gap"),minHeight:wl(".rec-dna__clear","minHeight"),marginTop:wl(".rec-dna__clear","marginTop"),paddingHorizontal:wl(".rec-dna__clear","paddingLeft")},testID:`${d}-clear`,children:[
1075
1084
  /* @__PURE__ */n.jsx(r.View,{style:{width:wl(".rec-dna__clear .dot","width"),height:wl(".rec-dna__clear .dot","width"),borderRadius:999,backgroundColor:fl.embClearDot}}),
1076
- /* @__PURE__ */n.jsx(Text,{style:{...u,fontSize:wl(".rec-dna__clear","fontSize"),lineHeight:wl(".rec-dna__clear","fontSize")*1.5,color:fl.embInk3},children:o.label}),o.onPress!==void 0?/* @__PURE__ */n.jsx(r.View,{...Bx,children:/* @__PURE__ */n.jsx(ChevronGlyph,{size:14,color:fl.embInk3,direction:"right"})}):null]}):null]})}function DnaResult({result:e}){let t=useEverfurTheme(),i=face(t,"bold"),l=/* @__PURE__ */n.jsxs(n.Fragment,{children:[
1085
+ /* @__PURE__ */n.jsx(Text,{style:{...u,fontSize:wl(".rec-dna__clear","fontSize"),lineHeight:wl(".rec-dna__clear","fontSize")*1.5,color:fl.embInk3},children:o.label}),o.onPress!==void 0?/* @__PURE__ */n.jsx(r.View,{...Wx,children:/* @__PURE__ */n.jsx(ChevronGlyph,{size:14,color:fl.embInk3,direction:"right"})}):null]}):null]})}function DnaResult({result:e}){let t=useEverfurTheme(),i=face(t,"bold"),l=/* @__PURE__ */n.jsxs(n.Fragment,{children:[
1077
1086
  /* @__PURE__ */n.jsx(r.View,{style:{width:wl(".dot","width"),height:wl(".dot","width"),borderRadius:999,backgroundColor:fl.embRiskDot}}),
1078
1087
  /* @__PURE__ */n.jsxs(r.View,{style:{flex:1,minWidth:0},children:[
1079
1088
  /* @__PURE__ */n.jsx(Text,{style:{...i,fontSize:wl(".rec-dna__risk small","fontSize"),lineHeight:wl(".rec-dna__risk small","fontSize")*1.5,color:fl.embRiskInk},children:e.kicker}),
1080
- /* @__PURE__ */n.jsx(Text,{style:{...i,marginTop:wl(".rec-dna__risk strong","marginTop"),fontSize:wl(".rec-dna__risk strong","fontSize"),lineHeight:wl(".rec-dna__risk strong","lineHeight"),color:fl.topInk},children:e.title})]}),e.onPress!==void 0?/* @__PURE__ */n.jsx(r.View,{...Bx,children:/* @__PURE__ */n.jsx(ChevronGlyph,{size:18,color:fl.embInk3,direction:"right"})}):null]}),o={flexDirection:"row",alignItems:"center",gap:wl(".rec-dna__risk","gap"),marginTop:wl(".rec-dna__risk","marginTop"),paddingTop:wl(".rec-dna__risk","paddingTop"),paddingRight:wl(".rec-dna__risk","paddingRight"),paddingBottom:wl(".rec-dna__risk","paddingBottom"),paddingLeft:wl(".rec-dna__risk","paddingLeft"),borderRadius:wl(".rec-dna__risk","borderRadius"),backgroundColor:fl.paper};return e.onPress!==void 0?/* @__PURE__ */n.jsx(r.Pressable,{onPress:e.onPress,accessibilityRole:"button",accessibilityLabel:`${e.kicker}. ${e.title}`,style:o,testID:"everfur-records-dna-card-result",children:l}):/* @__PURE__ */n.jsx(r.View,{style:o,testID:"everfur-records-dna-card-result",children:l})}function recordsSheet(e={}){/* @__PURE__ */
1081
- return Object.freeze({...e})}var Mx=Ib(Kr),qx=wl(".efh-btn--row","fontSize"),Nx=/* @__PURE__ */Object.freeze({style:/* @__PURE__ */Object.freeze({flexDirection:"row",alignItems:"center",justifyContent:"center",gap:Rb.button.gap,borderRadius:999,minHeight:wl(".efh-btn--row","minHeight"),paddingHorizontal:wl(".efh-btn--row","paddingLeft"),backgroundColor:Mx.fill}),labelStyle:/* @__PURE__ */Object.freeze({...face(Kr,"bold"),fontSize:qx,lineHeight:qx*1.2,color:Mx.onFill})});exports.EverfurClinicPicker=EverfurClinicPicker;exports.EverfurClinicRequest=EverfurClinicRequest;exports.EverfurClinicRequestBatch=EverfurClinicRequestBatch;exports.EverfurRecordDetail=EverfurRecordDetail;exports.EverfurRecordDocument=EverfurRecordDocument;exports.EverfurRecords=Ax;exports.EverfurRecordsConsent=EverfurRecordsConsent;exports.EverfurRecordsDashboard=EverfurRecordsDashboard;exports.EverfurRecordsFlow=EverfurRecordsFlow;exports.EverfurRecordsLabDetail=EverfurRecordsLabDetail;exports.EverfurRecordsRequest=EverfurRecordsRequest;exports.EverfurRecordsRequests=EverfurRecordsRequests;exports.EverfurRecordsSheet=EverfurRecordsSheet;exports.EverfurRecordsUpload=EverfurRecordsUpload;exports.RECORDS_CLINIC_BATCH_MAX=Bn;exports.RECORDS_SHEET_RN_COPY=jx;exports.RECORDS_SHEET_ROW_BUTTON_STYLE=Nx;exports.RECORDS_TERMINAL=Ie;exports.REQUEST_TIMELINE_TITLES=Zu;exports.RecordsDnaCard=RecordsDnaCard;exports.RequestDocumentsList=RequestDocumentsList;exports.SignaturePad=SignaturePad;exports.acceptsPhotos=acceptsPhotos;exports.applyFactOverlay=applyFactOverlay;exports.buildRequestTimeline=buildRequestTimeline;exports.currentRecordsScreen=currentRecordsScreen;exports.deriveRecordsDashboardState=deriveRecordsDashboardState;exports.initialRecordsNav=initialRecordsNav;exports.isFactEditable=isFactEditable;exports.isTerminalStatus=isTerminalStatus;exports.pickPetRecordsRequest=pickPetRecordsRequest;exports.popRecordsNav=popRecordsNav;exports.pushRecordsNav=pushRecordsNav;exports.recordsDenialReasonOf=recordsDenialReasonOf;exports.recordsNavReducer=recordsNavReducer;exports.recordsSheet=recordsSheet;exports.recordsSheetLook=recordsSheetLook;exports.registerRnSignature=registerRnSignature;exports.replaceRecordsNav=replaceRecordsNav;exports.resetRecordsNav=resetRecordsNav;exports.selectClinicCall=selectClinicCall;exports.selectDashboardView=selectDashboardView;exports.selectPrimaryLabel=selectPrimaryLabel;exports.selectRequestList=selectRequestList;exports.selectRequestTitle=selectRequestTitle;exports.transitionRecordsNav=transitionRecordsNav;exports.useEverfurRecords=useEverfurRecords;exports.useEverfurRecordsClinic=useEverfurRecordsClinic;exports.useEverfurRecordsClinicBatch=useEverfurRecordsClinicBatch;exports.useRecordFactEdit=useRecordFactEdit;exports.useRecordPdfLink=useRecordPdfLink;exports.useRecordShares=useRecordShares;exports.useRecordsMarkers=useRecordsMarkers;
1089
+ /* @__PURE__ */n.jsx(Text,{style:{...i,marginTop:wl(".rec-dna__risk strong","marginTop"),fontSize:wl(".rec-dna__risk strong","fontSize"),lineHeight:wl(".rec-dna__risk strong","lineHeight"),color:fl.topInk},children:e.title})]}),e.onPress!==void 0?/* @__PURE__ */n.jsx(r.View,{...Wx,children:/* @__PURE__ */n.jsx(ChevronGlyph,{size:18,color:fl.embInk3,direction:"right"})}):null]}),o={flexDirection:"row",alignItems:"center",gap:wl(".rec-dna__risk","gap"),marginTop:wl(".rec-dna__risk","marginTop"),paddingTop:wl(".rec-dna__risk","paddingTop"),paddingRight:wl(".rec-dna__risk","paddingRight"),paddingBottom:wl(".rec-dna__risk","paddingBottom"),paddingLeft:wl(".rec-dna__risk","paddingLeft"),borderRadius:wl(".rec-dna__risk","borderRadius"),backgroundColor:fl.paper};return e.onPress!==void 0?/* @__PURE__ */n.jsx(r.Pressable,{onPress:e.onPress,accessibilityRole:"button",accessibilityLabel:`${e.kicker}. ${e.title}`,style:o,testID:"everfur-records-dna-card-result",children:l}):/* @__PURE__ */n.jsx(r.View,{style:o,testID:"everfur-records-dna-card-result",children:l})}function recordsSheet(e={}){/* @__PURE__ */
1090
+ return Object.freeze({...e})}var Gx=Hb(Kr),Kx=wl(".efh-btn--row","fontSize"),Yx=/* @__PURE__ */Object.freeze({style:/* @__PURE__ */Object.freeze({flexDirection:"row",alignItems:"center",justifyContent:"center",gap:_b.button.gap,borderRadius:999,minHeight:wl(".efh-btn--row","minHeight"),paddingHorizontal:wl(".efh-btn--row","paddingLeft"),backgroundColor:Gx.fill}),labelStyle:/* @__PURE__ */Object.freeze({...face(Kr,"bold"),fontSize:Kx,lineHeight:Kx*1.2,color:Gx.onFill})});exports.EverfurClinicPicker=EverfurClinicPicker;exports.EverfurClinicRequest=EverfurClinicRequest;exports.EverfurClinicRequestBatch=EverfurClinicRequestBatch;exports.EverfurRecordDetail=EverfurRecordDetail;exports.EverfurRecordDocument=EverfurRecordDocument;exports.EverfurRecords=qx;exports.EverfurRecordsConsent=EverfurRecordsConsent;exports.EverfurRecordsDashboard=EverfurRecordsDashboard;exports.EverfurRecordsFlow=EverfurRecordsFlow;exports.EverfurRecordsLabDetail=EverfurRecordsLabDetail;exports.EverfurRecordsRequest=EverfurRecordsRequest;exports.EverfurRecordsRequests=EverfurRecordsRequests;exports.EverfurRecordsSheet=EverfurRecordsSheet;exports.EverfurRecordsUpload=EverfurRecordsUpload;exports.RECORDS_CLINIC_BATCH_MAX=Bn;exports.RECORDS_SHEET_RN_COPY=_x;exports.RECORDS_SHEET_ROW_BUTTON_STYLE=Yx;exports.RECORDS_TERMINAL=Ie;exports.REQUEST_TIMELINE_TITLES=Zu;exports.RecordsDnaCard=RecordsDnaCard;exports.RequestDocumentsList=RequestDocumentsList;exports.SignaturePad=SignaturePad;exports.acceptsPhotos=acceptsPhotos;exports.applyFactOverlay=applyFactOverlay;exports.buildRequestTimeline=buildRequestTimeline;exports.currentRecordsScreen=currentRecordsScreen;exports.deriveRecordsDashboardState=deriveRecordsDashboardState;exports.initialRecordsNav=initialRecordsNav;exports.isFactEditable=isFactEditable;exports.isTerminalStatus=isTerminalStatus;exports.pickPetRecordsRequest=pickPetRecordsRequest;exports.popRecordsNav=popRecordsNav;exports.pushRecordsNav=pushRecordsNav;exports.recordsDenialReasonOf=recordsDenialReasonOf;exports.recordsNavReducer=recordsNavReducer;exports.recordsSheet=recordsSheet;exports.recordsSheetLook=recordsSheetLook;exports.registerRnSignature=registerRnSignature;exports.replaceRecordsNav=replaceRecordsNav;exports.resetRecordsNav=resetRecordsNav;exports.selectClinicCall=selectClinicCall;exports.selectDashboardView=selectDashboardView;exports.selectPrimaryLabel=selectPrimaryLabel;exports.selectRequestList=selectRequestList;exports.selectRequestTitle=selectRequestTitle;exports.transitionRecordsNav=transitionRecordsNav;exports.useEverfurRecords=useEverfurRecords;exports.useEverfurRecordsClinic=useEverfurRecordsClinic;exports.useEverfurRecordsClinicBatch=useEverfurRecordsClinicBatch;exports.useRecordFactEdit=useRecordFactEdit;exports.useRecordPdfLink=useRecordPdfLink;exports.useRecordShares=useRecordShares;exports.useRecordsMarkers=useRecordsMarkers;