@everfur/sdk 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/CHANGELOG.md +634 -0
  2. package/README.md +58 -23
  3. package/consent/package.json +8 -0
  4. package/dist/Chat-DPUD6dnc.d.cts +128 -0
  5. package/dist/Chat-DwAC2vhB.d.ts +128 -0
  6. package/dist/DepthViews-DNEM96Se.d.ts +16 -0
  7. package/dist/DepthViews-DP0R-DhB.d.cts +19 -0
  8. package/dist/DepthViews-D_3hl4xk.d.ts +19 -0
  9. package/dist/DepthViews-DbFhR4Du.d.cts +16 -0
  10. package/dist/ErrorPolicyPort-CNf4uQZP.d.cts +22 -0
  11. package/dist/ErrorPolicyPort-CwbfmxzJ.d.ts +22 -0
  12. package/dist/{EverfurResult-D92-uL82.d.cts → EverfurResult-DN9pL2Ab.d.cts} +11 -10
  13. package/dist/{EverfurResult-D92-uL82.d.ts → EverfurResult-DN9pL2Ab.d.ts} +11 -10
  14. package/dist/{PhotoController-BItt5M7u.d.cts → PhotoController-3l7MT9jA.d.cts} +1 -1
  15. package/dist/{PhotoController-D8zMTdcW.d.ts → PhotoController-vzY5bfY_.d.ts} +1 -1
  16. package/dist/animations/index.cjs +1 -1997
  17. package/dist/animations/index.d.cts +35 -35
  18. package/dist/animations/index.d.ts +35 -35
  19. package/dist/animations/index.js +1 -1972
  20. package/dist/attachments-5NeobOCd.d.ts +256 -0
  21. package/dist/attachments-Bw3iMQgu.d.ts +146 -0
  22. package/dist/attachments-CQgFrEQ7.d.cts +146 -0
  23. package/dist/attachments-D8T5re7e.d.cts +256 -0
  24. package/dist/casesRepository-ClLv6qMl.d.ts +188 -0
  25. package/dist/casesRepository-DHwtGRYY.d.cts +188 -0
  26. package/dist/chat/index.cjs +1 -1170
  27. package/dist/chat/index.d.cts +31 -53
  28. package/dist/chat/index.d.ts +31 -53
  29. package/dist/chat/index.js +1 -1167
  30. package/dist/client/index.cjs +9 -2315
  31. package/dist/client/index.d.cts +77 -15
  32. package/dist/client/index.d.ts +77 -15
  33. package/dist/client/index.js +9 -2215
  34. package/dist/{config-CiJ0PVBB.d.ts → config-CzTZGlfF.d.cts} +63 -25
  35. package/dist/{config-BSjBdxrZ.d.cts → config-DW60uRb9.d.ts} +63 -25
  36. package/dist/consent/index.cjs +1 -0
  37. package/dist/consent/index.d.cts +33 -0
  38. package/dist/consent/index.d.ts +33 -0
  39. package/dist/consent/index.js +1 -0
  40. package/dist/context-DXhqHlPU.d.ts +159 -0
  41. package/dist/context-XvTzq1tE.d.cts +159 -0
  42. package/dist/copy-Mjoo91aS.d.ts +198 -0
  43. package/dist/copy-bKDNigLb.d.cts +198 -0
  44. package/dist/core/index.cjs +13 -3178
  45. package/dist/core/index.d.cts +58 -12
  46. package/dist/core/index.d.ts +58 -12
  47. package/dist/core/index.js +13 -3166
  48. package/dist/depth-CErXCU8J.d.cts +502 -0
  49. package/dist/depth-DjDcJ6kH.d.ts +502 -0
  50. package/dist/entitlementRepository-DKdXFgTo.d.cts +698 -0
  51. package/dist/entitlementRepository-DSbzuyAW.d.ts +698 -0
  52. package/dist/{identity-DK9zORrG.d.ts → identity-BMx2SUOM.d.ts} +19 -6
  53. package/dist/{identity-Brl-lDd6.d.cts → identity-DI4eVx9S.d.cts} +19 -6
  54. package/dist/{ids-CJ1S6adf.d.cts → ids-B2GAAifq.d.cts} +1 -1
  55. package/dist/{ids-CJ1S6adf.d.ts → ids-B2GAAifq.d.ts} +1 -1
  56. package/dist/index.cjs +12 -4494
  57. package/dist/index.d.cts +29 -121
  58. package/dist/index.d.ts +29 -121
  59. package/dist/index.js +12 -4470
  60. package/dist/models-B-Uh2LTf.d.ts +214 -0
  61. package/dist/models-D2EUxPZY.d.cts +214 -0
  62. package/dist/notifications/index.cjs +2 -0
  63. package/dist/notifications/index.d.cts +17 -0
  64. package/dist/notifications/index.d.ts +17 -0
  65. package/dist/notifications/index.js +2 -0
  66. package/dist/pets-CtQdRpWo.d.ts +92 -0
  67. package/dist/pets-aB8q0JyX.d.cts +92 -0
  68. package/dist/photo/index.cjs +1 -2189
  69. package/dist/photo/index.d.cts +6 -6
  70. package/dist/photo/index.d.ts +6 -6
  71. package/dist/photo/index.js +1 -2186
  72. package/dist/ports-BN6RHF9W.d.cts +48 -0
  73. package/dist/ports-BN6RHF9W.d.ts +48 -0
  74. package/dist/ports-DEBzEhbp.d.cts +386 -0
  75. package/dist/ports-DMolTRzU.d.ts +386 -0
  76. package/dist/profile-CSs1wlXT.d.cts +93 -0
  77. package/dist/profile-CSs1wlXT.d.ts +93 -0
  78. package/dist/records/depth/index.cjs +2 -0
  79. package/dist/records/depth/index.d.cts +13 -0
  80. package/dist/records/depth/index.d.ts +13 -0
  81. package/dist/records/depth/index.js +2 -0
  82. package/dist/records/index.cjs +3 -2839
  83. package/dist/records/index.d.cts +137 -203
  84. package/dist/records/index.d.ts +137 -203
  85. package/dist/records/index.js +3 -2833
  86. package/dist/requestFunnel-CjW7uDuA.d.ts +87 -0
  87. package/dist/requestFunnel-L-BQfi0z.d.cts +87 -0
  88. package/dist/{resolve-Dq_4_agU.d.ts → resolve-D4Ywz5OS.d.cts} +10 -4
  89. package/dist/{resolve-Dq_4_agU.d.cts → resolve-D4Ywz5OS.d.ts} +10 -4
  90. package/dist/{runtime-Bvr8yqXm.d.cts → runtime-B8s-_hv8.d.cts} +121 -59
  91. package/dist/{runtime-BIYzf9cK.d.ts → runtime-BR9ysG0J.d.ts} +121 -59
  92. package/dist/server/events/index.cjs +2 -0
  93. package/dist/server/events/index.d.cts +550 -0
  94. package/dist/server/events/index.d.ts +550 -0
  95. package/dist/server/events/index.js +2 -0
  96. package/dist/server/index.cjs +2 -533
  97. package/dist/server/index.d.cts +73 -18
  98. package/dist/server/index.d.ts +73 -18
  99. package/dist/server/index.js +2 -530
  100. package/dist/species-BXAIMh7I.d.cts +9 -0
  101. package/dist/species-BXAIMh7I.d.ts +9 -0
  102. package/dist/televet/index.cjs +1 -0
  103. package/dist/televet/index.d.cts +60 -0
  104. package/dist/televet/index.d.ts +60 -0
  105. package/dist/televet/index.js +1 -0
  106. package/dist/testing/index.cjs +5 -823
  107. package/dist/testing/index.d.cts +17 -3
  108. package/dist/testing/index.d.ts +17 -3
  109. package/dist/testing/index.js +5 -820
  110. package/dist/testing/rn/index.cjs +1 -449
  111. package/dist/testing/rn/index.d.cts +17 -29
  112. package/dist/testing/rn/index.d.ts +17 -29
  113. package/dist/testing/rn/index.js +1 -444
  114. package/dist/testing/web/index.cjs +1 -0
  115. package/dist/testing/web/index.d.cts +131 -0
  116. package/dist/testing/web/index.d.ts +131 -0
  117. package/dist/testing/web/index.js +1 -0
  118. package/dist/timelineRows-CaohZzXS.d.cts +19 -0
  119. package/dist/timelineRows-DZed6dAM.d.ts +19 -0
  120. package/dist/typeStyle-0TydiZ1w.d.cts +19 -0
  121. package/dist/typeStyle-CWMsoe6b.d.ts +19 -0
  122. package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
  123. package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
  124. package/dist/useRecordsDepth-BHBzJ76R.d.cts +237 -0
  125. package/dist/useRecordsDepth-BU-OhzH6.d.ts +237 -0
  126. package/dist/useVetVisit-Bc84hWUU.d.cts +187 -0
  127. package/dist/useVetVisit-CjmMa896.d.ts +187 -0
  128. package/dist/video/index.cjs +1 -1941
  129. package/dist/video/index.d.cts +4 -4
  130. package/dist/video/index.d.ts +4 -4
  131. package/dist/video/index.js +1 -1938
  132. package/dist/view-C3qPIXGX.d.cts +310 -0
  133. package/dist/view-DtSPYpKa.d.ts +310 -0
  134. package/dist/visitIntent-D7_yVp1I.d.cts +8 -0
  135. package/dist/visitIntent-D7_yVp1I.d.ts +8 -0
  136. package/dist/web/consent/index.cjs +1 -0
  137. package/dist/web/consent/index.d.cts +34 -0
  138. package/dist/web/consent/index.d.ts +34 -0
  139. package/dist/web/consent/index.js +1 -0
  140. package/dist/web/index.cjs +14 -0
  141. package/dist/web/index.d.cts +217 -0
  142. package/dist/web/index.d.ts +217 -0
  143. package/dist/web/index.js +14 -0
  144. package/dist/web/notifications/index.cjs +2 -0
  145. package/dist/web/notifications/index.d.cts +213 -0
  146. package/dist/web/notifications/index.d.ts +213 -0
  147. package/dist/web/notifications/index.js +2 -0
  148. package/dist/web/records/depth/index.cjs +2 -0
  149. package/dist/web/records/depth/index.d.cts +12 -0
  150. package/dist/web/records/depth/index.d.ts +12 -0
  151. package/dist/web/records/depth/index.js +2 -0
  152. package/dist/web/records/index.cjs +4 -0
  153. package/dist/web/records/index.d.cts +194 -0
  154. package/dist/web/records/index.d.ts +194 -0
  155. package/dist/web/records/index.js +4 -0
  156. package/dist/web/televet/index.cjs +1 -0
  157. package/dist/web/televet/index.d.cts +50 -0
  158. package/dist/web/televet/index.d.ts +50 -0
  159. package/dist/web/televet/index.js +1 -0
  160. package/notifications/package.json +8 -0
  161. package/package.json +197 -9
  162. package/records/depth/package.json +8 -0
  163. package/server/events/device-blocked.cjs +15 -0
  164. package/server/events/package.json +9 -0
  165. package/televet/package.json +8 -0
  166. package/testing/web/native-blocked.cjs +12 -0
  167. package/testing/web/package.json +8 -0
  168. package/web/consent/native-blocked.cjs +12 -0
  169. package/web/consent/package.json +8 -0
  170. package/web/native-blocked.cjs +12 -0
  171. package/web/notifications/native-blocked.cjs +12 -0
  172. package/web/notifications/package.json +8 -0
  173. package/web/package.json +8 -0
  174. package/web/records/depth/native-blocked.cjs +12 -0
  175. package/web/records/depth/package.json +8 -0
  176. package/web/records/native-blocked.cjs +12 -0
  177. package/web/records/package.json +8 -0
  178. package/web/televet/native-blocked.cjs +12 -0
  179. package/web/televet/package.json +8 -0
  180. package/dist/ChatController-CKdBvPj2.d.ts +0 -146
  181. package/dist/ChatController-CpUMvvZf.d.cts +0 -146
  182. package/dist/FilePort-BabWrv7I.d.cts +0 -22
  183. package/dist/FilePort-BabWrv7I.d.ts +0 -22
  184. package/dist/petsRepository-BEGb97M9.d.cts +0 -326
  185. package/dist/petsRepository-Bu18r2kK.d.ts +0 -326
  186. package/dist/requestFunnel-DuUH-kAe.d.cts +0 -28
  187. package/dist/requestFunnel-dio5OmR9.d.ts +0 -28
