@everfur/sdk 0.4.0 → 0.5.1

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 (177) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/README.md +9 -8
  3. package/dist/{Chat-BZZ-Py5l.d.ts → Chat-Rzplrf5M.d.ts} +17 -3
  4. package/dist/{Chat-Dq4fffIO.d.cts → Chat-ypo6miKm.d.cts} +17 -3
  5. package/dist/{DepthViews-BG3E25MD.d.ts → DepthViews-CeTfPUBX.d.ts} +1 -1
  6. package/dist/{DepthViews-B_hIypI6.d.cts → DepthViews-ClykXOJj.d.cts} +1 -1
  7. package/dist/{DepthViews-CL75jyRA.d.cts → DepthViews-Cui3oonj.d.cts} +1 -1
  8. package/dist/{DepthViews-CkYri51q.d.ts → DepthViews-baYLMNQ-.d.ts} +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-D_SECjr1.d.cts → attachments-CwsR-bPN.d.cts} +7 -6
  20. package/dist/{attachments-BrUWQYNK.d.ts → attachments-CzZ7in24.d.ts} +7 -6
  21. package/dist/{attachments-DpldrvIW.d.ts → attachments-D3HCBmOE.d.ts} +3 -3
  22. package/dist/{attachments-BorG422I.d.cts → attachments-Nk73Lll8.d.cts} +3 -3
  23. package/dist/{bookingCopy-SREvkG19.d.cts → bookingCopy-Dv8rKqyV.d.cts} +417 -14
  24. package/dist/{bookingCopy-CqtDYvCR.d.ts → bookingCopy-SDkXaxDf.d.ts} +417 -14
  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-v6QczS9N.d.ts → casesRepository-BTAecTnF.d.ts} +14 -2
  32. package/dist/{casesRepository-DwtZVsbj.d.cts → casesRepository-aryld7fJ.d.cts} +14 -2
  33. package/dist/chat/index.cjs +1 -1
  34. package/dist/chat/index.d.cts +12 -11
  35. package/dist/chat/index.d.ts +12 -11
  36. package/dist/chat/index.js +1 -1
  37. package/dist/client/index.cjs +5 -5
  38. package/dist/client/index.d.cts +14 -12
  39. package/dist/client/index.d.ts +14 -12
  40. package/dist/client/index.js +5 -5
  41. package/dist/{config-C7eb_IMD.d.ts → config-6qS7Sohy.d.cts} +3 -2
  42. package/dist/{config--Wu1Umhd.d.cts → config-X6BtwDwQ.d.ts} +3 -2
  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-CahAEha8.d.ts → context-7f3Nb_xE.d.ts} +9 -8
  48. package/dist/{context-CL3lyuy1.d.cts → context-CkqPM4Ml.d.cts} +9 -8
  49. package/dist/{copy-UeUJVk8X.d.cts → copy-Bd__Pw5s.d.cts} +5 -4
  50. package/dist/{copy-DdVFDL01.d.ts → copy-NgKgOOET.d.ts} +5 -4
  51. package/dist/core/index.cjs +9 -9
  52. package/dist/core/index.d.cts +19 -17
  53. package/dist/core/index.d.ts +19 -17
  54. package/dist/core/index.js +9 -9
  55. package/dist/{depth-DvPwPuT_.d.ts → depth-CYPH92jE.d.ts} +6 -5
  56. package/dist/{depth-D5HwcvKC.d.cts → depth-CyjaJJ6V.d.cts} +6 -5
  57. package/dist/{entitlementRepository-B7egEdW6.d.ts → entitlementRepository-DdeFuEKp.d.ts} +4 -4
  58. package/dist/{entitlementRepository-BpJ7tiwl.d.cts → entitlementRepository-Dl1qRLcJ.d.cts} +4 -4
  59. package/dist/{identity-C2-08BZW.d.cts → identity-DjqhDm5Z.d.cts} +2 -2
  60. package/dist/{identity-CEi9GRFZ.d.ts → identity-Dy_L7Yq4.d.ts} +2 -2
  61. package/dist/index.cjs +6 -6
  62. package/dist/index.d.cts +19 -17
  63. package/dist/index.d.ts +19 -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/{pets-JVCXgRgR.d.cts → pets-BSG2qbr_.d.cts} +2 -2
  72. package/dist/{pets-DJv2sj2H.d.ts → pets-D7cZutrX.d.ts} +2 -2
  73. package/dist/{petsRepository-B_gKbAzJ.d.cts → petsRepository-D1bnxDZg.d.cts} +2 -2
  74. package/dist/{petsRepository-Bk6GDwLs.d.ts → petsRepository-DhsX3GLw.d.ts} +2 -2
  75. package/dist/photo/index.cjs +1 -1
  76. package/dist/photo/index.d.cts +3 -2
  77. package/dist/photo/index.d.ts +3 -2
  78. package/dist/photo/index.js +1 -1
  79. package/dist/{ports-D7YW8qz9.d.ts → ports-C0m1G1fS.d.ts} +13 -6
  80. package/dist/{ports-BY2ph0_y.d.cts → ports-DNXyyzZF.d.cts} +13 -6
  81. package/dist/records/depth/index.cjs +2 -2
  82. package/dist/records/depth/index.d.cts +11 -10
  83. package/dist/records/depth/index.d.ts +11 -10
  84. package/dist/records/depth/index.js +2 -2
  85. package/dist/records/index.cjs +3 -3
  86. package/dist/records/index.d.cts +25 -14
  87. package/dist/records/index.d.ts +25 -14
  88. package/dist/records/index.js +3 -3
  89. package/dist/{requestFunnel-BjDpqqvm.d.cts → requestFunnel-Bqc1inM9.d.cts} +5 -4
  90. package/dist/{requestFunnel-DFMGcluw.d.ts → requestFunnel-FvE5yLDD.d.ts} +5 -4
  91. package/dist/{runtimeTypes-w5KqBMcs.d.ts → runtimeTypes-C0yPBz89.d.ts} +7 -7
  92. package/dist/{runtimeTypes-gZEJu-da.d.cts → runtimeTypes-RN-VXTFV.d.cts} +7 -7
  93. package/dist/server/events/index.cjs +1 -1
  94. package/dist/server/events/index.d.cts +4 -3
  95. package/dist/server/events/index.d.ts +4 -3
  96. package/dist/server/events/index.js +1 -1
  97. package/dist/server/index.cjs +1 -1
  98. package/dist/server/index.d.cts +5 -4
  99. package/dist/server/index.d.ts +5 -4
  100. package/dist/server/index.js +1 -1
  101. package/dist/televet/booking/index.cjs +1 -1
  102. package/dist/televet/booking/index.d.cts +310 -32
  103. package/dist/televet/booking/index.d.ts +310 -32
  104. package/dist/televet/booking/index.js +1 -1
  105. package/dist/televet/call/index.cjs +1 -1
  106. package/dist/televet/call/index.d.cts +25 -5
  107. package/dist/televet/call/index.d.ts +25 -5
  108. package/dist/televet/call/index.js +1 -1
  109. package/dist/televet/index.cjs +1 -1
  110. package/dist/televet/index.d.cts +41 -71
  111. package/dist/televet/index.d.ts +41 -71
  112. package/dist/televet/index.js +1 -1
  113. package/dist/televetGlobal-CEk0_cW9.d.cts +34 -0
  114. package/dist/televetGlobal-Cs9Wbqsy.d.ts +34 -0
  115. package/dist/testing/index.cjs +3 -3
  116. package/dist/testing/index.d.cts +3 -2
  117. package/dist/testing/index.d.ts +3 -2
  118. package/dist/testing/index.js +3 -3
  119. package/dist/testing/rn/index.cjs +1 -1
  120. package/dist/testing/rn/index.d.cts +13 -11
  121. package/dist/testing/rn/index.d.ts +13 -11
  122. package/dist/testing/rn/index.js +1 -1
  123. package/dist/testing/web/index.cjs +1 -1
  124. package/dist/testing/web/index.d.cts +14 -13
  125. package/dist/testing/web/index.d.ts +14 -13
  126. package/dist/testing/web/index.js +1 -1
  127. package/dist/{timelineRows-C15jxFFH.d.ts → timelineRows-D4U6A8zE.d.ts} +1 -1
  128. package/dist/{timelineRows-odO8g9r2.d.cts → timelineRows-DAB5dpjF.d.cts} +1 -1
  129. package/dist/{branding-CsRdeNwK.d.cts → tokens-CIngRkvt.d.cts} +7 -211
  130. package/dist/{branding-CsRdeNwK.d.ts → tokens-CIngRkvt.d.ts} +7 -211
  131. package/dist/{typeStyle-DmoyacDG.d.ts → typeStyle-DHJzDaUo.d.cts} +2 -1
  132. package/dist/{typeStyle-CKqVYD6L.d.cts → typeStyle-YPS_MXeI.d.ts} +2 -1
  133. package/dist/{useRecordsDepth-crhBllQK.d.ts → useRecordsDepth--ObtMyjH.d.ts} +24 -5
  134. package/dist/{useRecordsDepth-C6rjEaLn.d.cts → useRecordsDepth-B35y8bV-.d.cts} +24 -5
  135. package/dist/{useVetVisit-CjmMa896.d.ts → useVetVisit-BsjoDO-n.d.ts} +21 -6
  136. package/dist/{useVetVisit-Bc84hWUU.d.cts → useVetVisit-Ds8f1peV.d.cts} +21 -6
  137. package/dist/video/index.cjs +1 -1
  138. package/dist/video/index.d.cts +3 -2
  139. package/dist/video/index.d.ts +3 -2
  140. package/dist/video/index.js +1 -1
  141. package/dist/{view-DyitEO0m.d.cts → view-B-Toym_j.d.cts} +5 -4
  142. package/dist/{view-Bxwxp4xD.d.ts → view-D9JqNQai.d.ts} +5 -4
  143. package/dist/web/consent/index.cjs +1 -1
  144. package/dist/web/consent/index.d.cts +9 -8
  145. package/dist/web/consent/index.d.ts +9 -8
  146. package/dist/web/consent/index.js +1 -1
  147. package/dist/web/index.cjs +10 -10
  148. package/dist/web/index.d.cts +42 -19
  149. package/dist/web/index.d.ts +42 -19
  150. package/dist/web/index.js +10 -10
  151. package/dist/web/notifications/index.cjs +2 -2
  152. package/dist/web/notifications/index.d.cts +7 -6
  153. package/dist/web/notifications/index.d.ts +7 -6
  154. package/dist/web/notifications/index.js +2 -2
  155. package/dist/web/records/depth/index.cjs +2 -2
  156. package/dist/web/records/depth/index.d.cts +11 -10
  157. package/dist/web/records/depth/index.d.ts +11 -10
  158. package/dist/web/records/depth/index.js +2 -2
  159. package/dist/web/records/index.cjs +3 -3
  160. package/dist/web/records/index.d.cts +53 -35
  161. package/dist/web/records/index.d.ts +53 -35
  162. package/dist/web/records/index.js +3 -3
  163. package/dist/web/televet/booking/index.cjs +2 -1
  164. package/dist/web/televet/booking/index.d.cts +458 -33
  165. package/dist/web/televet/booking/index.d.ts +458 -33
  166. package/dist/web/televet/booking/index.js +2 -1
  167. package/dist/web/televet/call/index.cjs +1 -1
  168. package/dist/web/televet/call/index.d.cts +3 -1
  169. package/dist/web/televet/call/index.d.ts +3 -1
  170. package/dist/web/televet/call/index.js +1 -1
  171. package/dist/web/televet/index.cjs +1 -1
  172. package/dist/web/televet/index.d.cts +40 -74
  173. package/dist/web/televet/index.d.ts +40 -74
  174. package/dist/web/televet/index.js +1 -1
  175. package/package.json +3 -2
  176. package/dist/callCopy-DoQKG3-L.d.cts +0 -40
  177. package/dist/callCopy-DoQKG3-L.d.ts +0 -40
