@everfur/sdk 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/CHANGELOG.md +251 -4
  2. package/README.md +9 -3
  3. package/dist/{Chat-DwAC2vhB.d.ts → Chat-BOX-03ho.d.ts} +17 -3
  4. package/dist/{Chat-DPUD6dnc.d.cts → Chat-TA-aTcVF.d.cts} +17 -3
  5. package/dist/{DepthViews-DP0R-DhB.d.cts → DepthViews-CgjX2AJ5.d.ts} +1 -1
  6. package/dist/{DepthViews-DbFhR4Du.d.cts → DepthViews-Cviea-ri.d.cts} +1 -1
  7. package/dist/{DepthViews-DNEM96Se.d.ts → DepthViews-D2dRqWRq.d.ts} +1 -1
  8. package/dist/{DepthViews-D_3hl4xk.d.ts → DepthViews-DSFyaSeL.d.cts} +1 -1
  9. package/dist/{ErrorPolicyPort-CwbfmxzJ.d.ts → ErrorPolicyPort-D22LUVrK.d.ts} +1 -1
  10. package/dist/{ErrorPolicyPort-CNf4uQZP.d.cts → ErrorPolicyPort-D6CybiqJ.d.cts} +1 -1
  11. package/dist/{EverfurResult-DN9pL2Ab.d.cts → EverfurError-DmELDpXp.d.cts} +1 -67
  12. package/dist/{EverfurResult-DN9pL2Ab.d.ts → EverfurError-DmELDpXp.d.ts} +1 -67
  13. package/dist/EverfurResult-SGvHKsCB.d.ts +69 -0
  14. package/dist/EverfurResult-ZtH-YV1h.d.cts +69 -0
  15. package/dist/animations/index.cjs +1 -1
  16. package/dist/animations/index.d.cts +6 -5
  17. package/dist/animations/index.d.ts +6 -5
  18. package/dist/animations/index.js +1 -1
  19. package/dist/{attachments-5NeobOCd.d.ts → attachments-C_vtFu2f.d.ts} +7 -5
  20. package/dist/{attachments-D8T5re7e.d.cts → attachments-DHvnITuE.d.cts} +7 -5
  21. package/dist/{attachments-Bw3iMQgu.d.ts → attachments-oD5U2fXI.d.ts} +3 -3
  22. package/dist/{attachments-CQgFrEQ7.d.cts → attachments-pIdGOQfm.d.cts} +3 -3
  23. package/dist/bookingCopy-CJir9mjb.d.ts +1135 -0
  24. package/dist/bookingCopy-DfuA13dh.d.cts +1135 -0
  25. package/dist/branding-Xb_wL8N1.d.cts +212 -0
  26. package/dist/branding-xpQ056sM.d.ts +212 -0
  27. package/dist/callCopy-rDH9JTFo.d.cts +45 -0
  28. package/dist/callCopy-rDH9JTFo.d.ts +45 -0
  29. package/dist/callRoom-7wrE3RP2.d.ts +62 -0
  30. package/dist/callRoom-B_EqaUzx.d.cts +62 -0
  31. package/dist/casesRepository-B-Eg8ZJ3.d.cts +63 -0
  32. package/dist/casesRepository-DHgIYKN9.d.ts +63 -0
  33. package/dist/chat/index.cjs +1 -1
  34. package/dist/chat/index.d.cts +12 -10
  35. package/dist/chat/index.d.ts +12 -10
  36. package/dist/chat/index.js +1 -1
  37. package/dist/client/index.cjs +5 -5
  38. package/dist/client/index.d.cts +15 -11
  39. package/dist/client/index.d.ts +15 -11
  40. package/dist/client/index.js +5 -5
  41. package/dist/{config-CzTZGlfF.d.cts → config-ClI7QxB0.d.ts} +4 -3
  42. package/dist/{config-DW60uRb9.d.ts → config-DAFbf721.d.cts} +4 -3
  43. package/dist/consent/index.cjs +1 -1
  44. package/dist/consent/index.d.cts +9 -8
  45. package/dist/consent/index.d.ts +9 -8
  46. package/dist/consent/index.js +1 -1
  47. package/dist/{context-XvTzq1tE.d.cts → context-B-dUM1Qf.d.cts} +9 -8
  48. package/dist/{context-DXhqHlPU.d.ts → context-CZbgF_OH.d.ts} +9 -8
  49. package/dist/{copy-Mjoo91aS.d.ts → copy-CeRH3NXy.d.ts} +5 -4
  50. package/dist/{copy-bKDNigLb.d.cts → copy-CneuYdrO.d.cts} +5 -4
  51. package/dist/core/index.cjs +9 -9
  52. package/dist/core/index.d.cts +123 -32
  53. package/dist/core/index.d.ts +123 -32
  54. package/dist/core/index.js +9 -9
  55. package/dist/{depth-CErXCU8J.d.cts → depth-B3NFKlF9.d.cts} +38 -6
  56. package/dist/{depth-DjDcJ6kH.d.ts → depth-DO3Ko_qs.d.ts} +38 -6
  57. package/dist/entitlementRepository-74kW5mK0.d.ts +43 -0
  58. package/dist/entitlementRepository-m6zLUmiB.d.cts +43 -0
  59. package/dist/{identity-DI4eVx9S.d.cts → identity-C7uxGwfT.d.cts} +3 -3
  60. package/dist/{identity-BMx2SUOM.d.ts → identity-CLAUq-K4.d.ts} +3 -3
  61. package/dist/index.cjs +6 -6
  62. package/dist/index.d.cts +20 -17
  63. package/dist/index.d.ts +20 -17
  64. package/dist/index.js +6 -6
  65. package/dist/{models-D2EUxPZY.d.cts → models-Bn2z0NNo.d.cts} +1 -1
  66. package/dist/{models-B-Uh2LTf.d.ts → models-DSqA5Ahs.d.ts} +1 -1
  67. package/dist/notifications/index.cjs +2 -2
  68. package/dist/notifications/index.d.cts +5 -4
  69. package/dist/notifications/index.d.ts +5 -4
  70. package/dist/notifications/index.js +2 -2
  71. package/dist/optionalModule-DbJmsq5f.d.cts +21 -0
  72. package/dist/optionalModule-DbJmsq5f.d.ts +21 -0
  73. package/dist/{pets-aB8q0JyX.d.cts → pets-BoB5B7kp.d.cts} +2 -2
  74. package/dist/{pets-CtQdRpWo.d.ts → pets-w4M9d-Dn.d.ts} +2 -2
  75. package/dist/{casesRepository-ClLv6qMl.d.ts → petsRepository-BjKJ8UsN.d.ts} +3 -49
  76. package/dist/{casesRepository-DHwtGRYY.d.cts → petsRepository-DZZoEG3r.d.cts} +3 -49
  77. package/dist/photo/index.cjs +1 -1
  78. package/dist/photo/index.d.cts +3 -2
  79. package/dist/photo/index.d.ts +3 -2
  80. package/dist/photo/index.js +1 -1
  81. package/dist/{ports-DMolTRzU.d.ts → ports-BO3bzTJg.d.ts} +14 -17
  82. package/dist/{ports-DEBzEhbp.d.cts → ports-C2EVK416.d.cts} +14 -17
  83. package/dist/records/depth/index.cjs +2 -2
  84. package/dist/records/depth/index.d.cts +11 -10
  85. package/dist/records/depth/index.d.ts +11 -10
  86. package/dist/records/depth/index.js +2 -2
  87. package/dist/records/index.cjs +3 -3
  88. package/dist/records/index.d.cts +25 -14
  89. package/dist/records/index.d.ts +25 -14
  90. package/dist/records/index.js +3 -3
  91. package/dist/{requestFunnel-CjW7uDuA.d.ts → requestFunnel-D7ipek3e.d.ts} +28 -4
  92. package/dist/{requestFunnel-L-BQfi0z.d.cts → requestFunnel-Djjwgoe9.d.cts} +28 -4
  93. package/dist/{runtime-BR9ysG0J.d.ts → runtimeTypes-CTL3yToK.d.ts} +10 -100
  94. package/dist/{runtime-B8s-_hv8.d.cts → runtimeTypes-D2C9uD85.d.cts} +10 -100
  95. package/dist/server/events/index.cjs +1 -1
  96. package/dist/server/events/index.d.cts +4 -3
  97. package/dist/server/events/index.d.ts +4 -3
  98. package/dist/server/events/index.js +1 -1
  99. package/dist/server/index.cjs +1 -1
  100. package/dist/server/index.d.cts +5 -4
  101. package/dist/server/index.d.ts +5 -4
  102. package/dist/server/index.js +1 -1
  103. package/dist/televet/booking/index.cjs +1 -0
  104. package/dist/televet/booking/index.d.cts +566 -0
  105. package/dist/televet/booking/index.d.ts +566 -0
  106. package/dist/televet/booking/index.js +1 -0
  107. package/dist/televet/call/index.cjs +1 -0
  108. package/dist/televet/call/index.d.cts +161 -0
  109. package/dist/televet/call/index.d.ts +161 -0
  110. package/dist/televet/call/index.js +1 -0
  111. package/dist/televet/index.cjs +1 -1
  112. package/dist/televet/index.d.cts +64 -12
  113. package/dist/televet/index.d.ts +64 -12
  114. package/dist/televet/index.js +1 -1
  115. package/dist/televetGlobal-CEk0_cW9.d.cts +34 -0
  116. package/dist/televetGlobal-Cs9Wbqsy.d.ts +34 -0
  117. package/dist/testing/index.cjs +4 -4
  118. package/dist/testing/index.d.cts +4 -3
  119. package/dist/testing/index.d.ts +4 -3
  120. package/dist/testing/index.js +4 -4
  121. package/dist/testing/rn/index.cjs +1 -1
  122. package/dist/testing/rn/index.d.cts +13 -10
  123. package/dist/testing/rn/index.d.ts +13 -10
  124. package/dist/testing/rn/index.js +1 -1
  125. package/dist/testing/web/index.cjs +1 -1
  126. package/dist/testing/web/index.d.cts +14 -12
  127. package/dist/testing/web/index.d.ts +14 -12
  128. package/dist/testing/web/index.js +1 -1
  129. package/dist/{timelineRows-DZed6dAM.d.ts → timelineRows-7yFNK_rU.d.ts} +1 -1
  130. package/dist/{timelineRows-CaohZzXS.d.cts → timelineRows-CzR1T2DR.d.cts} +1 -1
  131. package/dist/tokens-CIngRkvt.d.cts +362 -0
  132. package/dist/tokens-CIngRkvt.d.ts +362 -0
  133. package/dist/typeStyle-DHJzDaUo.d.cts +112 -0
  134. package/dist/typeStyle-YPS_MXeI.d.ts +112 -0
  135. package/dist/{useRecordsDepth-BHBzJ76R.d.cts → useRecordsDepth-Bnw36jPr.d.cts} +24 -5
  136. package/dist/{useRecordsDepth-BU-OhzH6.d.ts → useRecordsDepth-DFF7Faxx.d.ts} +24 -5
  137. package/dist/{useVetVisit-CjmMa896.d.ts → useVetVisit-BsjoDO-n.d.ts} +21 -6
  138. package/dist/{useVetVisit-Bc84hWUU.d.cts → useVetVisit-Ds8f1peV.d.cts} +21 -6
  139. package/dist/video/index.cjs +1 -1
  140. package/dist/video/index.d.cts +3 -2
  141. package/dist/video/index.d.ts +3 -2
  142. package/dist/video/index.js +1 -1
  143. package/dist/{view-DtSPYpKa.d.ts → view-BqcOYFTr.d.ts} +5 -4
  144. package/dist/{view-C3qPIXGX.d.cts → view-CaJs8WFH.d.cts} +5 -4
  145. package/dist/web/consent/index.cjs +1 -1
  146. package/dist/web/consent/index.d.cts +9 -8
  147. package/dist/web/consent/index.d.ts +9 -8
  148. package/dist/web/consent/index.js +1 -1
  149. package/dist/web/index.cjs +10 -10
  150. package/dist/web/index.d.cts +43 -19
  151. package/dist/web/index.d.ts +43 -19
  152. package/dist/web/index.js +10 -10
  153. package/dist/web/notifications/index.cjs +2 -2
  154. package/dist/web/notifications/index.d.cts +7 -6
  155. package/dist/web/notifications/index.d.ts +7 -6
  156. package/dist/web/notifications/index.js +2 -2
  157. package/dist/web/records/depth/index.cjs +2 -2
  158. package/dist/web/records/depth/index.d.cts +11 -10
  159. package/dist/web/records/depth/index.d.ts +11 -10
  160. package/dist/web/records/depth/index.js +2 -2
  161. package/dist/web/records/index.cjs +3 -3
  162. package/dist/web/records/index.d.cts +123 -14
  163. package/dist/web/records/index.d.ts +123 -14
  164. package/dist/web/records/index.js +3 -3
  165. package/dist/web/televet/booking/index.cjs +2 -0
  166. package/dist/web/televet/booking/index.d.cts +770 -0
  167. package/dist/web/televet/booking/index.d.ts +770 -0
  168. package/dist/web/televet/booking/index.js +2 -0
  169. package/dist/web/televet/call/index.cjs +1 -0
  170. package/dist/web/televet/call/index.d.cts +144 -0
  171. package/dist/web/televet/call/index.d.ts +144 -0
  172. package/dist/web/televet/call/index.js +1 -0
  173. package/dist/web/televet/index.cjs +1 -1
  174. package/dist/web/televet/index.d.cts +61 -9
  175. package/dist/web/televet/index.d.ts +61 -9
  176. package/dist/web/televet/index.js +1 -1
  177. package/package.json +74 -5
  178. package/televet/booking/package.json +8 -0
  179. package/televet/call/package.json +8 -0
  180. package/web/televet/booking/native-blocked.cjs +12 -0
  181. package/web/televet/booking/package.json +8 -0
  182. package/web/televet/call/native-blocked.cjs +12 -0
  183. package/web/televet/call/package.json +8 -0
  184. package/dist/entitlementRepository-DKdXFgTo.d.cts +0 -698
  185. package/dist/entitlementRepository-DSbzuyAW.d.ts +0 -698
  186. package/dist/typeStyle-0TydiZ1w.d.cts +0 -19
  187. package/dist/typeStyle-CWMsoe6b.d.ts +0 -19
@@ -1 +1 @@
1
- import {createContext,forwardRef,useMemo,useState,useRef,useEffect,useCallback,useSyncExternalStore,createElement,useContext,Component}from'react';import {StyleSheet,TextInput,Linking,KeyboardAvoidingView,View,Platform,Pressable,ActivityIndicator,ScrollView,Animated,Text,UIManager,LayoutAnimation,Modal,Image,useWindowDimensions,FlatList}from'react-native';import {useSafeAreaInsets}from'react-native-safe-area-context';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var pl=Object.defineProperty;var i=(e,t)=>pl(e,"name",{value:t,configurable:true});var gr=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(gr.map(e=>e.wireCode));var fl=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",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",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"}),Wn=Object.freeze(gr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:fl[e.wireCode]}))),yl=new Map(Wn.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),ml=Object.freeze(["http_envelope",...[...new Set(Wn.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function wt(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...ml]){let o=yl.get(n+r);if(o)return o}}i(wt,"contractErrorFor");function gl(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(gl,"contractDocUrl");function Gn(e){return null}i(Gn,"publishedDocUrl");var hl=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"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 qn(e){return hl[e]}i(qn,"categoryFor");function Yn(e){let t=wt(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":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";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"}}i(Yn,"fromWire");var bl=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function hr(e){return bl.has(e)}i(hr,"isAutoRetryable");var vl=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Kn(e){return hr(e)||vl.has(e)}i(Kn,"isRetryableCode");var Cl=500,br=8e3,$n=4;function Qn(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Cl*2**r,br);return Math.floor(t()*n)}i(Qn,"backoffDelayMs");var El=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:"This feature isn't available on your account right now.",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:"Something in that request was not right. Check the details and try again.",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.",unknown:"Something went wrong. Please try again."});function vr(e){return El[e]}i(vr,"userFacingError");function Xn(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(Xn,"defineHidden");var Rl=/^[a-z][a-z0-9_]{0,63}$/;function j(e,t){let r=wt(t?.wireCode,t?.wireEnvelope),n={code:e,category:qn(e),retryable:t?.retryable??Kn(e),displayMessage:vr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&Rl.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Xn(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Xn(n,"raw",t.raw),Object.freeze(n)}i(j,"makeEverfurError");function le(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(le,"ok");function V(e){return Object.freeze({ok:false,error:e})}i(V,"err");var _t=class _t extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,_t.prototype);}};i(_t,"EverfurConfigError");var lt=_t;var p=Object.freeze({placeholder:"Message",send:"Send",stop:"Stop",retry:"Try again",followUps:"Follow up questions",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",typing:"Assistant is typing",loading:"Loading",empty:"No messages yet",transcript:"Conversation",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting\u2026",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openMenu:"Open menu",openMenuUnread:"Open menu, unread chats",yourPets:"Your Pets",yourPet:"Your pet",switchActivePet:"Switch active pet, {name}",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active \xB7 ",close:"Close",addAnotherPet:"Add another pet",addPet:"Add a pet",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function B(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>{let o=t[n];return o===void 0?r:String(o)})}i(B,"fillCopy");var Cr=Object.freeze([Object.freeze({key:"inaccurate",label:p.feedbackReasonInaccurate,feedbackType:"wrong"}),Object.freeze({key:"outdated",label:p.feedbackReasonOutdated,feedbackType:"outdated"}),Object.freeze({key:"unsafe",label:p.feedbackReasonUnsafe,feedbackType:"dangerous"}),Object.freeze({key:"unclear",label:p.feedbackReasonUnclear,feedbackType:"unclear"}),Object.freeze({key:"other",label:p.feedbackReasonOther,feedbackType:"not_helpful"})]),Zn=Object.freeze([Object.freeze({sentiment:"up",label:p.feedbackHelpful}),Object.freeze({sentiment:"neutral",label:p.feedbackNeutral}),Object.freeze({sentiment:"down",label:p.feedbackNotHelpful})]);function Sl(e){switch(e){case "up":return "helpful";case "neutral":return "neutral";case "down":return "not_helpful"}}i(Sl,"sentimentToFeedbackType");function Jn(e,t){if(e==="down"&&t!==null){let r=Cr.find(n=>n.key===t);if(r!==void 0)return r.feedbackType}return Sl(e)}i(Jn,"feedbackTypeFor");var eo=Symbol.for("@everfur/sdk#EverfurContext@v1"),to=globalThis,ro=to[eo]??(to[eo]=createContext(null));ro.displayName??="EverfurContext";function ie(){let e=useContext(ro);if(e===null)throw new lt("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(ie,"useEverfurContext");var xl=Object.freeze({status:"idle",messages:Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:Object.freeze([]),unreadCount:null});function xt(e){let{runtime:t,userRef:r,activePet:n,scopeEpoch:o}=ie(),a=e?.petRef??n??null,s=e?.conversationId??null,d=useMemo(()=>({runtime:t,userRef:r,petRef:a,conversationId:s,scopeEpoch:o}),[t,r,a,s,o]),[l,c]=useState(null),u=l?.scope===d?l.controller:t.registry.peekChat({userRef:r,petRef:a,conversationId:s}),f=useRef(null);useEffect(()=>{let P=t.registry.acquireChat({userRef:r,petRef:a,conversationId:s});return f.current=P,c({scope:d,controller:P}),()=>{f.current=null,c(k=>k?.controller===P?null:k),t.registry.releaseChat(P);}},[t,r,a,s,o,d]);let y=useCallback(P=>u?u.subscribe(P):Il,[u]),b=useCallback(()=>u?u.getSnapshot():xl,[u]),g=useSyncExternalStore(y,b,b),x=useCallback((P,k)=>u&&f.current===u&&!u.getSnapshot().isBootstrapping?Rr(u,u.send(P,k?.imageS3Keys===void 0?{}:{imageS3Keys:k.imageS3Keys}),()=>f.current===u):Promise.resolve(Sr()),[u]),m=useCallback(P=>u&&f.current===u&&!u.getSnapshot().isBootstrapping?Rr(u,u.askEverfur(P),()=>f.current===u):Promise.resolve(Sr()),[u]),T=useCallback(()=>u&&f.current===u?Rr(u,u.retryLast(),()=>f.current===u):Promise.resolve(Sr()),[u]),I=useCallback(()=>{u&&f.current===u&&u.stop();},[u]),O=useCallback(()=>{u&&f.current===u&&u.adoptConversation(null);},[u]),[F,h]=useState({controller:null,byMessage:{}}),E=F.controller===u?F.byMessage:Al,R=useCallback(async(P,k,M,H)=>{if(!u||f.current!==u)return V(j("accessDenied"));let X=String(P),U=F.controller===u?F.byMessage[X]:void 0;if(U===k&&M==null)return h(oe=>{let z={...oe.controller===u?oe.byMessage:{}};return delete z[X],{controller:u,byMessage:z}}),le(Object.freeze({feedbackId:""}));h(oe=>({controller:u,byMessage:{...oe.controller===u?oe.byMessage:{},[X]:k}}));let te=await u.submitFeedback(P,Jn(k,M??null),H??null);return f.current!==u?V(j("accessDenied")):(te.ok||h(oe=>{let z={...oe.controller===u?oe.byMessage:{}};return U===void 0?delete z[X]:z[X]=U,{controller:u,byMessage:z}}),te)},[u,F]),L=useMemo(()=>{let P=i(async k=>{if(!u||f.current!==u)return V(j("accessDenied"));let M=await k(u);return f.current===u?M:V(j("accessDenied"))},"run");return {listConversations:i(k=>P(M=>M.listConversations({...a?{petRef:a}:{},...k})),"listConversations"),getMessages:i((k,M)=>P(H=>H.getMessages(k,M)),"getMessages"),resumeConversation:i(k=>P(M=>M.resumeConversation(k)),"resumeConversation"),loadOlderMessages:i(()=>P(k=>k.loadOlderMessages()),"loadOlderMessages"),markRead:i(()=>P(k=>k.markRead()),"markRead"),refreshActiveThread:i(()=>P(k=>k.refreshActiveThread()),"refreshActiveThread"),answerCheckin:i((k,M)=>P(H=>H.answerCheckin(k,M)),"answerCheckin"),openCheckin:i(k=>P(M=>M.openCheckin(k)),"openCheckin")}},[u,a]);return useMemo(()=>({status:g.status,messages:g.messages,conversationId:g.conversationId,petRef:a,error:g.error,isStreaming:g.isStreaming,isBootstrapping:g.isBootstrapping,historyCursor:g.historyCursor??null,isLoadingHistory:g.isLoadingHistory??false,stopped:g.stopped??false,reconnecting:g.reconnecting??false,...L,suggestedPrompts:g.suggestedPrompts,unreadCount:g.unreadCount,hasUnreadThreads:g.hasUnreadThreads??false,newConversation:O,sentimentByMessage:E,feedback:R,send:x,askEverfur:m,retryLast:T,stop:I}),[g,a,x,m,T,I,L,O,E,R])}i(xt,"useEverfurChat");var Il=i(()=>{},"NOOP_UNSUBSCRIBE"),Al=Object.freeze({});async function Rr(e,t,r){for await(let o of t);if(!r())return V(j("accessDenied"));let n=e.getSnapshot();return n.status==="error"&&n.error!==null?V(n.error):le(Ol(n.messages))}i(Rr,"driveToResult");function Ol(e){for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r&&r.role==="assistant"&&r.responseId!==void 0)return r.responseId}return null}i(Ol,"lastAssistantResponseId");function Sr(){return V(j("internalError",{retryable:true}))}i(Sr,"notReadyError");function Pr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))Pr(e[t]);}return e}i(Pr,"deepFreeze");var Fl=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),io={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},ao={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},oo={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Ml={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Vl={regular:"400",medium:"500",bold:"700"},Dl={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Ll=0,It="System",At="monospace",Nl=["content","heading","control","compact","badge"];function Hl(e){let t={};for(let r of Nl)t[r]=e;return t}i(Hl,"authoredTierSizes");function so(){return {family:It,mono:At,fontUrl:null,families:{regular:It,medium:It,bold:It,mono:At,monoMedium:At,monoBold:At},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:oo,tierSizes:Hl(oo),lineHeight:Ml,weight:Vl,letterSpacing:Dl,scale:1,maxScale:Ll,scaleCaps:Fl}}i(so,"baseType");var lo={},Le=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function Ot(e){return `cubic-bezier(${e.join(", ")})`}i(Ot,"cssCubicBezier");var co={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:Ot(Le.standard),emphasized:Ot(Le.emphasized),exit:Ot(Le.exit)},reducedMotion:false},Ul={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:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",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:"#B91C1C",errorRed:"#FF1B00",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(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},uo=Pr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Ul,space:io,radius:ao,type:so(),motion:co,slots:lo}),zl={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:"#9A938C",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",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",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};Pr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:zl,space:io,radius:ao,type:so(),motion:co,slots:lo});var po=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),fo=globalThis,Tr=fo[po]??(fo[po]=createContext(uo));Tr.displayName??="EverfurThemeContext";function _(){return useContext(Tr)}i(_,"useEverfurTheme");function Yl(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(Yl,"tierMultiplier");function v({tier:e="content",...t}){let{type:r}=_(),n=Yl(r,e);return createElement(Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}i(v,"Text");var Qe=forwardRef(i(function(t,r){return createElement(TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));function Ft(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(Ft,"assertNever");function mo(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}i(mo,"errorFrame");function re(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}i(re,"slotBox");function kr(e){return e===void 0||e.backgroundColor!==void 0?e:e.borderRadius===void 0?void 0:{borderRadius:e.borderRadius}}i(kr,"ownGroundSlot");function fe(e){return e?.textColor===void 0?{}:{color:e.textColor}}i(fe,"slotText");var Ql=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function C(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Ql[t]]}}i(C,"face");function Xl(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}i(Xl,"authHeaders");function dt(e,t){return {...e,headers:{...Zl(e.headers),...Xl(t)}}}i(dt,"withAuthHeaders");function Zl(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();o==="authorization"||o==="x-everfur-partner-key"||(t[r]=n);}return t}i(Zl,"stripAuthHeaders");async function go(e,t){if(t.mode==="anonymous")return t.transport.request(dt(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return V(wr())}let n=await t.transport.request(dt(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let o;try{o=await t.identity.currentToken({forceRefresh:!0});}catch{return V(wr())}let a=await t.transport.request(dt(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?V(wr(a.error.httpStatus)):a}i(go,"authedSend");function wr(e){return j("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(wr,"authRejectedError");function ho(e){return j("internalError",{retryable:true,wireMessage:Jl(e)})}i(ho,"networkError");function Jl(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i(Jl,"describeCause");var ed=3e4,td=br*2,rd="idempotency-key",nd=new Set(["POST","PUT","PATCH","DELETE"]),od=Object.freeze({onEvent(){}}),id=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Ne(e){let t=e.observer??od,r=e.timers??id,n=e.rng??Math.random,o=e.sleep??((y,b)=>bd(y,r,b)),a=e.maxAttempts??$n,s=e.unaryTimeoutMs??ed,d=e.newIdempotencyKey??sd(),l=i(y=>{try{t.onEvent(y);}catch{}},"emit");async function c(y,b,g){let x=g?.maxAttempts,m=Math.max(1,x??a),I=g?.idempotent??nd.has(b.method)?d():null,O=ad(b,I),F=0;for(;;){let h=i(H=>Object.freeze({call:y,method:b.method,path:b.path,attempt:F,...I?{idempotencyKey:I}:{},...H}),"stamp");l(h({phase:"attempt"}));let E=gd(s,r),R=hd(E.signal,b.signal),L;try{L=await go({...O,signal:R.signal},e.auth);}catch(H){L=V(ho(H));}finally{R.dispose(),E.cancel();}if(L.ok)return l(h({phase:"settled",ok:true,reason:"ok"})),L;let P=L.error,k=dd(P,F,{maxAttempts:m,rng:n,now:r.now(),aborted:b.signal?.aborted===true,...x!==void 0?{perCallMaxAttempts:x}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),M={ok:false,code:P.code,reason:k.reason,...P.httpStatus!==void 0?{httpStatus:P.httpStatus}:{},...P.requestId!==void 0?{requestId:P.requestId}:{}};if(!k.retry)return l(h({phase:"settled",...M})),V(P);if(l(h({phase:"retry",...M,delayMs:k.delayMs})),await o(k.delayMs,b.signal),b.signal?.aborted===true)return l(h({phase:"settled",...M,reason:"aborted"})),V(P);F+=1;}}i(c,"send");async function u(y){return dt(y,await md(e.auth))}i(u,"authorize");async function*f(y,b,g){l(Object.freeze({call:y,phase:"stream.open",method:b.method,path:b.path,attempt:0}));try{yield*e.auth.transport.stream(b,g);}catch{yield mo({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(f,"stream"),Object.freeze({send:c,authorize:u,stream:f})}i(Ne,"createRequestFunnel");function ad(e,t){let r={};for(let[n,o]of Object.entries(e.headers??{}))n.toLowerCase()!==rd&&(r[n]=o);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(ad,"assembleHeaders");function sd(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(sd,"defaultIdempotencyKeyFactory");var ld=10;function dd(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=cd(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!hr(e.code))return {retry:false,reason:"terminal-code"};let o=n==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=i(()=>{if(r.policy===void 0)return null;let c;try{c=r.policy.maxAttempts(e.code);}catch{return null}return typeof c!="number"||!Number.isFinite(c)?null:Math.max(1,Math.min(ld,Math.floor(c)))},"policyCeiling"),d=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=d)return {retry:false,reason:"attempts-exhausted"};let l=ud(e,r.now);return l!==null?l>td?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:o,delayMs:l}:{retry:true,reason:o,delayMs:Qn(t,r.rng)}}i(dd,"decideRetry");function cd(e){let t=e.code==="unknown"?Yn(yd(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(cd,"throttleKind");function ud(e,t){let r=pd(e.raw);if(r===null)return null;let n=r-t;return n>0?n:0}i(ud,"retryOverrideMs");function pd(e){for(let t of vo(e)){let r=t.resets_at,n=fd(r);if(n!==null)return n}return null}i(pd,"findResetsAt");function vo(e){if(!bo(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];bo(n)&&t.push(n);}return t}i(vo,"candidateScopes");function fd(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}i(fd,"parseInstantMs");function yd(e){for(let t of vo(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(yd,"rawWireCode");function bo(e){return typeof e=="object"&&e!==null}i(bo,"isRecord");async function md(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}i(md,"resolveDeviceAuth");function gd(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(n),"cancel")}}i(gd,"boundedSignal");function hd(e,t){let r=i(()=>{},"noop");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 o=i(()=>n.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),{signal:n.signal,dispose:i(()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o);},"dispose")}}i(hd,"mergeSignals");function bd(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let o=t.setTimeout(()=>{r?.removeEventListener("abort",a),n();},e),a=i(()=>{t.clearTimeout(o),n();},"onAbort");r?.addEventListener("abort",a,{once:true});})}i(bd,"delayAbortable");function Mt(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(Mt,"hasLoneSurrogate");function Vt(e){return [...e].length}i(Vt,"serverLength");var Co=Object.freeze(["better","same","worse"]);var Eo=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Ro(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let o={handle:void 0},a=i(()=>{r.clearTimeout(o.handle),t.removeEventListener("abort",a),n();},"done");o.handle=r.setTimeout(a,e),t.addEventListener("abort",a,{once:true});})}i(Ro,"delayAbortable");var vd="watching";function So(e){return e.status!=null&&e.status!==vd}i(So,"isCheckinSettled");var Po=5,_r=4e3;var xr=4e3;var Cd=Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function To(e){return e!==Cd}i(To,"isUploadTransportAvailable");var Ed=Object.freeze(["image/jpeg","image/jpg","image/png","image/heic","image/heif","image/webp"]);var Dt=10*1024*1024,Lt=Po,ct=120,Rd="/widget/v1/uploads/initiate";function Sd(e){return typeof e=="string"&&Ed.includes(e.trim().toLowerCase())}i(Sd,"isAttachmentMime");function Ir(e){if(!e)return "attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return "attachment";if(t.length<=ct)return t;let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return t.slice(0,ct);let n=t.slice(r);return n.length>=ct?t.slice(0,ct):`${t.slice(0,r).slice(0,ct-n.length)}${n}`}i(Ir,"sanitizeFilename");function Ar(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}i(Ar,"formatBytes");var ut=i(e=>Object.freeze({ok:true,value:e}),"ok"),ye=i(e=>Object.freeze({ok:false,error:e}),"err");function Z(e,t,r,n){return Object.freeze({code:e,retryable:t,filename:r,...n??{}})}i(Z,"failure");function Pd(e){if(typeof e.sizeBytes=="number"&&Number.isFinite(e.sizeBytes)&&e.sizeBytes>=0)return e.sizeBytes;let t=e.blob;return t!==void 0&&typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}i(Pd,"attachmentSize");function Td(e){let t=Ir(e.name),r=typeof e.mimeType=="string"?e.mimeType.trim().toLowerCase():"";if(!Sd(r))return ye(Z("unsupported_type",false,t));let n=Pd(e);return n===null?ye(Z("unknown",false,t)):n>Dt?ye(Z("too_large",false,t,{sizeBytes:n})):ut(Object.freeze({file:e,filename:t,contentType:r,sizeBytes:n}))}i(Td,"validateAttachment");function kd(e){if(typeof e!="object"||e===null)return null;let t=e,r=i(c=>typeof c=="string"&&c.length>0?c:null,"str"),n=i(c=>typeof c=="number"&&Number.isFinite(c)?c:null,"num"),o=r(t.upload_id),a=r(t.upload_url),s=r(t.s3_key);if(o===null||a===null||s===null)return null;let d={},l=t.upload_fields;if(typeof l=="object"&&l!==null)for(let[c,u]of Object.entries(l))typeof u=="string"&&(d[c]=u);return Object.freeze({upload_id:o,upload_url:a,upload_fields:Object.freeze(d),expires_in_seconds:n(t.expires_in_seconds)??0,max_content_length:n(t.max_content_length)??Dt,s3_key:s,purpose:r(t.purpose)})}i(kd,"parsePolicy");function wd(e,t){let r=e.httpStatus;switch(e.code){case "quotaExceeded":return Z("quota_exceeded",false,t,{cause:e});case "rateLimited":return Z("rate_limited",true,t,{cause:e});case "idempotencyConflict":case "idempotencyInFlight":return Z("idempotency_conflict",true,t,{cause:e});case "validationFailed":return Z("unsupported_type",false,t,{cause:e});case "serviceUnavailable":case "streamTimeout":return Z("network",true,t,{cause:e});default:return r===429?Z("rate_limited",true,t,{cause:e}):r===503?Z("network",true,t,{cause:e}):r===void 0?Z("network",true,t,{cause:e}):Z("server",e.retryable,t,{httpStatus:r,cause:e})}}i(wd,"initiateFailure");async function _d(e,t,r){let n=await e.send("chat.attachments.initiate",{method:"POST",path:Rd,body:{filename:t.filename,content_type:t.contentType,file_size:t.sizeBytes},...r?.signal?{signal:r.signal}:{}});if(!n.ok)return ye(wd(n.error,t.filename));let o=kd(n.value);return o===null?ye(Z("server",false,t.filename)):ut(o)}i(_d,"initiateAttachmentUpload");async function xd(e,t,r,n){let o=i(()=>n?.signal?.aborted===true,"cancelled");if(o())return ye(Z("cancelled",true,r.filename));try{return await e.postMultipart(t,r.file,{...n?.signal?{signal:n.signal}:{},...n?.onProgress?{onProgress:n.onProgress}:{}}),ut(void 0)}catch{return o()?ye(Z("cancelled",true,r.filename)):ye(Z("server",true,r.filename))}}i(xd,"uploadAttachmentBytes");var Id=2,Ad=3,Od=Object.freeze([1e3,2e3,4e3]),ko=0;function Fd(){return ko+=1,`attachment-${ko}`}i(Fd,"defaultNewId");function wo(e){let t=Math.max(1,e.concurrency??Id),r=Math.max(1,e.maxAttempts??Ad),n=e.backoffMs??Od,o=Math.max(1,e.maxPerMessage??Lt),a=e.timers??Eo,s=e.newId??Fd,d=To(e.transport),l=new Map,c=[],u=[],f=new Set,y=new Set,b=Object.freeze({attachments:Object.freeze([])}),g=false,x=i(()=>{b=Object.freeze({attachments:Object.freeze(c.flatMap(h=>{let E=l.get(h);return E===void 0?[]:[E.state]}))});for(let h of y)h();},"publish"),m=i((h,E)=>{h.state=Object.freeze({...h.state,...E}),x();},"patch"),T=i(()=>{for(;!g&&f.size<t&&u.length>0;){let h=u.shift(),E=l.get(h);E!==void 0&&(f.add(h),I(E).finally(()=>{f.delete(h),T();}));}},"pump"),I=i(async h=>{let{attachment:E}=h;for(;h.attempts<r;){if(g||h.controller.signal.aborted)return;h.attempts+=1;let R=h.controller.signal;m(h,{status:"uploading",error:null,progress:0});let L=await _d(e.funnel,E,{signal:R});if(g||R.aborted)return;let P;if(!L.ok)P=ye(L.error);else {let X=await xd(e.transport,L.value,E,{signal:R,onProgress:i(U=>{!R.aborted&&h.state.status==="uploading"&&m(h,{progress:Md(U)});},"onProgress")});if(g||R.aborted)return;P=X.ok?ut(L.value.s3_key):ye(X.error);}if(P.ok){m(h,{status:"uploaded",s3Key:P.value,error:null,progress:1});return}let k=P.error,M=k.retryable&&h.attempts<r;if(m(h,{status:M?"uploading":"failed",error:k,progress:0}),!M)return;let H=n[Math.min(h.attempts-1,n.length-1)]??0;await Ro(H,R,a);}},"run"),O=i(h=>{u.push(h.state.id),T();},"enqueue"),F={available:d,subscribe(h){return y.add(h),()=>{y.delete(h);}},getSnapshot:i(()=>b,"getSnapshot"),get uploading(){return b.attachments.some(h=>h.status==="uploading")},get s3Keys(){return b.attachments.flatMap(h=>h.status==="uploaded"&&h.s3Key!==null?[h.s3Key]:[])},add(h){let E=Td(h);if(!E.ok)return E;if(g||c.length>=o)return ye(Z("too_many",false,E.value.filename));let R=s(),L={attachment:E.value,controller:new AbortController,attempts:0,state:Object.freeze({id:R,filename:E.value.filename,previewUri:h.uri,contentType:E.value.contentType,sizeBytes:E.value.sizeBytes,status:"uploading",s3Key:null,error:null,progress:0})};return l.set(R,L),c.push(R),x(),O(L),ut(L.state)},retry(h){let E=l.get(h);E===void 0||g||E.state.status!=="failed"||(E.controller=new AbortController,E.attempts=0,m(E,{status:"uploading",error:null,progress:0,s3Key:null}),O(E));},remove(h){let E=l.get(h);if(E===void 0)return;E.controller.abort(),l.delete(h);let R=c.indexOf(h);R>=0&&c.splice(R,1);let L=u.indexOf(h);L>=0&&u.splice(L,1),x();},clear(){for(let h of [...c])F.remove(h);},dispose(){g=true;for(let h of l.values())h.controller.abort();l.clear(),c.length=0,u.length=0,y.clear(),b=Object.freeze({attachments:Object.freeze([])});}};return F}i(wo,"createAttachmentQueue");function Md(e){return Number.isNaN(e)||e<0?0:e>1?1:e}i(Md,"clamp");function xo(e){switch(e.code){case "too_large":return B(p.attachmentTooLarge,{max:Ar(Dt),filename:e.filename,size:Ar(e.sizeBytes??0)});case "too_many":return B(p.attachmentTooMany,{max:Lt});case "unsupported_type":return B(p.attachmentUnsupported,{filename:e.filename});case "network":return p.attachmentNetwork;case "server":return B(p.attachmentServer,{status:e.httpStatus?` (${e.httpStatus})`:""});case "cancelled":return p.attachmentCancelled;case "rate_limited":return p.attachmentRateLimited;case "quota_exceeded":return p.attachmentQuota;case "idempotency_conflict":return p.attachmentConflict;case "unknown":return p.attachmentUnknown}}i(xo,"attachmentErrorMessage");function Io(e,t){return B(e>=t?p.attachmentsFull:p.addAttachment,{used:e,total:t})}i(Io,"attachControlLabel");var Nd=Object.freeze({attachments:Object.freeze([])});function Or(e={}){let{runtime:t,userRef:r,scopeEpoch:n}=ie(),o=e.maxPerMessage??Lt,a=useMemo(()=>{if(e.queue)return e.queue;let{services:m}=t.registry;return wo({funnel:Ne({auth:m.authFor(r),...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}}),transport:e.transport??m.uploadTransport,maxPerMessage:o})},[t,r,n,o,e.queue,e.transport]);useEffect(()=>()=>{a!==e.queue&&a.dispose();},[a,e.queue]);let s=useSyncExternalStore(a.subscribe,a.getSnapshot,()=>Nd),[d,l]=useState(null),c=useCallback(m=>{let I=(Array.isArray(m)?m:[m]).map(F=>a.add(F)),O=I.find(F=>!F.ok);return O!==void 0&&!O.ok&&l(O.error),I},[a,l]),u=useCallback(m=>a.retry(m),[a]),f=useCallback(m=>a.remove(m),[a]),y=useCallback(()=>a.clear(),[a]),b=useCallback(()=>l(null),[l]),g=s.attachments.some(m=>m.status==="uploading"),x=s.attachments.some(m=>m.status==="failed");return useMemo(()=>({available:a.available,attachments:s.attachments,maxPerMessage:o,uploading:g,failed:x,blocked:g||x,s3Keys:s.attachments.flatMap(m=>m.status==="uploaded"&&m.s3Key!==null?[m.s3Key]:[]),rejected:d,add:c,retry:u,remove:f,clear:y,dismissRejected:b}),[a.available,s,o,g,x,d,c,u,f,y,b])}i(Or,"useChatAttachments");var Ao=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Nt(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(Ao,t)?Ao[t]:null}i(Nt,"canonicalPetSpecies");var Oo=50,Hd=128,Fr=120,Fo=120,Ud=2e3,Mo=120,zd=80,Lo=new Set(["male","female","unknown"]),No=new Set(["day","month","year"]),Ho=new Set(["low","medium","high","athletic"]),Uo=new Set(["indoor","outdoor","both"]),zo=new Set(["mild","moderate","severe"]),Bd=/^(\d{4})-(\d{2})-(\d{2})$/,Bo=[["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"]],jo=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...Bo,...jo].map(([e])=>e));function jd(e){let t=Bd.exec(e);if(t===null)return false;let[r,n,o]=[Number(t[1]),Number(t[2]),Number(t[3])],a=new Date(Date.UTC(r,n-1,o));return a.getUTCFullYear()===r&&a.getUTCMonth()===n-1&&a.getUTCDate()===o}i(jd,"isRealDate");var yt=i(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),Wd=i((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),Ut=i((e,t)=>typeof t=="string"&&jd(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),ve=i((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(Mt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let o=t.trimmed?n.trim():n;if(t.required&&o.length===0)return `${r} is required and must not be blank`;let a=Vt(o);return a<=e?null:`${r} is ${a} characters; the server accepts at most ${e}`},"text"),Gd={sex:yt(Lo),spayedNeutered:Wd,birthDate:Ut,birthDatePrecision:yt(No),activityLevel:yt(Ho),indoorOutdoor:yt(Uo),foodBrand:ve(Mo),foodType:ve(Mo),microchipId:ve(zd)},Mr=["ref","ref",false,ve(Hd,{required:true,trimmed:true})],Vr=["notes","notes",false,ve(Ud,{trimmed:true})],Vo=[Mr,["name","name",true,ve(Fr,{required:true,trimmed:true})],["dose","dose",false,ve(Fo,{trimmed:true})],["frequency","frequency",false,ve(Fo,{trimmed:true})],["startDate","start_date",false,Ut],["endDate","end_date",false,Ut],Vr],qd={allergies:[Mr,["allergen","allergen",true,ve(Fr,{required:true,trimmed:true})],["severity","severity",false,yt(zo)],Vr],medications:Vo,supplements:Vo,conditions:[Mr,["conditionName","condition_name",true,ve(Fr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Ut],Vr]};function Yd(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let o=r,a={};for(let[l,c,u,f]of qd[e]){let y=o[l];if(y==null){if(u)return {error:`${n}.${l} is required`};y===null&&(a[c]=null);continue}let b=f(`${n}.${l}`,y);if(b!==null)return {error:b};a[c]=y;}let s=a.start_date,d=a.end_date;return typeof s=="string"&&typeof d=="string"&&d<s?{error:`${n}.endDate must not be before startDate`}:{item:a}}i(Yd,"itemToWire");function Kd(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>Oo)return {error:`${e} has ${t.length} items; the server accepts at most ${Oo}`};let r=[],n=new Set;for(let o=0;o<t.length;o+=1){let a=Yd(e,o,t[o]);if("error"in a)return a;let s=a.item.ref;if(typeof s=="string"){let d=s.trim();if(n.has(d))return {error:`${e}: ref ${JSON.stringify(d)} is used twice; a ref names one item`};n.add(d);}r.push(a.item);}return {items:r}}i(Kd,"listToWire");function Wo(e,t){let r=e,n={};for(let[s,d]of Bo){let l=r[s];if(l!==void 0){if(l!==null){let c=Gd[s](s,l);if(c!==null)return {error:c}}n[d]=l;}}let o=r.birthDate!==void 0,a=r.birthDatePrecision!==void 0;if(o!==a||o&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[s,d]of jo){let l=r[s];if(l===void 0)continue;let c=Kd(s,l);if("error"in c)return c;n[d]=c.items;}return Object.keys(n).length>0&&t!==void 0&&Nt(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}}i(Wo,"petHealthToWire");var K=i(e=>typeof e=="string"?e:null,"str"),ft=i((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),$d=i(e=>typeof e=="boolean"?e:null,"bool");function Ht(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}i(Ht,"itemsFromWire");function Do(e){let t=K(e.name);return t===null||t.length===0?null:Object.freeze({ref:K(e.ref),name:t,dose:K(e.dose),frequency:K(e.frequency),startDate:K(e.start_date),endDate:K(e.end_date),notes:K(e.notes)})}i(Do,"medicationFromWire");function Go(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:ft(Lo,e.sex),spayedNeutered:$d(e.spayed_neutered),birthDate:K(e.birth_date),birthDatePrecision:ft(No,e.birth_date_precision),activityLevel:ft(Ho,e.activity_level),indoorOutdoor:ft(Uo,e.indoor_outdoor),foodBrand:K(e.food_brand),foodType:K(e.food_type),microchipId:K(e.microchip_id),allergies:Ht(e.allergies,r=>{let n=K(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:K(r.ref),allergen:n,severity:ft(zo,r.severity),notes:K(r.notes)})}),medications:Ht(e.medications,Do),supplements:Ht(e.supplements,Do),conditions:Ht(e.conditions,r=>{let n=K(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:K(r.ref),conditionName:n,diagnosedDate:K(r.diagnosed_date),notes:K(r.notes)})})})}i(Go,"petHealthFromWire");var Ko=100,$o=50,Qo=100,Xo=50,Zo=500,Qd=128,Xd=6e4;function Ee(e){return j("validationFailed",{retryable:false,wireMessage:e})}i(Ee,"invalid");function He(e,t,r){if(typeof t!="string")return Ee(`${e} must be a string`);let n=Vt(t);return n<=r?null:Ee(`${e} is ${n} characters; the server accepts at most ${r}`)}i(He,"checkString");function zt(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Ee(`${e} must be a finite number between 0 and ${r}`)}i(zt,"outOfRange");function qo(e,t){if(typeof e!="string")return Ee("pet_ref must be a string");if(e.trim().length===0)return Ee("pet_ref must not be blank");if(Mt(e))return Ee("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return Ee("profile must be an object");let r=[He("pet_ref",e,Qd)];return t?.name!==void 0&&r.push(He("name",t.name,Ko)),t?.species!==void 0&&r.push(He("species",t.species,$o)),t?.breed!==void 0&&r.push(He("breed",t.breed,Qo)),t?.ageYears!==void 0&&r.push(zt("age_years",t.ageYears,Xo)),t?.weightKg!==void 0&&r.push(zt("weight_kg",t.weightKg,Zo)),r.find(n=>n!==null)??null}i(qo,"validate");function Jo(e,t){let r=Wo(e,t);return "error"in r?{error:Ee(r.error)}:r}i(Jo,"healthToWire");function Zd(e){if(typeof e!="object"||e===null)return {error:Ee("patch must be an object")};let t=e,r=[["name","name",a=>He("name",a,Ko)],["species","species",a=>He("species",a,$o)],["breed","breed",a=>He("breed",a,Qo)],["ageYears","age_years",a=>zt("age_years",a,Xo)],["weightKg","weight_kg",a=>zt("weight_kg",a,Zo)]],n={};for(let[a,s,d]of r){let l=t[a];if(l!==void 0){if(l!==null){let c=d(l);if(c!==null)return {error:c}}n[s]=l;}}let o=Jo(t,t.species);return "error"in o?o:(Object.assign(n,o.body),Object.keys(n).length===0?{error:Ee("patch must change at least one field")}:{body:n})}i(Zd,"patchToWire");function Jd(e){if(e==null)return {body:{}};let t=Jo(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}}}i(Jd,"toWire");var Ce=i(e=>typeof e=="string"?e:null,"str"),Bt=i(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function Yo(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:Ce(r.pet_ref)??t,name:Ce(r.name),species:Ce(r.species),breed:Ce(r.breed),ageYears:Bt(r.age_years),weightKg:Bt(r.weight_kg)})}i(Yo,"fromWire");function ei(e){if(typeof e!="object"||e===null)return null;let t=e,r=Ce(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:Ce(t.pet_id),petRef:r,name:Ce(t.name),species:Ce(t.species),breed:Ce(t.breed),ageYears:Bt(t.age_years),weightKg:Bt(t.weight_kg),updatedAt:Ce(t.updated_at)})}i(ei,"widgetPetFromWire");function ec(e){let t=ei(e);return t===null?null:Object.freeze({...t,...Go(e)})}i(ec,"widgetPetProfileFromWire");function tc(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=ei(r);return n===null?[]:[n]}))}i(tc,"petListFromWire");function jt(e){return rc(Ne({auth:e}),Ne({auth:e,unaryTimeoutMs:Xd}))}i(jt,"createPetsRepository");function rc(e,t=e){let r=i((o,a)=>a?{...o,signal:a}:o,"withSignal"),n=i(o=>qo(o,void 0)??`/widget/v1/pets/${encodeURIComponent(o)}`,"petPath");return {async list(o){let a=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},o?.signal));return a.ok?le(tc(a.value)):V(a.error)},async registerPet(o,a,s){let d=qo(o,a);if(d!==null)return V(d);let l=Jd(a);if("error"in l)return V(l.error);let u={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(o)}`,body:l.body},f=await e.send("pets.registerPet",s?.signal?{...u,signal:s.signal}:u);return f.ok?le(Yo(f.value,o)):V(f.error)},async updatePet(o,a,s){let d=n(o);if(typeof d!="string")return V(d);let l=Zd(a);if("error"in l)return V(l.error);let c=await e.send("pets.updatePet",r({method:"PATCH",path:d,body:l.body},s?.signal));return c.ok?le(Yo(c.value,o)):V(c.error)},async getPetProfile(o,a){let s=n(o);if(typeof s!="string")return V(s);let d=await e.send("pets.getPetProfile",r({method:"GET",path:`${s}/profile`},a?.signal));if(!d.ok)return V(d.error);let l=ec(d.value);return l===null?V(j("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):le(l)},async deletePet(o,a){let s=n(o);if(typeof s!="string")return V(s);let d=await e.send("pets.deletePet",r({method:"DELETE",path:s},a?.signal));return d.ok?le(void 0):V(d.error)},async eraseUserData(o){let a=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},o?.signal),{maxAttempts:1});return a.ok?le(void 0):V(a.error)}}}i(rc,"createPetsRepositoryOver");var ic="pet_not_registered";function ni(e){return e!=null&&e.reasonCode===ic}i(ni,"isPetNotRegistered");var ac=Object.freeze({status:"idle",error:null,registered:null,retry:i(()=>{},"retry")});function oi(e,t,r){let{runtime:n,userRef:o,scopeEpoch:a}=ie(),s=useCallback(()=>jt(n.registry.services.authFor(o)),[n,o,a]),d=useMemo(()=>t===void 0?null:Lr(t),[t]),[l,c]=useState({key:null,status:"idle",error:null,registered:null}),u=useRef(0),f=useRef(r);f.current=r;let y=e===null||d===null?null:`${String(o)}|${a}|${e}|${d}`,b=useCallback(()=>{if(e===null||t===void 0||y===null)return;let x=++u.current;c({key:y,status:"registering",error:null,registered:null}),s().registerPet(e,t).then(m=>{x===u.current&&(m.ok?(c({key:y,status:"registered",error:null,registered:m.value}),f.current?.()):c({key:y,status:"failed",error:m.error,registered:null}));});},[s,e,y]);useEffect(()=>{if(y===null){u.current+=1;return}return b(),()=>{u.current+=1;}},[y,b]);let g=useCallback(()=>{l.status==="failed"&&b();},[l.status,b]);return useMemo(()=>y===null?ac:l.key!==y?{status:"registering",error:null,registered:null,retry:g}:{status:l.status,error:l.error,registered:l.registered,retry:g},[y,l,g])}i(oi,"useChatPetRegistration");function Lr(e){return e===null||typeof e!="object"?JSON.stringify(e)??"undefined":Array.isArray(e)?`[${e.map(Lr).join(",")}]`:`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r<n?-1:r>n?1:0).map(([r,n])=>`${JSON.stringify(r)}:${Lr(n)}`).join(",")}}`}i(Lr,"stableKey");var mt=Object.freeze({standard:Le.standard,emphasized:Le.emphasized,exit:Le.exit,outQuad:Object.freeze([.25,.46,.45,.94])});var ii=Object.freeze({layoutMs:220,messageInMs:200,bannerInMs:220,bannerOutMs:160,iconInMs:180,iconOutMs:120,followUpInMs:180,followUpStaggerMs:70,citationsInMs:220,citationsRisePx:6,drawerMs:220,pressScale:.97,pressMs:140,revealTickMs:24,revealDivisor:12,dotsCycleMs:520,dotsMinOpacity:.44,dotsLiftPx:3.5,dotsStagger:Object.freeze([0,.18,.36]),copiedMs:1500,uploadFlashMs:600,reduced:false}),sc=Object.freeze({...ii,layoutMs:0,messageInMs:0,bannerInMs:0,bannerOutMs:0,iconInMs:0,iconOutMs:0,followUpInMs:0,followUpStaggerMs:0,citationsInMs:0,citationsRisePx:0,drawerMs:0,pressScale:1,pressMs:0,revealTickMs:0,dotsCycleMs:0,dotsMinOpacity:1,dotsLiftPx:0,reduced:true});function ai(e){return e.motion.reducedMotion?sc:ii}i(ai,"chatMotion");function Wt(e,t){return Math.max(0,t)*e.followUpStaggerMs}i(Wt,"followUpDelayMs");function si(e,t,r){if(e.reduced||t>=r)return r;let n=Math.max(1,Math.ceil((r-t)/e.revealDivisor));return Math.min(r,t+n)}i(si,"nextRevealLength");var Nr=Object.freeze({});function di(e){let[t,r]=useState(Nr),n=useRef(null),o=useRef([]);o.current=e.map(s=>s.id),useEffect(()=>{if(e.length===0){n.current=null,r(l=>l===Nr?l:Nr);return}let s=n.current;if(s===null)return;let d=e.find(l=>l.role==="user"&&!s.known.has(l.id));d!==void 0&&(n.current=null,r(l=>({...l,[d.id]:s.images})));},[e]);let a=useCallback(s=>{n.current=s.length===0?null:{images:s,known:new Set(o.current)};},[]);return useMemo(()=>({byMessage:t,stage:a}),[t,a])}i(di,"useSentImages");var fc=500;function Hr(e){if(!e)return null;let t=e.replace(/[\u0000-\u001F\u007F-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g," ").replace(/\s+/g," ").trim();return t?t.slice(0,fc):null}i(Hr,"sanitizeSeedPrompt");function ui(e,t,r){let n=Hr(r),o=useRef(e);o.current=e;let a=useRef(null);useEffect(()=>{if(n===null||t||a.current===n)return;let s=o.current;s!==void 0&&(a.current=n,Promise.resolve(s(n)).catch(()=>{}));},[n,t]);}i(ui,"useInitialAsk");function yc(e,t,r){if(e==="announced")return false;let n=r.lastRefresh;return n===null||n.conversationId!==t?false:r.now-n.at<15e3}i(yc,"isCoalesced");function pi(e,t){let r=t.activeConversationId;return r===null||r.length===0?{action:"skip",reason:"no_thread"}:t.isTurnInFlight?{action:"defer",reason:"turn_in_flight"}:t.isOffline?{action:"defer",reason:"offline"}:yc(e,r,t)?{action:"skip",reason:"coalesced"}:{action:"refresh",conversationId:r}}i(pi,"decideChatRefresh");function Ur(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}i(Ur,"reportHostFailure");function mc(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}i(mc,"isThenable");function W(e,...t){if(typeof e=="function")try{let r=e(...t);return mc(r)&&Promise.resolve(r).then(void 0,Ur),r}catch(r){Ur(r);return}}i(W,"callHost");var fi=new WeakMap;function yi(e){if(typeof e!="function")return;let t=fi.get(e);if(t!==void 0)return t;let r=i((...n)=>{W(e,...n);},"guarded");return fi.set(e,r),r}i(yi,"guardHost");function Xe(e,...t){let r;try{r=e(...t);}catch(n){return Ur(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}i(Xe,"callHostAsync");function gi(e,t){let r=useRef(t);r.current=t;let n=useRef(null),o=useRef(null),a=e?.isOffline===void 0?false:W(()=>e.isOffline?.()===!0)===true,s=useRef(()=>{});s.current=d=>{let{conversationId:l,isTurnInFlight:c,refresh:u}=r.current,f=pi(d,{activeConversationId:l,isTurnInFlight:c,isOffline:a,lastRefresh:n.current,now:Date.now()});if(f.action!=="skip"){if(f.action==="defer"){o.current!=="announced"&&(o.current=d);return}o.current=null,n.current={conversationId:f.conversationId,at:Date.now()},u!==void 0&&Promise.resolve(u()).catch(()=>{});}},useEffect(()=>{if(t.isTurnInFlight||a)return;let d=o.current;d!==null&&s.current(d);},[t.isTurnInFlight,a]),useEffect(()=>{if(e===void 0)return;let d=[],l=i((c,u)=>{if(c===void 0)return;let f=W(()=>c(()=>{s.current(u);}));typeof f=="function"&&d.push(f);},"subscribe");return l(e.onForeground?.bind(e),"foreground"),l(e.onOnline?.bind(e),"foreground"),l(e.onAnnounced?.bind(e),"announced"),()=>{for(let c of d)W(c);}},[e]);}i(gi,"useChatLifecycle");function hc(e){if(e===void 0)return null;let t=e.conversationId??"",r=e.petRef??"";return t===""&&r===""?null:`${String(t)}|${String(r)}`}i(hc,"targetKey");function bi(e,t){let r=hc(t),n=useRef({openCheckin:e,target:t});n.current={openCheckin:e,target:t};let o=useRef(null);useEffect(()=>{if(r===null||o.current===r)return;o.current=r;let{openCheckin:a,target:s}=n.current;a===void 0||s===void 0||Promise.resolve(a(s)).catch(()=>{});},[r]);}i(bi,"useCheckinTarget");function Ei(e,t,r){let[n,o]=useState({send:e,conversationId:t,text:r??"",seeded:r??null}),a=n.send===e&&(n.conversationId===null||n.conversationId===t);useEffect(()=>{o(d=>{let l=d.send===e&&(d.conversationId===null||d.conversationId===t),c=l?d.text:"",u=l?d.seeded:null,f=r!=null&&r!==u&&c.length===0;return {send:e,conversationId:t,text:f?r:c,seeded:f?r:u}});},[e,t,r]);let s=useCallback(d=>o(l=>({send:e,conversationId:t,text:d,seeded:l.seeded})),[e,t]);return [a?n.text:"",s]}i(Ei,"useChatDraft");function Ri(e,t,r,n){let o=useRef({draft:r,setDraft:n});o.current={draft:r,setDraft:n};let a=useRef(null),[s,d]=useState(null);useEffect(()=>{if(e===void 0)return;let l=`${t??""}`;if(a.current===l)return;a.current=l;let c=true;return (async()=>{let u=await Xe(()=>e.read(t));if(!c)return;let f=u.ok&&typeof u.value=="string"?u.value:"";f.length>0&&o.current.draft.length===0&&o.current.setDraft(f),d(l);})(),()=>{c=false;}},[e,t]),useEffect(()=>{e===void 0||s!==`${t??""}`||W(()=>e.write(t,r));},[e,t,r,s]);}i(Ri,"usePersistedDraft");var G=Object.freeze({heading:"Chat History",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No matching chats",noMatchBody:"Try a different title or start a new conversation.",loading:"Loading your chats\u2026",loadFailed:"Couldn\u2019t load your chats",loadingMore:"Loading more\u2026",untitled:"New conversation",newConversation:"New conversation",search:"Search",retry:"Try again",retryA11y:"Retry loading chats",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages\u2026",openConversation:"Open conversation",unreadPrefix:"Unread. "});function qt(e){let t=e?.replace(/\s+/g," ").trim();return t||G.untitled}i(qt,"conversationTitle");function Pi(e){return `${e.unreadCount!==null&&e.unreadCount>0?G.unreadPrefix:""}${G.openConversation} ${qt(e.title)}`}i(Pi,"openConversationLabel");function Si(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').toLowerCase().trim().replace(/\s+/g," ")}i(Si,"normalizeForSearch");function Sc(e,t){let r=Si(t);if(r.length===0)return e;let n=[[],[],[]];for(let o of e){let a=Si(qt(o.title)),s=a.indexOf(r);if(s<0)continue;let d=s===0?0:a.charAt(s-1)===" "?1:2;n[d]?.push(o);}return n.flat()}i(Sc,"filterConversations");function jr(e){return {scope:e,rows:[],cursor:null,loading:false,loadingMore:false,error:null}}i(jr,"fresh");function Ti(e){let[t,r]=useState(false),[n,o]=useState(""),a=e.listConversations,s=useRef(0),[d,l]=useState(()=>jr(a)),c=d.scope===a?d:jr(a);useEffect(()=>(s.current+=1,r(false),o(""),l(jr(a)),()=>{s.current+=1;}),[a]);let u=useCallback(async O=>{let F=++s.current,h=O!==void 0;l(R=>({...R,scope:a,loading:!h,loadingMore:h,error:null}));let E=await e.listConversations(O?{cursor:O}:void 0);if(F===s.current){if(!E.ok){l(R=>({...R,loading:false,loadingMore:false,error:E.error.displayMessage}));return}l(R=>{let L=O&&R.scope===a?R.rows:[],P=new Set(L.map(k=>k.id));return {scope:a,loading:false,loadingMore:false,error:null,rows:[...L,...E.value.conversations.filter(k=>!P.has(k.id))],cursor:E.value.nextCursor===O?null:E.value.nextCursor}});}},[e.listConversations,a]),f=i(()=>{r(true),o(""),u();},"show"),y=i(()=>{s.current+=1,r(false);},"close"),b=i(async O=>{let F=++s.current;l(E=>({...E,loading:true,error:null}));let h=await e.resumeConversation(O);F===s.current&&(l(E=>({...E,loading:false,error:h.ok?null:h.error.displayMessage})),h.ok&&r(false));},"resume"),g=i(async()=>{let O=s.current,F=await e.loadOlderMessages();O===s.current&&!F.ok&&l(h=>({...h,error:F.error.displayMessage}));},"earlier"),x=i(()=>{e.newConversation(),s.current+=1,r(false);},"newConversation"),m=i(()=>{c.cursor===null||c.loading||c.loadingMore||n.trim().length>0||u(c.cursor);},"loadMore"),T=useMemo(()=>Sc(c.rows,n),[c.rows,n]),I=n.trim().length>0;return {...c,open:t,show:f,close:y,load:u,resume:b,earlier:g,newConversation:x,loadMore:m,query:n,setQuery:o,searching:I,filtered:T,emptyKind:c.rows.length===0?"empty":"noMatch"}}i(Ti,"useHistoryPanel");var Yt="#111111",Kt="#FFFFFF",kc=Object.freeze({emergency:Object.freeze({level:"emergency",label:"Vet care now",borderColor:"#FCA5A5",backgroundColor:"#FEF2F2",textColor:"#991B1B",reasonColor:Yt,pillColor:Kt,showsVetAction:true}),schedule_soon:Object.freeze({level:"schedule_soon",label:"Vet care suggested soon",borderColor:"#FCD34D",backgroundColor:"#FFFBEB",textColor:"#92400E",reasonColor:Yt,pillColor:Kt,showsVetAction:true}),home_care:Object.freeze({level:"home_care",label:"Monitor at home",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:Yt,pillColor:Kt,showsVetAction:false}),general:Object.freeze({level:"general",label:"Good to know",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:Yt,pillColor:Kt,showsVetAction:false})});function wc(e){return `${e.messageId}:${e.level}:${e.reason??""}`}i(wc,"urgencySignature");function _c(e){return B(p.urgencyGeneralReason,{petName:e?.trim()||p.emptyTitlePetFallback})}i(_c,"generalUrgencyReason");function _i(e,t){for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(n?.role!=="assistant"||n.responseId===void 0)continue;let o=n.urgencyLevel;return o?{messageId:n.id,level:o,reason:n.urgencyReason??null}:n.urgencyProvided===true?{messageId:n.id,level:"general",reason:_c(t)}:null}return null}i(_i,"latestUrgencySource");function xi(e){let t=e===null?null:wc(e),[r,n]=useState(null),[o,a]=useState(false);useEffect(()=>a(false),[t]);let d=e!==null&&(o||!(r!==null&&r===t)),l=e===null?null:kc[e.level],c=e!==null&&!d&&e.level!=="general",u=useCallback(()=>{t!==null&&n(t),a(false);},[t]),f=useCallback(()=>a(true),[]);return useMemo(()=>({source:e,tier:l,signature:t,showBanner:d,showCompactIcon:c,showVetAction:d&&l!==null&&l.showsVetAction,dismissLabel:l===null?null:B(p.dismissBanner,{label:l.label}),dismiss:u,expand:f}),[e,l,t,d,c,u,f])}i(xi,"useUrgencySurface");function Ii(e){return e.isBootstrapping?"loading":e.status==="error"&&e.error&&e.messages.length===0?"error":e.messages.length===0?"empty":"populated"}i(Ii,"selectView");function xc(e){return e.code==="accessDenied"||e.code==="conversationNotFound"}i(xc,"needsNewConversation");function Ai(e){if(e.messages.length===0)return null;let t=e.status==="error"?e.error:null;if(t!==null){let r=xc(t);return {tone:"error",title:r?p.turnUnreachableTitle:p.turnFailedTitle,body:t.displayMessage,actionLabel:r?p.turnStartNewChat:p.turnRetry,action:r?"startNew":"retry"}}return e.stopped===true?{tone:"neutral",title:p.turnStoppedTitle,body:p.turnStoppedBody,actionLabel:p.turnRetry,action:"retry"}:null}i(Ai,"turnNotice");function Oi(e,t){let r=e[e.length-1];return t&&(r===void 0||r.role==="user")}i(Oi,"awaitingAssistant");function Fi(e,t){let r={};return e!==void 0&&(r.petRef=e),t!==void 0&&(r.conversationId=t),r}i(Fi,"buildChatOpts");var Gr=class Gr extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(Gr,"HostRenderBoundary");var Wr=Gr;function Ac({render:e}){return e()}i(Ac,"RenderHost");function Ue({render:e,fallback:t,resetKey:r}){return createElement(Wr,{fallback:t,resetKey:r,children:createElement(Ac,{render:e})})}i(Ue,"HostRender");var Oc=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function Fc(e){return Oc[e]}i(Fc,"requires");function Vi(e,t,r){let n=Fc(e),o=new Map;for(let d of t)o.set(d.resource,d);if(r?.isPending===true&&n.some(d=>!o.has(d)))return qr({name:e,enabled:false,isPending:true,limits:{}});let a=Mc(n,o);return n.filter(d=>o.get(d)?.granted!==true).length===0?qr({name:e,enabled:true,isPending:false,limits:a}):qr({name:e,enabled:false,isPending:false,limits:a,disabled:Vc(n,o)})}i(Vi,"decideCapability");function Mc(e,t){let r={};for(let n of e){let o=t.get(n)?.limits;if(o)for(let[a,s]of Object.entries(o)){let d=r[a];r[a]=d===void 0?s:Math.min(d,s);}}return r}i(Mc,"mergeLimits");function Vc(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:vr("accessDenied"),level:"user_entitlement",recoverable:false})}i(Vc,"disabledFor");function qr(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}i(qr,"freezeDecision");function gt(e){let{runtime:t}=ie(),r=t.entitlements,n=useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return useMemo(()=>Vi(e,n.decisions,{isPending:n.isPending}),[e,n])}i(gt,"useCapability");var Nc=48;function Hc(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(Hc,"selectView");function Hi(e){let{capability:t,children:r,renderDisabled:n,renderPending:o,style:a}=e,s=gt(t),d=useMemo(()=>Hc(s),[s]);switch(d){case "enabled":return r;case "pending":return o?jsx(Ue,{render:o,fallback:jsx(Li,{capability:t,style:a})}):jsx(Li,{capability:t,style:a});case "disabled":return n?jsx(Ue,{render:()=>n(s),fallback:jsx(Ni,{decision:s,style:a}),resetKey:s}):jsx(Ni,{decision:s,style:a});default:return Ft(d)}}i(Hi,"CapabilityGate");function Li({capability:e,style:t}){let r=_(),n=useMemo(()=>Ui(r),[r]);return jsx(View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsx(View,{style:n.skeletonBar})})}i(Li,"PendingSkeleton");function Ni({decision:e,style:t}){let r=_(),n=useMemo(()=>Ui(r),[r]),o=e.disabled?.reason??"";return jsx(View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?jsx(v,{style:n.offstateText,children:o}):null})}i(Ni,"OffState");function Ui(e){let{color:t,space:r,radius:n,type:o}=e;return StyleSheet.create({offstate:{minHeight:Nc,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...C(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}i(Ui,"makeStyles");var ht=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function ji(e){let t=_(),r=useMemo(()=>Bc(t),[t]);return jsxs(View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${ht.title}. ${ht.body}`,children:[jsx(v,{style:r.title,children:ht.title}),jsx(v,{style:r.body,children:ht.body})]})}i(ji,"ClinicalDisclaimer");function Bc(e){let{color:t,space:r,type:n}=e;return StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...C(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...C(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}i(Bc,"makeStyles");var J={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function $(e){return {width:e,height:e,alignItems:"center",justifyContent:"center"}}i($,"box");function ne(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}i(ne,"stroke");function Wi({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o={width:e*.82,height:n,borderRadius:n,backgroundColor:t};return jsxs(View,{style:[$(e),{gap:e*.22}],...J,children:[jsx(View,{style:o}),jsx(View,{style:o}),jsx(View,{style:o})]})}i(Wi,"MenuGlyph");function Gi({size:e,color:t,strokeWidth:r,rotate:n}){let o=ne(e,r),a=e*.78;return jsxs(View,{style:[$(e),{transform:[{rotate:n}]}],...J,children:[jsx(View,{style:{position:"absolute",width:a,height:o,borderRadius:o,backgroundColor:t}}),jsx(View,{style:{position:"absolute",width:o,height:a,borderRadius:o,backgroundColor:t}})]})}i(Gi,"Cross");function qi(e){return jsx(Gi,{...e,rotate:"0deg"})}i(qi,"PlusGlyph");function ze(e){return jsx(Gi,{...e,rotate:"45deg"})}i(ze,"CloseGlyph");function Ae({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsx(View,{style:$(e),...J,children:jsx(View,{style:{width:e*.36,height:e*.66,marginTop:-e*.14,borderBottomWidth:n,borderRightWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})})}i(Ae,"CheckGlyph");function Yi({size:e,color:t,strokeWidth:r,direction:n}){let o=ne(e,r),a=e*.46;return jsx(View,{style:$(e),...J,children:jsx(View,{style:{width:a,height:a,borderRightWidth:o,borderBottomWidth:o,borderColor:t,marginTop:n==="down"?-a*.4:a*.4,transform:[{rotate:n==="down"?"45deg":"225deg"}]}})})}i(Yi,"ChevronGlyph");function Ki({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o={width:e*.42,height:e*.7,borderWidth:n,borderColor:t,borderRadius:n};return jsxs(View,{style:[$(e),{flexDirection:"row",gap:1}],...J,children:[jsx(View,{style:[o,{borderTopLeftRadius:e*.2}]}),jsx(View,{style:[o,{borderTopRightRadius:e*.2}]})]})}i(Ki,"BookGlyph");function $i({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.5;return jsxs(View,{style:$(e),...J,children:[jsx(View,{style:{position:"absolute",width:e*.78,height:n,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}}),jsx(View,{style:{position:"absolute",top:e*.16,right:e*.16,width:o,height:o,borderTopWidth:n,borderRightWidth:n,borderColor:t}})]})}i($i,"ArrowUpRightGlyph");function Qi({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.6,a={position:"absolute",width:o,height:o,borderWidth:n,borderColor:t,borderRadius:e*.14};return jsxs(View,{style:$(e),...J,children:[jsx(View,{style:[a,{top:0,left:0}]}),jsx(View,{style:[a,{bottom:0,right:0}]})]})}i(Qi,"CopyGlyph");function $t({size:e,color:t,strokeWidth:r,active:n,rotate:o}){let a=ne(e,r),s=n?t:"transparent";return jsxs(View,{style:[$(e),{transform:[{rotate:o}]}],...J,children:[jsx(View,{style:{position:"absolute",bottom:e*.08,left:e*.12,width:e*.62,height:e*.5,borderWidth:a,borderColor:t,backgroundColor:s,borderRadius:e*.12,borderTopLeftRadius:e*.04}}),jsx(View,{style:{position:"absolute",top:e*.04,left:e*.4,width:e*.3,height:e*.5,borderWidth:a,borderColor:t,backgroundColor:s,borderRadius:e*.15,transform:[{rotate:"-20deg"}]}}),jsx(View,{style:{position:"absolute",bottom:e*.08,left:0,width:e*.2,height:e*.5,borderWidth:a,borderColor:t,backgroundColor:s,borderRadius:e*.05}})]})}i($t,"ThumbGlyph");function Xi({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxs(View,{style:[$(e),{borderRadius:e/2,borderWidth:n,borderColor:t}],...J,children:[jsx(View,{style:{width:n,height:n,borderRadius:n,backgroundColor:t,marginBottom:e*.1}}),jsx(View,{style:{width:n,height:e*.34,borderRadius:n,backgroundColor:t}})]})}i(Xi,"InfoGlyph");function Zi({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.34;return jsxs(View,{style:$(e),...J,children:[jsx(View,{style:{position:"absolute",top:e*.06,width:o,height:o,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}}),jsx(View,{style:{position:"absolute",top:e*.1,width:n,height:e*.56,borderRadius:n,backgroundColor:t}}),jsx(View,{style:{position:"absolute",bottom:0,width:e*.84,height:e*.3,borderBottomWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderBottomLeftRadius:n,borderBottomRightRadius:n}})]})}i(Zi,"UploadGlyph");function Ji({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxs(View,{style:[$(e),{borderWidth:n,borderColor:t,borderRadius:e*.14,overflow:"hidden"}],...J,children:[jsx(View,{style:{position:"absolute",top:e*.16,left:e*.18,width:e*.16,height:e*.16,borderRadius:e,backgroundColor:t}}),jsx(View,{style:{position:"absolute",bottom:-e*.3,right:-e*.1,width:e*.7,height:e*.7,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(Ji,"PhotoGlyph");function ea({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxs(View,{style:$(e),...J,children:[jsx(View,{style:{position:"absolute",top:e*.08,width:e*.34,height:e*.2,borderTopWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderTopLeftRadius:n,borderTopRightRadius:n}}),jsx(View,{style:{position:"absolute",top:e*.22,width:e*.92,height:e*.66,borderWidth:n,borderColor:t,borderRadius:e*.16,alignItems:"center",justifyContent:"center"},children:jsx(View,{style:{width:e*.3,height:e*.3,borderRadius:e,borderWidth:n,borderColor:t}})})]})}i(ea,"CameraGlyph");function ta({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.66;return jsxs(View,{style:$(e),...J,children:[jsx(View,{style:{position:"absolute",top:0,left:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t}}),jsx(View,{style:{position:"absolute",bottom:e*.02,right:e*.02,width:n,height:e*.4,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}})]})}i(ta,"SearchGlyph");function ra({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxs(View,{style:$(e),...J,children:[jsx(View,{style:{position:"absolute",width:e*.3,height:e*.82,borderWidth:n,borderColor:t,borderRadius:n,transform:[{rotate:"45deg"}]}}),jsx(View,{style:{position:"absolute",bottom:0,left:0,width:e*.4,height:n,borderRadius:n,backgroundColor:t}})]})}i(ra,"EditGlyph");function na({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.62;return jsxs(View,{style:$(e),...J,children:[jsx(View,{style:{position:"absolute",top:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t,alignItems:"center",justifyContent:"center"},children:jsx(View,{style:{width:n*1.4,height:n*1.4,borderRadius:n,backgroundColor:t}})}),jsx(View,{style:{position:"absolute",bottom:e*.04,width:o*.5,height:o*.5,borderRightWidth:n,borderBottomWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(na,"MapPinGlyph");function oa({size:e,color:t,testID:r}){let n=e*.36;return jsx(View,{style:$(e),testID:r,...J,children:jsx(View,{style:{width:0,height:0,marginLeft:e*.12,borderLeftWidth:e*.78,borderTopWidth:n,borderBottomWidth:n,borderLeftColor:t,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"-45deg"}]}})})}i(oa,"SendGlyph");function ia({size:e,color:t,testID:r}){return jsx(View,{style:$(e),testID:r,...J,children:jsx(View,{style:{width:e*.5,height:e*.5,backgroundColor:t}})})}i(ia,"StopGlyph");function Qt({size:e,strokeWidth:t,color:r,children:n}){return jsx(View,{style:[$(e),{borderRadius:e/2,borderWidth:t??StyleSheet.hairlineWidth,borderColor:r}],children:n})}i(Qt,"Ring");function q(){let e=_();return ai(e)}i(q,"useChatMotion");var Qc=8;function sa(e,t,r){return ((1-3*r+3*t)*e+(3*r-6*t))*e*e+3*t*e}i(sa,"bezierComponent");function Xc(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}i(Xc,"bezierSlope");function Xt(e){let[t,r,n,o]=e;return a=>{if(a<=0)return 0;if(a>=1)return 1;let s=a;for(let d=0;d<Qc;d+=1){let l=Xc(s,t,n);if(l===0)break;s-=(sa(s,t,n)-a)/l;}return sa(Math.min(1,Math.max(0,s)),r,o)}}i(Xt,"bezierEasing");var $r=Xt(mt.standard),Zc=Xt(mt.outQuad);function Jr(e){let t=useRef(null);return t.current===null&&(t.current=new Animated.Value(e)),t.current}i(Jr,"useAnimatedValue");function Be(e,t={}){let r=t.risePx??0,n=t.delayMs??0,o=Jr(e>0?0:1);return useEffect(()=>{if(e<=0)return;let a=Animated.timing(o,{toValue:1,duration:e,easing:Zc,useNativeDriver:true}),s=n>0?Animated.sequence([Animated.delay(n),a]):a;return s.start(),()=>s.stop()},[o,e,n]),useMemo(()=>({opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[r,0]})}]}),[o,r])}i(Be,"useFadeIn");function en({visible:e,inMs:t,outMs:r,style:n,children:o}){let[a,s]=useState(e),d=Jr(e&&t<=0?1:0);return useEffect(()=>{if(e){s(true);let c=Animated.timing(d,{toValue:1,duration:Math.max(0,t),easing:$r,useNativeDriver:true});return c.start(),()=>c.stop()}if(!a)return;if(r<=0){s(false);return}let l=Animated.timing(d,{toValue:0,duration:r,easing:$r,useNativeDriver:true});return l.start(({finished:c})=>{c&&s(false);}),()=>l.stop()},[e,a,t,r,d]),!a&&!e?null:jsx(Animated.View,{style:[n,{opacity:d}],children:o})}i(en,"FadePresence");function D({style:e,containerStyle:t,children:r,onPressIn:n,onPressOut:o,...a}){let s=q(),d=Jr(1),l=useCallback(c=>{s.pressMs<=0||s.pressScale===1||Animated.timing(d,{toValue:c,duration:s.pressMs,easing:$r,useNativeDriver:true}).start();},[d,s.pressMs,s.pressScale]);return jsx(Pressable,{...a,style:t,onPressIn:c=>{l(s.pressScale),n?.(c);},onPressOut:c=>{l(1),o?.(c);},children:jsx(Animated.View,{style:[e,{transform:[{scale:d}]}],children:r})})}i(D,"PressScale");function ca(e,t,r){let n=t&&r.revealTickMs>0,[o,a]=useState(0),s=useRef(e);return s.current=e,useEffect(()=>{if(!n)return;let d=setInterval(()=>{a(l=>si(r,l,s.current.length));},r.revealTickMs);return ()=>clearInterval(d)},[n,r]),n?e.slice(0,Math.min(o,e.length)):e}i(ca,"useRevealedText");var la=false;function Jc(e){e.layoutMs<=0||(la||(la=true,Platform.OS==="android"&&typeof UIManager.setLayoutAnimationEnabledExperimental=="function"&&UIManager.setLayoutAnimationEnabledExperimental(true)),LayoutAnimation.configureNext({duration:e.layoutMs,create:{type:"easeInEaseOut",property:"opacity"},update:{type:"easeInEaseOut"},delete:{type:"easeInEaseOut",property:"opacity"}}));}i(Jc,"animateLayout");function Zt(e,t){let r=useRef(e);r.current!==e&&(r.current=e,Jc(t));}i(Zt,"useAnimateLayoutOn");var tn=36,au=22,su=12,lu=12,du=16,cu="#000",uu="rgba(0,0,0,0.45)";function ua({uri:e,label:t,onClose:r}){let n=_(),o=useSafeAreaInsets();return e===null?null:jsxs(Modal,{visible:true,animationType:n.motion.reducedMotion?"none":"fade",transparent:false,statusBarTranslucent:true,onRequestClose:r,children:[jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:p.closePreview,style:Jt.backdrop,onPress:r,children:jsx(Image,{source:{uri:e},style:Jt.image,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,accessibilityIgnoresInvertColors:true})}),jsx(View,{pointerEvents:"box-none",style:[Jt.closeWrap,{top:o.top+lu}],children:jsx(D,{accessibilityRole:"button",accessibilityLabel:p.closePreview,hitSlop:su,style:Jt.closeButton,onPress:r,children:jsx(ze,{size:au,color:n.color.surface,strokeWidth:2})})})]})}i(ua,"AttachmentImageLightbox");var Jt=StyleSheet.create({backdrop:{flex:1,backgroundColor:cu,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"},closeWrap:{position:"absolute",right:du},closeButton:{width:tn,height:tn,borderRadius:tn/2,backgroundColor:uu,alignItems:"center",justifyContent:"center"}});var er=12,gu=80,rn=44,pa=22,hu=.14,bu=18,vu=8,fa=Object.freeze({photo:p.attachmentPhoto,camera:p.attachmentCamera});function ya({sources:e,full:t,onPick:r,onClose:n}){let o=_(),a=useMemo(()=>Cu(o),[o]);return jsxs(View,{style:a.anchor,pointerEvents:"box-none",children:[jsx(Pressable,{style:a.dismissLayer,accessibilityRole:"button",accessibilityLabel:p.closeAttachmentPicker,onPress:n}),jsxs(View,{style:a.bubble,children:[jsx(View,{style:a.tilesRow,children:e.map(s=>jsxs(D,{accessibilityRole:"button",accessibilityLabel:fa[s],accessibilityState:{disabled:t},disabled:t,containerStyle:a.tile,style:a.tileInner,onPress:()=>r(s),children:[jsx(View,{style:a.tileIconWrap,children:s==="photo"?jsx(Ji,{size:pa,color:o.color.brandInk,strokeWidth:1.5}):jsx(ea,{size:pa,color:o.color.brandInk,strokeWidth:1.5})}),jsx(v,{tier:"control",style:a.tileLabel,children:fa[s]})]},s))}),jsx(View,{style:a.tail}),jsx(View,{style:a.tailFill})]})]})}i(ya,"AttachmentPickerPopover");function Cu(e){let t=e.color,r=e.radius;return StyleSheet.create({anchor:{position:"absolute",left:0,right:0,bottom:"100%",paddingHorizontal:8,paddingBottom:10,alignItems:"flex-start"},dismissLayer:{position:"absolute",left:-1e3,right:-1e3,top:-2e3,bottom:0},bubble:{backgroundColor:t.surfaceCream,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:6,paddingVertical:8,shadowColor:t.shadow,shadowOpacity:hu,shadowRadius:bu,shadowOffset:{width:0,height:vu},elevation:8},tilesRow:{flexDirection:"row",alignItems:"stretch"},tile:{minWidth:gu,borderRadius:r.md},tileInner:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:10,paddingVertical:8,gap:6},tileIconWrap:{width:rn,height:rn,borderRadius:rn/2,backgroundColor:t.brandSoft,alignItems:"center",justifyContent:"center"},tileLabel:{...C(e,"medium"),fontSize:12,lineHeight:14,color:t.text.primary},tail:{position:"absolute",left:24,bottom:-er/2,width:er,height:er,backgroundColor:t.surfaceCream,borderRightWidth:1,borderBottomWidth:1,borderColor:t.brandBorderStrong,transform:[{rotate:"45deg"}]},tailFill:{position:"absolute",left:22,bottom:0,width:er+4,height:2,backgroundColor:t.surfaceCream}})}i(Cu,"makeStyles");var ma=56,ga=12,Su=14,Pu=10,Tu="rgba(16,70,46,0.45)",ku="rgba(7,193,104,0.55)",wu="rgba(185,28,28,0.55)",_u=200,xu=300,Pa=20,on=22,Iu=12,Au="rgba(0,0,0,0.78)",ha=220,ba=100,va="rgba(255,255,255,0.15)";function Ta({attachments:e,rejected:t,uploadFailed:r=false,onRetry:n,onRemove:o,onPreview:a}){let s=_(),d=useMemo(()=>wa(s),[s]);return e.length===0&&t===null?null:jsxs(View,{style:d.strip,children:[e.length>0?jsx(View,{style:d.cards,children:e.map(l=>jsx(Ou,{row:l,styles:d,onRetry:n,onRemove:o,onPreview:a},l.id))}):null,r?jsx(v,{style:d.rejected,accessibilityRole:"alert",children:p.attachmentsFailedBlocked}):null,t!==null?jsx(v,{style:d.rejected,accessibilityRole:"alert",children:xo(t)}):null]})}i(Ta,"AttachmentStrip");function Ou({row:e,styles:t,onRetry:r,onRemove:n,onPreview:o}){let a=_(),s=e.status==="uploading",d=e.status==="failed",l=e.status==="uploaded",c=useRef(e.status),[u,f]=useState(false);return useEffect(()=>{let y=c.current;c.current=e.status,e.status==="uploaded"&&y==="uploading"&&f(true);},[e.status]),jsxs(View,{style:t.card,children:[jsx(Pressable,{accessibilityRole:l?"button":"image",accessibilityLabel:l?B(p.previewAttachment,{filename:e.filename}):e.filename,accessibilityState:{busy:s,disabled:!l},disabled:!l,style:t.thumbHit,onPress:()=>o(e),children:jsxs(View,{style:t.thumb,children:[jsx(Image,{source:{uri:e.previewUri},style:t.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),s?jsx(View,{style:t.uploadingOverlay,children:jsx(ActivityIndicator,{size:"small",color:a.color.surface})}):null,u?jsx(Fu,{styles:t,onDone:()=>f(false)}):null]})}),d?jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:B(p.retryUpload,{filename:e.filename}),style:t.failedOverlay,onPress:()=>r(e.id),children:jsx(View,{style:t.failedInner,children:jsx(ze,{size:Pa,color:a.color.surface,strokeWidth:2})})}):null,jsx(D,{accessibilityRole:"button",accessibilityLabel:B(p.removeAttachment,{filename:e.filename}),hitSlop:6,containerStyle:t.removeSlot,style:t.removeButton,onPress:()=>n(e.id),children:jsx(ze,{size:Iu,color:a.color.surface,strokeWidth:1.5})})]})}i(Ou,"PreviewCard");function Fu({styles:e,onDone:t}){let r=_(),n=q(),o=useRef(null);o.current===null&&(o.current=new Animated.Value(0));let a=o.current;return useEffect(()=>{let s=Animated.sequence([Animated.timing(a,{toValue:1,duration:_u,useNativeDriver:true}),Animated.delay(n.uploadFlashMs),Animated.timing(a,{toValue:0,duration:xu,useNativeDriver:true})]);return s.start(({finished:d})=>{d&&t();}),()=>s.stop()},[a,n.uploadFlashMs,t]),jsx(Animated.View,{pointerEvents:"none",style:[e.successOverlay,{opacity:a}],children:jsx(Ae,{size:Pa,color:r.color.surface,strokeWidth:2})})}i(Fu,"SuccessFlash");function ka({images:e,onPreview:t}){let r=_(),n=useMemo(()=>wa(r),[r]);if(e.length===0)return null;let o=e.length===1;return jsx(View,{style:o?n.sentSingle:n.sentGrid,children:e.map((a,s)=>jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:B(p.attachedImage,{filename:a.filename}),onPress:()=>t(a),children:jsx(Image,{source:{uri:a.uri},style:o?n.singleImage:n.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${a.uri}-${s}`))})}i(ka,"SentImages");function wa(e){let t=e.color,r=e.type;return StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:ma,height:ma,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:ga,overflow:"hidden",backgroundColor:t.composerFill,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...StyleSheet.absoluteFillObject,alignItems:"center",justifyContent:"center",backgroundColor:Tu},successOverlay:{...StyleSheet.absoluteFillObject,alignItems:"center",justifyContent:"center",backgroundColor:ku},failedOverlay:{...StyleSheet.absoluteFillObject,borderRadius:ga,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:wu},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:on,height:on,borderRadius:on/2,backgroundColor:Au,borderWidth:1.5,borderColor:t.surface,alignItems:"center",justifyContent:"center"},rejected:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:ha,height:ha,borderRadius:Su,backgroundColor:va},gridImage:{width:ba,height:ba,borderRadius:Pu,backgroundColor:va}})}i(wa,"makeStyles");var Mu="file",Vu="chat attachment upload: the file handle has no uri",Du="chat attachment upload failed";function Lu(e){return {uri:e.uri,name:Ir(e.name),type:e.mimeType}}i(Lu,"filePartOf");function ln(e={}){return Object.freeze({postMultipart(t,r,n){if(typeof r.uri!="string"||r.uri.length===0)return Promise.reject(new Error(Vu));let{signal:o,onProgress:a}=n,s=i(()=>Promise.reject(new Error(Du)),"failed");if(o?.aborted===true)return s();let d=new FormData;for(let[c,u]of Object.entries(t.upload_fields))d.append(c,u);d.append(Mu,Lu(r));let l=e.fetch??fetch;return Promise.resolve().then(()=>l(t.upload_url,{method:"POST",body:d,credentials:"omit",...o?{signal:o}:{}})).then(c=>{if(!c.ok)return s();a?.(1);},s)}})}i(ln,"createRnChatAttachmentTransport");function cn(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=ie(),o=useMemo(()=>jt(e.registry.services.authFor(t)),[e,t,n]),[a,s]=useState({repository:o,pets:[],loading:true,error:null}),d=a.repository===o?a:{pets:[],loading:true,error:null},l=useRef(0),c=useCallback(async()=>{let f=++l.current;s(b=>({...b,repository:o,loading:true,error:null,pets:b.repository===o?b.pets:[]}));let y=await o.list();f===l.current&&s(y.ok?{repository:o,pets:y.value,loading:false,error:null}:b=>({repository:o,pets:b.repository===o?b.pets:[],loading:false,error:y.error}));},[o]);useEffect(()=>(c(),()=>{l.current+=1;}),[c]);let u=useMemo(()=>r===null?null:d.pets.find(f=>f.petRef===r)??null,[r,d.pets]);return useMemo(()=>({pets:d.pets,activePet:u,loading:d.loading,error:d.error,refresh:c}),[d.pets,d.loading,d.error,u,c])}i(cn,"useEverfurPets");function _a(e,t){if(t!==null){let r=e.find(n=>n.petRef===t);if(r!==void 0)return r}return e[0]??null}i(_a,"headerPetOf");var xa=Object.freeze({visitButton:"Talk to a vet"});var un=Object.freeze(["visit","join","summary","messages"]);function pn(e){return typeof e=="string"&&un.includes(e)}i(pn,"isVetVisitIntent");var Bu="/widget/v1/televet/handoffs",ju="/widget/v1/televet/availability",Wu="/widget/v1/televet/chat-entry",Gu=/^[a-z0-9][a-z0-9_-]{0,39}$/,qu=/^[A-Za-z0-9_-]{22}$/;var Ia=32,Aa=128,Oa=64;function yn(e){let t=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}i(yn,"vetVisitErrorReasonOf");function Fa(e){return V(j("validationFailed",{retryable:false,wireMessage:e}))}i(Fa,"invalid");function fn(e){return V(j("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}i(fn,"unusable");function Yu(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!Gu.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let o=t?.entry;if(o!=null){if(o!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=o;}let a=t?.visitRef,s=t?.intent,d=a!=null;if(d){let l=typeof a=="string"?a.trim():"";if(l.length<1||[...l].length>Oa)return {ok:false,message:`visitRef must be 1..${Oa} characters`};r.visit_ref=l;}if(s!=null){if(!d)return {ok:false,message:"intent needs the visitRef it opens"};if(!pn(s))return {ok:false,message:`intent must be one of ${un.join(", ")}`};r.intent=s;}return {ok:true,body:r}}i(Yu,"handoffBody");function Ku(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!pn(r)?null:Object.freeze({visitRef:t,intent:r})}i(Ku,"parseVisitEcho");function Va(e){let t=e.funnel??Ne({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=i(o=>(Ma(r,"televet.visit.handoff_failed",{reason:yn(o)}),V(o)),"failed");return {async createHandoff(o,a){let s;if(o!=null){let m=typeof o=="string"?[...o].length:0;if(m<1||m>Aa)return n(j("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Aa} characters`}));s=o;}let d=Yu(s,a);if(!d.ok){let m=Fa(d.message);return m.ok?m:n(m.error)}let l=d.body,c=await t.send("televet.visit.handoff",{method:"POST",path:Bu,body:l},{idempotent:false,maxAttempts:1});if(!c.ok)return n(c.error);let u=$u(c.value),f=l.return_to!==void 0,y=f?c.value?.flow_id:void 0;if(f&&(typeof y!="string"||!qu.test(y))){let m=fn("the handoff response carried no usable return flow id");return m.ok?m:n(m.error)}let b=l.visit_ref!==void 0,g=b?Ku(c.value?.visit):null;if(b&&g===null){let m=fn("the handoff response did not confirm the visit it opens");return m.ok?m:n(m.error)}let x=u===null?null:Object.freeze({...u,...f?{flowId:y}:{},...g!==null?{visit:g}:{}});return x===null?n(j("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(Ma(r,"televet.visit.handoff_created",{pet_scoped:l.pet_ref!==void 0}),le(x))},async checkAvailability(o){if(typeof o!="string"||o.length>Ia)return Fa(`state must be at most ${Ia} characters`);let a=await t.send("televet.visit.availability",{method:"POST",path:ju,body:{state:o}},{idempotent:false,maxAttempts:1});if(!a.ok)return V(a.error);let s=a.value?.available;return typeof s!="boolean"?fn("the availability response carried no usable answer"):le(Object.freeze({available:s}))},async chatEntryOpen(){try{let o=await t.send("televet.visit.chat_entry",{method:"GET",path:Wu},{maxAttempts:1});return o.ok&&o.value?.open===!0}catch{return false}}}}i(Va,"createVetVisitController");function $u(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Ju(t)?null:Object.freeze({url:t,expiresAt:r})}i($u,"parseHandoff");var Qu=new Set(["localhost","127.0.0.1","[::1]"]),Xu=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Zu=/[\s\u0000-\u001f\u007f]/;function Ju(e){if(Zu.test(e))return false;let t=Xu.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let o=n.replace(/:\d+$/,"").toLowerCase(),a=r==="https",s=r==="http"&&Qu.has(o);if(!a&&!s)return false;let d=e.indexOf("#");if(d<0)return false;let l=e.slice(d);return l.startsWith("#h=")&&l.length>3}i(Ju,"isOpenableVisitUrl");function Ma(e,t,r){if(e)try{e.track(t,r);}catch{}}i(Ma,"safeTrack");var La=Object.freeze({status:"idle",error:null,errorReason:null});function tp(e,t,r){let{usState:n,chat:o,scope:a}=r,s=t&&(n!==null||o),d=`${n??""}|${o?"chat":""}`,[l,c]=useState(null);if(useEffect(()=>{if(!s)return;let f=true,y=e.current;return c(null),i(async()=>{try{if(o&&!(y.chatEntryOpen&&await y.chatEntryOpen()))return !1;if(n===null)return !0;if(!y.checkAvailability)return !1;let g=await y.checkAvailability(n);return g.ok&&g.value.available}catch{return false}},"ask")().then(g=>{f&&c({key:d,open:g});}),()=>{f=false;}},[s,d,n,o,a,e]),!s)return null;let u=l!==null&&l.key===d;return {open:u&&l.open,pending:!u}}i(tp,"usePreflight");var rp=Object.freeze({status:"opening",error:null,errorReason:null});function Ha(e,t={}){let{runtime:r,userRef:n,scopeEpoch:o}=ie(),a=gt("televet"),s=a.enabled&&n!==null,d=t.usState??null,l=t.entry==="chat",c=t.petRef??null,u=useMemo(()=>{if(t.controller)return t.controller;let{services:P}=r.registry;return Va({auth:P.authFor(n),telemetry:P.telemetry,...P.errorPolicy?{errorPolicy:P.errorPolicy}:{}})},[r,n,o,t.controller]),f=useRef(u);f.current=u;let y=useMemo(()=>({runtime:r,userRef:n,scopeEpoch:o}),[r,n,o]),b=tp(f,s,{usState:d,chat:l,scope:y}),g=s&&(b===null||b.open)&&(!l||c!==null),x=t.returnTo??null,[m,T]=useState(La),I=useRef(null),O=useRef({runtime:r,userRef:n,scopeEpoch:o});O.current={runtime:r,userRef:n,scopeEpoch:o};let F=useRef(u);F.current=u;let h=useRef(g);h.current=g;let E=useCallback((P,k)=>{if(I.current)return I.current;let M=i((z,De)=>(T({status:z==="cancelled"?"idle":"error",error:De,errorReason:z==="cancelled"?null:z}),Object.freeze({opened:false,reason:z,error:De})),"fail");if(!h.current)return Promise.resolve(M("unavailable",null));let H=e.prepare();if(!H.ok)return Promise.resolve(M(H.reason,null));let X=O.current,U=F.current;T(rp);let oe=(async()=>{let z,De={...x!==null?{returnTo:x}:{},...l?{entry:"chat"}:{},...k!==null?{visitRef:k.visitRef}:{},...k!==null&&k.intent!==null&&k.intent!==void 0?{intent:k.intent}:{}},Tt=Object.keys(De).length===0?void 0:De,it=P===void 0?c:P;try{z=await(Tt===void 0?U.createHandoff(it):U.createHandoff(it,Tt));}catch{return e.abandon(H.value),M("unknown",null)}let Ye=O.current;if(Ye.runtime!==X.runtime||Ye.userRef!==X.userRef||Ye.scopeEpoch!==X.scopeEpoch)return e.abandon(H.value),M("cancelled",null);if(!z.ok)return e.abandon(H.value),M(yn(z.error),z.error);let Ke=await e.finish(H.value,z.value);return Ke!==null?M(Ke,null):(T(La),Object.freeze(z.value.flowId===void 0?{opened:true}:{opened:true,flowId:z.value.flowId}))})().finally(()=>{I.current===oe&&(I.current=null);});return I.current=oe,oe},[e,c,x,l]),R=useCallback(P=>E(P,null),[E]),L=useCallback((P,k)=>E(void 0,{visitRef:P,intent:k??null}),[E]);return {available:g,isPending:a.isPending||(b?.pending??false),status:m.status,error:m.error,errorReason:m.errorReason,open:R,openVisit:L}}i(Ha,"useVetVisitWith");var ip=i(e=>Linking.openURL(e),"defaultOpenUrl");function tr(e={}){let{openUrl:t,...r}=e,n=useMemo(()=>{let o=t??ip;return {prepare:i(()=>({ok:true,value:null}),"prepare"),async finish(a,s){try{return await o(s.url),null}catch{return "openFailed"}},abandon:i(()=>{},"abandon")}},[t]);return Ha(n,r)}i(tr,"useVetVisit");var Ua=44,cp=.6;function et(e){let{petRef:t,label:r,openUrl:n,onOpened:o,onError:a,style:s,labelStyle:d,controller:l,returnTo:c,usState:u,entry:f,visitRef:y,intent:b}=e,g=tr({...c!==void 0?{returnTo:c}:{},...u!==void 0?{usState:u}:{},...f!==void 0?{entry:f}:{},...t!==void 0?{petRef:t}:{},...n!==void 0?{openUrl:n}:{},...l!==void 0?{controller:l}:{}}),x=_(),m=useMemo(()=>up(x),[x]),T=useRef(false);if(!g.available)return null;let I=g.status==="opening",O=r??xa.visitButton;return jsx(Pressable,{onPress:i(()=>{I||T.current||(T.current=true,(y==null?g.open():g.openVisit(y,b??null)).then(h=>{h.opened?W(o,h.flowId??null):h.reason!=="cancelled"&&W(a,h.reason,h.error);}).finally(()=>{T.current=false;}));},"onPress"),accessibilityRole:"button",accessibilityLabel:O,accessibilityState:{busy:I,disabled:I},style:[m.button,I?m.busy:null,s],children:jsx(v,{style:[m.label,d],children:O})})}i(et,"VetVisitButton");function up(e){let{color:t,space:r,radius:n,type:o,slots:a}=e;return StyleSheet.create({button:{minHeight:Ua,minWidth:Ua,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.primary,...re(a.vetVisitButton)},busy:{opacity:cp},label:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug,...fe(a.vetVisitButton)}})}i(up,"makeStyles");function gn(e){return Nt(e)==="cat"?"cat":"dog"}i(gn,"speciesOf");function hn(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.floor(e)}i(hn,"petAgeYears");function ja(e){let t=hn(e.ageYears),r=gn(e.species)==="cat"?"Cat":"Dog";if(t==null)return r;let n=t===1?"1 yr":`${t} yrs`;return `${r} \xB7 ${n}`}i(ja,"formatPetMeta");var Ba=Object.freeze([Object.freeze({background:"#ffbdbd",foreground:"#6d1d14"}),Object.freeze({background:"#a0c4f6",foreground:"#0b3a73"}),Object.freeze({background:"#fbc558",foreground:"#10462e"}),Object.freeze({background:"#bde7c5",foreground:"#0e3b22"}),Object.freeze({background:"#dcc7f4",foreground:"#3a1d6a"}),Object.freeze({background:"#ffd8a8",foreground:"#5a2a04"})]);function pp(e){let t=0;for(let r=0;r<e.length;r+=1)t=t*31+e.charCodeAt(r)>>>0;return Ba[t%Ba.length]}i(pp,"pickInitialsPalette");function bn(e){let t=(e??"").trim();return (Array.from(t)[0]??"?").toUpperCase()}i(bn,"getInitial");function Wa(e){return {...pp(e.petRef),initial:bn(e.name)}}i(Wa,"petInitials");function gp(e){return Math.max(12,Math.round(e*.42))}i(gp,"letterSize");function Et({pet:e,size:t,ringStroke:r}){let n=_(),o=useMemo(()=>hp(n),[n]),a=t-r*2,s=e===null?null:Wa(e),d=gp(a);return jsx(Qt,{size:t,strokeWidth:r,color:n.color.success,children:jsx(View,{style:[o.disc,{width:a,height:a,borderRadius:a/2},s===null?o.discEmpty:{backgroundColor:s.background}],children:jsx(v,{tier:"badge",style:[o.letter,{fontSize:d,lineHeight:Math.round(d*1.2),color:s===null?n.color.text.muted:s.foreground}],children:s===null?bn(null):s.initial})})})}i(Et,"PetDisc");function hp(e){return StyleSheet.create({disc:{alignItems:"center",justifyContent:"center",overflow:"hidden"},discEmpty:{backgroundColor:e.color.brandSoft},letter:{...C(e,"bold"),textAlign:"center",includeFontPadding:false}})}i(hp,"makeStyles");var Cn=48,Ka=2,Rp=320,Sp="80%",Pp="rgba(17,17,17,0.45)",Tp=18,Ga=22,kp=12,qa=.4,wp=44;function En(e){return e?.name?.trim()||p.yourPet}i(En,"petDisplayName");function $a({visible:e,pets:t,activePetRef:r,onSelect:n,onAddPet:o=null,onClose:a}){let s=_(),d=useMemo(()=>_p(s),[s]);return e?jsx(Modal,{visible:true,transparent:true,animationType:s.motion.reducedMotion?"none":"fade",onRequestClose:a,children:jsxs(View,{style:d.root,children:[jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:a,accessibilityRole:"button",accessibilityLabel:p.close,children:jsx(View,{style:d.backdrop})}),jsxs(View,{style:d.panel,accessibilityViewIsModal:true,children:[jsx(v,{tier:"heading",style:d.title,accessibilityRole:"header",children:p.yourPets}),jsx(ScrollView,{style:d.list,contentContainerStyle:d.listContent,showsVerticalScrollIndicator:true,children:t.map(l=>{let c=l.petRef===r,u=En(l),f=ja(l);return jsxs(D,{accessibilityRole:"button",accessibilityLabel:B(c?p.petCurrentlyActive:p.switchToPet,{name:u}),accessibilityState:{selected:c},style:[d.row,c?d.rowActive:null],onPress:()=>n(l.petRef),children:[jsx(Et,{pet:l,size:Cn,ringStroke:Ka}),jsxs(View,{style:d.copy,children:[jsx(v,{style:d.name,numberOfLines:1,children:u}),jsx(v,{tier:"compact",style:d.meta,numberOfLines:1,children:c?`${p.activePrefix}${f}`:f})]}),c?jsx(Ae,{size:Tp,color:s.color.brandInk}):null]},l.petRef)})}),o!==null?jsxs(D,{accessibilityRole:"button",accessibilityLabel:p.addAnotherPet,style:d.addRow,onPress:o,children:[jsx(View,{style:d.addDisc,children:jsx(v,{tier:"control",style:d.addPlus,children:"+"})}),jsx(v,{style:d.addLabel,children:p.addAnotherPet})]}):null,jsx(D,{accessibilityRole:"button",accessibilityLabel:p.close,containerStyle:d.closeSlot,style:d.closeButton,onPress:a,children:jsx(v,{tier:"control",style:d.closeText,children:p.close})})]})]})}):null}i($a,"PetSwitcherSheet");function _p(e){let t=e.color,r=e.radius;return StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:Pp},panel:{backgroundColor:t.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:Ga,borderTopRightRadius:Ga,gap:14,maxHeight:Sp},title:{...C(e,"bold"),fontSize:18,lineHeight:22,color:t.brandInk},list:{maxHeight:Rp,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:wp,paddingHorizontal:8},addDisc:{width:Cn,height:Cn,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:Ka,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream},addPlus:{...C(e,"bold"),fontSize:20,lineHeight:22,color:t.brandInk},addLabel:{...C(e,"bold"),fontSize:15,lineHeight:20,color:t.text.primary},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowActive:{borderColor:t.brandInk,backgroundColor:t.brandSoft},copy:{flex:1,gap:2},name:{...C(e,"bold"),fontSize:15,lineHeight:18,color:t.text.primary},meta:{...C(e,"monoBold"),fontSize:11,lineHeight:13,color:t.text.muted,textTransform:"uppercase",letterSpacing:qa},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:kp,backgroundColor:t.brandSoft},closeText:{...C(e,"bold"),color:t.brandInk,fontSize:13,lineHeight:16,letterSpacing:qa}})}i(_p,"makeStyles");var Ap=44,rr=36,Op=22,Sn=9,Fp=1.5,Qa=6,We=35,nr=1.75,Pn=12.4,Mp=.5,Vp=8,Dp=28,Lp=160;function kn(e,t){return _a(e,t)}i(kn,"headerPet");function Za({pets:e,petRef:t,historyUnread:r,onOpenHistory:n,onPetChange:o,onAddPet:a,vet:s}){let d=_(),l=useMemo(()=>Hp(d),[d]),[c,u]=useState(false),f=kn(e.pets,t),y=e.pets.length>=2,b=t??f?.petRef??null,g=En(f),x=i(T=>{u(false),e.setActivePet(T),W(o,T);},"select"),m=a===void 0?null:()=>{u(false),W(a);};return jsxs(View,{style:l.row,children:[jsxs(D,{accessibilityRole:"button",accessibilityLabel:r?p.openMenuUnread:p.openMenu,containerStyle:l.iconSlot,style:l.iconButton,onPress:n,children:[jsx(Wi,{size:Op,color:d.color.text.primary,strokeWidth:2}),r?jsx(View,{style:l.unreadDot,pointerEvents:"none"}):null]}),jsx(View,{style:l.center,pointerEvents:"box-none",children:jsx(Np,{logoUrl:d.meta.logoUrl,name:d.meta.displayName,styles:l})}),b===null?null:jsx(et,{entry:"chat",petRef:b,...s?.returnTo!==void 0?{returnTo:s.returnTo}:{},...s?.usState!==void 0?{usState:s.usState}:{},style:l.vetEntry,labelStyle:l.vetEntryLabel}),jsx(View,{style:l.right,children:y?jsxs(D,{accessibilityRole:"button",accessibilityLabel:B(p.switchActivePet,{name:g}),containerStyle:l.avatarSlot,style:l.avatarWrap,onPress:()=>u(true),children:[jsx(Et,{pet:f,size:We,ringStroke:nr}),jsx(View,{style:l.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsx(qi,{size:Vp,color:d.color.brandInk,strokeWidth:2})})]}):e.loading&&f===null?jsx(View,{style:l.avatarWrap,accessible:true,accessibilityLabel:p.yourPet,children:jsx(Qt,{size:We,strokeWidth:nr,color:d.color.success,children:jsx(View,{style:l.placeholderDisc})})}):jsx(View,{style:l.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:f===null?p.yourPet:g,children:jsx(Et,{pet:f,size:We,ringStroke:nr})})}),jsx($a,{visible:c,pets:e.pets,activePetRef:f?.petRef??null,onSelect:x,onAddPet:m,onClose:()=>u(false)})]})}i(Za,"ChatHeader");function Np({logoUrl:e,name:t,styles:r}){let[n,o]=useState(null);return e===null||n===e?null:jsx(View,{style:r.logoBar,children:jsx(Image,{source:{uri:e},style:r.logo,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:()=>o(e)})})}i(Np,"BrandLogo");function Hp(e){let t=e.color,r=We-nr*2;return StyleSheet.create({vetEntry:{minHeight:Ap,justifyContent:"center",paddingHorizontal:12,borderRadius:e.radius.pill,backgroundColor:t.surfaceCream,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},vetEntryLabel:{...C(e,"bold"),color:t.brandInk,fontSize:e.type.size.caption},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:10,backgroundColor:t.surface},iconSlot:{borderRadius:rr/2},iconButton:{width:rr,height:rr,borderRadius:rr/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:Qa,right:Qa,width:Sn,height:Sn,borderRadius:Sn,backgroundColor:t.danger,borderWidth:Fp,borderColor:t.surface},center:{...StyleSheet.absoluteFillObject,alignItems:"center",justifyContent:"center"},logoBar:{alignItems:"center",paddingHorizontal:e.space.lg},logo:{height:Dp,width:Lp},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:We/2},avatarWrap:{width:We,height:We,position:"relative"},placeholderDisc:{width:r,height:r,borderRadius:r/2,backgroundColor:t.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:Pn,height:Pn,borderRadius:Pn/2,borderWidth:Mp,borderColor:t.success,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"}})}i(Hp,"makeStyles");var Fe=Object.freeze({eyebrow:"Checking in",logged:"Logged",findVet:"Find a vet now",answers:Object.freeze({better:"Better",same:"Same",worse:"Worse"})}),Ja=Object.freeze(Co.map(e=>Object.freeze({answer:e,label:Fe.answers[e]})));function es(e,t){let[r,n]=useState(null),[o,a]=useState(null),[s,d]=useState(null),l=useCallback(u=>{t!==null&&(n(u),a(null),t(e.caseId,u).then(f=>{n(null),f.ok?d(u):a(f.error);}));},[t,e.caseId]),c=s??e.answer;return {answer:c,answerable:!So(e),escalated:c==="worse",pending:r,error:o,choose:l}}i(es,"useCheckinCard");var os=44,Bp=.6;function is({message:e,checkin:t,onAnswer:r,petRef:n,onFindVet:o,vet:a}){let s=_(),d=useMemo(()=>jp(s),[s]),l=es(t,r),c=l.answer!==null||l.pending!==null,u=r!==null&&l.answerable;return jsxs(View,{style:d.card,accessibilityLabel:Fe.eyebrow,children:[jsx(v,{tier:"compact",style:d.eyebrow,children:Fe.eyebrow}),jsx(v,{style:d.question,accessibilityRole:"text",children:e.text}),u?jsx(View,{style:[d.row,l.pending?d.rowPending:null],children:Ja.map(({answer:f,label:y})=>{let b=(l.pending??l.answer)===f;return jsx(Pressable,{onPress:()=>l.choose(f),disabled:c,accessibilityRole:"button",accessibilityLabel:y,accessibilityState:{selected:b,disabled:c,busy:l.pending===f},style:[d.pill,b?d.pillSelected:null],children:jsx(v,{tier:"control",style:[d.pillLabel,b?d.pillLabelSelected:null],children:y})},f)})}):null,l.answer!==null?jsx(v,{style:d.logged,children:Fe.logged}):null,l.escalated?o!==void 0?jsx(Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:Fe.findVet,style:d.findVet,children:jsx(v,{tier:"control",style:d.findVetLabel,children:Fe.findVet})}):n?jsx(et,{entry:"chat",petRef:n,label:Fe.findVet,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},style:d.findVet,labelStyle:d.findVetLabel}):null:null,t.resolutionText?jsx(v,{style:d.resolution,children:t.resolutionText}):null,l.error?jsx(v,{style:d.error,accessibilityRole:"alert",children:l.error.displayMessage}):null]})}i(is,"CheckinCard");function jp(e){let t=e.color,r=e.space,n=e.radius,o=e.type;return StyleSheet.create({card:{maxWidth:"92%",padding:r.md,gap:r.sm,borderRadius:n.lg,backgroundColor:t.surface,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},eyebrow:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},question:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},row:{flexDirection:"row",gap:r.sm,marginTop:r.xs},rowPending:{opacity:Bp},pill:{flex:1,minHeight:os,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,borderRadius:n.pill,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surfaceCream},pillSelected:{backgroundColor:t.brand,borderColor:t.brand},pillLabel:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body},pillLabelSelected:{color:t.onPrimary},logged:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption},resolution:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},error:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption},findVet:{alignSelf:"stretch",minHeight:os,alignItems:"center",justifyContent:"center",borderRadius:n.pill,borderWidth:1.5,borderColor:t.brandBorder,backgroundColor:t.surface},findVetLabel:{...C(e,"bold"),color:t.brandInk,fontSize:o.size.body}})}i(jp,"makeStyles");var Gp=Object.freeze({TIER_1:"#07C168",TIER_2:"#27A9FF",TIER_3:"#FBC558"}),as="#C8BEB4";function qp(e){return e?Gp[e.toUpperCase()]??as:as}i(qp,"tierColor");function Yp(e){if(!e)return null;let t=/^tier[_\s-]?(\d+)$/i.exec(e.trim());return t?`Tier ${t[1]}`:e}i(Yp,"tierLabel");function Se(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0?null:t}i(Se,"text");function Kp(e){let t=Se(e);return t!==null&&/^https:\/\/\S+$/i.test(t)?t:null}i(Kp,"httpsUrl");function $p(e,t){let r=Se(e.source_name)??Se(e.sourceName),n=Se(e.section),o=Se(e.authority_tier)??Se(e.authorityTier),a=Yp(o),s=r??Se(e.title)??`Source ${t+1}`,d=Se(e.monograph_chunk_id)??Se(e.chunkId),l=[n,a].filter(c=>c!==null).join(" \xB7 ");return Object.freeze({title:s,sourceName:r,section:n,authorityTier:o,tierLabel:a,meta:l.length===0?null:l,url:Kp(e.url),excerpt:Se(e.excerpt),tierColor:qp(o),key:`${s}-${d??"none"}-${t}`})}i($p,"toCitationCard");function ss(e){return e===void 0||e.length===0?Qp:Object.freeze(e.map((t,r)=>$p(t,r)))}i(ss,"toCitationCards");var Qp=Object.freeze([]);function _n(e){return e===1?`1 ${p.sourceSingular}`:`${e} ${p.sourcePlural}`}i(_n,"sourcesLabel");function ls(e,t){return `${t?p.hideSources:p.showSources} ${_n(e)}`}i(ls,"sourcesToggleLabel");function ds(e){return [e.url!==null?`${p.openSource}: ${e.title}`:e.title,e.meta,e.excerpt].filter(t=>t!==null&&t.length>0).join(". ")}i(ds,"citationA11yLabel");var rf=244,us=8,ps=13,nf=14,of=.3,af=-0.24,sf=22,lf=10,df=15;function fs({citations:e}){let t=_(),r=useMemo(()=>pf(t),[t]),n=useMemo(()=>ss(e),[e]),[o,a]=useState(false);if(n.length===0)return null;let s=n.length;return jsxs(View,{style:r.block,children:[jsxs(D,{accessibilityRole:"button",accessibilityLabel:ls(s,o),accessibilityState:{expanded:o},containerStyle:r.toggleSlot,style:r.togglePill,onPress:()=>a(d=>!d),children:[jsx(Ki,{size:ps,color:t.color.brandInk,strokeWidth:1.5}),jsx(v,{tier:"compact",style:r.toggleLabel,children:_n(s)}),jsx(Yi,{size:ps,color:t.color.brandInk,strokeWidth:1.5,direction:o?"up":"down"})]}),o?jsx(cf,{cards:n,styles:r}):null]})}i(fs,"CitationCards");function cf({cards:e,styles:t}){let r=q(),n=Be(r.citationsInMs,{risePx:r.citationsRisePx});return jsx(Animated.View,{style:n,children:jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:t.row,children:e.map(o=>jsx(uf,{card:o,styles:t},o.key))})})}i(cf,"Deck");function uf({card:e,styles:t}){let r=_(),n=ds(e),o=e.url!==null,a=jsxs(Fragment,{children:[jsxs(View,{style:t.cardHeader,children:[jsx(View,{style:[t.tierDot,{backgroundColor:e.tierColor}]}),jsx(v,{style:[t.cardTitle,o?t.cardTitleLink:null],numberOfLines:2,children:e.title}),o?jsx($i,{size:nf,color:r.color.linkInk,strokeWidth:1.5}):null]}),e.meta!==null?jsx(v,{tier:"compact",style:t.cardMeta,numberOfLines:1,children:e.meta}):null,e.excerpt!==null?jsx(v,{style:t.cardExcerpt,numberOfLines:3,children:e.excerpt}):null]});if(e.url!==null){let s=e.url;return jsx(D,{accessibilityRole:"link",accessibilityLabel:n,style:t.card,onPress:()=>{Linking.openURL(s);},children:a})}return jsx(View,{accessible:true,accessibilityRole:"text",accessibilityLabel:n,style:t.card,children:a})}i(uf,"Card");function pf(e){let t=e.color,r=e.space,n=e.radius,o=e.type.size;return StyleSheet.create({block:{gap:r.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:n.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:r.xs+2,paddingHorizontal:r.md,paddingVertical:r.xs+2,borderRadius:n.pill,backgroundColor:t.brandSoft},toggleLabel:{...C(e,"monoBold"),fontSize:o.micro,lineHeight:o.micro,letterSpacing:of,color:t.brandInk,textTransform:"uppercase"},row:{gap:r.sm,paddingRight:r.xl,paddingTop:r.xs},card:{width:rf,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.md,gap:r.xs+2},cardHeader:{flexDirection:"row",alignItems:"center",gap:r.sm},tierDot:{width:us,height:us,borderRadius:n.pill},cardTitle:{...C(e,"bold"),flex:1,fontSize:o.bodyTight,lineHeight:sf,color:t.text.primary,letterSpacing:af},cardTitleLink:{color:t.linkInk},cardMeta:{...C(e,"monoMedium"),fontSize:o.nano,lineHeight:lf,letterSpacing:e.type.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},cardExcerpt:{...C(e,"regular"),fontSize:o.tiny,lineHeight:df,color:t.text.muted}})}i(pf,"makeStyles");var ms=44,bf="rgba(17,17,17,0.55)",gs=26,vf=36,hs=4,xn=20,In=38,Cf=18,Ef=12;function bs({visible:e,onSubmit:t,onSkip:r}){let n=_(),o=useMemo(()=>Rf(n),[n]),[a,s]=useState(null),[d,l]=useState(""),[c,u]=useState(false),[f,y]=useState(false),b=i(()=>{s(null),l(""),u(false),y(false);},"reset"),g=i(()=>{c||(b(),r());},"skip"),x=i(async()=>{if(c)return;u(true),y(false);let T=d.trim();await t(a,T.length>0?T:null)?b():(u(false),y(true));},"submit");if(!e)return null;let m=[...d].length>_r;return jsx(Modal,{visible:true,transparent:true,animationType:n.motion.reducedMotion?"none":"slide",onRequestClose:g,children:jsxs(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":void 0,style:o.root,children:[jsx(Pressable,{style:o.scrim,onPress:g,accessibilityRole:"button",accessibilityLabel:p.feedbackSkipA11y}),jsxs(View,{style:o.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[jsx(View,{style:o.handle}),jsxs(View,{style:o.header,children:[jsx(View,{style:o.iconBadge,children:jsx($t,{size:Cf,color:n.color.brandInk,active:false,rotate:"180deg"})}),jsxs(View,{style:o.headerText,children:[jsx(v,{tier:"heading",style:o.title,accessibilityRole:"header",children:p.feedbackTitle}),jsx(v,{style:o.subtitle,children:p.feedbackSubtitle})]})]}),jsx(View,{style:o.options,children:Cr.map(T=>{let I=a===T.key;return jsxs(D,{accessibilityRole:"button",accessibilityLabel:T.label,accessibilityState:{selected:I},style:[o.option,I?o.optionSelected:null],onPress:()=>s(O=>O===T.key?null:T.key),children:[jsx(v,{style:[o.optionLabel,I?o.optionLabelSelected:null],children:T.label}),jsx(View,{style:[o.radio,I?o.radioSelected:null],children:I?jsx(Ae,{size:Ef,color:n.color.surface,strokeWidth:2}):null})]},T.key)})}),jsxs(View,{style:o.inputWrap,children:[jsx(Qe,{style:o.input,placeholder:p.feedbackNotesPlaceholder,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:p.feedbackNotesPlaceholder,value:d,onChangeText:l,multiline:true,editable:!c}),d.length>0?jsx(v,{tier:"compact",style:[o.counter,m?o.counterOver:null],children:`${[...d].length}/${_r}`}):null]}),f?jsx(v,{style:o.failed,accessibilityRole:"alert",children:p.feedbackFailed}):null,jsxs(View,{style:o.actions,children:[jsx(D,{accessibilityRole:"button",accessibilityLabel:p.feedbackSubmit,accessibilityState:{busy:c,disabled:c||m},disabled:c||m,style:[o.submit,c||m?o.submitDisabled:null],onPress:()=>{x();},children:jsx(v,{tier:"control",style:o.submitLabel,children:p.feedbackSubmit})}),jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:p.feedbackSkipA11y,hitSlop:8,onPress:g,style:o.skip,children:jsx(v,{tier:"control",style:o.skipLabel,children:p.feedbackSkip})})]})]})]})})}i(bs,"FeedbackReasons");function Rf(e){let t=e.color,r=e.type,n=e.radius,o=e.slots;return StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{...StyleSheet.absoluteFillObject,backgroundColor:bf},sheet:{backgroundColor:t.surface,borderTopLeftRadius:gs,borderTopRightRadius:gs,paddingHorizontal:22,paddingTop:12,paddingBottom:34,gap:14},handle:{alignSelf:"center",width:vf,height:hs,borderRadius:hs/2,backgroundColor:t.brandBorder,marginBottom:2},header:{flexDirection:"row",alignItems:"center",gap:12},iconBadge:{width:In,height:In,borderRadius:In/2,alignItems:"center",justifyContent:"center",backgroundColor:t.brandSoft},headerText:{flex:1,gap:2},title:{...C(e,"bold"),fontSize:20,lineHeight:28,color:t.text.primary,letterSpacing:r.letterSpacing.tight},subtitle:{...C(e,"regular"),fontSize:r.size.body,lineHeight:r.size.body*r.lineHeight.relaxed,color:t.text.muted},options:{gap:8},option:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:14,paddingVertical:13,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder,backgroundColor:t.surface},optionSelected:{borderColor:t.brandInk,backgroundColor:t.brandSoft},optionLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.primary},optionLabelSelected:{color:t.brandInk},radio:{width:xn,height:xn,borderRadius:xn/2,borderWidth:2,borderColor:t.brandBorder,alignItems:"center",justifyContent:"center"},radioSelected:{borderColor:t.brandInk,backgroundColor:t.brandInk},inputWrap:{gap:4},input:{minHeight:72,maxHeight:132,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder,paddingHorizontal:14,paddingTop:12,paddingBottom:12,...C(e,"regular"),fontSize:r.size.body,color:t.text.primary,textAlignVertical:"top"},counter:{...C(e,"mono"),alignSelf:"flex-end",fontSize:r.size.caption,letterSpacing:.3,color:t.text.placeholder},counterOver:{color:t.danger},failed:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},actions:{gap:10,alignItems:"center"},submit:{alignSelf:"stretch",minHeight:ms,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.xl,borderRadius:n.pill,backgroundColor:t.brand,...re(o.primaryButton)},submitDisabled:{opacity:.6},submitLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.onPrimary,...fe(o.primaryButton)},skip:{minHeight:ms,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},skipLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.muted}})}i(Rf,"makeStyles");var Df=.88,Lf=420,Nf=58,Hf="rgba(17,17,17,0.28)",Uf=.08,zf=.1,Bf=.08,jf=.18,Wf=.78,Gf=.7,An=36,qf=10,Yf=14,Kf=12,$f=16,Qf=14,On=8,Xf=1.5,Zf=.5,Jf=Xt(mt.standard);function ey(e){return Math.min(Math.round(e*Df),Lf)}i(ey,"drawerPanelWidth");function Cs({chat:e,history:t}){let[r,n]=useState(t.open),o=useCallback(()=>n(false),[]);return t.open&&!r&&n(true),r?jsx(ty,{chat:e,history:t,onHidden:o}):null}i(Cs,"HistoryDrawer");function ty({chat:e,history:t,onHidden:r}){let n=_(),o=useMemo(()=>ny(n),[n]),a=q(),s=useSafeAreaInsets(),{width:d}=useWindowDimensions(),l=ey(d),c=t.open,u=useRef(null);u.current===null&&(u.current=new Animated.Value(a.drawerMs<=0&&c?1:0));let f=u.current;useEffect(()=>{if(!c&&a.drawerMs<=0){r();return}let T=Animated.timing(f,{toValue:c?1:0,duration:a.drawerMs,easing:Jf,useNativeDriver:true});return T.start(({finished:I})=>{I&&!c&&r();}),()=>T.stop()},[c,f,a.drawerMs,r]);let y=f.interpolate({inputRange:[0,1],outputRange:[-l,0]}),b=t.filtered,g=t.rows.length===0,x=g&&t.loading?jsxs(View,{style:o.emptyCard,accessibilityLabel:G.loading,accessibilityState:{busy:true},children:[jsx(ActivityIndicator,{color:n.color.onPrimary}),jsx(v,{style:o.emptyBody,children:G.loading})]}):g&&t.error!==null?jsxs(View,{style:o.emptyCard,children:[jsx(v,{style:o.emptyTitle,accessibilityRole:"alert",children:G.loadFailed}),jsx(v,{style:o.emptyBody,children:t.error}),jsx(D,{accessibilityRole:"button",accessibilityLabel:G.retryA11y,containerStyle:o.retrySlot,style:o.retryButton,onPress:()=>{t.load();},children:jsx(v,{tier:"control",style:o.retryText,children:G.retry})})]}):jsxs(View,{style:o.emptyCard,children:[jsx(v,{style:o.emptyTitle,children:t.emptyKind==="empty"?G.empty:G.noMatch}),jsx(v,{style:o.emptyBody,children:t.emptyKind==="empty"?G.emptyBody:G.noMatchBody})]}),m=!t.searching&&t.loadingMore?jsx(View,{style:o.loadMoreFooter,children:jsx(v,{style:o.loadMoreLabel,children:G.loadingMore})}):null;return jsx(Modal,{visible:true,transparent:true,animationType:"none",onRequestClose:t.close,children:jsxs(View,{style:o.root,children:[jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:t.close,accessibilityRole:"button",accessibilityLabel:G.closeA11y,children:jsx(Animated.View,{style:[o.backdrop,{opacity:f}]})}),jsx(Animated.View,{style:[o.panel,{width:l,paddingTop:Math.max(Nf,s.top+n.space.md),transform:[{translateX:y}]}],accessibilityViewIsModal:true,children:jsxs(KeyboardAvoidingView,{style:o.keyboardAvoider,behavior:Platform.OS==="ios"?"padding":"height",children:[jsxs(View,{style:o.searchRow,children:[jsxs(View,{style:o.searchPill,children:[jsx(ta,{size:Qf,color:n.color.text.muted,strokeWidth:1.5}),jsx(Qe,{value:t.query,onChangeText:T=>t.setQuery(T.replace(/^\s+/,"")),style:o.searchInput,placeholder:G.search,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:G.search,autoCorrect:false,autoCapitalize:"none",returnKeyType:"search"})]}),jsx(D,{accessibilityRole:"button",accessibilityLabel:G.newConversation,style:o.newButton,onPress:t.newConversation,children:jsx(ra,{size:$f,color:n.color.text.primary,strokeWidth:1.5})})]}),jsx(v,{tier:"heading",style:o.heading,accessibilityRole:"header",children:G.heading}),t.error!==null&&!g?jsx(View,{style:o.errorCard,children:jsx(v,{style:o.errorText,accessibilityRole:"alert",children:t.error})}):null,jsx(FlatList,{data:b,keyExtractor:T=>T.id,renderItem:({item:T})=>jsx(ry,{row:T,active:T.id===e.conversationId,disabled:t.loading,styles:o,onPress:()=>{t.resume(T.id);}}),contentContainerStyle:b.length===0?o.listEmpty:o.list,keyboardShouldPersistTaps:"handled",ListEmptyComponent:x,ListFooterComponent:m,onEndReached:t.loadMore,onEndReachedThreshold:Zf})]})})]})})}i(ty,"DrawerModal");function ry({row:e,active:t,disabled:r,styles:n,onPress:o}){let a=e.unreadCount!==null&&e.unreadCount>0;return jsx(D,{accessibilityRole:"button",accessibilityLabel:Pi(e),accessibilityState:{selected:t,disabled:r},disabled:r,style:[n.item,t?n.itemActive:null],onPress:o,children:jsxs(View,{style:n.itemRow,children:[jsx(v,{style:[n.itemTitle,a?n.itemTitleUnread:null],numberOfLines:1,children:qt(e.title)}),a?jsx(View,{style:n.unreadDot}):null]})})}i(ry,"Row");function dr(e,t){if(!/^#[0-9a-f]{6}$/i.test(e))return "transparent";let r=Math.round(Math.min(1,Math.max(0,t))*255);return `${e}${r.toString(16).padStart(2,"0").toUpperCase()}`}i(dr,"inkWash");function ny(e){let t=e.color,r=e.slots,n=t.onPrimary;return StyleSheet.create({root:{flex:1},backdrop:{flex:1,backgroundColor:Hf},panel:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:t.brand,paddingHorizontal:16,borderRightWidth:.5,borderRightColor:t.brandBorder,gap:12},keyboardAvoider:{flex:1,gap:12},searchRow:{flexDirection:"row",alignItems:"center",gap:10},searchPill:{flex:1,flexDirection:"row",alignItems:"center",gap:8,borderRadius:e.radius.pill,backgroundColor:t.surface,paddingHorizontal:14,paddingVertical:10,borderWidth:1,borderColor:dr(n,zf)},searchInput:{...C(e,"regular"),flex:1,fontSize:13,lineHeight:16,color:t.text.primary,padding:0},newButton:{width:An,height:An,borderRadius:An/2,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},heading:{...C(e,"bold"),fontSize:14,lineHeight:17,color:n,marginTop:4},list:{gap:10,paddingBottom:28},listEmpty:{flexGrow:1},item:{paddingVertical:12,paddingHorizontal:4,borderRadius:qf},itemActive:{backgroundColor:dr(n,Uf)},itemRow:{flexDirection:"row",alignItems:"center",gap:8},itemTitle:{...C(e,"regular"),flex:1,fontSize:14,lineHeight:18,color:n},itemTitleUnread:C(e,"bold"),unreadDot:{width:On,height:On,borderRadius:On/2,backgroundColor:t.danger,borderWidth:Xf,borderColor:n},errorCard:{borderRadius:Kf,borderWidth:.5,borderColor:t.danger,backgroundColor:t.surface,padding:12},errorText:{...C(e,"regular"),fontSize:11,lineHeight:16,color:t.danger},emptyCard:{borderRadius:Yf,padding:14,gap:6,backgroundColor:dr(n,Bf),borderWidth:.5,borderColor:dr(n,jf)},emptyTitle:{...C(e,"bold"),fontSize:12,lineHeight:15,color:n},emptyBody:{...C(e,"regular"),fontSize:11,lineHeight:17,color:n,opacity:Wf},retrySlot:{marginTop:8,alignSelf:"flex-start"},retryButton:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:7,borderWidth:1,borderColor:n,...re(r.primaryButton)},retryText:{...C(e,"bold"),fontSize:12,lineHeight:15,color:n,...fe(r.primaryButton)},loadMoreFooter:{paddingVertical:14,alignItems:"center"},loadMoreLabel:{...C(e,"regular"),fontSize:11,lineHeight:14,color:n,opacity:Gf}})}i(ny,"makeStyles");function Es(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}i(Es,"formatMessageTime");var Pt=15,ly=15,dy=6,cy=Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function ks({message:e,onCopy:t,sentiment:r=null,onSentiment:n,thanks:o=false}){let a=_(),s=useMemo(()=>uy(a),[a]),d=q(),l=e.role==="user",c=useMemo(()=>Es(e.createdAt),[e.createdAt]),u=t!==void 0&&e.text.length>0,f=!l&&n!==void 0&&e.responseId!==void 0,[y,b]=useState(false),g=useRef(null);useEffect(()=>()=>{g.current&&clearTimeout(g.current);},[]);let x=i(()=>{t!==void 0&&(Xe(t,e.text),b(true),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{b(false),g.current=null;},d.copiedMs));},"copy");return c===null&&!u&&!f?null:jsxs(View,{style:s.wrap,children:[jsxs(View,{style:[s.row,l?s.rowUser:s.rowAssistant],children:[c!==null?jsx(v,{tier:"compact",style:s.timestamp,children:c}):null,u?jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:y?p.copied:l?p.copyUserMessage:p.copyAssistantMessage,hitSlop:ly,onPress:x,style:s.iconHit,children:y?jsx(Ae,{size:Pt,color:a.color.success,strokeWidth:2}):jsx(Qi,{size:Pt,color:a.color.text.timestamp,strokeWidth:1.5})}):null,f?Zn.map(({sentiment:m,label:T})=>jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:T,accessibilityState:{selected:r===m},hitSlop:dy,onPress:()=>n?.(m),style:s.iconHit,children:jsx($t,{size:Pt,color:a.color.sentiment[m],active:r===m,rotate:cy[m],strokeWidth:1.5})},m)):null]}),o?jsx(v,{style:s.thanks,accessibilityLiveRegion:"polite",children:p.feedbackThanks}):null]})}i(ks,"MessageFooter");function uy(e){let t=e.type;return StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...C(e,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:e.color.text.timestamp,textAlign:"center"},iconHit:{width:Pt,height:Pt,alignItems:"center",justifyContent:"center"},thanks:{...C(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.text.secondary}})}i(uy,"makeStyles");var ws="#000000",py="#83E0B4",fy=Object.freeze([Object.freeze({id:"breed-health-miss",intent:"send",label:"What {breed} health issue do owners miss most?",fallbackLabel:"What {species} health issue do owners miss most?",background:"#A0C4F6",borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:py,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:"#10462E",borderWidth:1}),Object.freeze({id:"vet-prep",intent:"vet_report",label:"Help me prep for {petName}\u2019s vet visit.",background:"#FFBDBD",borderColor:"#6D1D14",borderWidth:1.25})]),yy=/\s*-\s*(?:small|medium|large|giant|toy)\s*$/i;function my(e){return e==null?e:e.replace(yy,"").trim()}i(my,"formatBreedForPrompt");var gy=new Set(["","?","-","--",".","n/a","na","none","null","nil","unknown","unspecified","unsure","not sure","not specified","not applicable","no idea","dunno","idk","tbd","other","i dont know","i don't know","dont know","don't know","do not know","i do not know","not known","no clue"]);function hy(e){let t=String(e??"").replace(/\s+/gu," ").trim().toLowerCase().replace(/\u2019/g,"'");return gy.has(t)}i(hy,"isUninformativeBreed");function by(e){return e==="cat"?"Domestic Short Hair Mix":"Mixed Breed"}i(by,"unspecifiedBreedLabel");function vy(e,t){return hy(e)?by(t):String(e).replace(/\s+/gu," ").trim()}i(vy,"resolveBreedLabel");function _s(e){let t=e?.name?.trim()||p.emptyTitlePetFallback;return B(p.emptyTitle,{petName:t})}i(_s,"emptyStateTitle");function xs(e){let t=gn(e?.species),r=t==="cat"?"my cat":"my dog",n=e?.name?.trim()||null,o=n||r,a=vy(my(e?.breed),t)||null,s=hn(e?.ageYears),d=s===null?null:String(s);return Object.freeze(fy.map(l=>{let c=l.label.includes("{breed}"),u=l.label.includes("{ageYears}"),y=l.fallbackLabel!==void 0&&(c&&!a||u&&!d)&&l.fallbackLabel?l.fallbackLabel:l.label,b=B(y,{petName:o,breed:a??r,species:t,ageYears:d??""}),g=!n&&y.startsWith("{petName}")?b.charAt(0).toUpperCase()+b.slice(1):b;return Object.freeze({id:l.id,intent:l.intent,label:g,background:l.background,borderColor:l.borderColor,borderWidth:l.borderWidth})}))}i(xs,"resolveQuickPrompts");var Ey=36,Os=4,Ry=340;function Fs({pet:e,petRef:t,onSend:r,onVetPrep:n,vet:o}){let a=_(),s=useMemo(()=>Py(a),[a]),d=useMemo(()=>xs(e),[e]),l=_s(e);return jsxs(View,{style:s.block,children:[jsx(v,{tier:"heading",style:s.title,accessibilityRole:"header",children:l}),jsx(View,{style:s.list,children:d.map((c,u)=>jsx(Sy,{prompt:c,index:u,petRef:t,onSend:r,onVetPrep:n,vet:o,pet:e,styles:s},c.id))})]})}i(Fs,"QuickPrompts");function Sy({prompt:e,index:t,pet:r,petRef:n,onSend:o,onVetPrep:a,vet:s,styles:d}){let l=q(),c=Be(l.followUpInMs,{delayMs:Wt(l,t)}),u={backgroundColor:e.background,borderColor:e.borderColor,borderWidth:e.borderWidth};return e.intent==="vet_report"?a!==void 0?jsx(Animated.View,{style:c,children:jsx(D,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Os,style:[d.chip,u],onPress:()=>{W(a,r);},children:jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})}):n===null?null:jsx(Animated.View,{style:c,children:jsx(et,{entry:"chat",petRef:n,label:e.label,...s?.returnTo!==void 0?{returnTo:s.returnTo}:{},...s?.usState!==void 0?{usState:s.usState}:{},style:[d.chip,u],labelStyle:d.chipLabel})}):jsx(Animated.View,{style:c,children:jsx(D,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Os,style:[d.chip,u],onPress:()=>o(e.label),children:jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})})}i(Sy,"Chip");function Py(e){let t=e.color;return StyleSheet.create({block:{gap:18,alignItems:"center",width:"100%"},title:{...C(e,"bold"),fontSize:28,lineHeight:34,color:t.text.primary,letterSpacing:-0.8,textAlign:"center",maxWidth:Ry},list:{width:"100%",gap:12,alignItems:"center"},chip:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:9,minHeight:Ey,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipLabel:{...C(e,"bold"),fontSize:12,lineHeight:14,color:ws,textAlign:"center"}})}i(Py,"makeStyles");var Mn=/\*\*([^*]+?)\*\*|\*([^*]+?)\*|`([^`]+?)`/g;function Ms(e){return e.includes("*")||e.includes("`")}i(Ms,"hasInlineMarkup");function Vs(e){let t=[],r=0;Mn.lastIndex=0;for(let n=Mn.exec(e);n!==null;n=Mn.exec(e)){n.index>r&&t.push({kind:"text",text:e.slice(r,n.index)});let o=n[1],a=n[2],s=n[3];o!==void 0?t.push({kind:"bold",text:o}):a!==void 0?t.push({kind:"italic",text:a}):s!==void 0&&t.push({kind:"code",text:s}),r=n.index+n[0].length;}return r<e.length&&t.push({kind:"text",text:e.slice(r)}),t}i(Vs,"tokenizeInlineMarkdown");function Ds(e,t){return Ms(e)?Vs(e).map((r,n)=>{switch(r.kind){case "bold":return jsx(v,{style:t.bold,children:r.text},n);case "italic":return t.italic?jsx(v,{style:t.italic,children:r.text},n):r.text;case "code":return t.code?jsx(v,{style:t.code,children:r.text},n):r.text;default:return r.text}}):e}i(Ds,"renderInlineMarkdown");var Hs=6,Bs=520,Iy=Math.round(Bs*.18),Us=.44,Ay=.5,zs=[0,.5,1],Oy=[0,1,2];function js(){let e=_(),t=useMemo(()=>My(e),[e]),r=!e.motion.reducedMotion;return jsx(View,{style:t.card,accessible:true,accessibilityRole:"text",accessibilityLabel:p.typing,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:Oy.map(n=>r?jsx(Fy,{index:n,style:t.dot},n):jsx(View,{style:[t.dot,t.dotStatic]},n))})}i(js,"TypingIndicator");function Fy({index:e,style:t}){let r=useRef(new Animated.Value(0)).current;useEffect(()=>{let a=Animated.sequence([Animated.delay(e*Iy),Animated.loop(Animated.timing(r,{toValue:1,duration:Bs,useNativeDriver:true}))]);return a.start(),()=>a.stop()},[r,e]);let n=r.interpolate({inputRange:zs,outputRange:[Us,1,Us]}),o=r.interpolate({inputRange:zs,outputRange:[0,-3.5,0]});return jsx(Animated.View,{style:[t,{opacity:n,transform:[{translateY:o}]}]})}i(Fy,"AnimatedDot");function My(e){let t=e.color,r=e.space,n=e.radius;return StyleSheet.create({card:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingHorizontal:r.md,paddingVertical:r.sm,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},dot:{width:Hs,height:Hs,borderRadius:n.pill,backgroundColor:t.brand},dotStatic:{opacity:Ay}})}i(My,"makeStyles");function Ws(e,t){let r={entry:"chat",petRef:e};return t?.returnTo!==void 0&&(r.returnTo=t.returnTo),t?.usState!==void 0&&(r.usState=t.usState),r}i(Ws,"chatVetVisitOptions");var Ny=16,Hy=.75,Dn=12,Gs=15,Uy=18,ur=22,zy=14,By=8,jy=20,Wy=10,Gy=13;function Ys({surface:e,petRef:t,renderVetAction:r,onFindVet:n,vet:o}){let a=_(),s=useMemo(()=>qy(a),[a]),d=q(),l=e.tier,c=e.source;return jsxs(Fragment,{children:[jsx(en,{visible:e.showBanner&&l!==null,inMs:d.bannerInMs,outMs:d.bannerOutMs,style:s.pinned,children:l!==null&&c!==null?jsxs(View,{accessibilityRole:"alert",style:[s.card,{borderColor:l.borderColor,backgroundColor:l.backgroundColor}],children:[jsx(v,{tier:"compact",style:[s.label,{color:l.textColor}],children:l.label}),c.reason!==null?jsx(v,{style:[s.reason,{color:l.reasonColor}],children:c.reason}):null,e.showVetAction?r!==void 0?jsx(Ue,{render:()=>r(l.level),fallback:jsx(qs,{tier:l,petRef:t,onFindVet:n,vet:o,styles:s}),resetKey:l.level}):jsx(qs,{tier:l,petRef:t,onFindVet:n,vet:o,styles:s}):null,e.dismissLabel!==null?jsx(D,{accessibilityRole:"button",accessibilityLabel:e.dismissLabel,hitSlop:By,containerStyle:s.closeSlot,style:s.closeButton,onPress:e.dismiss,children:jsx(ze,{size:zy,color:l.textColor,strokeWidth:1.5})}):null]}):null}),jsx(en,{visible:e.showCompactIcon,inMs:d.iconInMs,outMs:d.iconOutMs,style:s.indicatorRow,children:jsx(D,{accessibilityRole:"button",accessibilityLabel:p.showLatestVetAlert,hitSlop:Wy,onPress:e.expand,children:jsx(Xi,{size:jy,color:a.color.text.muted,strokeWidth:2})})})]})}i(Ys,"UrgencyBanner");function qs({tier:e,petRef:t,onFindVet:r,vet:n,styles:o}){let a=_(),s=tr(Ws(t,n)),d=s.status==="opening",l=s.available?()=>{s.open();}:r!==void 0?()=>{W(r,e.level);}:null;if(l===null)return null;let c=kr(a.slots.vetVisitButton)?.textColor??e.textColor;return jsxs(D,{accessibilityRole:"button",accessibilityLabel:p.findVetA11y,accessibilityState:{busy:d},containerStyle:o.findVetSlot,style:[o.findVetButton,{borderColor:e.borderColor,backgroundColor:e.pillColor},o.findVetSlotBox,d?o.findVetBusy:null],onPress:l,children:[jsx(na,{size:Gy,color:c,strokeWidth:1.5}),jsx(v,{tier:"control",style:[o.findVetLabel,{color:c}],children:p.findVet})]})}i(qs,"VetAction");function qy(e){let t=kr(e.slots.vetVisitButton);return StyleSheet.create({pinned:{marginTop:0,marginBottom:4,paddingHorizontal:e.space.lg},card:{borderRadius:Ny,borderWidth:Hy,paddingHorizontal:14,paddingVertical:8,gap:2},label:{...C(e,"monoBold"),fontSize:Dn,lineHeight:Gs},reason:{...C(e,"regular"),fontSize:Dn,lineHeight:Uy,paddingRight:ur},findVetSlot:{alignSelf:"flex-start",marginTop:6},findVetButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:e.radius.pill,borderWidth:1},findVetSlotBox:{...re(t,1)},findVetBusy:{opacity:.6},findVetLabel:{...C(e,"monoBold"),fontSize:Dn,lineHeight:Gs},closeSlot:{position:"absolute",top:6,right:6},closeButton:{width:ur,height:ur,borderRadius:ur/2,alignItems:"center",justifyContent:"center"},indicatorRow:{alignItems:"flex-end",paddingHorizontal:16,paddingTop:2,paddingBottom:4}})}i(qy,"makeStyles");function Ks(){let e=cn(),{handle:t}=ie(),r=useCallback(n=>t.setActivePet(n),[t]);return useMemo(()=>({...e,setActivePet:r}),[e,r])}i(Ks,"useChatPets");var tm=300,rm=3e3,$s=120,nt=44,nm=120,om="86%",Qs=15,Xs=22,fr=.5,im=.04,am=8,sm=2,lm=1,dm=.6,cm=22,um=48,Zs=1.25,pm=14,fm=18,ym=6,mm=14,gm=.04,hm=12,bm=2,vm=2,Js=36,Cm=20,rt=36,yr=(nt-rt)/2,Em=24,Rm=22,Sm=.4,Nn=30,Pm=20,Tm=.4,km=480,wm="12%",_m=Object.freeze(["photo"]),xm=1;function Im(e){let{style:t,renderPending:r}=e;return jsx(Hi,{capability:"chat",style:t,...r?{renderPending:r}:{},children:jsx(Am,{...e})})}i(Im,"EverfurChat");function Am({petRef:e,conversationId:t,style:r,renderPending:n,onCopy:o,onPetChange:a,onVetPrep:s,onFindVet:d,renderVetAction:l,attachments:c,pet:u,onAddPet:f,checkinTarget:y,initialAsk:b,composerSeed:g,lifecycle:x,draftStore:m,vetReturnTo:T,vetUsState:I}){let{theme:O,styles:F}=he(),h=q(),E=useMemo(()=>Fi(e,t),[e,t]),R=xt(E),L=Ii(R),P=Ks(),k=Ti(R),M=useSafeAreaInsets(),H=Ai(R),X=useMemo(()=>d===void 0?void 0:()=>{W(d,"emergency");},[d]),U=useMemo(()=>T===void 0&&I===void 0?void 0:{returnTo:T,usState:I},[T,I]),te=kn(P.pets,R.petRef),oe=useMemo(()=>_i(R.messages,te?.name??null),[R.messages,te?.name]),z=xi(oe);Zt(z.showBanner,h),bi(R.openCheckin,y),ui(R.askEverfur,R.isBootstrapping,b);let De=useMemo(()=>Hr(g),[g]);gi(x,{conversationId:R.conversationId===null?null:String(R.conversationId),isTurnInFlight:R.isStreaming,refresh:R.refreshActiveThread});let Tt=(R.hasUnreadThreads??false)||k.rows.some(be=>be.unreadCount!==null&&be.unreadCount>0)||(R.unreadCount??0)>0,it=di(R.messages),[Ye,Ke]=useState(null),il=useCallback(()=>Ke(null),[]),[at,mr]=useState(null),[al,Un]=useState(null),$e=useRef(null);useEffect(()=>()=>{$e.current&&clearTimeout($e.current);},[]);let zn=useCallback(be=>{Un(String(be)),$e.current&&clearTimeout($e.current),$e.current=setTimeout(()=>{Un(null),$e.current=null;},rm);},[]),sl=useCallback((be,kt)=>{let st=be.responseId;if(st===void 0)return;let ul=R.sentimentByMessage[String(st)];R.feedback(st,kt),kt==="down"&&ul!=="down"&&mr(st);},[R]),ll=useCallback(async(be,kt)=>at===null||!(await R.feedback(at,"down",be??"other",kt)).ok?false:(mr(null),zn(at),true),[R,at,zn]),dl=useCallback(()=>mr(null),[]),cl=useCallback(be=>{R.send(be);},[R.send]),Bn={send:R.send,stop:R.stop,isStreaming:R.isStreaming,conversationId:R.conversationId,seed:De,draftStore:m,onStage:it.stage,onPreview:Ke};return jsxs(KeyboardAvoidingView,{style:[F.container,{paddingTop:M.top},r],behavior:Platform.OS==="ios"?"padding":void 0,children:[jsx(Za,{pets:P,petRef:R.petRef,historyUnread:Tt,onOpenHistory:k.show,onPetChange:a,onAddPet:f,vet:U}),u!==void 0?jsx(Om,{petRef:e??null,pet:u,onRegistered:P.refresh}):null,jsx(Ys,{surface:z,petRef:R.petRef,renderVetAction:l,onFindVet:d,vet:U}),jsx(View,{style:F.body,children:Lm(L,R,{notice:H,vet:U,onCheckinFindVet:X,onSelectPrompt:cl,renderPending:n,shownPet:te,onVetPrep:s,onCopy:o,onSentiment:sl,thanksFor:al,imagesByMessage:it.byMessage,onPreview:Ke,onAddPet:f})}),c!==void 0?jsx(Fm,{...Bn,attachments:c}):jsx(nl,{...Bn,attachments:null}),jsx(ji,{}),O.meta.hidePoweredBy?null:jsx(v,{tier:"compact",style:F.poweredBy,accessibilityRole:"text",accessibilityLabel:p.poweredBy,children:p.poweredBy}),jsx(Cs,{chat:R,history:k}),jsx(bs,{visible:at!==null,onSubmit:ll,onSkip:dl}),jsx(ua,{uri:Ye?.uri??null,label:Ye?.label??"",onClose:il})]})}i(Am,"ChatBody");function Om({petRef:e,pet:t,onRegistered:r}){let{styles:n}=he(),o=oi(e,t,r);return o.status!=="failed"||o.error===null?null:jsxs(View,{style:n.setupNotice,accessible:true,accessibilityRole:"alert",children:[jsx(v,{tier:"compact",style:n.setupNoticeText,children:o.error.displayMessage}),jsx(Pressable,{onPress:o.retry,accessibilityRole:"button",accessibilityLabel:p.retry,hitSlop:yr,children:jsx(v,{tier:"control",style:n.setupNoticeAction,children:p.retry})})]})}i(Om,"PetSetupNotice");function Fm({attachments:e,...t}){let r=useMemo(()=>ln(),[]),n=Or({maxPerMessage:e.maxPerMessage??xm,transport:r}),o=useMemo(()=>({state:n,sources:e.sources??_m,pick:e.pick}),[n,e.sources,e.pick]);return jsx(nl,{...t,attachments:o})}i(Fm,"ComposerWithAttachments");function nl({send:e,stop:t,isStreaming:r,conversationId:n,attachments:o,seed:a,draftStore:s,onStage:d,onPreview:l}){let{theme:c,styles:u}=he(),f=q(),[y,b]=Ei(e,n,a);Ri(s,n===null?null:String(n),y,b);let[g,x]=useState(false),[m,T]=useState(false);useEffect(()=>{T(false);},[n]);let I=c.meta.placeholder??p.placeholder,O=o?.state.uploading??false,F=o?.state.failed??false,h=O||F,E=o?.state.attachments??Mm;Zt(E.length,f);let R=useCallback(()=>{if(y.trim().length===0||h||[...y].length>xr)return;let U=o?.state.s3Keys??Vm;o!==null&&U.length>0?(d(o.state.attachments.filter(te=>te.status==="uploaded").map(te=>({uri:te.previewUri,filename:te.filename}))),e(y,{imageS3Keys:U}),o.state.clear()):e(y),b(""),T(false);},[y,e,h,o,d]),L=useCallback(()=>{t();},[t]),P=useCallback(U=>{x(false),o!==null&&(T(false),o.state.dismissRejected(),Xe(o.pick,U).then(te=>{if(!te.ok){T(true);return}te.value!==null&&o.state.add(te.value);}));},[o]),M=useMemo(()=>[...y].length>xr,[y])||h,H=o!==null&&E.length>=o.state.maxPerMessage,X=c.slots.sendButton?.textColor??c.color.brandInk;return jsxs(View,{style:u.composerOuter,children:[o!==null&&g?jsx(ya,{sources:o.sources,full:H,onPick:P,onClose:()=>x(false)}):null,jsxs(View,{style:u.composer,children:[o!==null?jsx(Ta,{attachments:E,rejected:m?Dm:o.state.rejected,uploadFailed:F,onRetry:o.state.retry,onRemove:o.state.remove,onPreview:U=>l({uri:U.previewUri,label:U.filename})}):null,jsxs(View,{style:u.composerRow,children:[o!==null?jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:Io(E.length,o.state.maxPerMessage),accessibilityState:{disabled:H,expanded:g},disabled:H,hitSlop:(nt-Nn)/2,style:[u.attachControl,H?u.attachControlDisabled:null],onPress:()=>x(U=>!U),children:jsx(Zi,{size:Pm,color:H?c.color.text.muted:c.color.brandInk,strokeWidth:1.75})}):null,jsx(Qe,{style:u.input,value:y,onChangeText:b,placeholder:I,placeholderTextColor:c.slots.composerInput?.textColor??c.color.text.placeholder,accessibilityLabel:I,onSubmitEditing:R,returnKeyType:"send",blurOnSubmit:false,multiline:true,editable:true}),r?jsx(Pressable,{onPress:L,accessibilityRole:"button",accessibilityLabel:p.stop,hitSlop:yr,style:u.sendControl,children:jsx(View,{style:u.sendDisc,testID:"everfur-stop-disc",children:jsx(ia,{size:Rm,color:X,testID:"everfur-stop-glyph"})})}):jsx(Pressable,{onPress:R,disabled:M,accessibilityRole:"button",accessibilityLabel:p.send,accessibilityState:{disabled:M,busy:O},hitSlop:yr,style:[u.sendControl,M?u.sendControlDisabled:null],children:jsx(View,{style:u.sendDisc,testID:"everfur-send-disc",children:jsx(oa,{size:Em,color:X,testID:"everfur-send-glyph"})})})]})]})]})}i(nl,"Composer");var Mm=Object.freeze([]),Vm=Object.freeze([]),Dm=Object.freeze({code:"unknown",retryable:true,filename:""});function Lm(e,t,r){switch(e){case "loading":return r.renderPending?jsx(Ue,{render:r.renderPending,fallback:jsx(el,{})}):jsx(el,{});case "empty":return jsx(Nm,{pet:r.shownPet,petRef:t.petRef,prompts:t.suggestedPrompts,onSelectPrompt:r.onSelectPrompt,onVetPrep:r.onVetPrep,vet:r.vet});case "error":return jsx(Um,{error:t.error,onRetry:t.retryLast,onAddPet:r.onAddPet});case "populated":return jsx(zm,{messages:t.messages,prompts:t.suggestedPrompts,onSelectPrompt:r.onSelectPrompt,isStreaming:t.isStreaming,onAnswerCheckin:t.petRef?t.answerCheckin:null,onCopy:r.onCopy,sentimentByMessage:t.sentimentByMessage,onSentiment:r.onSentiment,thanksFor:r.thanksFor,imagesByMessage:r.imagesByMessage,onPreview:r.onPreview,notice:r.notice,reconnecting:t.reconnecting===true,onRetry:t.retryLast,onStartNew:t.newConversation,petRef:t.petRef,onFindVet:r.onCheckinFindVet,vet:r.vet});default:return Ft(e)}}i(Lm,"renderView");function el(){let{theme:e,styles:t}=he(),[r,n]=useState(false);return useEffect(()=>{let o=setTimeout(()=>n(true),tm);return ()=>clearTimeout(o)},[]),jsx(View,{style:t.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:p.loading,children:r?jsx(ActivityIndicator,{color:e.color.brandInk}):null})}i(el,"LoadingState");function Nm({pet:e,petRef:t,prompts:r,onSelectPrompt:n,onVetPrep:o,vet:a}){let{styles:s}=he();return jsxs(ScrollView,{contentContainerStyle:s.emptyContent,keyboardShouldPersistTaps:"handled",accessibilityLabel:p.empty,children:[jsx(Fs,{pet:e,petRef:t,onSend:n,onVetPrep:o,vet:a}),jsx(ol,{prompts:r,onSelectPrompt:n})]})}i(Nm,"EmptyState");function ol({prompts:e,onSelectPrompt:t}){let{styles:r}=he();return e.length===0?null:jsxs(View,{style:r.followUps,children:[jsx(v,{tier:"compact",style:r.followUpsLabel,accessibilityRole:"header",children:p.followUps}),e.map((n,o)=>jsx(Hm,{prompt:n,index:o,onSelectPrompt:t},n))]})}i(ol,"FollowUps");function Hm({prompt:e,index:t,onSelectPrompt:r}){let{styles:n}=he(),o=q(),a=Be(o.followUpInMs,{delayMs:Wt(o,t)});return jsx(Animated.View,{style:a,children:jsx(Pressable,{onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:e,style:[n.followUpRow,t>0?n.followUpDivider:null],children:jsx(v,{style:n.followUpText,children:e})})})}i(Hm,"FollowUpRow");function Um({error:e,onRetry:t,onAddPet:r}){let{styles:n}=he(),o=ni(e)?yi(r):void 0;return jsxs(View,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[jsx(v,{style:n.errorText,children:e.displayMessage}),o!==void 0?jsx(Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:p.addPet,style:n.retryButton,children:jsx(v,{tier:"control",style:n.retryLabel,children:p.addPet})}):null,e.retryable?jsx(Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:p.retry,style:n.retryButton,children:jsx(v,{tier:"control",style:n.retryLabel,children:p.retry})}):null]})}i(Um,"ErrorState");function zm({messages:e,prompts:t,onSelectPrompt:r,isStreaming:n,onAnswerCheckin:o,onCopy:a,sentimentByMessage:s,onSentiment:d,thanksFor:l,imagesByMessage:c,onPreview:u,notice:f,reconnecting:y,onRetry:b,onStartNew:g,petRef:x,onFindVet:m,vet:T}){let{styles:I}=he(),O=q();Zt(e.length,O);let F=Oi(e,n),h=e[e.length-1];return jsxs(ScrollView,{style:I.list,contentContainerStyle:I.listContent,accessibilityLabel:p.transcript,keyboardShouldPersistTaps:"handled",children:[e.map(E=>E.checkin?jsx(is,{message:E,checkin:E.checkin,onAnswer:o,petRef:x,onFindVet:m,vet:T},E.id):jsx(Wm,{message:E,revealing:n&&E===h&&E.role==="assistant",onCopy:a,sentiment:E.responseId===void 0?null:s[String(E.responseId)]??null,onSentiment:d,thanks:l!==null&&E.responseId!==void 0&&String(E.responseId)===l,images:c[E.id]??jm,onPreview:u},E.id)),y?jsx(v,{tier:"compact",style:I.reconnectingCaption,accessibilityRole:"text",children:p.reconnecting}):null,F?jsx(js,{}):null,f!==null?jsx(Bm,{notice:f,onRetry:b,onStartNew:g}):null,n?null:jsx(ol,{prompts:t,onSelectPrompt:r})]})}i(zm,"PopulatedState");function Bm({notice:e,onRetry:t,onStartNew:r}){let{styles:n}=he(),o=e.tone==="error";return jsxs(View,{style:[n.turnNotice,o?n.turnNoticeError:null],accessible:true,accessibilityRole:"alert",children:[jsx(v,{tier:"control",style:[n.turnNoticeTitle,o?n.turnNoticeTitleError:null],children:e.title}),jsx(v,{tier:"compact",style:n.turnNoticeBody,children:e.body}),jsx(Pressable,{onPress:e.action==="startNew"?r:t,accessibilityRole:"button",accessibilityLabel:e.actionLabel,hitSlop:yr,style:n.turnNoticeAction,children:jsx(v,{tier:"control",style:n.turnNoticeActionLabel,children:e.actionLabel})})]})}i(Bm,"TurnNoticeCard");var jm=Object.freeze([]);function Wm({message:e,revealing:t,onCopy:r,sentiment:n,onSentiment:o,thanks:a,images:s,onPreview:d}){let{styles:l}=he(),c=q(),u=Be(c.messageInMs),f=ca(e.text,t,c),y=e.role==="user",b=y?p.senderUser:p.senderAssistant,g=useCallback(m=>o(e,m),[o,e]),x=e.pending!==true;return jsxs(Animated.View,{style:[l.rowBlock,y?l.rowBlockUser:l.rowBlockAssistant,u],children:[jsx(View,{style:[l.row,y?l.rowUser:l.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${b}: ${e.text}`,accessibilityState:e.pending===true?{busy:true}:void 0,children:jsxs(View,{style:[l.bubble,y?l.bubbleUser:l.bubbleAssistant,e.pending?l.bubblePending:null],children:[y&&s.length>0?jsx(ka,{images:s,onPreview:m=>d({uri:m.uri,label:m.filename})}):null,jsx(v,{style:y?l.bubbleTextUser:l.bubbleTextAssistant,children:y?e.text:Ds(f,{bold:l.bubbleBold,italic:l.bubbleItalic,code:l.bubbleCode})})]})}),!y&&!t?jsx(fs,{citations:e.citations}):null,x?jsx(ks,{message:e,onCopy:r,sentiment:n,onSentiment:e.responseId===void 0?void 0:g,thanks:a}):null]})}i(Wm,"MessageRow");function he(){let e=_(),t=useMemo(()=>Gm(e),[e]);return {theme:e,styles:t}}i(he,"useChatTheme");function Gm(e){let t=e.color,r=e.space,n=e.radius,o=e.type,a=e.slots;return StyleSheet.create({container:{flex:1,minHeight:$s,backgroundColor:t.chatGround},body:{flex:1},centered:{minHeight:$s,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},emptyContent:{flexGrow:1,alignItems:"center",justifyContent:"flex-start",paddingTop:wm,paddingHorizontal:r.lg,paddingBottom:r.lg,minHeight:km,gap:18},errorText:{...C(e,"regular"),fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,color:t.danger,textAlign:"center",marginBottom:r.md},retryButton:{minHeight:nt,minWidth:nt,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand,...re(a.primaryButton)},retryLabel:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,...fe(a.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.sm,backgroundColor:t.surfaceCream},setupNoticeText:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption,flexShrink:1},turnNotice:{gap:r.xs,padding:r.md,borderRadius:n.lg,backgroundColor:t.surfaceCream,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder,alignItems:"flex-start"},turnNoticeError:{borderColor:t.danger},turnNoticeTitle:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.body},turnNoticeTitleError:{color:t.danger},turnNoticeBody:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal},turnNoticeAction:{minHeight:nt,justifyContent:"center"},turnNoticeActionLabel:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.body},setupNoticeAction:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.caption},reconnectingCaption:{...C(e,"medium"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},list:{flex:1},listContent:{padding:r.lg,gap:r.md},rowBlock:{gap:r.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:r.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:om},bubbleUser:{padding:Qs,backgroundColor:t.bubbleUser,borderRadius:n.xl,borderBottomRightRadius:n.sm,borderWidth:fr,borderColor:t.accentEdge,shadowColor:t.brand,shadowOpacity:im,shadowRadius:am,shadowOffset:{width:0,height:sm},elevation:lm,...re(a.userBubble,fr)},bubbleAssistant:a.assistantBubble?.backgroundColor===void 0?{...re(a.assistantBubble,fr)}:{padding:Qs,borderRadius:n.xl,...re(a.assistantBubble,fr)},bubblePending:{opacity:dm},bubbleTextUser:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:Xs,...fe(a.userBubble)},bubbleTextAssistant:{...C(e,"medium"),color:t.text.primary,fontSize:o.size.body,lineHeight:Xs,...fe(a.assistantBubble)},bubbleBold:C(e,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:C(e,"mono"),followUps:{alignSelf:"stretch",marginTop:r.sm,borderRadius:n.md,backgroundColor:t.brandSoft,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},followUpsLabel:{...C(e,"medium"),color:t.text.secondary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase",paddingHorizontal:r.md,paddingTop:r.md,paddingBottom:r.sm},followUpRow:{minHeight:nt,justifyContent:"center",paddingHorizontal:r.md,paddingVertical:r.sm},followUpDivider:{borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:t.brandBorder},followUpText:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug},composerOuter:{position:"relative"},composer:{marginHorizontal:r.md,marginTop:r.xs,marginBottom:r.sm,minHeight:um,justifyContent:"center",paddingLeft:pm,paddingRight:fm,paddingVertical:ym,backgroundColor:t.composerFill,borderWidth:Zs,borderColor:t.composerBorder,borderRadius:cm,shadowColor:t.shadow,shadowOpacity:gm,shadowRadius:hm,shadowOffset:{width:0,height:bm},elevation:vm,...re(a.composerInput,Zs)},composerRow:{flexDirection:"row",alignItems:"center",gap:mm,minHeight:Js},attachControl:{width:Nn,height:Nn,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:Tm},input:{flex:1,minHeight:Js,maxHeight:nm,paddingHorizontal:0,paddingVertical:0,...C(e,"regular"),fontSize:o.size.body,lineHeight:Cm,color:t.text.primary,...fe(a.composerInput)},sendControl:{minHeight:rt,minWidth:rt,alignItems:"center",justifyContent:"center"},sendDisc:{width:rt,height:rt,borderRadius:rt/2,alignItems:"center",justifyContent:"center",...re(a.sendButton)},sendControlDisabled:{opacity:Sm},poweredBy:{...C(e,"regular"),color:t.text.muted,fontSize:o.size.micro,textAlign:"center",paddingBottom:r.xs}})}i(Gm,"makeStyles");export{Im as EverfurChat,ln as createRnChatAttachmentTransport,Or as useChatAttachments,xt as useEverfurChat,cn as useEverfurPets};
1
+ import {createContext,forwardRef,useMemo,useState,useRef,useEffect,useCallback,useSyncExternalStore,createElement,useContext,Component}from'react';import {StyleSheet,TextInput,Linking,KeyboardAvoidingView,View,Platform,Pressable,Text,Animated,UIManager,LayoutAnimation,Modal,Image,ActivityIndicator,ScrollView,useWindowDimensions,FlatList}from'react-native';import {useSafeAreaInsets}from'react-native-safe-area-context';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var dd=Object.defineProperty;var i=(e,t)=>dd(e,"name",{value:t,configurable:true});var Ar=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(Ar.map(e=>e.wireCode));var ud=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",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",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"}),fo=Object.freeze(Ar.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:ud[e.wireCode]}))),cd=new Map(fo.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),pd=Object.freeze(["http_envelope",...[...new Set(fo.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function Vt(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...pd]){let o=cd.get(n+r);if(o)return o}}i(Vt,"contractErrorFor");function fd(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(fd,"contractDocUrl");function yo(e){return null}i(yo,"publishedDocUrl");var yd=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"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 mo(e){return yd[e]}i(mo,"categoryFor");function go(e){let t=Vt(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":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";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"}}i(go,"fromWire");var md=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Or(e){return md.has(e)}i(Or,"isAutoRetryable");var gd=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function ho(e){return Or(e)||gd.has(e)}i(ho,"isRetryableCode");var hd=500,Fr=8e3,bo=4;function vo(e,t=Math.random){let r=Math.max(0,e),n=Math.min(hd*2**r,Fr);return Math.floor(t()*n)}i(vo,"backoffDelayMs");var bd=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:"This feature isn't available on your account right now.",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:"Something in that request was not right. Check the details and try again.",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.",unknown:"Something went wrong. Please try again."});function Mr(e){return bd[e]}i(Mr,"userFacingError");function Co(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(Co,"defineHidden");var vd=/^[a-z][a-z0-9_]{0,63}$/;function q(e,t){let r=Vt(t?.wireCode,t?.wireEnvelope),n={code:e,category:mo(e),retryable:t?.retryable??ho(e),displayMessage:Mr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&vd.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Co(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Co(n,"raw",t.raw),Object.freeze(n)}i(q,"makeEverfurError");function de(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(de,"ok");function L(e){return Object.freeze({ok:false,error:e})}i(L,"err");var Lt=class Lt extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Lt.prototype);}};i(Lt,"EverfurConfigError");var ft=Lt;var p=Object.freeze({placeholder:"Ask me anything!",send:"Send",stop:"Stop",retry:"Try again",followUps:"Helpful follow-ups",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",typing:"Assistant is typing",loading:"Loading",empty:"No messages yet",transcript:"Conversation",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting\u2026",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openMenu:"Open menu",openMenuUnread:"Open menu, unread chats",yourPets:"Your Pets",yourPet:"Your pet",switchActivePet:"Switch active pet, {name}",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active \xB7 ",close:"Close",addAnotherPet:"Add another pet",addPet:"Add a pet",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function j(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>{let o=t[n];return o===void 0?r:String(o)})}i(j,"fillCopy");var Dr=Object.freeze([Object.freeze({key:"inaccurate",label:p.feedbackReasonInaccurate,feedbackType:"wrong"}),Object.freeze({key:"outdated",label:p.feedbackReasonOutdated,feedbackType:"outdated"}),Object.freeze({key:"unsafe",label:p.feedbackReasonUnsafe,feedbackType:"dangerous"}),Object.freeze({key:"unclear",label:p.feedbackReasonUnclear,feedbackType:"unclear"}),Object.freeze({key:"other",label:p.feedbackReasonOther,feedbackType:"not_helpful"})]),Eo=Object.freeze([Object.freeze({sentiment:"up",label:p.feedbackHelpful}),Object.freeze({sentiment:"neutral",label:p.feedbackNeutral}),Object.freeze({sentiment:"down",label:p.feedbackNotHelpful})]);function Cd(e){switch(e){case "up":return "helpful";case "neutral":return "neutral";case "down":return "not_helpful"}}i(Cd,"sentimentToFeedbackType");function Ro(e,t){if(e==="down"&&t!==null){let r=Dr.find(n=>n.key===t);if(r!==void 0)return r.feedbackType}return Cd(e)}i(Ro,"feedbackTypeFor");var So=Symbol.for("@everfur/sdk#EverfurContext@v1"),To=globalThis,Po=To[So]??(To[So]=createContext(null));Po.displayName??="EverfurContext";function se(){let e=useContext(Po);if(e===null)throw new ft("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(se,"useEverfurContext");var kd=Object.freeze({status:"idle",messages:Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:Object.freeze([]),unreadCount:null});function Nt(e){let{runtime:t,userRef:r,activePet:n,scopeEpoch:o}=se(),s=e?.petRef??n??null,a=e?.conversationId??null,l=useMemo(()=>({runtime:t,userRef:r,petRef:s,conversationId:a,scopeEpoch:o}),[t,r,s,a,o]),[d,u]=useState(null),c=d?.scope===l?d.controller:t.registry.peekChat({userRef:r,petRef:s,conversationId:a}),f=useRef(null);useEffect(()=>{let E=t.registry.acquireChat({userRef:r,petRef:s,conversationId:a});return f.current=E,u({scope:l,controller:E}),()=>{f.current=null,u(w=>w?.controller===E?null:w),t.registry.releaseChat(E);}},[t,r,s,a,o,l]);let y=useCallback(E=>c?c.subscribe(E):wd,[c]),g=useCallback(()=>c?c.getSnapshot():kd,[c]),m=useSyncExternalStore(y,g,g),x=useCallback((E,w)=>c&&f.current===c&&!c.getSnapshot().isBootstrapping?Lr(c,c.send(E,w?.imageS3Keys===void 0?{}:{imageS3Keys:w.imageS3Keys}),()=>f.current===c):Promise.resolve(Nr()),[c]),v=useCallback(E=>c&&f.current===c&&!c.getSnapshot().isBootstrapping?Lr(c,c.askEverfur(E),()=>f.current===c):Promise.resolve(Nr()),[c]),S=useCallback(()=>c&&f.current===c?Lr(c,c.retryLast(),()=>f.current===c):Promise.resolve(Nr()),[c]),O=useCallback(()=>{c&&f.current===c&&c.stop();},[c]),I=useCallback(()=>{c&&f.current===c&&c.adoptConversation(null);},[c]),[M,C]=useState({controller:null,byMessage:{}}),R=M.controller===c?M.byMessage:_d,F=useCallback(async(E,w,_,V)=>{if(!c||f.current!==c)return L(q("accessDenied"));let U=String(E),B=M.controller===c?M.byMessage[U]:void 0;if(B===w&&_==null)return C(re=>{let ge={...re.controller===c?re.byMessage:{}};return delete ge[U],{controller:c,byMessage:ge}}),de(Object.freeze({feedbackId:""}));C(re=>({controller:c,byMessage:{...re.controller===c?re.byMessage:{},[U]:w}}));let Z=await c.submitFeedback(E,Ro(w,_??null),V??null);return f.current!==c?L(q("accessDenied")):(Z.ok||C(re=>{let ge={...re.controller===c?re.byMessage:{}};return B===void 0?delete ge[U]:ge[U]=B,{controller:c,byMessage:ge}}),Z)},[c,M]),T=useMemo(()=>{let E=i(async w=>{if(!c||f.current!==c)return L(q("accessDenied"));let _=await w(c);return f.current===c?_:L(q("accessDenied"))},"run");return {listConversations:i(w=>E(_=>_.listConversations({...s?{petRef:s}:{},...w})),"listConversations"),getMessages:i((w,_)=>E(V=>V.getMessages(w,_)),"getMessages"),resumeConversation:i(w=>E(_=>_.resumeConversation(w)),"resumeConversation"),loadOlderMessages:i(()=>E(w=>w.loadOlderMessages()),"loadOlderMessages"),markRead:i(()=>E(w=>w.markRead()),"markRead"),refreshActiveThread:i(()=>E(w=>w.refreshActiveThread()),"refreshActiveThread"),answerCheckin:i((w,_)=>E(V=>V.answerCheckin(w,_)),"answerCheckin"),openCheckin:i(w=>E(_=>_.openCheckin(w)),"openCheckin")}},[c,s]);return useMemo(()=>({status:m.status,messages:m.messages,conversationId:m.conversationId,petRef:s,error:m.error,isStreaming:m.isStreaming,isBootstrapping:m.isBootstrapping,historyCursor:m.historyCursor??null,isLoadingHistory:m.isLoadingHistory??false,stopped:m.stopped??false,reconnecting:m.reconnecting??false,...T,suggestedPrompts:m.suggestedPrompts,unreadCount:m.unreadCount,hasUnreadThreads:m.hasUnreadThreads??false,newConversation:I,sentimentByMessage:R,feedback:F,send:x,askEverfur:v,retryLast:S,stop:O}),[m,s,x,v,S,O,T,I,R,F])}i(Nt,"useEverfurChat");var wd=i(()=>{},"NOOP_UNSUBSCRIBE"),_d=Object.freeze({});async function Lr(e,t,r){for await(let o of t);if(!r())return L(q("accessDenied"));let n=e.getSnapshot();return n.status==="error"&&n.error!==null?L(n.error):de(xd(n.messages))}i(Lr,"driveToResult");function xd(e){for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r&&r.role==="assistant"&&r.responseId!==void 0)return r.responseId}return null}i(xd,"lastAssistantResponseId");function Nr(){return L(q("internalError",{retryable:true}))}i(Nr,"notReadyError");function Hr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))Hr(e[t]);}return e}i(Hr,"deepFreeze");var Id=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),_o={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},xo={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},wo={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Ad={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Od={regular:"400",medium:"500",bold:"700"},Fd={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Md=0,Ht="System",Ut="monospace",Dd=["content","heading","control","compact","badge"];function Vd(e){let t={};for(let r of Dd)t[r]=e;return t}i(Vd,"authoredTierSizes");function Io(){return {family:Ht,mono:Ut,fontUrl:null,families:{regular:Ht,medium:Ht,bold:Ht,mono:Ut,monoMedium:Ut,monoBold:Ut},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:wo,tierSizes:Vd(wo),lineHeight:Ad,weight:Od,letterSpacing:Fd,scale:1,maxScale:Md,scaleCaps:Id}}i(Io,"baseType");var Ao={},Le=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function zt(e){return `cubic-bezier(${e.join(", ")})`}i(zt,"cssCubicBezier");var Oo={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:zt(Le.standard),emphasized:zt(Le.emphasized),exit:zt(Le.exit)},reducedMotion:false},Ld={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:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",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:"#B91C1C",errorRed:"#FF1B00",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(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},Fo=Hr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Ld,space:_o,radius:xo,type:Io(),motion:Oo,slots:Ao}),Nd={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:"#9A938C",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",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",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};Hr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Nd,space:_o,radius:xo,type:Io(),motion:Oo,slots:Ao});var Mo=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Do=globalThis,Ur=Do[Mo]??(Do[Mo]=createContext(Fo));Ur.displayName??="EverfurThemeContext";function k(){return useContext(Ur)}i(k,"useEverfurTheme");function Wd(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(Wd,"tierMultiplier");function h({tier:e="content",...t}){let{type:r}=k(),n=Wd(r,e);return createElement(Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}i(h,"Text");var Je=forwardRef(i(function(t,r){return createElement(TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));function Bt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(Bt,"assertNever");function Lo(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}i(Lo,"errorFrame");function Yd(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}i(Yd,"authHeaders");function yt(e,t){return {...e,headers:{...Kd(e.headers),...Yd(t)}}}i(yt,"withAuthHeaders");function Kd(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();o==="authorization"||o==="x-everfur-partner-key"||(t[r]=n);}return t}i(Kd,"stripAuthHeaders");async function No(e,t){if(t.mode==="anonymous")return t.transport.request(yt(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return L(zr())}let n=await t.transport.request(yt(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let o;try{o=await t.identity.currentToken({forceRefresh:!0});}catch{return L(zr())}let s=await t.transport.request(yt(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?L(zr(s.error.httpStatus)):s}i(No,"authedSend");function zr(e){return q("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(zr,"authRejectedError");function Ho(e){return q("internalError",{retryable:true,wireMessage:$d(e)})}i(Ho,"networkError");function $d(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i($d,"describeCause");var Xd=3e4,Qd=Fr*2,Zd="idempotency-key",Jd=new Set(["POST","PUT","PATCH","DELETE"]),eu=Object.freeze({onEvent(){}}),tu=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function ru(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}i(ru,"seededIdempotencyKey");function Ne(e){let t=e.observer??eu,r=e.timers??tu,n=e.rng??Math.random,o=e.sleep??((y,g)=>mu(y,r,g)),s=e.maxAttempts??bo,a=e.unaryTimeoutMs??Xd,l=e.newIdempotencyKey??ou(),d=i(y=>{try{t.onEvent(y);}catch{}},"emit");async function u(y,g,m){let x=m?.maxAttempts,v=Math.max(1,x??s),S=m?.idempotent??Jd.has(g.method),O=m?.idempotencyKey===void 0?null:ru(m.idempotencyKey),I=S?O??l():null,M=nu(g,I),C=0;for(;;){let R=i(U=>Object.freeze({call:y,method:g.method,path:g.path,attempt:C,...I?{idempotencyKey:I}:{},...U}),"stamp");d(R({phase:"attempt"}));let F=fu(a,r),T=yu(F.signal,g.signal),E;try{E=await No({...M,signal:T.signal},e.auth);}catch(U){E=L(Ho(U));}finally{T.dispose(),F.cancel();}if(E.ok)return d(R({phase:"settled",ok:true,reason:"ok"})),E;let w=E.error,_=su(w,C,{maxAttempts:v,rng:n,now:r.now(),aborted:g.signal?.aborted===true,...x!==void 0?{perCallMaxAttempts:x}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),V={ok:false,code:w.code,reason:_.reason,...w.httpStatus!==void 0?{httpStatus:w.httpStatus}:{},...w.requestId!==void 0?{requestId:w.requestId}:{}};if(!_.retry)return d(R({phase:"settled",...V})),L(w);if(d(R({phase:"retry",...V,delayMs:_.delayMs})),await o(_.delayMs,g.signal),g.signal?.aborted===true)return d(R({phase:"settled",...V,reason:"aborted"})),L(w);C+=1;}}i(u,"send");async function c(y){return yt(y,await pu(e.auth))}i(c,"authorize");async function*f(y,g,m){d(Object.freeze({call:y,phase:"stream.open",method:g.method,path:g.path,attempt:0}));try{yield*e.auth.transport.stream(g,m);}catch{yield Lo({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(f,"stream"),Object.freeze({send:u,authorize:c,stream:f})}i(Ne,"createRequestFunnel");function nu(e,t){let r={};for(let[n,o]of Object.entries(e.headers??{}))n.toLowerCase()!==Zd&&(r[n]=o);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(nu,"assembleHeaders");function ou(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(ou,"defaultIdempotencyKeyFactory");var iu=10;function su(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=au(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!Or(e.code))return {retry:false,reason:"terminal-code"};let o=n==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let a=i(()=>{if(r.policy===void 0)return null;let u;try{u=r.policy.maxAttempts(e.code);}catch{return null}return typeof u!="number"||!Number.isFinite(u)?null:Math.max(1,Math.min(iu,Math.floor(u)))},"policyCeiling"),l=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=l)return {retry:false,reason:"attempts-exhausted"};let d=lu(e,r.now);return d!==null?d>Qd?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:o,delayMs:d}:{retry:true,reason:o,delayMs:vo(t,r.rng)}}i(su,"decideRetry");function au(e){let t=e.code==="unknown"?go(cu(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(au,"throttleKind");function lu(e,t){let r=du(e.raw);if(r===null)return null;let n=r-t;return n>0?n:0}i(lu,"retryOverrideMs");function du(e){for(let t of zo(e)){let r=t.resets_at,n=uu(r);if(n!==null)return n}return null}i(du,"findResetsAt");function zo(e){if(!Uo(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];Uo(n)&&t.push(n);}return t}i(zo,"candidateScopes");function uu(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}i(uu,"parseInstantMs");function cu(e){for(let t of zo(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(cu,"rawWireCode");function Uo(e){return typeof e=="object"&&e!==null}i(Uo,"isRecord");async function pu(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}i(pu,"resolveDeviceAuth");function fu(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(n),"cancel")}}i(fu,"boundedSignal");function yu(e,t){let r=i(()=>{},"noop");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 o=i(()=>n.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),{signal:n.signal,dispose:i(()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o);},"dispose")}}i(yu,"mergeSignals");function mu(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let o=t.setTimeout(()=>{r?.removeEventListener("abort",s),n();},e),s=i(()=>{t.clearTimeout(o),n();},"onAbort");r?.addEventListener("abort",s,{once:true});})}i(mu,"delayAbortable");function jt(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(jt,"hasLoneSurrogate");function Wt(e){return [...e].length}i(Wt,"serverLength");var Bo=Object.freeze(["better","same","worse"]),jo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var Wo=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Go(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let o={handle:void 0},s=i(()=>{r.clearTimeout(o.handle),t.removeEventListener("abort",s),n();},"done");o.handle=r.setTimeout(s,e),t.addEventListener("abort",s,{once:true});})}i(Go,"delayAbortable");var gu="checkin",hu=/^\d{4}-\d{2}-\d{2}$/,bu="watching";function qo(e){return e.status!=null&&e.status!==bu}i(qo,"isCheckinSettled");function Yo(e){if(typeof e!="string")return null;let t=e.split(":");if(t.length!==3)return null;let[r,n,o]=t;return r!==gu||n===void 0||o===void 0||!jo.test(n)||!hu.test(o)?null:{caseId:n,dueDay:o}}i(Yo,"parseCheckinOrigin");var Gt=4e3;var qt=4e3;var Eu=Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function Ko(e){return e!==Eu}i(Ko,"isUploadTransportAvailable");var Ru=Object.freeze(["image/jpeg","image/jpg","image/png","image/heic","image/heif","image/webp"]);var Yt=10*1024*1024,Kt=5,mt=120,Su="/widget/v1/uploads/initiate";function Tu(e){return typeof e=="string"&&Ru.includes(e.trim().toLowerCase())}i(Tu,"isAttachmentMime");function Br(e){if(!e)return "attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return "attachment";if(t.length<=mt)return t;let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return t.slice(0,mt);let n=t.slice(r);return n.length>=mt?t.slice(0,mt):`${t.slice(0,r).slice(0,mt-n.length)}${n}`}i(Br,"sanitizeFilename");function jr(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}i(jr,"formatBytes");var gt=i(e=>Object.freeze({ok:true,value:e}),"ok"),he=i(e=>Object.freeze({ok:false,error:e}),"err");function J(e,t,r,n){return Object.freeze({code:e,retryable:t,filename:r,...n??{}})}i(J,"failure");function Pu(e){if(typeof e.sizeBytes=="number"&&Number.isFinite(e.sizeBytes)&&e.sizeBytes>=0)return e.sizeBytes;let t=e.blob;return t!==void 0&&typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}i(Pu,"attachmentSize");function ku(e){let t=Br(e.name),r=typeof e.mimeType=="string"?e.mimeType.trim().toLowerCase():"";if(!Tu(r))return he(J("unsupported_type",false,t));let n=Pu(e);return n===null?he(J("unknown",false,t)):n>Yt?he(J("too_large",false,t,{sizeBytes:n})):gt(Object.freeze({file:e,filename:t,contentType:r,sizeBytes:n}))}i(ku,"validateAttachment");function wu(e){if(typeof e!="object"||e===null)return null;let t=e,r=i(u=>typeof u=="string"&&u.length>0?u:null,"str"),n=i(u=>typeof u=="number"&&Number.isFinite(u)?u:null,"num"),o=r(t.upload_id),s=r(t.upload_url),a=r(t.s3_key);if(o===null||s===null||a===null)return null;let l={},d=t.upload_fields;if(typeof d=="object"&&d!==null)for(let[u,c]of Object.entries(d))typeof c=="string"&&(l[u]=c);return Object.freeze({upload_id:o,upload_url:s,upload_fields:Object.freeze(l),expires_in_seconds:n(t.expires_in_seconds)??0,max_content_length:n(t.max_content_length)??Yt,s3_key:a,purpose:r(t.purpose)})}i(wu,"parsePolicy");function _u(e,t){let r=e.httpStatus;switch(e.code){case "quotaExceeded":return J("quota_exceeded",false,t,{cause:e});case "rateLimited":return J("rate_limited",true,t,{cause:e});case "idempotencyConflict":case "idempotencyInFlight":return J("idempotency_conflict",true,t,{cause:e});case "validationFailed":return J("unsupported_type",false,t,{cause:e});case "serviceUnavailable":case "streamTimeout":return J("network",true,t,{cause:e});default:return r===429?J("rate_limited",true,t,{cause:e}):r===503?J("network",true,t,{cause:e}):r===void 0?J("network",true,t,{cause:e}):J("server",e.retryable,t,{httpStatus:r,cause:e})}}i(_u,"initiateFailure");async function xu(e,t,r){let n=await e.send("chat.attachments.initiate",{method:"POST",path:Su,body:{filename:t.filename,content_type:t.contentType,file_size:t.sizeBytes},...r?.signal?{signal:r.signal}:{}});if(!n.ok)return he(_u(n.error,t.filename));let o=wu(n.value);return o===null?he(J("server",false,t.filename)):gt(o)}i(xu,"initiateAttachmentUpload");async function Iu(e,t,r,n){let o=i(()=>n?.signal?.aborted===true,"cancelled");if(o())return he(J("cancelled",true,r.filename));try{return await e.postMultipart(t,r.file,{...n?.signal?{signal:n.signal}:{},...n?.onProgress?{onProgress:n.onProgress}:{}}),gt(void 0)}catch{return o()?he(J("cancelled",true,r.filename)):he(J("server",true,r.filename))}}i(Iu,"uploadAttachmentBytes");var Au=2,Ou=3,Fu=Object.freeze([1e3,2e3,4e3]),$o=0;function Mu(){return $o+=1,`attachment-${$o}`}i(Mu,"defaultNewId");function Xo(e){let t=Math.max(1,e.concurrency??Au),r=Math.max(1,e.maxAttempts??Ou),n=e.backoffMs??Fu,o=Math.max(1,e.maxPerMessage??Kt),s=e.timers??Wo,a=e.newId??Mu,l=Ko(e.transport),d=new Map,u=[],c=[],f=new Set,y=new Set,g=Object.freeze({attachments:Object.freeze([])}),m=false,x=i(()=>{g=Object.freeze({attachments:Object.freeze(u.flatMap(C=>{let R=d.get(C);return R===void 0?[]:[R.state]}))});for(let C of y)C();},"publish"),v=i((C,R)=>{C.state=Object.freeze({...C.state,...R}),x();},"patch"),S=i(()=>{for(;!m&&f.size<t&&c.length>0;){let C=c.shift(),R=d.get(C);R!==void 0&&(f.add(C),O(R).finally(()=>{f.delete(C),S();}));}},"pump"),O=i(async C=>{let{attachment:R}=C;for(;C.attempts<r;){if(m||C.controller.signal.aborted)return;C.attempts+=1;let F=C.controller.signal;v(C,{status:"uploading",error:null,progress:0});let T=await xu(e.funnel,R,{signal:F});if(m||F.aborted)return;let E;if(!T.ok)E=he(T.error);else {let U=await Iu(e.transport,T.value,R,{signal:F,onProgress:i(B=>{!F.aborted&&C.state.status==="uploading"&&v(C,{progress:Du(B)});},"onProgress")});if(m||F.aborted)return;E=U.ok?gt(T.value.s3_key):he(U.error);}if(E.ok){v(C,{status:"uploaded",s3Key:E.value,error:null,progress:1});return}let w=E.error,_=w.retryable&&C.attempts<r;if(v(C,{status:_?"uploading":"failed",error:w,progress:0}),!_)return;let V=n[Math.min(C.attempts-1,n.length-1)]??0;await Go(V,F,s);}},"run"),I=i(C=>{c.push(C.state.id),S();},"enqueue"),M={available:l,subscribe(C){return y.add(C),()=>{y.delete(C);}},getSnapshot:i(()=>g,"getSnapshot"),get uploading(){return g.attachments.some(C=>C.status==="uploading")},get s3Keys(){return g.attachments.flatMap(C=>C.status==="uploaded"&&C.s3Key!==null?[C.s3Key]:[])},add(C){let R=ku(C);if(!R.ok)return R;if(m||u.length>=o)return he(J("too_many",false,R.value.filename));let F=a(),T={attachment:R.value,controller:new AbortController,attempts:0,state:Object.freeze({id:F,filename:R.value.filename,previewUri:C.uri,contentType:R.value.contentType,sizeBytes:R.value.sizeBytes,status:"uploading",s3Key:null,error:null,progress:0})};return d.set(F,T),u.push(F),x(),I(T),gt(T.state)},retry(C){let R=d.get(C);R===void 0||m||R.state.status!=="failed"||(R.controller=new AbortController,R.attempts=0,v(R,{status:"uploading",error:null,progress:0,s3Key:null}),I(R));},remove(C){let R=d.get(C);if(R===void 0)return;R.controller.abort(),d.delete(C);let F=u.indexOf(C);F>=0&&u.splice(F,1);let T=c.indexOf(C);T>=0&&c.splice(T,1),x();},clear(){for(let C of [...u])M.remove(C);},dispose(){m=true;for(let C of d.values())C.controller.abort();d.clear(),u.length=0,c.length=0,y.clear(),g=Object.freeze({attachments:Object.freeze([])});}};return M}i(Xo,"createAttachmentQueue");function Du(e){return Number.isNaN(e)||e<0?0:e>1?1:e}i(Du,"clamp");function Zo(e){switch(e.code){case "too_large":return j(p.attachmentTooLarge,{max:jr(Yt),filename:e.filename,size:jr(e.sizeBytes??0)});case "too_many":return j(p.attachmentTooMany,{max:Kt});case "unsupported_type":return j(p.attachmentUnsupported,{filename:e.filename});case "network":return p.attachmentNetwork;case "server":return j(p.attachmentServer,{status:e.httpStatus?` (${e.httpStatus})`:""});case "cancelled":return p.attachmentCancelled;case "rate_limited":return p.attachmentRateLimited;case "quota_exceeded":return p.attachmentQuota;case "idempotency_conflict":return p.attachmentConflict;case "unknown":return p.attachmentUnknown}}i(Zo,"attachmentErrorMessage");function Jo(e,t){return j(e>=t?p.attachmentsFull:p.addAttachment,{used:e,total:t})}i(Jo,"attachControlLabel");var Hu=Object.freeze({attachments:Object.freeze([])});function Wr(e={}){let{runtime:t,userRef:r,scopeEpoch:n}=se(),o=e.maxPerMessage??Kt,s=useMemo(()=>{if(e.queue)return e.queue;let{services:v}=t.registry;return Xo({funnel:Ne({auth:v.authFor(r),...v.errorPolicy?{errorPolicy:v.errorPolicy}:{}}),transport:e.transport??v.uploadTransport,maxPerMessage:o})},[t,r,n,o,e.queue,e.transport]);useEffect(()=>()=>{s!==e.queue&&s.dispose();},[s,e.queue]);let a=useSyncExternalStore(s.subscribe,s.getSnapshot,()=>Hu),[l,d]=useState(null),u=useCallback(v=>{let O=(Array.isArray(v)?v:[v]).map(M=>s.add(M)),I=O.find(M=>!M.ok);return I!==void 0&&!I.ok&&d(I.error),O},[s,d]),c=useCallback(v=>s.retry(v),[s]),f=useCallback(v=>s.remove(v),[s]),y=useCallback(()=>s.clear(),[s]),g=useCallback(()=>d(null),[d]),m=a.attachments.some(v=>v.status==="uploading"),x=a.attachments.some(v=>v.status==="failed");return useMemo(()=>({available:s.available,attachments:a.attachments,maxPerMessage:o,uploading:m,failed:x,blocked:m||x,s3Keys:a.attachments.flatMap(v=>v.status==="uploaded"&&v.s3Key!==null?[v.s3Key]:[]),rejected:l,add:u,retry:c,remove:f,clear:y,dismissRejected:g}),[s.available,a,o,m,x,l,u,c,f,y,g])}i(Wr,"useChatAttachments");var ei=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function $t(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(ei,t)?ei[t]:null}i($t,"canonicalPetSpecies");var ti=50,Uu=128,Gr=120,ri=120,zu=2e3,ni=120,Bu=80,si=new Set(["male","female","unknown"]),ai=new Set(["day","month","year"]),li=new Set(["low","medium","high","athletic"]),di=new Set(["indoor","outdoor","both"]),ui=new Set(["mild","moderate","severe"]),ju=/^(\d{4})-(\d{2})-(\d{2})$/,ci=[["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"]],pi=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...ci,...pi].map(([e])=>e));function Wu(e){let t=ju.exec(e);if(t===null)return false;let[r,n,o]=[Number(t[1]),Number(t[2]),Number(t[3])],s=new Date(Date.UTC(r,n-1,o));return s.getUTCFullYear()===r&&s.getUTCMonth()===n-1&&s.getUTCDate()===o}i(Wu,"isRealDate");var vt=i(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),Gu=i((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),Qt=i((e,t)=>typeof t=="string"&&Wu(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),Ce=i((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(jt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let o=t.trimmed?n.trim():n;if(t.required&&o.length===0)return `${r} is required and must not be blank`;let s=Wt(o);return s<=e?null:`${r} is ${s} characters; the server accepts at most ${e}`},"text"),qu={sex:vt(si),spayedNeutered:Gu,birthDate:Qt,birthDatePrecision:vt(ai),activityLevel:vt(li),indoorOutdoor:vt(di),foodBrand:Ce(ni),foodType:Ce(ni),microchipId:Ce(Bu)},qr=["ref","ref",false,Ce(Uu,{required:true,trimmed:true})],Yr=["notes","notes",false,Ce(zu,{trimmed:true})],oi=[qr,["name","name",true,Ce(Gr,{required:true,trimmed:true})],["dose","dose",false,Ce(ri,{trimmed:true})],["frequency","frequency",false,Ce(ri,{trimmed:true})],["startDate","start_date",false,Qt],["endDate","end_date",false,Qt],Yr],Yu={allergies:[qr,["allergen","allergen",true,Ce(Gr,{required:true,trimmed:true})],["severity","severity",false,vt(ui)],Yr],medications:oi,supplements:oi,conditions:[qr,["conditionName","condition_name",true,Ce(Gr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Qt],Yr]};function Ku(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let o=r,s={};for(let[d,u,c,f]of Yu[e]){let y=o[d];if(y==null){if(c)return {error:`${n}.${d} is required`};y===null&&(s[u]=null);continue}let g=f(`${n}.${d}`,y);if(g!==null)return {error:g};s[u]=y;}let a=s.start_date,l=s.end_date;return typeof a=="string"&&typeof l=="string"&&l<a?{error:`${n}.endDate must not be before startDate`}:{item:s}}i(Ku,"itemToWire");function $u(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>ti)return {error:`${e} has ${t.length} items; the server accepts at most ${ti}`};let r=[],n=new Set;for(let o=0;o<t.length;o+=1){let s=Ku(e,o,t[o]);if("error"in s)return s;let a=s.item.ref;if(typeof a=="string"){let l=a.trim();if(n.has(l))return {error:`${e}: ref ${JSON.stringify(l)} is used twice; a ref names one item`};n.add(l);}r.push(s.item);}return {items:r}}i($u,"listToWire");function fi(e,t){let r=e,n={};for(let[a,l]of ci){let d=r[a];if(d!==void 0){if(d!==null){let u=qu[a](a,d);if(u!==null)return {error:u}}n[l]=d;}}let o=r.birthDate!==void 0,s=r.birthDatePrecision!==void 0;if(o!==s||o&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[a,l]of pi){let d=r[a];if(d===void 0)continue;let u=$u(a,d);if("error"in u)return u;n[l]=u.items;}return Object.keys(n).length>0&&t!==void 0&&$t(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}}i(fi,"petHealthToWire");var $=i(e=>typeof e=="string"?e:null,"str"),bt=i((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),Xu=i(e=>typeof e=="boolean"?e:null,"bool");function Xt(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}i(Xt,"itemsFromWire");function ii(e){let t=$(e.name);return t===null||t.length===0?null:Object.freeze({ref:$(e.ref),name:t,dose:$(e.dose),frequency:$(e.frequency),startDate:$(e.start_date),endDate:$(e.end_date),notes:$(e.notes)})}i(ii,"medicationFromWire");function yi(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:bt(si,e.sex),spayedNeutered:Xu(e.spayed_neutered),birthDate:$(e.birth_date),birthDatePrecision:bt(ai,e.birth_date_precision),activityLevel:bt(li,e.activity_level),indoorOutdoor:bt(di,e.indoor_outdoor),foodBrand:$(e.food_brand),foodType:$(e.food_type),microchipId:$(e.microchip_id),allergies:Xt(e.allergies,r=>{let n=$(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),allergen:n,severity:bt(ui,r.severity),notes:$(r.notes)})}),medications:Xt(e.medications,ii),supplements:Xt(e.supplements,ii),conditions:Xt(e.conditions,r=>{let n=$(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),conditionName:n,diagnosedDate:$(r.diagnosed_date),notes:$(r.notes)})})})}i(yi,"petHealthFromWire");var hi=100,bi=50,vi=100,Ci=50,Ei=500,Qu=128,Zu=6e4;function Re(e){return q("validationFailed",{retryable:false,wireMessage:e})}i(Re,"invalid");function He(e,t,r){if(typeof t!="string")return Re(`${e} must be a string`);let n=Wt(t);return n<=r?null:Re(`${e} is ${n} characters; the server accepts at most ${r}`)}i(He,"checkString");function Zt(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Re(`${e} must be a finite number between 0 and ${r}`)}i(Zt,"outOfRange");function mi(e,t){if(typeof e!="string")return Re("pet_ref must be a string");if(e.trim().length===0)return Re("pet_ref must not be blank");if(jt(e))return Re("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return Re("profile must be an object");let r=[He("pet_ref",e,Qu)];return t?.name!==void 0&&r.push(He("name",t.name,hi)),t?.species!==void 0&&r.push(He("species",t.species,bi)),t?.breed!==void 0&&r.push(He("breed",t.breed,vi)),t?.ageYears!==void 0&&r.push(Zt("age_years",t.ageYears,Ci)),t?.weightKg!==void 0&&r.push(Zt("weight_kg",t.weightKg,Ei)),r.find(n=>n!==null)??null}i(mi,"validate");function Ri(e,t){let r=fi(e,t);return "error"in r?{error:Re(r.error)}:r}i(Ri,"healthToWire");function Ju(e){if(typeof e!="object"||e===null)return {error:Re("patch must be an object")};let t=e,r=[["name","name",s=>He("name",s,hi)],["species","species",s=>He("species",s,bi)],["breed","breed",s=>He("breed",s,vi)],["ageYears","age_years",s=>Zt("age_years",s,Ci)],["weightKg","weight_kg",s=>Zt("weight_kg",s,Ei)]],n={};for(let[s,a,l]of r){let d=t[s];if(d!==void 0){if(d!==null){let u=l(d);if(u!==null)return {error:u}}n[a]=d;}}let o=Ri(t,t.species);return "error"in o?o:(Object.assign(n,o.body),Object.keys(n).length===0?{error:Re("patch must change at least one field")}:{body:n})}i(Ju,"patchToWire");function ec(e){if(e==null)return {body:{}};let t=Ri(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}}}i(ec,"toWire");var Ee=i(e=>typeof e=="string"?e:null,"str"),Jt=i(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function gi(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:Ee(r.pet_ref)??t,name:Ee(r.name),species:Ee(r.species),breed:Ee(r.breed),ageYears:Jt(r.age_years),weightKg:Jt(r.weight_kg)})}i(gi,"fromWire");function Si(e){if(typeof e!="object"||e===null)return null;let t=e,r=Ee(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:Ee(t.pet_id),petRef:r,name:Ee(t.name),species:Ee(t.species),breed:Ee(t.breed),ageYears:Jt(t.age_years),weightKg:Jt(t.weight_kg),updatedAt:Ee(t.updated_at)})}i(Si,"widgetPetFromWire");function tc(e){let t=Si(e);return t===null?null:Object.freeze({...t,...yi(e)})}i(tc,"widgetPetProfileFromWire");function rc(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=Si(r);return n===null?[]:[n]}))}i(rc,"petListFromWire");function er(e){return nc(Ne({auth:e}),Ne({auth:e,unaryTimeoutMs:Zu}))}i(er,"createPetsRepository");function nc(e,t=e){let r=i((o,s)=>s?{...o,signal:s}:o,"withSignal"),n=i(o=>mi(o,void 0)??`/widget/v1/pets/${encodeURIComponent(o)}`,"petPath");return {async list(o){let s=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},o?.signal));return s.ok?de(rc(s.value)):L(s.error)},async registerPet(o,s,a){let l=mi(o,s);if(l!==null)return L(l);let d=ec(s);if("error"in d)return L(d.error);let c={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(o)}`,body:d.body},f=await e.send("pets.registerPet",a?.signal?{...c,signal:a.signal}:c);return f.ok?de(gi(f.value,o)):L(f.error)},async updatePet(o,s,a){let l=n(o);if(typeof l!="string")return L(l);let d=Ju(s);if("error"in d)return L(d.error);let u=await e.send("pets.updatePet",r({method:"PATCH",path:l,body:d.body},a?.signal));return u.ok?de(gi(u.value,o)):L(u.error)},async getPetProfile(o,s){let a=n(o);if(typeof a!="string")return L(a);let l=await e.send("pets.getPetProfile",r({method:"GET",path:`${a}/profile`},s?.signal));if(!l.ok)return L(l.error);let d=tc(l.value);return d===null?L(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):de(d)},async deletePet(o,s){let a=n(o);if(typeof a!="string")return L(a);let l=await e.send("pets.deletePet",r({method:"DELETE",path:a},s?.signal));return l.ok?de(void 0):L(l.error)},async eraseUserData(o){let s=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},o?.signal),{maxAttempts:1});return s.ok?de(void 0):L(s.error)}}}i(nc,"createPetsRepositoryOver");var sc="pet_not_registered";function ki(e){return e!=null&&e.reasonCode===sc}i(ki,"isPetNotRegistered");var ac=Object.freeze({status:"idle",error:null,registered:null,retry:i(()=>{},"retry")});function wi(e,t,r){let{runtime:n,userRef:o,scopeEpoch:s}=se(),a=useCallback(()=>er(n.registry.services.authFor(o)),[n,o,s]),l=useMemo(()=>t===void 0?null:$r(t),[t]),[d,u]=useState({key:null,status:"idle",error:null,registered:null}),c=useRef(0),f=useRef(r);f.current=r;let y=e===null||l===null?null:`${String(o)}|${s}|${e}|${l}`,g=useCallback(()=>{if(e===null||t===void 0||y===null)return;let x=++c.current;u({key:y,status:"registering",error:null,registered:null}),a().registerPet(e,t).then(v=>{x===c.current&&(v.ok?(u({key:y,status:"registered",error:null,registered:v.value}),f.current?.()):u({key:y,status:"failed",error:v.error,registered:null}));});},[a,e,y]);useEffect(()=>{if(y===null){c.current+=1;return}return g(),()=>{c.current+=1;}},[y,g]);let m=useCallback(()=>{d.status==="failed"&&g();},[d.status,g]);return useMemo(()=>y===null?ac:d.key!==y?{status:"registering",error:null,registered:null,retry:m}:{status:d.status,error:d.error,registered:d.registered,retry:m},[y,d,m])}i(wi,"useChatPetRegistration");function $r(e){return e===null||typeof e!="object"?JSON.stringify(e)??"undefined":Array.isArray(e)?`[${e.map($r).join(",")}]`:`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r<n?-1:r>n?1:0).map(([r,n])=>`${JSON.stringify(r)}:${$r(n)}`).join(",")}}`}i($r,"stableKey");var Xr=Object.freeze({});function xi(e){let[t,r]=useState(Xr),n=useRef(null),o=useRef([]);o.current=e.map(a=>a.id),useEffect(()=>{if(e.length===0){n.current=null,r(d=>d===Xr?d:Xr);return}let a=n.current;if(a===null)return;let l=e.find(d=>d.role==="user"&&!a.known.has(d.id));l!==void 0&&(n.current=null,r(d=>({...d,[l.id]:a.images})));},[e]);let s=useCallback(a=>{n.current=a.length===0?null:{images:a,known:new Set(o.current)};},[]);return useMemo(()=>({byMessage:t,stage:s}),[t,s])}i(xi,"useSentImages");var fc=500;function Qr(e){if(!e)return null;let t=e.replace(/[\u0000-\u001F\u007F-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g," ").replace(/\s+/g," ").trim();return t?t.slice(0,fc):null}i(Qr,"sanitizeSeedPrompt");function Ai(e,t,r){let n=Qr(r),o=useRef(e);o.current=e;let s=useRef(null);useEffect(()=>{if(n===null||t||s.current===n)return;let a=o.current;a!==void 0&&(s.current=n,Promise.resolve(a(n)).catch(()=>{}));},[n,t]);}i(Ai,"useInitialAsk");function yc(e,t,r){if(e==="announced")return false;let n=r.lastRefresh;return n===null||n.conversationId!==t?false:r.now-n.at<15e3}i(yc,"isCoalesced");function Oi(e,t){let r=t.activeConversationId;return r===null||r.length===0?{action:"skip",reason:"no_thread"}:t.isTurnInFlight?{action:"defer",reason:"turn_in_flight"}:t.isOffline?{action:"defer",reason:"offline"}:yc(e,r,t)?{action:"skip",reason:"coalesced"}:{action:"refresh",conversationId:r}}i(Oi,"decideChatRefresh");function Zr(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}i(Zr,"reportHostFailure");function mc(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}i(mc,"isThenable");function W(e,...t){if(typeof e=="function")try{let r=e(...t);return mc(r)&&Promise.resolve(r).then(void 0,Zr),r}catch(r){Zr(r);return}}i(W,"callHost");var Fi=new WeakMap;function Mi(e){if(typeof e!="function")return;let t=Fi.get(e);if(t!==void 0)return t;let r=i((...n)=>{W(e,...n);},"guarded");return Fi.set(e,r),r}i(Mi,"guardHost");function et(e,...t){let r;try{r=e(...t);}catch(n){return Zr(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}i(et,"callHostAsync");function Vi(e,t){let r=useRef(t);r.current=t;let n=useRef(null),o=useRef(null),s=e?.isOffline===void 0?false:W(()=>e.isOffline?.()===!0)===true,a=useRef(()=>{});a.current=l=>{let{conversationId:d,isTurnInFlight:u,refresh:c}=r.current,f=Oi(l,{activeConversationId:d,isTurnInFlight:u,isOffline:s,lastRefresh:n.current,now:Date.now()});if(f.action!=="skip"){if(f.action==="defer"){o.current!=="announced"&&(o.current=l);return}o.current=null,n.current={conversationId:f.conversationId,at:Date.now()},c!==void 0&&Promise.resolve(c()).catch(()=>{});}},useEffect(()=>{if(t.isTurnInFlight||s)return;let l=o.current;l!==null&&a.current(l);},[t.isTurnInFlight,s]),useEffect(()=>{if(e===void 0)return;let l=[],d=i((u,c)=>{if(u===void 0)return;let f=W(()=>u(()=>{a.current(c);}));typeof f=="function"&&l.push(f);},"subscribe");return d(e.onForeground?.bind(e),"foreground"),d(e.onOnline?.bind(e),"foreground"),d(e.onAnnounced?.bind(e),"announced"),()=>{for(let u of l)W(u);}},[e]);}i(Vi,"useChatLifecycle");function hc(e){if(e===void 0)return null;let t=e.conversationId??"",r=e.petRef??"";return t===""&&r===""?null:`${String(t)}|${String(r)}`}i(hc,"targetKey");function Ni(e,t){let r=hc(t),n=useRef({openCheckin:e,target:t});n.current={openCheckin:e,target:t};let o=useRef(null);useEffect(()=>{if(r===null||o.current===r)return;o.current=r;let{openCheckin:s,target:a}=n.current;s===void 0||a===void 0||Promise.resolve(s(a)).catch(()=>{});},[r]);}i(Ni,"useCheckinTarget");function zi(e,t,r){let[n,o]=useState({send:e,conversationId:t,text:r??"",seeded:r??null}),s=n.send===e&&(n.conversationId===null||n.conversationId===t);useEffect(()=>{o(l=>{let d=l.send===e&&(l.conversationId===null||l.conversationId===t),u=d?l.text:"",c=d?l.seeded:null,f=r!=null&&r!==c&&u.length===0;return {send:e,conversationId:t,text:f?r:u,seeded:f?r:c}});},[e,t,r]);let a=useCallback(l=>o(d=>({send:e,conversationId:t,text:l,seeded:d.seeded})),[e,t]);return [s?n.text:"",a]}i(zi,"useChatDraft");function Bi(e,t,r,n){let o=useRef({draft:r,setDraft:n});o.current={draft:r,setDraft:n};let s=useRef(null),[a,l]=useState(null);useEffect(()=>{if(e===void 0)return;let d=`${t??""}`;if(s.current===d)return;s.current=d;let u=true;return (async()=>{let c=await et(()=>e.read(t));if(!u)return;let f=c.ok&&typeof c.value=="string"?c.value:"";f.length>0&&o.current.draft.length===0&&o.current.setDraft(f),l(d);})(),()=>{u=false;}},[e,t]),useEffect(()=>{e===void 0||a!==`${t??""}`||W(()=>e.write(t,r));},[e,t,r,a]);}i(Bi,"usePersistedDraft");var Y=Object.freeze({heading:"Chat History",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No matching chats",noMatchBody:"Try a different title or start a new conversation.",loading:"Loading your chats\u2026",loadFailed:"Couldn\u2019t load your chats",loadingMore:"Loading more\u2026",untitled:"New conversation",newConversation:"New conversation",newChat:"New chat",search:"Search",retry:"Try again",retryA11y:"Retry loading chats",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages\u2026",openConversation:"Open conversation",unreadPrefix:"Unread. "});function rr(e){let t=e?.replace(/\s+/g," ").trim();return t||Y.untitled}i(rr,"conversationTitle");function Wi(e){return `${e.unreadCount!==null&&e.unreadCount>0?Y.unreadPrefix:""}${Y.openConversation} ${rr(e.title)}`}i(Wi,"openConversationLabel");function ji(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').toLowerCase().trim().replace(/\s+/g," ")}i(ji,"normalizeForSearch");function Sc(e,t){let r=ji(t);if(r.length===0)return e;let n=[[],[],[]];for(let o of e){let s=ji(rr(o.title)),a=s.indexOf(r);if(a<0)continue;let l=a===0?0:s.charAt(a-1)===" "?1:2;n[l]?.push(o);}return n.flat()}i(Sc,"filterConversations");function tn(e){return {scope:e,rows:[],cursor:null,loading:false,loadingMore:false,error:null}}i(tn,"fresh");function Gi(e){let[t,r]=useState(false),[n,o]=useState(""),s=e.listConversations,a=useRef(0),[l,d]=useState(()=>tn(s)),u=l.scope===s?l:tn(s);useEffect(()=>(a.current+=1,r(false),o(""),d(tn(s)),()=>{a.current+=1;}),[s]);let c=useCallback(async I=>{let M=++a.current,C=I!==void 0;d(F=>({...F,scope:s,loading:!C,loadingMore:C,error:null}));let R=await e.listConversations(I?{cursor:I}:void 0);if(M===a.current){if(!R.ok){d(F=>({...F,loading:false,loadingMore:false,error:R.error.displayMessage}));return}d(F=>{let T=I&&F.scope===s?F.rows:[],E=new Set(T.map(w=>w.id));return {scope:s,loading:false,loadingMore:false,error:null,rows:[...T,...R.value.conversations.filter(w=>!E.has(w.id))],cursor:R.value.nextCursor===I?null:R.value.nextCursor}});}},[e.listConversations,s]),f=i(()=>{r(true),o(""),c();},"show"),y=i(()=>{a.current+=1,r(false);},"close"),g=i(async I=>{let M=++a.current;d(R=>({...R,loading:true,error:null}));let C=await e.resumeConversation(I);M===a.current&&(d(R=>({...R,loading:false,error:C.ok?null:C.error.displayMessage})),C.ok&&r(false));},"resume"),m=i(async()=>{let I=a.current,M=await e.loadOlderMessages();I===a.current&&!M.ok&&d(C=>({...C,error:M.error.displayMessage}));},"earlier"),x=i(()=>{e.newConversation(),a.current+=1,r(false);},"newConversation"),v=i(()=>{u.cursor===null||u.loading||u.loadingMore||n.trim().length>0||c(u.cursor);},"loadMore"),S=useMemo(()=>Sc(u.rows,n),[u.rows,n]),O=n.trim().length>0;return {...u,open:t,show:f,close:y,load:c,resume:g,earlier:m,newConversation:x,loadMore:v,query:n,setQuery:o,searching:O,filtered:S,emptyKind:u.rows.length===0?"empty":"noMatch"}}i(Gi,"useHistoryPanel");var nr="#111111",or="#FFFFFF",kc=Object.freeze({emergency:Object.freeze({level:"emergency",label:"Vet care now",borderColor:"#FCA5A5",backgroundColor:"#FEF2F2",textColor:"#991B1B",reasonColor:nr,pillColor:or,showsVetAction:true}),schedule_soon:Object.freeze({level:"schedule_soon",label:"Vet care suggested soon",borderColor:"#FCD34D",backgroundColor:"#FFFBEB",textColor:"#92400E",reasonColor:nr,pillColor:or,showsVetAction:true}),home_care:Object.freeze({level:"home_care",label:"Monitor at home",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:nr,pillColor:or,showsVetAction:false}),general:Object.freeze({level:"general",label:"Good to know",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:nr,pillColor:or,showsVetAction:false})});function wc(e){return `${e.messageId}:${e.level}:${e.reason??""}`}i(wc,"urgencySignature");function _c(e){return j(p.urgencyGeneralReason,{petName:e?.trim()||p.emptyTitlePetFallback})}i(_c,"generalUrgencyReason");function Ki(e,t){for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(n?.role!=="assistant"||n.responseId===void 0)continue;let o=n.urgencyLevel;return o?{messageId:n.id,level:o,reason:n.urgencyReason??null}:n.urgencyProvided===true?{messageId:n.id,level:"general",reason:_c(t)}:null}return null}i(Ki,"latestUrgencySource");function $i(e){let t=e===null?null:wc(e),[r,n]=useState(null),[o,s]=useState(false);useEffect(()=>s(false),[t]);let l=e!==null&&(o||!(r!==null&&r===t)),d=e===null?null:kc[e.level],u=e!==null&&!l&&e.level!=="general",c=useCallback(()=>{t!==null&&n(t),s(false);},[t]),f=useCallback(()=>s(true),[]);return useMemo(()=>({source:e,tier:d,signature:t,showBanner:l,showCompactIcon:u,showVetAction:l&&d!==null&&d.showsVetAction,dismissLabel:d===null?null:j(p.dismissBanner,{label:d.label}),dismiss:c,expand:f}),[e,d,t,l,u,c,f])}i($i,"useUrgencySurface");function Xi(e){return e.isBootstrapping?"loading":e.status==="error"&&e.error&&e.messages.length===0?"error":e.messages.length===0?"empty":"populated"}i(Xi,"selectView");function xc(e){return e.code==="accessDenied"||e.code==="conversationNotFound"}i(xc,"needsNewConversation");function Qi(e){if(e.messages.length===0)return null;let t=e.status==="error"?e.error:null;if(t!==null){let r=xc(t);return {tone:"error",title:r?p.turnUnreachableTitle:p.turnFailedTitle,body:t.displayMessage,actionLabel:r?p.turnStartNewChat:p.turnRetry,action:r?"startNew":"retry"}}return e.stopped===true?{tone:"neutral",title:p.turnStoppedTitle,body:p.turnStoppedBody,actionLabel:p.turnRetry,action:"retry"}:null}i(Qi,"turnNotice");function Zi(e,t){let r=e[e.length-1];return t&&(r===void 0||r.role==="user")}i(Zi,"awaitingAssistant");function Ji(e,t){let r={};return e!==void 0&&(r.petRef=e),t!==void 0&&(r.conversationId=t),r}i(Ji,"buildChatOpts");var Ic=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function b(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Ic[t]]}}i(b,"face");var nn=class nn extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(nn,"HostRenderBoundary");var rn=nn;function Oc({render:e}){return e()}i(Oc,"RenderHost");function Ue({render:e,fallback:t,resetKey:r}){return createElement(rn,{fallback:t,resetKey:r,children:createElement(Oc,{render:e})})}i(Ue,"HostRender");var Fc=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function Mc(e){return Fc[e]}i(Mc,"requires");function ts(e,t,r){let n=Mc(e),o=new Map;for(let l of t)o.set(l.resource,l);if(r?.isPending===true&&n.some(l=>!o.has(l)))return on({name:e,enabled:false,isPending:true,limits:{}});let s=Dc(n,o);return n.filter(l=>o.get(l)?.granted!==true).length===0?on({name:e,enabled:true,isPending:false,limits:s}):on({name:e,enabled:false,isPending:false,limits:s,disabled:Vc(n,o)})}i(ts,"decideCapability");function Dc(e,t){let r={};for(let n of e){let o=t.get(n)?.limits;if(o)for(let[s,a]of Object.entries(o)){let l=r[s];r[s]=l===void 0?a:Math.min(l,a);}}return r}i(Dc,"mergeLimits");function Vc(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:Mr("accessDenied"),level:"user_entitlement",recoverable:false})}i(Vc,"disabledFor");function on(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}i(on,"freezeDecision");function Ct(e){let{runtime:t}=se(),r=t.entitlements,n=useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return useMemo(()=>ts(e,n.decisions,{isPending:n.isPending}),[e,n])}i(Ct,"useCapability");var Hc=48;function Uc(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(Uc,"selectView");function is(e){let{capability:t,children:r,renderDisabled:n,renderPending:o,style:s}=e,a=Ct(t),l=useMemo(()=>Uc(a),[a]);switch(l){case "enabled":return r;case "pending":return o?jsx(Ue,{render:o,fallback:jsx(ns,{capability:t,style:s})}):jsx(ns,{capability:t,style:s});case "disabled":return n?jsx(Ue,{render:()=>n(a),fallback:jsx(os,{decision:a,style:s}),resetKey:a}):jsx(os,{decision:a,style:s});default:return Bt(l)}}i(is,"CapabilityGate");function ns({capability:e,style:t}){let r=k(),n=useMemo(()=>ss(r),[r]);return jsx(View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsx(View,{style:n.skeletonBar})})}i(ns,"PendingSkeleton");function os({decision:e,style:t}){let r=k(),n=useMemo(()=>ss(r),[r]),o=e.disabled?.reason??"";return jsx(View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?jsx(h,{style:n.offstateText,children:o}):null})}i(os,"OffState");function ss(e){let{color:t,space:r,radius:n,type:o}=e;return StyleSheet.create({offstate:{minHeight:Hc,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...b(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}i(ss,"makeStyles");var Et=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function ds(e){let t=k(),r=useMemo(()=>jc(t),[t]);return jsxs(View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${Et.title}. ${Et.body}`,children:[jsx(h,{style:r.title,children:Et.title}),jsx(h,{style:r.body,children:Et.body})]})}i(ds,"ClinicalDisclaimer");function jc(e){let{color:t,space:r,type:n}=e;return StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...b(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...b(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}i(jc,"makeStyles");var ee={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function X(e){return {width:e,height:e,alignItems:"center",justifyContent:"center"}}i(X,"box");function oe(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}i(oe,"stroke");function us({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o={width:e*.82,height:n,borderRadius:n,backgroundColor:t};return jsxs(View,{style:[X(e),{gap:e*.22}],...ee,children:[jsx(View,{style:o}),jsx(View,{style:o}),jsx(View,{style:o})]})}i(us,"MenuGlyph");function cs({size:e,color:t,strokeWidth:r,rotate:n}){let o=oe(e,r),s=e*.78;return jsxs(View,{style:[X(e),{transform:[{rotate:n}]}],...ee,children:[jsx(View,{style:{position:"absolute",width:s,height:o,borderRadius:o,backgroundColor:t}}),jsx(View,{style:{position:"absolute",width:o,height:s,borderRadius:o,backgroundColor:t}})]})}i(cs,"Cross");function ps(e){return jsx(cs,{...e,rotate:"0deg"})}i(ps,"PlusGlyph");function ze(e){return jsx(cs,{...e,rotate:"45deg"})}i(ze,"CloseGlyph");function Fe({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsx(View,{style:X(e),...ee,children:jsx(View,{style:{width:e*.36,height:e*.66,marginTop:-e*.14,borderBottomWidth:n,borderRightWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})})}i(Fe,"CheckGlyph");var qc={down:{rotate:"45deg",marginTop:-0.4,marginLeft:0},up:{rotate:"225deg",marginTop:.4,marginLeft:0},right:{rotate:"-45deg",marginTop:0,marginLeft:-0.4}};function ir({size:e,color:t,strokeWidth:r,direction:n}){let o=oe(e,r),s=e*.46,a=qc[n];return jsx(View,{style:X(e),...ee,children:jsx(View,{style:{width:s,height:s,borderRightWidth:o,borderBottomWidth:o,borderColor:t,marginTop:s*a.marginTop,marginLeft:s*a.marginLeft,transform:[{rotate:a.rotate}]}})})}i(ir,"ChevronGlyph");function fs({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o={width:e*.42,height:e*.7,borderWidth:n,borderColor:t,borderRadius:n};return jsxs(View,{style:[X(e),{flexDirection:"row",gap:1}],...ee,children:[jsx(View,{style:[o,{borderTopLeftRadius:e*.2}]}),jsx(View,{style:[o,{borderTopRightRadius:e*.2}]})]})}i(fs,"BookGlyph");function ys({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.5;return jsxs(View,{style:X(e),...ee,children:[jsx(View,{style:{position:"absolute",width:e*.78,height:n,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}}),jsx(View,{style:{position:"absolute",top:e*.16,right:e*.16,width:o,height:o,borderTopWidth:n,borderRightWidth:n,borderColor:t}})]})}i(ys,"ArrowUpRightGlyph");function ms({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.6,s={position:"absolute",width:o,height:o,borderWidth:n,borderColor:t,borderRadius:e*.14};return jsxs(View,{style:X(e),...ee,children:[jsx(View,{style:[s,{top:0,left:0}]}),jsx(View,{style:[s,{bottom:0,right:0}]})]})}i(ms,"CopyGlyph");function sr({size:e,color:t,strokeWidth:r,active:n,rotate:o}){let s=oe(e,r),a=n?t:"transparent";return jsxs(View,{style:[X(e),{transform:[{rotate:o}]}],...ee,children:[jsx(View,{style:{position:"absolute",bottom:e*.08,left:e*.12,width:e*.62,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.12,borderTopLeftRadius:e*.04}}),jsx(View,{style:{position:"absolute",top:e*.04,left:e*.4,width:e*.3,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.15,transform:[{rotate:"-20deg"}]}}),jsx(View,{style:{position:"absolute",bottom:e*.08,left:0,width:e*.2,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.05}})]})}i(sr,"ThumbGlyph");function gs({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxs(View,{style:[X(e),{borderRadius:e/2,borderWidth:n,borderColor:t}],...ee,children:[jsx(View,{style:{width:n,height:n,borderRadius:n,backgroundColor:t,marginBottom:e*.1}}),jsx(View,{style:{width:n,height:e*.34,borderRadius:n,backgroundColor:t}})]})}i(gs,"InfoGlyph");function hs({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.34;return jsxs(View,{style:X(e),...ee,children:[jsx(View,{style:{position:"absolute",top:e*.06,width:o,height:o,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}}),jsx(View,{style:{position:"absolute",top:e*.1,width:n,height:e*.56,borderRadius:n,backgroundColor:t}}),jsx(View,{style:{position:"absolute",bottom:0,width:e*.84,height:e*.3,borderBottomWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderBottomLeftRadius:n,borderBottomRightRadius:n}})]})}i(hs,"UploadGlyph");function bs({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxs(View,{style:[X(e),{borderWidth:n,borderColor:t,borderRadius:e*.14,overflow:"hidden"}],...ee,children:[jsx(View,{style:{position:"absolute",top:e*.16,left:e*.18,width:e*.16,height:e*.16,borderRadius:e,backgroundColor:t}}),jsx(View,{style:{position:"absolute",bottom:-e*.3,right:-e*.1,width:e*.7,height:e*.7,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(bs,"PhotoGlyph");function vs({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxs(View,{style:X(e),...ee,children:[jsx(View,{style:{position:"absolute",top:e*.08,width:e*.34,height:e*.2,borderTopWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderTopLeftRadius:n,borderTopRightRadius:n}}),jsx(View,{style:{position:"absolute",top:e*.22,width:e*.92,height:e*.66,borderWidth:n,borderColor:t,borderRadius:e*.16,alignItems:"center",justifyContent:"center"},children:jsx(View,{style:{width:e*.3,height:e*.3,borderRadius:e,borderWidth:n,borderColor:t}})})]})}i(vs,"CameraGlyph");function Cs({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.66;return jsxs(View,{style:X(e),...ee,children:[jsx(View,{style:{position:"absolute",top:0,left:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t}}),jsx(View,{style:{position:"absolute",bottom:e*.02,right:e*.02,width:n,height:e*.4,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}})]})}i(Cs,"SearchGlyph");function Es({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxs(View,{style:X(e),...ee,children:[jsx(View,{style:{position:"absolute",width:e*.3,height:e*.82,borderWidth:n,borderColor:t,borderRadius:n,transform:[{rotate:"45deg"}]}}),jsx(View,{style:{position:"absolute",bottom:0,left:0,width:e*.4,height:n,borderRadius:n,backgroundColor:t}})]})}i(Es,"EditGlyph");function Rs({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.62;return jsxs(View,{style:X(e),...ee,children:[jsx(View,{style:{position:"absolute",top:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t,alignItems:"center",justifyContent:"center"},children:jsx(View,{style:{width:n*1.4,height:n*1.4,borderRadius:n,backgroundColor:t}})}),jsx(View,{style:{position:"absolute",bottom:e*.04,width:o*.5,height:o*.5,borderRightWidth:n,borderBottomWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(Rs,"MapPinGlyph");function Ss({size:e,color:t,testID:r}){let n=e*.36;return jsx(View,{style:X(e),testID:r,...ee,children:jsx(View,{style:{width:0,height:0,marginLeft:e*.12,borderLeftWidth:e*.78,borderTopWidth:n,borderBottomWidth:n,borderLeftColor:t,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"-45deg"}]}})})}i(Ss,"SendGlyph");function Ts({size:e,color:t,testID:r}){return jsx(View,{style:X(e),testID:r,...ee,children:jsx(View,{style:{width:e*.5,height:e*.5,backgroundColor:t}})})}i(Ts,"StopGlyph");function ar({size:e,strokeWidth:t,color:r,children:n}){return jsx(View,{style:[X(e),{borderRadius:e/2,borderWidth:t??StyleSheet.hairlineWidth,borderColor:r}],children:n})}i(ar,"Ring");var Rt=Object.freeze({standard:Le.standard,emphasized:Le.emphasized,exit:Le.exit,outQuad:Object.freeze([.25,.46,.45,.94])});var Ps=Object.freeze({layoutMs:220,messageInMs:200,bannerInMs:220,bannerOutMs:160,iconInMs:180,iconOutMs:120,followUpInMs:180,followUpStaggerMs:70,citationsInMs:220,citationsRisePx:6,drawerMs:220,pressScale:.97,pressMs:140,revealTickMs:24,revealDivisor:12,dotsCycleMs:520,dotsMinOpacity:.44,dotsLiftPx:3.5,dotsStagger:Object.freeze([0,.18,.36]),copiedMs:1500,uploadFlashMs:600,reduced:false}),Yc=Object.freeze({...Ps,layoutMs:0,messageInMs:0,bannerInMs:0,bannerOutMs:0,iconInMs:0,iconOutMs:0,followUpInMs:0,followUpStaggerMs:0,citationsInMs:0,citationsRisePx:0,drawerMs:0,pressScale:1,pressMs:0,revealTickMs:0,dotsCycleMs:0,dotsMinOpacity:1,dotsLiftPx:0,reduced:true});function ks(e){return e.motion.reducedMotion?Yc:Ps}i(ks,"chatMotion");function lr(e,t){return Math.max(0,t)*e.followUpStaggerMs}i(lr,"followUpDelayMs");function ws(e,t,r){if(e.reduced||t>=r)return r;let n=Math.max(1,Math.ceil((r-t)/e.revealDivisor));return Math.min(r,t+n)}i(ws,"nextRevealLength");function G(){let e=k();return ks(e)}i(G,"useChatMotion");var Jc=8;function xs(e,t,r){return ((1-3*r+3*t)*e+(3*r-6*t))*e*e+3*t*e}i(xs,"bezierComponent");function ep(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}i(ep,"bezierSlope");function dr(e){let[t,r,n,o]=e;return s=>{if(s<=0)return 0;if(s>=1)return 1;let a=s;for(let l=0;l<Jc;l+=1){let d=ep(a,t,n);if(d===0)break;a-=(xs(a,t,n)-s)/d;}return xs(Math.min(1,Math.max(0,a)),r,o)}}i(dr,"bezierEasing");var ln=dr(Rt.standard),tp=dr(Rt.outQuad);function pn(e){let t=useRef(null);return t.current===null&&(t.current=new Animated.Value(e)),t.current}i(pn,"useAnimatedValue");function Be(e,t={}){let r=t.risePx??0,n=t.delayMs??0,o=pn(e>0?0:1);return useEffect(()=>{if(e<=0)return;let s=Animated.timing(o,{toValue:1,duration:e,easing:tp,useNativeDriver:true}),a=n>0?Animated.sequence([Animated.delay(n),s]):s;return a.start(),()=>a.stop()},[o,e,n]),useMemo(()=>({opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[r,0]})}]}),[o,r])}i(Be,"useFadeIn");function fn({visible:e,inMs:t,outMs:r,style:n,children:o}){let[s,a]=useState(e),l=pn(e&&t<=0?1:0);return useEffect(()=>{if(e){a(true);let u=Animated.timing(l,{toValue:1,duration:Math.max(0,t),easing:ln,useNativeDriver:true});return u.start(),()=>u.stop()}if(!s)return;if(r<=0){a(false);return}let d=Animated.timing(l,{toValue:0,duration:r,easing:ln,useNativeDriver:true});return d.start(({finished:u})=>{u&&a(false);}),()=>d.stop()},[e,s,t,r,l]),!s&&!e?null:jsx(Animated.View,{style:[n,{opacity:l}],children:o})}i(fn,"FadePresence");var rp=12;function N({style:e,containerStyle:t,children:r,onPressIn:n,onPressOut:o,hitSlop:s,...a}){let l=G(),d=pn(1),u=useCallback(c=>{l.pressMs<=0||l.pressScale===1||Animated.timing(d,{toValue:c,duration:l.pressMs,easing:ln,useNativeDriver:true}).start();},[d,l.pressMs,l.pressScale]);return jsx(Pressable,{...a,hitSlop:s??rp,style:t,onPressIn:c=>{u(l.pressScale),n?.(c);},onPressOut:c=>{u(1),o?.(c);},children:jsx(Animated.View,{style:[e,{transform:[{scale:d}]}],children:r})})}i(N,"PressScale");function Os(e,t,r){let n=t&&r.revealTickMs>0,[o,s]=useState(0),a=useRef(e);return a.current=e,useEffect(()=>{if(!n)return;let l=setInterval(()=>{s(d=>ws(r,d,a.current.length));},r.revealTickMs);return ()=>clearInterval(l)},[n,r]),n?e.slice(0,Math.min(o,e.length)):e}i(Os,"useRevealedText");var Is=false;function np(e){e.layoutMs<=0||(Is||(Is=true,Platform.OS==="android"&&typeof UIManager.setLayoutAnimationEnabledExperimental=="function"&&UIManager.setLayoutAnimationEnabledExperimental(true)),LayoutAnimation.configureNext({duration:e.layoutMs,create:{type:"easeInEaseOut",property:"opacity"},update:{type:"easeInEaseOut"},delete:{type:"easeInEaseOut",property:"opacity"}}));}i(np,"animateLayout");function St(e,t){let r=useRef(e);r.current!==e&&(r.current=e,np(t));}i(St,"useAnimateLayoutOn");var yn=36,up=22,cp=12,pp=12,fp=16,yp="#000",mp="rgba(0,0,0,0.45)";function Fs({uri:e,label:t,onClose:r}){let n=k(),o=useSafeAreaInsets();return e===null?null:jsxs(Modal,{visible:true,animationType:n.motion.reducedMotion?"none":"fade",transparent:false,statusBarTranslucent:true,onRequestClose:r,children:[jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:p.closePreview,style:ur.backdrop,onPress:r,children:jsx(Image,{source:{uri:e},style:ur.image,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,accessibilityIgnoresInvertColors:true})}),jsx(View,{pointerEvents:"box-none",style:[ur.closeWrap,{top:o.top+pp}],children:jsx(N,{accessibilityRole:"button",accessibilityLabel:p.closePreview,hitSlop:cp,style:ur.closeButton,onPress:r,children:jsx(ze,{size:up,color:n.color.surface,strokeWidth:2})})})]})}i(Fs,"AttachmentImageLightbox");var ur=StyleSheet.create({backdrop:{flex:1,backgroundColor:yp,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"},closeWrap:{position:"absolute",right:fp},closeButton:{width:yn,height:yn,borderRadius:yn/2,backgroundColor:mp,alignItems:"center",justifyContent:"center"}});var cr=12,Cp=80,mn=44,Ms=22,Ep=.14,Rp=18,Sp=8,Ds=Object.freeze({photo:p.attachmentPhoto,camera:p.attachmentCamera});function Vs({sources:e,full:t,onPick:r,onClose:n}){let o=k(),s=useMemo(()=>Tp(o),[o]);return jsxs(View,{style:s.anchor,pointerEvents:"box-none",children:[jsx(Pressable,{style:s.dismissLayer,accessibilityRole:"button",accessibilityLabel:p.closeAttachmentPicker,onPress:n}),jsxs(View,{style:s.bubble,children:[jsx(View,{style:s.tilesRow,children:e.map(a=>jsxs(N,{accessibilityRole:"button",accessibilityLabel:Ds[a],accessibilityState:{disabled:t},disabled:t,containerStyle:s.tile,style:s.tileInner,onPress:()=>r(a),children:[jsx(View,{style:s.tileIconWrap,children:a==="photo"?jsx(bs,{size:Ms,color:o.color.brandInk,strokeWidth:1.5}):jsx(vs,{size:Ms,color:o.color.brandInk,strokeWidth:1.5})}),jsx(h,{tier:"control",style:s.tileLabel,children:Ds[a]})]},a))}),jsx(View,{style:s.tail}),jsx(View,{style:s.tailFill})]})]})}i(Vs,"AttachmentPickerPopover");function Tp(e){let t=e.color,r=e.radius;return StyleSheet.create({anchor:{position:"absolute",left:0,right:0,bottom:"100%",paddingHorizontal:8,paddingBottom:10,alignItems:"flex-start"},dismissLayer:{position:"absolute",left:-1e3,right:-1e3,top:-2e3,bottom:0},bubble:{backgroundColor:t.surfaceCream,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:6,paddingVertical:8,shadowColor:t.shadow,shadowOpacity:Ep,shadowRadius:Rp,shadowOffset:{width:0,height:Sp},elevation:8},tilesRow:{flexDirection:"row",alignItems:"stretch"},tile:{minWidth:Cp,borderRadius:r.md},tileInner:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:10,paddingVertical:8,gap:6},tileIconWrap:{width:mn,height:mn,borderRadius:mn/2,backgroundColor:t.brandSoft,alignItems:"center",justifyContent:"center"},tileLabel:{...b(e,"medium"),fontSize:12,lineHeight:14,color:t.text.primary},tail:{position:"absolute",left:24,bottom:-cr/2,width:cr,height:cr,backgroundColor:t.surfaceCream,borderRightWidth:1,borderBottomWidth:1,borderColor:t.brandBorderStrong,transform:[{rotate:"45deg"}]},tailFill:{position:"absolute",left:22,bottom:0,width:cr+4,height:2,backgroundColor:t.surfaceCream}})}i(Tp,"makeStyles");function Pp(e){if(typeof e=="number")return Ls(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return hn(t.slice(1));if(t.toLowerCase().startsWith("0x"))return hn(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return kp(t);if(/^[0-9a-fA-F]+$/.test(t)){let r=hn(t);if(r!==null)return r}return /^\d+$/.test(t)?Ls(Number.parseInt(t,10)):null}i(Pp,"toRgba");function hn(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return {r:bn(t[0]),g:bn(t[1]),b:bn(t[2]),a:1};if(t.length===6)return {r:je(t,0),g:je(t,2),b:je(t,4),a:1};if(t.length===8){let r=je(t,0);return {r:je(t,2),g:je(t,4),b:je(t,6),a:r/255}}return null}i(hn,"fromHex");function kp(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(d=>d.trim());if(n.length<3)return null;let o=vn(Number(n[0])),s=vn(Number(n[1])),a=vn(Number(n[2]));if(o===null||s===null||a===null)return null;let l=1;if(n.length>=4){let d=Number(n[3]);if(!Number.isFinite(d))return null;l=Math.min(1,Math.max(0,d));}return {r:o,g:s,b:a,a:l}}i(kp,"fromRgbFunc");function Ls(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}}i(Ls,"argbIntToRgba");function je(e,t){return Number.parseInt(e.slice(t,t+2),16)}i(je,"byte");function bn(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}i(bn,"dup");function vn(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}i(vn,"clampByte");function Ns(e,t){let r=Pp(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return `rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}i(Ns,"withAlpha");var Hs=56,Us=12,xp=14,Ip=10,Ap=.45,Op="rgba(7,193,104,0.55)",Fp="rgba(185,28,28,0.55)",Mp=200,Dp=300,Ks=20,Cn=22,Vp=12,Lp="rgba(0,0,0,0.78)",zs=220,Bs=100,js="rgba(255,255,255,0.15)";function $s({attachments:e,rejected:t,uploadFailed:r=false,onRetry:n,onRemove:o,onPreview:s}){let a=k(),l=useMemo(()=>Qs(a),[a]);return e.length===0&&t===null?null:jsxs(View,{style:l.strip,children:[e.length>0?jsx(View,{style:l.cards,children:e.map(d=>jsx(Np,{row:d,styles:l,onRetry:n,onRemove:o,onPreview:s},d.id))}):null,r?jsx(h,{style:l.rejected,accessibilityRole:"alert",children:p.attachmentsFailedBlocked}):null,t!==null?jsx(h,{style:l.rejected,accessibilityRole:"alert",children:Zo(t)}):null]})}i($s,"AttachmentStrip");function Np({row:e,styles:t,onRetry:r,onRemove:n,onPreview:o}){let s=k(),a=e.status==="uploading",l=e.status==="failed",d=e.status==="uploaded",u=useRef(e.status),[c,f]=useState(false);return useEffect(()=>{let y=u.current;u.current=e.status,e.status==="uploaded"&&y==="uploading"&&f(true);},[e.status]),jsxs(View,{style:t.card,children:[jsx(Pressable,{accessibilityRole:d?"button":"image",accessibilityLabel:d?j(p.previewAttachment,{filename:e.filename}):e.filename,accessibilityState:{busy:a,disabled:!d},disabled:!d,style:t.thumbHit,onPress:()=>o(e),children:jsxs(View,{style:t.thumb,children:[jsx(Image,{source:{uri:e.previewUri},style:t.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),a?jsx(View,{style:t.uploadingOverlay,children:jsx(ActivityIndicator,{size:"small",color:s.color.surface})}):null,c?jsx(Hp,{styles:t,onDone:()=>f(false)}):null]})}),l?jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:j(p.retryUpload,{filename:e.filename}),style:t.failedOverlay,onPress:()=>r(e.id),children:jsx(View,{style:t.failedInner,children:jsx(ze,{size:Ks,color:s.color.surface,strokeWidth:2})})}):null,jsx(N,{accessibilityRole:"button",accessibilityLabel:j(p.removeAttachment,{filename:e.filename}),hitSlop:6,containerStyle:t.removeSlot,style:t.removeButton,onPress:()=>n(e.id),children:jsx(ze,{size:Vp,color:s.color.surface,strokeWidth:1.5})})]})}i(Np,"PreviewCard");function Hp({styles:e,onDone:t}){let r=k(),n=G(),o=useRef(null);o.current===null&&(o.current=new Animated.Value(0));let s=o.current;return useEffect(()=>{let a=Animated.sequence([Animated.timing(s,{toValue:1,duration:Mp,useNativeDriver:true}),Animated.delay(n.uploadFlashMs),Animated.timing(s,{toValue:0,duration:Dp,useNativeDriver:true})]);return a.start(({finished:l})=>{l&&t();}),()=>a.stop()},[s,n.uploadFlashMs,t]),jsx(Animated.View,{pointerEvents:"none",style:[e.successOverlay,{opacity:s}],children:jsx(Fe,{size:Ks,color:r.color.surface,strokeWidth:2})})}i(Hp,"SuccessFlash");function Xs({images:e,onPreview:t}){let r=k(),n=useMemo(()=>Qs(r),[r]);if(e.length===0)return null;let o=e.length===1;return jsx(View,{style:o?n.sentSingle:n.sentGrid,children:e.map((s,a)=>jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:j(p.attachedImage,{filename:s.filename}),onPress:()=>t(s),children:jsx(Image,{source:{uri:s.uri},style:o?n.singleImage:n.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${s.uri}-${a}`))})}i(Xs,"SentImages");function Qs(e){let t=e.color,r=e.type;return StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:Hs,height:Hs,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:Us,overflow:"hidden",backgroundColor:t.composerFill,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...StyleSheet.absoluteFillObject,alignItems:"center",justifyContent:"center",backgroundColor:Ns(e.color.brandInk,Ap)??e.color.brandSofter},successOverlay:{...StyleSheet.absoluteFillObject,alignItems:"center",justifyContent:"center",backgroundColor:Op},failedOverlay:{...StyleSheet.absoluteFillObject,borderRadius:Us,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:Fp},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:Cn,height:Cn,borderRadius:Cn/2,backgroundColor:Lp,borderWidth:1.5,borderColor:t.surface,alignItems:"center",justifyContent:"center"},rejected:{...b(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:zs,height:zs,borderRadius:xp,backgroundColor:js},gridImage:{width:Bs,height:Bs,borderRadius:Ip,backgroundColor:js}})}i(Qs,"makeStyles");var Up="file",zp="chat attachment upload: the file handle has no uri",Bp="chat attachment upload failed";function jp(e){return {uri:e.uri,name:Br(e.name),type:e.mimeType}}i(jp,"filePartOf");function Sn(e={}){return Object.freeze({postMultipart(t,r,n){if(typeof r.uri!="string"||r.uri.length===0)return Promise.reject(new Error(zp));let{signal:o,onProgress:s}=n,a=i(()=>Promise.reject(new Error(Bp)),"failed");if(o?.aborted===true)return a();let l=new FormData;for(let[u,c]of Object.entries(t.upload_fields))l.append(u,c);l.append(Up,jp(r));let d=e.fetch??fetch;return Promise.resolve().then(()=>d(t.upload_url,{method:"POST",body:l,credentials:"omit",...o?{signal:o}:{}})).then(u=>{if(!u.ok)return a();s?.(1);},a)}})}i(Sn,"createRnChatAttachmentTransport");function Pn(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=se(),o=useMemo(()=>er(e.registry.services.authFor(t)),[e,t,n]),[s,a]=useState({repository:o,pets:[],loading:true,error:null}),l=s.repository===o?s:{pets:[],loading:true,error:null},d=useRef(0),u=useCallback(async()=>{let f=++d.current;a(g=>({...g,repository:o,loading:true,error:null,pets:g.repository===o?g.pets:[]}));let y=await o.list();f===d.current&&a(y.ok?{repository:o,pets:y.value,loading:false,error:null}:g=>({repository:o,pets:g.repository===o?g.pets:[],loading:false,error:y.error}));},[o]);useEffect(()=>(u(),()=>{d.current+=1;}),[u]);let c=useMemo(()=>r===null?null:l.pets.find(f=>f.petRef===r)??null,[r,l.pets]);return useMemo(()=>({pets:l.pets,activePet:c,loading:l.loading,error:l.error,refresh:u}),[l.pets,l.loading,l.error,c,u])}i(Pn,"useEverfurPets");function Zs(e,t){if(t!==null){let r=e.find(n=>n.petRef===t);if(r!==void 0)return r}return e[0]??null}i(Zs,"headerPetOf");function ie(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}i(ie,"slotBox");function kn(e){return e===void 0||e.backgroundColor!==void 0?e:e.borderRadius===void 0?void 0:{borderRadius:e.borderRadius}}i(kn,"ownGroundSlot");function be(e){return e?.textColor===void 0?{}:{color:e.textColor}}i(be,"slotText");var Js=Object.freeze({visitButton:"Talk to a vet"});var ea=Symbol.for("@everfur/sdk/televet");function we(){let e=globalThis,t=e[ea];if(t!==void 0)return t;let r={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[ea]=r,r}i(we,"televetGlobal");function pr(e){let t=we();t.snapshot=Object.freeze({...t.snapshot,...e});for(let r of [...t.listeners])try{r();}catch{}}i(pr,"publish");function ta(e){let t=we().presenter;if(t===null)return "absent";try{return t(e)===!1?"declined":"presented"}catch(r){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",r),"threw"}}i(ta,"callTelevetPresenter");function ra(e){let t=we();return t.listeners.add(e),()=>{t.listeners.delete(e);}}i(ra,"subscribeTelevetExperience");function wn(){return we().snapshot}i(wn,"televetExperienceSnapshot");function Kp(){return we().hosts.length>0}i(Kp,"hasTelevetHost");function na(e){if(!Kp())return false;let t=Object.freeze({...e});return pr({request:t,serial:we().snapshot.serial+1}),true}i(na,"presentTelevetExperience");function _n(){we().snapshot.request!==null&&pr({request:null});}i(_n,"dismissTelevetExperience");function oa(){let e=we(),t=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,t],pr({activeHost:e.hosts[0]??null}),t}i(oa,"claimTelevetHost");function ia(e){let t=we();t.hosts=t.hosts.filter(n=>n!==e);let r=t.hosts[0]??null;pr(r===null?{activeHost:r,request:null}:{activeHost:r});}i(ia,"releaseTelevetHost");var sa=false;function fr(e,t){return t!==void 0?(W(t,e),"onStartInApp"):ta(e)==="presented"?"presenter":na(e)?"experience":(sa||(sa=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}i(fr,"openVetVisitInApp");function da(e){let t=null;return ()=>{if(t!==null)return t;let r=e();return t=r,r.then(void 0,()=>{t===r&&(t=null);}),r}}i(da,"memoizeTelevetLoader");function ua(e){let[t,r]=useState(null);useEffect(()=>{let u=oa();return r(u),()=>{ia(u);}},[]);let n=useSyncExternalStore(ra,wn,wn),s=t!==null&&n.activeHost===t?n.request:null,[a,l]=useState(null),d=s!==null&&a===null;return useEffect(()=>{if(!d)return;let u=true;return e().then(c=>{u&&l(()=>c);},c=>{u&&(console.warn("[everfur] The in-app vet visit could not load its screens.",c),_n());}),()=>{u=false;}},[d,e]),s===null||a===null?null:{module:a,request:s,serial:n.serial,dismiss:_n}}i(ua,"useTelevetExperienceHost");var Xp=da(()=>import('@everfur/sdk/televet/booking'));function kt(){let e=ua(Xp);if(e===null)return null;let{EverfurTelevetModal:t}=e.module;return jsx(t,{request:e.request,onClose:e.dismiss},e.serial)}i(kt,"EverfurTelevetHost");var xn=Object.freeze(["visit","join","summary","messages"]);function In(e){return typeof e=="string"&&xn.includes(e)}i(In,"isVetVisitIntent");var Zp="/widget/v1/televet/handoffs",Jp="/widget/v1/televet/availability",ef="/widget/v1/televet/chat-entry",tf=/^[a-z0-9][a-z0-9_-]{0,39}$/,rf=/^[A-Za-z0-9_-]{22}$/;var ca=32,pa=128,fa=64;function On(e){let t=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}i(On,"vetVisitErrorReasonOf");function ya(e){return L(q("validationFailed",{retryable:false,wireMessage:e}))}i(ya,"invalid");function An(e){return L(q("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}i(An,"unusable");function nf(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!tf.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let o=t?.entry;if(o!=null){if(o!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=o;}let s=t?.visitRef,a=t?.intent,l=s!=null;if(l){let d=typeof s=="string"?s.trim():"";if(d.length<1||[...d].length>fa)return {ok:false,message:`visitRef must be 1..${fa} characters`};r.visit_ref=d;}if(a!=null){if(!l)return {ok:false,message:"intent needs the visitRef it opens"};if(!In(a))return {ok:false,message:`intent must be one of ${xn.join(", ")}`};r.intent=a;}return {ok:true,body:r}}i(nf,"handoffBody");function of(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!In(r)?null:Object.freeze({visitRef:t,intent:r})}i(of,"parseVisitEcho");function ga(e){let t=e.funnel??Ne({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=i(o=>(ma(r,"televet.visit.handoff_failed",{reason:On(o)}),L(o)),"failed");return {async createHandoff(o,s){let a;if(o!=null){let v=typeof o=="string"?[...o].length:0;if(v<1||v>pa)return n(q("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${pa} characters`}));a=o;}let l=nf(a,s);if(!l.ok){let v=ya(l.message);return v.ok?v:n(v.error)}let d=l.body,u=await t.send("televet.visit.handoff",{method:"POST",path:Zp,body:d},{idempotent:false,maxAttempts:1});if(!u.ok)return n(u.error);let c=sf(u.value),f=d.return_to!==void 0,y=f?u.value?.flow_id:void 0;if(f&&(typeof y!="string"||!rf.test(y))){let v=An("the handoff response carried no usable return flow id");return v.ok?v:n(v.error)}let g=d.visit_ref!==void 0,m=g?of(u.value?.visit):null;if(g&&m===null){let v=An("the handoff response did not confirm the visit it opens");return v.ok?v:n(v.error)}let x=c===null?null:Object.freeze({...c,...f?{flowId:y}:{},...m!==null?{visit:m}:{}});return x===null?n(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(ma(r,"televet.visit.handoff_created",{pet_scoped:d.pet_ref!==void 0}),de(x))},async checkAvailability(o){if(typeof o!="string"||o.length>ca)return ya(`state must be at most ${ca} characters`);let s=await t.send("televet.visit.availability",{method:"POST",path:Jp,body:{state:o}},{idempotent:false,maxAttempts:1});if(!s.ok)return L(s.error);let a=s.value?.available;return typeof a!="boolean"?An("the availability response carried no usable answer"):de(Object.freeze({available:a}))},async chatEntryOpen(){try{let o=await t.send("televet.visit.chat_entry",{method:"GET",path:ef},{maxAttempts:1});return o.ok&&o.value?.open===!0}catch{return false}}}}i(ga,"createVetVisitController");function sf(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!uf(t)?null:Object.freeze({url:t,expiresAt:r})}i(sf,"parseHandoff");var af=new Set(["localhost","127.0.0.1","[::1]"]),lf=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,df=/[\s\u0000-\u001f\u007f]/;function uf(e){if(df.test(e))return false;let t=lf.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let o=n.replace(/:\d+$/,"").toLowerCase(),s=r==="https",a=r==="http"&&af.has(o);if(!s&&!a)return false;let l=e.indexOf("#");if(l<0)return false;let d=e.slice(l);return d.startsWith("#h=")&&d.length>3}i(uf,"isOpenableVisitUrl");function ma(e,t,r){if(e)try{e.track(t,r);}catch{}}i(ma,"safeTrack");var Fn=Object.freeze({status:"idle",error:null,errorReason:null});function pf(e,t,r){let{usState:n,chat:o,scope:s}=r,a=t&&(n!==null||o),l=`${n??""}|${o?"chat":""}`,[d,u]=useState(null);if(useEffect(()=>{if(!a)return;let f=true,y=e.current;return u(null),i(async()=>{try{if(o&&!(y.chatEntryOpen&&await y.chatEntryOpen()))return !1;if(n===null)return !0;if(!y.checkAvailability)return !1;let m=await y.checkAvailability(n);return m.ok&&m.value.available}catch{return false}},"ask")().then(m=>{f&&u({key:l,open:m});}),()=>{f=false;}},[a,l,n,o,s,e]),!a)return null;let c=d!==null&&d.key===l;return {open:c&&d.open,pending:!c}}i(pf,"usePreflight");var ff=Object.freeze({status:"opening",error:null,errorReason:null});function va(e,t={}){let{runtime:r,userRef:n,scopeEpoch:o}=se(),s=Ct("televet"),a=s.enabled&&n!==null,l=t.usState??null,d=t.entry==="chat",u=t.petRef??null,c=t.prefer==="redirect",f=useMemo(()=>{if(t.controller)return t.controller;let{services:_}=r.registry;return ga({auth:_.authFor(n),telemetry:_.telemetry,..._.errorPolicy?{errorPolicy:_.errorPolicy}:{}})},[r,n,o,t.controller]),y=useRef(f);y.current=f;let g=useMemo(()=>({runtime:r,userRef:n,scopeEpoch:o}),[r,n,o]),m=pf(y,a,{usState:l,chat:d,scope:g}),x=a&&(m===null||m.open)&&(!d||u!==null),v=t.returnTo??null,[S,O]=useState(Fn),I=useRef(null),M=useRef({runtime:r,userRef:n,scopeEpoch:o});M.current={runtime:r,userRef:n,scopeEpoch:o};let C=useRef(f);C.current=f;let R=useRef(x);R.current=x;let F=useCallback((_,V)=>{if(I.current)return I.current;let U=i((ne,Ve)=>(O({status:ne==="cancelled"?"idle":"error",error:Ve,errorReason:ne==="cancelled"?null:ne}),Object.freeze({opened:false,reason:ne,error:Ve})),"fail");if(!R.current)return Promise.resolve(U("unavailable",null));let B=e.prepare();if(!B.ok)return Promise.resolve(U(B.reason,null));let Z=M.current,re=C.current;O(ff);let dt=(async()=>{let ne,Ve={...v!==null?{returnTo:v}:{},...d?{entry:"chat"}:{},...V!==null?{visitRef:V.visitRef}:{},...V!==null&&V.intent!==null&&V.intent!==void 0?{intent:V.intent}:{}},Mt=Object.keys(Ve).length===0?void 0:Ve,ut=_===void 0?u:_;try{ne=await(Mt===void 0?re.createHandoff(ut):re.createHandoff(ut,Mt));}catch{return e.abandon(B.value),U("unknown",null)}let Xe=M.current;if(Xe.runtime!==Z.runtime||Xe.userRef!==Z.userRef||Xe.scopeEpoch!==Z.scopeEpoch)return e.abandon(B.value),U("cancelled",null);if(!ne.ok)return e.abandon(B.value),U(On(ne.error),ne.error);let Qe=await e.finish(B.value,ne.value);return Qe!==null?U(Qe,null):(O(Fn),Object.freeze(ne.value.flowId===void 0?{opened:true}:{opened:true,flowId:ne.value.flowId}))})().finally(()=>{I.current===dt&&(I.current=null);});return I.current=dt,dt},[e,u,v,d]),T=useCallback((_,V)=>{if(!R.current)return O({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}));let U=_===void 0?u:_,B={...U!==null?{petRef:U}:{},...l!==null?{usState:l}:{},...V!==null?{visitRef:V.visitRef,intent:V.intent}:{}};return fr(B)===null?(O({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}))):(O(Fn),Promise.resolve(Object.freeze({opened:true})))},[u,l]),E=useCallback(_=>c?F(_,null):T(_,null),[c,F,T]),w=useCallback((_,V)=>c?F(void 0,{visitRef:_,intent:V??null}):T(void 0,{visitRef:_,intent:V??null}),[c,F,T]);return {available:x,isPending:s.isPending||(m?.pending??false),status:S.status,error:S.error,errorReason:S.errorReason,open:E,openVisit:w}}i(va,"useVetVisitWith");var gf=i(e=>Linking.openURL(e),"defaultOpenUrl");function mr(e={}){let{openUrl:t,...r}=e,n=useMemo(()=>{let o=t??gf;return {prepare:i(()=>({ok:true,value:null}),"prepare"),async finish(s,a){try{return await o(a.url),null}catch{return "openFailed"}},abandon:i(()=>{},"abandon")}},[t]);return va(n,r)}i(mr,"useVetVisit");var Ca=44,Ef=.6;function nt(e){let{petRef:t,label:r,openUrl:n,onOpened:o,onError:s,style:a,labelStyle:l,controller:d,returnTo:u,usState:c,entry:f,visitRef:y,intent:g,onStartInApp:m,prefer:x}=e,v=x==="redirect",S=mr({...u!==void 0?{returnTo:u}:{},...c!==void 0?{usState:c}:{},...f!==void 0?{entry:f}:{},...t!==void 0?{petRef:t}:{},...n!==void 0?{openUrl:n}:{},...d!==void 0?{controller:d}:{},prefer:v?"redirect":"in-app"}),O=k(),I=useMemo(()=>Rf(O),[O]),M=useRef(false);if(!S.available)return jsxs(Fragment,{children:[null,jsx(kt,{})]});let C=S.status==="opening",R=r??Js.visitButton;return jsxs(Fragment,{children:[jsx(Pressable,{onPress:i(()=>{if(!(C||M.current)){if(!v){let T={...t!==void 0?{petRef:t}:{},...c!==void 0?{usState:c}:{},...y!=null?{visitRef:y,intent:g??null}:{}};fr(T,m)===null&&W(s,"unavailable",null);return}M.current=true,(y==null?S.open():S.openVisit(y,g??null)).then(T=>{T.opened?W(o,T.flowId??null):T.reason!=="cancelled"&&W(s,T.reason,T.error);}).finally(()=>{M.current=false;});}},"onPress"),accessibilityRole:"button",accessibilityLabel:R,accessibilityState:{busy:C,disabled:C},style:[I.button,C?I.busy:null,a],children:jsx(h,{style:[I.label,l],children:R})}),jsx(kt,{})]})}i(nt,"VetVisitButton");function Rf(e){let{color:t,space:r,radius:n,type:o,slots:s}=e;return StyleSheet.create({button:{minHeight:Ca,minWidth:Ca,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.primary,...ie(s.vetVisitButton)},busy:{opacity:Ef},label:{...b(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug,...be(s.vetVisitButton)}})}i(Rf,"makeStyles");function Mn(e){return $t(e)==="cat"?"cat":"dog"}i(Mn,"speciesOf");function Dn(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.floor(e)}i(Dn,"petAgeYears");function Ta(e){let t=Dn(e.ageYears),r=Mn(e.species)==="cat"?"Cat":"Dog";if(t==null)return r;let n=t===1?"1 yr":`${t} yrs`;return `${r} \xB7 ${n}`}i(Ta,"formatPetMeta");var Sa=Object.freeze([Object.freeze({background:"#ffbdbd",foreground:"#6d1d14"}),Object.freeze({background:"#a0c4f6",foreground:"#0b3a73"}),Object.freeze({background:"#fbc558",foreground:"#10462e"}),Object.freeze({background:"#bde7c5",foreground:"#0e3b22"}),Object.freeze({background:"#dcc7f4",foreground:"#3a1d6a"}),Object.freeze({background:"#ffd8a8",foreground:"#5a2a04"})]);function Sf(e){let t=0;for(let r=0;r<e.length;r+=1)t=t*31+e.charCodeAt(r)>>>0;return Sa[t%Sa.length]}i(Sf,"pickInitialsPalette");function Vn(e){let t=(e??"").trim();return (Array.from(t)[0]??"?").toUpperCase()}i(Vn,"getInitial");function Pa(e){return {...Sf(e.petRef),initial:Vn(e.name)}}i(Pa,"petInitials");function wf(e){return Math.max(12,Math.round(e*.42))}i(wf,"letterSize");function _t({pet:e,size:t,ringStroke:r}){let n=k(),o=useMemo(()=>_f(n),[n]),s=t-r*2,a=e===null?null:Pa(e),l=wf(s);return jsx(ar,{size:t,strokeWidth:r,color:n.color.success,children:jsx(View,{style:[o.disc,{width:s,height:s,borderRadius:s/2},a===null?o.discEmpty:{backgroundColor:a.background}],children:jsx(h,{tier:"badge",style:[o.letter,{fontSize:l,lineHeight:Math.round(l*1.2),color:a===null?n.color.text.muted:a.foreground}],children:a===null?Vn(null):a.initial})})})}i(_t,"PetDisc");function _f(e){return StyleSheet.create({disc:{alignItems:"center",justifyContent:"center",overflow:"hidden"},discEmpty:{backgroundColor:e.color.brandSoft},letter:{...b(e,"bold"),textAlign:"center",includeFontPadding:false}})}i(_f,"makeStyles");var Nn=48,xa=2,Ff=320,Mf="80%",Df="rgba(17,17,17,0.45)",Vf=18,ka=22,Lf=12,wa=.4,Nf=44;function Hn(e){return e?.name?.trim()||p.yourPet}i(Hn,"petDisplayName");function Ia({visible:e,pets:t,activePetRef:r,onSelect:n,onAddPet:o=null,onClose:s}){let a=k(),l=useMemo(()=>Hf(a),[a]);return e?jsx(Modal,{visible:true,transparent:true,animationType:a.motion.reducedMotion?"none":"fade",onRequestClose:s,children:jsxs(View,{style:l.root,children:[jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:s,accessibilityRole:"button",accessibilityLabel:p.close,children:jsx(View,{style:l.backdrop})}),jsxs(View,{style:l.panel,accessibilityViewIsModal:true,children:[jsx(h,{tier:"heading",style:l.title,accessibilityRole:"header",children:p.yourPets}),jsx(ScrollView,{style:l.list,contentContainerStyle:l.listContent,showsVerticalScrollIndicator:true,children:t.map(d=>{let u=d.petRef===r,c=Hn(d),f=Ta(d);return jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(u?p.petCurrentlyActive:p.switchToPet,{name:c}),accessibilityState:{selected:u},style:[l.row,u?l.rowActive:null],onPress:()=>n(d.petRef),children:[jsx(_t,{pet:d,size:Nn,ringStroke:xa}),jsxs(View,{style:l.copy,children:[jsx(h,{style:l.name,numberOfLines:1,children:c}),jsx(h,{tier:"compact",style:l.meta,numberOfLines:1,children:u?`${p.activePrefix}${f}`:f})]}),u?jsx(Fe,{size:Vf,color:a.color.brandInk}):null]},d.petRef)})}),o!==null?jsxs(N,{accessibilityRole:"button",accessibilityLabel:p.addAnotherPet,style:l.addRow,onPress:o,children:[jsx(View,{style:l.addDisc,children:jsx(h,{tier:"control",style:l.addPlus,children:"+"})}),jsx(h,{style:l.addLabel,children:p.addAnotherPet})]}):null,jsx(N,{accessibilityRole:"button",accessibilityLabel:p.close,containerStyle:l.closeSlot,style:l.closeButton,onPress:s,children:jsx(h,{tier:"control",style:l.closeText,children:p.close})})]})]})}):null}i(Ia,"PetSwitcherSheet");function Hf(e){let t=e.color,r=e.radius;return StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:Df},panel:{backgroundColor:t.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:ka,borderTopRightRadius:ka,gap:14,maxHeight:Mf},title:{...b(e,"bold"),fontSize:18,lineHeight:22,color:t.brandInk},list:{maxHeight:Ff,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:Nf,paddingHorizontal:8},addDisc:{width:Nn,height:Nn,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:xa,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream},addPlus:{...b(e,"bold"),fontSize:20,lineHeight:22,color:t.brandInk},addLabel:{...b(e,"bold"),fontSize:15,lineHeight:20,color:t.text.primary},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowActive:{borderColor:t.brandInk,backgroundColor:t.brandSoft},copy:{flex:1,gap:2},name:{...b(e,"bold"),fontSize:15,lineHeight:18,color:t.text.primary},meta:{...b(e,"monoBold"),fontSize:11,lineHeight:13,color:t.text.muted,textTransform:"uppercase",letterSpacing:wa},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:Lf,backgroundColor:t.brandSoft},closeText:{...b(e,"bold"),color:t.brandInk,fontSize:13,lineHeight:16,letterSpacing:wa}})}i(Hf,"makeStyles");var Bf=44,hr=36,jf=22,zn=9,Wf=1.5,Aa=6,Ge=35,br=1.75,Bn=12.4,Gf=.5,qf=8,Yf=28,Kf=160;function Wn(e,t){return Zs(e,t)}i(Wn,"headerPet");function Fa({pets:e,petRef:t,historyUnread:r,onOpenHistory:n,onPetChange:o,onAddPet:s,vet:a}){let l=k(),d=useMemo(()=>Xf(l),[l]),[u,c]=useState(false),f=Wn(e.pets,t),y=e.pets.length>=2,g=t??f?.petRef??null,m=Hn(f),x=i(S=>{c(false),e.setActivePet(S),W(o,S);},"select"),v=s===void 0?null:()=>{c(false),W(s);};return jsxs(View,{style:d.row,children:[jsxs(N,{accessibilityRole:"button",accessibilityLabel:r?p.openMenuUnread:p.openMenu,containerStyle:d.iconSlot,style:d.iconButton,onPress:n,children:[jsx(us,{size:jf,color:l.color.text.primary,strokeWidth:2}),r?jsx(View,{style:d.unreadDot,pointerEvents:"none"}):null]}),jsx(View,{style:d.center,pointerEvents:"box-none",children:jsx($f,{logoUrl:l.meta.logoUrl,name:l.meta.displayName,styles:d})}),g===null?null:jsx(nt,{entry:"chat",petRef:g,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:d.vetEntry,labelStyle:d.vetEntryLabel}),jsx(View,{style:d.right,children:y?jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(p.switchActivePet,{name:m}),containerStyle:d.avatarSlot,style:d.avatarWrap,onPress:()=>c(true),children:[jsx(_t,{pet:f,size:Ge,ringStroke:br}),jsx(View,{style:d.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsx(ps,{size:qf,color:l.color.brandInk,strokeWidth:2})})]}):e.loading&&f===null?jsx(View,{style:d.avatarWrap,accessible:true,accessibilityLabel:p.yourPet,children:jsx(ar,{size:Ge,strokeWidth:br,color:l.color.success,children:jsx(View,{style:d.placeholderDisc})})}):jsx(View,{style:d.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:f===null?p.yourPet:m,children:jsx(_t,{pet:f,size:Ge,ringStroke:br})})}),jsx(Ia,{visible:u,pets:e.pets,activePetRef:f?.petRef??null,onSelect:x,onAddPet:v,onClose:()=>c(false)})]})}i(Fa,"ChatHeader");function $f({logoUrl:e,name:t,styles:r}){let[n,o]=useState(null);return e===null||n===e?null:jsx(View,{style:r.logoBar,children:jsx(Image,{source:{uri:e},style:r.logo,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:()=>o(e)})})}i($f,"BrandLogo");function Xf(e){let t=e.color,r=Ge-br*2;return StyleSheet.create({vetEntry:{minHeight:Bf,justifyContent:"center",paddingHorizontal:12,borderRadius:e.radius.pill,backgroundColor:t.surfaceCream,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},vetEntryLabel:{...b(e,"bold"),color:t.brandInk,fontSize:e.type.size.caption},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:10,backgroundColor:t.surface},iconSlot:{borderRadius:hr/2},iconButton:{width:hr,height:hr,borderRadius:hr/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:Aa,right:Aa,width:zn,height:zn,borderRadius:zn,backgroundColor:t.danger,borderWidth:Wf,borderColor:t.surface},center:{...StyleSheet.absoluteFillObject,alignItems:"center",justifyContent:"center"},logoBar:{alignItems:"center",paddingHorizontal:e.space.lg},logo:{height:Yf,width:Kf},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:Ge/2},avatarWrap:{width:Ge,height:Ge,position:"relative"},placeholderDisc:{width:r,height:r,borderRadius:r/2,backgroundColor:t.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:Bn,height:Bn,borderRadius:Bn/2,borderWidth:Gf,borderColor:t.success,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"}})}i(Xf,"makeStyles");var Da=44,ty="rgba(17,17,17,0.55)",Va=26,ry=36,La=4,qn=20,Yn=38,ny=18,oy=12;function Na({visible:e,onSubmit:t,onSkip:r}){let n=k(),o=useMemo(()=>iy(n),[n]),[s,a]=useState(null),[l,d]=useState(""),[u,c]=useState(false),[f,y]=useState(false),g=i(()=>{a(null),d(""),c(false),y(false);},"reset"),m=i(()=>{u||(g(),r());},"skip"),x=i(async()=>{if(u)return;c(true),y(false);let S=l.trim();await t(s,S.length>0?S:null)?g():(c(false),y(true));},"submit");if(!e)return null;let v=[...l].length>Gt;return jsx(Modal,{visible:true,transparent:true,animationType:n.motion.reducedMotion?"none":"slide",onRequestClose:m,children:jsxs(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":void 0,style:o.root,children:[jsx(Pressable,{style:o.scrim,onPress:m,accessibilityRole:"button",accessibilityLabel:p.feedbackSkipA11y}),jsxs(View,{style:o.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[jsx(View,{style:o.handle}),jsxs(View,{style:o.header,children:[jsx(View,{style:o.iconBadge,children:jsx(sr,{size:ny,color:n.color.brandInk,active:false,rotate:"180deg"})}),jsxs(View,{style:o.headerText,children:[jsx(h,{tier:"heading",style:o.title,accessibilityRole:"header",children:p.feedbackTitle}),jsx(h,{style:o.subtitle,children:p.feedbackSubtitle})]})]}),jsx(View,{style:o.options,children:Dr.map(S=>{let O=s===S.key;return jsxs(N,{accessibilityRole:"button",accessibilityLabel:S.label,accessibilityState:{selected:O},style:[o.option,O?o.optionSelected:null],onPress:()=>a(I=>I===S.key?null:S.key),children:[jsx(h,{style:[o.optionLabel,O?o.optionLabelSelected:null],children:S.label}),jsx(View,{style:[o.radio,O?o.radioSelected:null],children:O?jsx(Fe,{size:oy,color:n.color.surface,strokeWidth:2}):null})]},S.key)})}),jsxs(View,{style:o.inputWrap,children:[jsx(Je,{style:o.input,placeholder:p.feedbackNotesPlaceholder,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:p.feedbackNotesPlaceholder,value:l,onChangeText:d,multiline:true,editable:!u}),l.length>0?jsx(h,{tier:"compact",style:[o.counter,v?o.counterOver:null],children:`${[...l].length}/${Gt}`}):null]}),f?jsx(h,{style:o.failed,accessibilityRole:"alert",children:p.feedbackFailed}):null,jsxs(View,{style:o.actions,children:[jsx(N,{accessibilityRole:"button",accessibilityLabel:p.feedbackSubmit,accessibilityState:{busy:u,disabled:u||v},disabled:u||v,style:[o.submit,u||v?o.submitDisabled:null],onPress:()=>{x();},children:jsx(h,{tier:"control",style:o.submitLabel,children:p.feedbackSubmit})}),jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:p.feedbackSkipA11y,hitSlop:8,onPress:m,style:o.skip,children:jsx(h,{tier:"control",style:o.skipLabel,children:p.feedbackSkip})})]})]})]})})}i(Na,"FeedbackReasons");function iy(e){let t=e.color,r=e.type,n=e.radius,o=e.slots;return StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{...StyleSheet.absoluteFillObject,backgroundColor:ty},sheet:{backgroundColor:t.surface,borderTopLeftRadius:Va,borderTopRightRadius:Va,paddingHorizontal:22,paddingTop:12,paddingBottom:34,gap:14},handle:{alignSelf:"center",width:ry,height:La,borderRadius:La/2,backgroundColor:t.brandBorder,marginBottom:2},header:{flexDirection:"row",alignItems:"center",gap:12},iconBadge:{width:Yn,height:Yn,borderRadius:Yn/2,alignItems:"center",justifyContent:"center",backgroundColor:t.brandSoft},headerText:{flex:1,gap:2},title:{...b(e,"bold"),fontSize:20,lineHeight:28,color:t.text.primary,letterSpacing:r.letterSpacing.tight},subtitle:{...b(e,"regular"),fontSize:r.size.body,lineHeight:r.size.body*r.lineHeight.relaxed,color:t.text.muted},options:{gap:8},option:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:14,paddingVertical:13,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder,backgroundColor:t.surface},optionSelected:{borderColor:t.brandInk,backgroundColor:t.brandSoft},optionLabel:{...b(e,"medium"),fontSize:r.size.body,color:t.text.primary},optionLabelSelected:{color:t.brandInk},radio:{width:qn,height:qn,borderRadius:qn/2,borderWidth:2,borderColor:t.brandBorderStrong,alignItems:"center",justifyContent:"center"},radioSelected:{borderColor:t.brandInk,backgroundColor:t.brandInk},inputWrap:{gap:4},input:{minHeight:72,maxHeight:132,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:14,paddingTop:12,paddingBottom:12,...b(e,"regular"),fontSize:r.size.body,color:t.text.primary,textAlignVertical:"top"},counter:{...b(e,"mono"),alignSelf:"flex-end",fontSize:r.size.caption,letterSpacing:.3,color:t.text.placeholder},counterOver:{color:t.danger},failed:{...b(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},actions:{gap:10,alignItems:"center"},submit:{alignSelf:"stretch",minHeight:Da,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.xl,borderRadius:n.pill,backgroundColor:t.brand,...ie(o.primaryButton)},submitDisabled:{opacity:.6},submitLabel:{...b(e,"medium"),fontSize:r.size.body,color:t.onPrimary,...be(o.primaryButton)},skip:{minHeight:Da,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},skipLabel:{...b(e,"medium"),fontSize:r.size.body,color:t.text.muted}})}i(iy,"makeStyles");var vy=.88,Cy=420,Ey=58,Ry="rgba(17,17,17,0.28)",Sy=.08,Ty=.1,Py=.08,ky=.18,wy=.78,_y=.7,Kn=36,xy=10,Iy=14,Ay=12,Oy=16,Fy=14,$n=8,My=1.5,Dy=.5,Vy=dr(Rt.standard);function Ly(e){return Math.min(Math.round(e*vy),Cy)}i(Ly,"drawerPanelWidth");function Ua({chat:e,history:t}){let[r,n]=useState(t.open),o=useCallback(()=>n(false),[]);return t.open&&!r&&n(true),r?jsx(Ny,{chat:e,history:t,onHidden:o}):null}i(Ua,"HistoryDrawer");function Ny({chat:e,history:t,onHidden:r}){let n=k(),o=useMemo(()=>Uy(n),[n]),s=G(),a=useSafeAreaInsets(),{width:l}=useWindowDimensions(),d=Ly(l),u=t.open,c=useRef(null);c.current===null&&(c.current=new Animated.Value(s.drawerMs<=0&&u?1:0));let f=c.current;useEffect(()=>{if(!u&&s.drawerMs<=0){r();return}let S=Animated.timing(f,{toValue:u?1:0,duration:s.drawerMs,easing:Vy,useNativeDriver:true});return S.start(({finished:O})=>{O&&!u&&r();}),()=>S.stop()},[u,f,s.drawerMs,r]);let y=f.interpolate({inputRange:[0,1],outputRange:[-d,0]}),g=t.filtered,m=t.rows.length===0,x=m&&t.loading?jsxs(View,{style:o.emptyCard,accessibilityLabel:Y.loading,accessibilityState:{busy:true},children:[jsx(ActivityIndicator,{color:n.color.onPrimary}),jsx(h,{style:o.emptyBody,children:Y.loading})]}):m&&t.error!==null?jsxs(View,{style:o.emptyCard,children:[jsx(h,{style:o.emptyTitle,accessibilityRole:"alert",children:Y.loadFailed}),jsx(h,{style:o.emptyBody,children:t.error}),jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.retryA11y,containerStyle:o.retrySlot,style:o.retryButton,onPress:()=>{t.load();},children:jsx(h,{tier:"control",style:o.retryText,children:Y.retry})})]}):jsxs(View,{style:o.emptyCard,children:[jsx(h,{style:o.emptyTitle,children:t.emptyKind==="empty"?Y.empty:Y.noMatch}),jsx(h,{style:o.emptyBody,children:t.emptyKind==="empty"?Y.emptyBody:Y.noMatchBody})]}),v=!t.searching&&t.loadingMore?jsx(View,{style:o.loadMoreFooter,children:jsx(h,{style:o.loadMoreLabel,children:Y.loadingMore})}):null;return jsx(Modal,{visible:true,transparent:true,animationType:"none",onRequestClose:t.close,children:jsxs(View,{style:o.root,children:[jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:t.close,accessibilityRole:"button",accessibilityLabel:Y.closeA11y,children:jsx(Animated.View,{style:[o.backdrop,{opacity:f}]})}),jsx(Animated.View,{style:[o.panel,{width:d,paddingTop:Math.max(Ey,a.top+n.space.md),transform:[{translateX:y}]}],accessibilityViewIsModal:true,children:jsxs(KeyboardAvoidingView,{style:o.keyboardAvoider,behavior:Platform.OS==="ios"?"padding":"height",children:[jsxs(View,{style:o.searchRow,children:[jsxs(View,{style:o.searchPill,children:[jsx(Cs,{size:Fy,color:n.color.text.muted,strokeWidth:1.5}),jsx(Je,{value:t.query,onChangeText:S=>t.setQuery(S.replace(/^\s+/,"")),style:o.searchInput,placeholder:Y.search,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:Y.search,autoCorrect:false,autoCapitalize:"none",returnKeyType:"search"})]}),jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.newConversation,style:o.newButton,onPress:t.newConversation,children:jsx(Es,{size:Oy,color:n.color.text.primary,strokeWidth:1.5})})]}),jsx(h,{tier:"heading",style:o.heading,accessibilityRole:"header",children:Y.heading}),t.error!==null&&!m?jsx(View,{style:o.errorCard,children:jsx(h,{style:o.errorText,accessibilityRole:"alert",children:t.error})}):null,jsx(FlatList,{data:g,keyExtractor:S=>S.id,renderItem:({item:S})=>jsx(Hy,{row:S,active:S.id===e.conversationId,disabled:t.loading,styles:o,onPress:()=>{t.resume(S.id);}}),contentContainerStyle:g.length===0?o.listEmpty:o.list,keyboardShouldPersistTaps:"handled",ListEmptyComponent:x,ListFooterComponent:v,onEndReached:t.loadMore,onEndReachedThreshold:Dy})]})})]})})}i(Ny,"DrawerModal");function Hy({row:e,active:t,disabled:r,styles:n,onPress:o}){let s=e.unreadCount!==null&&e.unreadCount>0;return jsx(N,{accessibilityRole:"button",accessibilityLabel:Wi(e),accessibilityState:{selected:t,disabled:r},disabled:r,style:[n.item,t?n.itemActive:null],onPress:o,children:jsxs(View,{style:n.itemRow,children:[jsx(h,{style:[n.itemTitle,s?n.itemTitleUnread:null],numberOfLines:1,children:rr(e.title)}),s?jsx(View,{style:n.unreadDot}):null]})})}i(Hy,"Row");function Er(e,t){if(!/^#[0-9a-f]{6}$/i.test(e))return "transparent";let r=Math.round(Math.min(1,Math.max(0,t))*255);return `${e}${r.toString(16).padStart(2,"0").toUpperCase()}`}i(Er,"inkWash");function Uy(e){let t=e.color,r=e.slots,n=t.onPrimary;return StyleSheet.create({root:{flex:1},backdrop:{flex:1,backgroundColor:Ry},panel:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:t.brand,paddingHorizontal:16,borderRightWidth:.5,borderRightColor:t.brandBorder,gap:12},keyboardAvoider:{flex:1,gap:12},searchRow:{flexDirection:"row",alignItems:"center",gap:10},searchPill:{flex:1,flexDirection:"row",alignItems:"center",gap:8,borderRadius:e.radius.pill,backgroundColor:t.surface,paddingHorizontal:14,paddingVertical:10,borderWidth:1,borderColor:Er(n,Ty)},searchInput:{...b(e,"regular"),flex:1,fontSize:13,lineHeight:16,color:t.text.primary,padding:0},newButton:{width:Kn,height:Kn,borderRadius:Kn/2,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},heading:{...b(e,"bold"),fontSize:14,lineHeight:17,color:n,marginTop:4},list:{gap:10,paddingBottom:28},listEmpty:{flexGrow:1},item:{paddingVertical:12,paddingHorizontal:4,borderRadius:xy},itemActive:{backgroundColor:Er(n,Sy)},itemRow:{flexDirection:"row",alignItems:"center",gap:8},itemTitle:{...b(e,"regular"),flex:1,fontSize:14,lineHeight:18,color:n},itemTitleUnread:b(e,"bold"),unreadDot:{width:$n,height:$n,borderRadius:$n/2,backgroundColor:t.danger,borderWidth:My,borderColor:n},errorCard:{borderRadius:Ay,borderWidth:.5,borderColor:t.danger,backgroundColor:t.surface,padding:12},errorText:{...b(e,"regular"),fontSize:11,lineHeight:16,color:t.danger},emptyCard:{borderRadius:Iy,padding:14,gap:6,backgroundColor:Er(n,Py),borderWidth:.5,borderColor:Er(n,ky)},emptyTitle:{...b(e,"bold"),fontSize:12,lineHeight:15,color:n},emptyBody:{...b(e,"regular"),fontSize:11,lineHeight:17,color:n,opacity:wy},retrySlot:{marginTop:8,alignSelf:"flex-start"},retryButton:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:7,borderWidth:1,borderColor:n,...ie(r.primaryButton)},retryText:{...b(e,"bold"),fontSize:12,lineHeight:15,color:n,...be(r.primaryButton)},loadMoreFooter:{paddingVertical:14,alignItems:"center"},loadMoreLabel:{...b(e,"regular"),fontSize:11,lineHeight:14,color:n,opacity:_y}})}i(Uy,"makeStyles");function za(e,t){let r={entry:"chat",petRef:e};return t?.returnTo!==void 0&&(r.returnTo=t.returnTo),t?.usState!==void 0&&(r.usState=t.usState),t?.prefer!==void 0&&(r.prefer=t.prefer),r}i(za,"chatVetVisitOptions");var Wy=16,Gy=.75,Xn=12,Ba=15,qy=18,Rr=22,Yy=14,Ky=8,$y=20,Xy=10,Qy=13;function Wa({surface:e,petRef:t,renderVetAction:r,onFindVet:n,vet:o}){let s=k(),a=useMemo(()=>Zy(s),[s]),l=G(),d=e.tier,u=e.source;return jsxs(Fragment,{children:[jsx(fn,{visible:e.showBanner&&d!==null,inMs:l.bannerInMs,outMs:l.bannerOutMs,style:a.pinned,children:d!==null&&u!==null?jsxs(View,{accessibilityRole:"alert",style:[a.card,{borderColor:d.borderColor,backgroundColor:d.backgroundColor}],children:[jsx(h,{tier:"compact",style:[a.label,{color:d.textColor}],children:d.label}),u.reason!==null?jsx(h,{style:[a.reason,{color:d.reasonColor}],children:u.reason}):null,e.showVetAction?r!==void 0?jsx(Ue,{render:()=>r(d.level),fallback:jsx(ja,{tier:d,petRef:t,onFindVet:n,vet:o,styles:a}),resetKey:d.level}):jsx(ja,{tier:d,petRef:t,onFindVet:n,vet:o,styles:a}):null,e.dismissLabel!==null?jsx(N,{accessibilityRole:"button",accessibilityLabel:e.dismissLabel,hitSlop:Ky,containerStyle:a.closeSlot,style:a.closeButton,onPress:e.dismiss,children:jsx(ze,{size:Yy,color:d.textColor,strokeWidth:1.5})}):null]}):null}),jsx(fn,{visible:e.showCompactIcon,inMs:l.iconInMs,outMs:l.iconOutMs,style:a.indicatorRow,children:jsx(N,{accessibilityRole:"button",accessibilityLabel:p.showLatestVetAlert,hitSlop:Xy,onPress:e.expand,children:jsx(gs,{size:$y,color:s.color.text.muted,strokeWidth:2})})})]})}i(Wa,"UrgencyBanner");function ja({tier:e,petRef:t,onFindVet:r,vet:n,styles:o}){let s=k(),a=mr(za(t,n)),l=a.status==="opening",d=a.available?()=>{a.open();}:r!==void 0?()=>{W(r,e.level);}:null;if(d===null)return null;let u=kn(s.slots.vetVisitButton)?.textColor??e.textColor;return jsxs(N,{accessibilityRole:"button",accessibilityLabel:p.findVetA11y,accessibilityState:{busy:l},containerStyle:o.findVetSlot,style:[o.findVetButton,{borderColor:e.borderColor,backgroundColor:e.pillColor},o.findVetSlotBox,l?o.findVetBusy:null],onPress:d,children:[jsx(Rs,{size:Qy,color:u,strokeWidth:1.5}),jsx(h,{tier:"control",style:[o.findVetLabel,{color:u}],children:p.findVet})]})}i(ja,"VetAction");function Zy(e){let t=kn(e.slots.vetVisitButton);return StyleSheet.create({pinned:{marginTop:0,marginBottom:4,paddingHorizontal:e.space.lg},card:{borderRadius:Wy,borderWidth:Gy,paddingHorizontal:14,paddingVertical:8,gap:2},label:{...b(e,"monoBold"),fontSize:Xn,lineHeight:Ba},reason:{...b(e,"regular"),fontSize:Xn,lineHeight:qy,paddingRight:Rr},findVetSlot:{alignSelf:"flex-start",marginTop:6},findVetButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:e.radius.pill,borderWidth:1},findVetSlotBox:{...ie(t,1)},findVetBusy:{opacity:.6},findVetLabel:{...b(e,"monoBold"),fontSize:Xn,lineHeight:Ba},closeSlot:{position:"absolute",top:6,right:6},closeButton:{width:Rr,height:Rr,borderRadius:Rr/2,alignItems:"center",justifyContent:"center"},indicatorRow:{alignItems:"flex-end",paddingHorizontal:16,paddingTop:2,paddingBottom:4}})}i(Zy,"makeStyles");function Ga(){let e=Pn(),{handle:t}=se(),r=useCallback(n=>t.setActivePet(n),[t]);return useMemo(()=>({...e,setActivePet:r}),[e,r])}i(Ga,"useChatPets");var Ja=300,el=3e3,Ya=120,it=44,nm=120,om="86%",Ka=15,$a=22,Sr=.5,im=.04,sm=8,am=2,lm=1,dm=.6,um=22,cm=48,Xa=1.25,pm=14,fm=18,ym=6,mm=14,gm=.04,hm=12,bm=2,vm=2,Qa=36,Cm=20,ot=36,st=(it-ot)/2,tl=24,rl=22,Em=.4,Tr=30,nl=20,Rm=.4,Sm=480,Tm=8,Za=14,Pm=10,km=14,wm=12,_m=13,xm=18,Im="12%";function pe(){let e=k(),t=useMemo(()=>Am(e),[e]);return {theme:e,styles:t}}i(pe,"useChatTheme");function Am(e){let t=e.color,r=e.space,n=e.radius,o=e.type,s=e.slots;return StyleSheet.create({container:{flex:1,minHeight:Ya,backgroundColor:t.chatGround},body:{flex:1},centered:{minHeight:Ya,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},emptyContent:{flexGrow:1,alignItems:"center",justifyContent:"flex-start",paddingTop:Im,paddingHorizontal:r.lg,paddingBottom:r.lg,minHeight:Sm,gap:18},errorText:{...b(e,"regular"),fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,color:t.danger,textAlign:"center",marginBottom:r.md},retryButton:{minHeight:it,minWidth:it,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand,...ie(s.primaryButton)},retryLabel:{...b(e,"medium"),color:t.onPrimary,fontSize:o.size.body,...be(s.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.sm,backgroundColor:t.surfaceCream},setupNoticeText:{...b(e,"regular"),color:t.danger,fontSize:o.size.caption,flexShrink:1},turnNotice:{gap:r.xs,padding:r.md,borderRadius:n.lg,backgroundColor:t.surfaceCream,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder,alignItems:"flex-start"},turnNoticeError:{borderColor:t.danger},turnNoticeTitle:{...b(e,"bold"),color:t.text.primary,fontSize:o.size.body},turnNoticeTitleError:{color:t.danger},turnNoticeBody:{...b(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal},turnNoticeAction:{minHeight:it,justifyContent:"center"},turnNoticeActionLabel:{...b(e,"medium"),color:t.brandInk,fontSize:o.size.body},setupNoticeAction:{...b(e,"medium"),color:t.brandInk,fontSize:o.size.caption},reconnectingCaption:{...b(e,"medium"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},list:{flex:1},listContent:{padding:r.lg,gap:r.md},rowBlock:{gap:r.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:r.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:om},bubbleUser:{padding:Ka,backgroundColor:t.bubbleUser,borderRadius:n.xl,borderBottomRightRadius:n.sm,borderWidth:Sr,borderColor:t.accentEdge,shadowColor:t.brand,shadowOpacity:im,shadowRadius:sm,shadowOffset:{width:0,height:am},elevation:lm,...ie(s.userBubble,Sr)},bubbleAssistant:s.assistantBubble?.backgroundColor===void 0?{...ie(s.assistantBubble,Sr)}:{padding:Ka,borderRadius:n.xl,...ie(s.assistantBubble,Sr)},bubblePending:{opacity:dm},bubbleTextUser:{...b(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:$a,...be(s.userBubble)},bubbleTextAssistant:{...b(e,"medium"),color:t.text.primary,fontSize:o.size.body,lineHeight:$a,...be(s.assistantBubble)},bubbleBold:b(e,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:b(e,"mono"),followUps:{alignSelf:"stretch",marginTop:r.sm,gap:Tm},followUpSlot:{alignSelf:"stretch",borderRadius:Za},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:wm,paddingVertical:Pm,paddingHorizontal:km,borderRadius:Za,backgroundColor:t.brandSoft},followUpText:{...b(e,"medium"),flex:1,color:t.text.primary,fontSize:_m,lineHeight:xm},composerOuter:{position:"relative"},composer:{marginHorizontal:r.md,marginTop:r.xs,marginBottom:r.sm,minHeight:cm,justifyContent:"center",paddingLeft:pm,paddingRight:fm,paddingVertical:ym,backgroundColor:t.composerFill,borderWidth:Xa,borderColor:t.composerBorder,borderRadius:um,shadowColor:t.shadow,shadowOpacity:gm,shadowRadius:hm,shadowOffset:{width:0,height:bm},elevation:vm,...ie(s.composerInput,Xa)},composerRow:{flexDirection:"row",alignItems:"center",gap:mm,minHeight:Qa},attachControl:{width:Tr,height:Tr,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:Rm},input:{flex:1,minHeight:Qa,maxHeight:nm,paddingHorizontal:0,paddingVertical:0,...b(e,"regular"),fontSize:o.size.body,lineHeight:Cm,color:t.text.primary,...be(s.composerInput)},sendControl:{minHeight:ot,minWidth:ot,alignItems:"center",justifyContent:"center"},sendDisc:{width:ot,height:ot,borderRadius:ot/2,alignItems:"center",justifyContent:"center",...ie(s.sendButton)},sendControlDisabled:{opacity:Em},poweredBy:{...b(e,"regular"),color:t.text.muted,fontSize:o.size.micro,textAlign:"center",paddingBottom:r.xs}})}i(Am,"makeStyles");var Om=Object.freeze({kind:"live"}),Fm=Object.freeze({kind:"folded"});function Zn(e){if(e.role!=="assistant"||e.checkin===void 0)return null;let t=e.checkin.caseId,r=Yo(e.proactiveOriginRef);return {caseId:t,dueDay:r!==null&&r.caseId===t?r.dueDay:""}}i(Zn,"askOf");function il(e){let t=new Map,r=new Map;for(let o of e){let s=Zn(o);if(s===null)continue;let a=r.get(s.caseId);(a===void 0||s.dueDay>=a.dueDay)&&r.set(s.caseId,{messageId:o.id,dueDay:s.dueDay});}if(r.size===0)return t;let n=null;for(let o of e){let s=Zn(o);if(s===null){n=null;continue}if(r.get(s.caseId)?.messageId===o.id){t.set(o.id,Om),n=null;continue}if(n!==null&&n.caseId===s.caseId){n.days.push(s.dueDay),t.set(o.id,Fm);continue}let a=[s.dueDay];n={id:o.id,caseId:s.caseId,days:a},t.set(o.id,{kind:"past",runDueDays:a});}return t}i(il,"placeCheckins");var ol=864e5,Mm=365;function Pr(e,t){if(typeof e!="string"||typeof t!="string")return null;let r=Date.parse(e),n=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(n))return null;let o=Math.floor(n/ol)-Math.floor(r/ol);return o<1||o>Mm?null:o}i(Pr,"checkinDayNumber");function sl(e){return Zn(e)?.dueDay||null}i(sl,"checkinDueDay");var ye=Object.freeze({eyebrow:"Checking in",logged:"Logged",findVet:"Find a vet now",day:"Day {day}",daySeparator:" \xB7 ",answers:Object.freeze({better:"Better",same:"Same",worse:"Worse"})}),al=Object.freeze(Bo.map(e=>Object.freeze({answer:e,label:ye.answers[e]})));function ll(e,t){let[r,n]=useState(null),[o,s]=useState(null),[a,l]=useState(null),d=useCallback(c=>{t!==null&&(n(c),s(null),t(e.caseId,c).then(f=>{n(null),f.ok?l(c):s(f.error);}));},[t,e.caseId]),u=a??e.answer;return {answer:u,answerable:!qo(e),escalated:u==="worse",pending:r,error:o,choose:d}}i(ll,"useCheckinCard");var cl=44,Lm=.6;function fl({message:e,checkin:t,onAnswer:r,petRef:n,onFindVet:o,vet:s}){let a=k(),l=useMemo(()=>Nm(a),[a]),d=ll(t,r),u=d.answer!==null||d.pending!==null,c=r!==null&&d.answerable,f=Pr(t.openedAt,sl(e));return jsxs(View,{style:l.card,accessibilityLabel:ye.eyebrow,children:[jsxs(View,{style:l.head,children:[jsx(h,{tier:"compact",style:l.eyebrow,children:ye.eyebrow}),f!==null?jsx(h,{tier:"compact",style:l.headDay,children:j(ye.day,{day:f})}):null]}),jsx(h,{style:l.question,accessibilityRole:"text",children:e.text}),c?jsx(View,{style:[l.row,d.pending?l.rowPending:null],children:al.map(({answer:y,label:g})=>{let m=(d.pending??d.answer)===y;return jsx(Pressable,{onPress:()=>d.choose(y),disabled:u,accessibilityRole:"button",accessibilityLabel:g,accessibilityState:{selected:m,disabled:u,busy:d.pending===y},style:[l.pill,m?l.pillSelected:null],children:jsx(h,{tier:"control",style:[l.pillLabel,m?l.pillLabelSelected:null],children:g})},y)})}):null,d.answer!==null?jsx(h,{style:l.logged,children:ye.logged}):null,d.escalated?o!==void 0?jsx(Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:ye.findVet,style:l.findVet,children:jsx(h,{tier:"control",style:l.findVetLabel,children:ye.findVet})}):n?jsx(nt,{entry:"chat",petRef:n,label:ye.findVet,...s?.returnTo!==void 0?{returnTo:s.returnTo}:{},...s?.usState!==void 0?{usState:s.usState}:{},...s?.prefer!==void 0?{prefer:s.prefer}:{},style:l.findVet,labelStyle:l.findVetLabel}):null:null,t.resolutionText?jsx(h,{style:l.resolution,children:t.resolutionText}):null,d.error?jsx(h,{style:l.error,accessibilityRole:"alert",children:d.error.displayMessage}):null]})}i(fl,"CheckinCard");function Nm(e){let t=e.color,r=e.space,n=e.radius,o=e.type;return StyleSheet.create({card:{maxWidth:"92%",padding:r.md,gap:r.sm,borderRadius:n.lg,backgroundColor:t.brandSoft,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},head:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},eyebrow:{...b(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},headDay:{...b(e,"bold"),color:t.text.primary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},question:{...b(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},row:{flexDirection:"row",gap:r.sm,marginTop:r.xs},rowPending:{opacity:Lm},pill:{flex:1,minHeight:cl,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,borderRadius:n.pill,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},pillSelected:{backgroundColor:t.brand,borderColor:t.brand},pillLabel:{...b(e,"regular"),color:t.text.primary,fontSize:o.size.body},pillLabelSelected:{color:t.onPrimary},logged:{...b(e,"regular"),color:t.text.secondary,fontSize:o.size.caption},resolution:{...b(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},error:{...b(e,"regular"),color:t.danger,fontSize:o.size.caption},findVet:{alignSelf:"stretch",minHeight:cl,alignItems:"center",justifyContent:"center",borderRadius:n.pill,borderWidth:1.5,borderColor:t.brandBorder,backgroundColor:t.surface},findVetLabel:{...b(e,"bold"),color:t.brandInk,fontSize:o.size.body}})}i(Nm,"makeStyles");var zm=1.5,Bm=3;function ml({text:e,runDueDays:t,openedAt:r}){let n=k(),o=useMemo(()=>jm(n),[n]),s=t.map(l=>Pr(r,l)).filter(l=>l!==null),a=t.length>1;return a&&s.length===0?null:jsxs(View,{style:o.row,children:[jsx(View,{style:o.rule,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"}),jsxs(View,{style:o.body,children:[s.length>0?jsx(h,{tier:"compact",style:o.days,children:s.map(l=>j(ye.day,{day:l})).join(ye.daySeparator)}):null,a?null:jsx(h,{style:o.question,accessibilityRole:"text",children:e})]})]})}i(ml,"CheckinPastAsk");function jm(e){let t=e.color,r=e.space,n=e.type;return StyleSheet.create({row:{flexDirection:"row",paddingVertical:r.xs},rule:{width:zm,borderRadius:1,backgroundColor:t.borderHairlineGreen,marginRight:r.md},body:{flex:1,gap:Bm},days:{...b(e,"monoMedium"),fontSize:n.size.nano,letterSpacing:n.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},question:{...b(e,"regular"),fontSize:n.size.bodyTight,lineHeight:n.size.bodyTight*n.lineHeight.normal,color:t.text.muted}})}i(jm,"makeStyles");var Wm=Object.freeze({TIER_1:"#07C168",TIER_2:"#27A9FF",TIER_3:"#FBC558"}),gl="#C8BEB4";function Gm(e){return e?Wm[e.toUpperCase()]??gl:gl}i(Gm,"tierColor");function qm(e){if(!e)return null;let t=/^tier[_\s-]?(\d+)$/i.exec(e.trim());return t?`Tier ${t[1]}`:e}i(qm,"tierLabel");function Pe(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0?null:t}i(Pe,"text");function Ym(e){let t=Pe(e);return t!==null&&/^https:\/\/\S+$/i.test(t)?t:null}i(Ym,"httpsUrl");function Km(e,t){let r=Pe(e.source_name)??Pe(e.sourceName),n=Pe(e.section),o=Pe(e.authority_tier)??Pe(e.authorityTier),s=qm(o),a=r??Pe(e.title)??`Source ${t+1}`,l=Pe(e.monograph_chunk_id)??Pe(e.chunkId),d=[n,s].filter(u=>u!==null).join(" \xB7 ");return Object.freeze({title:a,sourceName:r,section:n,authorityTier:o,tierLabel:s,meta:d.length===0?null:d,url:Ym(e.url),excerpt:Pe(e.excerpt),tierColor:Gm(o),key:`${a}-${l??"none"}-${t}`})}i(Km,"toCitationCard");function hl(e){return e===void 0||e.length===0?$m:Object.freeze(e.map((t,r)=>Km(t,r)))}i(hl,"toCitationCards");var $m=Object.freeze([]);function no(e){return e===1?`1 ${p.sourceSingular}`:`${e} ${p.sourcePlural}`}i(no,"sourcesLabel");function bl(e,t){return `${t?p.hideSources:p.showSources} ${no(e)}`}i(bl,"sourcesToggleLabel");function vl(e){return [e.url!==null?`${p.openSource}: ${e.title}`:e.title,e.meta,e.excerpt].filter(t=>t!==null&&t.length>0).join(". ")}i(vl,"citationA11yLabel");var eg=244,El=8,Rl=13,tg=14,rg=.3,ng=-0.24,og=22,ig=10,sg=15;function Sl({citations:e,onOpenUrl:t}){let r=k(),n=useMemo(()=>dg(r),[r]),o=useMemo(()=>hl(e),[e]),[s,a]=useState(false);if(o.length===0)return null;let l=o.length;return jsxs(View,{style:n.block,children:[jsxs(N,{accessibilityRole:"button",accessibilityLabel:bl(l,s),accessibilityState:{expanded:s},containerStyle:n.toggleSlot,style:n.togglePill,onPress:()=>a(d=>!d),children:[jsx(fs,{size:Rl,color:r.color.brandInk,strokeWidth:1.5}),jsx(h,{tier:"compact",style:n.toggleLabel,children:no(l)}),jsx(ir,{size:Rl,color:r.color.brandInk,strokeWidth:1.5,direction:s?"up":"down"})]}),s?jsx(ag,{cards:o,styles:n,open:t}):null]})}i(Sl,"CitationCards");function ag({cards:e,styles:t,open:r}){let n=G(),o=Be(n.citationsInMs,{risePx:n.citationsRisePx});return jsx(Animated.View,{style:o,children:jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:t.row,children:e.map(s=>jsx(lg,{card:s,styles:t,open:r},s.key))})})}i(ag,"Deck");function lg({card:e,styles:t,open:r}){let n=k(),o=e.url!==null&&r!==void 0,s=vl(o?e:{...e,url:null}),a=jsxs(Fragment,{children:[jsxs(View,{style:t.cardHeader,children:[jsx(View,{style:[t.tierDot,{backgroundColor:e.tierColor}]}),jsx(h,{style:[t.cardTitle,o?t.cardTitleLink:null],numberOfLines:2,children:e.title}),o?jsx(ys,{size:tg,color:n.color.linkInk,strokeWidth:1.5}):null]}),e.meta!==null?jsx(h,{tier:"compact",style:t.cardMeta,numberOfLines:1,children:e.meta}):null,e.excerpt!==null?jsx(h,{style:t.cardExcerpt,numberOfLines:3,children:e.excerpt}):null]});if(e.url!==null&&r!==void 0){let l=e.url;return jsx(N,{accessibilityRole:"link",accessibilityLabel:s,style:t.card,onPress:()=>r(l),children:a})}return jsx(View,{accessible:true,accessibilityRole:"text",accessibilityLabel:s,style:t.card,children:a})}i(lg,"Card");function dg(e){let t=e.color,r=e.space,n=e.radius,o=e.type.size;return StyleSheet.create({block:{gap:r.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:n.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:r.xs+2,paddingHorizontal:r.md,paddingVertical:r.xs+2,borderRadius:n.pill,backgroundColor:t.brandSoft},toggleLabel:{...b(e,"monoBold"),fontSize:o.micro,lineHeight:o.micro,letterSpacing:rg,color:t.brandInk,textTransform:"uppercase"},row:{gap:r.sm,paddingRight:r.xl,paddingTop:r.xs},card:{width:eg,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.md,gap:r.xs+2},cardHeader:{flexDirection:"row",alignItems:"center",gap:r.sm},tierDot:{width:El,height:El,borderRadius:n.pill},cardTitle:{...b(e,"bold"),flex:1,fontSize:o.bodyTight,lineHeight:og,color:t.text.primary,letterSpacing:ng},cardTitleLink:{color:t.linkInk},cardMeta:{...b(e,"monoMedium"),fontSize:o.nano,lineHeight:ig,letterSpacing:e.type.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},cardExcerpt:{...b(e,"regular"),fontSize:o.tiny,lineHeight:sg,color:t.text.muted}})}i(dg,"makeStyles");function Tl(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}i(Tl,"formatMessageTime");var At=15,mg=15,gg=6,hg=Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function xl({message:e,onCopy:t,sentiment:r=null,onSentiment:n,thanks:o=false}){let s=k(),a=useMemo(()=>bg(s),[s]),l=G(),d=e.role==="user",u=useMemo(()=>Tl(e.createdAt),[e.createdAt]),c=t!==void 0&&e.text.length>0,f=!d&&n!==void 0&&e.responseId!==void 0,[y,g]=useState(false),m=useRef(null);useEffect(()=>()=>{m.current&&clearTimeout(m.current);},[]);let x=i(()=>{t!==void 0&&(et(t,e.text),g(true),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{g(false),m.current=null;},l.copiedMs));},"copy");return u===null&&!c&&!f?null:jsxs(View,{style:a.wrap,children:[jsxs(View,{style:[a.row,d?a.rowUser:a.rowAssistant],children:[u!==null?jsx(h,{tier:"compact",style:a.timestamp,children:u}):null,c?jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:y?p.copied:d?p.copyUserMessage:p.copyAssistantMessage,hitSlop:mg,onPress:x,style:a.iconHit,children:y?jsx(Fe,{size:At,color:s.color.success,strokeWidth:2}):jsx(ms,{size:At,color:s.color.text.timestamp,strokeWidth:1.5})}):null,f?Eo.map(({sentiment:v,label:S})=>jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:S,accessibilityState:{selected:r===v},hitSlop:gg,onPress:()=>n?.(v),style:a.iconHit,children:jsx(sr,{size:At,color:s.color.sentiment[v],active:r===v,rotate:hg[v],strokeWidth:1.5})},v)):null]}),o?jsx(h,{style:a.thanks,accessibilityLiveRegion:"polite",children:p.feedbackThanks}):null]})}i(xl,"MessageFooter");function bg(e){let t=e.type;return StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...b(e,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:e.color.text.timestamp,textAlign:"center"},iconHit:{width:At,height:At,alignItems:"center",justifyContent:"center"},thanks:{...b(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.text.secondary}})}i(bg,"makeStyles");var Il="#10462E",Al="#000000",vg="#83E0B4",Cg=Object.freeze([Object.freeze({id:"breed-health-miss",intent:"send",label:"What {breed} health issue do owners miss most?",fallbackLabel:"What {species} health issue do owners miss most?",background:"#A0C4F6",borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:vg,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:Il,brandEdge:true,borderWidth:1}),Object.freeze({id:"vet-prep",intent:"vet_report",label:"Help me prep for {petName}\u2019s vet visit.",background:"#FFBDBD",borderColor:"#6D1D14",borderWidth:1.25})]),Eg=/\s*-\s*(?:small|medium|large|giant|toy)\s*$/i;function Rg(e){return e==null?e:e.replace(Eg,"").trim()}i(Rg,"formatBreedForPrompt");var Sg=new Set(["","?","-","--",".","n/a","na","none","null","nil","unknown","unspecified","unsure","not sure","not specified","not applicable","no idea","dunno","idk","tbd","other","i dont know","i don't know","dont know","don't know","do not know","i do not know","not known","no clue"]);function Tg(e){let t=String(e??"").replace(/\s+/gu," ").trim().toLowerCase().replace(/\u2019/g,"'");return Sg.has(t)}i(Tg,"isUninformativeBreed");function Pg(e){return e==="cat"?"Domestic Short Hair Mix":"Mixed Breed"}i(Pg,"unspecifiedBreedLabel");function kg(e,t){return Tg(e)?Pg(t):String(e).replace(/\s+/gu," ").trim()}i(kg,"resolveBreedLabel");function Ol(e){let t=e?.name?.trim()||p.emptyTitlePetFallback;return j(p.emptyTitle,{petName:t})}i(Ol,"emptyStateTitle");function Fl(e,t=Il){let r=Mn(e?.species),n=r==="cat"?"my cat":"my dog",o=e?.name?.trim()||null,s=o||n,a=kg(Rg(e?.breed),r)||null,l=Dn(e?.ageYears),d=l===null?null:String(l);return Object.freeze(Cg.map(u=>{let c=u.label.includes("{breed}"),f=u.label.includes("{ageYears}"),g=u.fallbackLabel!==void 0&&(c&&!a||f&&!d)&&u.fallbackLabel?u.fallbackLabel:u.label,m=j(g,{petName:s,breed:a??n,species:r,ageYears:d??""}),x=!o&&g.startsWith("{petName}")?m.charAt(0).toUpperCase()+m.slice(1):m;return Object.freeze({id:u.id,intent:u.intent,label:x,background:u.background,borderColor:u.brandEdge===true?t:u.borderColor,borderWidth:u.borderWidth})}))}i(Fl,"resolveQuickPrompts");var _g=36,Vl=4,xg=340;function Ll({pet:e,petRef:t,onSend:r,onVetPrep:n,vet:o}){let s=k(),a=useMemo(()=>Ag(s),[s]),l=useMemo(()=>Fl(e,s.color.brandInk),[e,s.color.brandInk]),d=Ol(e);return jsxs(View,{style:a.block,children:[jsx(h,{tier:"heading",style:a.title,accessibilityRole:"header",children:d}),jsx(View,{style:a.list,children:l.map((u,c)=>jsx(Ig,{prompt:u,index:c,petRef:t,onSend:r,onVetPrep:n,vet:o,pet:e,styles:a},u.id))})]})}i(Ll,"QuickPrompts");function Ig({prompt:e,index:t,pet:r,petRef:n,onSend:o,onVetPrep:s,vet:a,styles:l}){let d=G(),u=Be(d.followUpInMs,{delayMs:lr(d,t)}),c={backgroundColor:e.background,borderColor:e.borderColor,borderWidth:e.borderWidth};return e.intent==="vet_report"?s!==void 0?jsx(Animated.View,{style:u,children:jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Vl,style:[l.chip,c],onPress:()=>{W(s,r);},children:jsx(h,{tier:"compact",style:l.chipLabel,children:e.label})})}):n===null?null:jsx(Animated.View,{style:u,children:jsx(nt,{entry:"chat",petRef:n,label:e.label,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:[l.chip,c],labelStyle:l.chipLabel})}):jsx(Animated.View,{style:u,children:jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Vl,style:[l.chip,c],onPress:()=>o(e.label),children:jsx(h,{tier:"compact",style:l.chipLabel,children:e.label})})})}i(Ig,"Chip");function Ag(e){let t=e.color;return StyleSheet.create({block:{gap:18,alignItems:"center",width:"100%"},title:{...b(e,"bold"),fontSize:28,lineHeight:34,color:t.text.primary,letterSpacing:-0.8,textAlign:"center",maxWidth:xg},list:{width:"100%",gap:12,alignItems:"center"},chip:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:9,minHeight:_g,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipLabel:{...b(e,"bold"),fontSize:12,lineHeight:14,color:Al,textAlign:"center"}})}i(Ag,"makeStyles");var io=/\*\*([^*]+?)\*\*|\*([^*]+?)\*|`([^`]+?)`/g;function Nl(e){return e.includes("*")||e.includes("`")}i(Nl,"hasInlineMarkup");function Hl(e){let t=[],r=0;io.lastIndex=0;for(let n=io.exec(e);n!==null;n=io.exec(e)){n.index>r&&t.push({kind:"text",text:e.slice(r,n.index)});let o=n[1],s=n[2],a=n[3];o!==void 0?t.push({kind:"bold",text:o}):s!==void 0?t.push({kind:"italic",text:s}):a!==void 0&&t.push({kind:"code",text:a}),r=n.index+n[0].length;}return r<e.length&&t.push({kind:"text",text:e.slice(r)}),t}i(Hl,"tokenizeInlineMarkdown");function Ul(e,t){return Nl(e)?Hl(e).map((r,n)=>{switch(r.kind){case "bold":return jsx(h,{style:t.bold,children:r.text},n);case "italic":return t.italic?jsx(h,{style:t.italic,children:r.text},n):r.text;case "code":return t.code?jsx(h,{style:t.code,children:r.text},n):r.text;default:return r.text}}):e}i(Ul,"renderInlineMarkdown");var jl=6,ql=520,Lg=Math.round(ql*.18),Wl=.44,Ng=.5,Gl=[0,.5,1],Hg=[0,1,2];function Yl(){let e=k(),t=useMemo(()=>zg(e),[e]),r=!e.motion.reducedMotion;return jsx(View,{style:t.card,accessible:true,accessibilityRole:"text",accessibilityLabel:p.typing,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:Hg.map(n=>r?jsx(Ug,{index:n,style:t.dot},n):jsx(View,{style:[t.dot,t.dotStatic]},n))})}i(Yl,"TypingIndicator");function Ug({index:e,style:t}){let r=useRef(new Animated.Value(0)).current;useEffect(()=>{let s=Animated.sequence([Animated.delay(e*Lg),Animated.loop(Animated.timing(r,{toValue:1,duration:ql,useNativeDriver:true}))]);return s.start(),()=>s.stop()},[r,e]);let n=r.interpolate({inputRange:Gl,outputRange:[Wl,1,Wl]}),o=r.interpolate({inputRange:Gl,outputRange:[0,-3.5,0]});return jsx(Animated.View,{style:[t,{opacity:n,transform:[{translateY:o}]}]})}i(Ug,"AnimatedDot");function zg(e){let t=e.color,r=e.space,n=e.radius;return StyleSheet.create({card:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingHorizontal:r.md,paddingVertical:r.sm,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},dot:{width:jl,height:jl,borderRadius:n.pill,backgroundColor:t.brand},dotStatic:{opacity:Ng}})}i(zg,"makeStyles");function Ql(e,t,r){switch(e){case "loading":return r.renderPending?jsx(Ue,{render:r.renderPending,fallback:jsx(Kl,{})}):jsx(Kl,{});case "empty":return jsx(Yg,{pet:r.shownPet,petRef:t.petRef,prompts:t.suggestedPrompts,onSelectPrompt:r.onSelectPrompt,onVetPrep:r.onVetPrep,vet:r.vet});case "error":return jsx($g,{error:t.error,onRetry:t.retryLast,onAddPet:r.onAddPet});case "populated":return jsx(Xg,{messages:t.messages,prompts:t.suggestedPrompts,onSelectPrompt:r.onSelectPrompt,isStreaming:t.isStreaming,onAnswerCheckin:t.petRef?t.answerCheckin:null,onCopy:r.onCopy,sentimentByMessage:t.sentimentByMessage,onSentiment:r.onSentiment,thanksFor:r.thanksFor,imagesByMessage:r.imagesByMessage,onPreview:r.onPreview,notice:r.notice,reconnecting:t.reconnecting===true,onRetry:t.retryLast,onStartNew:t.newConversation,petRef:t.petRef,onFindVet:r.onCheckinFindVet,vet:r.vet,onOpenUrl:r.onOpenUrl});default:return Bt(e)}}i(Ql,"renderView");function Kl(){let{theme:e,styles:t}=pe(),[r,n]=useState(false);return useEffect(()=>{let o=setTimeout(()=>n(true),Ja);return ()=>clearTimeout(o)},[]),jsx(View,{style:t.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:p.loading,children:r?jsx(ActivityIndicator,{color:e.color.brandInk}):null})}i(Kl,"LoadingState");function Yg({pet:e,petRef:t,prompts:r,onSelectPrompt:n,onVetPrep:o,vet:s}){let{styles:a}=pe();return jsxs(ScrollView,{contentContainerStyle:a.emptyContent,keyboardShouldPersistTaps:"handled",accessibilityLabel:p.empty,children:[jsx(Ll,{pet:e,petRef:t,onSend:n,onVetPrep:o,vet:s}),jsx(Zl,{prompts:r,onSelectPrompt:n})]})}i(Yg,"EmptyState");function Zl({prompts:e,onSelectPrompt:t}){let{styles:r}=pe();return e.length===0?null:jsx(View,{style:r.followUps,children:e.map((n,o)=>jsx(Kg,{prompt:n,index:o,onSelectPrompt:t},n))})}i(Zl,"FollowUps");function Kg({prompt:e,index:t,onSelectPrompt:r}){let{theme:n,styles:o}=pe(),s=G(),a=Be(s.followUpInMs,{delayMs:lr(s,t)});return jsx(Animated.View,{style:a,children:jsxs(N,{onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:e,containerStyle:o.followUpSlot,style:o.followUpRow,children:[jsx(h,{style:o.followUpText,children:e}),jsx(ir,{size:Jg,color:n.color.brandInk,direction:"right"})]})})}i(Kg,"FollowUpRow");function $g({error:e,onRetry:t,onAddPet:r}){let{styles:n}=pe(),o=ki(e)?Mi(r):void 0;return jsxs(View,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[jsx(h,{style:n.errorText,children:e.displayMessage}),o!==void 0?jsx(Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:p.addPet,style:n.retryButton,children:jsx(h,{tier:"control",style:n.retryLabel,children:p.addPet})}):null,e.retryable?jsx(Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:p.retry,style:n.retryButton,children:jsx(h,{tier:"control",style:n.retryLabel,children:p.retry})}):null]})}i($g,"ErrorState");function Xg({messages:e,prompts:t,onSelectPrompt:r,isStreaming:n,onAnswerCheckin:o,onCopy:s,sentimentByMessage:a,onSentiment:l,thanksFor:d,imagesByMessage:u,onPreview:c,notice:f,reconnecting:y,onRetry:g,onStartNew:m,petRef:x,onFindVet:v,vet:S,onOpenUrl:O}){let{styles:I}=pe(),M=G();St(e.length,M);let C=useMemo(()=>il(e),[e]),R=Zi(e,n),F=e[e.length-1];return jsxs(ScrollView,{style:I.list,contentContainerStyle:I.listContent,accessibilityLabel:p.transcript,keyboardShouldPersistTaps:"handled",children:[e.map(T=>{let E=T.checkin?C.get(T.id):void 0;return E?.kind==="folded"?null:E?.kind==="past"?jsx(ml,{text:T.text,runDueDays:E.runDueDays,openedAt:T.checkin?.openedAt},T.id):T.checkin&&E!==void 0?jsx(fl,{message:T,checkin:T.checkin,onAnswer:o,petRef:x,onFindVet:v,vet:S},T.id):jsx(eh,{message:T,revealing:n&&T===F&&T.role==="assistant",onCopy:s,sentiment:T.responseId===void 0?null:a[String(T.responseId)]??null,onSentiment:l,thanks:d!==null&&T.responseId!==void 0&&String(T.responseId)===d,images:u[T.id]??Zg,onPreview:c,onOpenUrl:O},T.id)}),y?jsx(h,{tier:"compact",style:I.reconnectingCaption,accessibilityRole:"text",children:p.reconnecting}):null,R?jsx(Yl,{}):null,f!==null?jsx(Qg,{notice:f,onRetry:g,onStartNew:m}):null,n?null:jsx(Zl,{prompts:t,onSelectPrompt:r})]})}i(Xg,"PopulatedState");function Qg({notice:e,onRetry:t,onStartNew:r}){let{styles:n}=pe(),o=e.tone==="error";return jsxs(View,{style:[n.turnNotice,o?n.turnNoticeError:null],accessible:true,accessibilityRole:"alert",children:[jsx(h,{tier:"control",style:[n.turnNoticeTitle,o?n.turnNoticeTitleError:null],children:e.title}),jsx(h,{tier:"compact",style:n.turnNoticeBody,children:e.body}),jsx(Pressable,{onPress:e.action==="startNew"?r:t,accessibilityRole:"button",accessibilityLabel:e.actionLabel,hitSlop:st,style:n.turnNoticeAction,children:jsx(h,{tier:"control",style:n.turnNoticeActionLabel,children:e.actionLabel})})]})}i(Qg,"TurnNoticeCard");var Zg=Object.freeze([]),Jg=14;function eh({message:e,revealing:t,onCopy:r,sentiment:n,onSentiment:o,thanks:s,images:a,onPreview:l,onOpenUrl:d}){let{styles:u}=pe(),c=G(),f=Be(c.messageInMs),y=Os(e.text,t,c),g=e.role==="user",m=g?p.senderUser:p.senderAssistant,x=useCallback(S=>o(e,S),[o,e]),v=e.pending!==true;return jsxs(Animated.View,{style:[u.rowBlock,g?u.rowBlockUser:u.rowBlockAssistant,f],children:[jsx(View,{style:[u.row,g?u.rowUser:u.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${m}: ${e.text}`,accessibilityState:e.pending===true?{busy:true}:void 0,children:jsxs(View,{style:[u.bubble,g?u.bubbleUser:u.bubbleAssistant,e.pending?u.bubblePending:null],children:[g&&a.length>0?jsx(Xs,{images:a,onPreview:S=>l({uri:S.uri,label:S.filename})}):null,jsx(h,{style:g?u.bubbleTextUser:u.bubbleTextAssistant,children:g?e.text:Ul(y,{bold:u.bubbleBold,italic:u.bubbleItalic,code:u.bubbleCode})})]})}),!g&&!t?jsx(Sl,{citations:e.citations,onOpenUrl:d}):null,v?jsx(xl,{message:e,onCopy:r,sentiment:n,onSentiment:e.responseId===void 0?void 0:x,thanks:s}):null]})}i(eh,"MessageRow");var ih=Object.freeze(["photo"]),sh=1;function ah(e){let{style:t,renderPending:r}=e;return jsx(is,{capability:"chat",style:t,...r?{renderPending:r}:{},children:jsx(lh,{...e})})}i(ah,"EverfurChat");function lh({petRef:e,conversationId:t,style:r,renderPending:n,onCopy:o,onPetChange:s,onVetPrep:a,onFindVet:l,renderVetAction:d,attachments:u,pet:c,onAddPet:f,checkinTarget:y,initialAsk:g,composerSeed:m,lifecycle:x,draftStore:v,vetReturnTo:S,vetUsState:O,vetPrefer:I,onOpenUrl:M}){let{theme:C,styles:R}=pe(),F=G(),T=useMemo(()=>Ji(e,t),[e,t]),E=Nt(T),w=Xi(E),_=Ga(),V=Gi(E),U=useSafeAreaInsets(),B=Qi(E),Z=useMemo(()=>l===void 0?void 0:()=>{W(l,"emergency");},[l]),re=useMemo(()=>S===void 0&&O===void 0&&I===void 0?void 0:{returnTo:S,usState:O,prefer:I},[S,O,I]),ge=Wn(_.pets,E.petRef),dt=useMemo(()=>Ki(E.messages,ge?.name??null),[E.messages,ge?.name]),ne=$i(dt);St(ne.showBanner,F),Ni(E.openCheckin,y),Ai(E.askEverfur,E.isBootstrapping,g);let Ve=useMemo(()=>Qr(m),[m]);Vi(x,{conversationId:E.conversationId===null?null:String(E.conversationId),isTurnInFlight:E.isStreaming,refresh:E.refreshActiveThread});let Mt=(E.hasUnreadThreads??false)||V.rows.some(fe=>fe.unreadCount!==null&&fe.unreadCount>0)||(E.unreadCount??0)>0,ut=xi(E.messages),[Xe,Qe]=useState(null),td=useCallback(()=>Qe(null),[]),[ct,Ir]=useState(null),[rd,lo]=useState(null),Ze=useRef(null);useEffect(()=>()=>{Ze.current&&clearTimeout(Ze.current);},[]);let uo=useCallback(fe=>{lo(String(fe)),Ze.current&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{lo(null),Ze.current=null;},el);},[]),nd=useCallback((fe,Dt)=>{let pt=fe.responseId;if(pt===void 0)return;let ld=E.sentimentByMessage[String(pt)];E.feedback(pt,Dt),Dt==="down"&&ld!=="down"&&Ir(pt);},[E]),od=useCallback(async(fe,Dt)=>ct===null||!(await E.feedback(ct,"down",fe??"other",Dt)).ok?false:(Ir(null),uo(ct),true),[E,ct,uo]),id=useCallback(()=>Ir(null),[]),sd=useCallback(fe=>{E.send(fe);},[E.send]),ad=useMemo(()=>M===void 0?void 0:fe=>{W(M,fe,"citation");},[M]),co={send:E.send,stop:E.stop,isStreaming:E.isStreaming,conversationId:E.conversationId,seed:Ve,draftStore:v,onStage:ut.stage,onPreview:Qe};return jsxs(KeyboardAvoidingView,{style:[R.container,{paddingTop:U.top},r],behavior:Platform.OS==="ios"?"padding":void 0,children:[jsx(Fa,{pets:_,petRef:E.petRef,historyUnread:Mt,onOpenHistory:V.show,onPetChange:s,onAddPet:f,vet:re}),c!==void 0?jsx(dh,{petRef:e??null,pet:c,onRegistered:_.refresh}):null,jsx(Wa,{surface:ne,petRef:E.petRef,renderVetAction:d,onFindVet:l,vet:re}),jsx(View,{style:R.body,children:Ql(w,E,{notice:B,vet:re,onCheckinFindVet:Z,onSelectPrompt:sd,renderPending:n,shownPet:ge,onVetPrep:a,onCopy:o,onSentiment:nd,thanksFor:rd,imagesByMessage:ut.byMessage,onPreview:Qe,onAddPet:f,onOpenUrl:ad})}),u!==void 0?jsx(uh,{...co,attachments:u}):jsx(ed,{...co,attachments:null}),jsx(ds,{}),C.meta.hidePoweredBy?null:jsx(h,{tier:"compact",style:R.poweredBy,accessibilityRole:"text",accessibilityLabel:p.poweredBy,children:p.poweredBy}),jsx(Ua,{chat:E,history:V}),jsx(Na,{visible:ct!==null,onSubmit:od,onSkip:id}),jsx(Fs,{uri:Xe?.uri??null,label:Xe?.label??"",onClose:td}),jsx(kt,{})]})}i(lh,"ChatBody");function dh({petRef:e,pet:t,onRegistered:r}){let{styles:n}=pe(),o=wi(e,t,r);return o.status!=="failed"||o.error===null?null:jsxs(View,{style:n.setupNotice,accessible:true,accessibilityRole:"alert",children:[jsx(h,{tier:"compact",style:n.setupNoticeText,children:o.error.displayMessage}),jsx(Pressable,{onPress:o.retry,accessibilityRole:"button",accessibilityLabel:p.retry,hitSlop:st,children:jsx(h,{tier:"control",style:n.setupNoticeAction,children:p.retry})})]})}i(dh,"PetSetupNotice");function uh({attachments:e,...t}){let r=useMemo(()=>Sn(),[]),n=Wr({maxPerMessage:e.maxPerMessage??sh,transport:r}),o=useMemo(()=>({state:n,sources:e.sources??ih,pick:e.pick}),[n,e.sources,e.pick]);return jsx(ed,{...t,attachments:o})}i(uh,"ComposerWithAttachments");function ed({send:e,stop:t,isStreaming:r,conversationId:n,attachments:o,seed:s,draftStore:a,onStage:l,onPreview:d}){let{theme:u,styles:c}=pe(),f=G(),[y,g]=zi(e,n,s);Bi(a,n===null?null:String(n),y,g);let[m,x]=useState(false),[v,S]=useState(false);useEffect(()=>{S(false);},[n]);let O=u.meta.placeholder??p.placeholder,I=o?.state.uploading??false,M=o?.state.failed??false,C=I||M,R=o?.state.attachments??ch;St(R.length,f);let F=useCallback(()=>{if(y.trim().length===0||C||[...y].length>qt)return;let B=o?.state.s3Keys??ph;o!==null&&B.length>0?(l(o.state.attachments.filter(Z=>Z.status==="uploaded").map(Z=>({uri:Z.previewUri,filename:Z.filename}))),e(y,{imageS3Keys:B}),o.state.clear()):e(y),g(""),S(false);},[y,e,C,o,l]),T=useCallback(()=>{t();},[t]),E=useCallback(B=>{x(false),o!==null&&(S(false),o.state.dismissRejected(),et(o.pick,B).then(Z=>{if(!Z.ok){S(true);return}Z.value!==null&&o.state.add(Z.value);}));},[o]),_=useMemo(()=>[...y].length>qt,[y])||C,V=o!==null&&R.length>=o.state.maxPerMessage,U=u.slots.sendButton?.textColor??u.color.brandInk;return jsxs(View,{style:c.composerOuter,children:[o!==null&&m?jsx(Vs,{sources:o.sources,full:V,onPick:E,onClose:()=>x(false)}):null,jsxs(View,{style:c.composer,children:[o!==null?jsx($s,{attachments:R,rejected:v?fh:o.state.rejected,uploadFailed:M,onRetry:o.state.retry,onRemove:o.state.remove,onPreview:B=>d({uri:B.previewUri,label:B.filename})}):null,jsxs(View,{style:c.composerRow,children:[o!==null?jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:Jo(R.length,o.state.maxPerMessage),accessibilityState:{disabled:V,expanded:m},disabled:V,hitSlop:(it-Tr)/2,style:[c.attachControl,V?c.attachControlDisabled:null],onPress:()=>x(B=>!B),children:jsx(hs,{size:nl,color:V?u.color.text.muted:u.color.brandInk,strokeWidth:1.75})}):null,jsx(Je,{style:c.input,value:y,onChangeText:g,placeholder:O,placeholderTextColor:u.slots.composerInput?.textColor??u.color.text.placeholder,accessibilityLabel:O,onSubmitEditing:F,returnKeyType:"send",blurOnSubmit:false,multiline:true,editable:true}),r?jsx(Pressable,{onPress:T,accessibilityRole:"button",accessibilityLabel:p.stop,hitSlop:st,style:c.sendControl,children:jsx(View,{style:c.sendDisc,testID:"everfur-stop-disc",children:jsx(Ts,{size:rl,color:U,testID:"everfur-stop-glyph"})})}):jsx(Pressable,{onPress:F,disabled:_,accessibilityRole:"button",accessibilityLabel:p.send,accessibilityState:{disabled:_,busy:I},hitSlop:st,style:[c.sendControl,_?c.sendControlDisabled:null],children:jsx(View,{style:c.sendDisc,testID:"everfur-send-disc",children:jsx(Ss,{size:tl,color:U,testID:"everfur-send-glyph"})})})]})]})]})}i(ed,"Composer");var ch=Object.freeze([]),ph=Object.freeze([]),fh=Object.freeze({code:"unknown",retryable:true,filename:""});export{ah as EverfurChat,Sn as createRnChatAttachmentTransport,Wr as useChatAttachments,Nt as useEverfurChat,Pn as useEverfurPets};