@everfur/sdk 0.7.1 → 0.8.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.
- package/CHANGELOG.md +311 -0
- package/README.md +24 -16
- package/dist/{Chat-CFi5cNUF.d.ts → Chat-Cv9EYMYA.d.ts} +3 -3
- package/dist/{Chat-DQOsAumH.d.cts → Chat-s2vcPbw3.d.cts} +3 -3
- package/dist/{DepthViews-uilL1NJZ.d.ts → DepthViews-CVxUHOJ-.d.ts} +1 -1
- package/dist/{DepthViews-C409ubw-.d.cts → DepthViews-Cz7mSW7p.d.cts} +1 -1
- package/dist/{DepthViews-es8mIK0w.d.ts → DepthViews-DNRY0Ugm.d.ts} +1 -1
- package/dist/{DepthViews-D81c95Ra.d.cts → DepthViews-DvNixbxg.d.cts} +1 -1
- package/dist/{ErrorPolicyPort-D22LUVrK.d.ts → ErrorPolicyPort-DwSnmGcX.d.ts} +1 -1
- package/dist/{ErrorPolicyPort-D6CybiqJ.d.cts → ErrorPolicyPort-NFDPe-5w.d.cts} +1 -1
- package/dist/{EverfurError-DmELDpXp.d.cts → EverfurError-pEXDbUJ1.d.cts} +9 -1
- package/dist/{EverfurError-DmELDpXp.d.ts → EverfurError-pEXDbUJ1.d.ts} +9 -1
- package/dist/{EverfurResult-ZtH-YV1h.d.cts → EverfurResult-dtl8ERAw.d.cts} +1 -1
- package/dist/{EverfurResult-SGvHKsCB.d.ts → EverfurResult-sKkoXew0.d.ts} +1 -1
- package/dist/IntakeMedia-BFZfBLjB.d.cts +116 -0
- package/dist/{IntakeMedia-BcjjUizr.d.ts → IntakeMedia-BH0fYDT2.d.cts} +19 -2
- package/dist/{IntakeMedia-CL_S2tZE.d.cts → IntakeMedia-Bavl7E4Z.d.ts} +19 -2
- package/dist/IntakeMedia-C8GlN_GK.d.ts +116 -0
- package/dist/animations/index.cjs +109 -1
- package/dist/animations/index.d.cts +6 -6
- package/dist/animations/index.d.ts +6 -6
- package/dist/animations/index.js +109 -1
- package/dist/{attachments-DNaSbmA3.d.ts → attachments-BaslXMdS.d.ts} +3 -3
- package/dist/{attachments-DI710no4.d.cts → attachments-DbFwz4iq.d.cts} +7 -7
- package/dist/{attachments-B2GjBgvF.d.cts → attachments-y3EcOX_w.d.cts} +3 -3
- package/dist/{attachments-SF88N654.d.ts → attachments-y_aO4hlk.d.ts} +7 -7
- package/dist/{bookingCopy-xlXxORCA.d.cts → bookingCopy-4i1R7klo.d.cts} +15 -7
- package/dist/{bookingCopy-D2N3RhsV.d.ts → bookingCopy-B3UMITD-.d.ts} +15 -7
- package/dist/{branding-ytH4jJq1.d.ts → branding-BYEqU855.d.ts} +1 -1
- package/dist/{branding-Bio5MM6g.d.cts → branding-BwEu68C8.d.cts} +1 -1
- package/dist/{callRoom-7wrE3RP2.d.ts → callRoom-B1qq_D-4.d.ts} +1 -1
- package/dist/{callRoom-B_EqaUzx.d.cts → callRoom-DfZTWFXh.d.cts} +1 -1
- package/dist/{casesRepository-B-md8h1S.d.cts → casesRepository-B6Z0XBIb.d.cts} +2 -2
- package/dist/{casesRepository-CC6951TK.d.ts → casesRepository-SI0zp5YH.d.ts} +2 -2
- package/dist/chat/index.cjs +333 -1
- package/dist/chat/index.d.cts +12 -12
- package/dist/chat/index.d.ts +12 -12
- package/dist/chat/index.js +333 -1
- package/dist/client/index.cjs +115 -11
- package/dist/client/index.d.cts +14 -14
- package/dist/client/index.d.ts +14 -14
- package/dist/client/index.js +115 -11
- package/dist/{config-BM0sv5jx.d.ts → config-Cvo47voG.d.ts} +3 -3
- package/dist/{config-Daa1plhQ.d.cts → config-v5k6NsK_.d.cts} +3 -3
- package/dist/consent/index.cjs +112 -1
- package/dist/consent/index.d.cts +9 -9
- package/dist/consent/index.d.ts +9 -9
- package/dist/consent/index.js +112 -1
- package/dist/{context-DQHtwcHN.d.cts → context-BZOtJbBO.d.cts} +9 -9
- package/dist/{context-CDV2pwGI.d.ts → context-cZ7NZ0sG.d.ts} +9 -9
- package/dist/{copy-Cl1l-qmY.d.ts → copy-CZBUHbyS.d.ts} +5 -5
- package/dist/{copy-BEx5F71o.d.cts → copy-ChJupm1p.d.cts} +5 -5
- package/dist/core/index.cjs +140 -13
- package/dist/core/index.d.cts +19 -19
- package/dist/core/index.d.ts +19 -19
- package/dist/core/index.js +140 -13
- package/dist/{depth-CAAwiStc.d.cts → depth-CRyU7-pf.d.cts} +7 -6
- package/dist/{depth-DfNRVtrV.d.ts → depth-vNpwOkZ8.d.ts} +7 -6
- package/dist/{entitlementRepository-DPvWjV-N.d.cts → entitlementRepository-Bv8nSYRd.d.cts} +4 -4
- package/dist/{entitlementRepository-CVWvND1P.d.ts → entitlementRepository-CUdxbQrP.d.ts} +4 -4
- package/dist/{identity-BhT7oJDS.d.ts → identity-B8GkH53J.d.ts} +2 -2
- package/dist/{identity-DUlshgow.d.cts → identity-BHaMJ3KK.d.cts} +2 -2
- package/dist/index.cjs +363 -12
- package/dist/index.d.cts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +363 -12
- package/dist/{models-DSqA5Ahs.d.ts → models-CrbUwbuS.d.ts} +1 -1
- package/dist/{models-Bn2z0NNo.d.cts → models-DzvqEjMm.d.cts} +1 -1
- package/dist/notifications/index.cjs +94 -2
- package/dist/notifications/index.d.cts +5 -5
- package/dist/notifications/index.d.ts +5 -5
- package/dist/notifications/index.js +94 -2
- package/dist/{pets-Bneph9m1.d.cts → pets-BI7Ji8hi.d.cts} +2 -2
- package/dist/{pets-DjcLmRrW.d.ts → pets-Dnn-DK1T.d.ts} +2 -2
- package/dist/{petsRepository-BwxmfX_s.d.ts → petsRepository-B2lO1sKS.d.ts} +2 -2
- package/dist/{petsRepository-BnVre3q7.d.cts → petsRepository-BP9nhM1R.d.cts} +2 -2
- package/dist/photo/index.cjs +131 -1
- package/dist/photo/index.d.cts +3 -3
- package/dist/photo/index.d.ts +3 -3
- package/dist/photo/index.js +131 -1
- package/dist/{ports-Di9rdLO9.d.ts → ports-BUXF0Rp3.d.ts} +7 -7
- package/dist/{ports-BPKxFOSe.d.cts → ports-C40S2V14.d.cts} +7 -7
- package/dist/records/depth/index.cjs +200 -2
- package/dist/records/depth/index.d.cts +11 -11
- package/dist/records/depth/index.d.ts +11 -11
- package/dist/records/depth/index.js +200 -2
- package/dist/records/index.cjs +742 -4
- package/dist/records/index.d.cts +22 -14
- package/dist/records/index.d.ts +22 -14
- package/dist/records/index.js +742 -4
- package/dist/{requestFunnel-CiSX2pun.d.ts → requestFunnel-BrOijMcw.d.ts} +5 -5
- package/dist/{requestFunnel-DMR_1T3O.d.cts → requestFunnel-BxNVGyGm.d.cts} +5 -5
- package/dist/{runtimeTypes-CkMFCbHW.d.ts → runtimeTypes-CvI1ZH8j.d.ts} +7 -7
- package/dist/{runtimeTypes-2gJ5hYoE.d.cts → runtimeTypes-DOO3f-W-.d.cts} +7 -7
- package/dist/server/events/index.cjs +92 -2
- package/dist/server/events/index.d.cts +4 -4
- package/dist/server/events/index.d.ts +4 -4
- package/dist/server/events/index.js +92 -2
- package/dist/server/index.cjs +95 -2
- package/dist/server/index.d.cts +5 -5
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +95 -2
- package/dist/televet/booking/index.cjs +394 -4
- package/dist/televet/booking/index.d.cts +24 -127
- package/dist/televet/booking/index.d.ts +24 -127
- package/dist/televet/booking/index.js +394 -4
- package/dist/televet/call/index.cjs +71 -1
- package/dist/televet/call/index.d.cts +3 -3
- package/dist/televet/call/index.d.ts +3 -3
- package/dist/televet/call/index.js +71 -1
- package/dist/televet/index.cjs +101 -1
- package/dist/televet/index.d.cts +25 -8
- package/dist/televet/index.d.ts +25 -8
- package/dist/televet/index.js +101 -1
- package/dist/{bookingTypes-D4pD3tHs.d.ts → televetGlobal-C5dTUACe.d.cts} +34 -1
- package/dist/{bookingTypes-D4pD3tHs.d.cts → televetGlobal-CnjrfhT4.d.ts} +34 -1
- package/dist/testing/index.cjs +98 -7
- package/dist/testing/index.d.cts +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +98 -7
- package/dist/testing/rn/index.cjs +101 -1
- package/dist/testing/rn/index.d.cts +13 -13
- package/dist/testing/rn/index.d.ts +13 -13
- package/dist/testing/rn/index.js +101 -1
- package/dist/testing/web/index.cjs +95 -1
- package/dist/testing/web/index.d.cts +14 -14
- package/dist/testing/web/index.d.ts +14 -14
- package/dist/testing/web/index.js +95 -1
- package/dist/{timelineRows-D3171ksh.d.ts → timelineRows-CEx2TzYB.d.ts} +1 -1
- package/dist/{timelineRows-DDnz4gx2.d.cts → timelineRows-Dffceql_.d.cts} +1 -1
- package/dist/{tokens-BYtbKwFh.d.cts → tokens-Tzo1KBND.d.cts} +43 -2
- package/dist/{tokens-BYtbKwFh.d.ts → tokens-Tzo1KBND.d.ts} +43 -2
- package/dist/{typeStyle-DKz02DGU.d.ts → typeStyle-C3IG9Sft.d.ts} +22 -3
- package/dist/{typeStyle-BqfwxZH4.d.cts → typeStyle-CZ3Tj60N.d.cts} +22 -3
- package/dist/{useRecordsDepth-COJ0wSYK.d.cts → useRecordsDepth-D6a6-_u_.d.cts} +7 -6
- package/dist/{useRecordsDepth-Z9FF5X4E.d.ts → useRecordsDepth-DuPUJFDQ.d.ts} +7 -6
- package/dist/{useVetVisit-Ds8f1peV.d.cts → useVetVisit-BQX_aTJs.d.cts} +2 -2
- package/dist/{useVetVisit-BsjoDO-n.d.ts → useVetVisit-RPBOabl8.d.ts} +2 -2
- package/dist/video/index.cjs +122 -1
- package/dist/video/index.d.cts +3 -3
- package/dist/video/index.d.ts +3 -3
- package/dist/video/index.js +122 -1
- package/dist/{view-DoQEHXJR.d.ts → view-BSmN5RWf.d.ts} +5 -5
- package/dist/{view-nRy6SitU.d.cts → view-UFwCG1Pn.d.cts} +5 -5
- package/dist/web/consent/index.cjs +111 -1
- package/dist/web/consent/index.d.cts +9 -9
- package/dist/web/consent/index.d.ts +9 -9
- package/dist/web/consent/index.js +111 -1
- package/dist/web/index.cjs +325 -14
- package/dist/web/index.d.cts +22 -22
- package/dist/web/index.d.ts +22 -22
- package/dist/web/index.js +325 -14
- package/dist/web/notifications/index.cjs +95 -2
- package/dist/web/notifications/index.d.cts +7 -7
- package/dist/web/notifications/index.d.ts +7 -7
- package/dist/web/notifications/index.js +95 -2
- package/dist/web/records/depth/index.cjs +169 -2
- package/dist/web/records/depth/index.d.cts +11 -11
- package/dist/web/records/depth/index.d.ts +11 -11
- package/dist/web/records/depth/index.js +169 -2
- package/dist/web/records/index.cjs +689 -4
- package/dist/web/records/index.d.cts +34 -37
- package/dist/web/records/index.d.ts +34 -37
- package/dist/web/records/index.js +689 -4
- package/dist/web/records/upload/index.cjs +3 -0
- package/dist/web/records/upload/index.d.cts +23 -0
- package/dist/web/records/upload/index.d.ts +23 -0
- package/dist/web/records/upload/index.js +3 -0
- package/dist/web/televet/booking/index.cjs +423 -4
- package/dist/web/televet/booking/index.d.cts +21 -35
- package/dist/web/televet/booking/index.d.ts +21 -35
- package/dist/web/televet/booking/index.js +423 -4
- package/dist/web/televet/call/index.cjs +28 -1
- package/dist/web/televet/call/index.d.cts +2 -2
- package/dist/web/televet/call/index.d.ts +2 -2
- package/dist/web/televet/call/index.js +28 -1
- package/dist/web/televet/index.cjs +102 -4
- package/dist/web/televet/index.d.cts +22 -11
- package/dist/web/televet/index.d.ts +22 -11
- package/dist/web/televet/index.js +102 -4
- package/package.json +20 -4
- package/web/records/upload/native-blocked.cjs +12 -0
- package/web/records/upload/package.json +8 -0
- package/dist/televetGlobal-CEk0_cW9.d.cts +0 -34
- package/dist/televetGlobal-Cs9Wbqsy.d.ts +0 -34
|
@@ -1,2 +1,169 @@
|
|
|
1
|
-
'use strict';var react=require('react'),zod=require('zod'),jsxRuntime=require('react/jsx-runtime');var Ut=Object.defineProperty;var o=(e,r)=>Ut(e,"name",{value:r,configurable:true});function qt(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(qt,"slotBox");function $(e){return e?.textColor===void 0?{}:{color:e.textColor}}o($,"slotText");function L(e,r){let t=qt(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 nr(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(nr,"reportHostFailure");function Bt(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(Bt,"isThenable");function $t(e,...r){if(typeof e=="function")try{let t=e(...r);return Bt(t)&&Promise.resolve(t).then(void 0,nr),t}catch(t){nr(t);return}}o($t,"callHost");var or=new WeakMap;function re(e){if(typeof e!="function")return;let r=or.get(e);if(r!==void 0)return r;let t=o((...n)=>{$t(e,...n);},"guarded");return or.set(e,t),t}o(re,"guardHost");function H(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}o(H,"ok");function P(e){return Object.freeze({ok:false,error:e})}o(P,"err");var le=class le extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,le.prototype);}};o(le,"EverfurConfigError");var te=le;var ir=Symbol.for("@everfur/sdk#EverfurContext@v1"),ar=globalThis,sr=ar[ir]??(ar[ir]=react.createContext(null));sr.displayName??="EverfurContext";function M(){let e=react.useContext(sr);if(e===null)throw new te("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(M,"useEverfurContext");var U=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"}),lr="Everfur summarizes what your vet recorded. It is informational, not diagnostic.";var Wt="your pet";function I(e){let r=e?.trim()??"";return r.length>0?r:Wt}o(I,"petNameOr");var dr=Object.freeze({title:"Health records",titleWeb:o(e=>{let r=e?.trim()??"";return r.length>0?`${r}\u2019s Records`:"Health records"},"titleWeb"),titleNative:o(e=>{let r=e?.trim()??"";return r.length>0?r:"Health records"},"titleNative"),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:"At a glance",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",askNamed:o(e=>{let r=e?.trim()??"";return r.length>0?`Ask about ${r}`:"Ask about this marker"},"askNamed"),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 are on the way`,"title"),anotherClinic:"Another clinic",anotherClinicSub:"Seen more than one vet? We ask each one.",uploadDocumentPhotoSub:"A PDF, or a photo of a paper record.",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"),firstRecordTitle:o(e=>`Add ${I(e)}\u2019s first record`,"firstRecordTitle"),body:"Records can come from more than one clinic over a lifetime.",requestFromClinic:"Request from a clinic",requestFromClinicSub:"We send a secure request and read every page they send back.",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 cr(e){return e?.httpStatus===429?"rate_limited":e?.httpStatus===502?"service_unavailable":"error"}o(cr,"recordsEmptyVariantForError");function pr(e,r){return e===null?"":r?`${e} ${r}`:e}o(pr,"formatEntityValue");var ur=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(e){if(!e)return "-";let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(r!==null){let i=ur[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 `${ur[n.getUTCMonth()]} ${n.getUTCDate()}, ${n.getUTCFullYear()}`}o(k,"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 yr(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(yr,"markerStatusLabel");function Yt(e,r){return r<2?null:`${e==="flat"?"Holding steady":`Trending ${e==="down"?"down":e==="up"?"up":"steady"}`} over ${r} visits`}o(Yt,"trajectoryLabel");function de(e){let r=e.replace(/_/g," ").trim();return r.length===0?e:r.charAt(0).toUpperCase()+r.slice(1)}o(de,"humanize");var fr=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 gr(e){return Object.prototype.hasOwnProperty.call(fr,e)?fr[e]:de(e)}o(gr,"bodySystemLabel");var mr=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 br(e){return Object.prototype.hasOwnProperty.call(mr,e)?mr[e]:de(e)}o(br,"soapSectionLabel");function hr(e){return e===null||!Number.isFinite(e)?"-":`${e.toFixed(3).replace(/\.?0+$/,"")} kg`}o(hr,"formatWeightKg");function vr(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(vr,"formatMarkerReading");function Rr(e,r,t){let n=Yt(r,t);return e?`${h.measured(k(e))}${n?` \xB7 ${n}`:""}`:n}o(Rr,"labDetailLine");var ce=Object.freeze({visit:0,vaccine:1,weight:2,medication:3});function _r(e){if(!e)return null;let r=Date.parse(e);return Number.isNaN(r)?null:r}o(_r,"toMillis");function Se(e){let r=[...e.visits.map((t,n)=>({key:`visit-${n}-${t.visitId}`,kind:"visit",kindLabel:h.kind.visit,at:t.visitDate,date:k(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(k(t.expiresOn))),{key:`vaccine-${n}-${t.vaccineId}`,kind:"vaccine",kindLabel:h.kind.vaccine,at:t.administeredOn,date:k(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:k(t.observedOn),title:hr(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:k(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=_r(t.at),s=_r(n.at);return i===null&&s===null?ce[t.kind]-ce[n.kind]:i===null?1:s===null?-1:s!==i?s-i:ce[t.kind]-ce[n.kind]}))}o(Se,"buildTimelineRows");var Ce=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(Ce.map(e=>e.wireCode));var Kt=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"}),xr=Object.freeze(Ce.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Kt[e.wireCode]}))),Gt=new Map(xr.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Xt=Object.freeze(["http_envelope",...[...new Set(xr.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function ue(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let n of [r??"http_envelope",...Xt]){let i=Gt.get(n+t);if(i)return i}}o(ue,"contractErrorFor");function Qt(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Qt,"contractDocUrl");function Sr(e){return null}o(Sr,"publishedDocUrl");var Jt=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 Cr(e){return Jt[e]}o(Cr,"categoryFor");function wr(e){let r=ue(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),n=t.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(t.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":case "TELEVETRATELIMITED":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}o(wr,"fromWire");var Zt=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function we(e){return Zt.has(e)}o(we,"isAutoRetryable");var en=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Tr(e){return we(e)||en.has(e)}o(Tr,"isRetryableCode");var rn=500,Te=8e3,kr=4;function Or(e,r=Math.random){let t=Math.max(0,e),n=Math.min(rn*2**t,Te);return Math.floor(r()*n)}o(Or,"backoffDelayMs");var tn=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 ke(e){return tn[e]}o(ke,"userFacingError");function Pr(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}o(Pr,"defineHidden");var nn=/^[a-z][a-z0-9_]{0,63}$/;function N(e,r){let t=ue(r?.wireCode,r?.wireEnvelope),n={code:e,category:Cr(e),retryable:r?.retryable??Tr(e),displayMessage:ke(e)};if(r?.httpStatus!==void 0&&(n.httpStatus=r.httpStatus),r?.requestId&&(n.requestId=r.requestId),typeof r?.reasonCode=="string"&&nn.test(r.reasonCode)&&(n.reasonCode=r.reasonCode),t);return r?.wireMessage&&Pr(n,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&Pr(n,"raw",r.raw),Object.freeze(n)}o(N,"makeEverfurError");function Fr(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(Fr,"assertNever");function Ar(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(Ar,"errorFrame");function sn(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(sn,"authHeaders");function ne(e,r){return {...e,headers:{...ln(e.headers),...sn(r)}}}o(ne,"withAuthHeaders");function ln(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(ln,"stripAuthHeaders");async function Dr(e,r){if(r.mode==="anonymous")return r.transport.request(ne(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return P(Oe())}let n=await r.transport.request(ne(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 P(Oe())}let s=await r.transport.request(ne(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?P(Oe(s.error.httpStatus)):s}o(Dr,"authedSend");function Oe(e){return N("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(Oe,"authRejectedError");function Ir(e){return N("internalError",{retryable:true,wireMessage:dn(e)})}o(Ir,"networkError");function dn(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(dn,"describeCause");var cn=3e4,un=Te*2,pn="idempotency-key",fn=new Set(["POST","PUT","PATCH","DELETE"]),mn=Object.freeze({onEvent(){}}),yn=Object.freeze({setTimeout:o((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function gn(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}o(gn,"seededIdempotencyKey");function jr(e){let r=e.observer??mn,t=e.timers??yn,n=e.rng??Math.random,i=e.sleep??((g,v)=>Pn(g,t,v)),s=e.maxAttempts??kr,u=e.unaryTimeoutMs??cn,d=e.newIdempotencyKey??hn(),a=o(g=>{try{r.onEvent(g);}catch{}},"emit");async function c(g,v,E){let S=E?.maxAttempts,B=Math.max(1,S??s),Q=E?.idempotent??fn.has(v.method),J=E?.idempotencyKey===void 0?null:gn(E.idempotencyKey),Re=Q?J??d():null,Mt=bn(v,Re),_e=0;for(;;){let Z=o(xe=>Object.freeze({call:g,method:v.method,path:v.path,attempt:_e,...Re?{idempotencyKey:Re}:{},...xe}),"stamp");a(Z({phase:"attempt"}));let rr=kn(u,t),tr=On(rr.signal,v.signal),ee;try{ee=await Dr({...Mt,signal:tr.signal},e.auth);}catch(xe){ee=P(Ir(xe));}finally{tr.dispose(),rr.cancel();}if(ee.ok)return a(Z({phase:"settled",ok:true,reason:"ok"})),ee;let j=ee.error,se=Rn(j,_e,{maxAttempts:B,rng:n,now:t.now(),aborted:v.signal?.aborted===true,...S!==void 0?{perCallMaxAttempts:S}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),Ee={ok:false,code:j.code,reason:se.reason,...j.httpStatus!==void 0?{httpStatus:j.httpStatus}:{},...j.requestId!==void 0?{requestId:j.requestId}:{}};if(!se.retry)return a(Z({phase:"settled",...Ee})),P(j);if(a(Z({phase:"retry",...Ee,delayMs:se.delayMs})),await i(se.delayMs,v.signal),v.signal?.aborted===true)return a(Z({phase:"settled",...Ee,reason:"aborted"})),P(j);_e+=1;}}o(c,"send");async function p(g){return ne(g,await Tn(e.auth))}o(p,"authorize");async function*b(g,v,E){a(Object.freeze({call:g,phase:"stream.open",method:v.method,path:v.path,attempt:0}));try{yield*e.auth.transport.stream(v,E);}catch{yield Ar({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(b,"stream"),Object.freeze({send:c,authorize:p,stream:b})}o(jr,"createRequestFunnel");function bn(e,r){let t={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==pn&&(t[n]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}o(bn,"assembleHeaders");function hn(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(hn,"defaultIdempotencyKeyFactory");var vn=10;function Rn(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let n=_n(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!we(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 u=o(()=>{if(t.policy===void 0)return null;let c;try{c=t.policy.maxAttempts(e.code);}catch{return null}return typeof c!="number"||!Number.isFinite(c)?null:Math.max(1,Math.min(vn,Math.floor(c)))},"policyCeiling"),d=t.perCallMaxAttempts??u()??t.maxAttempts;if(r+1>=d)return {retry:false,reason:"attempts-exhausted"};let a=En(e,t.now);return a!==null?a>un?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:a}:{retry:true,reason:i,delayMs:Or(r,t.rng)}}o(Rn,"decideRetry");function _n(e){let r=e.code==="unknown"?wr(wn(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}o(_n,"throttleKind");function En(e,r){let t=Sn(e.raw);if(t!==null){let i=t-r;return i>0?i:0}let n=xn(e.raw);return n===null?null:Math.round(n*1e3)}o(En,"retryOverrideMs");function xn(e){for(let r of Pe(e)){let t=r.retry_after_seconds;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t}return null}o(xn,"findRetryAfterSeconds");function Sn(e){for(let r of Pe(e)){let t=r.resets_at,n=Cn(t);if(n!==null)return n}return null}o(Sn,"findResetsAt");function Pe(e){if(!zr(e))return [];let r=[e];for(let t of ["error","detail"]){let n=e[t];zr(n)&&r.push(n);}return r}o(Pe,"candidateScopes");function Cn(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(Cn,"parseInstantMs");function wn(e){for(let r of Pe(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}o(wn,"rawWireCode");function zr(e){return typeof e=="object"&&e!==null}o(zr,"isRecord");async function Tn(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(Tn,"resolveDeviceAuth");function kn(e,r){let t=new AbortController,n=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:o(()=>r.clearTimeout(n),"cancel")}}o(kn,"boundedSignal");function On(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(On,"mergeSignals");function Pn(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(Pn,"delayAbortable");function Fe(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(Fe,"hasLoneSurrogate");var Nr=64,Lr=512;function An(e){return e==="owner_reported"||e==="clinic_document"?e:null}o(An,"normalizeOrigin");zod.z.object({request_id:zod.z.string().min(1),pet_ref:zod.z.string().min(1),status:zod.z.string(),simple_status:zod.z.string().nullish(),simple_status_detail:zod.z.string().nullish(),status_label:zod.z.string().optional(),dispatch_status:zod.z.string().nullish(),can_retry_send:zod.z.boolean().optional(),can_revoke:zod.z.boolean().optional(),can_convert_to_upload:zod.z.boolean().optional(),can_update_clinic_email:zod.z.boolean().optional(),reminder_count:zod.z.number().int().nonnegative().optional(),last_reminder_at:zod.z.string().nullish(),waiting_expectation:zod.z.string().nullish(),document_count:zod.z.number().optional(),held_item_count:zod.z.number().optional(),received_at:zod.z.string().nullish(),parsing_started_at:zod.z.string().nullish(),review_started_at:zod.z.string().nullish(),created_at:zod.z.string().optional(),updated_at:zod.z.string().optional(),source:zod.z.string().nullish().catch(null),action_needed_label:zod.z.string().nullish().catch(null),failure_reason:zod.z.string().nullish().catch(null),failure_code:zod.z.string().nullish().catch(null),recovery_stage:zod.z.string().nullish().catch(null),show_clinic_phone:zod.z.boolean().optional().catch(void 0),clinic_name:zod.z.string().nullish().catch(null),clinic_email:zod.z.string().nullish().catch(null),clinic_phone:zod.z.string().nullish().catch(null),converted_to_upload_at:zod.z.string().nullish().catch(null),request_group_id:zod.z.string().nullish().catch(null)}).passthrough();zod.z.object({request_group_id:zod.z.string().min(1),pet_ref:zod.z.string().min(1),total:zod.z.number().int().nonnegative(),responded:zod.z.number().int().nonnegative(),pending:zod.z.number().int().nonnegative(),members:zod.z.array(zod.z.unknown())});zod.z.object({source_doc_id:zod.z.string().min(1),request_id:zod.z.string().min(1)});var Dn=zod.z.object({label:zod.z.string(),value:zod.z.string()}),Ae=zod.z.object({key:zod.z.string(),category:zod.z.string().optional(),label:zod.z.string().optional(),value:zod.z.string().nullish(),unit:zod.z.string().nullish(),observed_at:zod.z.string().nullish(),status:zod.z.string().nullish(),origin:zod.z.string().nullish(),canonical_key:zod.z.string().nullish()}),In=zod.z.object({at:zod.z.string(),value:zod.z.number().nullish(),display:zod.z.string().nullish(),origin:zod.z.string().nullish()}),zn=zod.z.object({key:zod.z.string(),label:zod.z.string().optional(),points:zod.z.array(In).optional()}),jn=zod.z.object({title:zod.z.string(),detail:zod.z.string().nullish(),due_at:zod.z.string().nullish()}),De=zod.z.object({doc_id:zod.z.string(),title:zod.z.string().nullish(),page_count:zod.z.number().nullish(),received_at:zod.z.string().nullish()});function Mr(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:An(e.origin),canonicalKey:e.canonical_key??null})}o(Mr,"mapEntityRow");function Ur(e){return Object.freeze({docId:e.doc_id,title:e.title??null,pageCount:e.page_count??null,receivedAt:e.received_at??null})}o(Ur,"mapDocumentRow");zod.z.object({identity:zod.z.array(Dn).optional(),entities:zod.z.array(Ae).optional(),entity_series:zod.z.array(zn).optional(),forward_looking:zod.z.array(jn).optional(),documents:zod.z.array(De).optional()});zod.z.object({pet_ref:zod.z.string().optional(),granted:zod.z.boolean().optional(),version:zod.z.string().nullish(),granted_at:zod.z.string().nullish()});var R=zod.z.string().nullish(),pe=zod.z.number().nullish(),Nn=zod.z.object({collected_at:R,at:R,value:pe,unit:R,qualitative_result:R,ref_low:pe,ref_high:pe,status:R,source_clinic:R,source_doc_id:R,doc_id:R,reviewed:zod.z.boolean().nullish()}),Ln=zod.z.object({collected_at:R,at:R,value:pe,unit:R,qualitative_result:R,status:R}),Mn=zod.z.object({marker_id:zod.z.string().min(1),canonical_name:R,name:R,loinc_code:R,canonical_unit:R,unit:R,panel_name:R,panel:R,meaning_text:R,meaning:R,latest:Ln.nullish(),trajectory:R,points:zod.z.array(Nn).optional()}),Un=zod.z.object({total_markers:zod.z.number().int().nonnegative(),in_range_count:zod.z.number().int().nonnegative(),out_of_range_count:zod.z.number().int().nonnegative(),unknown_count:zod.z.number().int().nonnegative()}),qn=zod.z.object({markers:zod.z.array(Mn).optional(),summary:Un.nullish(),disclaimer:zod.z.string().optional(),featured_marker_id:R});function Bn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Bn,"isObject");function qr(e){return Object.freeze({petRef:e,withheld:true,markers:Object.freeze([]),summary:null,disclaimer:"",featuredMarkerId:null})}o(qr,"withheldMarkers");function Br(e,r){let t=Bn(r)?r:{},n=typeof t.pet_ref=="string"&&t.pet_ref.length>0?t.pet_ref:e;if(t.withheld===true)return qr(n);let i=qn.safeParse(t);if(!i.success)return qr(n);let s=i.data,u=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(u))}));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(Br,"mapRecordMarkers");var $r=128,z=128;var $n=zod.z.string().min(1).refine(e=>e.startsWith("https://")),Hn=zod.z.object({source_doc_id:zod.z.string().min(1),file_name:zod.z.string().nullish(),doc_format:zod.z.string().nullish(),byte_size:zod.z.number().int().nonnegative().nullish(),received_at:zod.z.string().nullish(),download_url:$n,expires_in_seconds:zod.z.number().int().nonnegative().nullish()}),Vn=zod.z.object({items:zod.z.array(zod.z.unknown()).optional()});function Hr(e){let r=Vn.safeParse(e);if(!r.success)return null;let t=[];for(let n of r.data.items??[]){let i=Hn.safeParse(n);i.success&&t.push(Object.freeze({sourceDocId:i.data.source_doc_id,fileName:i.data.file_name??null,docFormat:i.data.doc_format??null,byteSize:i.data.byte_size??null,receivedAt:i.data.received_at??null,downloadUrl:i.data.download_url,expiresInSeconds:i.data.expires_in_seconds??0}));}return Object.freeze(t)}o(Hr,"mapRequestDocuments");var fe=Object.freeze(["vet","groomer","boarding"]),Wn=zod.z.string().min(1).refine(e=>e.startsWith("https://")),V=zod.z.string().nullish(),Ie=zod.z.unknown().optional(),Yn=zod.z.object({share_id:zod.z.string().min(1),share_url:zod.z.string().min(1),expires_at:V,audience:Ie}),Kn=zod.z.object({shares:zod.z.array(zod.z.object({share_id:zod.z.string().min(1),expires_at:V,created_at:V,view_count:zod.z.number().int().nonnegative().nullish(),last_viewed_at:V,audience:Ie})).optional()}),Gn=zod.z.object({download_url:Wn,expires_at:V}),Xn=zod.z.object({share_id:zod.z.string().min(1),expires_at:V,audience:Ie}),Qn=zod.z.object({audience:zod.z.string().min(1),sections:zod.z.array(zod.z.string()),entity_types:zod.z.array(zod.z.string()).nullable()}),Jn=254;function Vr(e){let r=e.trim();return r.length>0&&r.length<=Jn&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(r)}o(Vr,"isShareRecipientEmail");var Wr=o(e=>typeof e=="string"&&fe.includes(e),"isAudience");function ze(e){return Wr(e)?e:null}o(ze,"audienceOf");function Yr(e){let r=zod.z.array(Qn).safeParse(e);if(!r.success)return Object.freeze([]);let t=new Set,n=[];for(let i of r.data)!Wr(i.audience)||t.has(i.audience)||(t.add(i.audience),n.push(Object.freeze({audience:i.audience,sections:Object.freeze([...i.sections]),entityTypes:i.entity_types===null?null:Object.freeze([...i.entity_types])})));return Object.freeze(n)}o(Yr,"mapShareAudiences");function Zn(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(Zn,"resolveShareUrl");function Kr(e,r){let t=Yn.safeParse(e);if(!t.success)return null;let n=Zn(t.data.share_url,r);return n===null?null:Object.freeze({shareId:t.data.share_id,shareUrl:n,expiresAt:t.data.expires_at??null,audience:ze(t.data.audience)})}o(Kr,"mapRecordShareLink");function Gr(e){let r=Kn.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,audience:ze(t.audience)}))):null}o(Gr,"mapRecordShareList");function Xr(e){let r=Xn.safeParse(e);return r.success?Object.freeze({shareId:r.data.share_id,expiresAt:r.data.expires_at??null,audience:ze(r.data.audience)}):null}o(Xr,"mapRecordShareEmailReceipt");function Qr(e){let r=Gn.safeParse(e);return r.success?Object.freeze({downloadUrl:r.data.download_url,expiresAt:r.data.expires_at??null}):null}o(Qr,"mapRecordPdfLink");var Jr="application/pdf",eo=Object.freeze(["image/jpeg","image/png","image/heic","image/heif"]),me=Object.freeze({features:Object.freeze({}),uploadContentTypes:Object.freeze([Jr]),shareAudiences:Object.freeze([])}),ro=zod.z.object({features:zod.z.record(zod.z.boolean()),upload_content_types:zod.z.array(zod.z.string()).nullish(),share_audiences:zod.z.unknown().optional()});function Zr(e){let r=ro.safeParse(e);if(!r.success)return me;let t=r.data.upload_content_types??[],n=eo.filter(i=>t.includes(i));return Object.freeze({features:Object.freeze({...r.data.features}),uploadContentTypes:Object.freeze([Jr,...n]),shareAudiences:Yr(r.data.share_audiences)})}o(Zr,"mapRecordsFeatures");var to=zod.z.object({signatures:zod.z.array(zod.z.object({signature_id:zod.z.string().min(1),preview_url:zod.z.string().min(1).refine(e=>e.startsWith("https://")),created_at:zod.z.string().nullish()})).optional()});function et(e){let r=to.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(et,"mapSignatureSuggestions");var y=zod.z.string().nullish(),oe=zod.z.number().nullish(),no=zod.z.object({at:y,value:oe,unit:y,qualitative_result:y,ref_low:oe,ref_high:oe,status:y,doc_id:y}),oo=zod.z.object({marker_id:zod.z.string(),name:zod.z.string(),loinc_code:y,unit:y,panel:y,meaning:y,latest:zod.z.object({at:y,value:oe,unit:y,qualitative_result:y,status:y}).nullish(),trajectory:y,points:zod.z.array(no).optional()}),io=zod.z.object({encounter_id:zod.z.string(),date:y,type:y,clinic_name:y,veterinarian:y,doc_id:y}),ao=zod.z.object({note_id:zod.z.string(),encounter_id:y,observed_on:y,sections:zod.z.array(zod.z.object({section:zod.z.string(),text:zod.z.string()})).optional()}),so=zod.z.object({exam_id:zod.z.string(),encounter_id:y,observed_on:y,doc_id:y,systems:zod.z.record(zod.z.object({finding_status:y,finding:y})).optional()}),lo=zod.z.object({has_lab_history:zod.z.boolean().optional(),has_vaccination_history:zod.z.boolean().optional(),has_weight_history:zod.z.boolean().optional(),has_vitals_history:zod.z.boolean().optional(),has_physical_exam_history:zod.z.boolean().optional(),has_procedure_history:zod.z.boolean().optional(),has_genetic_history:zod.z.boolean().optional(),has_reproductive_history:zod.z.boolean().optional(),has_parasite_prevention_history:zod.z.boolean().optional(),earliest_record_at:y,latest_record_at:y,documents_ingested:zod.z.number().int().nonnegative().optional(),documents_in_review:zod.z.number().int().nonnegative().optional(),entities_pending_review:zod.z.record(zod.z.number().int().nonnegative()).optional(),held_total:zod.z.number().int().nonnegative().optional()}),co=zod.z.object({conflict_id:zod.z.string(),entity_type:zod.z.string(),field:y,severity:y,candidates:zod.z.array(zod.z.object({value:zod.z.string(),source_doc_id:y,doc_id:y,collected_at:y})).optional()}),uo=zod.z.object({lab_results:zod.z.array(oo).optional(),encounters:zod.z.array(io).optional(),clinician_notes:zod.z.array(ao).optional(),physical_exams:zod.z.array(so).optional(),completeness:lo.nullish(),conflicts:zod.z.array(co).optional()}),po=zod.z.object({visits:zod.z.array(zod.z.object({visit_id:zod.z.string(),visit_date:y,veterinarian:y,summary:y,doc_id:y})),vaccines:zod.z.array(zod.z.object({vaccine_id:zod.z.string(),product:y,lot:y,administered_on:y,expires_on:y,doc_id:y})),weights:zod.z.array(zod.z.object({weight_id:zod.z.string(),observed_on:y,weight_kg:oe,doc_id:y})),medications:zod.z.array(zod.z.object({medication_id:zod.z.string(),drug_name:y,dose:y,route:y,frequency:y,sig:y,rx_number:y,started_on:y,stopped_on:y,doc_id:y})),disclaimer:zod.z.string().optional()}),fo=zod.z.object({document:De,contributions:zod.z.array(Ae),contribution_count:zod.z.number().int().nonnegative().optional()});function Ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Ne,"isObject");function Le(e,r){return typeof e.pet_ref=="string"&&e.pet_ref.length>0?e.pet_ref:r}o(Le,"petOf");function je(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(je,"emptyDepth");function tt(e,r){let t=Ne(r)?r:{},n=Le(t,e);if(t.withheld===true)return je(n,true);if(!["lab_results","encounters","clinician_notes","physical_exams","completeness","conflicts"].some(a=>a in t))return je(n,false);let s=uo.safeParse(t);if(!s.success)return je(n,true);let u=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((u.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((u.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((u.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(c=>Object.freeze({section:c.section,text:c.text})))}))),physicalExams:Object.freeze((u.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(([c,p])=>Object.freeze({system:c,findingStatus:p.finding_status??null,finding:p.finding??null})))}))),completeness:u.completeness?Object.freeze({hasLabHistory:u.completeness.has_lab_history===true,hasVaccinationHistory:u.completeness.has_vaccination_history===true,hasWeightHistory:u.completeness.has_weight_history===true,hasVitalsHistory:u.completeness.has_vitals_history===true,hasPhysicalExamHistory:u.completeness.has_physical_exam_history===true,hasProcedureHistory:u.completeness.has_procedure_history===true,hasGeneticHistory:u.completeness.has_genetic_history===true,hasReproductiveHistory:u.completeness.has_reproductive_history===true,hasParasitePreventionHistory:u.completeness.has_parasite_prevention_history===true,earliestRecordAt:u.completeness.earliest_record_at??null,latestRecordAt:u.completeness.latest_record_at??null,documentsIngested:u.completeness.documents_ingested??0,documentsInReview:u.completeness.documents_in_review??0,entitiesPendingReview:Object.freeze({...u.completeness.entities_pending_review??{}}),heldTotal:u.completeness.held_total??0}):null,conflicts:Object.freeze((u.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(c=>Object.freeze({value:c.value,docId:c.source_doc_id??c.doc_id??null,collectedAt:c.collected_at??null})))})))})}o(tt,"mapRecordDepth");function rt(e){return Object.freeze({petRef:e,withheld:true,isEmpty:false,visits:Object.freeze([]),vaccines:Object.freeze([]),weights:Object.freeze([]),medications:Object.freeze([]),disclaimer:""})}o(rt,"withheldTimeline");function nt(e,r){let t=Ne(r)?r:{},n=Le(t,e);if(t.withheld===true)return rt(n);let i=po.safeParse(t);if(!i.success)return rt(n);let s=i.data,u=s.visits.map(p=>Object.freeze({visitId:p.visit_id,visitDate:p.visit_date??null,veterinarian:p.veterinarian??null,summary:p.summary??null,docId:p.doc_id??null})),d=s.vaccines.map(p=>Object.freeze({vaccineId:p.vaccine_id,product:p.product??null,lot:p.lot??null,administeredOn:p.administered_on??null,expiresOn:p.expires_on??null,docId:p.doc_id??null})),a=s.weights.map(p=>Object.freeze({weightId:p.weight_id,observedOn:p.observed_on??null,weightKg:p.weight_kg??null,docId:p.doc_id??null})),c=s.medications.map(p=>Object.freeze({medicationId:p.medication_id,drugName:p.drug_name??null,dose:p.dose??null,route:p.route??null,frequency:p.frequency??null,sig:p.sig??null,rxNumber:p.rx_number??null,startedOn:p.started_on??null,stoppedOn:p.stopped_on??null,docId:p.doc_id??null}));return Object.freeze({petRef:n,withheld:false,isEmpty:u.length===0&&d.length===0&&a.length===0&&c.length===0,visits:Object.freeze(u),vaccines:Object.freeze(d),weights:Object.freeze(a),medications:Object.freeze(c),disclaimer:s.disclaimer??""})}o(nt,"mapRecordsTimeline");function ot(e,r){let t=Ne(r)?r:{},n=Le(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=fo.safeParse(t);if(!s.success)return i();let u=Object.freeze(s.data.contributions.map(Mr));return Object.freeze({petRef:n,withheld:false,document:Ur(s.data.document),contributions:u,contributionCount:s.data.contribution_count??u.length})}o(ot,"mapDocumentContributions");var mo="/widget/v1/records/pets";function it(e){let r=e.funnel??jr({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=o((a,c)=>typeof a=="string"&&a.length>0&&!Fe(a)&&[...a].length<=c,"segment"),n=o(async(a,c,p,b)=>{if(!t(c,z))return A();let g=await r.send(a,{method:"GET",path:p});if(!g.ok)return g;let v=b(g.value);return v.petRef===c?H(v):P(N("internalError",{retryable:false}))},"read"),i=o(a=>`${mo}/${encodeURIComponent(a)}`,"pet"),s=o(a=>`${i(a)}/everfur_record`,"record"),u=o(async(a,c,p)=>{let b=await r.send(a,c,c.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!b.ok)return b;let g=p(b.value);return g===null?P(N("internalError",{retryable:false})):H(g)},"parsed"),d=o((a,c)=>!t(a.entityType,Nr)||!t(a.canonicalKey,Lr)||a.idempotencyKey!==void 0&&!t(a.idempotencyKey,$r)||c!==void 0&&Object.keys(c).length===0?null:{entity_type:a.entityType,canonical_key:a.canonicalKey,...c!==void 0?{corrected_fields:c}:{},...a.idempotencyKey!==void 0?{idempotency_key:a.idempotencyKey}:{}},"factBody");return {getRecordDepth:o(a=>n("records.depth.record",a,`${i(a)}/record`,c=>tt(a,c)),"getRecordDepth"),getTimeline:o(a=>n("records.depth.timeline",a,`${i(a)}/timeline`,c=>nt(a,c)),"getTimeline"),getDocumentContributions(a,c){return t(c,64)?n("records.depth.contributions",a,`${i(a)}/documents/${encodeURIComponent(c)}/contributions`,p=>ot(a,p)):A()},getMarkers:o(a=>n("records.depth.markers",a,`${i(a)}/markers`,c=>Br(a,c)),"getMarkers"),createShare(a,c){if(!t(a,z))return A();let p=c?.audience;return p!==void 0&&!fe.includes(p)?A():u("records.share.create",{method:"POST",path:`${s(a)}/share`,...p!==void 0?{body:{audience:p}}:{}},b=>Kr(b,e.apiBaseUrl))},emailShare(a,c){let p=c.recipientKind,b=typeof c.recipientEmail=="string"?c.recipientEmail.trim():"",g=p==="other"||fe.includes(p);return !t(a,z)||!g||!Vr(b)||Fe(b)?A():u("records.share.email",{method:"POST",path:`${s(a)}/share/email`,body:{recipient_email:b,recipient_kind:p}},Xr)},async readFeatures(){try{let a=await r.send("records.getFeatures",{method:"GET",path:"/widget/v1/records/features"});return a.ok?Zr(a.value):me}catch{return me}},listShares(a){return t(a,z)?u("records.share.list",{method:"GET",path:`${s(a)}/shares`},Gr):A()},async revokeShare(a,c){if(!t(a,z)||!t(c,64))return A();let p=await r.send("records.share.revoke",{method:"DELETE",path:`${s(a)}/shares/${encodeURIComponent(c)}`},{idempotent:false,maxAttempts:1});return p.ok?H(void 0):p},getPdfLink(a){return t(a,z)?u("records.pdf.link",{method:"GET",path:`${s(a)}/pdf-link`},Qr):A()},async editFact(a,c){let p=t(a,z)?d(c,c.correctedFields):null;if(p===null)return A();let b=await r.send("records.fact.edit",{method:"POST",path:`${s(a)}/facts/edit`,body:p},{idempotent:false,maxAttempts:1});return b.ok?H(void 0):b},async removeFact(a,c){let p=t(a,z)?d(c):null;if(p===null)return A();let b=await r.send("records.fact.remove",{method:"POST",path:`${s(a)}/facts/remove`,body:p},{idempotent:false,maxAttempts:1});return b.ok?H(void 0):b},listRequestDocuments(a){return t(a,64)?u("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(a)}/documents`},Hr):A()},listAuthorizationSignatures:o(()=>u("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},et),"listAuthorizationSignatures")}}o(it,"createRecordsDepthClient");function A(){return Promise.resolve(P(N("validationFailed",{retryable:false})))}o(A,"invalid");var bo=new Map,at=new Set;function ho(e){return bo.get(e)??0}o(ho,"recordsConsentEpochOf");function vo(e){return at.add(e),()=>{at.delete(e);}}o(vo,"subscribe");function st(e){let r=react.useCallback(()=>ho(e),[e]);return react.useSyncExternalStore(vo,r,r)}o(st,"useRecordsConsentEpoch");function dt(){let{runtime:e,userRef:r,scopeEpoch:t}=M();return react.useMemo(()=>{let{services:n}=e.registry;return it({auth:n.authFor(r),...n.errorPolicy?{errorPolicy:n.errorPolicy}:{},...typeof n.apiBaseUrl=="string"?{apiBaseUrl:n.apiBaseUrl}:{}})},[e,r,t])}o(dt,"useEverfurRecordsDepthClient");function ie(e,r,t,n=""){let i=dt(),{userRef:s}=M(),u=st(e),d=react.useMemo(()=>({}),[i,e,n,u]),[a,c]=react.useState({scope:d,value:null,error:null,loading:true}),p=react.useRef(0),b=react.useCallback(async()=>{let Q=p.current+=1;if(c({scope:d,value:null,error:null,loading:true}),s===null){c({scope:d,value:null,error:null,loading:false});return}let J=await r(i,e);Q===p.current&&(J.ok?c({scope:d,value:J.value,error:null,loading:false}):c({scope:d,value:null,error:J.error,loading:false}));},[i,e,r,d,s]);react.useEffect(()=>(b(),()=>{p.current+=1;}),[b]);let g=a.scope===d?a:{value:null,error:null,loading:true},v=react.useCallback(()=>{b();},[b]),E=g.error===null||g.error.httpStatus!==404,S=E?g.error:null,B=g.loading?"loading":S!==null?"error":g.value===null?"empty":g.value.withheld?"populated":t(g.value)?"empty":"populated";return react.useMemo(()=>({status:B,value:g.value,error:S,available:E,refresh:v}),[B,g.value,S,E,v])}o(ie,"useRecordsDepthRead");var Be=class Be extends react.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(Be,"HostRenderBoundary");var Ue=Be;function So({render:e}){return e()}o(So,"RenderHost");function qe({render:e,fallback:r,resetKey:t}){return react.createElement(Ue,{fallback:r,resetKey:t,children:react.createElement(So,{render:e})})}o(qe,"HostRender");function Ve(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))Ve(e[r]);}return e}o(Ve,"deepFreeze");var Co=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),pt={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},ft={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},ut={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},wo={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},To={regular:"400",medium:"500",bold:"700"},ko={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Oo=0,ye="System",ge="monospace",Po=["content","heading","control","compact","badge"];function Fo(e){let r={};for(let t of Po)r[t]=e;return r}o(Fo,"authoredTierSizes");function mt(){return {family:ye,mono:ge,fontUrl:null,families:{regular:ye,medium:ye,bold:ye,mono:ge,monoMedium:ge,monoBold:ge},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:ut,tierSizes:Fo(ut),lineHeight:wo,weight:To,letterSpacing:ko,scale:1,maxScale:Oo,scaleCaps:Co}}o(mt,"baseType");var yt={},$e=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function He(e){return `cubic-bezier(${e.join(", ")})`}o(He,"cssCubicBezier");var gt={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:He($e.standard),emphasized:He($e.emphasized),exit:He($e.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:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},bt=Ve({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Ao,space:pt,radius:ft,type:mt(),motion:gt,slots:yt}),Do={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};Ve({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Do,space:pt,radius:ft,type:mt(),motion:gt,slots:yt});var ht=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),vt=globalThis,We=vt[ht]??(vt[ht]=react.createContext(bt));We.displayName??="EverfurThemeContext";function T(){return react.useContext(We)}o(T,"useEverfurTheme");var Rt=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var _t='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',jo="System";function No(e){let r=e.trim();return r.length===0||r===jo?_t:`${Et(r)}, ${_t}`}o(No,"cssFontFamily");function Lo(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Et(r)}, ui-monospace, Menlo, Consolas, monospace`}o(Lo,"cssMonoFamily");function Et(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}o(Et,"quote");function _(e,r){let t=e.type,n=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?Lo(n):No(n),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[Rt[r]]}}o(_,"faceCss");var K=Object.freeze({textAlign:"start"});var Mo=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 Uo(e){return Mo[e]}o(Uo,"requires");function xt(e,r,t){let n=Uo(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 Ye({name:e,enabled:false,isPending:true,limits:{}});let s=qo(n,i);return n.filter(d=>i.get(d)?.granted!==true).length===0?Ye({name:e,enabled:true,isPending:false,limits:s}):Ye({name:e,enabled:false,isPending:false,limits:s,disabled:Bo(n,i)})}o(xt,"decideCapability");function qo(e,r){let t={};for(let n of e){let i=r.get(n)?.limits;if(i)for(let[s,u]of Object.entries(i)){let d=t[s];t[s]=d===void 0?u:Math.min(d,u);}}return t}o(qo,"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:ke("accessDenied"),level:"user_entitlement",recoverable:false})}o(Bo,"disabledFor");function Ye(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(Ye,"freezeDecision");function Ke(e){let{runtime:r}=M(),t=r.entitlements,n=react.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return react.useMemo(()=>xt(e,n.decisions,{isPending:n.isPending}),[e,n])}o(Ke,"useCapability");var Vo=48;function Wo(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(Wo,"selectView");function wt(e){let{capability:r,children:t,renderDisabled:n,renderPending:i,style:s,className:u}=e,d=Ke(r),a=react.useMemo(()=>Wo(d),[d]);switch(a){case "enabled":return t;case "pending":return i?jsxRuntime.jsx(qe,{render:i,fallback:jsxRuntime.jsx(St,{capability:r,style:s,className:u})}):jsxRuntime.jsx(St,{capability:r,style:s,className:u});case "disabled":return n?jsxRuntime.jsx(qe,{render:()=>n(d),fallback:jsxRuntime.jsx(Ct,{decision:d,style:s,className:u}),resetKey:d}):jsxRuntime.jsx(Ct,{decision:d,style:s,className:u});default:return Fr(a)}}o(wt,"CapabilityGate");function St({capability:e,style:r,className:t}){let n=T(),i=react.useMemo(()=>Tt(n),[n]);return jsxRuntime.jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${e}`,className:t,style:{...i.offstate,...r},children:jsxRuntime.jsx("div",{style:i.skeletonBar})})}o(St,"PendingSkeleton");function Ct({decision:e,style:r,className:t}){let n=T(),i=react.useMemo(()=>Tt(n),[n]),s=e.disabled?.reason??"";return jsxRuntime.jsx("div",{className:t,style:{...i.offstate,...r},children:s.length>0?jsxRuntime.jsx("p",{style:i.offstateText,children:s}):null})}o(Ct,"OffState");function Tt(e){let{color:r,space:t,radius:n,type:i}=e;return {offstate:{...K,boxSizing:"border-box",minHeight:Vo,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(Tt,"makeStyles");function kt(e){let r=T(),t=react.useMemo(()=>Ko(r),[r]);return jsxRuntime.jsx("p",{role:"note",className:e.className,style:{...t,...e.style},"data-testid":"records-footnote",children:lr})}o(kt,"RecordsFootnote");function Ko(e){let{color:r,space:t,type:n}=e;return {...K,boxSizing:"border-box",margin:0,padding:`${t.md}px ${t.lg}px ${t.lg}px`,textAlign:"center",..._(e,"regular"),fontSize:n.size.caption,lineHeight:`${Math.round(n.size.caption*n.lineHeight.normal)}px`,color:r.text.muted,backgroundColor:r.background}}o(Ko,"footnoteStyle");var Xo=120,Qo=44;function Jo({reason:e,onExit:r,exitLabel:t,style:n,className:i}){let{color:s,space:u,radius:d,type:a}=T();return jsxRuntime.jsxs("div",{className:i,"data-testid":"records-gate-off",style:{boxSizing:"border-box",minHeight:Xo,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:u.md,padding:u.lg,borderRadius:d.md,border:`1px solid ${s.brandBorder}`,backgroundColor:s.surfaceCream,color:s.text.primary,...n},children:[e.length>0?jsxRuntime.jsx("p",{style:{margin:0,fontSize:a.size.bodyTight,color:s.text.muted},children:e}):null,jsxRuntime.jsx("button",{type:"button",onClick:r,"data-testid":"records-gate-off-exit",style:{minHeight:Qo,padding:`0 ${u.lg}px`,borderRadius:d.pill,border:`1.5px solid ${s.brandInk}`,backgroundColor:"transparent",color:s.brandInk,font:"inherit",fontSize:a.size.body,cursor:"pointer"},children:t})]})}o(Jo,"RecordsGateOffState");function Ot(e,r){return e===void 0?{}:{renderDisabled:o(t=>jsxRuntime.jsx(Jo,{reason:t.disabled?.reason??"",onExit:e,exitLabel:r}),"renderDisabled")}}o(Ot,"recordsGateExit");var Pt="data-ef-screen-heading";var ri=120,ae=44,ti=52,Qe="Back";function ni(){let e=T(),r=react.useMemo(()=>oi(e),[e]);return {theme:e,styles:r}}o(ni,"useScreenStyles");function be({title:e,onBack:r,right:t,testID:n,variant:i="brand"}){let{styles:s}=ni();return jsxRuntime.jsxs("header",{style:s.headerRow,"data-testid":n,children:[r?jsxRuntime.jsx("button",{type:"button",onClick:r,"aria-label":Qe,style:s.iconButton,"data-testid":n?`${n}-back`:void 0,children:jsxRuntime.jsx("span",{"aria-hidden":"true",style:s.backChevron})}):jsxRuntime.jsx("span",{style:s.iconButton}),e.trim().length>0?jsxRuntime.jsx("h2",{tabIndex:-1,[Pt]:"",style:i==="document"?s.documentTitle:s.headerTitle,children:e}):jsxRuntime.jsx("span",{"aria-hidden":"true",style:s.headerTitle,"data-testid":n?`${n}-spacer`:void 0}),jsxRuntime.jsx("div",{style:s.headerRight,children:t??jsxRuntime.jsx("span",{style:s.iconButton})})]})}o(be,"ScreenHeader");function oi(e){let{color:r,space:t,radius:n,type:i,slots:s}=e,u=o((E,S)=>`${Math.round(E*S)}px`,"lh"),d=o((E,S,B,Q="regular")=>({margin:0,..._(e,Q),fontSize:E,lineHeight:u(E,S),color:B}),"text"),a=$(s.recordCard),c=e.brightness==="dark"?r.errorRed:r.danger,p=o((E,S)=>({backgroundColor:E,color:S,border:"1.5px solid transparent"}),"tone"),b=o((E,S)=>({backgroundColor:r.surface,color:S,border:`1.5px solid ${E}`}),"edge"),g=`1px solid ${r.borderRingCream}`,v={boxSizing:"border-box",minHeight:ti,minWidth:ae,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:b(r.brandBorderStrong,r.text.primary),info:p(r.brandSoft,r.brandInk),warning:b(r.cautionAccent,r.text.primary),critical:b(r.danger,r.danger),positive:b(r.success,r.brandInk)},root:{...K,boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:ri,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:ae,height:ae,display:"inline-flex",alignItems:"center",justifyContent:"center",border:0,background:"transparent",cursor:"pointer",padding:0,color:r.brandInk,flexShrink:0},backChevron:{display:"block",width:t.md,height:t.md,borderLeft:`2px solid ${r.brandInk}`,borderBottom:`2px solid ${r.brandInk}`,transform:"rotate(45deg)",marginLeft:t.xs},headerTitle:{...d(i.size.heading,i.lineHeight.tight,r.brandInk,"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.subtitle,i.lineHeight.snug,r.text.primary,"bold"),letterSpacing:"-0.02em"},sectionCount:{...d(i.size.bodyTight,i.lineHeight.snug,r.text.muted,"medium")},card:{boxSizing:"border-box",borderRadius:n.lg,border:g,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,border:g,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:{boxSizing:"border-box",display:"inline-flex",alignItems:"center",minHeight:24,borderRadius:n.pill,padding:`0 ${t.sm+t.xs/2}px`,..._(e,"monoBold"),fontSize:i.size.tiny+1,lineHeight:u(i.size.tiny+1,i.lineHeight.snug),letterSpacing:"0.06em",textTransform:"uppercase",whiteSpace:"nowrap"},pill:v,pillPrimary:{border:0,backgroundColor:r.brand,color:r.onPrimary,...L(s.primaryButton),...$(s.primaryButton)},pillOutline:{border:`1.5px solid ${r.brandInk}`,backgroundColor:"transparent",color:r.brandInk},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:{minHeight:ae,border:0,backgroundColor:"transparent",color:r.linkInk,padding:`${t.sm}px`},pillDisabled:{opacity:.5,cursor:"default"},infoNote:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.brandSoft,padding:`${t.sm+t.xs/2}px ${t.md}px`,...d(i.size.bodyTight,i.lineHeight.normal,r.text.primary)},cautionNote:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.badgeBgCaution,padding:`${t.sm+t.xs/2}px ${t.md}px`,...d(i.size.bodyTight,i.lineHeight.normal,r.warningStrong)},statusCard:{borderRadius:n.md,backgroundColor:r.brandSoft,padding:t.md+t.xs/2,...d(i.size.bodyTight,i.lineHeight.relaxed,r.text.primary)},errorBanner:{display:"flex",gap:t.sm,borderRadius:n.md-t.xs/2,backgroundColor:r.badgeBgCritical,padding:t.md,...d(i.size.bodyTight,i.lineHeight.normal,c)},errorText:d(i.size.bodyTight,i.lineHeight.normal,c),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},chipSentence:{..._(e,"medium"),fontSize:i.size.caption,lineHeight:u(i.size.caption,i.lineHeight.normal),letterSpacing:"normal",textTransform:"none",whiteSpace:"normal",borderRadius:n.md,padding:`${t.xs}px ${t.sm+t.xs/2}px`},lead:{...d(i.size.body+1,i.lineHeight.snug,r.text.primary,"bold"),padding:`0 ${t.sm}px`},subLead:{...d(i.size.body,i.lineHeight.normal,r.text.muted),padding:`0 ${t.lg}px ${t.md}px`},field:{boxSizing:"border-box",display:"block",width:"100%",minHeight:ae,padding:`${t.sm}px ${t.md}px`,border:`1px solid ${r.borderHairlineGreen}`,borderRadius:n.sm,color:r.text.primary,backgroundColor:r.surface,..._(e,"regular"),fontSize:i.size.body},fieldLabel:{...d(i.size.bodyTight,i.lineHeight.normal,r.text.secondary,"medium"),display:"block",marginBottom:t.xs},muted:d(i.size.caption,i.lineHeight.normal,r.text.muted),bodyText:d(i.size.body,i.lineHeight.normal,r.text.primary),mono:_(e,"mono"),plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column"},dialogFrame:{boxSizing:"border-box",position:"fixed",top:0,right:0,bottom:0,left:0,width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0,padding:0,border:0,backgroundColor:"transparent",overflow:"hidden"},dialogScrim:{boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:t.lg,backgroundColor:"rgba(0,0,0,0.4)"},dialogScrimSide:{boxSizing:"border-box",display:"flex",alignItems:"stretch",justifyContent:"flex-end",width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.4)"},dialogPanel:{boxSizing:"border-box",width:"100%",maxWidth:560,maxHeight:"100%",overflowY:"auto",backgroundColor:r.surface,borderRadius:n.xl-1,padding:`${t.lg}px ${t.lg+t.xs+t.xs/2}px`,display:"flex",flexDirection:"column",gap:t.md,..._(e,"regular"),color:r.text.primary},dialogPanelSide:{boxSizing:"border-box",width:"min(100vw, 480px)",height:"100%",maxHeight:"100%",overflowY:"auto",backgroundColor:r.surface,padding:`${t.lg}px ${t.lg+t.xs+t.xs/2}px`,display:"flex",flexDirection:"column",gap:t.md,..._(e,"regular"),color:r.text.primary},sheetHeader:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:t.sm},sheetTitle:{...d(i.size.heading,i.lineHeight.snug,r.text.primary,"bold")},sheetHelper:d(i.size.bodyTight,i.lineHeight.normal,r.text.muted),closeGlyph:{fontSize:i.size.verdict,lineHeight:1,color:r.text.primary}}}o(oi,"makeScreenStyles");var Ft=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"})}),Je=60;function At(e){return `Try again in ${e}s`}o(At,"coolingActionLabel");var Dt="Try again, available shortly";function G({width:e,height:r,radius:t,style:n}){let{color:i,radius:s}=T();return jsxRuntime.jsx("span",{"aria-hidden":"true",style:{display:"block",width:e,height:r,borderRadius:t??s.xs,backgroundColor:i.skeleton,flexShrink:0,...n}})}o(G,"SkeletonBlock");var li=44,Ze=62;function zt({testID:e}){let r=jt();return jsxRuntime.jsxs("div",{role:"progressbar","aria-label":h.loadingTimeline,"aria-busy":"true",style:r.timeline,"data-testid":e,children:[jsxRuntime.jsx("div",{style:r.timelineDisclaimer,children:jsxRuntime.jsx(G,{width:"100%",height:li,radius:12})}),Array.from({length:6},(t,n)=>jsxRuntime.jsxs("div",{children:[n>0?jsxRuntime.jsx("div",{style:r.timelineSeparator}):null,jsxRuntime.jsxs("div",{style:r.timelineRow,children:[jsxRuntime.jsx(G,{width:34,height:34,radius:17}),jsxRuntime.jsxs("div",{style:r.timelineBody,children:[jsxRuntime.jsxs("div",{style:r.timelineTop,children:[jsxRuntime.jsx(G,{width:44,height:10,radius:5}),jsxRuntime.jsx(G,{width:56,height:12,radius:6})]}),jsxRuntime.jsx(G,{width:"70%",height:14,radius:7}),n%2===0?jsxRuntime.jsx(G,{width:"45%",height:12,radius:6}):null]})]})]},n))]})}o(zt,"TimelineSkeleton");function he({variant:e,onAction:r,message:t,testID:n}){let i=jt(),s=Ft[e],[u,d]=react.useState(e==="rate_limited"?Je:0);react.useEffect(()=>{e==="rate_limited"&&d(Je);},[e]),react.useEffect(()=>{if(u<=0)return;let p=setTimeout(()=>d(b=>Math.max(0,b-1)),1e3);return ()=>clearTimeout(p)},[u]);let a=e==="rate_limited"&&u>0,c=a?At(u):s.action;return jsxRuntime.jsxs("section",{role:"status",style:i.empty,"data-testid":n,children:[jsxRuntime.jsx("span",{"aria-hidden":"true",style:i.emptyGlyph}),jsxRuntime.jsx("h3",{style:i.emptyTitle,children:s.title}),jsxRuntime.jsx("p",{style:i.emptyBody,children:t??s.body}),c!==null&&r?jsxRuntime.jsx("button",{type:"button",onClick:r,disabled:a,"aria-label":a?Dt:c,style:{...i.emptyAction,...a?i.emptyActionDisabled:{}},"data-testid":n?`${n}-action`:`records-empty-${e}-action`,children:c}):null]})}o(he,"RecordsEmptyState");function jt(){let e=T();return react.useMemo(()=>di(e),[e])}o(jt,"useStyles");function di(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:Ze},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.brandInk},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(di,"makeStyles");var mi=300,Nt=120,Lt=44,yi=o((e,r)=>e.getTimeline(r),"readTimeline"),gi=o(e=>e.isEmpty,"timelineEmpty"),bi=o((e,r)=>e.getRecordDepth(r),"readDepth"),hi=o(e=>!e.available||e.labResults.length+e.encounters.length+e.clinicianNotes.length+e.physicalExams.length===0,"depthEmpty"),vi=o(e=>e.contributions.length===0,"contributionsEmpty");function Ri({petRef:e,style:r,className:t,onBack:n}){let i=ie(e,yi,gi);return jsxRuntime.jsx(er,{state:i,style:r,className:t,onBack:n,header:jsxRuntime.jsx(be,{title:h.timeline,onBack:re(n),testID:"timeline-header"}),loading:jsxRuntime.jsx(zt,{testID:"timeline-loading"}),empty:jsxRuntime.jsx(he,{variant:"no_records",testID:"timeline-empty"}),render:s=>jsxRuntime.jsx(Ci,{timeline:s})})}o(Ri,"EverfurRecordsTimeline");function _i({petRef:e,style:r,className:t,onBack:n}){let i=ie(e,bi,hi);return jsxRuntime.jsx(er,{state:i,style:r,className:t,onBack:n,header:n?jsxRuntime.jsx(be,{title:U.records,onBack:re(n)}):null,render:s=>jsxRuntime.jsx(wi,{depth:s})})}o(_i,"EverfurRecordDepth");function Ei({petRef:e,docId:r,style:t,className:n,onBack:i}){let s=react.useCallback((a,c)=>a.getDocumentContributions(c,r),[r]),u=ie(e,s,vi,r),d=u.value?.document?.title?.trim()||h.uploadedDocument;return jsxRuntime.jsx(er,{state:u,style:t,className:n,onBack:i,header:jsxRuntime.jsx(be,{title:d,onBack:re(i),testID:"contributions-header"}),empty:jsxRuntime.jsx(he,{variant:"no_records",testID:"contributions-empty"}),render:a=>jsxRuntime.jsx(Ti,{view:a})})}o(Ei,"EverfurDocumentContributions");function er({state:e,style:r,className:t,header:n,loading:i,empty:s,render:u,onBack:d}){let{styles:a}=ve(),{userRef:c}=M();return jsxRuntime.jsx(wt,{capability:"records",style:r,className:t,...Ot(re(d),Qe),children:jsxRuntime.jsxs("div",{className:t,style:{...a.container,...r},children:[n??null,jsxRuntime.jsx("div",{style:a.body,children:c===null?jsxRuntime.jsx("p",{role:"alert",style:a.alertText,children:U.sessionRequired}):xi(e,u,a,i,s)}),jsxRuntime.jsx(kt,{})]})})}o(er,"DepthSurface");function xi(e,r,t,n,i){switch(e.status){case "loading":return n??jsxRuntime.jsx(Si,{styles:t});case "empty":return i??jsxRuntime.jsx("div",{style:t.centered,children:jsxRuntime.jsx("div",{role:"img","aria-label":U.empty,style:t.emptyGlyph})});case "error":return e.error?jsxRuntime.jsx(he,{variant:cr(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(xi,"renderState");function Si({styles:e}){let[r,t]=react.useState(false);return react.useEffect(()=>{let n=setTimeout(()=>t(true),mi);return ()=>clearTimeout(n)},[]),jsxRuntime.jsx("div",{role:"status","aria-busy":"true","aria-label":U.loading,style:e.centered,children:r?jsxRuntime.jsx("div",{"aria-hidden":"true",style:e.spinner}):null})}o(Si,"LoadingState");function Ci({timeline:e}){let{styles:r}=ve(),t=Se(e);return jsxRuntime.jsxs("section",{"aria-label":h.timeline,style:r.timelineList,children:[e.disclaimer.length>0?jsxRuntime.jsx("p",{role:"note","aria-label":dr.important(e.disclaimer),style:r.timelineBand,children:e.disclaimer}):null,jsxRuntime.jsx("ul",{style:r.plainList,children:t.map((n,i)=>jsxRuntime.jsx("li",{style:i>0?r.timelineSeparated:void 0,"data-testid":`records-timeline-row-${n.kind}`,children:jsxRuntime.jsxs("div",{style:r.timelineRow,"aria-label":[n.kindLabel,n.date,n.title,n.detail].filter(Boolean).join(", "),children:[jsxRuntime.jsx("span",{"aria-hidden":"true",style:r.timelineBubble}),jsxRuntime.jsxs("div",{style:r.timelineBody,children:[jsxRuntime.jsxs("div",{style:r.topLine,children:[jsxRuntime.jsx("span",{style:r.timelineKind,children:n.kindLabel}),jsxRuntime.jsx("span",{style:r.date,children:n.date})]}),jsxRuntime.jsx("span",{style:r.timelineTitle,children:n.title}),n.detail?jsxRuntime.jsx("span",{style:r.rowDetail,children:n.detail}):null]})]})},n.key))})]})}o(Ci,"TimelineBody");function wi({depth:e}){let{styles:r}=ve();return jsxRuntime.jsxs("section",{"aria-label":U.records,style:r.list,children:[e.labResults.length>0?jsxRuntime.jsxs("div",{style:r.section,children:[jsxRuntime.jsx("h3",{style:r.heading,children:`${h.labResults} (${e.labResults.length})`}),jsxRuntime.jsx("ul",{style:r.card,children:e.labResults.map(t=>{let n=yr(t.latest.status),i=Rr(t.latest.at,t.trajectory,t.points.length);return jsxRuntime.jsxs("li",{style:r.row,children:[jsxRuntime.jsx("span",{style:r.rowTitle,children:t.name}),jsxRuntime.jsx("span",{style:r.rowValue,children:vr(t.latest.value,t.latest.unit,t.latest.qualitativeResult)}),i?jsxRuntime.jsx("span",{style:r.rowDetail,children:i}):null,jsxRuntime.jsx("span",{style:{...r.chip,...n.outOfRange?r.chipCritical:r.chipNeutral},children:n.label}),t.meaning?jsxRuntime.jsx("span",{style:r.rowDetail,children:t.meaning}):null]},t.markerId)})})]}):null,e.encounters.length>0?jsxRuntime.jsxs("div",{style:r.section,children:[jsxRuntime.jsx("h3",{style:r.heading,children:`${h.visits} (${e.encounters.length})`}),jsxRuntime.jsx("ul",{style:r.card,children:e.encounters.map(t=>{let n=[t.date?k(t.date):null,t.clinicName,t.veterinarian].filter(i=>i&&i!=="-").join(" \xB7 ");return jsxRuntime.jsxs("li",{style:r.row,children:[jsxRuntime.jsx("span",{style:r.rowTitle,children:t.type?de(t.type):h.visit}),n?jsxRuntime.jsx("span",{style:r.rowDetail,children:n}):null]},t.encounterId)})})]}):null,e.physicalExams.length>0?jsxRuntime.jsxs("div",{style:r.section,children:[jsxRuntime.jsx("h3",{style:r.heading,children:`${h.physicalExams} (${e.physicalExams.length})`}),e.physicalExams.map(t=>jsxRuntime.jsxs("div",{style:r.card,children:[jsxRuntime.jsx("h4",{style:r.rowTitle,children:t.observedOn?k(t.observedOn):h.exam}),jsxRuntime.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 jsxRuntime.jsxs("li",{style:r.row,children:[jsxRuntime.jsx("span",{style:r.rowTitle,children:gr(n.system)}),i&&n.finding?jsxRuntime.jsx("span",{style:r.rowDetail,children:n.finding}):null,jsxRuntime.jsx("span",{style:{...r.chip,...i?r.chipCaution:r.chipNeutral},children:s})]},n.system)})})]},t.examId))]}):null,e.clinicianNotes.length>0?jsxRuntime.jsxs("div",{style:r.section,children:[jsxRuntime.jsx("h3",{style:r.heading,children:`${h.visitNotes} (${e.clinicianNotes.length})`}),e.clinicianNotes.map(t=>jsxRuntime.jsxs("div",{style:r.card,children:[jsxRuntime.jsx("h4",{style:r.rowTitle,children:t.observedOn?k(t.observedOn):h.visitNote}),jsxRuntime.jsx("dl",{style:r.plainList,children:t.sections.map((n,i)=>jsxRuntime.jsxs("div",{style:r.row,children:[jsxRuntime.jsx("dt",{style:r.kindLabel,children:br(n.section)}),jsxRuntime.jsx("dd",{style:n.text?r.rowDetail:r.rowMuted,children:n.text||h.notRecorded})]},`${n.section}:${i}`))})]},t.noteId))]}):null]})}o(wi,"DepthBody");function Ti({view:e}){let{styles:r}=ve();return jsxRuntime.jsxs("section",{"aria-label":U.records,style:r.list,children:[e.document?.receivedAt?jsxRuntime.jsx("p",{style:r.rowDetail,children:k(e.document.receivedAt)}):null,jsxRuntime.jsx("dl",{style:r.card,children:e.contributions.map(t=>jsxRuntime.jsxs("div",{style:r.row,children:[jsxRuntime.jsx("dt",{style:r.rowTitle,children:t.label}),jsxRuntime.jsx("dd",{style:r.rowValue,children:pr(t.value,t.unit)}),t.observedAt?jsxRuntime.jsx("dd",{style:r.rowDetail,children:k(t.observedAt)}):null]},t.key))})]})}o(Ti,"ContributionsBody");function ve(){let e=T(),r=react.useMemo(()=>ki(e),[e]);return {theme:e,styles:r}}o(ve,"useDepthTheme");function ki(e){let{color:r,space:t,radius:n,type:i,slots:s}=e,u=o((g,v)=>`${Math.round(g*v)}px`,"lh"),d=o((g,v,E,S="regular")=>({margin:0,..._(e,S),fontSize:g,lineHeight:u(g,v),color:E}),"text"),a=$(s.recordCard),c=o((g,v,E,S="regular")=>({...d(g,v,E,S),...a}),"inCard"),p=`1px solid ${r.brandBorder}`,b=e.brightness==="dark"?r.errorRed:r.danger;return {container:{boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:Nt,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:Nt,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.brandInk},emptyGlyph:{boxSizing:"border-box",width:40,height:40,borderRadius:n.lg,backgroundColor:r.brandSoft,border:p},alertText:d(i.size.subtitle,i.lineHeight.snug,r.text.secondary),errorText:d(i.size.subtitle,i.lineHeight.snug,b),primaryButton:{boxSizing:"border-box",minHeight:Lt,minWidth:Lt,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),...$(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:p,...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:{...c(i.size.caption,i.lineHeight.normal,r.text.muted,"medium")},date:c(i.size.caption,i.lineHeight.normal,r.text.muted),rowTitle:{...c(i.size.body,i.lineHeight.normal,r.text.primary,"bold")},rowValue:{...c(i.size.body,i.lineHeight.normal,r.text.primary,"medium")},rowDetail:c(i.size.bodyTight,i.lineHeight.normal,r.text.muted),rowMuted:{...c(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:Ze,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:p},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(ki,"makeStyles");
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var react=require("react"),zod=require("zod"),jsxRuntime=require("react/jsx-runtime");function slotBox(slot,borderWidth){if(slot===void 0)return{};let out={};return slot.backgroundColor!==void 0&&(out.backgroundColor=slot.backgroundColor),slot.borderColor!==void 0&&(out.borderColor=slot.borderColor,out.borderWidth=borderWidth??1),slot.borderRadius!==void 0&&(out.borderRadius=slot.borderRadius),out}function slotText(slot){return slot?.textColor===void 0?{}:{color:slot.textColor}}function slotBoxCss(slot,borderWidth){let box=slotBox(slot,borderWidth),out={};return box.backgroundColor!==void 0&&(out.backgroundColor=box.backgroundColor),box.borderColor!==void 0&&(out.border=`${box.borderWidth??1}px solid ${box.borderColor}`),box.borderRadius!==void 0&&(out.borderRadius=box.borderRadius),out}function reportHostFailure(error){let globalConsole=globalThis.console;try{globalConsole?.error?.("[everfur] A host callback threw; the SDK ignored it.",error)}catch{}}function isThenable(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&typeof value.then=="function"}function callHost(fn,...args){if(typeof fn=="function")try{let result=fn(...args);return isThenable(result)&&Promise.resolve(result).then(void 0,reportHostFailure),result}catch(error){reportHostFailure(error);return}}var GUARDED=/* @__PURE__ */new WeakMap;function guardHost(fn){if(typeof fn!="function")return;let cached=GUARDED.get(fn);if(cached!==void 0)return cached;let guarded=(...args)=>{callHost(fn,...args)};return GUARDED.set(fn,guarded),guarded}function ok(value,warning){/* @__PURE__ */
|
|
3
|
+
return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
|
|
4
|
+
return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=react.createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=react.useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}var RECORDS_COPY=/* @__PURE__ */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"}),RECORDS_FOOTNOTE="Everfur summarizes what your vet recorded. It is informational, not diagnostic.";var NAMELESS_PET="your pet";function petNameOr(petName){let trimmed=petName?.trim()??"";return trimmed.length>0?trimmed:NAMELESS_PET}var DASHBOARD_COPY=/* @__PURE__ */Object.freeze({title:"Health records",titleWeb:petName=>{let name=petName?.trim()??"";return name.length>0?`${name}’s Records`:"Health records"},titleNative:petName=>{let name=petName?.trim()??"";return name.length>0?name:"Health records"},openTimeline:"Open timeline",loading:"Loading health records",lead:petName=>`${petNameOr(petName)}’s lab trends`,retryMarkers:"Retry loading lab trends",viewFullRecord:"View full medical record",viewTimeline:"View full timeline",important:disclaimer=>`Important: ${disclaimer}`});function recordsEmptyVariantForError(error){return error?.httpStatus===429?"rate_limited":error?.httpStatus===502?"service_unavailable":"error"}function formatEntityValue(value,unit){return value===null?"":unit?`${value} ${unit}`:value}var MONTHS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function formatRecordsDate(at){if(!at)return"-";let iso=/^(\d{4})-(\d{2})-(\d{2})/.exec(at);if(iso!==null){let month=MONTHS[Number(iso[2])-1];return month===void 0?"-":`${month} ${Number(iso[3])}, ${iso[1]}`}let ms=Date.parse(at);if(Number.isNaN(ms))return"-";let date=new Date(ms);return`${MONTHS[date.getUTCMonth()]} ${date.getUTCDate()}, ${date.getUTCFullYear()}`}var DEPTH_COPY=/* @__PURE__ */Object.freeze({timeline:"Timeline",loadingTimeline:"Loading timeline",labResults:"Blood & lab work",visits:"Visits",physicalExams:"Physical exams",visitNotes:"Visit notes",visit:"Visit",exam:"Exam",visitNote:"Visit note",notRecorded:"Not recorded",abnormal:"Abnormal",notExamined:"Not examined",normal:"Normal",measured:date=>`Measured ${date}`,uploadedDocument:"Uploaded document",kind:/* @__PURE__ */Object.freeze({visit:"Visit",vaccine:"Vaccine",weight:"Weight",medication:"Medication"}),clinicVisit:"Clinic visit",doctor:name=>`Dr. ${name}`,lot:lot=>`Lot ${lot}`,expires:date=>`Expires ${date}`});function markerStatusLabel(status){switch(status){case"above":return{label:"Above range",outOfRange:true};case"below":return{label:"Below range",outOfRange:true};case"in_range":return{label:"In range",outOfRange:false};default:return{label:"No range on file",outOfRange:false}}}function trajectoryLabel(trajectory,visitCount){return visitCount<2?null:`${trajectory==="flat"?"Holding steady":`Trending ${trajectory==="down"?"down":trajectory==="up"?"up":"steady"}`} over ${visitCount} visits`}function humanize(key){let spaced=key.replace(/_/g," ").trim();return spaced.length===0?key:spaced.charAt(0).toUpperCase()+spaced.slice(1)}var BODY_SYSTEM_LABEL=/* @__PURE__ */Object.freeze({general:"General / attitude",eent:"Eyes, ears, nose & throat",oral_dental:"Oral & dental",cardiovascular:"Cardiovascular",respiratory:"Respiratory",gastrointestinal:"GI / abdomen",urogenital:"Urogenital",musculoskeletal:"Musculoskeletal",neurologic:"Neurologic",integument:"Skin & coat",lymphatic:"Lymph nodes"});function bodySystemLabel(system){return Object.prototype.hasOwnProperty.call(BODY_SYSTEM_LABEL,system)?BODY_SYSTEM_LABEL[system]:humanize(system)}var SOAP_SECTION_LABEL=/* @__PURE__ */Object.freeze({reason_for_visit:"Reason for visit",subjective:"Subjective",objective:"Objective",assessment:"Assessment",plan:"Plan",discharge_instructions:"Discharge instructions",follow_up:"Follow-up",remarks:"Notes"});function soapSectionLabel(section){return Object.prototype.hasOwnProperty.call(SOAP_SECTION_LABEL,section)?SOAP_SECTION_LABEL[section]:humanize(section)}function formatWeightKg(weightKg){return weightKg===null||!Number.isFinite(weightKg)?"-":`${weightKg.toFixed(3).replace(/\.?0+$/,"")} kg`}function formatMarkerReading(value,unit,qualitative){if((value===null||!Number.isFinite(value))&&qualitative)return qualitative;if(value===null||!Number.isFinite(value))return"-";let num3=value.toFixed(3).replace(/\.?0+$/,"");return unit?`${num3} ${unit}`:num3}function labDetailLine(at,trajectory,pointCount){let traj=trajectoryLabel(trajectory,pointCount);return at?`${DEPTH_COPY.measured(formatRecordsDate(at))}${traj?` · ${traj}`:""}`:traj}var KIND_ORDER=/* @__PURE__ */Object.freeze({visit:0,vaccine:1,weight:2,medication:3});function toMillis(iso){if(!iso)return null;let ms=Date.parse(iso);return Number.isNaN(ms)?null:ms}function buildTimelineRows(timeline){let rows=[...timeline.visits.map((visit,index)=>({key:`visit-${index}-${visit.visitId}`,kind:"visit",kindLabel:DEPTH_COPY.kind.visit,at:visit.visitDate,date:formatRecordsDate(visit.visitDate),title:visit.summary??DEPTH_COPY.clinicVisit,detail:visit.veterinarian?DEPTH_COPY.doctor(visit.veterinarian):null,docId:visit.docId})),...timeline.vaccines.map((vaccine,index)=>{let parts=[];return vaccine.lot&&parts.push(DEPTH_COPY.lot(vaccine.lot)),vaccine.expiresOn&&parts.push(DEPTH_COPY.expires(formatRecordsDate(vaccine.expiresOn))),{key:`vaccine-${index}-${vaccine.vaccineId}`,kind:"vaccine",kindLabel:DEPTH_COPY.kind.vaccine,at:vaccine.administeredOn,date:formatRecordsDate(vaccine.administeredOn),title:vaccine.product||DEPTH_COPY.kind.vaccine,detail:parts.length?parts.join(" · "):null,docId:vaccine.docId}}),...timeline.weights.map((weight,index)=>({key:`weight-${index}-${weight.weightId}`,kind:"weight",kindLabel:DEPTH_COPY.kind.weight,at:weight.observedOn,date:formatRecordsDate(weight.observedOn),title:formatWeightKg(weight.weightKg),detail:null,docId:weight.docId})),...timeline.medications.map((medication,index)=>{let parts=[medication.dose,medication.route,medication.frequency].filter(p=>!!p);return{key:`medication-${index}-${medication.medicationId}`,kind:"medication",kindLabel:DEPTH_COPY.kind.medication,at:medication.startedOn,date:formatRecordsDate(medication.startedOn),title:medication.drugName||DEPTH_COPY.kind.medication,detail:parts.length?parts.join(" · "):null,docId:medication.docId}})];/* @__PURE__ */
|
|
5
|
+
return Object.freeze(rows.sort((a,b)=>{let am=toMillis(a.at),bm=toMillis(b.at);return am===null&&bm===null?KIND_ORDER[a.kind]-KIND_ORDER[b.kind]:am===null?1:bm===null?-1:bm!==am?bm-am:KIND_ORDER[a.kind]-KIND_ORDER[b.kind]}))}var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
|
|
6
|
+
/* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
7
|
+
/* @__PURE__ */Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),
|
|
8
|
+
/* @__PURE__ */Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),
|
|
9
|
+
/* @__PURE__ */Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),
|
|
10
|
+
/* @__PURE__ */Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
11
|
+
/* @__PURE__ */Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),
|
|
12
|
+
/* @__PURE__ */Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
13
|
+
/* @__PURE__ */Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
14
|
+
/* @__PURE__ */Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),
|
|
15
|
+
/* @__PURE__ */Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),
|
|
16
|
+
/* @__PURE__ */Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),
|
|
17
|
+
/* @__PURE__ */Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),
|
|
18
|
+
/* @__PURE__ */Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
19
|
+
/* @__PURE__ */Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),
|
|
20
|
+
/* @__PURE__ */Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),
|
|
21
|
+
/* @__PURE__ */Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),
|
|
22
|
+
/* @__PURE__ */Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
23
|
+
/* @__PURE__ */Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
24
|
+
/* @__PURE__ */Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),
|
|
25
|
+
/* @__PURE__ */Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
26
|
+
/* @__PURE__ */Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),
|
|
27
|
+
/* @__PURE__ */Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),
|
|
28
|
+
/* @__PURE__ */Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
29
|
+
/* @__PURE__ */Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
30
|
+
/* @__PURE__ */Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
31
|
+
/* @__PURE__ */Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
|
|
32
|
+
/* @__PURE__ */Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
33
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
34
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
35
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
36
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
37
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
38
|
+
/* @__PURE__ */Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
39
|
+
/* @__PURE__ */Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
40
|
+
/* @__PURE__ */Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
41
|
+
/* @__PURE__ */Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
42
|
+
/* @__PURE__ */Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
43
|
+
/* @__PURE__ */Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),
|
|
44
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
45
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),
|
|
46
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
47
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
48
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
49
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
50
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
51
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
52
|
+
/* @__PURE__ */Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
53
|
+
/* @__PURE__ */Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
54
|
+
/* @__PURE__ */Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),
|
|
55
|
+
/* @__PURE__ */Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
56
|
+
/* @__PURE__ */Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),
|
|
57
|
+
/* @__PURE__ */Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
58
|
+
/* @__PURE__ */Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
59
|
+
/* @__PURE__ */Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
60
|
+
/* @__PURE__ */Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),
|
|
61
|
+
/* @__PURE__ */Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
62
|
+
/* @__PURE__ */Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
63
|
+
/* @__PURE__ */Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
64
|
+
/* @__PURE__ */Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
65
|
+
/* @__PURE__ */Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
66
|
+
/* @__PURE__ */Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),
|
|
67
|
+
/* @__PURE__ */Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
68
|
+
/* @__PURE__ */Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
69
|
+
/* @__PURE__ */Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
70
|
+
/* @__PURE__ */Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
71
|
+
/* @__PURE__ */Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
72
|
+
/* @__PURE__ */Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
73
|
+
/* @__PURE__ */Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),
|
|
74
|
+
/* @__PURE__ */Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),
|
|
75
|
+
/* @__PURE__ */Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
76
|
+
/* @__PURE__ */Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
77
|
+
/* @__PURE__ */Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
78
|
+
/* @__PURE__ */Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
79
|
+
/* @__PURE__ */Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
80
|
+
/* @__PURE__ */Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),
|
|
81
|
+
/* @__PURE__ */Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
82
|
+
/* @__PURE__ */Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),
|
|
83
|
+
/* @__PURE__ */Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
|
|
84
|
+
/* @__PURE__ */Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
85
|
+
/* @__PURE__ */Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),
|
|
86
|
+
/* @__PURE__ */Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),
|
|
87
|
+
/* @__PURE__ */Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
88
|
+
/* @__PURE__ */Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
|
|
89
|
+
/* @__PURE__ */Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
90
|
+
/* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
91
|
+
/* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
92
|
+
/* @__PURE__ */Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",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"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"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 categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,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.",identitySignatureRequired:ACCESS_DENIED_COPY,unknown:"Something went wrong. Please try again."});function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),error={code:code,category:categoryFor(code),retryable:opts?.retryable??isRetryableCode(code),displayMessage:userFacingError(code)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
|
|
93
|
+
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch{return err(authRejectedError())}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch{return err(authRejectedError())}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?err(authRejectedError(retry.error.httpStatus)):retry}function authRejectedError(httpStatus){return makeEverfurError("authRejected",{retryable:false,...httpStatus!==void 0?{httpStatus:httpStatus}:{}})}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
94
|
+
/* @__PURE__ */Object.freeze({call:call,phase:"stream.open",method:req.method,path:req.path,attempt:0}));try{yield*deps.auth.transport.stream(req,signal)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
95
|
+
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}var FACT_ENTITY_TYPE_MAX=64,FACT_CANONICAL_KEY_MAX=512;function normalizeOrigin(raw){return raw==="owner_reported"||raw==="clinic_document"?raw:null}var entitySchema=/* @__PURE__ */zod.z.object({key:/* @__PURE__ */zod.z.string(),category:/* @__PURE__ */zod.z.string().optional(),label:/* @__PURE__ */zod.z.string().optional(),value:/* @__PURE__ */zod.z.string().nullish(),unit:/* @__PURE__ */zod.z.string().nullish(),observed_at:/* @__PURE__ */zod.z.string().nullish(),status:/* @__PURE__ */zod.z.string().nullish(),origin:/* @__PURE__ */zod.z.string().nullish(),canonical_key:/* @__PURE__ */zod.z.string().nullish()});var documentSchema=/* @__PURE__ */zod.z.object({doc_id:/* @__PURE__ */zod.z.string(),title:/* @__PURE__ */zod.z.string().nullish(),page_count:/* @__PURE__ */zod.z.number().nullish(),received_at:/* @__PURE__ */zod.z.string().nullish()});function mapEntityRow(e){/* @__PURE__ */
|
|
96
|
+
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:normalizeOrigin(e.origin),canonicalKey:e.canonical_key??null})}function mapDocumentRow(d){/* @__PURE__ */
|
|
97
|
+
return Object.freeze({docId:d.doc_id,title:d.title??null,pageCount:d.page_count??null,receivedAt:d.received_at??null})}var str=/* @__PURE__ */zod.z.string().nullish(),num=/* @__PURE__ */zod.z.number().nullish(),pointSchema=/* @__PURE__ */zod.z.object({collected_at:str,at:str,value:num,unit:str,qualitative_result:str,ref_low:num,ref_high:num,status:str,source_clinic:str,source_doc_id:str,doc_id:str,reviewed:/* @__PURE__ */zod.z.boolean().nullish()}),latestSchema=/* @__PURE__ */zod.z.object({collected_at:str,at:str,value:num,unit:str,qualitative_result:str,status:str}),markerSchema=/* @__PURE__ */zod.z.object({marker_id:/* @__PURE__ */zod.z.string().min(1),canonical_name:str,name:str,loinc_code:str,canonical_unit:str,unit:str,panel_name:str,panel:str,meaning_text:str,meaning:str,latest:/* @__PURE__ */latestSchema.nullish(),trajectory:str,points:/* @__PURE__ */zod.z.array(pointSchema).optional()}),summarySchema=/* @__PURE__ */zod.z.object({total_markers:/* @__PURE__ */zod.z.number().int().nonnegative(),in_range_count:/* @__PURE__ */zod.z.number().int().nonnegative(),out_of_range_count:/* @__PURE__ */zod.z.number().int().nonnegative(),unknown_count:/* @__PURE__ */zod.z.number().int().nonnegative()}),markersSchema=/* @__PURE__ */zod.z.object({markers:/* @__PURE__ */zod.z.array(markerSchema).optional(),summary:/* @__PURE__ */summarySchema.nullish(),disclaimer:/* @__PURE__ */zod.z.string().optional(),featured_marker_id:str});function isObject(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}function withheldMarkers(pet){/* @__PURE__ */
|
|
98
|
+
return Object.freeze({petRef:pet,withheld:true,markers:/* @__PURE__ */Object.freeze([]),summary:null,disclaimer:"",featuredMarkerId:null})}function mapRecordMarkers(petRef,wire){let w=isObject(wire)?wire:{},pet=typeof w.pet_ref=="string"&&w.pet_ref.length>0?w.pet_ref:petRef;if(w.withheld===true)return withheldMarkers(pet);let parsed=markersSchema.safeParse(w);if(!parsed.success)return withheldMarkers(pet);let m=parsed.data,point=p=>/* @__PURE__ */Object.freeze({at:p.collected_at??p.at??null,value:p.value??null,unit:p.unit??null,qualitativeResult:p.qualitative_result??null,refLow:p.ref_low??null,refHigh:p.ref_high??null,status:p.status??null,sourceClinic:p.source_clinic??null,docId:p.source_doc_id??p.doc_id??null,reviewed:p.reviewed===true}),markers=(m.markers??[]).map(marker=>/* @__PURE__ */Object.freeze({markerId:marker.marker_id,name:marker.canonical_name??marker.name??marker.marker_id,loincCode:marker.loinc_code??null,unit:marker.canonical_unit??marker.unit??null,panel:marker.panel_name??marker.panel??null,meaning:marker.meaning_text??marker.meaning??null,latest:marker.latest?/* @__PURE__ */Object.freeze({at:marker.latest.collected_at??marker.latest.at??null,value:marker.latest.value??null,unit:marker.latest.unit??null,qualitativeResult:marker.latest.qualitative_result??null,status:marker.latest.status??null}):null,trajectory:marker.trajectory??null,points:/* @__PURE__ */Object.freeze((marker.points??[]).map(point))}));/* @__PURE__ */
|
|
99
|
+
return Object.freeze({petRef:pet,withheld:false,markers:/* @__PURE__ */Object.freeze(markers),summary:m.summary?/* @__PURE__ */Object.freeze({totalMarkers:m.summary.total_markers,inRangeCount:m.summary.in_range_count,outOfRangeCount:m.summary.out_of_range_count,unknownCount:m.summary.unknown_count}):null,disclaimer:m.disclaimer??"",featuredMarkerId:m.featured_marker_id??null})}var IDEMPOTENCY_KEY_MAX=128,PET_REF_MAX=128;var https=/* @__PURE__ */zod.z.string().min(1).refine(value=>value.startsWith("https://")),itemSchema=/* @__PURE__ */zod.z.object({source_doc_id:/* @__PURE__ */zod.z.string().min(1),file_name:/* @__PURE__ */zod.z.string().nullish(),doc_format:/* @__PURE__ */zod.z.string().nullish(),byte_size:/* @__PURE__ */zod.z.number().int().nonnegative().nullish(),received_at:/* @__PURE__ */zod.z.string().nullish(),download_url:https,expires_in_seconds:/* @__PURE__ */zod.z.number().int().nonnegative().nullish()}),listSchema=/* @__PURE__ */zod.z.object({items:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.unknown()).optional()});function mapRequestDocuments(wire){let parsed=listSchema.safeParse(wire);if(!parsed.success)return null;let rows=[];for(let raw of parsed.data.items??[]){let item=itemSchema.safeParse(raw);item.success&&rows.push(
|
|
100
|
+
/* @__PURE__ */Object.freeze({sourceDocId:item.data.source_doc_id,fileName:item.data.file_name??null,docFormat:item.data.doc_format??null,byteSize:item.data.byte_size??null,receivedAt:item.data.received_at??null,downloadUrl:item.data.download_url,expiresInSeconds:item.data.expires_in_seconds??0}))}/* @__PURE__ */
|
|
101
|
+
return Object.freeze(rows)}var RECORD_SHARE_AUDIENCES=/* @__PURE__ */Object.freeze(["vet","groomer","boarding"]),https2=/* @__PURE__ */zod.z.string().min(1).refine(value=>value.startsWith("https://")),str2=/* @__PURE__ */zod.z.string().nullish(),audienceField=/* @__PURE__ */zod.z.unknown().optional(),linkSchema=/* @__PURE__ */zod.z.object({share_id:/* @__PURE__ */zod.z.string().min(1),share_url:/* @__PURE__ */zod.z.string().min(1),expires_at:str2,audience:audienceField}),listSchema2=/* @__PURE__ */zod.z.object({shares:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.object({share_id:/* @__PURE__ */zod.z.string().min(1),expires_at:str2,created_at:str2,view_count:/* @__PURE__ */zod.z.number().int().nonnegative().nullish(),last_viewed_at:str2,audience:audienceField})).optional()}),pdfSchema=/* @__PURE__ */zod.z.object({download_url:https2,expires_at:str2}),emailSchema=/* @__PURE__ */zod.z.object({share_id:/* @__PURE__ */zod.z.string().min(1),expires_at:str2,audience:audienceField}),scopeSchema=/* @__PURE__ */zod.z.object({audience:/* @__PURE__ */zod.z.string().min(1),sections:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.string()),entity_types:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.string()).nullable()}),SHARE_RECIPIENT_EMAIL_MAX=254;function isShareRecipientEmail(value){let trimmed=value.trim();return trimmed.length>0&&trimmed.length<=SHARE_RECIPIENT_EMAIL_MAX&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(trimmed)}var isAudience=value=>typeof value=="string"&&RECORD_SHARE_AUDIENCES.includes(value);function audienceOf(value){return isAudience(value)?value:null}function mapShareAudiences(wire){let parsed=zod.z.array(scopeSchema).safeParse(wire);if(!parsed.success)/* @__PURE__ */return Object.freeze([]);let seen=/* @__PURE__ */new Set,scopes=[];for(let scope of parsed.data)!isAudience(scope.audience)||seen.has(scope.audience)||(seen.add(scope.audience),scopes.push(/* @__PURE__ */Object.freeze({audience:scope.audience,sections:/* @__PURE__ */Object.freeze([...scope.sections]),entityTypes:scope.entity_types===null?null:/* @__PURE__ */Object.freeze([...scope.entity_types])}))/* @__PURE__ */);return Object.freeze(scopes)}function resolveShareUrl(shareUrl,apiBaseUrl){let trimmed=shareUrl.trim();if(trimmed.length===0)return null;try{let absolute=/^[a-z][a-z0-9+.-]*:/i.test(trimmed)?new URL(trimmed):apiBaseUrl!==void 0?new URL(trimmed,apiBaseUrl):null;return absolute===null||absolute.protocol!=="https:"?null:absolute.toString()}catch{return null}}function mapRecordShareLink(wire,apiBaseUrl){let parsed=linkSchema.safeParse(wire);if(!parsed.success)return null;let shareUrl=resolveShareUrl(parsed.data.share_url,apiBaseUrl);return shareUrl===null?null:/* @__PURE__ */Object.freeze({shareId:parsed.data.share_id,shareUrl:shareUrl,expiresAt:parsed.data.expires_at??null,audience:audienceOf(parsed.data.audience)})}function mapRecordShareList(wire){let parsed=listSchema2.safeParse(wire);return parsed.success?/* @__PURE__ */Object.freeze((parsed.data.shares??[]).map(share=>/* @__PURE__ */Object.freeze({shareId:share.share_id,expiresAt:share.expires_at??null,createdAt:share.created_at??null,viewCount:share.view_count??0,lastViewedAt:share.last_viewed_at??null,audience:audienceOf(share.audience)}))):null}function mapRecordShareEmailReceipt(wire){let parsed=emailSchema.safeParse(wire);return parsed.success?/* @__PURE__ */Object.freeze({shareId:parsed.data.share_id,expiresAt:parsed.data.expires_at??null,audience:audienceOf(parsed.data.audience)}):null}function mapRecordPdfLink(wire){let parsed=pdfSchema.safeParse(wire);return parsed.success?/* @__PURE__ */Object.freeze({downloadUrl:parsed.data.download_url,expiresAt:parsed.data.expires_at??null}):null}var RECORDS_PDF_CONTENT_TYPE="application/pdf",RECORDS_PHOTO_CONTENT_TYPES=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/heic","image/heif"]);var RECORDS_FEATURES_PDF_ONLY=/* @__PURE__ */Object.freeze({features:/* @__PURE__ */Object.freeze({}),uploadContentTypes:/* @__PURE__ */Object.freeze([RECORDS_PDF_CONTENT_TYPE]),shareAudiences:/* @__PURE__ */Object.freeze([])}),featuresSchema=/* @__PURE__ */zod.z.object({features:/* @__PURE__ */zod.z.record(/* @__PURE__ */zod.z.boolean()),upload_content_types:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.string()).nullish(),share_audiences:/* @__PURE__ */zod.z.unknown().optional()});function mapRecordsFeatures(wire){let parsed=featuresSchema.safeParse(wire);if(!parsed.success)return RECORDS_FEATURES_PDF_ONLY;let listed=parsed.data.upload_content_types??[],photos=RECORDS_PHOTO_CONTENT_TYPES.filter(type=>listed.includes(type));/* @__PURE__ */
|
|
102
|
+
return Object.freeze({features:/* @__PURE__ */Object.freeze({...parsed.data.features}),uploadContentTypes:/* @__PURE__ */Object.freeze([RECORDS_PDF_CONTENT_TYPE,...photos]),shareAudiences:mapShareAudiences(parsed.data.share_audiences)})}var listSchema3=/* @__PURE__ */zod.z.object({signatures:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.object({signature_id:/* @__PURE__ */zod.z.string().min(1),preview_url:/* @__PURE__ */zod.z.string().min(1).refine(value=>value.startsWith("https://")),created_at:/* @__PURE__ */zod.z.string().nullish()})).optional()});function mapSignatureSuggestions(wire){let parsed=listSchema3.safeParse(wire);return parsed.success?/* @__PURE__ */Object.freeze((parsed.data.signatures??[]).map(row=>/* @__PURE__ */Object.freeze({signatureId:row.signature_id,previewUrl:row.preview_url,createdAt:row.created_at??null}))):null}var str3=/* @__PURE__ */zod.z.string().nullish(),num2=/* @__PURE__ */zod.z.number().nullish(),labPointSchema=/* @__PURE__ */zod.z.object({at:str3,value:num2,unit:str3,qualitative_result:str3,ref_low:num2,ref_high:num2,status:str3,doc_id:str3}),labMarkerSchema=/* @__PURE__ */zod.z.object({marker_id:/* @__PURE__ */zod.z.string(),name:/* @__PURE__ */zod.z.string(),loinc_code:str3,unit:str3,panel:str3,meaning:str3,latest:/* @__PURE__ */zod.z.object({at:str3,value:num2,unit:str3,qualitative_result:str3,status:str3}).nullish(),trajectory:str3,points:/* @__PURE__ */zod.z.array(labPointSchema).optional()}),encounterSchema=/* @__PURE__ */zod.z.object({encounter_id:/* @__PURE__ */zod.z.string(),date:str3,type:str3,clinic_name:str3,veterinarian:str3,doc_id:str3}),noteSchema=/* @__PURE__ */zod.z.object({note_id:/* @__PURE__ */zod.z.string(),encounter_id:str3,observed_on:str3,sections:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.object({section:/* @__PURE__ */zod.z.string(),text:/* @__PURE__ */zod.z.string()})).optional()}),examSchema=/* @__PURE__ */zod.z.object({exam_id:/* @__PURE__ */zod.z.string(),encounter_id:str3,observed_on:str3,doc_id:str3,systems:/* @__PURE__ */zod.z.record(/* @__PURE__ */zod.z.object({finding_status:str3,finding:str3})).optional()}),completenessSchema=/* @__PURE__ */zod.z.object({has_lab_history:/* @__PURE__ */zod.z.boolean().optional(),has_vaccination_history:/* @__PURE__ */zod.z.boolean().optional(),has_weight_history:/* @__PURE__ */zod.z.boolean().optional(),has_vitals_history:/* @__PURE__ */zod.z.boolean().optional(),has_physical_exam_history:/* @__PURE__ */zod.z.boolean().optional(),has_procedure_history:/* @__PURE__ */zod.z.boolean().optional(),has_genetic_history:/* @__PURE__ */zod.z.boolean().optional(),has_reproductive_history:/* @__PURE__ */zod.z.boolean().optional(),has_parasite_prevention_history:/* @__PURE__ */zod.z.boolean().optional(),earliest_record_at:str3,latest_record_at:str3,documents_ingested:/* @__PURE__ */zod.z.number().int().nonnegative().optional(),documents_in_review:/* @__PURE__ */zod.z.number().int().nonnegative().optional(),entities_pending_review:/* @__PURE__ */zod.z.record(/* @__PURE__ */zod.z.number().int().nonnegative()).optional(),held_total:/* @__PURE__ */zod.z.number().int().nonnegative().optional()}),conflictSchema=/* @__PURE__ */zod.z.object({conflict_id:/* @__PURE__ */zod.z.string(),entity_type:/* @__PURE__ */zod.z.string(),field:str3,severity:str3,candidates:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.object({value:/* @__PURE__ */zod.z.string(),source_doc_id:str3,doc_id:str3,collected_at:str3})).optional()}),depthSchema=/* @__PURE__ */zod.z.object({lab_results:/* @__PURE__ */zod.z.array(labMarkerSchema).optional(),encounters:/* @__PURE__ */zod.z.array(encounterSchema).optional(),clinician_notes:/* @__PURE__ */zod.z.array(noteSchema).optional(),physical_exams:/* @__PURE__ */zod.z.array(examSchema).optional(),completeness:/* @__PURE__ */completenessSchema.nullish(),conflicts:/* @__PURE__ */zod.z.array(conflictSchema).optional()}),timelineSchema=/* @__PURE__ */zod.z.object({visits:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.object({visit_id:/* @__PURE__ */zod.z.string(),visit_date:str3,veterinarian:str3,summary:str3,doc_id:str3})),vaccines:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.object({vaccine_id:/* @__PURE__ */zod.z.string(),product:str3,lot:str3,administered_on:str3,expires_on:str3,doc_id:str3})),weights:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.object({weight_id:/* @__PURE__ */zod.z.string(),observed_on:str3,weight_kg:num2,doc_id:str3})),medications:/* @__PURE__ */zod.z.array(/* @__PURE__ */zod.z.object({medication_id:/* @__PURE__ */zod.z.string(),drug_name:str3,dose:str3,route:str3,frequency:str3,sig:str3,rx_number:str3,started_on:str3,stopped_on:str3,doc_id:str3})),disclaimer:/* @__PURE__ */zod.z.string().optional()}),contributionsSchema=/* @__PURE__ */zod.z.object({document:documentSchema,contributions:/* @__PURE__ */zod.z.array(entitySchema),contribution_count:/* @__PURE__ */zod.z.number().int().nonnegative().optional()});function isObject2(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}function petOf(w,petRef){return typeof w.pet_ref=="string"&&w.pet_ref.length>0?w.pet_ref:petRef}function emptyDepth(pet,withheld){/* @__PURE__ */
|
|
103
|
+
return Object.freeze({petRef:pet,available:false,withheld:withheld,labResults:/* @__PURE__ */Object.freeze([]),encounters:/* @__PURE__ */Object.freeze([]),clinicianNotes:/* @__PURE__ */Object.freeze([]),physicalExams:/* @__PURE__ */Object.freeze([]),completeness:null,conflicts:/* @__PURE__ */Object.freeze([])})}function mapRecordDepth(petRef,wire){let w=isObject2(wire)?wire:{},pet=petOf(w,petRef);if(w.withheld===true)return emptyDepth(pet,true);if(!["lab_results","encounters","clinician_notes","physical_exams","completeness","conflicts"].some(key=>key in w))return emptyDepth(pet,false);let parsed=depthSchema.safeParse(w);if(!parsed.success)return emptyDepth(pet,true);let d=parsed.data,point=p=>/* @__PURE__ */Object.freeze({at:p.at??null,value:p.value??null,unit:p.unit??null,qualitativeResult:p.qualitative_result??null,refLow:p.ref_low??null,refHigh:p.ref_high??null,status:p.status??null,docId:p.doc_id??null});/* @__PURE__ */
|
|
104
|
+
return Object.freeze({petRef:pet,available:true,withheld:false,labResults:/* @__PURE__ */Object.freeze((d.lab_results??[]).map(m=>/* @__PURE__ */Object.freeze({markerId:m.marker_id,name:m.name,loincCode:m.loinc_code??null,unit:m.unit??null,panel:m.panel??null,meaning:m.meaning??null,latest:/* @__PURE__ */Object.freeze({at:m.latest?.at??null,value:m.latest?.value??null,unit:m.latest?.unit??null,qualitativeResult:m.latest?.qualitative_result??null,status:m.latest?.status??null}),trajectory:m.trajectory??null,points:/* @__PURE__ */Object.freeze((m.points??[]).map(point))}))),encounters:/* @__PURE__ */Object.freeze((d.encounters??[]).map(e=>/* @__PURE__ */Object.freeze({encounterId:e.encounter_id,date:e.date??null,type:e.type??null,clinicName:e.clinic_name??null,veterinarian:e.veterinarian??null,docId:e.doc_id??null}))),clinicianNotes:/* @__PURE__ */Object.freeze((d.clinician_notes??[]).map(n=>/* @__PURE__ */Object.freeze({noteId:n.note_id,encounterId:n.encounter_id??null,observedOn:n.observed_on??null,sections:/* @__PURE__ */Object.freeze((n.sections??[]).map(s=>/* @__PURE__ */Object.freeze({section:s.section,text:s.text})))}))),physicalExams:/* @__PURE__ */Object.freeze((d.physical_exams??[]).map(x=>/* @__PURE__ */Object.freeze({examId:x.exam_id,encounterId:x.encounter_id??null,observedOn:x.observed_on??null,docId:x.doc_id??null,systems:/* @__PURE__ */Object.freeze(Object.entries(x.systems??{}).map(([system,field])=>/* @__PURE__ */Object.freeze({system:system,findingStatus:field.finding_status??null,finding:field.finding??null})))}))),completeness:d.completeness?/* @__PURE__ */Object.freeze({hasLabHistory:d.completeness.has_lab_history===true,hasVaccinationHistory:d.completeness.has_vaccination_history===true,hasWeightHistory:d.completeness.has_weight_history===true,hasVitalsHistory:d.completeness.has_vitals_history===true,hasPhysicalExamHistory:d.completeness.has_physical_exam_history===true,hasProcedureHistory:d.completeness.has_procedure_history===true,hasGeneticHistory:d.completeness.has_genetic_history===true,hasReproductiveHistory:d.completeness.has_reproductive_history===true,hasParasitePreventionHistory:d.completeness.has_parasite_prevention_history===true,earliestRecordAt:d.completeness.earliest_record_at??null,latestRecordAt:d.completeness.latest_record_at??null,documentsIngested:d.completeness.documents_ingested??0,documentsInReview:d.completeness.documents_in_review??0,entitiesPendingReview:/* @__PURE__ */Object.freeze({...d.completeness.entities_pending_review??{}}),heldTotal:d.completeness.held_total??0}):null,conflicts:/* @__PURE__ */Object.freeze((d.conflicts??[]).map(c=>/* @__PURE__ */Object.freeze({conflictId:c.conflict_id,entityType:c.entity_type,field:c.field??null,severity:c.severity??"needs_review",candidates:/* @__PURE__ */Object.freeze((c.candidates??[]).map(k=>/* @__PURE__ */Object.freeze({value:k.value,docId:k.source_doc_id??k.doc_id??null,collectedAt:k.collected_at??null})))})))})}function withheldTimeline(pet){/* @__PURE__ */
|
|
105
|
+
return Object.freeze({petRef:pet,withheld:true,isEmpty:false,visits:/* @__PURE__ */Object.freeze([]),vaccines:/* @__PURE__ */Object.freeze([]),weights:/* @__PURE__ */Object.freeze([]),medications:/* @__PURE__ */Object.freeze([]),disclaimer:""})}function mapRecordsTimeline(petRef,wire){let w=isObject2(wire)?wire:{},pet=petOf(w,petRef);if(w.withheld===true)return withheldTimeline(pet);let parsed=timelineSchema.safeParse(w);if(!parsed.success)return withheldTimeline(pet);let t=parsed.data,visits=t.visits.map(v=>/* @__PURE__ */Object.freeze({visitId:v.visit_id,visitDate:v.visit_date??null,veterinarian:v.veterinarian??null,summary:v.summary??null,docId:v.doc_id??null})),vaccines=t.vaccines.map(v=>/* @__PURE__ */Object.freeze({vaccineId:v.vaccine_id,product:v.product??null,lot:v.lot??null,administeredOn:v.administered_on??null,expiresOn:v.expires_on??null,docId:v.doc_id??null})),weights=t.weights.map(v=>/* @__PURE__ */Object.freeze({weightId:v.weight_id,observedOn:v.observed_on??null,weightKg:v.weight_kg??null,docId:v.doc_id??null})),medications=t.medications.map(m=>/* @__PURE__ */Object.freeze({medicationId:m.medication_id,drugName:m.drug_name??null,dose:m.dose??null,route:m.route??null,frequency:m.frequency??null,sig:m.sig??null,rxNumber:m.rx_number??null,startedOn:m.started_on??null,stoppedOn:m.stopped_on??null,docId:m.doc_id??null}));/* @__PURE__ */
|
|
106
|
+
return Object.freeze({petRef:pet,withheld:false,isEmpty:visits.length===0&&vaccines.length===0&&weights.length===0&&medications.length===0,visits:/* @__PURE__ */Object.freeze(visits),vaccines:/* @__PURE__ */Object.freeze(vaccines),weights:/* @__PURE__ */Object.freeze(weights),medications:/* @__PURE__ */Object.freeze(medications),disclaimer:t.disclaimer??""})}function mapDocumentContributions(petRef,wire){let w=isObject2(wire)?wire:{},pet=petOf(w,petRef),withheld=()=>/* @__PURE__ */Object.freeze({petRef:pet,withheld:true,document:null,contributions:/* @__PURE__ */Object.freeze([]),contributionCount:0});if(w.withheld===true)return withheld();let parsed=contributionsSchema.safeParse(w);if(!parsed.success)return withheld();let contributions=/* @__PURE__ */Object.freeze(parsed.data.contributions.map(mapEntityRow));/* @__PURE__ */
|
|
107
|
+
return Object.freeze({petRef:pet,withheld:false,document:mapDocumentRow(parsed.data.document),contributions:contributions,contributionCount:parsed.data.contribution_count??contributions.length})}var BASE="/widget/v1/records/pets";function createRecordsDepthClient(deps){let funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),segment=(value,max)=>typeof value=="string"&&value.length>0&&!hasLoneSurrogate(value)&&[...value].length<=max,read=async(call,petRef,path,map)=>{if(!segment(petRef,PET_REF_MAX))return invalid();let result=await funnel.send(call,{method:"GET",path:path});if(!result.ok)return result;let view=map(result.value);return view.petRef===petRef?ok(view):err(makeEverfurError("internalError",{retryable:false}))},pet=petRef=>`${BASE}/${encodeURIComponent(petRef)}`,record=petRef=>`${pet(petRef)}/everfur_record`,parsed=async(call,req,map)=>{let result=await funnel.send(call,req,req.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!result.ok)return result;let value=map(result.value);return value===null?err(makeEverfurError("internalError",{retryable:false})):ok(value)},factBody=(input,corrected)=>!segment(input.entityType,FACT_ENTITY_TYPE_MAX)||!segment(input.canonicalKey,FACT_CANONICAL_KEY_MAX)||input.idempotencyKey!==void 0&&!segment(input.idempotencyKey,IDEMPOTENCY_KEY_MAX)||corrected!==void 0&&Object.keys(corrected).length===0?null:{entity_type:input.entityType,canonical_key:input.canonicalKey,...corrected!==void 0?{corrected_fields:corrected}:{},...input.idempotencyKey!==void 0?{idempotency_key:input.idempotencyKey}:{}};return{getRecordDepth:petRef=>read("records.depth.record",petRef,`${pet(petRef)}/record`,wire=>mapRecordDepth(petRef,wire)),getTimeline:petRef=>read("records.depth.timeline",petRef,`${pet(petRef)}/timeline`,wire=>mapRecordsTimeline(petRef,wire)),getDocumentContributions(petRef,docId){return segment(docId,64)?read("records.depth.contributions",petRef,`${pet(petRef)}/documents/${encodeURIComponent(docId)}/contributions`,wire=>mapDocumentContributions(petRef,wire)):invalid()},getMarkers:petRef=>read("records.depth.markers",petRef,`${pet(petRef)}/markers`,wire=>mapRecordMarkers(petRef,wire)),createShare(petRef,opts){if(!segment(petRef,PET_REF_MAX))return invalid();let audience=opts?.audience;return audience!==void 0&&!RECORD_SHARE_AUDIENCES.includes(audience)?invalid():parsed("records.share.create",{method:"POST",path:`${record(petRef)}/share`,...audience!==void 0?{body:{audience:audience}}:{}},wire=>mapRecordShareLink(wire,deps.apiBaseUrl))},emailShare(petRef,input){let kind=input.recipientKind,email=typeof input.recipientEmail=="string"?input.recipientEmail.trim():"",kindOk=kind==="other"||RECORD_SHARE_AUDIENCES.includes(kind);return!segment(petRef,PET_REF_MAX)||!kindOk||!isShareRecipientEmail(email)||hasLoneSurrogate(email)?invalid():parsed("records.share.email",{method:"POST",path:`${record(petRef)}/share/email`,body:{recipient_email:email,recipient_kind:kind}},mapRecordShareEmailReceipt)},async readFeatures(){try{let result=await funnel.send("records.getFeatures",{method:"GET",path:"/widget/v1/records/features"});return result.ok?mapRecordsFeatures(result.value):RECORDS_FEATURES_PDF_ONLY}catch{return RECORDS_FEATURES_PDF_ONLY}},listShares(petRef){return segment(petRef,PET_REF_MAX)?parsed("records.share.list",{method:"GET",path:`${record(petRef)}/shares`},mapRecordShareList):invalid()},async revokeShare(petRef,shareId){if(!segment(petRef,PET_REF_MAX)||!segment(shareId,64))return invalid();let result=await funnel.send("records.share.revoke",{method:"DELETE",path:`${record(petRef)}/shares/${encodeURIComponent(shareId)}`},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},getPdfLink(petRef){return segment(petRef,PET_REF_MAX)?parsed("records.pdf.link",{method:"GET",path:`${record(petRef)}/pdf-link`},mapRecordPdfLink):invalid()},async editFact(petRef,input){let body=segment(petRef,PET_REF_MAX)?factBody(input,input.correctedFields):null;if(body===null)return invalid();let result=await funnel.send("records.fact.edit",{method:"POST",path:`${record(petRef)}/facts/edit`,body:body},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},async removeFact(petRef,input){let body=segment(petRef,PET_REF_MAX)?factBody(input):null;if(body===null)return invalid();let result=await funnel.send("records.fact.remove",{method:"POST",path:`${record(petRef)}/facts/remove`,body:body},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},listRequestDocuments(requestId){return segment(requestId,64)?parsed("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(requestId)}/documents`},mapRequestDocuments):invalid()},listAuthorizationSignatures:()=>parsed("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},mapSignatureSuggestions)}}function invalid(){return Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false})))}var epochs=/* @__PURE__ */new Map,listeners=/* @__PURE__ */new Set;function recordsConsentEpochOf(petRef){return epochs.get(petRef)??0}function subscribe(onStoreChange){return listeners.add(onStoreChange),()=>{listeners.delete(onStoreChange)}}function useRecordsConsentEpoch(petRef){let snapshot=react.useCallback(()=>recordsConsentEpochOf(petRef),[petRef]);return react.useSyncExternalStore(subscribe,snapshot,snapshot)}function useEverfurRecordsDepthClient(){let{runtime:runtime,userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext();return react.useMemo(()=>{let{services:services}=runtime.registry;return createRecordsDepthClient({auth:services.authFor(userRef),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{},...typeof services.apiBaseUrl=="string"?{apiBaseUrl:services.apiBaseUrl}:{}})},[runtime,userRef,scopeEpoch])}function useRecordsDepthRead(petRef,read,isEmpty,extraKey=""){let client=useEverfurRecordsDepthClient(),{userRef:userRef}=useEverfurContext(),consentEpoch=useRecordsConsentEpoch(petRef),scope=react.useMemo(()=>({}),[client,petRef,extraKey,consentEpoch]),[state,setState]=react.useState({scope:scope,value:null,error:null,loading:true}),generation=react.useRef(0),load=react.useCallback(async()=>{let gen=generation.current+=1;if(setState({scope:scope,value:null,error:null,loading:true}),userRef===null){setState({scope:scope,value:null,error:null,loading:false});return}let result=await read(client,petRef);gen===generation.current&&(result.ok?setState({scope:scope,value:result.value,error:null,loading:false}):setState({scope:scope,value:null,error:result.error,loading:false}))},[client,petRef,read,scope,userRef]);react.useEffect(()=>(load(),()=>{generation.current+=1}),[load]);let current=state.scope===scope?state:{value:null,error:null,loading:true},refresh=react.useCallback(()=>{load()},[load]),available=current.error===null||current.error.httpStatus!==404,error=available?current.error:null,status=current.loading?"loading":error!==null?"error":current.value===null?"empty":current.value.withheld?"populated":isEmpty(current.value)?"empty":"populated";return react.useMemo(()=>({status:status,value:current.value,error:error,available:available,refresh:refresh}),[status,current.value,error,available,refresh])}var HostRenderBoundary=class extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(props,state){return Object.is(props.resetKey,state.key)?null:{failed:false,key:props.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:render}){return render()}function HostRender({render:render,fallback:fallback,resetKey:resetKey}){return react.createElement(HostRenderBoundary,{fallback:fallback,resetKey:resetKey,children:react.createElement(RenderHost,{render:render})})}var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS}}var NO_SLOTS={},EASING_CURVES=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(curve){return`cubic-bezier(${curve.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=react.createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return react.useContext(EverfurThemeContext)}var FACE_WEIGHT=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var SYSTEM_UI_STACK='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',RN_SYSTEM_FAMILY="System";function cssFontFamily(family){let named=family.trim();return named.length===0||named===RN_SYSTEM_FAMILY?SYSTEM_UI_STACK:`${quote(named)}, ${SYSTEM_UI_STACK}`}function cssMonoFamily(mono){let named=mono.trim();return named.length===0||named==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${quote(named)}, ui-monospace, Menlo, Consolas, monospace`}function quote(family){return`"${family.replace(/[\\"]/g,"\\$&")}"`}function faceCss(theme,weight){let type=theme.type,family=type.families[weight];return{fontFamily:weight==="mono"||weight==="monoMedium"||weight==="monoBold"?cssMonoFamily(family):cssFontFamily(family),fontWeight:type.namedFaces[weight]?type.weight.regular:type.weight[FACE_WEIGHT[weight]]}}var SURFACE_ROOT_RESET=/* @__PURE__ */Object.freeze({textAlign:"start"});var REQUIRES=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
108
|
+
return Object.freeze({reason:explicit.reason,level:explicit.level,recoverable:explicit.recoverable})}/* @__PURE__ */
|
|
109
|
+
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function freezeDecision(d){let base={name:d.name,enabled:d.enabled,isPending:d.isPending,limits:/* @__PURE__ */Object.freeze({...d.limits})};return d.disabled!==void 0&&(base.disabled=d.disabled),/* @__PURE__ */Object.freeze(base)}function useCapability(name){let{runtime:runtime}=useEverfurContext(),store=runtime.entitlements,snapshot=react.useSyncExternalStore(store.subscribe,store.getSnapshot,store.getSnapshot);return react.useMemo(()=>decideCapability(name,snapshot.decisions,{isPending:snapshot.isPending}),[name,snapshot])}var MIN_OFFSTATE_HEIGHT=48;function selectView(decision){return decision.isPending?"pending":decision.enabled?"enabled":"disabled"}function CapabilityGate(props){let{capability:capability,children:children,renderDisabled:renderDisabled,renderPending:renderPending,style:style,className:className}=props,decision=useCapability(capability),view=react.useMemo(()=>selectView(decision),[decision]);switch(view){case"enabled":return children;case"pending":return renderPending?/* @__PURE__ */jsxRuntime.jsx(HostRender,{render:renderPending,fallback:/* @__PURE__ */jsxRuntime.jsx(PendingSkeleton,{capability:capability,style:style,className:className})}):/* @__PURE__ */jsxRuntime.jsx(PendingSkeleton,{capability:capability,style:style,className:className});case"disabled":return renderDisabled?/* @__PURE__ */jsxRuntime.jsx(HostRender,{render:()=>renderDisabled(decision),fallback:/* @__PURE__ */jsxRuntime.jsx(OffState,{decision:decision,style:style,className:className}),resetKey:decision}):/* @__PURE__ */jsxRuntime.jsx(OffState,{decision:decision,style:style,className:className});default:return assertNever(view)}}function PendingSkeleton({capability:capability,style:style,className:className}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles(theme),[theme]);/* @__PURE__ */
|
|
110
|
+
return jsxRuntime.jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${capability}`,className:className,style:{...styles.offstate,...style},children:/* @__PURE__ */jsxRuntime.jsx("div",{style:styles.skeletonBar})})}function OffState({decision:decision,style:style,className:className}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles(theme),[theme]),message=decision.disabled?.reason??"";/* @__PURE__ */
|
|
111
|
+
return jsxRuntime.jsx("div",{className:className,style:{...styles.offstate,...style},children:message.length>0?/* @__PURE__ */jsxRuntime.jsx("p",{style:styles.offstateText,children:message}):null})}function makeStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme;return{offstate:{...SURFACE_ROOT_RESET,boxSizing:"border-box",minHeight:MIN_OFFSTATE_HEIGHT,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${space.md}px ${space.lg}px`,backgroundColor:color.surfaceCream,borderRadius:radius.md,border:`1px solid ${color.brandBorder}`},offstateText:{margin:0,...faceCss(theme,"regular"),fontSize:type.size.body,lineHeight:`${Math.round(type.size.body*type.lineHeight.normal)}px`,color:color.text.muted},skeletonBar:{height:space.md,borderRadius:radius.xs,backgroundColor:color.brandSofter}}}var RecordsFootnoteDrawnAbove=react.createContext(false);function RecordsFootnote(props){let theme=useEverfurTheme(),style=react.useMemo(()=>footnoteStyle(theme),[theme]);return react.useContext(RecordsFootnoteDrawnAbove)?null:/* @__PURE__ */jsxRuntime.jsx("p",{role:"note",className:props.className,style:{...style,...props.style},"data-testid":"records-footnote",children:RECORDS_FOOTNOTE})}function footnoteStyle(theme){let{color:color,space:space,type:type}=theme;return{...SURFACE_ROOT_RESET,boxSizing:"border-box",margin:0,padding:`${space.md}px ${space.lg}px ${space.lg}px`,textAlign:"center",...faceCss(theme,"regular"),fontSize:type.size.caption,lineHeight:`${Math.round(type.size.caption*type.lineHeight.normal)}px`,color:color.text.muted,backgroundColor:color.background}}var MIN_HEIGHT=120,MIN_TARGET=44;function RecordsGateOffState({reason:reason,onExit:onExit,exitLabel:exitLabel,style:style,className:className}){let{color:color,space:space,radius:radius,type:type}=useEverfurTheme();/* @__PURE__ */
|
|
112
|
+
return jsxRuntime.jsxs("div",{className:className,"data-testid":"records-gate-off",style:{boxSizing:"border-box",minHeight:MIN_HEIGHT,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:space.md,padding:space.lg,borderRadius:radius.md,border:`1px solid ${color.brandBorder}`,backgroundColor:color.surfaceCream,color:color.text.primary,...style},children:[reason.length>0?/* @__PURE__ */jsxRuntime.jsx("p",{style:{margin:0,fontSize:type.size.bodyTight,color:color.text.muted},children:reason}):null,
|
|
113
|
+
/* @__PURE__ */jsxRuntime.jsx("button",{type:"button",onClick:onExit,"data-testid":"records-gate-off-exit",style:{minHeight:MIN_TARGET,padding:`0 ${space.lg}px`,borderRadius:radius.pill,border:`1.5px solid ${color.brandInk}`,backgroundColor:"transparent",color:color.brandInk,font:"inherit",fontSize:type.size.body,cursor:"pointer"},children:exitLabel})]})}function recordsGateExit(onExit,exitLabel){return onExit===void 0?{}:{renderDisabled:decision=>/* @__PURE__ */jsxRuntime.jsx(RecordsGateOffState,{reason:decision.disabled?.reason??"",onExit:onExit,exitLabel:exitLabel})}}var SCREEN_HEADING_ATTR="data-ef-screen-heading";var MIN_SURFACE_HEIGHT=120,MIN_TOUCH_TARGET=44,BUTTON_HEIGHT=52,BACK_LABEL="Back";function useScreenStyles(){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeScreenStyles(theme),[theme]);return{theme:theme,styles:styles}}function ScreenHeader({title:title,onBack:onBack,right:right,testID:testID,variant:variant="brand"}){let{styles:styles}=useScreenStyles();/* @__PURE__ */
|
|
114
|
+
return jsxRuntime.jsxs("header",{style:styles.headerRow,"data-testid":testID,children:[onBack?/* @__PURE__ */jsxRuntime.jsx("button",{type:"button",onClick:onBack,"aria-label":BACK_LABEL,style:styles.iconButton,"data-testid":testID?`${testID}-back`:void 0,children:/* @__PURE__ */jsxRuntime.jsx("span",{"aria-hidden":"true",style:styles.backChevron})}):/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.iconButton}),title.trim().length>0?/* @__PURE__ */jsxRuntime.jsx("h2",{tabIndex:-1,[SCREEN_HEADING_ATTR]:"",style:variant==="document"?styles.documentTitle:styles.headerTitle,children:title}):/* @__PURE__ */jsxRuntime.jsx("span",{"aria-hidden":"true",style:styles.headerTitle,"data-testid":testID?`${testID}-spacer`:void 0}),
|
|
115
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{style:styles.headerRight,children:right??/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.iconButton})})]})}function makeScreenStyles(theme){let{color:color,space:space,radius:radius,type:type,slots:slots}=theme,lh=(size,multiplier)=>`${Math.round(size*multiplier)}px`,text=(size,multiplier,fg,weight="regular")=>({margin:0,...faceCss(theme,weight),fontSize:size,lineHeight:lh(size,multiplier),color:fg}),cardText=slotText(slots.recordCard),errorColor=theme.brightness==="dark"?color.errorRed:color.danger,tone=(bg,fg)=>({backgroundColor:bg,color:fg,border:"1.5px solid transparent"}),edge=(line,fg)=>({backgroundColor:color.surface,color:fg,border:`1.5px solid ${line}`}),cardEdge=`1px solid ${color.borderRingCream}`,button={boxSizing:"border-box",minHeight:BUTTON_HEIGHT,minWidth:MIN_TOUCH_TARGET,padding:`${space.md}px ${space.lg+space.xs/2}px`,borderRadius:radius.pill,...faceCss(theme,"bold"),fontSize:type.size.body,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:space.sm,textDecoration:"none"};return{chipTones:{neutral:edge(color.brandBorderStrong,color.text.primary),info:tone(color.brandSoft,color.brandInk),warning:edge(color.cautionAccent,color.text.primary),critical:edge(color.danger,color.danger),positive:edge(color.success,color.brandInk)},root:{...SURFACE_ROOT_RESET,boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:MIN_SURFACE_HEIGHT,height:"100%",backgroundColor:color.background,color:color.text.primary,...faceCss(theme,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},content:{display:"flex",flexDirection:"column",gap:space.lg,padding:`0 ${space.lg}px ${space.xxl}px`},contentTight:{display:"flex",flexDirection:"column",gap:space.lg,padding:`0 ${space.sm}px ${space.xxl}px`},inset:{padding:`0 ${space.sm}px`},headerRow:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.sm,padding:`${space.xs}px ${space.lg}px ${space.md}px`},iconButton:{boxSizing:"border-box",width:MIN_TOUCH_TARGET,height:MIN_TOUCH_TARGET,display:"inline-flex",alignItems:"center",justifyContent:"center",border:0,background:"transparent",cursor:"pointer",padding:0,color:color.brandInk,flexShrink:0},backChevron:{display:"block",width:space.md,height:space.md,borderLeft:`2px solid ${color.brandInk}`,borderBottom:`2px solid ${color.brandInk}`,transform:"rotate(45deg)",marginLeft:space.xs},headerTitle:{...text(type.size.heading,type.lineHeight.tight,color.brandInk,"bold"),flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},documentTitle:{...text(type.size.subtitle,type.lineHeight.snug,color.text.primary,"bold"),flex:1,textAlign:"center"},headerRight:{display:"flex",alignItems:"center",gap:space.sm+space.xs/2},section:{display:"flex",flexDirection:"column",gap:space.sm+space.xs/2},sectionHeader:{display:"flex",alignItems:"center",gap:space.sm,padding:`0 ${space.xs}px`},sectionTitle:{...text(type.size.subtitle,type.lineHeight.snug,color.text.primary,"bold"),letterSpacing:"-0.02em"},sectionCount:{...text(type.size.bodyTight,type.lineHeight.snug,color.text.muted,"medium")},card:{boxSizing:"border-box",borderRadius:radius.lg,border:cardEdge,backgroundColor:color.surface,padding:`${space.xs}px ${space.lg}px`,margin:0,listStyle:"none",...slotBoxCss(slots.recordCard,1)},creamCard:{boxSizing:"border-box",borderRadius:radius.lg,border:cardEdge,backgroundColor:color.surfaceCream,padding:space.lg,display:"flex",flexDirection:"column",gap:space.md,...slotBoxCss(slots.recordCard,1)},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.md,padding:`${space.md}px 0`},rowDivider:{borderTop:`1px solid ${color.borderHairlineGreen}`},rowMain:{flex:1,minWidth:0},rowRight:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:space.xs+space.xs/2},rowTitle:{...text(type.size.body,type.lineHeight.snug,color.text.primary,"medium"),...cardText},rowDetail:{...text(type.size.caption,type.lineHeight.normal,color.text.secondary),marginTop:space.xs/2,...cardText},rowValue:{...text(type.size.body+1,type.lineHeight.snug,color.text.primary,"bold"),marginTop:space.xs/2,...cardText},rowMuted:{...text(type.size.caption,type.lineHeight.normal,color.text.muted),...cardText},chip:{boxSizing:"border-box",display:"inline-flex",alignItems:"center",minHeight:24,borderRadius:radius.pill,padding:`0 ${space.sm+space.xs/2}px`,...faceCss(theme,"monoBold"),fontSize:type.size.tiny+1,lineHeight:lh(type.size.tiny+1,type.lineHeight.snug),letterSpacing:"0.06em",textTransform:"uppercase",whiteSpace:"nowrap"},pill:button,pillPrimary:{border:0,backgroundColor:color.brand,color:color.onPrimary,...slotBoxCss(slots.primaryButton),...slotText(slots.primaryButton)},pillOutline:{border:`1.5px solid ${color.brandInk}`,backgroundColor:"transparent",color:color.brandInk},pillDanger:{border:`1.4px solid ${color.danger}`,backgroundColor:color.surface,color:color.danger,fontSize:type.size.bodyTight},pillAsk:{border:`1px solid ${color.borderRingCream}`,backgroundColor:color.surface,color:color.text.primary},pillLink:{minHeight:MIN_TOUCH_TARGET,border:0,backgroundColor:"transparent",color:color.linkInk,padding:`${space.sm}px`},pillDisabled:{opacity:.5,cursor:"default"},infoNote:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.brandSoft,padding:`${space.sm+space.xs/2}px ${space.md}px`,...text(type.size.bodyTight,type.lineHeight.normal,color.text.primary)},cautionNote:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.badgeBgCaution,padding:`${space.sm+space.xs/2}px ${space.md}px`,...text(type.size.bodyTight,type.lineHeight.normal,color.warningStrong)},statusCard:{borderRadius:radius.md,backgroundColor:color.brandSoft,padding:space.md+space.xs/2,...text(type.size.bodyTight,type.lineHeight.relaxed,color.text.primary)},errorBanner:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.badgeBgCritical,padding:space.md,...text(type.size.bodyTight,type.lineHeight.normal,errorColor)},errorText:text(type.size.bodyTight,type.lineHeight.normal,errorColor),band:{display:"flex",alignItems:"flex-start",gap:space.sm,borderRadius:radius.md-space.xs/2,padding:space.md,backgroundColor:color.brandSoft,margin:0},bandText:{flex:1,...text(type.size.caption,type.lineHeight.normal,color.text.secondary)},infoGlyph:{boxSizing:"border-box",flexShrink:0,width:space.md+space.xs/2,height:space.md+space.xs/2,borderRadius:radius.pill,border:`1px solid ${color.text.secondary}`,display:"inline-flex",alignItems:"center",justifyContent:"center",...faceCss(theme,"bold"),fontSize:type.size.small,color:color.text.secondary},chevron:{display:"inline-block",width:space.sm,height:space.sm,borderTop:`2px solid ${color.text.muted}`,borderRight:`2px solid ${color.text.muted}`,flexShrink:0},chipSentence:{...faceCss(theme,"medium"),fontSize:type.size.caption,lineHeight:lh(type.size.caption,type.lineHeight.normal),letterSpacing:"normal",textTransform:"none",whiteSpace:"normal",borderRadius:radius.md,padding:`${space.xs}px ${space.sm+space.xs/2}px`},lead:{...text(type.size.body+1,type.lineHeight.snug,color.text.primary,"bold"),padding:`0 ${space.sm}px`},subLead:{...text(type.size.body,type.lineHeight.normal,color.text.muted),padding:`0 ${space.lg}px ${space.md}px`},field:{boxSizing:"border-box",display:"block",width:"100%",minHeight:MIN_TOUCH_TARGET,padding:`${space.sm}px ${space.md}px`,border:`1px solid ${color.borderHairlineGreen}`,borderRadius:radius.sm,color:color.text.primary,backgroundColor:color.surface,...faceCss(theme,"regular"),fontSize:type.size.body},fieldLabel:{...text(type.size.bodyTight,type.lineHeight.normal,color.text.secondary,"medium"),display:"block",marginBottom:space.xs},muted:text(type.size.caption,type.lineHeight.normal,color.text.muted),bodyText:text(type.size.body,type.lineHeight.normal,color.text.primary),mono:faceCss(theme,"mono"),plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column"},dialogFrame:{boxSizing:"border-box",position:"fixed",top:0,right:0,bottom:0,left:0,width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0,padding:0,border:0,backgroundColor:"transparent",overflow:"hidden"},dialogScrim:{boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:space.lg,backgroundColor:"rgba(0,0,0,0.4)"},dialogScrimSide:{boxSizing:"border-box",display:"flex",alignItems:"stretch",justifyContent:"flex-end",width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.4)"},dialogPanel:{boxSizing:"border-box",width:"100%",maxWidth:560,maxHeight:"100%",overflowY:"auto",backgroundColor:color.surface,borderRadius:radius.xl-1,padding:`${space.lg}px ${space.lg+space.xs+space.xs/2}px`,display:"flex",flexDirection:"column",gap:space.md,...faceCss(theme,"regular"),color:color.text.primary},dialogPanelSide:{boxSizing:"border-box",width:"min(100vw, 480px)",height:"100%",maxHeight:"100%",overflowY:"auto",backgroundColor:color.surface,padding:`${space.lg}px ${space.lg+space.xs+space.xs/2}px`,display:"flex",flexDirection:"column",gap:space.md,...faceCss(theme,"regular"),color:color.text.primary},sheetHeader:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:space.sm},sheetTitle:{...text(type.size.heading,type.lineHeight.snug,color.text.primary,"bold")},sheetHelper:text(type.size.bodyTight,type.lineHeight.normal,color.text.muted),closeGlyph:{fontSize:type.size.verdict,lineHeight:1,color:color.text.primary}}}var RECORDS_EMPTY_COPY=/* @__PURE__ */Object.freeze({idle:/* @__PURE__ */Object.freeze({title:"Find your pet’s clinic",body:"Search for the clinic that holds your pet’s records. We’ll request them on your behalf once you sign the authorization.",action:null}),no_requests:/* @__PURE__ */Object.freeze({title:"No record requests yet",body:"When you request records from a clinic, you’ll be able to track every step here.",action:null}),no_records:/* @__PURE__ */Object.freeze({title:"Nothing to show just yet",body:"Once your pet’s records arrive and our team reviews them, lab trends and visits will appear here.",action:null}),rate_limited:/* @__PURE__ */Object.freeze({title:"Slow down a moment",body:"You’ve made a lot of requests just now. You can try again shortly.",action:"Try again"}),service_unavailable:/* @__PURE__ */Object.freeze({title:"Records search is temporarily down",body:"We’re working on it. Please try again in a few minutes.",action:"Try again"}),error:/* @__PURE__ */Object.freeze({title:"Couldn’t reach Everfur",body:"Check your connection and try again.",action:"Try again"})}),RATE_LIMIT_COOLDOWN_S=60;function coolingActionLabel(seconds){return`Try again in ${seconds}s`}var COOLING_A11Y_LABEL="Try again, available shortly";function SkeletonBlock({width:width,height:height,radius:radius,style:style}){let{color:color,radius:radii}=useEverfurTheme();/* @__PURE__ */
|
|
116
|
+
return jsxRuntime.jsx("span",{"aria-hidden":"true",style:{display:"block",width:width,height:height,borderRadius:radius??radii.xs,backgroundColor:color.skeleton,flexShrink:0,...style}})}var DISCLAIMER_H=44,TIMELINE_SEPARATOR_INSET=62;function TimelineSkeleton({testID:testID}){let s=useStyles();/* @__PURE__ */
|
|
117
|
+
return jsxRuntime.jsxs("div",{role:"progressbar","aria-label":DEPTH_COPY.loadingTimeline,"aria-busy":"true",style:s.timeline,"data-testid":testID,children:[
|
|
118
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{style:s.timelineDisclaimer,children:/* @__PURE__ */jsxRuntime.jsx(SkeletonBlock,{width:"100%",height:DISCLAIMER_H,radius:12})}),Array.from({length:6},(_,index)=>/* @__PURE__ */jsxRuntime.jsxs("div",{children:[index>0?/* @__PURE__ */jsxRuntime.jsx("div",{style:s.timelineSeparator}):null,
|
|
119
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{style:s.timelineRow,children:[
|
|
120
|
+
/* @__PURE__ */jsxRuntime.jsx(SkeletonBlock,{width:34,height:34,radius:17}),
|
|
121
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{style:s.timelineBody,children:[
|
|
122
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{style:s.timelineTop,children:[
|
|
123
|
+
/* @__PURE__ */jsxRuntime.jsx(SkeletonBlock,{width:44,height:10,radius:5}),
|
|
124
|
+
/* @__PURE__ */jsxRuntime.jsx(SkeletonBlock,{width:56,height:12,radius:6})]}),
|
|
125
|
+
/* @__PURE__ */jsxRuntime.jsx(SkeletonBlock,{width:"70%",height:14,radius:7}),index%2===0?/* @__PURE__ */jsxRuntime.jsx(SkeletonBlock,{width:"45%",height:12,radius:6}):null]})]})]},index))]})}function RecordsEmptyState({variant:variant,onAction:onAction,message:message,testID:testID}){let s=useStyles(),copy=RECORDS_EMPTY_COPY[variant],[cooldown,setCooldown]=react.useState(variant==="rate_limited"?RATE_LIMIT_COOLDOWN_S:0);react.useEffect(()=>{variant==="rate_limited"&&setCooldown(RATE_LIMIT_COOLDOWN_S)},[variant]),react.useEffect(()=>{if(cooldown<=0)return;let handle=setTimeout(()=>setCooldown(n=>Math.max(0,n-1)),1e3);return()=>clearTimeout(handle)},[cooldown]);let cooling=variant==="rate_limited"&&cooldown>0,label=cooling?coolingActionLabel(cooldown):copy.action;/* @__PURE__ */
|
|
126
|
+
return jsxRuntime.jsxs("section",{role:"status",style:s.empty,"data-testid":testID,children:[
|
|
127
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{"aria-hidden":"true",style:s.emptyGlyph}),
|
|
128
|
+
/* @__PURE__ */jsxRuntime.jsx("h3",{style:s.emptyTitle,children:copy.title}),
|
|
129
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{style:s.emptyBody,children:message??copy.body}),label!==null&&onAction?/* @__PURE__ */jsxRuntime.jsx("button",{type:"button",onClick:onAction,disabled:cooling,"aria-label":cooling?COOLING_A11Y_LABEL:label,style:{...s.emptyAction,...cooling?s.emptyActionDisabled:{}},"data-testid":testID?`${testID}-action`:`records-empty-${variant}-action`,children:label}):null]})}function useStyles(){let theme=useEverfurTheme();return react.useMemo(()=>makeStyles2(theme),[theme])}function makeStyles2(theme){let{color:color,space:space,radius:radius,type:type}=theme,hairline=`1px solid ${color.brandBorder}`;return{dashboard:{display:"flex",flexDirection:"column",gap:space.lg,padding:`${space.xs}px ${space.sm}px 0`,backgroundColor:color.background},inset:{padding:`0 ${space.sm}px`},summaryCard:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.md+space.xs/2,borderRadius:radius.lg-space.xs,border:hairline,backgroundColor:color.surface,padding:`${space.lg+space.xs}px ${space.lg}px`},badges:{display:"flex",gap:space.md},carouselCard:{borderRadius:radius.lg-space.xs,border:hairline,backgroundColor:color.surface,padding:space.lg},dots:{display:"flex",alignItems:"center",justifyContent:"center",gap:space.xs+space.xs/2},centered:{display:"flex",justifyContent:"center"},actions:{display:"flex",flexDirection:"column",gap:space.sm+space.xs/2},actionRow:{display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:radius.md,border:hairline,backgroundColor:color.surface,padding:space.lg},actionLeft:{flex:1,display:"flex",alignItems:"center",gap:space.md},request:{display:"flex",flexDirection:"column",gap:space.lg+space.xs/2,padding:`${space.xs}px ${space.lg}px 0`},railRow:{display:"flex",alignItems:"flex-start",gap:space.md},railColumn:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.xs/2,width:24},railBody:{flex:1,display:"flex",flexDirection:"column",gap:space.xs+space.xs/2,paddingBottom:space.lg+space.xs/2},statusCard:{display:"flex",flexDirection:"column",gap:space.sm,borderRadius:radius.md,backgroundColor:color.brandSoft,padding:space.md+space.xs/2},timeline:{backgroundColor:color.background},timelineDisclaimer:{padding:`${space.xs}px ${space.lg}px ${space.md}px`},timelineRow:{display:"flex",gap:space.md,padding:`${space.md+space.xs/2}px ${space.lg}px`},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:space.xs-1},timelineTop:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.sm},timelineSeparator:{height:1,backgroundColor:color.brandBorder,marginLeft:TIMELINE_SEPARATOR_INSET},clinics:{display:"flex",flexDirection:"column",gap:space.md},clinicRow:{display:"flex",flexDirection:"column",gap:space.sm,borderRadius:radius.lg-space.xs/2,border:hairline,backgroundColor:color.surface,padding:`${space.md+space.xs/2}px`},shares:{display:"flex",flexDirection:"column",gap:space.md,padding:space.md,borderRadius:radius.md,backgroundColor:color.surfaceCream,border:hairline},shareRow:{display:"flex",flexDirection:"column",gap:space.xs+space.xs/2},empty:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.sm+space.xs/2,padding:`${space.xxl}px ${space.xl}px`,textAlign:"center"},emptyGlyph:{boxSizing:"border-box",width:22,height:22,borderRadius:11,backgroundColor:color.brandSoft,border:hairline,marginBottom:space.xs},emptyTitle:{margin:0,...faceCss(theme,"bold"),fontSize:type.size.subtitle,lineHeight:`${Math.round(type.size.subtitle*type.lineHeight.snug)-1}px`,color:color.brandInk},emptyBody:{margin:0,...faceCss(theme,"regular"),fontSize:type.size.bodyTight,lineHeight:`${Math.round(type.size.bodyTight*type.lineHeight.normal)}px`,color:color.text.muted,maxWidth:320},emptyAction:{boxSizing:"border-box",marginTop:space.sm,minHeight:40,borderRadius:radius.pill,padding:`0 ${space.lg+space.xs/2}px`,backgroundColor:color.brand,color:color.onPrimary,border:0,cursor:"pointer",...faceCss(theme,"bold"),fontSize:type.size.bodyTight},emptyActionDisabled:{opacity:.5,cursor:"default"}}}var SPINNER_DELAY_MS=300,MIN_SURFACE_HEIGHT2=120,MIN_TOUCH_TARGET2=44,readTimeline=(client,petRef)=>client.getTimeline(petRef),timelineEmpty=value=>value.isEmpty,readDepth=(client,petRef)=>client.getRecordDepth(petRef),depthEmpty=value=>!value.available||value.labResults.length+value.encounters.length+value.clinicianNotes.length+value.physicalExams.length===0,contributionsEmpty=value=>value.contributions.length===0;function EverfurRecordsTimeline({petRef:petRef,style:style,className:className,onBack:onBack}){let state=useRecordsDepthRead(petRef,readTimeline,timelineEmpty);/* @__PURE__ */
|
|
130
|
+
return jsxRuntime.jsx(DepthSurface,{state:state,style:style,className:className,onBack:onBack,header:/* @__PURE__ */jsxRuntime.jsx(ScreenHeader,{title:DEPTH_COPY.timeline,onBack:guardHost(onBack),testID:"timeline-header"}),loading:/* @__PURE__ */jsxRuntime.jsx(TimelineSkeleton,{testID:"timeline-loading"}),empty:/* @__PURE__ */jsxRuntime.jsx(RecordsEmptyState,{variant:"no_records",testID:"timeline-empty"}),render:timeline=>/* @__PURE__ */jsxRuntime.jsx(TimelineBody,{timeline:timeline})})}function EverfurRecordDepth({petRef:petRef,style:style,className:className,onBack:onBack}){let state=useRecordsDepthRead(petRef,readDepth,depthEmpty);/* @__PURE__ */
|
|
131
|
+
return jsxRuntime.jsx(DepthSurface,{state:state,style:style,className:className,onBack:onBack,header:onBack?/* @__PURE__ */jsxRuntime.jsx(ScreenHeader,{title:RECORDS_COPY.records,onBack:guardHost(onBack)}):null,render:depth=>/* @__PURE__ */jsxRuntime.jsx(DepthBody,{depth:depth})})}function EverfurDocumentContributions({petRef:petRef,docId:docId,style:style,className:className,onBack:onBack}){let read=react.useCallback((client,pet)=>client.getDocumentContributions(pet,docId),[docId]),state=useRecordsDepthRead(petRef,read,contributionsEmpty,docId),title=state.value?.document?.title?.trim()||DEPTH_COPY.uploadedDocument;/* @__PURE__ */
|
|
132
|
+
return jsxRuntime.jsx(DepthSurface,{state:state,style:style,className:className,onBack:onBack,header:/* @__PURE__ */jsxRuntime.jsx(ScreenHeader,{title:title,onBack:guardHost(onBack),testID:"contributions-header"}),empty:/* @__PURE__ */jsxRuntime.jsx(RecordsEmptyState,{variant:"no_records",testID:"contributions-empty"}),render:view=>/* @__PURE__ */jsxRuntime.jsx(ContributionsBody,{view:view})})}function DepthSurface({state:state,style:style,className:className,header:header,loading:loading,empty:empty,render:render,onBack:onBack}){let{styles:styles}=useDepthTheme(),{userRef:userRef}=useEverfurContext();/* @__PURE__ */
|
|
133
|
+
return jsxRuntime.jsx(CapabilityGate,{capability:"records",style:style,className:className,...recordsGateExit(guardHost(onBack),BACK_LABEL),children:/* @__PURE__ */jsxRuntime.jsxs("div",{className:className,style:{...styles.container,...style},children:[header??null,
|
|
134
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{style:styles.body,children:userRef===null?/* @__PURE__ */jsxRuntime.jsx("p",{role:"alert",style:styles.alertText,children:RECORDS_COPY.sessionRequired}):renderState(state,render,styles,loading,empty)}),
|
|
135
|
+
/* @__PURE__ */jsxRuntime.jsx(RecordsFootnote,{})]})})}function renderState(state,render,styles,loading,empty){switch(state.status){case"loading":return loading??/* @__PURE__ */jsxRuntime.jsx(LoadingState,{styles:styles});case"empty":return empty??/* @__PURE__ */jsxRuntime.jsx("div",{style:styles.centered,children:/* @__PURE__ */jsxRuntime.jsx("div",{role:"img","aria-label":RECORDS_COPY.empty,style:styles.emptyGlyph})});case"error":return state.error?/* @__PURE__ */jsxRuntime.jsx(RecordsEmptyState,{variant:recordsEmptyVariantForError(state.error),message:state.error.displayMessage,onAction:state.error.retryable?state.refresh:void 0,testID:"depth-error"}):null;case"populated":return state.value===null||state.value.withheld?null:render(state.value);default:return null}}function LoadingState({styles:styles}){let[visible,setVisible]=react.useState(false);return react.useEffect(()=>{let id=setTimeout(()=>setVisible(true),SPINNER_DELAY_MS);return()=>clearTimeout(id)},[]),/* @__PURE__ */jsxRuntime.jsx("div",{role:"status","aria-busy":"true","aria-label":RECORDS_COPY.loading,style:styles.centered,children:visible?/* @__PURE__ */jsxRuntime.jsx("div",{"aria-hidden":"true",style:styles.spinner}):null})}function TimelineBody({timeline:timeline}){let{styles:styles}=useDepthTheme(),rows=buildTimelineRows(timeline);/* @__PURE__ */
|
|
136
|
+
return jsxRuntime.jsxs("section",{"aria-label":DEPTH_COPY.timeline,style:styles.timelineList,children:[timeline.disclaimer.length>0?/* @__PURE__ */jsxRuntime.jsx("p",{role:"note","aria-label":DASHBOARD_COPY.important(timeline.disclaimer),style:styles.timelineBand,children:timeline.disclaimer}):null,
|
|
137
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{style:styles.plainList,children:rows.map((row,index)=>/* @__PURE__ */jsxRuntime.jsx("li",{style:index>0?styles.timelineSeparated:void 0,"data-testid":`records-timeline-row-${row.kind}`,children:/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.timelineRow,"aria-label":[row.kindLabel,row.date,row.title,row.detail].filter(Boolean).join(", "),children:[
|
|
138
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{"aria-hidden":"true",style:styles.timelineBubble}),
|
|
139
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.timelineBody,children:[
|
|
140
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.topLine,children:[
|
|
141
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.timelineKind,children:row.kindLabel}),
|
|
142
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.date,children:row.date})]}),
|
|
143
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.timelineTitle,children:row.title}),row.detail?/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowDetail,children:row.detail}):null]})]})},row.key))})]})}function DepthBody({depth:depth}){let{styles:styles}=useDepthTheme();/* @__PURE__ */
|
|
144
|
+
return jsxRuntime.jsxs("section",{"aria-label":RECORDS_COPY.records,style:styles.list,children:[depth.labResults.length>0?/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.section,children:[
|
|
145
|
+
/* @__PURE__ */jsxRuntime.jsx("h3",{style:styles.heading,children:`${DEPTH_COPY.labResults} (${depth.labResults.length})`}),
|
|
146
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{style:styles.card,children:depth.labResults.map(marker=>{let status=markerStatusLabel(marker.latest.status),detail=labDetailLine(marker.latest.at,marker.trajectory,marker.points.length);/* @__PURE__ */
|
|
147
|
+
return jsxRuntime.jsxs("li",{style:styles.row,children:[
|
|
148
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowTitle,children:marker.name}),
|
|
149
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowValue,children:formatMarkerReading(marker.latest.value,marker.latest.unit,marker.latest.qualitativeResult)}),detail?/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowDetail,children:detail}):null,
|
|
150
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:{...styles.chip,...status.outOfRange?styles.chipCritical:styles.chipNeutral},children:status.label}),marker.meaning?/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowDetail,children:marker.meaning}):null]},marker.markerId)})})]}):null,depth.encounters.length>0?/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.section,children:[
|
|
151
|
+
/* @__PURE__ */jsxRuntime.jsx("h3",{style:styles.heading,children:`${DEPTH_COPY.visits} (${depth.encounters.length})`}),
|
|
152
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{style:styles.card,children:depth.encounters.map(encounter=>{let detail=[encounter.date?formatRecordsDate(encounter.date):null,encounter.clinicName,encounter.veterinarian].filter(p=>p&&p!=="-").join(" · ");/* @__PURE__ */
|
|
153
|
+
return jsxRuntime.jsxs("li",{style:styles.row,children:[
|
|
154
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowTitle,children:encounter.type?humanize(encounter.type):DEPTH_COPY.visit}),detail?/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowDetail,children:detail}):null]},encounter.encounterId)})})]}):null,depth.physicalExams.length>0?/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.section,children:[
|
|
155
|
+
/* @__PURE__ */jsxRuntime.jsx("h3",{style:styles.heading,children:`${DEPTH_COPY.physicalExams} (${depth.physicalExams.length})`}),depth.physicalExams.map(exam=>/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.card,children:[
|
|
156
|
+
/* @__PURE__ */jsxRuntime.jsx("h4",{style:styles.rowTitle,children:exam.observedOn?formatRecordsDate(exam.observedOn):DEPTH_COPY.exam}),
|
|
157
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{style:styles.plainList,children:exam.systems.map(system=>{let abnormal=system.findingStatus==="abnormal",label=abnormal?DEPTH_COPY.abnormal:system.findingStatus==="not_examined"?DEPTH_COPY.notExamined:DEPTH_COPY.normal;/* @__PURE__ */
|
|
158
|
+
return jsxRuntime.jsxs("li",{style:styles.row,children:[
|
|
159
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowTitle,children:bodySystemLabel(system.system)}),abnormal&&system.finding?/* @__PURE__ */jsxRuntime.jsx("span",{style:styles.rowDetail,children:system.finding}):null,
|
|
160
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{style:{...styles.chip,...abnormal?styles.chipCaution:styles.chipNeutral},children:label})]},system.system)})})]},exam.examId))]}):null,depth.clinicianNotes.length>0?/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.section,children:[
|
|
161
|
+
/* @__PURE__ */jsxRuntime.jsx("h3",{style:styles.heading,children:`${DEPTH_COPY.visitNotes} (${depth.clinicianNotes.length})`}),depth.clinicianNotes.map(note=>/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.card,children:[
|
|
162
|
+
/* @__PURE__ */jsxRuntime.jsx("h4",{style:styles.rowTitle,children:note.observedOn?formatRecordsDate(note.observedOn):DEPTH_COPY.visitNote}),
|
|
163
|
+
/* @__PURE__ */jsxRuntime.jsx("dl",{style:styles.plainList,children:note.sections.map((section,index)=>/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.row,children:[
|
|
164
|
+
/* @__PURE__ */jsxRuntime.jsx("dt",{style:styles.kindLabel,children:soapSectionLabel(section.section)}),
|
|
165
|
+
/* @__PURE__ */jsxRuntime.jsx("dd",{style:section.text?styles.rowDetail:styles.rowMuted,children:section.text||DEPTH_COPY.notRecorded})]},`${section.section}:${index}`))})]},note.noteId))]}):null]})}function ContributionsBody({view:view}){let{styles:styles}=useDepthTheme();/* @__PURE__ */
|
|
166
|
+
return jsxRuntime.jsxs("section",{"aria-label":RECORDS_COPY.records,style:styles.list,children:[view.document?.receivedAt?/* @__PURE__ */jsxRuntime.jsx("p",{style:styles.rowDetail,children:formatRecordsDate(view.document.receivedAt)}):null,
|
|
167
|
+
/* @__PURE__ */jsxRuntime.jsx("dl",{style:styles.card,children:view.contributions.map(entity=>/* @__PURE__ */jsxRuntime.jsxs("div",{style:styles.row,children:[
|
|
168
|
+
/* @__PURE__ */jsxRuntime.jsx("dt",{style:styles.rowTitle,children:entity.label}),
|
|
169
|
+
/* @__PURE__ */jsxRuntime.jsx("dd",{style:styles.rowValue,children:formatEntityValue(entity.value,entity.unit)}),entity.observedAt?/* @__PURE__ */jsxRuntime.jsx("dd",{style:styles.rowDetail,children:formatRecordsDate(entity.observedAt)}):null]},entity.key))})]})}function useDepthTheme(){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles3(theme),[theme]);return{theme:theme,styles:styles}}function makeStyles3(theme){let{color:color,space:space,radius:radius,type:type,slots:slots}=theme,lh=(size,multiplier)=>`${Math.round(size*multiplier)}px`,text=(size,multiplier,fg,weight="regular")=>({margin:0,...faceCss(theme,weight),fontSize:size,lineHeight:lh(size,multiplier),color:fg}),cardText=slotText(slots.recordCard),inCard=(size,multiplier,fg,weight="regular")=>({...text(size,multiplier,fg,weight),...cardText}),hairline=`1px solid ${color.brandBorder}`,errorColor=theme.brightness==="dark"?color.errorRed:color.danger;return{container:{boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:MIN_SURFACE_HEIGHT2,height:"100%",backgroundColor:color.background,color:color.text.primary,...faceCss(theme,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},centered:{boxSizing:"border-box",flex:"1 1 auto",minHeight:MIN_SURFACE_HEIGHT2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:space.lg,padding:space.xl,textAlign:"center"},spinner:{boxSizing:"border-box",width:24,height:24,borderRadius:radius.pill,border:`3px solid ${color.brandSofter}`,borderTopColor:color.brandInk},emptyGlyph:{boxSizing:"border-box",width:40,height:40,borderRadius:radius.lg,backgroundColor:color.brandSoft,border:hairline},alertText:text(type.size.subtitle,type.lineHeight.snug,color.text.secondary),errorText:text(type.size.subtitle,type.lineHeight.snug,errorColor),primaryButton:{boxSizing:"border-box",minHeight:MIN_TOUCH_TARGET2,minWidth:MIN_TOUCH_TARGET2,padding:`${space.md}px ${space.xl}px`,borderRadius:radius.pill,...faceCss(theme,"bold"),fontSize:type.size.body,border:0,cursor:"pointer",backgroundColor:color.primary,color:color.onPrimary,...slotBoxCss(slots.primaryButton),...slotText(slots.primaryButton)},list:{display:"flex",flexDirection:"column",gap:space.md,padding:space.lg},section:{display:"flex",flexDirection:"column",gap:space.sm},heading:{...text(type.size.heading,type.lineHeight.snug,color.text.primary,"bold")},card:{boxSizing:"border-box",listStyle:"none",display:"flex",flexDirection:"column",gap:space.sm,margin:0,padding:space.md,borderRadius:radius.md,backgroundColor:color.surfaceCream,border:hairline,...slotBoxCss(slots.recordCard,1)},plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:space.sm},row:{display:"flex",flexDirection:"column",gap:space.xs,padding:`${space.xs}px 0`,borderBottom:`1px solid ${color.borderHairlineGreen}`},topLine:{display:"flex",justifyContent:"space-between",gap:space.md},kindLabel:{...inCard(type.size.caption,type.lineHeight.normal,color.text.muted,"medium")},date:inCard(type.size.caption,type.lineHeight.normal,color.text.muted),rowTitle:{...inCard(type.size.body,type.lineHeight.normal,color.text.primary,"bold")},rowValue:{...inCard(type.size.body,type.lineHeight.normal,color.text.primary,"medium")},rowDetail:inCard(type.size.bodyTight,type.lineHeight.normal,color.text.muted),rowMuted:{...inCard(type.size.bodyTight,type.lineHeight.normal,color.text.muted),opacity:.7},chip:{...text(type.size.caption,type.lineHeight.normal,color.text.primary),alignSelf:"flex-start",padding:`${space.xs}px ${space.sm}px`,borderRadius:radius.pill},chipNeutral:{backgroundColor:color.badgeBgNeutral},chipCaution:{backgroundColor:color.badgeBgCaution},chipCritical:{backgroundColor:color.badgeBgCritical},disclaimer:text(type.size.caption,type.lineHeight.normal,color.text.muted),timelineList:{display:"flex",flexDirection:"column",paddingBottom:space.xxl},timelineBand:{...text(type.size.caption,type.lineHeight.normal,color.text.secondary),borderRadius:radius.md-space.xs/2,padding:space.md,backgroundColor:color.brandSoft,margin:`${space.xs}px ${space.lg}px ${space.md}px`},timelineSeparated:{borderTop:`1px solid ${color.brandBorder}`,marginLeft:TIMELINE_SEPARATOR_INSET,paddingLeft:0},timelineRow:{display:"flex",gap:space.md,padding:`${space.md+space.xs/2}px ${space.lg}px`},timelineBubble:{boxSizing:"border-box",flexShrink:0,width:34,height:34,borderRadius:radius.pill,backgroundColor:color.brandSoft,border:hairline},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:space.xs-1,minWidth:0},timelineKind:{...faceCss(theme,"mono"),fontSize:type.size.micro,lineHeight:`${type.size.bodyTight}px`,letterSpacing:type.letterSpacing.eyebrow/3,textTransform:"uppercase",color:color.text.secondary},timelineTitle:{...text(type.size.body,type.lineHeight.normal,color.text.primary,"medium")}}}exports.EverfurDocumentContributions=EverfurDocumentContributions;exports.EverfurRecordDepth=EverfurRecordDepth;exports.EverfurRecordsTimeline=EverfurRecordsTimeline;exports.buildTimelineRows=buildTimelineRows;exports.mapDocumentContributions=mapDocumentContributions;exports.mapRecordDepth=mapRecordDepth;exports.mapRecordsTimeline=mapRecordsTimeline;exports.useEverfurRecordsDepthClient=useEverfurRecordsDepthClient;exports.useRecordsDepthRead=useRecordsDepthRead;
|