@@ -1,2 +1,2 @@
1
- import {createContext,useMemo,useState,useRef,useCallback,useEffect,useContext,useSyncExternalStore,Component,createElement}from'react';import {z}from'zod';import {jsx,jsxs}from'react/jsx-runtime';var Tt=Object.defineProperty;var o=(e,r)=>Tt(e,"name",{value:r,configurable:true});function Ot(e,r){if(e===void 0)return {};let t={};return e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(t.borderColor=e.borderColor,t.borderWidth=r??1),e.borderRadius!==void 0&&(t.borderRadius=e.borderRadius),t}o(Ot,"slotBox");function U(e){return e?.textColor===void 0?{}:{color:e.textColor}}o(U,"slotText");function L(e,r){let t=Ot(e,r),n={};return t.backgroundColor!==void 0&&(n.backgroundColor=t.backgroundColor),t.borderColor!==void 0&&(n.border=`${t.borderWidth??1}px solid ${t.borderColor}`),t.borderRadius!==void 0&&(n.borderRadius=t.borderRadius),n}o(L,"slotBoxCss");function Xe(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(Xe,"reportHostFailure");function Pt(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(Pt,"isThenable");function Ft(e,...r){if(typeof e=="function")try{let t=e(...r);return Pt(t)&&Promise.resolve(t).then(void 0,Xe),t}catch(t){Xe(t);return}}o(Ft,"callHost");var Qe=new WeakMap;function Q(e){if(typeof e!="function")return;let r=Qe.get(e);if(r!==void 0)return r;let t=o((...n)=>{Ft(e,...n);},"guarded");return Qe.set(e,t),t}o(Q,"guardHost");function $(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}o($,"ok");function O(e){return Object.freeze({ok:false,error:e})}o(O,"err");var ie=class ie extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,ie.prototype);}};o(ie,"EverfurConfigError");var J=ie;var Je=Symbol.for("@everfur/sdk#EverfurContext@v1"),Ze=globalThis,er=Ze[Je]??(Ze[Je]=createContext(null));er.displayName??="EverfurContext";function M(){let e=useContext(er);if(e===null)throw new J("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(M,"useEverfurContext");var q=Object.freeze({loading:"Loading",empty:"No records yet",upload:"Upload records",consentRequired:"Consent required",allow:"Allow",sessionRequired:"Sign in required",recordUnavailable:"Record unavailable",retry:"Try again",records:"Records",beingReviewed:"being reviewed"});var zt="your pet";function A(e){let r=e?.trim()??"";return r.length>0?r:zt}o(A,"petNameOr");var rr=Object.freeze({title:"Health records",openTimeline:"Open timeline",loading:"Loading health records",lead:o(e=>`${A(e)}\u2019s lab trends`,"lead"),retryMarkers:"Retry loading lab trends",viewFullRecord:"View full medical record",viewTimeline:"View full timeline",important:o(e=>`Important: ${e}`,"important")});Object.freeze({title:"Marker Summary",marker:"Marker",markers:"Markers",outOfRange:"OUT OF RANGE",inRange:"IN RANGE",noRange:"NO RANGE",subtitle:"Summary of your pet\u2019s biomarkers",ask:"Ask about these markers",askA11y:"Ask Everfur about these markers",a11y:o((e,r,t,n)=>`Marker summary: ${e} ${e===1?"marker":"markers"}, ${r} in range, ${t} out of range${n>0?`, ${n} without a range`:""}.`,"a11y")});Object.freeze({counter:o((e,r)=>`${e+1} of ${r}`,"counter"),a11y:o((e,r,t)=>e!==null?`${e}, marker ${r+1} of ${t}. Swipe left or right to see more markers.`:`Marker ${r+1} of ${t}`,"a11y")});Object.freeze({tapHint:"Tap a point to see where it came from.",singleHint:"One reading so far: we\u2019ll plot a trend as more come in.",empty:"No readings for this marker yet.",ask:"Ask about this marker",askA11y:o(e=>`Ask Everfur about ${e}`,"askA11y"),status:o(e=>`Status: ${e}`,"status"),latestA11y:o((e,r,t)=>`Latest reading ${e}, ${r}, collected ${t}`,"latestA11y"),readingsA11y:o(e=>`${e} readings, oldest to newest`,"readingsA11y")});Object.freeze({title:o(e=>`${A(e)}\u2019s records request`,"title"),body:o(e=>`We\u2019re requesting ${A(e)}\u2019s records from your vet. This usually takes a few days; we\u2019ll show lab trends here as soon as they arrive.`,"body"),a11y:o(e=>`Records request in progress for ${A(e)}.`,"a11y"),openA11y:o((e,r)=>`Open ${A(e)}\u2019s records request. ${r}`,"openA11y"),ask:"Ask about this request",askA11y:"Ask Everfur about this records request"});Object.freeze({title:o(e=>`Add ${A(e)}\u2019s records`,"title"),body:"Records can come from more than one clinic over a lifetime.",requestFromClinic:"Request from a clinic",requestFromClinicA11y:o(e=>`Request ${A(e)}\u2019s records from a clinic`,"requestFromClinicA11y"),uploadDocument:"Upload a document",uploadDocumentA11y:o(e=>`Upload one of ${A(e)}\u2019s records`,"uploadDocumentA11y")});function tr(e){return e?.httpStatus===429?"rate_limited":e?.httpStatus===502?"service_unavailable":"error"}o(tr,"recordsEmptyVariantForError");function or(e,r){return e===null?"":r?`${e} ${r}`:e}o(or,"formatEntityValue");var nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function w(e){if(!e)return "-";let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(r!==null){let i=nr[Number(r[2])-1];return i===void 0?"-":`${i} ${Number(r[3])}, ${r[1]}`}let t=Date.parse(e);if(Number.isNaN(t))return "-";let n=new Date(t);return `${nr[n.getUTCMonth()]} ${n.getUTCDate()}, ${n.getUTCFullYear()}`}o(w,"formatRecordsDate");var h=Object.freeze({timeline:"Timeline",loadingTimeline:"Loading timeline",labResults:"Blood & lab work",visits:"Visits",physicalExams:"Physical exams",visitNotes:"Visit notes",visit:"Visit",exam:"Exam",visitNote:"Visit note",notRecorded:"Not recorded",abnormal:"Abnormal",notExamined:"Not examined",normal:"Normal",measured:o(e=>`Measured ${e}`,"measured"),uploadedDocument:"Uploaded document",kind:Object.freeze({visit:"Visit",vaccine:"Vaccine",weight:"Weight",medication:"Medication"}),clinicVisit:"Clinic visit",doctor:o(e=>`Dr. ${e}`,"doctor"),lot:o(e=>`Lot ${e}`,"lot"),expires:o(e=>`Expires ${e}`,"expires")});function sr(e){switch(e){case "above":return {label:"Above range",outOfRange:true};case "below":return {label:"Below range",outOfRange:true};case "in_range":return {label:"In range",outOfRange:false};default:return {label:"No range on file",outOfRange:false}}}o(sr,"markerStatusLabel");function At(e,r){return r<2?null:`${e==="flat"?"Holding steady":`Trending ${e==="down"?"down":e==="up"?"up":"steady"}`} over ${r} visits`}o(At,"trajectoryLabel");function ae(e){let r=e.replace(/_/g," ").trim();return r.length===0?e:r.charAt(0).toUpperCase()+r.slice(1)}o(ae,"humanize");var ir=Object.freeze({general:"General / attitude",eent:"Eyes, ears, nose & throat",oral_dental:"Oral & dental",cardiovascular:"Cardiovascular",respiratory:"Respiratory",gastrointestinal:"GI / abdomen",urogenital:"Urogenital",musculoskeletal:"Musculoskeletal",neurologic:"Neurologic",integument:"Skin & coat",lymphatic:"Lymph nodes"});function lr(e){return Object.prototype.hasOwnProperty.call(ir,e)?ir[e]:ae(e)}o(lr,"bodySystemLabel");var ar=Object.freeze({reason_for_visit:"Reason for visit",subjective:"Subjective",objective:"Objective",assessment:"Assessment",plan:"Plan",discharge_instructions:"Discharge instructions",follow_up:"Follow-up",remarks:"Notes"});function dr(e){return Object.prototype.hasOwnProperty.call(ar,e)?ar[e]:ae(e)}o(dr,"soapSectionLabel");function ur(e){return e===null||!Number.isFinite(e)?"-":`${e.toFixed(3).replace(/\.?0+$/,"")} kg`}o(ur,"formatWeightKg");function cr(e,r,t){if((e===null||!Number.isFinite(e))&&t)return t;if(e===null||!Number.isFinite(e))return "-";let n=e.toFixed(3).replace(/\.?0+$/,"");return r?`${n} ${r}`:n}o(cr,"formatMarkerReading");function pr(e,r,t){let n=At(r,t);return e?`${h.measured(w(e))}${n?` \xB7 ${n}`:""}`:n}o(pr,"labDetailLine");var se=Object.freeze({visit:0,vaccine:1,weight:2,medication:3});function fr(e){if(!e)return null;let r=Date.parse(e);return Number.isNaN(r)?null:r}o(fr,"toMillis");function Re(e){let r=[...e.visits.map((t,n)=>({key:`visit-${n}-${t.visitId}`,kind:"visit",kindLabel:h.kind.visit,at:t.visitDate,date:w(t.visitDate),title:t.summary??h.clinicVisit,detail:t.veterinarian?h.doctor(t.veterinarian):null,docId:t.docId})),...e.vaccines.map((t,n)=>{let i=[];return t.lot&&i.push(h.lot(t.lot)),t.expiresOn&&i.push(h.expires(w(t.expiresOn))),{key:`vaccine-${n}-${t.vaccineId}`,kind:"vaccine",kindLabel:h.kind.vaccine,at:t.administeredOn,date:w(t.administeredOn),title:t.product||h.kind.vaccine,detail:i.length?i.join(" \xB7 "):null,docId:t.docId}}),...e.weights.map((t,n)=>({key:`weight-${n}-${t.weightId}`,kind:"weight",kindLabel:h.kind.weight,at:t.observedOn,date:w(t.observedOn),title:ur(t.weightKg),detail:null,docId:t.docId})),...e.medications.map((t,n)=>{let i=[t.dose,t.route,t.frequency].filter(s=>!!s);return {key:`medication-${n}-${t.medicationId}`,kind:"medication",kindLabel:h.kind.medication,at:t.startedOn,date:w(t.startedOn),title:t.drugName||h.kind.medication,detail:i.length?i.join(" \xB7 "):null,docId:t.docId}})];return Object.freeze(r.sort((t,n)=>{let i=fr(t.at),s=fr(n.at);return i===null&&s===null?se[t.kind]-se[n.kind]:i===null?1:s===null?-1:s!==i?s-i:se[t.kind]-se[n.kind]}))}o(Re,"buildTimelineRows");var _e=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(_e.map(e=>e.wireCode));var jt=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"}),yr=Object.freeze(_e.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:jt[e.wireCode]}))),Nt=new Map(yr.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Lt=Object.freeze(["http_envelope",...[...new Set(yr.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function le(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let n of [r??"http_envelope",...Lt]){let i=Nt.get(n+t);if(i)return i}}o(le,"contractErrorFor");function Mt(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Mt,"contractDocUrl");function gr(e){return null}o(gr,"publishedDocUrl");var qt=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 br(e){return qt[e]}o(br,"categoryFor");function hr(e){let r=le(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),n=t.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(t.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"}}o(hr,"fromWire");var Bt=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Ee(e){return Bt.has(e)}o(Ee,"isAutoRetryable");var Ut=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function vr(e){return Ee(e)||Ut.has(e)}o(vr,"isRetryableCode");var $t=500,xe=8e3,Rr=4;function _r(e,r=Math.random){let t=Math.max(0,e),n=Math.min($t*2**t,xe);return Math.floor(r()*n)}o(_r,"backoffDelayMs");var Ht=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 Ce(e){return Ht[e]}o(Ce,"userFacingError");function Er(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}o(Er,"defineHidden");var Vt=/^[a-z][a-z0-9_]{0,63}$/;function j(e,r){let t=le(r?.wireCode,r?.wireEnvelope),n={code:e,category:br(e),retryable:r?.retryable??vr(e),displayMessage:Ce(e)};if(r?.httpStatus!==void 0&&(n.httpStatus=r.httpStatus),r?.requestId&&(n.requestId=r.requestId),typeof r?.reasonCode=="string"&&Vt.test(r.reasonCode)&&(n.reasonCode=r.reasonCode),t);return r?.wireMessage&&Er(n,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&Er(n,"raw",r.raw),Object.freeze(n)}o(j,"makeEverfurError");function xr(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(xr,"assertNever");function Cr(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})}o(Cr,"errorFrame");function Kt(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}o(Kt,"authHeaders");function Z(e,r){return {...e,headers:{...Gt(e.headers),...Kt(r)}}}o(Z,"withAuthHeaders");function Gt(e){if(!e)return {};let r={};for(let[t,n]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=n);}return r}o(Gt,"stripAuthHeaders");async function Sr(e,r){if(r.mode==="anonymous")return r.transport.request(Z(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return O(Se())}let n=await r.transport.request(Z(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return O(Se())}let s=await r.transport.request(Z(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?O(Se(s.error.httpStatus)):s}o(Sr,"authedSend");function Se(e){return j("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(Se,"authRejectedError");function wr(e){return j("internalError",{retryable:true,wireMessage:Xt(e)})}o(wr,"networkError");function Xt(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(Xt,"describeCause");var Qt=3e4,Jt=xe*2,Zt="idempotency-key",en=new Set(["POST","PUT","PATCH","DELETE"]),rn=Object.freeze({onEvent(){}}),tn=Object.freeze({setTimeout:o((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function nn(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}o(nn,"seededIdempotencyKey");function Tr(e){let r=e.observer??rn,t=e.timers??tn,n=e.rng??Math.random,i=e.sleep??((g,b)=>bn(g,t,b)),s=e.maxAttempts??Rr,c=e.unaryTimeoutMs??Qt,d=e.newIdempotencyKey??an(),a=o(g=>{try{r.onEvent(g);}catch{}},"emit");async function u(g,b,E){let k=E?.maxAttempts,B=Math.max(1,k??s),ye=E?.idempotent??en.has(b.method),K=E?.idempotencyKey===void 0?null:nn(E.idempotencyKey),ge=ye?K??d():null,kt=on(b,ge),be=0;for(;;){let G=o(ve=>Object.freeze({call:g,method:b.method,path:b.path,attempt:be,...ge?{idempotencyKey:ge}:{},...ve}),"stamp");a(G({phase:"attempt"}));let Ke=yn(c,t),Ge=gn(Ke.signal,b.signal),X;try{X=await Sr({...kt,signal:Ge.signal},e.auth);}catch(ve){X=O(wr(ve));}finally{Ge.dispose(),Ke.cancel();}if(X.ok)return a(G({phase:"settled",ok:true,reason:"ok"})),X;let z=X.error,oe=ln(z,be,{maxAttempts:B,rng:n,now:t.now(),aborted:b.signal?.aborted===true,...k!==void 0?{perCallMaxAttempts:k}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),he={ok:false,code:z.code,reason:oe.reason,...z.httpStatus!==void 0?{httpStatus:z.httpStatus}:{},...z.requestId!==void 0?{requestId:z.requestId}:{}};if(!oe.retry)return a(G({phase:"settled",...he})),O(z);if(a(G({phase:"retry",...he,delayMs:oe.delayMs})),await i(oe.delayMs,b.signal),b.signal?.aborted===true)return a(G({phase:"settled",...he,reason:"aborted"})),O(z);be+=1;}}o(u,"send");async function f(g){return Z(g,await mn(e.auth))}o(f,"authorize");async function*v(g,b,E){a(Object.freeze({call:g,phase:"stream.open",method:b.method,path:b.path,attempt:0}));try{yield*e.auth.transport.stream(b,E);}catch{yield Cr({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(v,"stream"),Object.freeze({send:u,authorize:f,stream:v})}o(Tr,"createRequestFunnel");function on(e,r){let t={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==Zt&&(t[n]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}o(on,"assembleHeaders");function an(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(an,"defaultIdempotencyKeyFactory");var sn=10;function ln(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let n=dn(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!Ee(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let c=o(()=>{if(t.policy===void 0)return null;let u;try{u=t.policy.maxAttempts(e.code);}catch{return null}return typeof u!="number"||!Number.isFinite(u)?null:Math.max(1,Math.min(sn,Math.floor(u)))},"policyCeiling"),d=t.perCallMaxAttempts??c()??t.maxAttempts;if(r+1>=d)return {retry:false,reason:"attempts-exhausted"};let a=un(e,t.now);return a!==null?a>Jt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:a}:{retry:true,reason:i,delayMs:_r(r,t.rng)}}o(ln,"decideRetry");function dn(e){let r=e.code==="unknown"?hr(fn(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}o(dn,"throttleKind");function un(e,r){let t=cn(e.raw);if(t===null)return null;let n=t-r;return n>0?n:0}o(un,"retryOverrideMs");function cn(e){for(let r of Or(e)){let t=r.resets_at,n=pn(t);if(n!==null)return n}return null}o(cn,"findResetsAt");function Or(e){if(!kr(e))return [];let r=[e];for(let t of ["error","detail"]){let n=e[t];kr(n)&&r.push(n);}return r}o(Or,"candidateScopes");function pn(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 r=Date.parse(e);return Number.isFinite(r)?r:null}return null}o(pn,"parseInstantMs");function fn(e){for(let r of Or(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}o(fn,"rawWireCode");function kr(e){return typeof e=="object"&&e!==null}o(kr,"isRecord");async function mn(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}:{}}}o(mn,"resolveDeviceAuth");function yn(e,r){let t=new AbortController,n=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:o(()=>r.clearTimeout(n),"cancel")}}o(yn,"boundedSignal");function gn(e,r){let t=o(()=>{},"noop");if(!r)return {signal:e,dispose:t};let n=new AbortController;if(e.aborted||r.aborted)return n.abort(),{signal:n.signal,dispose:t};let i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}o(gn,"mergeSignals");function bn(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(n=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",s),n();},e),s=o(()=>{r.clearTimeout(i),n();},"onAbort");t?.addEventListener("abort",s,{once:true});})}o(bn,"delayAbortable");function Pr(e){for(let r=0;r<e.length;r+=1){let t=e.charCodeAt(r);if(t>=55296&&t<=56319){let n=e.charCodeAt(r+1);if(!(n>=56320&&n<=57343))return true;r+=1;}else if(t>=56320&&t<=57343)return true}return false}o(Pr,"hasLoneSurrogate");var Fr=64,Dr=512;function vn(e){return e==="owner_reported"||e==="clinic_document"?e:null}o(vn,"normalizeOrigin");z.object({request_id:z.string().min(1),pet_ref:z.string().min(1),status:z.string(),simple_status:z.string().nullish(),simple_status_detail:z.string().nullish(),status_label:z.string().optional(),dispatch_status:z.string().nullish(),can_retry_send:z.boolean().optional(),can_revoke:z.boolean().optional(),can_convert_to_upload:z.boolean().optional(),can_update_clinic_email:z.boolean().optional(),reminder_count:z.number().int().nonnegative().optional(),last_reminder_at:z.string().nullish(),waiting_expectation:z.string().nullish(),document_count:z.number().optional(),held_item_count:z.number().optional(),received_at:z.string().nullish(),parsing_started_at:z.string().nullish(),review_started_at:z.string().nullish(),created_at:z.string().optional(),updated_at:z.string().optional(),source:z.string().nullish().catch(null),action_needed_label:z.string().nullish().catch(null),failure_reason:z.string().nullish().catch(null),failure_code:z.string().nullish().catch(null),recovery_stage:z.string().nullish().catch(null),show_clinic_phone:z.boolean().optional().catch(void 0),clinic_name:z.string().nullish().catch(null),clinic_email:z.string().nullish().catch(null),clinic_phone:z.string().nullish().catch(null),converted_to_upload_at:z.string().nullish().catch(null),request_group_id:z.string().nullish().catch(null)}).passthrough();z.object({request_group_id:z.string().min(1),pet_ref:z.string().min(1),total:z.number().int().nonnegative(),responded:z.number().int().nonnegative(),pending:z.number().int().nonnegative(),members:z.array(z.unknown())});z.object({source_doc_id:z.string().min(1),request_id:z.string().min(1)});var Rn=z.object({label:z.string(),value:z.string()}),we=z.object({key:z.string(),category:z.string().optional(),label:z.string().optional(),value:z.string().nullish(),unit:z.string().nullish(),observed_at:z.string().nullish(),status:z.string().nullish(),origin:z.string().nullish(),canonical_key:z.string().nullish()}),_n=z.object({at:z.string(),value:z.number().nullish(),display:z.string().nullish(),origin:z.string().nullish()}),En=z.object({key:z.string(),label:z.string().optional(),points:z.array(_n).optional()}),xn=z.object({title:z.string(),detail:z.string().nullish(),due_at:z.string().nullish()}),ke=z.object({doc_id:z.string(),title:z.string().nullish(),page_count:z.number().nullish(),received_at:z.string().nullish()});function Ir(e){return Object.freeze({key:e.key,category:e.category??"",label:e.label??e.key,value:e.value??null,unit:e.unit??null,observedAt:e.observed_at??null,status:e.status??null,origin:vn(e.origin),canonicalKey:e.canonical_key??null})}o(Ir,"mapEntityRow");function zr(e){return Object.freeze({docId:e.doc_id,title:e.title??null,pageCount:e.page_count??null,receivedAt:e.received_at??null})}o(zr,"mapDocumentRow");z.object({identity:z.array(Rn).optional(),entities:z.array(we).optional(),entity_series:z.array(En).optional(),forward_looking:z.array(xn).optional(),documents:z.array(ke).optional()});z.object({pet_ref:z.string().optional(),granted:z.boolean().optional(),version:z.string().nullish(),granted_at:z.string().nullish()});var R=z.string().nullish(),de=z.number().nullish(),Cn=z.object({collected_at:R,at:R,value:de,unit:R,qualitative_result:R,ref_low:de,ref_high:de,status:R,source_clinic:R,source_doc_id:R,doc_id:R,reviewed:z.boolean().nullish()}),Sn=z.object({collected_at:R,at:R,value:de,unit:R,qualitative_result:R,status:R}),wn=z.object({marker_id:z.string().min(1),canonical_name:R,name:R,loinc_code:R,canonical_unit:R,unit:R,panel_name:R,panel:R,meaning_text:R,meaning:R,latest:Sn.nullish(),trajectory:R,points:z.array(Cn).optional()}),kn=z.object({total_markers:z.number().int().nonnegative(),in_range_count:z.number().int().nonnegative(),out_of_range_count:z.number().int().nonnegative(),unknown_count:z.number().int().nonnegative()}),Tn=z.object({markers:z.array(wn).optional(),summary:kn.nullish(),disclaimer:z.string().optional(),featured_marker_id:R});function On(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(On,"isObject");function Ar(e){return Object.freeze({petRef:e,withheld:true,markers:Object.freeze([]),summary:null,disclaimer:"",featuredMarkerId:null})}o(Ar,"withheldMarkers");function jr(e,r){let t=On(r)?r:{},n=typeof t.pet_ref=="string"&&t.pet_ref.length>0?t.pet_ref:e;if(t.withheld===true)return Ar(n);let i=Tn.safeParse(t);if(!i.success)return Ar(n);let s=i.data,c=o(a=>Object.freeze({at:a.collected_at??a.at??null,value:a.value??null,unit:a.unit??null,qualitativeResult:a.qualitative_result??null,refLow:a.ref_low??null,refHigh:a.ref_high??null,status:a.status??null,sourceClinic:a.source_clinic??null,docId:a.source_doc_id??a.doc_id??null,reviewed:a.reviewed===true}),"point"),d=(s.markers??[]).map(a=>Object.freeze({markerId:a.marker_id,name:a.canonical_name??a.name??a.marker_id,loincCode:a.loinc_code??null,unit:a.canonical_unit??a.unit??null,panel:a.panel_name??a.panel??null,meaning:a.meaning_text??a.meaning??null,latest:a.latest?Object.freeze({at:a.latest.collected_at??a.latest.at??null,value:a.latest.value??null,unit:a.latest.unit??null,qualitativeResult:a.latest.qualitative_result??null,status:a.latest.status??null}):null,trajectory:a.trajectory??null,points:Object.freeze((a.points??[]).map(c))}));return Object.freeze({petRef:n,withheld:false,markers:Object.freeze(d),summary:s.summary?Object.freeze({totalMarkers:s.summary.total_markers,inRangeCount:s.summary.in_range_count,outOfRangeCount:s.summary.out_of_range_count,unknownCount:s.summary.unknown_count}):null,disclaimer:s.disclaimer??"",featuredMarkerId:s.featured_marker_id??null})}o(jr,"mapRecordMarkers");var Nr=128,N=128;var Pn=z.string().min(1).refine(e=>e.startsWith("https://")),Fn=z.object({source_doc_id:z.string().min(1),file_name:z.string().nullish(),doc_format:z.string().nullish(),byte_size:z.number().int().nonnegative().nullish(),received_at:z.string().nullish(),download_url:Pn,expires_in_seconds:z.number().int().nonnegative().nullish()}),Dn=z.object({items:z.array(z.unknown()).optional()});function Lr(e){let r=Dn.safeParse(e);if(!r.success)return null;let t=[];for(let n of r.data.items??[]){let i=Fn.safeParse(n);i.success&&t.push(Object.freeze({sourceDocId:i.data.source_doc_id,fileName:i.data.file_name??null,docFormat:i.data.doc_format??null,byteSize:i.data.byte_size??null,receivedAt:i.data.received_at??null,downloadUrl:i.data.download_url,expiresInSeconds:i.data.expires_in_seconds??0}));}return Object.freeze(t)}o(Lr,"mapRequestDocuments");var In=z.string().min(1).refine(e=>e.startsWith("https://")),ee=z.string().nullish(),zn=z.object({share_id:z.string().min(1),share_url:z.string().min(1),expires_at:ee}),An=z.object({shares:z.array(z.object({share_id:z.string().min(1),expires_at:ee,created_at:ee,view_count:z.number().int().nonnegative().nullish(),last_viewed_at:ee})).optional()}),jn=z.object({download_url:In,expires_at:ee});function Nn(e,r){let t=e.trim();if(t.length===0)return null;try{let n=/^[a-z][a-z0-9+.-]*:/i.test(t)?new URL(t):r!==void 0?new URL(t,r):null;return n===null||n.protocol!=="https:"?null:n.toString()}catch{return null}}o(Nn,"resolveShareUrl");function Mr(e,r){let t=zn.safeParse(e);if(!t.success)return null;let n=Nn(t.data.share_url,r);return n===null?null:Object.freeze({shareId:t.data.share_id,shareUrl:n,expiresAt:t.data.expires_at??null})}o(Mr,"mapRecordShareLink");function qr(e){let r=An.safeParse(e);return r.success?Object.freeze((r.data.shares??[]).map(t=>Object.freeze({shareId:t.share_id,expiresAt:t.expires_at??null,createdAt:t.created_at??null,viewCount:t.view_count??0,lastViewedAt:t.last_viewed_at??null}))):null}o(qr,"mapRecordShareList");function Br(e){let r=jn.safeParse(e);return r.success?Object.freeze({downloadUrl:r.data.download_url,expiresAt:r.data.expires_at??null}):null}o(Br,"mapRecordPdfLink");var Ln=z.object({signatures:z.array(z.object({signature_id:z.string().min(1),preview_url:z.string().min(1).refine(e=>e.startsWith("https://")),created_at:z.string().nullish()})).optional()});function Ur(e){let r=Ln.safeParse(e);return r.success?Object.freeze((r.data.signatures??[]).map(t=>Object.freeze({signatureId:t.signature_id,previewUrl:t.preview_url,createdAt:t.created_at??null}))):null}o(Ur,"mapSignatureSuggestions");var y=z.string().nullish(),re=z.number().nullish(),Mn=z.object({at:y,value:re,unit:y,qualitative_result:y,ref_low:re,ref_high:re,status:y,doc_id:y}),qn=z.object({marker_id:z.string(),name:z.string(),loinc_code:y,unit:y,panel:y,meaning:y,latest:z.object({at:y,value:re,unit:y,qualitative_result:y,status:y}).nullish(),trajectory:y,points:z.array(Mn).optional()}),Bn=z.object({encounter_id:z.string(),date:y,type:y,clinic_name:y,veterinarian:y,doc_id:y}),Un=z.object({note_id:z.string(),encounter_id:y,observed_on:y,sections:z.array(z.object({section:z.string(),text:z.string()})).optional()}),$n=z.object({exam_id:z.string(),encounter_id:y,observed_on:y,doc_id:y,systems:z.record(z.object({finding_status:y,finding:y})).optional()}),Hn=z.object({has_lab_history:z.boolean().optional(),has_vaccination_history:z.boolean().optional(),has_weight_history:z.boolean().optional(),has_vitals_history:z.boolean().optional(),has_physical_exam_history:z.boolean().optional(),has_procedure_history:z.boolean().optional(),has_genetic_history:z.boolean().optional(),has_reproductive_history:z.boolean().optional(),has_parasite_prevention_history:z.boolean().optional(),earliest_record_at:y,latest_record_at:y,documents_ingested:z.number().int().nonnegative().optional(),documents_in_review:z.number().int().nonnegative().optional(),entities_pending_review:z.record(z.number().int().nonnegative()).optional(),held_total:z.number().int().nonnegative().optional()}),Vn=z.object({conflict_id:z.string(),entity_type:z.string(),field:y,severity:y,candidates:z.array(z.object({value:z.string(),source_doc_id:y,doc_id:y,collected_at:y})).optional()}),Wn=z.object({lab_results:z.array(qn).optional(),encounters:z.array(Bn).optional(),clinician_notes:z.array(Un).optional(),physical_exams:z.array($n).optional(),completeness:Hn.nullish(),conflicts:z.array(Vn).optional()}),Yn=z.object({visits:z.array(z.object({visit_id:z.string(),visit_date:y,veterinarian:y,summary:y,doc_id:y})),vaccines:z.array(z.object({vaccine_id:z.string(),product:y,lot:y,administered_on:y,expires_on:y,doc_id:y})),weights:z.array(z.object({weight_id:z.string(),observed_on:y,weight_kg:re,doc_id:y})),medications:z.array(z.object({medication_id:z.string(),drug_name:y,dose:y,route:y,frequency:y,sig:y,rx_number:y,started_on:y,stopped_on:y,doc_id:y})),disclaimer:z.string().optional()}),Kn=z.object({document:ke,contributions:z.array(we),contribution_count:z.number().int().nonnegative().optional()});function Oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Oe,"isObject");function Pe(e,r){return typeof e.pet_ref=="string"&&e.pet_ref.length>0?e.pet_ref:r}o(Pe,"petOf");function Te(e,r){return Object.freeze({petRef:e,available:false,withheld:r,labResults:Object.freeze([]),encounters:Object.freeze([]),clinicianNotes:Object.freeze([]),physicalExams:Object.freeze([]),completeness:null,conflicts:Object.freeze([])})}o(Te,"emptyDepth");function Hr(e,r){let t=Oe(r)?r:{},n=Pe(t,e);if(t.withheld===true)return Te(n,true);if(!["lab_results","encounters","clinician_notes","physical_exams","completeness","conflicts"].some(a=>a in t))return Te(n,false);let s=Wn.safeParse(t);if(!s.success)return Te(n,true);let c=s.data,d=o(a=>Object.freeze({at:a.at??null,value:a.value??null,unit:a.unit??null,qualitativeResult:a.qualitative_result??null,refLow:a.ref_low??null,refHigh:a.ref_high??null,status:a.status??null,docId:a.doc_id??null}),"point");return Object.freeze({petRef:n,available:true,withheld:false,labResults:Object.freeze((c.lab_results??[]).map(a=>Object.freeze({markerId:a.marker_id,name:a.name,loincCode:a.loinc_code??null,unit:a.unit??null,panel:a.panel??null,meaning:a.meaning??null,latest:Object.freeze({at:a.latest?.at??null,value:a.latest?.value??null,unit:a.latest?.unit??null,qualitativeResult:a.latest?.qualitative_result??null,status:a.latest?.status??null}),trajectory:a.trajectory??null,points:Object.freeze((a.points??[]).map(d))}))),encounters:Object.freeze((c.encounters??[]).map(a=>Object.freeze({encounterId:a.encounter_id,date:a.date??null,type:a.type??null,clinicName:a.clinic_name??null,veterinarian:a.veterinarian??null,docId:a.doc_id??null}))),clinicianNotes:Object.freeze((c.clinician_notes??[]).map(a=>Object.freeze({noteId:a.note_id,encounterId:a.encounter_id??null,observedOn:a.observed_on??null,sections:Object.freeze((a.sections??[]).map(u=>Object.freeze({section:u.section,text:u.text})))}))),physicalExams:Object.freeze((c.physical_exams??[]).map(a=>Object.freeze({examId:a.exam_id,encounterId:a.encounter_id??null,observedOn:a.observed_on??null,docId:a.doc_id??null,systems:Object.freeze(Object.entries(a.systems??{}).map(([u,f])=>Object.freeze({system:u,findingStatus:f.finding_status??null,finding:f.finding??null})))}))),completeness:c.completeness?Object.freeze({hasLabHistory:c.completeness.has_lab_history===true,hasVaccinationHistory:c.completeness.has_vaccination_history===true,hasWeightHistory:c.completeness.has_weight_history===true,hasVitalsHistory:c.completeness.has_vitals_history===true,hasPhysicalExamHistory:c.completeness.has_physical_exam_history===true,hasProcedureHistory:c.completeness.has_procedure_history===true,hasGeneticHistory:c.completeness.has_genetic_history===true,hasReproductiveHistory:c.completeness.has_reproductive_history===true,hasParasitePreventionHistory:c.completeness.has_parasite_prevention_history===true,earliestRecordAt:c.completeness.earliest_record_at??null,latestRecordAt:c.completeness.latest_record_at??null,documentsIngested:c.completeness.documents_ingested??0,documentsInReview:c.completeness.documents_in_review??0,entitiesPendingReview:Object.freeze({...c.completeness.entities_pending_review??{}}),heldTotal:c.completeness.held_total??0}):null,conflicts:Object.freeze((c.conflicts??[]).map(a=>Object.freeze({conflictId:a.conflict_id,entityType:a.entity_type,field:a.field??null,severity:a.severity??"needs_review",candidates:Object.freeze((a.candidates??[]).map(u=>Object.freeze({value:u.value,docId:u.source_doc_id??u.doc_id??null,collectedAt:u.collected_at??null})))})))})}o(Hr,"mapRecordDepth");function $r(e){return Object.freeze({petRef:e,withheld:true,isEmpty:false,visits:Object.freeze([]),vaccines:Object.freeze([]),weights:Object.freeze([]),medications:Object.freeze([]),disclaimer:""})}o($r,"withheldTimeline");function Vr(e,r){let t=Oe(r)?r:{},n=Pe(t,e);if(t.withheld===true)return $r(n);let i=Yn.safeParse(t);if(!i.success)return $r(n);let s=i.data,c=s.visits.map(f=>Object.freeze({visitId:f.visit_id,visitDate:f.visit_date??null,veterinarian:f.veterinarian??null,summary:f.summary??null,docId:f.doc_id??null})),d=s.vaccines.map(f=>Object.freeze({vaccineId:f.vaccine_id,product:f.product??null,lot:f.lot??null,administeredOn:f.administered_on??null,expiresOn:f.expires_on??null,docId:f.doc_id??null})),a=s.weights.map(f=>Object.freeze({weightId:f.weight_id,observedOn:f.observed_on??null,weightKg:f.weight_kg??null,docId:f.doc_id??null})),u=s.medications.map(f=>Object.freeze({medicationId:f.medication_id,drugName:f.drug_name??null,dose:f.dose??null,route:f.route??null,frequency:f.frequency??null,sig:f.sig??null,rxNumber:f.rx_number??null,startedOn:f.started_on??null,stoppedOn:f.stopped_on??null,docId:f.doc_id??null}));return Object.freeze({petRef:n,withheld:false,isEmpty:c.length===0&&d.length===0&&a.length===0&&u.length===0,visits:Object.freeze(c),vaccines:Object.freeze(d),weights:Object.freeze(a),medications:Object.freeze(u),disclaimer:s.disclaimer??""})}o(Vr,"mapRecordsTimeline");function Wr(e,r){let t=Oe(r)?r:{},n=Pe(t,e),i=o(()=>Object.freeze({petRef:n,withheld:true,document:null,contributions:Object.freeze([]),contributionCount:0}),"withheld");if(t.withheld===true)return i();let s=Kn.safeParse(t);if(!s.success)return i();let c=Object.freeze(s.data.contributions.map(Ir));return Object.freeze({petRef:n,withheld:false,document:zr(s.data.document),contributions:c,contributionCount:s.data.contribution_count??c.length})}o(Wr,"mapDocumentContributions");var Gn="/widget/v1/records/pets";function Yr(e){let r=e.funnel??Tr({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=o((a,u)=>typeof a=="string"&&a.length>0&&!Pr(a)&&[...a].length<=u,"segment"),n=o(async(a,u,f,v)=>{if(!t(u,N))return I();let g=await r.send(a,{method:"GET",path:f});if(!g.ok)return g;let b=v(g.value);return b.petRef===u?$(b):O(j("internalError",{retryable:false}))},"read"),i=o(a=>`${Gn}/${encodeURIComponent(a)}`,"pet"),s=o(a=>`${i(a)}/everfur_record`,"record"),c=o(async(a,u,f)=>{let v=await r.send(a,u,u.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!v.ok)return v;let g=f(v.value);return g===null?O(j("internalError",{retryable:false})):$(g)},"parsed"),d=o((a,u)=>!t(a.entityType,Fr)||!t(a.canonicalKey,Dr)||a.idempotencyKey!==void 0&&!t(a.idempotencyKey,Nr)||u!==void 0&&Object.keys(u).length===0?null:{entity_type:a.entityType,canonical_key:a.canonicalKey,...u!==void 0?{corrected_fields:u}:{},...a.idempotencyKey!==void 0?{idempotency_key:a.idempotencyKey}:{}},"factBody");return {getRecordDepth:o(a=>n("records.depth.record",a,`${i(a)}/record`,u=>Hr(a,u)),"getRecordDepth"),getTimeline:o(a=>n("records.depth.timeline",a,`${i(a)}/timeline`,u=>Vr(a,u)),"getTimeline"),getDocumentContributions(a,u){return t(u,64)?n("records.depth.contributions",a,`${i(a)}/documents/${encodeURIComponent(u)}/contributions`,f=>Wr(a,f)):I()},getMarkers:o(a=>n("records.depth.markers",a,`${i(a)}/markers`,u=>jr(a,u)),"getMarkers"),createShare(a){return t(a,N)?c("records.share.create",{method:"POST",path:`${s(a)}/share`},u=>Mr(u,e.apiBaseUrl)):I()},listShares(a){return t(a,N)?c("records.share.list",{method:"GET",path:`${s(a)}/shares`},qr):I()},async revokeShare(a,u){if(!t(a,N)||!t(u,64))return I();let f=await r.send("records.share.revoke",{method:"DELETE",path:`${s(a)}/shares/${encodeURIComponent(u)}`},{idempotent:false,maxAttempts:1});return f.ok?$(void 0):f},getPdfLink(a){return t(a,N)?c("records.pdf.link",{method:"GET",path:`${s(a)}/pdf-link`},Br):I()},async editFact(a,u){let f=t(a,N)?d(u,u.correctedFields):null;if(f===null)return I();let v=await r.send("records.fact.edit",{method:"POST",path:`${s(a)}/facts/edit`,body:f},{idempotent:false,maxAttempts:1});return v.ok?$(void 0):v},async removeFact(a,u){let f=t(a,N)?d(u):null;if(f===null)return I();let v=await r.send("records.fact.remove",{method:"POST",path:`${s(a)}/facts/remove`,body:f},{idempotent:false,maxAttempts:1});return v.ok?$(void 0):v},listRequestDocuments(a){return t(a,64)?c("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(a)}/documents`},Lr):I()},listAuthorizationSignatures:o(()=>c("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},Ur),"listAuthorizationSignatures")}}o(Yr,"createRecordsDepthClient");function I(){return Promise.resolve(O(j("validationFailed",{retryable:false})))}o(I,"invalid");var Jn=new Map,Kr=new Set;function Zn(e){return Jn.get(e)??0}o(Zn,"recordsConsentEpochOf");function eo(e){return Kr.add(e),()=>{Kr.delete(e);}}o(eo,"subscribe");function Gr(e){let r=useCallback(()=>Zn(e),[e]);return useSyncExternalStore(eo,r,r)}o(Gr,"useRecordsConsentEpoch");function Qr(){let{runtime:e,userRef:r,scopeEpoch:t}=M();return useMemo(()=>{let{services:n}=e.registry;return Yr({auth:n.authFor(r),...n.errorPolicy?{errorPolicy:n.errorPolicy}:{},...typeof n.apiBaseUrl=="string"?{apiBaseUrl:n.apiBaseUrl}:{}})},[e,r,t])}o(Qr,"useEverfurRecordsDepthClient");function te(e,r,t,n=""){let i=Qr(),{userRef:s}=M(),c=Gr(e),d=useMemo(()=>({}),[i,e,n,c]),[a,u]=useState({scope:d,value:null,error:null,loading:true}),f=useRef(0),v=useCallback(async()=>{let ye=f.current+=1;if(u({scope:d,value:null,error:null,loading:true}),s===null){u({scope:d,value:null,error:null,loading:false});return}let K=await r(i,e);ye===f.current&&(K.ok?u({scope:d,value:K.value,error:null,loading:false}):u({scope:d,value:null,error:K.error,loading:false}));},[i,e,r,d,s]);useEffect(()=>(v(),()=>{f.current+=1;}),[v]);let g=a.scope===d?a:{value:null,error:null,loading:true},b=useCallback(()=>{v();},[v]),E=g.error===null||g.error.httpStatus!==404,k=E?g.error:null,B=g.loading?"loading":k!==null?"error":g.value===null?"empty":g.value.withheld?"populated":t(g.value)?"empty":"populated";return useMemo(()=>({status:B,value:g.value,error:k,available:E,refresh:b}),[B,g.value,k,E,b])}o(te,"useRecordsDepthRead");var ze=class ze extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(t,n){return Object.is(t.resetKey,n.key)?null:{failed:false,key:t.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(ze,"HostRenderBoundary");var De=ze;function io({render:e}){return e()}o(io,"RenderHost");function Ie({render:e,fallback:r,resetKey:t}){return createElement(De,{fallback:r,resetKey:t,children:createElement(io,{render:e})})}o(Ie,"HostRender");function Ne(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))Ne(e[r]);}return e}o(Ne,"deepFreeze");var ao=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),et={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},rt={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Zr={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},so={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},lo={regular:"400",medium:"500",bold:"700"},uo={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},co=0,ue="System",ce="monospace",po=["content","heading","control","compact","badge"];function fo(e){let r={};for(let t of po)r[t]=e;return r}o(fo,"authoredTierSizes");function tt(){return {family:ue,mono:ce,fontUrl:null,families:{regular:ue,medium:ue,bold:ue,mono:ce,monoMedium:ce,monoBold:ce},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Zr,tierSizes:fo(Zr),lineHeight:so,weight:lo,letterSpacing:uo,scale:1,maxScale:co,scaleCaps:ao}}o(tt,"baseType");var nt={},Ae=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function je(e){return `cubic-bezier(${e.join(", ")})`}o(je,"cssCubicBezier");var ot={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:je(Ae.standard),emphasized:je(Ae.emphasized),exit:je(Ae.exit)},reducedMotion:false},mo={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)"},it=Ne({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:mo,space:et,radius:rt,type:tt(),motion:ot,slots:nt}),yo={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)"};Ne({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:yo,space:et,radius:rt,type:tt(),motion:ot,slots:nt});var at=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),st=globalThis,Le=st[at]??(st[at]=createContext(it));Le.displayName??="EverfurThemeContext";function S(){return useContext(Le)}o(S,"useEverfurTheme");var lt=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var dt='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',ho="System";function vo(e){let r=e.trim();return r.length===0||r===ho?dt:`${ut(r)}, ${dt}`}o(vo,"cssFontFamily");function Ro(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${ut(r)}, ui-monospace, Menlo, Consolas, monospace`}o(Ro,"cssMonoFamily");function ut(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}o(ut,"quote");function _(e,r){let t=e.type,n=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?Ro(n):vo(n),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[lt[r]]}}o(_,"faceCss");var _o=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 Eo(e){return _o[e]}o(Eo,"requires");function ct(e,r,t){let n=Eo(e),i=new Map;for(let d of r)i.set(d.resource,d);if(t?.isPending===true&&n.some(d=>!i.has(d)))return Me({name:e,enabled:false,isPending:true,limits:{}});let s=xo(n,i);return n.filter(d=>i.get(d)?.granted!==true).length===0?Me({name:e,enabled:true,isPending:false,limits:s}):Me({name:e,enabled:false,isPending:false,limits:s,disabled:Co(n,i)})}o(ct,"decideCapability");function xo(e,r){let t={};for(let n of e){let i=r.get(n)?.limits;if(i)for(let[s,c]of Object.entries(i)){let d=t[s];t[s]=d===void 0?c:Math.min(d,c);}}return t}o(xo,"mergeLimits");function Co(e,r){for(let t of e){let n=r.get(t)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:Ce("accessDenied"),level:"user_entitlement",recoverable:false})}o(Co,"disabledFor");function Me(e){let r={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(r.disabled=e.disabled),Object.freeze(r)}o(Me,"freezeDecision");function qe(e){let{runtime:r}=M(),t=r.entitlements,n=useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return useMemo(()=>ct(e,n.decisions,{isPending:n.isPending}),[e,n])}o(qe,"useCapability");var ko=48;function To(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(To,"selectView");function mt(e){let{capability:r,children:t,renderDisabled:n,renderPending:i,style:s,className:c}=e,d=qe(r),a=useMemo(()=>To(d),[d]);switch(a){case "enabled":return t;case "pending":return i?jsx(Ie,{render:i,fallback:jsx(pt,{capability:r,style:s,className:c})}):jsx(pt,{capability:r,style:s,className:c});case "disabled":return n?jsx(Ie,{render:()=>n(d),fallback:jsx(ft,{decision:d,style:s,className:c}),resetKey:d}):jsx(ft,{decision:d,style:s,className:c});default:return xr(a)}}o(mt,"CapabilityGate");function pt({capability:e,style:r,className:t}){let n=S(),i=useMemo(()=>yt(n),[n]);return jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${e}`,className:t,style:{...i.offstate,...r},children:jsx("div",{style:i.skeletonBar})})}o(pt,"PendingSkeleton");function ft({decision:e,style:r,className:t}){let n=S(),i=useMemo(()=>yt(n),[n]),s=e.disabled?.reason??"";return jsx("div",{className:t,style:{...i.offstate,...r},children:s.length>0?jsx("p",{style:i.offstateText,children:s}):null})}o(ft,"OffState");function yt(e){let{color:r,space:t,radius:n,type:i}=e;return {offstate:{boxSizing:"border-box",minHeight:ko,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${t.md}px ${t.lg}px`,backgroundColor:r.surfaceCream,borderRadius:n.md,border:`1px solid ${r.brandBorder}`},offstateText:{margin:0,..._(e,"regular"),fontSize:i.size.body,lineHeight:`${Math.round(i.size.body*i.lineHeight.normal)}px`,color:r.text.muted},skeletonBar:{height:t.md,borderRadius:n.xs,backgroundColor:r.brandSofter}}}o(yt,"makeStyles");var Ue=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 bt(e){let r=S(),t=useMemo(()=>Po(r),[r]);return jsxs("div",{role:"note",className:e.className,style:{...t.container,...e.style},children:[jsx("p",{style:t.title,children:Ue.title}),jsx("p",{style:t.body,children:Ue.body})]})}o(bt,"ClinicalDisclaimer");function Po(e){let{color:r,space:t,type:n}=e,i=`${Math.round(n.size.caption*n.lineHeight.snug)}px`;return {container:{boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.xs,padding:`${t.md}px ${t.lg}px`,borderTop:`1px solid ${r.borderHairlineGreen}`,backgroundColor:r.surfaceCream},title:{margin:0,..._(e,"bold"),fontSize:n.size.caption,lineHeight:i,color:r.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{margin:0,..._(e,"regular"),fontSize:n.size.caption,lineHeight:i,color:r.text.muted}}}o(Po,"makeStyles");var Do=120,Io=44;function zo({reason:e,onExit:r,exitLabel:t,style:n,className:i}){let{color:s,space:c,radius:d,type:a}=S();return jsxs("div",{className:i,"data-testid":"records-gate-off",style:{boxSizing:"border-box",minHeight:Do,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:c.md,padding:c.lg,borderRadius:d.md,border:`1px solid ${s.brandBorder}`,backgroundColor:s.surfaceCream,color:s.text.primary,...n},children:[e.length>0?jsx("p",{style:{margin:0,fontSize:a.size.bodyTight,color:s.text.muted},children:e}):null,jsx("button",{type:"button",onClick:r,"data-testid":"records-gate-off-exit",style:{minHeight:Io,padding:`0 ${c.lg}px`,borderRadius:d.pill,border:`1.5px solid ${s.brand}`,backgroundColor:"transparent",color:s.brand,font:"inherit",fontSize:a.size.body,cursor:"pointer"},children:t})]})}o(zo,"RecordsGateOffState");function ht(e,r){return e===void 0?{}:{renderDisabled:o(t=>jsx(zo,{reason:t.disabled?.reason??"",onExit:e,exitLabel:r}),"renderDisabled")}}o(ht,"recordsGateExit");var No=120,ne=44,He="Back";function Lo(){let e=S(),r=useMemo(()=>Mo(e),[e]);return {theme:e,styles:r}}o(Lo,"useScreenStyles");function pe({title:e,onBack:r,right:t,testID:n,variant:i="brand"}){let{styles:s}=Lo();return jsxs("header",{style:s.headerRow,"data-testid":n,children:[r?jsx("button",{type:"button",onClick:r,"aria-label":He,style:s.iconButton,"data-testid":n?`${n}-back`:void 0,children:jsx("span",{"aria-hidden":"true",style:s.backChevron})}):jsx("span",{style:s.iconButton}),jsx("h2",{style:i==="document"?s.documentTitle:s.headerTitle,children:e}),jsx("div",{style:s.headerRight,children:t??jsx("span",{style:s.iconButton})})]})}o(pe,"ScreenHeader");function Mo(e){let{color:r,space:t,radius:n,type:i,slots:s}=e,c=o((b,E)=>`${Math.round(b*E)}px`,"lh"),d=o((b,E,k,B="regular")=>({margin:0,..._(e,B),fontSize:b,lineHeight:c(b,E),color:k}),"text"),a=U(s.recordCard),u=`1px solid ${r.brandBorder}`,f=e.brightness==="dark"?r.errorRed:r.danger,v=o((b,E)=>({backgroundColor:b,color:E}),"tone"),g={boxSizing:"border-box",minHeight:ne,minWidth:ne,padding:`${t.md}px ${t.lg+t.xs/2}px`,borderRadius:n.pill,..._(e,"bold"),fontSize:i.size.body,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:t.sm,textDecoration:"none"};return {chipTones:{neutral:v(r.badgeBgNeutral,r.text.secondary),info:v(r.brandSoft,r.brand),warning:v(r.badgeBgCaution,r.warningStrong),critical:v(r.badgeBgCritical,r.danger),positive:v(r.badgeBgPositive,r.success)},root:{boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:No,height:"100%",backgroundColor:r.background,color:r.text.primary,..._(e,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},content:{display:"flex",flexDirection:"column",gap:t.lg,padding:`0 ${t.lg}px ${t.xxl}px`},contentTight:{display:"flex",flexDirection:"column",gap:t.lg,padding:`0 ${t.sm}px ${t.xxl}px`},inset:{padding:`0 ${t.sm}px`},headerRow:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:t.sm,padding:`${t.xs}px ${t.lg}px ${t.md}px`},iconButton:{boxSizing:"border-box",width:ne,height:ne,display:"inline-flex",alignItems:"center",justifyContent:"center",border:0,background:"transparent",cursor:"pointer",padding:0,color:r.brand,flexShrink:0},backChevron:{display:"block",width:t.md,height:t.md,borderLeft:`2px solid ${r.brand}`,borderBottom:`2px solid ${r.brand}`,transform:"rotate(45deg)",marginLeft:t.xs},headerTitle:{...d(i.size.heading,i.lineHeight.tight,r.brand,"bold"),flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},documentTitle:{...d(i.size.subtitle,i.lineHeight.snug,r.text.primary,"bold"),flex:1,textAlign:"center"},headerRight:{display:"flex",alignItems:"center",gap:t.sm+t.xs/2},section:{display:"flex",flexDirection:"column",gap:t.sm+t.xs/2},sectionHeader:{display:"flex",alignItems:"center",gap:t.sm,padding:`0 ${t.xs}px`},sectionTitle:{...d(i.size.body+1,i.lineHeight.snug,r.text.primary,"bold")},sectionCount:{...d(i.size.bodyTight,i.lineHeight.snug,r.text.muted,"medium")},card:{boxSizing:"border-box",borderRadius:n.lg-t.xs,border:u,backgroundColor:r.surface,padding:`${t.xs}px ${t.lg}px`,margin:0,listStyle:"none",...L(s.recordCard,1)},creamCard:{boxSizing:"border-box",borderRadius:n.lg-t.xs/2,border:u,backgroundColor:r.surfaceCream,padding:t.lg,display:"flex",flexDirection:"column",gap:t.md,...L(s.recordCard,1)},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:t.md,padding:`${t.md}px 0`},rowDivider:{borderTop:`1px solid ${r.borderHairlineGreen}`},rowMain:{flex:1,minWidth:0},rowRight:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:t.xs+t.xs/2},rowTitle:{...d(i.size.body,i.lineHeight.snug,r.text.primary,"medium"),...a},rowDetail:{...d(i.size.caption,i.lineHeight.normal,r.text.secondary),marginTop:t.xs/2,...a},rowValue:{...d(i.size.body+1,i.lineHeight.snug,r.text.primary,"bold"),marginTop:t.xs/2,...a},rowMuted:{...d(i.size.caption,i.lineHeight.normal,r.text.muted),...a},chip:{display:"inline-block",borderRadius:n.pill,padding:`${t.xs-1}px ${t.sm}px`,..._(e,"medium"),fontSize:i.size.tiny,lineHeight:c(i.size.tiny,i.lineHeight.snug),whiteSpace:"nowrap"},pill:g,pillPrimary:{border:0,backgroundColor:r.brand,color:r.onPrimary,...L(s.primaryButton),...U(s.primaryButton)},pillOutline:{border:`1.5px solid ${r.brand}`,backgroundColor:"transparent",color:r.brand},pillDanger:{border:`1.4px solid ${r.danger}`,backgroundColor:r.surface,color:r.danger,fontSize:i.size.bodyTight},pillAsk:{border:`1px solid ${r.borderRingCream}`,backgroundColor:r.surface,color:r.text.primary},pillLink:{border:0,backgroundColor:"transparent",color:r.linkInk,padding:`${t.sm}px`},pillDisabled:{opacity:.5,cursor:"default"},infoNote:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.brandSoft,padding:`${t.sm+t.xs/2}px ${t.md}px`,...d(i.size.bodyTight,i.lineHeight.normal,r.text.primary)},cautionNote:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.badgeBgCaution,padding:`${t.sm+t.xs/2}px ${t.md}px`,...d(i.size.bodyTight,i.lineHeight.normal,r.warningStrong)},statusCard:{borderRadius:n.md,backgroundColor:r.brandSoft,padding:t.md+t.xs/2,...d(i.size.bodyTight,i.lineHeight.relaxed,r.text.primary)},errorBanner:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.badgeBgCritical,padding:t.md,...d(i.size.bodyTight,i.lineHeight.normal,f)},errorText:d(i.size.bodyTight,i.lineHeight.normal,f),band:{display:"flex",alignItems:"flex-start",gap:t.sm,borderRadius:n.md-t.xs/2,padding:t.md,backgroundColor:r.brandSoft,margin:0},bandText:{flex:1,...d(i.size.caption,i.lineHeight.normal,r.text.secondary)},infoGlyph:{boxSizing:"border-box",flexShrink:0,width:t.md+t.xs/2,height:t.md+t.xs/2,borderRadius:n.pill,border:`1px solid ${r.text.secondary}`,display:"inline-flex",alignItems:"center",justifyContent:"center",..._(e,"bold"),fontSize:i.size.small,color:r.text.secondary},chevron:{display:"inline-block",width:t.sm,height:t.sm,borderTop:`2px solid ${r.text.muted}`,borderRight:`2px solid ${r.text.muted}`,flexShrink:0},lead:{...d(i.size.body+1,i.lineHeight.snug,r.text.primary,"bold"),padding:`0 ${t.sm}px`},field:{boxSizing:"border-box",display:"block",width:"100%",minHeight:ne,padding:`${t.sm}px ${t.md}px`,border:`1px solid ${r.borderHairlineGreen}`,borderRadius:n.sm,color:r.text.primary,backgroundColor:r.surface,..._(e,"regular"),fontSize:i.size.body},fieldLabel:{...d(i.size.bodyTight,i.lineHeight.normal,r.text.secondary,"medium"),display:"block",marginBottom:t.xs},muted:d(i.size.caption,i.lineHeight.normal,r.text.muted),bodyText:d(i.size.body,i.lineHeight.normal,r.text.primary),mono:_(e,"mono"),plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column"},sheetBackdrop:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:10},sheet:{boxSizing:"border-box",width:"100%",maxWidth:560,maxHeight:"88%",overflowY:"auto",backgroundColor:r.surface,borderTopLeftRadius:n.xl-1,borderTopRightRadius:n.xl-1,padding:`${t.md}px ${t.lg+t.xs+t.xs/2}px ${n.xl}px`,display:"flex",flexDirection:"column",gap:t.md,..._(e,"regular"),color:r.text.primary},sheetHandle:{alignSelf:"center",width:t.xxl+t.xs,height:t.xs,borderRadius:n.pill,backgroundColor:r.borderRingCream},sheetHeader:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:t.sm},sheetTitle:{...d(i.size.heading,i.lineHeight.snug,r.text.primary,"bold")},sheetHelper:d(i.size.bodyTight,i.lineHeight.normal,r.text.muted),closeGlyph:{fontSize:i.size.verdict,lineHeight:1,color:r.text.primary}}}o(Mo,"makeScreenStyles");var vt=Object.freeze({idle:Object.freeze({title:"Find your pet\u2019s clinic",body:"Search for the clinic that holds your pet\u2019s records. We\u2019ll request them on your behalf once you sign the authorization.",action:null}),no_requests:Object.freeze({title:"No record requests yet",body:"When you request records from a clinic, you\u2019ll be able to track every step here.",action:null}),no_records:Object.freeze({title:"Nothing to show just yet",body:"Once your pet\u2019s records arrive and our team reviews them, lab trends and visits will appear here.",action:null}),rate_limited:Object.freeze({title:"Slow down a moment",body:"You\u2019ve made a lot of requests just now. You can try again shortly.",action:"Try again"}),service_unavailable:Object.freeze({title:"Records search is temporarily down",body:"We\u2019re working on it. Please try again in a few minutes.",action:"Try again"}),error:Object.freeze({title:"Couldn\u2019t reach Everfur",body:"Check your connection and try again.",action:"Try again"})}),Ve=60;function Rt(e){return `Try again in ${e}s`}o(Rt,"coolingActionLabel");var _t="Try again, available shortly";function W({width:e,height:r,radius:t,style:n}){let{color:i,radius:s}=S();return jsx("span",{"aria-hidden":"true",style:{display:"block",width:e,height:r,borderRadius:t??s.xs,backgroundColor:i.skeleton,flexShrink:0,...n}})}o(W,"SkeletonBlock");var $o=44,We=62;function xt({testID:e}){let r=Ct();return jsxs("div",{role:"progressbar","aria-label":h.loadingTimeline,"aria-busy":"true",style:r.timeline,"data-testid":e,children:[jsx("div",{style:r.timelineDisclaimer,children:jsx(W,{width:"100%",height:$o,radius:12})}),Array.from({length:6},(t,n)=>jsxs("div",{children:[n>0?jsx("div",{style:r.timelineSeparator}):null,jsxs("div",{style:r.timelineRow,children:[jsx(W,{width:34,height:34,radius:17}),jsxs("div",{style:r.timelineBody,children:[jsxs("div",{style:r.timelineTop,children:[jsx(W,{width:44,height:10,radius:5}),jsx(W,{width:56,height:12,radius:6})]}),jsx(W,{width:"70%",height:14,radius:7}),n%2===0?jsx(W,{width:"45%",height:12,radius:6}):null]})]})]},n))]})}o(xt,"TimelineSkeleton");function fe({variant:e,onAction:r,message:t,testID:n}){let i=Ct(),s=vt[e],[c,d]=useState(e==="rate_limited"?Ve:0);useEffect(()=>{e==="rate_limited"&&d(Ve);},[e]),useEffect(()=>{if(c<=0)return;let f=setTimeout(()=>d(v=>Math.max(0,v-1)),1e3);return ()=>clearTimeout(f)},[c]);let a=e==="rate_limited"&&c>0,u=a?Rt(c):s.action;return jsxs("section",{role:"status",style:i.empty,"data-testid":n,children:[jsx("span",{"aria-hidden":"true",style:i.emptyGlyph}),jsx("h3",{style:i.emptyTitle,children:s.title}),jsx("p",{style:i.emptyBody,children:t??s.body}),u!==null&&r?jsx("button",{type:"button",onClick:r,disabled:a,"aria-label":a?_t:u,style:{...i.emptyAction,...a?i.emptyActionDisabled:{}},"data-testid":n?`${n}-action`:`records-empty-${e}-action`,children:u}):null]})}o(fe,"RecordsEmptyState");function Ct(){let e=S();return useMemo(()=>Ho(e),[e])}o(Ct,"useStyles");function Ho(e){let{color:r,space:t,radius:n,type:i}=e,s=`1px solid ${r.brandBorder}`;return {dashboard:{display:"flex",flexDirection:"column",gap:t.lg,padding:`${t.xs}px ${t.sm}px 0`,backgroundColor:r.background},inset:{padding:`0 ${t.sm}px`},summaryCard:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.md+t.xs/2,borderRadius:n.lg-t.xs,border:s,backgroundColor:r.surface,padding:`${t.lg+t.xs}px ${t.lg}px`},badges:{display:"flex",gap:t.md},carouselCard:{borderRadius:n.lg-t.xs,border:s,backgroundColor:r.surface,padding:t.lg},dots:{display:"flex",alignItems:"center",justifyContent:"center",gap:t.xs+t.xs/2},centered:{display:"flex",justifyContent:"center"},actions:{display:"flex",flexDirection:"column",gap:t.sm+t.xs/2},actionRow:{display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:n.md,border:s,backgroundColor:r.surface,padding:t.lg},actionLeft:{flex:1,display:"flex",alignItems:"center",gap:t.md},request:{display:"flex",flexDirection:"column",gap:t.lg+t.xs/2,padding:`${t.xs}px ${t.lg}px 0`},railRow:{display:"flex",alignItems:"flex-start",gap:t.md},railColumn:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.xs/2,width:24},railBody:{flex:1,display:"flex",flexDirection:"column",gap:t.xs+t.xs/2,paddingBottom:t.lg+t.xs/2},statusCard:{display:"flex",flexDirection:"column",gap:t.sm,borderRadius:n.md,backgroundColor:r.brandSoft,padding:t.md+t.xs/2},timeline:{backgroundColor:r.background},timelineDisclaimer:{padding:`${t.xs}px ${t.lg}px ${t.md}px`},timelineRow:{display:"flex",gap:t.md,padding:`${t.md+t.xs/2}px ${t.lg}px`},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:t.xs-1},timelineTop:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:t.sm},timelineSeparator:{height:1,backgroundColor:r.brandBorder,marginLeft:We},clinics:{display:"flex",flexDirection:"column",gap:t.md},clinicRow:{display:"flex",flexDirection:"column",gap:t.sm,borderRadius:n.lg-t.xs/2,border:s,backgroundColor:r.surface,padding:`${t.md+t.xs/2}px`},shares:{display:"flex",flexDirection:"column",gap:t.md,padding:t.md,borderRadius:n.md,backgroundColor:r.surfaceCream,border:s},shareRow:{display:"flex",flexDirection:"column",gap:t.xs+t.xs/2},empty:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.sm+t.xs/2,padding:`${t.xxl}px ${t.xl}px`,textAlign:"center"},emptyGlyph:{boxSizing:"border-box",width:22,height:22,borderRadius:11,backgroundColor:r.brandSoft,border:s,marginBottom:t.xs},emptyTitle:{margin:0,..._(e,"bold"),fontSize:i.size.subtitle,lineHeight:`${Math.round(i.size.subtitle*i.lineHeight.snug)-1}px`,color:r.brand},emptyBody:{margin:0,..._(e,"regular"),fontSize:i.size.bodyTight,lineHeight:`${Math.round(i.size.bodyTight*i.lineHeight.normal)}px`,color:r.text.muted,maxWidth:320},emptyAction:{boxSizing:"border-box",marginTop:t.sm,minHeight:40,borderRadius:n.pill,padding:`0 ${t.lg+t.xs/2}px`,backgroundColor:r.brand,color:r.onPrimary,border:0,cursor:"pointer",..._(e,"bold"),fontSize:i.size.bodyTight},emptyActionDisabled:{opacity:.5,cursor:"default"}}}o(Ho,"makeStyles");var Go=300,St=120,wt=44,Xo=o((e,r)=>e.getTimeline(r),"readTimeline"),Qo=o(e=>e.isEmpty,"timelineEmpty"),Jo=o((e,r)=>e.getRecordDepth(r),"readDepth"),Zo=o(e=>!e.available||e.labResults.length+e.encounters.length+e.clinicianNotes.length+e.physicalExams.length===0,"depthEmpty"),ei=o(e=>e.contributions.length===0,"contributionsEmpty");function ri({petRef:e,style:r,className:t,onBack:n}){let i=te(e,Xo,Qo);return jsx(Ye,{state:i,style:r,className:t,onBack:n,header:jsx(pe,{title:h.timeline,onBack:Q(n),testID:"timeline-header"}),loading:jsx(xt,{testID:"timeline-loading"}),empty:jsx(fe,{variant:"no_records",testID:"timeline-empty"}),render:s=>jsx(ai,{timeline:s})})}o(ri,"EverfurRecordsTimeline");function ti({petRef:e,style:r,className:t,onBack:n}){let i=te(e,Jo,Zo);return jsx(Ye,{state:i,style:r,className:t,onBack:n,header:n?jsx(pe,{title:q.records,onBack:Q(n)}):null,render:s=>jsx(si,{depth:s})})}o(ti,"EverfurRecordDepth");function ni({petRef:e,docId:r,style:t,className:n,onBack:i}){let s=useCallback((a,u)=>a.getDocumentContributions(u,r),[r]),c=te(e,s,ei,r),d=c.value?.document?.title?.trim()||h.uploadedDocument;return jsx(Ye,{state:c,style:t,className:n,onBack:i,header:jsx(pe,{title:d,onBack:Q(i),testID:"contributions-header"}),empty:jsx(fe,{variant:"no_records",testID:"contributions-empty"}),render:a=>jsx(li,{view:a})})}o(ni,"EverfurDocumentContributions");function Ye({state:e,style:r,className:t,header:n,loading:i,empty:s,render:c,onBack:d}){let{styles:a}=me(),{userRef:u}=M();return jsx(mt,{capability:"records",style:r,className:t,...ht(Q(d),He),children:jsxs("div",{className:t,style:{...a.container,...r},children:[n??null,jsx("div",{style:a.body,children:u===null?jsx("p",{role:"alert",style:a.alertText,children:q.sessionRequired}):oi(e,c,a,i,s)}),jsx(bt,{})]})})}o(Ye,"DepthSurface");function oi(e,r,t,n,i){switch(e.status){case "loading":return n??jsx(ii,{styles:t});case "empty":return i??jsx("div",{style:t.centered,children:jsx("div",{role:"img","aria-label":q.empty,style:t.emptyGlyph})});case "error":return e.error?jsx(fe,{variant:tr(e.error),message:e.error.displayMessage,onAction:e.error.retryable?e.refresh:void 0,testID:"depth-error"}):null;case "populated":return e.value===null||e.value.withheld?null:r(e.value);default:return null}}o(oi,"renderState");function ii({styles:e}){let[r,t]=useState(false);return useEffect(()=>{let n=setTimeout(()=>t(true),Go);return ()=>clearTimeout(n)},[]),jsx("div",{role:"status","aria-busy":"true","aria-label":q.loading,style:e.centered,children:r?jsx("div",{"aria-hidden":"true",style:e.spinner}):null})}o(ii,"LoadingState");function ai({timeline:e}){let{styles:r}=me(),t=Re(e);return jsxs("section",{"aria-label":h.timeline,style:r.timelineList,children:[e.disclaimer.length>0?jsx("p",{role:"note","aria-label":rr.important(e.disclaimer),style:r.timelineBand,children:e.disclaimer}):null,jsx("ul",{style:r.plainList,children:t.map((n,i)=>jsx("li",{style:i>0?r.timelineSeparated:void 0,"data-testid":`records-timeline-row-${n.kind}`,children:jsxs("div",{style:r.timelineRow,"aria-label":[n.kindLabel,n.date,n.title,n.detail].filter(Boolean).join(", "),children:[jsx("span",{"aria-hidden":"true",style:r.timelineBubble}),jsxs("div",{style:r.timelineBody,children:[jsxs("div",{style:r.topLine,children:[jsx("span",{style:r.timelineKind,children:n.kindLabel}),jsx("span",{style:r.date,children:n.date})]}),jsx("span",{style:r.timelineTitle,children:n.title}),n.detail?jsx("span",{style:r.rowDetail,children:n.detail}):null]})]})},n.key))})]})}o(ai,"TimelineBody");function si({depth:e}){let{styles:r}=me();return jsxs("section",{"aria-label":q.records,style:r.list,children:[e.labResults.length>0?jsxs("div",{style:r.section,children:[jsx("h3",{style:r.heading,children:`${h.labResults} (${e.labResults.length})`}),jsx("ul",{style:r.card,children:e.labResults.map(t=>{let n=sr(t.latest.status),i=pr(t.latest.at,t.trajectory,t.points.length);return jsxs("li",{style:r.row,children:[jsx("span",{style:r.rowTitle,children:t.name}),jsx("span",{style:r.rowValue,children:cr(t.latest.value,t.latest.unit,t.latest.qualitativeResult)}),i?jsx("span",{style:r.rowDetail,children:i}):null,jsx("span",{style:{...r.chip,...n.outOfRange?r.chipCritical:r.chipNeutral},children:n.label}),t.meaning?jsx("span",{style:r.rowDetail,children:t.meaning}):null]},t.markerId)})})]}):null,e.encounters.length>0?jsxs("div",{style:r.section,children:[jsx("h3",{style:r.heading,children:`${h.visits} (${e.encounters.length})`}),jsx("ul",{style:r.card,children:e.encounters.map(t=>{let n=[t.date?w(t.date):null,t.clinicName,t.veterinarian].filter(i=>i&&i!=="-").join(" \xB7 ");return jsxs("li",{style:r.row,children:[jsx("span",{style:r.rowTitle,children:t.type?ae(t.type):h.visit}),n?jsx("span",{style:r.rowDetail,children:n}):null]},t.encounterId)})})]}):null,e.physicalExams.length>0?jsxs("div",{style:r.section,children:[jsx("h3",{style:r.heading,children:`${h.physicalExams} (${e.physicalExams.length})`}),e.physicalExams.map(t=>jsxs("div",{style:r.card,children:[jsx("h4",{style:r.rowTitle,children:t.observedOn?w(t.observedOn):h.exam}),jsx("ul",{style:r.plainList,children:t.systems.map(n=>{let i=n.findingStatus==="abnormal",s=i?h.abnormal:n.findingStatus==="not_examined"?h.notExamined:h.normal;return jsxs("li",{style:r.row,children:[jsx("span",{style:r.rowTitle,children:lr(n.system)}),i&&n.finding?jsx("span",{style:r.rowDetail,children:n.finding}):null,jsx("span",{style:{...r.chip,...i?r.chipCaution:r.chipNeutral},children:s})]},n.system)})})]},t.examId))]}):null,e.clinicianNotes.length>0?jsxs("div",{style:r.section,children:[jsx("h3",{style:r.heading,children:`${h.visitNotes} (${e.clinicianNotes.length})`}),e.clinicianNotes.map(t=>jsxs("div",{style:r.card,children:[jsx("h4",{style:r.rowTitle,children:t.observedOn?w(t.observedOn):h.visitNote}),jsx("dl",{style:r.plainList,children:t.sections.map((n,i)=>jsxs("div",{style:r.row,children:[jsx("dt",{style:r.kindLabel,children:dr(n.section)}),jsx("dd",{style:n.text?r.rowDetail:r.rowMuted,children:n.text||h.notRecorded})]},`${n.section}:${i}`))})]},t.noteId))]}):null]})}o(si,"DepthBody");function li({view:e}){let{styles:r}=me();return jsxs("section",{"aria-label":q.records,style:r.list,children:[e.document?.receivedAt?jsx("p",{style:r.rowDetail,children:w(e.document.receivedAt)}):null,jsx("dl",{style:r.card,children:e.contributions.map(t=>jsxs("div",{style:r.row,children:[jsx("dt",{style:r.rowTitle,children:t.label}),jsx("dd",{style:r.rowValue,children:or(t.value,t.unit)}),t.observedAt?jsx("dd",{style:r.rowDetail,children:w(t.observedAt)}):null]},t.key))})]})}o(li,"ContributionsBody");function me(){let e=S(),r=useMemo(()=>di(e),[e]);return {theme:e,styles:r}}o(me,"useDepthTheme");function di(e){let{color:r,space:t,radius:n,type:i,slots:s}=e,c=o((g,b)=>`${Math.round(g*b)}px`,"lh"),d=o((g,b,E,k="regular")=>({margin:0,..._(e,k),fontSize:g,lineHeight:c(g,b),color:E}),"text"),a=U(s.recordCard),u=o((g,b,E,k="regular")=>({...d(g,b,E,k),...a}),"inCard"),f=`1px solid ${r.brandBorder}`,v=e.brightness==="dark"?r.errorRed:r.danger;return {container:{boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:St,height:"100%",backgroundColor:r.background,color:r.text.primary,..._(e,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},centered:{boxSizing:"border-box",flex:"1 1 auto",minHeight:St,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:t.lg,padding:t.xl,textAlign:"center"},spinner:{boxSizing:"border-box",width:24,height:24,borderRadius:n.pill,border:`3px solid ${r.brandSofter}`,borderTopColor:r.brand},emptyGlyph:{boxSizing:"border-box",width:40,height:40,borderRadius:n.lg,backgroundColor:r.brandSoft,border:f},alertText:d(i.size.subtitle,i.lineHeight.snug,r.text.secondary),errorText:d(i.size.subtitle,i.lineHeight.snug,v),primaryButton:{boxSizing:"border-box",minHeight:wt,minWidth:wt,padding:`${t.md}px ${t.xl}px`,borderRadius:n.pill,..._(e,"bold"),fontSize:i.size.body,border:0,cursor:"pointer",backgroundColor:r.primary,color:r.onPrimary,...L(s.primaryButton),...U(s.primaryButton)},list:{display:"flex",flexDirection:"column",gap:t.md,padding:t.lg},section:{display:"flex",flexDirection:"column",gap:t.sm},heading:{...d(i.size.heading,i.lineHeight.snug,r.text.primary,"bold")},card:{boxSizing:"border-box",listStyle:"none",display:"flex",flexDirection:"column",gap:t.sm,margin:0,padding:t.md,borderRadius:n.md,backgroundColor:r.surfaceCream,border:f,...L(s.recordCard,1)},plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:t.sm},row:{display:"flex",flexDirection:"column",gap:t.xs,padding:`${t.xs}px 0`,borderBottom:`1px solid ${r.borderHairlineGreen}`},topLine:{display:"flex",justifyContent:"space-between",gap:t.md},kindLabel:{...u(i.size.caption,i.lineHeight.normal,r.text.muted,"medium")},date:u(i.size.caption,i.lineHeight.normal,r.text.muted),rowTitle:{...u(i.size.body,i.lineHeight.normal,r.text.primary,"bold")},rowValue:{...u(i.size.body,i.lineHeight.normal,r.text.primary,"medium")},rowDetail:u(i.size.bodyTight,i.lineHeight.normal,r.text.muted),rowMuted:{...u(i.size.bodyTight,i.lineHeight.normal,r.text.muted),opacity:.7},chip:{...d(i.size.caption,i.lineHeight.normal,r.text.primary),alignSelf:"flex-start",padding:`${t.xs}px ${t.sm}px`,borderRadius:n.pill},chipNeutral:{backgroundColor:r.badgeBgNeutral},chipCaution:{backgroundColor:r.badgeBgCaution},chipCritical:{backgroundColor:r.badgeBgCritical},disclaimer:d(i.size.caption,i.lineHeight.normal,r.text.muted),timelineList:{display:"flex",flexDirection:"column",paddingBottom:t.xxl},timelineBand:{...d(i.size.caption,i.lineHeight.normal,r.text.secondary),borderRadius:n.md-t.xs/2,padding:t.md,backgroundColor:r.brandSoft,margin:`${t.xs}px ${t.lg}px ${t.md}px`},timelineSeparated:{borderTop:`1px solid ${r.brandBorder}`,marginLeft:We,paddingLeft:0},timelineRow:{display:"flex",gap:t.md,padding:`${t.md+t.xs/2}px ${t.lg}px`},timelineBubble:{boxSizing:"border-box",flexShrink:0,width:34,height:34,borderRadius:n.pill,backgroundColor:r.brandSoft,border:f},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:t.xs-1,minWidth:0},timelineKind:{..._(e,"mono"),fontSize:i.size.micro,lineHeight:`${i.size.bodyTight}px`,letterSpacing:i.letterSpacing.eyebrow/3,textTransform:"uppercase",color:r.text.secondary},timelineTitle:{...d(i.size.body,i.lineHeight.normal,r.text.primary,"medium")}}}o(di,"makeStyles");
2
- export{ni as EverfurDocumentContributions,ti as EverfurRecordDepth,ri as EverfurRecordsTimeline,Re as buildTimelineRows,Wr as mapDocumentContributions,Hr as mapRecordDepth,Vr as mapRecordsTimeline,Qr as useEverfurRecordsDepthClient,te as useRecordsDepthRead};
1
+ import {createContext,useMemo,useState,useRef,useCallback,useEffect,useContext,useSyncExternalStore,Component,createElement}from'react';import {z}from'zod';import {jsx,jsxs}from'react/jsx-runtime';var Pt=Object.defineProperty;var o=(e,r)=>Pt(e,"name",{value:r,configurable:true});function Ft(e,r){if(e===void 0)return {};let t={};return e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(t.borderColor=e.borderColor,t.borderWidth=r??1),e.borderRadius!==void 0&&(t.borderRadius=e.borderRadius),t}o(Ft,"slotBox");function B(e){return e?.textColor===void 0?{}:{color:e.textColor}}o(B,"slotText");function L(e,r){let t=Ft(e,r),n={};return t.backgroundColor!==void 0&&(n.backgroundColor=t.backgroundColor),t.borderColor!==void 0&&(n.border=`${t.borderWidth??1}px solid ${t.borderColor}`),t.borderRadius!==void 0&&(n.borderRadius=t.borderRadius),n}o(L,"slotBoxCss");function Je(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(Je,"reportHostFailure");function Dt(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(Dt,"isThenable");function It(e,...r){if(typeof e=="function")try{let t=e(...r);return Dt(t)&&Promise.resolve(t).then(void 0,Je),t}catch(t){Je(t);return}}o(It,"callHost");var Ze=new WeakMap;function J(e){if(typeof e!="function")return;let r=Ze.get(e);if(r!==void 0)return r;let t=o((...n)=>{It(e,...n);},"guarded");return Ze.set(e,t),t}o(J,"guardHost");function $(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}o($,"ok");function O(e){return Object.freeze({ok:false,error:e})}o(O,"err");var ae=class ae extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,ae.prototype);}};o(ae,"EverfurConfigError");var Z=ae;var er=Symbol.for("@everfur/sdk#EverfurContext@v1"),rr=globalThis,tr=rr[er]??(rr[er]=createContext(null));tr.displayName??="EverfurContext";function M(){let e=useContext(tr);if(e===null)throw new Z("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(M,"useEverfurContext");var q=Object.freeze({loading:"Loading",empty:"No records yet",upload:"Upload records",consentRequired:"Consent required",allow:"Allow",sessionRequired:"Sign in required",recordUnavailable:"Record unavailable",retry:"Try again",records:"Records",beingReviewed:"being reviewed"});var jt="your pet";function A(e){let r=e?.trim()??"";return r.length>0?r:jt}o(A,"petNameOr");var nr=Object.freeze({title:"Health records",openTimeline:"Open timeline",loading:"Loading health records",lead:o(e=>`${A(e)}\u2019s lab trends`,"lead"),retryMarkers:"Retry loading lab trends",viewFullRecord:"View full medical record",viewTimeline:"View full timeline",important:o(e=>`Important: ${e}`,"important")});Object.freeze({title:"Marker Summary",marker:"Marker",markers:"Markers",outOfRange:"OUT OF RANGE",inRange:"IN RANGE",noRange:"NO RANGE",subtitle:"Summary of your pet\u2019s biomarkers",ask:"Ask about these markers",askA11y:"Ask Everfur about these markers",a11y:o((e,r,t,n)=>`Marker summary: ${e} ${e===1?"marker":"markers"}, ${r} in range, ${t} out of range${n>0?`, ${n} without a range`:""}.`,"a11y")});Object.freeze({counter:o((e,r)=>`${e+1} of ${r}`,"counter"),a11y:o((e,r,t)=>e!==null?`${e}, marker ${r+1} of ${t}. Swipe left or right to see more markers.`:`Marker ${r+1} of ${t}`,"a11y")});Object.freeze({tapHint:"Tap a point to see where it came from.",singleHint:"One reading so far: we\u2019ll plot a trend as more come in.",empty:"No readings for this marker yet.",ask:"Ask about this marker",askA11y:o(e=>`Ask Everfur about ${e}`,"askA11y"),status:o(e=>`Status: ${e}`,"status"),latestA11y:o((e,r,t)=>`Latest reading ${e}, ${r}, collected ${t}`,"latestA11y"),readingsA11y:o(e=>`${e} readings, oldest to newest`,"readingsA11y")});Object.freeze({title:o(e=>`${A(e)}\u2019s records request`,"title"),body:o(e=>`We\u2019re requesting ${A(e)}\u2019s records from your vet. This usually takes a few days; we\u2019ll show lab trends here as soon as they arrive.`,"body"),a11y:o(e=>`Records request in progress for ${A(e)}.`,"a11y"),openA11y:o((e,r)=>`Open ${A(e)}\u2019s records request. ${r}`,"openA11y"),ask:"Ask about this request",askA11y:"Ask Everfur about this records request"});Object.freeze({title:o(e=>`Add ${A(e)}\u2019s records`,"title"),body:"Records can come from more than one clinic over a lifetime.",requestFromClinic:"Request from a clinic",requestFromClinicA11y:o(e=>`Request ${A(e)}\u2019s records from a clinic`,"requestFromClinicA11y"),uploadDocument:"Upload a document",uploadDocumentA11y:o(e=>`Upload one of ${A(e)}\u2019s records`,"uploadDocumentA11y")});function or(e){return e?.httpStatus===429?"rate_limited":e?.httpStatus===502?"service_unavailable":"error"}o(or,"recordsEmptyVariantForError");function ar(e,r){return e===null?"":r?`${e} ${r}`:e}o(ar,"formatEntityValue");var ir=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function w(e){if(!e)return "-";let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(r!==null){let i=ir[Number(r[2])-1];return i===void 0?"-":`${i} ${Number(r[3])}, ${r[1]}`}let t=Date.parse(e);if(Number.isNaN(t))return "-";let n=new Date(t);return `${ir[n.getUTCMonth()]} ${n.getUTCDate()}, ${n.getUTCFullYear()}`}o(w,"formatRecordsDate");var h=Object.freeze({timeline:"Timeline",loadingTimeline:"Loading timeline",labResults:"Blood & lab work",visits:"Visits",physicalExams:"Physical exams",visitNotes:"Visit notes",visit:"Visit",exam:"Exam",visitNote:"Visit note",notRecorded:"Not recorded",abnormal:"Abnormal",notExamined:"Not examined",normal:"Normal",measured:o(e=>`Measured ${e}`,"measured"),uploadedDocument:"Uploaded document",kind:Object.freeze({visit:"Visit",vaccine:"Vaccine",weight:"Weight",medication:"Medication"}),clinicVisit:"Clinic visit",doctor:o(e=>`Dr. ${e}`,"doctor"),lot:o(e=>`Lot ${e}`,"lot"),expires:o(e=>`Expires ${e}`,"expires")});function dr(e){switch(e){case "above":return {label:"Above range",outOfRange:true};case "below":return {label:"Below range",outOfRange:true};case "in_range":return {label:"In range",outOfRange:false};default:return {label:"No range on file",outOfRange:false}}}o(dr,"markerStatusLabel");function Nt(e,r){return r<2?null:`${e==="flat"?"Holding steady":`Trending ${e==="down"?"down":e==="up"?"up":"steady"}`} over ${r} visits`}o(Nt,"trajectoryLabel");function se(e){let r=e.replace(/_/g," ").trim();return r.length===0?e:r.charAt(0).toUpperCase()+r.slice(1)}o(se,"humanize");var sr=Object.freeze({general:"General / attitude",eent:"Eyes, ears, nose & throat",oral_dental:"Oral & dental",cardiovascular:"Cardiovascular",respiratory:"Respiratory",gastrointestinal:"GI / abdomen",urogenital:"Urogenital",musculoskeletal:"Musculoskeletal",neurologic:"Neurologic",integument:"Skin & coat",lymphatic:"Lymph nodes"});function ur(e){return Object.prototype.hasOwnProperty.call(sr,e)?sr[e]:se(e)}o(ur,"bodySystemLabel");var lr=Object.freeze({reason_for_visit:"Reason for visit",subjective:"Subjective",objective:"Objective",assessment:"Assessment",plan:"Plan",discharge_instructions:"Discharge instructions",follow_up:"Follow-up",remarks:"Notes"});function cr(e){return Object.prototype.hasOwnProperty.call(lr,e)?lr[e]:se(e)}o(cr,"soapSectionLabel");function pr(e){return e===null||!Number.isFinite(e)?"-":`${e.toFixed(3).replace(/\.?0+$/,"")} kg`}o(pr,"formatWeightKg");function fr(e,r,t){if((e===null||!Number.isFinite(e))&&t)return t;if(e===null||!Number.isFinite(e))return "-";let n=e.toFixed(3).replace(/\.?0+$/,"");return r?`${n} ${r}`:n}o(fr,"formatMarkerReading");function mr(e,r,t){let n=Nt(r,t);return e?`${h.measured(w(e))}${n?` \xB7 ${n}`:""}`:n}o(mr,"labDetailLine");var le=Object.freeze({visit:0,vaccine:1,weight:2,medication:3});function yr(e){if(!e)return null;let r=Date.parse(e);return Number.isNaN(r)?null:r}o(yr,"toMillis");function _e(e){let r=[...e.visits.map((t,n)=>({key:`visit-${n}-${t.visitId}`,kind:"visit",kindLabel:h.kind.visit,at:t.visitDate,date:w(t.visitDate),title:t.summary??h.clinicVisit,detail:t.veterinarian?h.doctor(t.veterinarian):null,docId:t.docId})),...e.vaccines.map((t,n)=>{let i=[];return t.lot&&i.push(h.lot(t.lot)),t.expiresOn&&i.push(h.expires(w(t.expiresOn))),{key:`vaccine-${n}-${t.vaccineId}`,kind:"vaccine",kindLabel:h.kind.vaccine,at:t.administeredOn,date:w(t.administeredOn),title:t.product||h.kind.vaccine,detail:i.length?i.join(" \xB7 "):null,docId:t.docId}}),...e.weights.map((t,n)=>({key:`weight-${n}-${t.weightId}`,kind:"weight",kindLabel:h.kind.weight,at:t.observedOn,date:w(t.observedOn),title:pr(t.weightKg),detail:null,docId:t.docId})),...e.medications.map((t,n)=>{let i=[t.dose,t.route,t.frequency].filter(s=>!!s);return {key:`medication-${n}-${t.medicationId}`,kind:"medication",kindLabel:h.kind.medication,at:t.startedOn,date:w(t.startedOn),title:t.drugName||h.kind.medication,detail:i.length?i.join(" \xB7 "):null,docId:t.docId}})];return Object.freeze(r.sort((t,n)=>{let i=yr(t.at),s=yr(n.at);return i===null&&s===null?le[t.kind]-le[n.kind]:i===null?1:s===null?-1:s!==i?s-i:le[t.kind]-le[n.kind]}))}o(_e,"buildTimelineRows");var Ee=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(Ee.map(e=>e.wireCode));var Lt=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"}),br=Object.freeze(Ee.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Lt[e.wireCode]}))),Mt=new Map(br.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),qt=Object.freeze(["http_envelope",...[...new Set(br.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function de(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let n of [r??"http_envelope",...qt]){let i=Mt.get(n+t);if(i)return i}}o(de,"contractErrorFor");function Ut(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Ut,"contractDocUrl");function hr(e){return null}o(hr,"publishedDocUrl");var Bt=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 vr(e){return Bt[e]}o(vr,"categoryFor");function Rr(e){let r=de(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),n=t.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(t.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":case "TELEVETRATELIMITED":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "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"}}o(Rr,"fromWire");var $t=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function xe(e){return $t.has(e)}o(xe,"isAutoRetryable");var Ht=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function _r(e){return xe(e)||Ht.has(e)}o(_r,"isRetryableCode");var Vt=500,Se=8e3,Er=4;function xr(e,r=Math.random){let t=Math.max(0,e),n=Math.min(Vt*2**t,Se);return Math.floor(r()*n)}o(xr,"backoffDelayMs");var Wt=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 Ce(e){return Wt[e]}o(Ce,"userFacingError");function Sr(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}o(Sr,"defineHidden");var Yt=/^[a-z][a-z0-9_]{0,63}$/;function j(e,r){let t=de(r?.wireCode,r?.wireEnvelope),n={code:e,category:vr(e),retryable:r?.retryable??_r(e),displayMessage:Ce(e)};if(r?.httpStatus!==void 0&&(n.httpStatus=r.httpStatus),r?.requestId&&(n.requestId=r.requestId),typeof r?.reasonCode=="string"&&Yt.test(r.reasonCode)&&(n.reasonCode=r.reasonCode),t);return r?.wireMessage&&Sr(n,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&Sr(n,"raw",r.raw),Object.freeze(n)}o(j,"makeEverfurError");function Cr(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(Cr,"assertNever");function wr(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})}o(wr,"errorFrame");function Xt(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}o(Xt,"authHeaders");function ee(e,r){return {...e,headers:{...Qt(e.headers),...Xt(r)}}}o(ee,"withAuthHeaders");function Qt(e){if(!e)return {};let r={};for(let[t,n]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=n);}return r}o(Qt,"stripAuthHeaders");async function Tr(e,r){if(r.mode==="anonymous")return r.transport.request(ee(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return O(we())}let n=await r.transport.request(ee(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return O(we())}let s=await r.transport.request(ee(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?O(we(s.error.httpStatus)):s}o(Tr,"authedSend");function we(e){return j("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(we,"authRejectedError");function kr(e){return j("internalError",{retryable:true,wireMessage:Jt(e)})}o(kr,"networkError");function Jt(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(Jt,"describeCause");var Zt=3e4,en=Se*2,rn="idempotency-key",tn=new Set(["POST","PUT","PATCH","DELETE"]),nn=Object.freeze({onEvent(){}}),on=Object.freeze({setTimeout:o((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function an(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}o(an,"seededIdempotencyKey");function Pr(e){let r=e.observer??nn,t=e.timers??on,n=e.rng??Math.random,i=e.sleep??((g,b)=>Rn(g,t,b)),s=e.maxAttempts??Er,c=e.unaryTimeoutMs??Zt,d=e.newIdempotencyKey??ln(),a=o(g=>{try{r.onEvent(g);}catch{}},"emit");async function u(g,b,E){let T=E?.maxAttempts,U=Math.max(1,T??s),ge=E?.idempotent??tn.has(b.method),G=E?.idempotencyKey===void 0?null:an(E.idempotencyKey),be=ge?G??d():null,Ot=sn(b,be),he=0;for(;;){let X=o(Re=>Object.freeze({call:g,method:b.method,path:b.path,attempt:he,...be?{idempotencyKey:be}:{},...Re}),"stamp");a(X({phase:"attempt"}));let Xe=hn(c,t),Qe=vn(Xe.signal,b.signal),Q;try{Q=await Tr({...Ot,signal:Qe.signal},e.auth);}catch(Re){Q=O(kr(Re));}finally{Qe.dispose(),Xe.cancel();}if(Q.ok)return a(X({phase:"settled",ok:true,reason:"ok"})),Q;let z=Q.error,ie=un(z,he,{maxAttempts:U,rng:n,now:t.now(),aborted:b.signal?.aborted===true,...T!==void 0?{perCallMaxAttempts:T}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),ve={ok:false,code:z.code,reason:ie.reason,...z.httpStatus!==void 0?{httpStatus:z.httpStatus}:{},...z.requestId!==void 0?{requestId:z.requestId}:{}};if(!ie.retry)return a(X({phase:"settled",...ve})),O(z);if(a(X({phase:"retry",...ve,delayMs:ie.delayMs})),await i(ie.delayMs,b.signal),b.signal?.aborted===true)return a(X({phase:"settled",...ve,reason:"aborted"})),O(z);he+=1;}}o(u,"send");async function f(g){return ee(g,await bn(e.auth))}o(f,"authorize");async function*v(g,b,E){a(Object.freeze({call:g,phase:"stream.open",method:b.method,path:b.path,attempt:0}));try{yield*e.auth.transport.stream(b,E);}catch{yield wr({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(v,"stream"),Object.freeze({send:u,authorize:f,stream:v})}o(Pr,"createRequestFunnel");function sn(e,r){let t={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==rn&&(t[n]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}o(sn,"assembleHeaders");function ln(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(ln,"defaultIdempotencyKeyFactory");var dn=10;function un(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let n=cn(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!xe(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let c=o(()=>{if(t.policy===void 0)return null;let u;try{u=t.policy.maxAttempts(e.code);}catch{return null}return typeof u!="number"||!Number.isFinite(u)?null:Math.max(1,Math.min(dn,Math.floor(u)))},"policyCeiling"),d=t.perCallMaxAttempts??c()??t.maxAttempts;if(r+1>=d)return {retry:false,reason:"attempts-exhausted"};let a=pn(e,t.now);return a!==null?a>en?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:a}:{retry:true,reason:i,delayMs:xr(r,t.rng)}}o(un,"decideRetry");function cn(e){let r=e.code==="unknown"?Rr(gn(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}o(cn,"throttleKind");function pn(e,r){let t=mn(e.raw);if(t!==null){let i=t-r;return i>0?i:0}let n=fn(e.raw);return n===null?null:Math.round(n*1e3)}o(pn,"retryOverrideMs");function fn(e){for(let r of Te(e)){let t=r.retry_after_seconds;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t}return null}o(fn,"findRetryAfterSeconds");function mn(e){for(let r of Te(e)){let t=r.resets_at,n=yn(t);if(n!==null)return n}return null}o(mn,"findResetsAt");function Te(e){if(!Or(e))return [];let r=[e];for(let t of ["error","detail"]){let n=e[t];Or(n)&&r.push(n);}return r}o(Te,"candidateScopes");function yn(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 r=Date.parse(e);return Number.isFinite(r)?r:null}return null}o(yn,"parseInstantMs");function gn(e){for(let r of Te(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}o(gn,"rawWireCode");function Or(e){return typeof e=="object"&&e!==null}o(Or,"isRecord");async function bn(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}:{}}}o(bn,"resolveDeviceAuth");function hn(e,r){let t=new AbortController,n=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:o(()=>r.clearTimeout(n),"cancel")}}o(hn,"boundedSignal");function vn(e,r){let t=o(()=>{},"noop");if(!r)return {signal:e,dispose:t};let n=new AbortController;if(e.aborted||r.aborted)return n.abort(),{signal:n.signal,dispose:t};let i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}o(vn,"mergeSignals");function Rn(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(n=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",s),n();},e),s=o(()=>{r.clearTimeout(i),n();},"onAbort");t?.addEventListener("abort",s,{once:true});})}o(Rn,"delayAbortable");function Fr(e){for(let r=0;r<e.length;r+=1){let t=e.charCodeAt(r);if(t>=55296&&t<=56319){let n=e.charCodeAt(r+1);if(!(n>=56320&&n<=57343))return true;r+=1;}else if(t>=56320&&t<=57343)return true}return false}o(Fr,"hasLoneSurrogate");var Dr=64,Ir=512;function En(e){return e==="owner_reported"||e==="clinic_document"?e:null}o(En,"normalizeOrigin");z.object({request_id:z.string().min(1),pet_ref:z.string().min(1),status:z.string(),simple_status:z.string().nullish(),simple_status_detail:z.string().nullish(),status_label:z.string().optional(),dispatch_status:z.string().nullish(),can_retry_send:z.boolean().optional(),can_revoke:z.boolean().optional(),can_convert_to_upload:z.boolean().optional(),can_update_clinic_email:z.boolean().optional(),reminder_count:z.number().int().nonnegative().optional(),last_reminder_at:z.string().nullish(),waiting_expectation:z.string().nullish(),document_count:z.number().optional(),held_item_count:z.number().optional(),received_at:z.string().nullish(),parsing_started_at:z.string().nullish(),review_started_at:z.string().nullish(),created_at:z.string().optional(),updated_at:z.string().optional(),source:z.string().nullish().catch(null),action_needed_label:z.string().nullish().catch(null),failure_reason:z.string().nullish().catch(null),failure_code:z.string().nullish().catch(null),recovery_stage:z.string().nullish().catch(null),show_clinic_phone:z.boolean().optional().catch(void 0),clinic_name:z.string().nullish().catch(null),clinic_email:z.string().nullish().catch(null),clinic_phone:z.string().nullish().catch(null),converted_to_upload_at:z.string().nullish().catch(null),request_group_id:z.string().nullish().catch(null)}).passthrough();z.object({request_group_id:z.string().min(1),pet_ref:z.string().min(1),total:z.number().int().nonnegative(),responded:z.number().int().nonnegative(),pending:z.number().int().nonnegative(),members:z.array(z.unknown())});z.object({source_doc_id:z.string().min(1),request_id:z.string().min(1)});var xn=z.object({label:z.string(),value:z.string()}),ke=z.object({key:z.string(),category:z.string().optional(),label:z.string().optional(),value:z.string().nullish(),unit:z.string().nullish(),observed_at:z.string().nullish(),status:z.string().nullish(),origin:z.string().nullish(),canonical_key:z.string().nullish()}),Sn=z.object({at:z.string(),value:z.number().nullish(),display:z.string().nullish(),origin:z.string().nullish()}),Cn=z.object({key:z.string(),label:z.string().optional(),points:z.array(Sn).optional()}),wn=z.object({title:z.string(),detail:z.string().nullish(),due_at:z.string().nullish()}),Oe=z.object({doc_id:z.string(),title:z.string().nullish(),page_count:z.number().nullish(),received_at:z.string().nullish()});function zr(e){return Object.freeze({key:e.key,category:e.category??"",label:e.label??e.key,value:e.value??null,unit:e.unit??null,observedAt:e.observed_at??null,status:e.status??null,origin:En(e.origin),canonicalKey:e.canonical_key??null})}o(zr,"mapEntityRow");function Ar(e){return Object.freeze({docId:e.doc_id,title:e.title??null,pageCount:e.page_count??null,receivedAt:e.received_at??null})}o(Ar,"mapDocumentRow");z.object({identity:z.array(xn).optional(),entities:z.array(ke).optional(),entity_series:z.array(Cn).optional(),forward_looking:z.array(wn).optional(),documents:z.array(Oe).optional()});z.object({pet_ref:z.string().optional(),granted:z.boolean().optional(),version:z.string().nullish(),granted_at:z.string().nullish()});var R=z.string().nullish(),ue=z.number().nullish(),Tn=z.object({collected_at:R,at:R,value:ue,unit:R,qualitative_result:R,ref_low:ue,ref_high:ue,status:R,source_clinic:R,source_doc_id:R,doc_id:R,reviewed:z.boolean().nullish()}),kn=z.object({collected_at:R,at:R,value:ue,unit:R,qualitative_result:R,status:R}),On=z.object({marker_id:z.string().min(1),canonical_name:R,name:R,loinc_code:R,canonical_unit:R,unit:R,panel_name:R,panel:R,meaning_text:R,meaning:R,latest:kn.nullish(),trajectory:R,points:z.array(Tn).optional()}),Pn=z.object({total_markers:z.number().int().nonnegative(),in_range_count:z.number().int().nonnegative(),out_of_range_count:z.number().int().nonnegative(),unknown_count:z.number().int().nonnegative()}),Fn=z.object({markers:z.array(On).optional(),summary:Pn.nullish(),disclaimer:z.string().optional(),featured_marker_id:R});function Dn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Dn,"isObject");function jr(e){return Object.freeze({petRef:e,withheld:true,markers:Object.freeze([]),summary:null,disclaimer:"",featuredMarkerId:null})}o(jr,"withheldMarkers");function Nr(e,r){let t=Dn(r)?r:{},n=typeof t.pet_ref=="string"&&t.pet_ref.length>0?t.pet_ref:e;if(t.withheld===true)return jr(n);let i=Fn.safeParse(t);if(!i.success)return jr(n);let s=i.data,c=o(a=>Object.freeze({at:a.collected_at??a.at??null,value:a.value??null,unit:a.unit??null,qualitativeResult:a.qualitative_result??null,refLow:a.ref_low??null,refHigh:a.ref_high??null,status:a.status??null,sourceClinic:a.source_clinic??null,docId:a.source_doc_id??a.doc_id??null,reviewed:a.reviewed===true}),"point"),d=(s.markers??[]).map(a=>Object.freeze({markerId:a.marker_id,name:a.canonical_name??a.name??a.marker_id,loincCode:a.loinc_code??null,unit:a.canonical_unit??a.unit??null,panel:a.panel_name??a.panel??null,meaning:a.meaning_text??a.meaning??null,latest:a.latest?Object.freeze({at:a.latest.collected_at??a.latest.at??null,value:a.latest.value??null,unit:a.latest.unit??null,qualitativeResult:a.latest.qualitative_result??null,status:a.latest.status??null}):null,trajectory:a.trajectory??null,points:Object.freeze((a.points??[]).map(c))}));return Object.freeze({petRef:n,withheld:false,markers:Object.freeze(d),summary:s.summary?Object.freeze({totalMarkers:s.summary.total_markers,inRangeCount:s.summary.in_range_count,outOfRangeCount:s.summary.out_of_range_count,unknownCount:s.summary.unknown_count}):null,disclaimer:s.disclaimer??"",featuredMarkerId:s.featured_marker_id??null})}o(Nr,"mapRecordMarkers");var Lr=128,N=128;var In=z.string().min(1).refine(e=>e.startsWith("https://")),zn=z.object({source_doc_id:z.string().min(1),file_name:z.string().nullish(),doc_format:z.string().nullish(),byte_size:z.number().int().nonnegative().nullish(),received_at:z.string().nullish(),download_url:In,expires_in_seconds:z.number().int().nonnegative().nullish()}),An=z.object({items:z.array(z.unknown()).optional()});function Mr(e){let r=An.safeParse(e);if(!r.success)return null;let t=[];for(let n of r.data.items??[]){let i=zn.safeParse(n);i.success&&t.push(Object.freeze({sourceDocId:i.data.source_doc_id,fileName:i.data.file_name??null,docFormat:i.data.doc_format??null,byteSize:i.data.byte_size??null,receivedAt:i.data.received_at??null,downloadUrl:i.data.download_url,expiresInSeconds:i.data.expires_in_seconds??0}));}return Object.freeze(t)}o(Mr,"mapRequestDocuments");var jn=z.string().min(1).refine(e=>e.startsWith("https://")),re=z.string().nullish(),Nn=z.object({share_id:z.string().min(1),share_url:z.string().min(1),expires_at:re}),Ln=z.object({shares:z.array(z.object({share_id:z.string().min(1),expires_at:re,created_at:re,view_count:z.number().int().nonnegative().nullish(),last_viewed_at:re})).optional()}),Mn=z.object({download_url:jn,expires_at:re});function qn(e,r){let t=e.trim();if(t.length===0)return null;try{let n=/^[a-z][a-z0-9+.-]*:/i.test(t)?new URL(t):r!==void 0?new URL(t,r):null;return n===null||n.protocol!=="https:"?null:n.toString()}catch{return null}}o(qn,"resolveShareUrl");function qr(e,r){let t=Nn.safeParse(e);if(!t.success)return null;let n=qn(t.data.share_url,r);return n===null?null:Object.freeze({shareId:t.data.share_id,shareUrl:n,expiresAt:t.data.expires_at??null})}o(qr,"mapRecordShareLink");function Ur(e){let r=Ln.safeParse(e);return r.success?Object.freeze((r.data.shares??[]).map(t=>Object.freeze({shareId:t.share_id,expiresAt:t.expires_at??null,createdAt:t.created_at??null,viewCount:t.view_count??0,lastViewedAt:t.last_viewed_at??null}))):null}o(Ur,"mapRecordShareList");function Br(e){let r=Mn.safeParse(e);return r.success?Object.freeze({downloadUrl:r.data.download_url,expiresAt:r.data.expires_at??null}):null}o(Br,"mapRecordPdfLink");var Un=z.object({signatures:z.array(z.object({signature_id:z.string().min(1),preview_url:z.string().min(1).refine(e=>e.startsWith("https://")),created_at:z.string().nullish()})).optional()});function $r(e){let r=Un.safeParse(e);return r.success?Object.freeze((r.data.signatures??[]).map(t=>Object.freeze({signatureId:t.signature_id,previewUrl:t.preview_url,createdAt:t.created_at??null}))):null}o($r,"mapSignatureSuggestions");var y=z.string().nullish(),te=z.number().nullish(),Bn=z.object({at:y,value:te,unit:y,qualitative_result:y,ref_low:te,ref_high:te,status:y,doc_id:y}),$n=z.object({marker_id:z.string(),name:z.string(),loinc_code:y,unit:y,panel:y,meaning:y,latest:z.object({at:y,value:te,unit:y,qualitative_result:y,status:y}).nullish(),trajectory:y,points:z.array(Bn).optional()}),Hn=z.object({encounter_id:z.string(),date:y,type:y,clinic_name:y,veterinarian:y,doc_id:y}),Vn=z.object({note_id:z.string(),encounter_id:y,observed_on:y,sections:z.array(z.object({section:z.string(),text:z.string()})).optional()}),Wn=z.object({exam_id:z.string(),encounter_id:y,observed_on:y,doc_id:y,systems:z.record(z.object({finding_status:y,finding:y})).optional()}),Yn=z.object({has_lab_history:z.boolean().optional(),has_vaccination_history:z.boolean().optional(),has_weight_history:z.boolean().optional(),has_vitals_history:z.boolean().optional(),has_physical_exam_history:z.boolean().optional(),has_procedure_history:z.boolean().optional(),has_genetic_history:z.boolean().optional(),has_reproductive_history:z.boolean().optional(),has_parasite_prevention_history:z.boolean().optional(),earliest_record_at:y,latest_record_at:y,documents_ingested:z.number().int().nonnegative().optional(),documents_in_review:z.number().int().nonnegative().optional(),entities_pending_review:z.record(z.number().int().nonnegative()).optional(),held_total:z.number().int().nonnegative().optional()}),Kn=z.object({conflict_id:z.string(),entity_type:z.string(),field:y,severity:y,candidates:z.array(z.object({value:z.string(),source_doc_id:y,doc_id:y,collected_at:y})).optional()}),Gn=z.object({lab_results:z.array($n).optional(),encounters:z.array(Hn).optional(),clinician_notes:z.array(Vn).optional(),physical_exams:z.array(Wn).optional(),completeness:Yn.nullish(),conflicts:z.array(Kn).optional()}),Xn=z.object({visits:z.array(z.object({visit_id:z.string(),visit_date:y,veterinarian:y,summary:y,doc_id:y})),vaccines:z.array(z.object({vaccine_id:z.string(),product:y,lot:y,administered_on:y,expires_on:y,doc_id:y})),weights:z.array(z.object({weight_id:z.string(),observed_on:y,weight_kg:te,doc_id:y})),medications:z.array(z.object({medication_id:z.string(),drug_name:y,dose:y,route:y,frequency:y,sig:y,rx_number:y,started_on:y,stopped_on:y,doc_id:y})),disclaimer:z.string().optional()}),Qn=z.object({document:Oe,contributions:z.array(ke),contribution_count:z.number().int().nonnegative().optional()});function Fe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Fe,"isObject");function De(e,r){return typeof e.pet_ref=="string"&&e.pet_ref.length>0?e.pet_ref:r}o(De,"petOf");function Pe(e,r){return Object.freeze({petRef:e,available:false,withheld:r,labResults:Object.freeze([]),encounters:Object.freeze([]),clinicianNotes:Object.freeze([]),physicalExams:Object.freeze([]),completeness:null,conflicts:Object.freeze([])})}o(Pe,"emptyDepth");function Vr(e,r){let t=Fe(r)?r:{},n=De(t,e);if(t.withheld===true)return Pe(n,true);if(!["lab_results","encounters","clinician_notes","physical_exams","completeness","conflicts"].some(a=>a in t))return Pe(n,false);let s=Gn.safeParse(t);if(!s.success)return Pe(n,true);let c=s.data,d=o(a=>Object.freeze({at:a.at??null,value:a.value??null,unit:a.unit??null,qualitativeResult:a.qualitative_result??null,refLow:a.ref_low??null,refHigh:a.ref_high??null,status:a.status??null,docId:a.doc_id??null}),"point");return Object.freeze({petRef:n,available:true,withheld:false,labResults:Object.freeze((c.lab_results??[]).map(a=>Object.freeze({markerId:a.marker_id,name:a.name,loincCode:a.loinc_code??null,unit:a.unit??null,panel:a.panel??null,meaning:a.meaning??null,latest:Object.freeze({at:a.latest?.at??null,value:a.latest?.value??null,unit:a.latest?.unit??null,qualitativeResult:a.latest?.qualitative_result??null,status:a.latest?.status??null}),trajectory:a.trajectory??null,points:Object.freeze((a.points??[]).map(d))}))),encounters:Object.freeze((c.encounters??[]).map(a=>Object.freeze({encounterId:a.encounter_id,date:a.date??null,type:a.type??null,clinicName:a.clinic_name??null,veterinarian:a.veterinarian??null,docId:a.doc_id??null}))),clinicianNotes:Object.freeze((c.clinician_notes??[]).map(a=>Object.freeze({noteId:a.note_id,encounterId:a.encounter_id??null,observedOn:a.observed_on??null,sections:Object.freeze((a.sections??[]).map(u=>Object.freeze({section:u.section,text:u.text})))}))),physicalExams:Object.freeze((c.physical_exams??[]).map(a=>Object.freeze({examId:a.exam_id,encounterId:a.encounter_id??null,observedOn:a.observed_on??null,docId:a.doc_id??null,systems:Object.freeze(Object.entries(a.systems??{}).map(([u,f])=>Object.freeze({system:u,findingStatus:f.finding_status??null,finding:f.finding??null})))}))),completeness:c.completeness?Object.freeze({hasLabHistory:c.completeness.has_lab_history===true,hasVaccinationHistory:c.completeness.has_vaccination_history===true,hasWeightHistory:c.completeness.has_weight_history===true,hasVitalsHistory:c.completeness.has_vitals_history===true,hasPhysicalExamHistory:c.completeness.has_physical_exam_history===true,hasProcedureHistory:c.completeness.has_procedure_history===true,hasGeneticHistory:c.completeness.has_genetic_history===true,hasReproductiveHistory:c.completeness.has_reproductive_history===true,hasParasitePreventionHistory:c.completeness.has_parasite_prevention_history===true,earliestRecordAt:c.completeness.earliest_record_at??null,latestRecordAt:c.completeness.latest_record_at??null,documentsIngested:c.completeness.documents_ingested??0,documentsInReview:c.completeness.documents_in_review??0,entitiesPendingReview:Object.freeze({...c.completeness.entities_pending_review??{}}),heldTotal:c.completeness.held_total??0}):null,conflicts:Object.freeze((c.conflicts??[]).map(a=>Object.freeze({conflictId:a.conflict_id,entityType:a.entity_type,field:a.field??null,severity:a.severity??"needs_review",candidates:Object.freeze((a.candidates??[]).map(u=>Object.freeze({value:u.value,docId:u.source_doc_id??u.doc_id??null,collectedAt:u.collected_at??null})))})))})}o(Vr,"mapRecordDepth");function Hr(e){return Object.freeze({petRef:e,withheld:true,isEmpty:false,visits:Object.freeze([]),vaccines:Object.freeze([]),weights:Object.freeze([]),medications:Object.freeze([]),disclaimer:""})}o(Hr,"withheldTimeline");function Wr(e,r){let t=Fe(r)?r:{},n=De(t,e);if(t.withheld===true)return Hr(n);let i=Xn.safeParse(t);if(!i.success)return Hr(n);let s=i.data,c=s.visits.map(f=>Object.freeze({visitId:f.visit_id,visitDate:f.visit_date??null,veterinarian:f.veterinarian??null,summary:f.summary??null,docId:f.doc_id??null})),d=s.vaccines.map(f=>Object.freeze({vaccineId:f.vaccine_id,product:f.product??null,lot:f.lot??null,administeredOn:f.administered_on??null,expiresOn:f.expires_on??null,docId:f.doc_id??null})),a=s.weights.map(f=>Object.freeze({weightId:f.weight_id,observedOn:f.observed_on??null,weightKg:f.weight_kg??null,docId:f.doc_id??null})),u=s.medications.map(f=>Object.freeze({medicationId:f.medication_id,drugName:f.drug_name??null,dose:f.dose??null,route:f.route??null,frequency:f.frequency??null,sig:f.sig??null,rxNumber:f.rx_number??null,startedOn:f.started_on??null,stoppedOn:f.stopped_on??null,docId:f.doc_id??null}));return Object.freeze({petRef:n,withheld:false,isEmpty:c.length===0&&d.length===0&&a.length===0&&u.length===0,visits:Object.freeze(c),vaccines:Object.freeze(d),weights:Object.freeze(a),medications:Object.freeze(u),disclaimer:s.disclaimer??""})}o(Wr,"mapRecordsTimeline");function Yr(e,r){let t=Fe(r)?r:{},n=De(t,e),i=o(()=>Object.freeze({petRef:n,withheld:true,document:null,contributions:Object.freeze([]),contributionCount:0}),"withheld");if(t.withheld===true)return i();let s=Qn.safeParse(t);if(!s.success)return i();let c=Object.freeze(s.data.contributions.map(zr));return Object.freeze({petRef:n,withheld:false,document:Ar(s.data.document),contributions:c,contributionCount:s.data.contribution_count??c.length})}o(Yr,"mapDocumentContributions");var Jn="/widget/v1/records/pets";function Kr(e){let r=e.funnel??Pr({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=o((a,u)=>typeof a=="string"&&a.length>0&&!Fr(a)&&[...a].length<=u,"segment"),n=o(async(a,u,f,v)=>{if(!t(u,N))return I();let g=await r.send(a,{method:"GET",path:f});if(!g.ok)return g;let b=v(g.value);return b.petRef===u?$(b):O(j("internalError",{retryable:false}))},"read"),i=o(a=>`${Jn}/${encodeURIComponent(a)}`,"pet"),s=o(a=>`${i(a)}/everfur_record`,"record"),c=o(async(a,u,f)=>{let v=await r.send(a,u,u.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!v.ok)return v;let g=f(v.value);return g===null?O(j("internalError",{retryable:false})):$(g)},"parsed"),d=o((a,u)=>!t(a.entityType,Dr)||!t(a.canonicalKey,Ir)||a.idempotencyKey!==void 0&&!t(a.idempotencyKey,Lr)||u!==void 0&&Object.keys(u).length===0?null:{entity_type:a.entityType,canonical_key:a.canonicalKey,...u!==void 0?{corrected_fields:u}:{},...a.idempotencyKey!==void 0?{idempotency_key:a.idempotencyKey}:{}},"factBody");return {getRecordDepth:o(a=>n("records.depth.record",a,`${i(a)}/record`,u=>Vr(a,u)),"getRecordDepth"),getTimeline:o(a=>n("records.depth.timeline",a,`${i(a)}/timeline`,u=>Wr(a,u)),"getTimeline"),getDocumentContributions(a,u){return t(u,64)?n("records.depth.contributions",a,`${i(a)}/documents/${encodeURIComponent(u)}/contributions`,f=>Yr(a,f)):I()},getMarkers:o(a=>n("records.depth.markers",a,`${i(a)}/markers`,u=>Nr(a,u)),"getMarkers"),createShare(a){return t(a,N)?c("records.share.create",{method:"POST",path:`${s(a)}/share`},u=>qr(u,e.apiBaseUrl)):I()},listShares(a){return t(a,N)?c("records.share.list",{method:"GET",path:`${s(a)}/shares`},Ur):I()},async revokeShare(a,u){if(!t(a,N)||!t(u,64))return I();let f=await r.send("records.share.revoke",{method:"DELETE",path:`${s(a)}/shares/${encodeURIComponent(u)}`},{idempotent:false,maxAttempts:1});return f.ok?$(void 0):f},getPdfLink(a){return t(a,N)?c("records.pdf.link",{method:"GET",path:`${s(a)}/pdf-link`},Br):I()},async editFact(a,u){let f=t(a,N)?d(u,u.correctedFields):null;if(f===null)return I();let v=await r.send("records.fact.edit",{method:"POST",path:`${s(a)}/facts/edit`,body:f},{idempotent:false,maxAttempts:1});return v.ok?$(void 0):v},async removeFact(a,u){let f=t(a,N)?d(u):null;if(f===null)return I();let v=await r.send("records.fact.remove",{method:"POST",path:`${s(a)}/facts/remove`,body:f},{idempotent:false,maxAttempts:1});return v.ok?$(void 0):v},listRequestDocuments(a){return t(a,64)?c("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(a)}/documents`},Mr):I()},listAuthorizationSignatures:o(()=>c("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},$r),"listAuthorizationSignatures")}}o(Kr,"createRecordsDepthClient");function I(){return Promise.resolve(O(j("validationFailed",{retryable:false})))}o(I,"invalid");var ro=new Map,Gr=new Set;function to(e){return ro.get(e)??0}o(to,"recordsConsentEpochOf");function no(e){return Gr.add(e),()=>{Gr.delete(e);}}o(no,"subscribe");function Xr(e){let r=useCallback(()=>to(e),[e]);return useSyncExternalStore(no,r,r)}o(Xr,"useRecordsConsentEpoch");function Jr(){let{runtime:e,userRef:r,scopeEpoch:t}=M();return useMemo(()=>{let{services:n}=e.registry;return Kr({auth:n.authFor(r),...n.errorPolicy?{errorPolicy:n.errorPolicy}:{},...typeof n.apiBaseUrl=="string"?{apiBaseUrl:n.apiBaseUrl}:{}})},[e,r,t])}o(Jr,"useEverfurRecordsDepthClient");function ne(e,r,t,n=""){let i=Jr(),{userRef:s}=M(),c=Xr(e),d=useMemo(()=>({}),[i,e,n,c]),[a,u]=useState({scope:d,value:null,error:null,loading:true}),f=useRef(0),v=useCallback(async()=>{let ge=f.current+=1;if(u({scope:d,value:null,error:null,loading:true}),s===null){u({scope:d,value:null,error:null,loading:false});return}let G=await r(i,e);ge===f.current&&(G.ok?u({scope:d,value:G.value,error:null,loading:false}):u({scope:d,value:null,error:G.error,loading:false}));},[i,e,r,d,s]);useEffect(()=>(v(),()=>{f.current+=1;}),[v]);let g=a.scope===d?a:{value:null,error:null,loading:true},b=useCallback(()=>{v();},[v]),E=g.error===null||g.error.httpStatus!==404,T=E?g.error:null,U=g.loading?"loading":T!==null?"error":g.value===null?"empty":g.value.withheld?"populated":t(g.value)?"empty":"populated";return useMemo(()=>({status:U,value:g.value,error:T,available:E,refresh:b}),[U,g.value,T,E,b])}o(ne,"useRecordsDepthRead");var je=class je extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(t,n){return Object.is(t.resetKey,n.key)?null:{failed:false,key:t.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(je,"HostRenderBoundary");var ze=je;function lo({render:e}){return e()}o(lo,"RenderHost");function Ae({render:e,fallback:r,resetKey:t}){return createElement(ze,{fallback:r,resetKey:t,children:createElement(lo,{render:e})})}o(Ae,"HostRender");function Me(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))Me(e[r]);}return e}o(Me,"deepFreeze");var uo=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),rt={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},tt={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},et={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},co={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},po={regular:"400",medium:"500",bold:"700"},fo={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},mo=0,ce="System",pe="monospace",yo=["content","heading","control","compact","badge"];function go(e){let r={};for(let t of yo)r[t]=e;return r}o(go,"authoredTierSizes");function nt(){return {family:ce,mono:pe,fontUrl:null,families:{regular:ce,medium:ce,bold:ce,mono:pe,monoMedium:pe,monoBold:pe},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:et,tierSizes:go(et),lineHeight:co,weight:po,letterSpacing:fo,scale:1,maxScale:mo,scaleCaps:uo}}o(nt,"baseType");var ot={},Ne=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function Le(e){return `cubic-bezier(${e.join(", ")})`}o(Le,"cssCubicBezier");var it={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:Le(Ne.standard),emphasized:Le(Ne.emphasized),exit:Le(Ne.exit)},reducedMotion:false},bo={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)"},at=Me({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:bo,space:rt,radius:tt,type:nt(),motion:it,slots:ot}),ho={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)"};Me({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ho,space:rt,radius:tt,type:nt(),motion:it,slots:ot});var st=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),lt=globalThis,qe=lt[st]??(lt[st]=createContext(at));qe.displayName??="EverfurThemeContext";function C(){return useContext(qe)}o(C,"useEverfurTheme");var dt=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var ut='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',_o="System";function Eo(e){let r=e.trim();return r.length===0||r===_o?ut:`${ct(r)}, ${ut}`}o(Eo,"cssFontFamily");function xo(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${ct(r)}, ui-monospace, Menlo, Consolas, monospace`}o(xo,"cssMonoFamily");function ct(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}o(ct,"quote");function _(e,r){let t=e.type,n=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?xo(n):Eo(n),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[dt[r]]}}o(_,"faceCss");var V=Object.freeze({textAlign:"start"});var So=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 Co(e){return So[e]}o(Co,"requires");function pt(e,r,t){let n=Co(e),i=new Map;for(let d of r)i.set(d.resource,d);if(t?.isPending===true&&n.some(d=>!i.has(d)))return Ue({name:e,enabled:false,isPending:true,limits:{}});let s=wo(n,i);return n.filter(d=>i.get(d)?.granted!==true).length===0?Ue({name:e,enabled:true,isPending:false,limits:s}):Ue({name:e,enabled:false,isPending:false,limits:s,disabled:To(n,i)})}o(pt,"decideCapability");function wo(e,r){let t={};for(let n of e){let i=r.get(n)?.limits;if(i)for(let[s,c]of Object.entries(i)){let d=t[s];t[s]=d===void 0?c:Math.min(d,c);}}return t}o(wo,"mergeLimits");function To(e,r){for(let t of e){let n=r.get(t)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:Ce("accessDenied"),level:"user_entitlement",recoverable:false})}o(To,"disabledFor");function Ue(e){let r={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(r.disabled=e.disabled),Object.freeze(r)}o(Ue,"freezeDecision");function Be(e){let{runtime:r}=M(),t=r.entitlements,n=useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return useMemo(()=>pt(e,n.decisions,{isPending:n.isPending}),[e,n])}o(Be,"useCapability");var Po=48;function Fo(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(Fo,"selectView");function yt(e){let{capability:r,children:t,renderDisabled:n,renderPending:i,style:s,className:c}=e,d=Be(r),a=useMemo(()=>Fo(d),[d]);switch(a){case "enabled":return t;case "pending":return i?jsx(Ae,{render:i,fallback:jsx(ft,{capability:r,style:s,className:c})}):jsx(ft,{capability:r,style:s,className:c});case "disabled":return n?jsx(Ae,{render:()=>n(d),fallback:jsx(mt,{decision:d,style:s,className:c}),resetKey:d}):jsx(mt,{decision:d,style:s,className:c});default:return Cr(a)}}o(yt,"CapabilityGate");function ft({capability:e,style:r,className:t}){let n=C(),i=useMemo(()=>gt(n),[n]);return jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${e}`,className:t,style:{...i.offstate,...r},children:jsx("div",{style:i.skeletonBar})})}o(ft,"PendingSkeleton");function mt({decision:e,style:r,className:t}){let n=C(),i=useMemo(()=>gt(n),[n]),s=e.disabled?.reason??"";return jsx("div",{className:t,style:{...i.offstate,...r},children:s.length>0?jsx("p",{style:i.offstateText,children:s}):null})}o(mt,"OffState");function gt(e){let{color:r,space:t,radius:n,type:i}=e;return {offstate:{...V,boxSizing:"border-box",minHeight:Po,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${t.md}px ${t.lg}px`,backgroundColor:r.surfaceCream,borderRadius:n.md,border:`1px solid ${r.brandBorder}`},offstateText:{margin:0,..._(e,"regular"),fontSize:i.size.body,lineHeight:`${Math.round(i.size.body*i.lineHeight.normal)}px`,color:r.text.muted},skeletonBar:{height:t.md,borderRadius:n.xs,backgroundColor:r.brandSofter}}}o(gt,"makeStyles");var He=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 ht(e){let r=C(),t=useMemo(()=>Io(r),[r]);return jsxs("div",{role:"note",className:e.className,style:{...t.container,...e.style},children:[jsx("p",{style:t.title,children:He.title}),jsx("p",{style:t.body,children:He.body})]})}o(ht,"ClinicalDisclaimer");function Io(e){let{color:r,space:t,type:n}=e,i=`${Math.round(n.size.caption*n.lineHeight.snug)}px`;return {container:{...V,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.xs,padding:`${t.md}px ${t.lg}px`,borderTop:`1px solid ${r.borderHairlineGreen}`,backgroundColor:r.surfaceCream},title:{margin:0,..._(e,"bold"),fontSize:n.size.caption,lineHeight:i,color:r.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{margin:0,..._(e,"regular"),fontSize:n.size.caption,lineHeight:i,color:r.text.muted}}}o(Io,"makeStyles");var Ao=120,jo=44;function No({reason:e,onExit:r,exitLabel:t,style:n,className:i}){let{color:s,space:c,radius:d,type:a}=C();return jsxs("div",{className:i,"data-testid":"records-gate-off",style:{boxSizing:"border-box",minHeight:Ao,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:c.md,padding:c.lg,borderRadius:d.md,border:`1px solid ${s.brandBorder}`,backgroundColor:s.surfaceCream,color:s.text.primary,...n},children:[e.length>0?jsx("p",{style:{margin:0,fontSize:a.size.bodyTight,color:s.text.muted},children:e}):null,jsx("button",{type:"button",onClick:r,"data-testid":"records-gate-off-exit",style:{minHeight:jo,padding:`0 ${c.lg}px`,borderRadius:d.pill,border:`1.5px solid ${s.brand}`,backgroundColor:"transparent",color:s.brand,font:"inherit",fontSize:a.size.body,cursor:"pointer"},children:t})]})}o(No,"RecordsGateOffState");function vt(e,r){return e===void 0?{}:{renderDisabled:o(t=>jsx(No,{reason:t.disabled?.reason??"",onExit:e,exitLabel:r}),"renderDisabled")}}o(vt,"recordsGateExit");var Rt="data-ef-screen-heading";var qo=120,oe=44,We="Back";function Uo(){let e=C(),r=useMemo(()=>Bo(e),[e]);return {theme:e,styles:r}}o(Uo,"useScreenStyles");function fe({title:e,onBack:r,right:t,testID:n,variant:i="brand"}){let{styles:s}=Uo();return jsxs("header",{style:s.headerRow,"data-testid":n,children:[r?jsx("button",{type:"button",onClick:r,"aria-label":We,style:s.iconButton,"data-testid":n?`${n}-back`:void 0,children:jsx("span",{"aria-hidden":"true",style:s.backChevron})}):jsx("span",{style:s.iconButton}),jsx("h2",{tabIndex:-1,[Rt]:"",style:i==="document"?s.documentTitle:s.headerTitle,children:e}),jsx("div",{style:s.headerRight,children:t??jsx("span",{style:s.iconButton})})]})}o(fe,"ScreenHeader");function Bo(e){let{color:r,space:t,radius:n,type:i,slots:s}=e,c=o((b,E)=>`${Math.round(b*E)}px`,"lh"),d=o((b,E,T,U="regular")=>({margin:0,..._(e,U),fontSize:b,lineHeight:c(b,E),color:T}),"text"),a=B(s.recordCard),u=`1px solid ${r.brandBorder}`,f=e.brightness==="dark"?r.errorRed:r.danger,v=o((b,E)=>({backgroundColor:b,color:E}),"tone"),g={boxSizing:"border-box",minHeight:oe,minWidth:oe,padding:`${t.md}px ${t.lg+t.xs/2}px`,borderRadius:n.pill,..._(e,"bold"),fontSize:i.size.body,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:t.sm,textDecoration:"none"};return {chipTones:{neutral:v(r.badgeBgNeutral,r.text.secondary),info:v(r.brandSoft,r.brand),warning:v(r.badgeBgCaution,r.warningStrong),critical:v(r.badgeBgCritical,r.danger),positive:v(r.badgeBgPositive,r.success)},root:{...V,boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:qo,height:"100%",backgroundColor:r.background,color:r.text.primary,..._(e,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},content:{display:"flex",flexDirection:"column",gap:t.lg,padding:`0 ${t.lg}px ${t.xxl}px`},contentTight:{display:"flex",flexDirection:"column",gap:t.lg,padding:`0 ${t.sm}px ${t.xxl}px`},inset:{padding:`0 ${t.sm}px`},headerRow:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:t.sm,padding:`${t.xs}px ${t.lg}px ${t.md}px`},iconButton:{boxSizing:"border-box",width:oe,height:oe,display:"inline-flex",alignItems:"center",justifyContent:"center",border:0,background:"transparent",cursor:"pointer",padding:0,color:r.brand,flexShrink:0},backChevron:{display:"block",width:t.md,height:t.md,borderLeft:`2px solid ${r.brand}`,borderBottom:`2px solid ${r.brand}`,transform:"rotate(45deg)",marginLeft:t.xs},headerTitle:{...d(i.size.heading,i.lineHeight.tight,r.brand,"bold"),flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},documentTitle:{...d(i.size.subtitle,i.lineHeight.snug,r.text.primary,"bold"),flex:1,textAlign:"center"},headerRight:{display:"flex",alignItems:"center",gap:t.sm+t.xs/2},section:{display:"flex",flexDirection:"column",gap:t.sm+t.xs/2},sectionHeader:{display:"flex",alignItems:"center",gap:t.sm,padding:`0 ${t.xs}px`},sectionTitle:{...d(i.size.body+1,i.lineHeight.snug,r.text.primary,"bold")},sectionCount:{...d(i.size.bodyTight,i.lineHeight.snug,r.text.muted,"medium")},card:{boxSizing:"border-box",borderRadius:n.lg-t.xs,border:u,backgroundColor:r.surface,padding:`${t.xs}px ${t.lg}px`,margin:0,listStyle:"none",...L(s.recordCard,1)},creamCard:{boxSizing:"border-box",borderRadius:n.lg-t.xs/2,border:u,backgroundColor:r.surfaceCream,padding:t.lg,display:"flex",flexDirection:"column",gap:t.md,...L(s.recordCard,1)},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:t.md,padding:`${t.md}px 0`},rowDivider:{borderTop:`1px solid ${r.borderHairlineGreen}`},rowMain:{flex:1,minWidth:0},rowRight:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:t.xs+t.xs/2},rowTitle:{...d(i.size.body,i.lineHeight.snug,r.text.primary,"medium"),...a},rowDetail:{...d(i.size.caption,i.lineHeight.normal,r.text.secondary),marginTop:t.xs/2,...a},rowValue:{...d(i.size.body+1,i.lineHeight.snug,r.text.primary,"bold"),marginTop:t.xs/2,...a},rowMuted:{...d(i.size.caption,i.lineHeight.normal,r.text.muted),...a},chip:{display:"inline-block",borderRadius:n.pill,padding:`${t.xs-1}px ${t.sm}px`,..._(e,"medium"),fontSize:i.size.tiny,lineHeight:c(i.size.tiny,i.lineHeight.snug),whiteSpace:"nowrap"},pill:g,pillPrimary:{border:0,backgroundColor:r.brand,color:r.onPrimary,...L(s.primaryButton),...B(s.primaryButton)},pillOutline:{border:`1.5px solid ${r.brand}`,backgroundColor:"transparent",color:r.brand},pillDanger:{border:`1.4px solid ${r.danger}`,backgroundColor:r.surface,color:r.danger,fontSize:i.size.bodyTight},pillAsk:{border:`1px solid ${r.borderRingCream}`,backgroundColor:r.surface,color:r.text.primary},pillLink:{border:0,backgroundColor:"transparent",color:r.linkInk,padding:`${t.sm}px`},pillDisabled:{opacity:.5,cursor:"default"},infoNote:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.brandSoft,padding:`${t.sm+t.xs/2}px ${t.md}px`,...d(i.size.bodyTight,i.lineHeight.normal,r.text.primary)},cautionNote:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.badgeBgCaution,padding:`${t.sm+t.xs/2}px ${t.md}px`,...d(i.size.bodyTight,i.lineHeight.normal,r.warningStrong)},statusCard:{borderRadius:n.md,backgroundColor:r.brandSoft,padding:t.md+t.xs/2,...d(i.size.bodyTight,i.lineHeight.relaxed,r.text.primary)},errorBanner:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.badgeBgCritical,padding:t.md,...d(i.size.bodyTight,i.lineHeight.normal,f)},errorText:d(i.size.bodyTight,i.lineHeight.normal,f),band:{display:"flex",alignItems:"flex-start",gap:t.sm,borderRadius:n.md-t.xs/2,padding:t.md,backgroundColor:r.brandSoft,margin:0},bandText:{flex:1,...d(i.size.caption,i.lineHeight.normal,r.text.secondary)},infoGlyph:{boxSizing:"border-box",flexShrink:0,width:t.md+t.xs/2,height:t.md+t.xs/2,borderRadius:n.pill,border:`1px solid ${r.text.secondary}`,display:"inline-flex",alignItems:"center",justifyContent:"center",..._(e,"bold"),fontSize:i.size.small,color:r.text.secondary},chevron:{display:"inline-block",width:t.sm,height:t.sm,borderTop:`2px solid ${r.text.muted}`,borderRight:`2px solid ${r.text.muted}`,flexShrink:0},lead:{...d(i.size.body+1,i.lineHeight.snug,r.text.primary,"bold"),padding:`0 ${t.sm}px`},field:{boxSizing:"border-box",display:"block",width:"100%",minHeight:oe,padding:`${t.sm}px ${t.md}px`,border:`1px solid ${r.borderHairlineGreen}`,borderRadius:n.sm,color:r.text.primary,backgroundColor:r.surface,..._(e,"regular"),fontSize:i.size.body},fieldLabel:{...d(i.size.bodyTight,i.lineHeight.normal,r.text.secondary,"medium"),display:"block",marginBottom:t.xs},muted:d(i.size.caption,i.lineHeight.normal,r.text.muted),bodyText:d(i.size.body,i.lineHeight.normal,r.text.primary),mono:_(e,"mono"),plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column"},dialogFrame:{boxSizing:"border-box",position:"fixed",top:0,right:0,bottom:0,left:0,width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0,padding:0,border:0,backgroundColor:"transparent",overflow:"hidden"},dialogScrim:{boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:t.lg,backgroundColor:"rgba(0,0,0,0.4)"},dialogScrimSide:{boxSizing:"border-box",display:"flex",alignItems:"stretch",justifyContent:"flex-end",width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.4)"},dialogPanel:{boxSizing:"border-box",width:"100%",maxWidth:560,maxHeight:"100%",overflowY:"auto",backgroundColor:r.surface,borderRadius:n.xl-1,padding:`${t.lg}px ${t.lg+t.xs+t.xs/2}px`,display:"flex",flexDirection:"column",gap:t.md,..._(e,"regular"),color:r.text.primary},dialogPanelSide:{boxSizing:"border-box",width:"min(100vw, 480px)",height:"100%",maxHeight:"100%",overflowY:"auto",backgroundColor:r.surface,padding:`${t.lg}px ${t.lg+t.xs+t.xs/2}px`,display:"flex",flexDirection:"column",gap:t.md,..._(e,"regular"),color:r.text.primary},sheetHeader:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:t.sm},sheetTitle:{...d(i.size.heading,i.lineHeight.snug,r.text.primary,"bold")},sheetHelper:d(i.size.bodyTight,i.lineHeight.normal,r.text.muted),closeGlyph:{fontSize:i.size.verdict,lineHeight:1,color:r.text.primary}}}o(Bo,"makeScreenStyles");var _t=Object.freeze({idle:Object.freeze({title:"Find your pet\u2019s clinic",body:"Search for the clinic that holds your pet\u2019s records. We\u2019ll request them on your behalf once you sign the authorization.",action:null}),no_requests:Object.freeze({title:"No record requests yet",body:"When you request records from a clinic, you\u2019ll be able to track every step here.",action:null}),no_records:Object.freeze({title:"Nothing to show just yet",body:"Once your pet\u2019s records arrive and our team reviews them, lab trends and visits will appear here.",action:null}),rate_limited:Object.freeze({title:"Slow down a moment",body:"You\u2019ve made a lot of requests just now. You can try again shortly.",action:"Try again"}),service_unavailable:Object.freeze({title:"Records search is temporarily down",body:"We\u2019re working on it. Please try again in a few minutes.",action:"Try again"}),error:Object.freeze({title:"Couldn\u2019t reach Everfur",body:"Check your connection and try again.",action:"Try again"})}),Ye=60;function Et(e){return `Try again in ${e}s`}o(Et,"coolingActionLabel");var xt="Try again, available shortly";function Y({width:e,height:r,radius:t,style:n}){let{color:i,radius:s}=C();return jsx("span",{"aria-hidden":"true",style:{display:"block",width:e,height:r,borderRadius:t??s.xs,backgroundColor:i.skeleton,flexShrink:0,...n}})}o(Y,"SkeletonBlock");var Wo=44,Ke=62;function Ct({testID:e}){let r=wt();return jsxs("div",{role:"progressbar","aria-label":h.loadingTimeline,"aria-busy":"true",style:r.timeline,"data-testid":e,children:[jsx("div",{style:r.timelineDisclaimer,children:jsx(Y,{width:"100%",height:Wo,radius:12})}),Array.from({length:6},(t,n)=>jsxs("div",{children:[n>0?jsx("div",{style:r.timelineSeparator}):null,jsxs("div",{style:r.timelineRow,children:[jsx(Y,{width:34,height:34,radius:17}),jsxs("div",{style:r.timelineBody,children:[jsxs("div",{style:r.timelineTop,children:[jsx(Y,{width:44,height:10,radius:5}),jsx(Y,{width:56,height:12,radius:6})]}),jsx(Y,{width:"70%",height:14,radius:7}),n%2===0?jsx(Y,{width:"45%",height:12,radius:6}):null]})]})]},n))]})}o(Ct,"TimelineSkeleton");function me({variant:e,onAction:r,message:t,testID:n}){let i=wt(),s=_t[e],[c,d]=useState(e==="rate_limited"?Ye:0);useEffect(()=>{e==="rate_limited"&&d(Ye);},[e]),useEffect(()=>{if(c<=0)return;let f=setTimeout(()=>d(v=>Math.max(0,v-1)),1e3);return ()=>clearTimeout(f)},[c]);let a=e==="rate_limited"&&c>0,u=a?Et(c):s.action;return jsxs("section",{role:"status",style:i.empty,"data-testid":n,children:[jsx("span",{"aria-hidden":"true",style:i.emptyGlyph}),jsx("h3",{style:i.emptyTitle,children:s.title}),jsx("p",{style:i.emptyBody,children:t??s.body}),u!==null&&r?jsx("button",{type:"button",onClick:r,disabled:a,"aria-label":a?xt:u,style:{...i.emptyAction,...a?i.emptyActionDisabled:{}},"data-testid":n?`${n}-action`:`records-empty-${e}-action`,children:u}):null]})}o(me,"RecordsEmptyState");function wt(){let e=C();return useMemo(()=>Yo(e),[e])}o(wt,"useStyles");function Yo(e){let{color:r,space:t,radius:n,type:i}=e,s=`1px solid ${r.brandBorder}`;return {dashboard:{display:"flex",flexDirection:"column",gap:t.lg,padding:`${t.xs}px ${t.sm}px 0`,backgroundColor:r.background},inset:{padding:`0 ${t.sm}px`},summaryCard:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.md+t.xs/2,borderRadius:n.lg-t.xs,border:s,backgroundColor:r.surface,padding:`${t.lg+t.xs}px ${t.lg}px`},badges:{display:"flex",gap:t.md},carouselCard:{borderRadius:n.lg-t.xs,border:s,backgroundColor:r.surface,padding:t.lg},dots:{display:"flex",alignItems:"center",justifyContent:"center",gap:t.xs+t.xs/2},centered:{display:"flex",justifyContent:"center"},actions:{display:"flex",flexDirection:"column",gap:t.sm+t.xs/2},actionRow:{display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:n.md,border:s,backgroundColor:r.surface,padding:t.lg},actionLeft:{flex:1,display:"flex",alignItems:"center",gap:t.md},request:{display:"flex",flexDirection:"column",gap:t.lg+t.xs/2,padding:`${t.xs}px ${t.lg}px 0`},railRow:{display:"flex",alignItems:"flex-start",gap:t.md},railColumn:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.xs/2,width:24},railBody:{flex:1,display:"flex",flexDirection:"column",gap:t.xs+t.xs/2,paddingBottom:t.lg+t.xs/2},statusCard:{display:"flex",flexDirection:"column",gap:t.sm,borderRadius:n.md,backgroundColor:r.brandSoft,padding:t.md+t.xs/2},timeline:{backgroundColor:r.background},timelineDisclaimer:{padding:`${t.xs}px ${t.lg}px ${t.md}px`},timelineRow:{display:"flex",gap:t.md,padding:`${t.md+t.xs/2}px ${t.lg}px`},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:t.xs-1},timelineTop:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:t.sm},timelineSeparator:{height:1,backgroundColor:r.brandBorder,marginLeft:Ke},clinics:{display:"flex",flexDirection:"column",gap:t.md},clinicRow:{display:"flex",flexDirection:"column",gap:t.sm,borderRadius:n.lg-t.xs/2,border:s,backgroundColor:r.surface,padding:`${t.md+t.xs/2}px`},shares:{display:"flex",flexDirection:"column",gap:t.md,padding:t.md,borderRadius:n.md,backgroundColor:r.surfaceCream,border:s},shareRow:{display:"flex",flexDirection:"column",gap:t.xs+t.xs/2},empty:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.sm+t.xs/2,padding:`${t.xxl}px ${t.xl}px`,textAlign:"center"},emptyGlyph:{boxSizing:"border-box",width:22,height:22,borderRadius:11,backgroundColor:r.brandSoft,border:s,marginBottom:t.xs},emptyTitle:{margin:0,..._(e,"bold"),fontSize:i.size.subtitle,lineHeight:`${Math.round(i.size.subtitle*i.lineHeight.snug)-1}px`,color:r.brand},emptyBody:{margin:0,..._(e,"regular"),fontSize:i.size.bodyTight,lineHeight:`${Math.round(i.size.bodyTight*i.lineHeight.normal)}px`,color:r.text.muted,maxWidth:320},emptyAction:{boxSizing:"border-box",marginTop:t.sm,minHeight:40,borderRadius:n.pill,padding:`0 ${t.lg+t.xs/2}px`,backgroundColor:r.brand,color:r.onPrimary,border:0,cursor:"pointer",..._(e,"bold"),fontSize:i.size.bodyTight},emptyActionDisabled:{opacity:.5,cursor:"default"}}}o(Yo,"makeStyles");var Jo=300,Tt=120,kt=44,Zo=o((e,r)=>e.getTimeline(r),"readTimeline"),ei=o(e=>e.isEmpty,"timelineEmpty"),ri=o((e,r)=>e.getRecordDepth(r),"readDepth"),ti=o(e=>!e.available||e.labResults.length+e.encounters.length+e.clinicianNotes.length+e.physicalExams.length===0,"depthEmpty"),ni=o(e=>e.contributions.length===0,"contributionsEmpty");function oi({petRef:e,style:r,className:t,onBack:n}){let i=ne(e,Zo,ei);return jsx(Ge,{state:i,style:r,className:t,onBack:n,header:jsx(fe,{title:h.timeline,onBack:J(n),testID:"timeline-header"}),loading:jsx(Ct,{testID:"timeline-loading"}),empty:jsx(me,{variant:"no_records",testID:"timeline-empty"}),render:s=>jsx(di,{timeline:s})})}o(oi,"EverfurRecordsTimeline");function ii({petRef:e,style:r,className:t,onBack:n}){let i=ne(e,ri,ti);return jsx(Ge,{state:i,style:r,className:t,onBack:n,header:n?jsx(fe,{title:q.records,onBack:J(n)}):null,render:s=>jsx(ui,{depth:s})})}o(ii,"EverfurRecordDepth");function ai({petRef:e,docId:r,style:t,className:n,onBack:i}){let s=useCallback((a,u)=>a.getDocumentContributions(u,r),[r]),c=ne(e,s,ni,r),d=c.value?.document?.title?.trim()||h.uploadedDocument;return jsx(Ge,{state:c,style:t,className:n,onBack:i,header:jsx(fe,{title:d,onBack:J(i),testID:"contributions-header"}),empty:jsx(me,{variant:"no_records",testID:"contributions-empty"}),render:a=>jsx(ci,{view:a})})}o(ai,"EverfurDocumentContributions");function Ge({state:e,style:r,className:t,header:n,loading:i,empty:s,render:c,onBack:d}){let{styles:a}=ye(),{userRef:u}=M();return jsx(yt,{capability:"records",style:r,className:t,...vt(J(d),We),children:jsxs("div",{className:t,style:{...a.container,...r},children:[n??null,jsx("div",{style:a.body,children:u===null?jsx("p",{role:"alert",style:a.alertText,children:q.sessionRequired}):si(e,c,a,i,s)}),jsx(ht,{})]})})}o(Ge,"DepthSurface");function si(e,r,t,n,i){switch(e.status){case "loading":return n??jsx(li,{styles:t});case "empty":return i??jsx("div",{style:t.centered,children:jsx("div",{role:"img","aria-label":q.empty,style:t.emptyGlyph})});case "error":return e.error?jsx(me,{variant:or(e.error),message:e.error.displayMessage,onAction:e.error.retryable?e.refresh:void 0,testID:"depth-error"}):null;case "populated":return e.value===null||e.value.withheld?null:r(e.value);default:return null}}o(si,"renderState");function li({styles:e}){let[r,t]=useState(false);return useEffect(()=>{let n=setTimeout(()=>t(true),Jo);return ()=>clearTimeout(n)},[]),jsx("div",{role:"status","aria-busy":"true","aria-label":q.loading,style:e.centered,children:r?jsx("div",{"aria-hidden":"true",style:e.spinner}):null})}o(li,"LoadingState");function di({timeline:e}){let{styles:r}=ye(),t=_e(e);return jsxs("section",{"aria-label":h.timeline,style:r.timelineList,children:[e.disclaimer.length>0?jsx("p",{role:"note","aria-label":nr.important(e.disclaimer),style:r.timelineBand,children:e.disclaimer}):null,jsx("ul",{style:r.plainList,children:t.map((n,i)=>jsx("li",{style:i>0?r.timelineSeparated:void 0,"data-testid":`records-timeline-row-${n.kind}`,children:jsxs("div",{style:r.timelineRow,"aria-label":[n.kindLabel,n.date,n.title,n.detail].filter(Boolean).join(", "),children:[jsx("span",{"aria-hidden":"true",style:r.timelineBubble}),jsxs("div",{style:r.timelineBody,children:[jsxs("div",{style:r.topLine,children:[jsx("span",{style:r.timelineKind,children:n.kindLabel}),jsx("span",{style:r.date,children:n.date})]}),jsx("span",{style:r.timelineTitle,children:n.title}),n.detail?jsx("span",{style:r.rowDetail,children:n.detail}):null]})]})},n.key))})]})}o(di,"TimelineBody");function ui({depth:e}){let{styles:r}=ye();return jsxs("section",{"aria-label":q.records,style:r.list,children:[e.labResults.length>0?jsxs("div",{style:r.section,children:[jsx("h3",{style:r.heading,children:`${h.labResults} (${e.labResults.length})`}),jsx("ul",{style:r.card,children:e.labResults.map(t=>{let n=dr(t.latest.status),i=mr(t.latest.at,t.trajectory,t.points.length);return jsxs("li",{style:r.row,children:[jsx("span",{style:r.rowTitle,children:t.name}),jsx("span",{style:r.rowValue,children:fr(t.latest.value,t.latest.unit,t.latest.qualitativeResult)}),i?jsx("span",{style:r.rowDetail,children:i}):null,jsx("span",{style:{...r.chip,...n.outOfRange?r.chipCritical:r.chipNeutral},children:n.label}),t.meaning?jsx("span",{style:r.rowDetail,children:t.meaning}):null]},t.markerId)})})]}):null,e.encounters.length>0?jsxs("div",{style:r.section,children:[jsx("h3",{style:r.heading,children:`${h.visits} (${e.encounters.length})`}),jsx("ul",{style:r.card,children:e.encounters.map(t=>{let n=[t.date?w(t.date):null,t.clinicName,t.veterinarian].filter(i=>i&&i!=="-").join(" \xB7 ");return jsxs("li",{style:r.row,children:[jsx("span",{style:r.rowTitle,children:t.type?se(t.type):h.visit}),n?jsx("span",{style:r.rowDetail,children:n}):null]},t.encounterId)})})]}):null,e.physicalExams.length>0?jsxs("div",{style:r.section,children:[jsx("h3",{style:r.heading,children:`${h.physicalExams} (${e.physicalExams.length})`}),e.physicalExams.map(t=>jsxs("div",{style:r.card,children:[jsx("h4",{style:r.rowTitle,children:t.observedOn?w(t.observedOn):h.exam}),jsx("ul",{style:r.plainList,children:t.systems.map(n=>{let i=n.findingStatus==="abnormal",s=i?h.abnormal:n.findingStatus==="not_examined"?h.notExamined:h.normal;return jsxs("li",{style:r.row,children:[jsx("span",{style:r.rowTitle,children:ur(n.system)}),i&&n.finding?jsx("span",{style:r.rowDetail,children:n.finding}):null,jsx("span",{style:{...r.chip,...i?r.chipCaution:r.chipNeutral},children:s})]},n.system)})})]},t.examId))]}):null,e.clinicianNotes.length>0?jsxs("div",{style:r.section,children:[jsx("h3",{style:r.heading,children:`${h.visitNotes} (${e.clinicianNotes.length})`}),e.clinicianNotes.map(t=>jsxs("div",{style:r.card,children:[jsx("h4",{style:r.rowTitle,children:t.observedOn?w(t.observedOn):h.visitNote}),jsx("dl",{style:r.plainList,children:t.sections.map((n,i)=>jsxs("div",{style:r.row,children:[jsx("dt",{style:r.kindLabel,children:cr(n.section)}),jsx("dd",{style:n.text?r.rowDetail:r.rowMuted,children:n.text||h.notRecorded})]},`${n.section}:${i}`))})]},t.noteId))]}):null]})}o(ui,"DepthBody");function ci({view:e}){let{styles:r}=ye();return jsxs("section",{"aria-label":q.records,style:r.list,children:[e.document?.receivedAt?jsx("p",{style:r.rowDetail,children:w(e.document.receivedAt)}):null,jsx("dl",{style:r.card,children:e.contributions.map(t=>jsxs("div",{style:r.row,children:[jsx("dt",{style:r.rowTitle,children:t.label}),jsx("dd",{style:r.rowValue,children:ar(t.value,t.unit)}),t.observedAt?jsx("dd",{style:r.rowDetail,children:w(t.observedAt)}):null]},t.key))})]})}o(ci,"ContributionsBody");function ye(){let e=C(),r=useMemo(()=>pi(e),[e]);return {theme:e,styles:r}}o(ye,"useDepthTheme");function pi(e){let{color:r,space:t,radius:n,type:i,slots:s}=e,c=o((g,b)=>`${Math.round(g*b)}px`,"lh"),d=o((g,b,E,T="regular")=>({margin:0,..._(e,T),fontSize:g,lineHeight:c(g,b),color:E}),"text"),a=B(s.recordCard),u=o((g,b,E,T="regular")=>({...d(g,b,E,T),...a}),"inCard"),f=`1px solid ${r.brandBorder}`,v=e.brightness==="dark"?r.errorRed:r.danger;return {container:{boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:Tt,height:"100%",backgroundColor:r.background,color:r.text.primary,..._(e,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},centered:{boxSizing:"border-box",flex:"1 1 auto",minHeight:Tt,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:t.lg,padding:t.xl,textAlign:"center"},spinner:{boxSizing:"border-box",width:24,height:24,borderRadius:n.pill,border:`3px solid ${r.brandSofter}`,borderTopColor:r.brand},emptyGlyph:{boxSizing:"border-box",width:40,height:40,borderRadius:n.lg,backgroundColor:r.brandSoft,border:f},alertText:d(i.size.subtitle,i.lineHeight.snug,r.text.secondary),errorText:d(i.size.subtitle,i.lineHeight.snug,v),primaryButton:{boxSizing:"border-box",minHeight:kt,minWidth:kt,padding:`${t.md}px ${t.xl}px`,borderRadius:n.pill,..._(e,"bold"),fontSize:i.size.body,border:0,cursor:"pointer",backgroundColor:r.primary,color:r.onPrimary,...L(s.primaryButton),...B(s.primaryButton)},list:{display:"flex",flexDirection:"column",gap:t.md,padding:t.lg},section:{display:"flex",flexDirection:"column",gap:t.sm},heading:{...d(i.size.heading,i.lineHeight.snug,r.text.primary,"bold")},card:{boxSizing:"border-box",listStyle:"none",display:"flex",flexDirection:"column",gap:t.sm,margin:0,padding:t.md,borderRadius:n.md,backgroundColor:r.surfaceCream,border:f,...L(s.recordCard,1)},plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:t.sm},row:{display:"flex",flexDirection:"column",gap:t.xs,padding:`${t.xs}px 0`,borderBottom:`1px solid ${r.borderHairlineGreen}`},topLine:{display:"flex",justifyContent:"space-between",gap:t.md},kindLabel:{...u(i.size.caption,i.lineHeight.normal,r.text.muted,"medium")},date:u(i.size.caption,i.lineHeight.normal,r.text.muted),rowTitle:{...u(i.size.body,i.lineHeight.normal,r.text.primary,"bold")},rowValue:{...u(i.size.body,i.lineHeight.normal,r.text.primary,"medium")},rowDetail:u(i.size.bodyTight,i.lineHeight.normal,r.text.muted),rowMuted:{...u(i.size.bodyTight,i.lineHeight.normal,r.text.muted),opacity:.7},chip:{...d(i.size.caption,i.lineHeight.normal,r.text.primary),alignSelf:"flex-start",padding:`${t.xs}px ${t.sm}px`,borderRadius:n.pill},chipNeutral:{backgroundColor:r.badgeBgNeutral},chipCaution:{backgroundColor:r.badgeBgCaution},chipCritical:{backgroundColor:r.badgeBgCritical},disclaimer:d(i.size.caption,i.lineHeight.normal,r.text.muted),timelineList:{display:"flex",flexDirection:"column",paddingBottom:t.xxl},timelineBand:{...d(i.size.caption,i.lineHeight.normal,r.text.secondary),borderRadius:n.md-t.xs/2,padding:t.md,backgroundColor:r.brandSoft,margin:`${t.xs}px ${t.lg}px ${t.md}px`},timelineSeparated:{borderTop:`1px solid ${r.brandBorder}`,marginLeft:Ke,paddingLeft:0},timelineRow:{display:"flex",gap:t.md,padding:`${t.md+t.xs/2}px ${t.lg}px`},timelineBubble:{boxSizing:"border-box",flexShrink:0,width:34,height:34,borderRadius:n.pill,backgroundColor:r.brandSoft,border:f},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:t.xs-1,minWidth:0},timelineKind:{..._(e,"mono"),fontSize:i.size.micro,lineHeight:`${i.size.bodyTight}px`,letterSpacing:i.letterSpacing.eyebrow/3,textTransform:"uppercase",color:r.text.secondary},timelineTitle:{...d(i.size.body,i.lineHeight.normal,r.text.primary,"medium")}}}o(pi,"makeStyles");
2
+ export{ai as EverfurDocumentContributions,ii as EverfurRecordDepth,oi as EverfurRecordsTimeline,_e as buildTimelineRows,Yr as mapDocumentContributions,Vr as mapRecordDepth,Wr as mapRecordsTimeline,Jr as useEverfurRecordsDepthClient,ne as useRecordsDepthRead};