@@ -0,0 +1,2 @@
1
+ import {createContext,useMemo,useState,useRef,useCallback,useEffect,useContext,useSyncExternalStore,Component,createElement}from'react';import {z as z$1}from'zod';import {jsx,jsxs}from'react/jsx-runtime';var St=Object.defineProperty;var o=(e,r)=>St(e,"name",{value:r,configurable:true});function wt(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(wt,"slotBox");function U(e){return e?.textColor===void 0?{}:{color:e.textColor}}o(U,"slotText");function L(e,r){let t=wt(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 Ke(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(Ke,"reportHostFailure");function kt(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(kt,"isThenable");function Tt(e,...r){if(typeof e=="function")try{let t=e(...r);return kt(t)&&Promise.resolve(t).then(void 0,Ke),t}catch(t){Ke(t);return}}o(Tt,"callHost");var Ge=new WeakMap;function X(e){if(typeof e!="function")return;let r=Ge.get(e);if(r!==void 0)return r;let t=o((...n)=>{Tt(e,...n);},"guarded");return Ge.set(e,t),t}o(X,"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 oe=class oe extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,oe.prototype);}};o(oe,"EverfurConfigError");var Q=oe;var Xe=Symbol.for("@everfur/sdk#EverfurContext@v1"),Qe=globalThis,Je=Qe[Xe]??(Qe[Xe]=createContext(null));Je.displayName??="EverfurContext";function M(){let e=useContext(Je);if(e===null)throw new Q("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(M,"useEverfurContext");var B=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 Ft="your pet";function I(e){let r=e?.trim()??"";return r.length>0?r:Ft}o(I,"petNameOr");var Ze=Object.freeze({title:"Health records",openTimeline:"Open timeline",loading:"Loading health records",lead:o(e=>`${I(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=>`${I(e)}\u2019s records request`,"title"),body:o(e=>`We\u2019re requesting ${I(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 ${I(e)}.`,"a11y"),openA11y:o((e,r)=>`Open ${I(e)}\u2019s records request. ${r}`,"openA11y"),ask:"Ask about this request",askA11y:"Ask Everfur about this records request"});Object.freeze({title:o(e=>`Add ${I(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 ${I(e)}\u2019s records from a clinic`,"requestFromClinicA11y"),uploadDocument:"Upload a document",uploadDocumentA11y:o(e=>`Upload one of ${I(e)}\u2019s records`,"uploadDocumentA11y")});function er(e){return e?.httpStatus===429?"rate_limited":e?.httpStatus===502?"service_unavailable":"error"}o(er,"recordsEmptyVariantForError");function tr(e,r){return e===null?"":r?`${e} ${r}`:e}o(tr,"formatEntityValue");var rr=["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=rr[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 `${rr[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 ir(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(ir,"markerStatusLabel");function Dt(e,r){return r<2?null:`${e==="flat"?"Holding steady":`Trending ${e==="down"?"down":e==="up"?"up":"steady"}`} over ${r} visits`}o(Dt,"trajectoryLabel");function ie(e){let r=e.replace(/_/g," ").trim();return r.length===0?e:r.charAt(0).toUpperCase()+r.slice(1)}o(ie,"humanize");var nr=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 ar(e){return Object.prototype.hasOwnProperty.call(nr,e)?nr[e]:ie(e)}o(ar,"bodySystemLabel");var or=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 sr(e){return Object.prototype.hasOwnProperty.call(or,e)?or[e]:ie(e)}o(sr,"soapSectionLabel");function lr(e){return e===null||!Number.isFinite(e)?"-":`${e.toFixed(3).replace(/\.?0+$/,"")} kg`}o(lr,"formatWeightKg");function dr(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(dr,"formatMarkerReading");function ur(e,r,t){let n=Dt(r,t);return e?`${h.measured(w(e))}${n?` \xB7 ${n}`:""}`:n}o(ur,"labDetailLine");var ae=Object.freeze({visit:0,vaccine:1,weight:2,medication:3});function cr(e){if(!e)return null;let r=Date.parse(e);return Number.isNaN(r)?null:r}o(cr,"toMillis");function be(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:lr(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=cr(t.at),s=cr(n.at);return i===null&&s===null?ae[t.kind]-ae[n.kind]:i===null?1:s===null?-1:s!==i?s-i:ae[t.kind]-ae[n.kind]}))}o(be,"buildTimelineRows");var he=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(he.map(e=>e.wireCode));var It=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"}),fr=Object.freeze(he.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:It[e.wireCode]}))),zt=new Map(fr.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),At=Object.freeze(["http_envelope",...[...new Set(fr.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function se(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let n of [r??"http_envelope",...At]){let i=zt.get(n+t);if(i)return i}}o(se,"contractErrorFor");function jt(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(jt,"contractDocUrl");function yr(e){return null}o(yr,"publishedDocUrl");var Nt=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 mr(e){return Nt[e]}o(mr,"categoryFor");function gr(e){let r=se(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(gr,"fromWire");var Lt=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ve(e){return Lt.has(e)}o(ve,"isAutoRetryable");var Mt=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function br(e){return ve(e)||Mt.has(e)}o(br,"isRetryableCode");var Bt=500,Re=8e3,hr=4;function vr(e,r=Math.random){let t=Math.max(0,e),n=Math.min(Bt*2**t,Re);return Math.floor(r()*n)}o(vr,"backoffDelayMs");var qt=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 _e(e){return qt[e]}o(_e,"userFacingError");function Rr(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}o(Rr,"defineHidden");var Ut=/^[a-z][a-z0-9_]{0,63}$/;function z(e,r){let t=se(r?.wireCode,r?.wireEnvelope),n={code:e,category:mr(e),retryable:r?.retryable??br(e),displayMessage:_e(e)};if(r?.httpStatus!==void 0&&(n.httpStatus=r.httpStatus),r?.requestId&&(n.requestId=r.requestId),typeof r?.reasonCode=="string"&&Ut.test(r.reasonCode)&&(n.reasonCode=r.reasonCode),t);return r?.wireMessage&&Rr(n,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&Rr(n,"raw",r.raw),Object.freeze(n)}o(z,"makeEverfurError");function _r(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(_r,"assertNever");function Er(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(Er,"errorFrame");function Vt(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(Vt,"authHeaders");function J(e,r){return {...e,headers:{...Wt(e.headers),...Vt(r)}}}o(J,"withAuthHeaders");function Wt(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(Wt,"stripAuthHeaders");async function xr(e,r){if(r.mode==="anonymous")return r.transport.request(J(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(Ee())}let n=await r.transport.request(J(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(Ee())}let s=await r.transport.request(J(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?O(Ee(s.error.httpStatus)):s}o(xr,"authedSend");function Ee(e){return z("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(Ee,"authRejectedError");function Cr(e){return z("internalError",{retryable:true,wireMessage:Yt(e)})}o(Cr,"networkError");function Yt(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(Yt,"describeCause");var Kt=3e4,Gt=Re*2,Xt="idempotency-key",Qt=new Set(["POST","PUT","PATCH","DELETE"]),Jt=Object.freeze({onEvent(){}}),Zt=Object.freeze({setTimeout:o((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function wr(e){let r=e.observer??Jt,t=e.timers??Zt,n=e.rng??Math.random,i=e.sleep??((g,b)=>fn(g,t,b)),s=e.maxAttempts??hr,c=e.unaryTimeoutMs??Kt,d=e.newIdempotencyKey??rn(),a=o(g=>{try{r.onEvent(g);}catch{}},"emit");async function u(g,b,E){let k=E?.maxAttempts,q=Math.max(1,k??s),N=E?.idempotent??Qt.has(b.method)?d():null,Ct=en(b,N),ye=0;for(;;){let K=o(ge=>Object.freeze({call:g,method:b.method,path:b.path,attempt:ye,...N?{idempotencyKey:N}:{},...ge}),"stamp");a(K({phase:"attempt"}));let We=cn(c,t),Ye=pn(We.signal,b.signal),G;try{G=await xr({...Ct,signal:Ye.signal},e.auth);}catch(ge){G=O(Cr(ge));}finally{Ye.dispose(),We.cancel();}if(G.ok)return a(K({phase:"settled",ok:true,reason:"ok"})),G;let D=G.error,ne=nn(D,ye,{maxAttempts:q,rng:n,now:t.now(),aborted:b.signal?.aborted===true,...k!==void 0?{perCallMaxAttempts:k}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),me={ok:false,code:D.code,reason:ne.reason,...D.httpStatus!==void 0?{httpStatus:D.httpStatus}:{},...D.requestId!==void 0?{requestId:D.requestId}:{}};if(!ne.retry)return a(K({phase:"settled",...me})),O(D);if(a(K({phase:"retry",...me,delayMs:ne.delayMs})),await i(ne.delayMs,b.signal),b.signal?.aborted===true)return a(K({phase:"settled",...me,reason:"aborted"})),O(D);ye+=1;}}o(u,"send");async function f(g){return J(g,await un(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 Er({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(wr,"createRequestFunnel");function en(e,r){let t={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==Xt&&(t[n]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}o(en,"assembleHeaders");function rn(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(rn,"defaultIdempotencyKeyFactory");var tn=10;function nn(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let n=on(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!ve(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(tn,Math.floor(u)))},"policyCeiling"),d=t.perCallMaxAttempts??c()??t.maxAttempts;if(r+1>=d)return {retry:false,reason:"attempts-exhausted"};let a=an(e,t.now);return a!==null?a>Gt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:a}:{retry:true,reason:i,delayMs:vr(r,t.rng)}}o(nn,"decideRetry");function on(e){let r=e.code==="unknown"?gr(dn(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}o(on,"throttleKind");function an(e,r){let t=sn(e.raw);if(t===null)return null;let n=t-r;return n>0?n:0}o(an,"retryOverrideMs");function sn(e){for(let r of kr(e)){let t=r.resets_at,n=ln(t);if(n!==null)return n}return null}o(sn,"findResetsAt");function kr(e){if(!Sr(e))return [];let r=[e];for(let t of ["error","detail"]){let n=e[t];Sr(n)&&r.push(n);}return r}o(kr,"candidateScopes");function ln(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(ln,"parseInstantMs");function dn(e){for(let r of kr(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}o(dn,"rawWireCode");function Sr(e){return typeof e=="object"&&e!==null}o(Sr,"isRecord");async function un(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(un,"resolveDeviceAuth");function cn(e,r){let t=new AbortController,n=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:o(()=>r.clearTimeout(n),"cancel")}}o(cn,"boundedSignal");function pn(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(pn,"mergeSignals");function fn(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(fn,"delayAbortable");function Tr(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(Tr,"hasLoneSurrogate");var Or=64,Pr=512;function mn(e){return e==="owner_reported"||e==="clinic_document"?e:null}o(mn,"normalizeOrigin");z$1.object({request_id:z$1.string().min(1),pet_ref:z$1.string().min(1),status:z$1.string(),simple_status:z$1.string().nullish(),simple_status_detail:z$1.string().nullish(),status_label:z$1.string().optional(),dispatch_status:z$1.string().nullish(),can_retry_send:z$1.boolean().optional(),can_revoke:z$1.boolean().optional(),can_convert_to_upload:z$1.boolean().optional(),can_update_clinic_email:z$1.boolean().optional(),reminder_count:z$1.number().int().nonnegative().optional(),last_reminder_at:z$1.string().nullish(),waiting_expectation:z$1.string().nullish(),document_count:z$1.number().optional(),held_item_count:z$1.number().optional(),received_at:z$1.string().nullish(),parsing_started_at:z$1.string().nullish(),review_started_at:z$1.string().nullish(),created_at:z$1.string().optional(),updated_at:z$1.string().optional(),source:z$1.string().nullish().catch(null),action_needed_label:z$1.string().nullish().catch(null),failure_reason:z$1.string().nullish().catch(null),failure_code:z$1.string().nullish().catch(null),recovery_stage:z$1.string().nullish().catch(null),show_clinic_phone:z$1.boolean().optional().catch(void 0),clinic_name:z$1.string().nullish().catch(null),clinic_email:z$1.string().nullish().catch(null),clinic_phone:z$1.string().nullish().catch(null),converted_to_upload_at:z$1.string().nullish().catch(null),request_group_id:z$1.string().nullish().catch(null)}).passthrough();z$1.object({request_group_id:z$1.string().min(1),pet_ref:z$1.string().min(1),total:z$1.number().int().nonnegative(),responded:z$1.number().int().nonnegative(),pending:z$1.number().int().nonnegative(),members:z$1.array(z$1.unknown())});z$1.object({source_doc_id:z$1.string().min(1),request_id:z$1.string().min(1)});var gn=z$1.object({label:z$1.string(),value:z$1.string()}),xe=z$1.object({key:z$1.string(),category:z$1.string().optional(),label:z$1.string().optional(),value:z$1.string().nullish(),unit:z$1.string().nullish(),observed_at:z$1.string().nullish(),status:z$1.string().nullish(),origin:z$1.string().nullish(),canonical_key:z$1.string().nullish()}),bn=z$1.object({at:z$1.string(),value:z$1.number().nullish(),display:z$1.string().nullish(),origin:z$1.string().nullish()}),hn=z$1.object({key:z$1.string(),label:z$1.string().optional(),points:z$1.array(bn).optional()}),vn=z$1.object({title:z$1.string(),detail:z$1.string().nullish(),due_at:z$1.string().nullish()}),Ce=z$1.object({doc_id:z$1.string(),title:z$1.string().nullish(),page_count:z$1.number().nullish(),received_at:z$1.string().nullish()});function Fr(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:mn(e.origin),canonicalKey:e.canonical_key??null})}o(Fr,"mapEntityRow");function Dr(e){return Object.freeze({docId:e.doc_id,title:e.title??null,pageCount:e.page_count??null,receivedAt:e.received_at??null})}o(Dr,"mapDocumentRow");z$1.object({identity:z$1.array(gn).optional(),entities:z$1.array(xe).optional(),entity_series:z$1.array(hn).optional(),forward_looking:z$1.array(vn).optional(),documents:z$1.array(Ce).optional()});z$1.object({pet_ref:z$1.string().optional(),granted:z$1.boolean().optional(),version:z$1.string().nullish(),granted_at:z$1.string().nullish()});var R=z$1.string().nullish(),le=z$1.number().nullish(),Rn=z$1.object({collected_at:R,at:R,value:le,unit:R,qualitative_result:R,ref_low:le,ref_high:le,status:R,source_clinic:R,source_doc_id:R,doc_id:R,reviewed:z$1.boolean().nullish()}),_n=z$1.object({collected_at:R,at:R,value:le,unit:R,qualitative_result:R,status:R}),En=z$1.object({marker_id:z$1.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:_n.nullish(),trajectory:R,points:z$1.array(Rn).optional()}),xn=z$1.object({total_markers:z$1.number().int().nonnegative(),in_range_count:z$1.number().int().nonnegative(),out_of_range_count:z$1.number().int().nonnegative(),unknown_count:z$1.number().int().nonnegative()}),Cn=z$1.object({markers:z$1.array(En).optional(),summary:xn.nullish(),disclaimer:z$1.string().optional(),featured_marker_id:R});function Sn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Sn,"isObject");function Ir(e){return Object.freeze({petRef:e,withheld:true,markers:Object.freeze([]),summary:null,disclaimer:"",featuredMarkerId:null})}o(Ir,"withheldMarkers");function zr(e,r){let t=Sn(r)?r:{},n=typeof t.pet_ref=="string"&&t.pet_ref.length>0?t.pet_ref:e;if(t.withheld===true)return Ir(n);let i=Cn.safeParse(t);if(!i.success)return Ir(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(zr,"mapRecordMarkers");var Ar=128,A=128;var wn=z$1.string().min(1).refine(e=>e.startsWith("https://")),Z=z$1.string().nullish(),kn=z$1.object({share_id:z$1.string().min(1),share_url:z$1.string().min(1),expires_at:Z}),Tn=z$1.object({shares:z$1.array(z$1.object({share_id:z$1.string().min(1),expires_at:Z,created_at:Z,view_count:z$1.number().int().nonnegative().nullish(),last_viewed_at:Z})).optional()}),On=z$1.object({download_url:wn,expires_at:Z});function Pn(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(Pn,"resolveShareUrl");function jr(e,r){let t=kn.safeParse(e);if(!t.success)return null;let n=Pn(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(jr,"mapRecordShareLink");function Nr(e){let r=Tn.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(Nr,"mapRecordShareList");function Lr(e){let r=On.safeParse(e);return r.success?Object.freeze({downloadUrl:r.data.download_url,expiresAt:r.data.expires_at??null}):null}o(Lr,"mapRecordPdfLink");var Fn=z$1.object({signatures:z$1.array(z$1.object({signature_id:z$1.string().min(1),preview_url:z$1.string().min(1).refine(e=>e.startsWith("https://")),created_at:z$1.string().nullish()})).optional()});function Mr(e){let r=Fn.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(Mr,"mapSignatureSuggestions");var m=z$1.string().nullish(),ee=z$1.number().nullish(),Dn=z$1.object({at:m,value:ee,unit:m,qualitative_result:m,ref_low:ee,ref_high:ee,status:m,doc_id:m}),In=z$1.object({marker_id:z$1.string(),name:z$1.string(),loinc_code:m,unit:m,panel:m,meaning:m,latest:z$1.object({at:m,value:ee,unit:m,qualitative_result:m,status:m}).nullish(),trajectory:m,points:z$1.array(Dn).optional()}),zn=z$1.object({encounter_id:z$1.string(),date:m,type:m,clinic_name:m,veterinarian:m,doc_id:m}),An=z$1.object({note_id:z$1.string(),encounter_id:m,observed_on:m,sections:z$1.array(z$1.object({section:z$1.string(),text:z$1.string()})).optional()}),jn=z$1.object({exam_id:z$1.string(),encounter_id:m,observed_on:m,doc_id:m,systems:z$1.record(z$1.object({finding_status:m,finding:m})).optional()}),Nn=z$1.object({has_lab_history:z$1.boolean().optional(),has_vaccination_history:z$1.boolean().optional(),has_weight_history:z$1.boolean().optional(),has_vitals_history:z$1.boolean().optional(),has_physical_exam_history:z$1.boolean().optional(),has_procedure_history:z$1.boolean().optional(),has_genetic_history:z$1.boolean().optional(),has_reproductive_history:z$1.boolean().optional(),has_parasite_prevention_history:z$1.boolean().optional(),earliest_record_at:m,latest_record_at:m,documents_ingested:z$1.number().int().nonnegative().optional(),documents_in_review:z$1.number().int().nonnegative().optional(),entities_pending_review:z$1.record(z$1.number().int().nonnegative()).optional(),held_total:z$1.number().int().nonnegative().optional()}),Ln=z$1.object({conflict_id:z$1.string(),entity_type:z$1.string(),field:m,severity:m,candidates:z$1.array(z$1.object({value:z$1.string(),source_doc_id:m,doc_id:m,collected_at:m})).optional()}),Mn=z$1.object({lab_results:z$1.array(In).optional(),encounters:z$1.array(zn).optional(),clinician_notes:z$1.array(An).optional(),physical_exams:z$1.array(jn).optional(),completeness:Nn.nullish(),conflicts:z$1.array(Ln).optional()}),Bn=z$1.object({visits:z$1.array(z$1.object({visit_id:z$1.string(),visit_date:m,veterinarian:m,summary:m,doc_id:m})),vaccines:z$1.array(z$1.object({vaccine_id:z$1.string(),product:m,lot:m,administered_on:m,expires_on:m,doc_id:m})),weights:z$1.array(z$1.object({weight_id:z$1.string(),observed_on:m,weight_kg:ee,doc_id:m})),medications:z$1.array(z$1.object({medication_id:z$1.string(),drug_name:m,dose:m,route:m,frequency:m,sig:m,rx_number:m,started_on:m,stopped_on:m,doc_id:m})),disclaimer:z$1.string().optional()}),qn=z$1.object({document:Ce,contributions:z$1.array(xe),contribution_count:z$1.number().int().nonnegative().optional()});function we(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(we,"isObject");function ke(e,r){return typeof e.pet_ref=="string"&&e.pet_ref.length>0?e.pet_ref:r}o(ke,"petOf");function Se(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(Se,"emptyDepth");function qr(e,r){let t=we(r)?r:{},n=ke(t,e);if(t.withheld===true)return Se(n,true);if(!["lab_results","encounters","clinician_notes","physical_exams","completeness","conflicts"].some(a=>a in t))return Se(n,false);let s=Mn.safeParse(t);if(!s.success)return Se(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(qr,"mapRecordDepth");function Br(e){return Object.freeze({petRef:e,withheld:true,isEmpty:false,visits:Object.freeze([]),vaccines:Object.freeze([]),weights:Object.freeze([]),medications:Object.freeze([]),disclaimer:""})}o(Br,"withheldTimeline");function Ur(e,r){let t=we(r)?r:{},n=ke(t,e);if(t.withheld===true)return Br(n);let i=Bn.safeParse(t);if(!i.success)return Br(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(Ur,"mapRecordsTimeline");function $r(e,r){let t=we(r)?r:{},n=ke(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(Fr));return Object.freeze({petRef:n,withheld:false,document:Dr(s.data.document),contributions:c,contributionCount:s.data.contribution_count??c.length})}o($r,"mapDocumentContributions");var Un="/widget/v1/records/pets";function Hr(e){let r=e.funnel??wr({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=o((a,u)=>typeof a=="string"&&a.length>0&&!Tr(a)&&[...a].length<=u,"segment"),n=o(async(a,u,f,v)=>{if(!t(u,A))return j();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(z("internalError",{retryable:false}))},"read"),i=o(a=>`${Un}/${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(z("internalError",{retryable:false})):$(g)},"parsed"),d=o((a,u)=>!t(a.entityType,Or)||!t(a.canonicalKey,Pr)||a.idempotencyKey!==void 0&&!t(a.idempotencyKey,Ar)||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=>qr(a,u)),"getRecordDepth"),getTimeline:o(a=>n("records.depth.timeline",a,`${i(a)}/timeline`,u=>Ur(a,u)),"getTimeline"),getDocumentContributions(a,u){return t(u,64)?n("records.depth.contributions",a,`${i(a)}/documents/${encodeURIComponent(u)}/contributions`,f=>$r(a,f)):j()},getMarkers:o(a=>n("records.depth.markers",a,`${i(a)}/markers`,u=>zr(a,u)),"getMarkers"),createShare(a){return t(a,A)?c("records.share.create",{method:"POST",path:`${s(a)}/share`},u=>jr(u,e.apiBaseUrl)):j()},listShares(a){return t(a,A)?c("records.share.list",{method:"GET",path:`${s(a)}/shares`},Nr):j()},async revokeShare(a,u){if(!t(a,A)||!t(u,64))return j();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,A)?c("records.pdf.link",{method:"GET",path:`${s(a)}/pdf-link`},Lr):j()},async editFact(a,u){let f=t(a,A)?d(u,u.correctedFields):null;if(f===null)return j();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,A)?d(u):null;if(f===null)return j();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},listAuthorizationSignatures:o(()=>c("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},Mr),"listAuthorizationSignatures")}}o(Hr,"createRecordsDepthClient");function j(){return Promise.resolve(O(z("validationFailed",{retryable:false})))}o(j,"invalid");var Vn=new Map,Vr=new Set;function Wn(e){return Vn.get(e)??0}o(Wn,"recordsConsentEpochOf");function Yn(e){return Vr.add(e),()=>{Vr.delete(e);}}o(Yn,"subscribe");function Wr(e){let r=useCallback(()=>Wn(e),[e]);return useSyncExternalStore(Yn,r,r)}o(Wr,"useRecordsConsentEpoch");function Kr(){let{runtime:e,userRef:r,scopeEpoch:t}=M();return useMemo(()=>{let{services:n}=e.registry;return Hr({auth:n.authFor(r),...n.errorPolicy?{errorPolicy:n.errorPolicy}:{},...typeof n.apiBaseUrl=="string"?{apiBaseUrl:n.apiBaseUrl}:{}})},[e,r,t])}o(Kr,"useEverfurRecordsDepthClient");function re(e,r,t,n=""){let i=Kr(),{userRef:s}=M(),c=Wr(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 Ve=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 N=await r(i,e);Ve===f.current&&(N.ok?u({scope:d,value:N.value,error:null,loading:false}):u({scope:d,value:null,error:N.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,q=g.loading?"loading":k!==null?"error":g.value===null?"empty":g.value.withheld?"populated":t(g.value)?"empty":"populated";return useMemo(()=>({status:q,value:g.value,error:k,available:E,refresh:b}),[q,g.value,k,E,b])}o(re,"useRecordsDepthRead");var Fe=class Fe 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(Fe,"HostRenderBoundary");var Oe=Fe;function Jn({render:e}){return e()}o(Jn,"RenderHost");function Pe({render:e,fallback:r,resetKey:t}){return createElement(Oe,{fallback:r,resetKey:t,children:createElement(Jn,{render:e})})}o(Pe,"HostRender");function ze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))ze(e[r]);}return e}o(ze,"deepFreeze");var Zn=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Qr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Jr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Xr={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},eo={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},ro={regular:"400",medium:"500",bold:"700"},to={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},no=0,de="System",ue="monospace",oo=["content","heading","control","compact","badge"];function io(e){let r={};for(let t of oo)r[t]=e;return r}o(io,"authoredTierSizes");function Zr(){return {family:de,mono:ue,fontUrl:null,families:{regular:de,medium:de,bold:de,mono:ue,monoMedium:ue,monoBold:ue},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Xr,tierSizes:io(Xr),lineHeight:eo,weight:ro,letterSpacing:to,scale:1,maxScale:no,scaleCaps:Zn}}o(Zr,"baseType");var et={},De=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function Ie(e){return `cubic-bezier(${e.join(", ")})`}o(Ie,"cssCubicBezier");var rt={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:Ie(De.standard),emphasized:Ie(De.emphasized),exit:Ie(De.exit)},reducedMotion:false},ao={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)"},tt=ze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ao,space:Qr,radius:Jr,type:Zr(),motion:rt,slots:et}),so={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)"};ze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:so,space:Qr,radius:Jr,type:Zr(),motion:rt,slots:et});var nt=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),ot=globalThis,Ae=ot[nt]??(ot[nt]=createContext(tt));Ae.displayName??="EverfurThemeContext";function S(){return useContext(Ae)}o(S,"useEverfurTheme");var it=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var at='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',co="System";function po(e){let r=e.trim();return r.length===0||r===co?at:`${st(r)}, ${at}`}o(po,"cssFontFamily");function fo(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${st(r)}, ui-monospace, Menlo, Consolas, monospace`}o(fo,"cssMonoFamily");function st(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}o(st,"quote");function _(e,r){let t=e.type,n=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?fo(n):po(n),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[it[r]]}}o(_,"faceCss");var yo=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 mo(e){return yo[e]}o(mo,"requires");function lt(e,r,t){let n=mo(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 je({name:e,enabled:false,isPending:true,limits:{}});let s=go(n,i);return n.filter(d=>i.get(d)?.granted!==true).length===0?je({name:e,enabled:true,isPending:false,limits:s}):je({name:e,enabled:false,isPending:false,limits:s,disabled:bo(n,i)})}o(lt,"decideCapability");function go(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(go,"mergeLimits");function bo(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:_e("accessDenied"),level:"user_entitlement",recoverable:false})}o(bo,"disabledFor");function je(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(je,"freezeDecision");function Ne(e){let{runtime:r}=M(),t=r.entitlements,n=useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return useMemo(()=>lt(e,n.decisions,{isPending:n.isPending}),[e,n])}o(Ne,"useCapability");var Ro=48;function _o(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(_o,"selectView");function ct(e){let{capability:r,children:t,renderDisabled:n,renderPending:i,style:s,className:c}=e,d=Ne(r),a=useMemo(()=>_o(d),[d]);switch(a){case "enabled":return t;case "pending":return i?jsx(Pe,{render:i,fallback:jsx(dt,{capability:r,style:s,className:c})}):jsx(dt,{capability:r,style:s,className:c});case "disabled":return n?jsx(Pe,{render:()=>n(d),fallback:jsx(ut,{decision:d,style:s,className:c}),resetKey:d}):jsx(ut,{decision:d,style:s,className:c});default:return _r(a)}}o(ct,"CapabilityGate");function dt({capability:e,style:r,className:t}){let n=S(),i=useMemo(()=>pt(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(dt,"PendingSkeleton");function ut({decision:e,style:r,className:t}){let n=S(),i=useMemo(()=>pt(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(ut,"OffState");function pt(e){let{color:r,space:t,radius:n,type:i}=e;return {offstate:{boxSizing:"border-box",minHeight:Ro,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(pt,"makeStyles");var Me=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 yt(e){let r=S(),t=useMemo(()=>xo(r),[r]);return jsxs("div",{role:"note",className:e.className,style:{...t.container,...e.style},children:[jsx("p",{style:t.title,children:Me.title}),jsx("p",{style:t.body,children:Me.body})]})}o(yt,"ClinicalDisclaimer");function xo(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(xo,"makeStyles");var So=120,wo=44;function ko({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:So,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:wo,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(ko,"RecordsGateOffState");function mt(e,r){return e===void 0?{}:{renderDisabled:o(t=>jsx(ko,{reason:t.disabled?.reason??"",onExit:e,exitLabel:r}),"renderDisabled")}}o(mt,"recordsGateExit");var Po=120,te=44,qe="Back";function Fo(){let e=S(),r=useMemo(()=>Do(e),[e]);return {theme:e,styles:r}}o(Fo,"useScreenStyles");function ce({title:e,onBack:r,right:t,testID:n,variant:i="brand"}){let{styles:s}=Fo();return jsxs("header",{style:s.headerRow,"data-testid":n,children:[r?jsx("button",{type:"button",onClick:r,"aria-label":qe,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(ce,"ScreenHeader");function Do(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,q="regular")=>({margin:0,..._(e,q),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:te,minWidth:te,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:Po,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:te,height:te,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.brand,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:te,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(Do,"makeScreenStyles");var gt=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"})}),Ue=60;function bt(e){return `Try again in ${e}s`}o(bt,"coolingActionLabel");var ht="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 jo=44,$e=62;function Rt({testID:e}){let r=_t();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:jo,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(Rt,"TimelineSkeleton");function pe({variant:e,onAction:r,message:t,testID:n}){let i=_t(),s=gt[e],[c,d]=useState(e==="rate_limited"?Ue:0);useEffect(()=>{e==="rate_limited"&&d(Ue);},[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?bt(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?ht:u,style:{...i.emptyAction,...a?i.emptyActionDisabled:{}},"data-testid":n?`${n}-action`:`records-empty-${e}-action`,children:u}):null]})}o(pe,"RecordsEmptyState");function _t(){let e=S();return useMemo(()=>No(e),[e])}o(_t,"useStyles");function No(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:$e},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(No,"makeStyles");var Uo=300,Et=120,xt=44,$o=o((e,r)=>e.getTimeline(r),"readTimeline"),Ho=o(e=>e.isEmpty,"timelineEmpty"),Vo=o((e,r)=>e.getRecordDepth(r),"readDepth"),Wo=o(e=>!e.available||e.labResults.length+e.encounters.length+e.clinicianNotes.length+e.physicalExams.length===0,"depthEmpty"),Yo=o(e=>e.contributions.length===0,"contributionsEmpty");function Ko({petRef:e,style:r,className:t,onBack:n}){let i=re(e,$o,Ho);return jsx(He,{state:i,style:r,className:t,onBack:n,header:jsx(ce,{title:h.timeline,onBack:X(n),testID:"timeline-header"}),loading:jsx(Rt,{testID:"timeline-loading"}),empty:jsx(pe,{variant:"no_records",testID:"timeline-empty"}),render:s=>jsx(Zo,{timeline:s})})}o(Ko,"EverfurRecordsTimeline");function Go({petRef:e,style:r,className:t,onBack:n}){let i=re(e,Vo,Wo);return jsx(He,{state:i,style:r,className:t,onBack:n,header:n?jsx(ce,{title:B.records,onBack:X(n)}):null,render:s=>jsx(ei,{depth:s})})}o(Go,"EverfurRecordDepth");function Xo({petRef:e,docId:r,style:t,className:n,onBack:i}){let s=useCallback((a,u)=>a.getDocumentContributions(u,r),[r]),c=re(e,s,Yo,r),d=c.value?.document?.title?.trim()||h.uploadedDocument;return jsx(He,{state:c,style:t,className:n,onBack:i,header:jsx(ce,{title:d,onBack:X(i),testID:"contributions-header"}),empty:jsx(pe,{variant:"no_records",testID:"contributions-empty"}),render:a=>jsx(ri,{view:a})})}o(Xo,"EverfurDocumentContributions");function He({state:e,style:r,className:t,header:n,loading:i,empty:s,render:c,onBack:d}){let{styles:a}=fe(),{userRef:u}=M();return jsx(ct,{capability:"records",style:r,className:t,...mt(X(d),qe),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:B.sessionRequired}):Qo(e,c,a,i,s)}),jsx(yt,{})]})})}o(He,"DepthSurface");function Qo(e,r,t,n,i){switch(e.status){case "loading":return n??jsx(Jo,{styles:t});case "empty":return i??jsx("div",{style:t.centered,children:jsx("div",{role:"img","aria-label":B.empty,style:t.emptyGlyph})});case "error":return e.error?jsx(pe,{variant:er(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(Qo,"renderState");function Jo({styles:e}){let[r,t]=useState(false);return useEffect(()=>{let n=setTimeout(()=>t(true),Uo);return ()=>clearTimeout(n)},[]),jsx("div",{role:"status","aria-busy":"true","aria-label":B.loading,style:e.centered,children:r?jsx("div",{"aria-hidden":"true",style:e.spinner}):null})}o(Jo,"LoadingState");function Zo({timeline:e}){let{styles:r}=fe(),t=be(e);return jsxs("section",{"aria-label":h.timeline,style:r.timelineList,children:[e.disclaimer.length>0?jsx("p",{role:"note","aria-label":Ze.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(Zo,"TimelineBody");function ei({depth:e}){let{styles:r}=fe();return jsxs("section",{"aria-label":B.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=ir(t.latest.status),i=ur(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:dr(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?ie(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:ar(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:sr(n.section)}),jsx("dd",{style:n.text?r.rowDetail:r.rowMuted,children:n.text||h.notRecorded})]},`${n.section}:${i}`))})]},t.noteId))]}):null]})}o(ei,"DepthBody");function ri({view:e}){let{styles:r}=fe();return jsxs("section",{"aria-label":B.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:tr(t.value,t.unit)}),t.observedAt?jsx("dd",{style:r.rowDetail,children:w(t.observedAt)}):null]},t.key))})]})}o(ri,"ContributionsBody");function fe(){let e=S(),r=useMemo(()=>ti(e),[e]);return {theme:e,styles:r}}o(fe,"useDepthTheme");function ti(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:Et,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:Et,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:xt,minWidth:xt,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:$e,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(ti,"makeStyles");
2
+ export{Xo as EverfurDocumentContributions,Go as EverfurRecordDepth,Ko as EverfurRecordsTimeline,be as buildTimelineRows,$r as mapDocumentContributions,qr as mapRecordDepth,Ur as mapRecordsTimeline,Kr as useEverfurRecordsDepthClient,re as useRecordsDepthRead};