@everfur/sdk 1.5.0 → 1.5.2
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/dist/{bookingCopy.d-BuDv16WP.d.ts → bookingCopy.d-BL2-URcv.d.ts} +3 -2
- package/dist/{bookingCopy.d-rnBSqOSN.d.cts → bookingCopy.d-Dfew1pjY.d.cts} +3 -2
- package/dist/care/index.cjs +2 -2
- package/dist/care/index.js +2 -2
- package/dist/chat/index.cjs +235 -234
- package/dist/chat/index.js +311 -310
- package/dist/chat/lite/index.cjs +339 -338
- package/dist/chat/lite/index.js +314 -313
- package/dist/{chunk-4KFFE42Z.js → chunk-2T5CB5MW.js} +20 -20
- package/dist/{chunk-HHCGXQJR.js → chunk-ASE36WGP.js} +11 -11
- package/dist/{chunk-6IHY7HS7.js → chunk-CMDCBYUH.js} +1 -1
- package/dist/{chunk-BMYNDBUR.js → chunk-K7YHXFPQ.js} +1 -1
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +31 -31
- package/dist/core/index.js +31 -31
- package/dist/health-plan/index.cjs +266 -266
- package/dist/health-plan/index.js +443 -443
- package/dist/{inbox.d-DJ9xgU1Z.d.ts → inbox.d-B2JXK0uI.d.ts} +1 -1
- package/dist/{inbox.d-CPcMMz-Y.d.cts → inbox.d-CwA1ogzV.d.cts} +1 -1
- package/dist/index.cjs +257 -256
- package/dist/index.js +364 -363
- package/dist/{models.d-BULqCO2R.d.ts → models.d-NAWqF1wC.d.ts} +4 -1
- package/dist/{models.d-BKmOfoqV.d.cts → models.d-wJ_Ze4p5.d.cts} +4 -1
- package/dist/notifications/inbox/index.cjs +28 -28
- package/dist/notifications/inbox/index.d.cts +5 -5
- package/dist/notifications/inbox/index.d.ts +5 -5
- package/dist/notifications/inbox/index.js +53 -53
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.d.cts +3 -3
- package/dist/notifications/index.d.ts +3 -3
- package/dist/notifications/index.js +1 -1
- package/dist/{parse.d-Cj3fURer.d.ts → parse.d-QjB2LJCd.d.ts} +19 -10
- package/dist/{parse.d-cH7ZmMeo.d.cts → parse.d-_Ttu2h5g.d.cts} +19 -10
- package/dist/records/depth/index.cjs +80 -80
- package/dist/records/depth/index.js +115 -115
- package/dist/records/index.cjs +653 -653
- package/dist/records/index.js +1074 -1074
- package/dist/{route.d-DSYEd2MR.d.ts → route.d-DtuKY5dM.d.ts} +1 -1
- package/dist/{route.d-DCzQh4ix.d.cts → route.d-Nt-r-7IO.d.cts} +1 -1
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/shop/index.cjs +188 -188
- package/dist/shop/index.js +386 -386
- package/dist/shop/orders-v2/index.cjs +72 -72
- package/dist/shop/orders-v2/index.js +126 -126
- package/dist/tabs/index.cjs +114 -111
- package/dist/tabs/index.d.cts +19 -6
- package/dist/tabs/index.d.ts +19 -6
- package/dist/tabs/index.js +191 -188
- package/dist/televet/booking/index.cjs +214 -212
- package/dist/televet/booking/index.d.cts +2 -2
- package/dist/televet/booking/index.d.ts +2 -2
- package/dist/televet/booking/index.js +344 -342
- package/dist/televet/call/index.cjs +53 -53
- package/dist/televet/call/index.js +67 -67
- package/dist/{useInboxUnread.d-CXiaR3BZ.d.ts → useInboxUnread.d-0DrQPn7J.d.ts} +1 -1
- package/dist/{useInboxUnread.d-DERpMelw.d.cts → useInboxUnread.d-CRcOTkmu.d.cts} +1 -1
- package/dist/web/health-plan/index.cjs +1 -1
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/inbox/index.cjs +1 -1
- package/dist/web/inbox/index.d.cts +6 -6
- package/dist/web/inbox/index.d.ts +6 -6
- package/dist/web/inbox/index.js +1 -1
- package/dist/web/index.cjs +184 -184
- package/dist/web/index.js +181 -181
- package/dist/web/notifications/index.cjs +1 -1
- package/dist/web/notifications/index.d.cts +2 -2
- package/dist/web/notifications/index.d.ts +2 -2
- package/dist/web/notifications/index.js +1 -1
- package/dist/web/records-sheet/index.cjs +1 -1
- package/dist/web/records-sheet/index.js +1 -1
- package/dist/web/shop/index.cjs +1 -1
- package/dist/web/shop/index.js +2 -2
- package/dist/web/televet/booking/index.cjs +7 -8
- package/dist/web/televet/booking/index.d.cts +2 -2
- package/dist/web/televet/booking/index.d.ts +2 -2
- package/dist/web/televet/booking/index.js +7 -8
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +33 -33
- package/package.json +1 -1
|
@@ -1,120 +1,120 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
|
-
import{createContext,forwardRef as e,createElement as t,useMemo as r,useState as n,useRef as i,useCallback as a,useEffect as o,useContext as l,useSyncExternalStore as s,Component as d}from"react";import{TextInput as c,View as u,ActivityIndicator as p,ScrollView as f,StyleSheet as h,Pressable as b,Text as g,Image as m}from"react-native";import{jsx as y,jsxs as v,Fragment as _}from"react/jsx-runtime";import{z as w}from"zod";function C(e,t){if(e===void 0)return{};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}function x(e){return e?.textColor===void 0?{}:{color:e.textColor}}function k(e){return e.recordCard??e.card}var z=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[z[t]]}}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type;if(r===null&&n===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:n??e.type.weight[z[t]]};let i=face(e,t);return i.fontWeight===void 0||n===null?i:{fontFamily:i.fontFamily,fontWeight:n}}function S(e){return e<=450?"regular":e<=650?"medium":"bold"}var O={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=j.get(e);r===void 0&&(r=/* @__PURE__ */new Map,j.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=T(e,t);return r.set(t,i),i}var j=/* @__PURE__ */new WeakMap;function T(e,t){let r=e.type.roles[t],n=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,i=S(Number(n)),a=r.face==="mono"?face(e,O[i]):r.face==="heading"?headingFace(e,i):face(e,i),o=r.face==="heading"?e.type.headingWeight??n:n,l=a.fontWeight===void 0?a:{fontFamily:a.fontFamily,fontWeight:o},s=r.size,d={...l,fontSize:s,lineHeight:Math.round(s*r.lineHeight*100)/100};return r.letterSpacing!==0&&(d.letterSpacing=Math.round(s*r.letterSpacing*100)/100),r.uppercase&&(d.textTransform="uppercase"),/* @__PURE__ */Object.freeze(d)}function parseColor(e){let t=E(e);return t===null?null:H(t)}function E(e){if(typeof e=="number")return I(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return R(t.slice(1));if(t.toLowerCase().startsWith("0x"))return R(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return F(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=R(t);if(e!==null)return e}return/^\d+$/.test(t)?I(Number.parseInt(t,10)):null}function R(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:B(t[0]),g:B(t[1]),b:B(t[2]),a:1};if(t.length===6)return{r:D(t,0),g:D(t,2),b:D(t,4),a:1};if(t.length===8){let e=D(t,0);return{r:D(t,2),g:D(t,4),b:D(t,6),a:e/255}}return null}function F(e){let t=e.indexOf("("),r=e.indexOf(")");if(t<0||r<0||r<t)return null;let n=e.slice(t+1,r).split(",").map(e=>e.trim());if(n.length<3)return null;let i=L(Number(n[0])),a=L(Number(n[1])),o=L(Number(n[2]));if(i===null||a===null||o===null)return null;let l=1;if(n.length>=4){let e=Number(n[3]);if(!Number.isFinite(e))return null;l=Math.min(1,Math.max(0,e))}return{r:i,g:a,b:o,a:l}}function I(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,r=t>>>24&255;return{r:t>>>16&255,g:t>>>8&255,b:t&255,a:r===0?1:r/255}}function D(e,t){return Number.parseInt(e.slice(t,t+2),16)}function B(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function L(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function H(e){if(e.a>=1)return A(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function A(e,t,r){return`#${N(e)}${N(t)}${N(r)}`.toUpperCase()}function N(e){return e.toString(16).padStart(2,"0")}var P="#111111",M="#FFFFFF",$="#000000";function readableOn(e){let t=E(e);if(t===null)return M;let r=U(t),n=U({r:17,g:17,b:17}),i=U({r:255,g:255,b:255});return V(r,i)>=V(r,n)?M:P}function q(e,t){let r=readableOn(e);return contrastRatio(r,e)>=t?r:contrastRatio(M,e)>=contrastRatio($,e)?M:$}function W(e){let t=t=>e.reduce((e,r)=>Math.min(e,contrastRatio(t,r)),Number.POSITIVE_INFINITY);return t(M)>=t($)?M:$}function U(e){let t=G(e.r/255),r=G(e.g/255),n=G(e.b/255);return.2126*t+.7152*r+.0722*n}function G(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function V(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}function contrastRatio(e,t){let r=E(e),n=E(t);if(r===null||n===null)return 1;let i=n.a>=1?n:{...n},a=r.a>=1?r:K(r,i);return V(U(a),U(i))}function K(e,t){let r=e.a,n=(e,t)=>Math.round(e*r+t*(1-r));return{r:n(e.r,t.r),g:n(e.g,t.g),b:n(e.b,t.b),a:1}}function Y(e,t){let r=E(e),n=E(t);if(r===null||n===null)return null;let i=r.a>=1?r:K(r,{...n});return A(i.r,i.g,i.b)}function Q(e,t){let r=E(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return`rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}var X=.05;function Z(e,t,r,n){let i=t[0];if(i===void 0)return r;let a=e=>t.every(t=>contrastRatio(e,t)>=n);if(E(e)===null)return r;if(a(e))return e;let o=Y(e,i),l=o===null?null:E(o),s=E(r);if(l===null||s===null)return r;for(let e=1;e<1/X;e+=1){let t=e*X,r=(e,r)=>Math.round(e+(r-e)*t),n=A(r(l.r,s.r),r(l.g,s.g),r(l.b,s.b));if(a(n))return n}return r}var J=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var ee=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){ee(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var te=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var re={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},ne={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},ie={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},ae={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},oe={regular:"400",medium:"500",bold:"700"},le={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},se=0,de="System",ce="monospace",ue=["content","heading","control","compact","badge"];function pe(e){let t={};for(let r of ue)t[r]=e;return t}var fe=[];function he(){return{family:de,mono:ce,fontUrl:null,families:{regular:de,medium:de,bold:de,mono:ce,monoMedium:ce,monoBold:ce},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:ie,tierSizes:pe(ie),lineHeight:ae,weight:oe,letterSpacing:le,scale:1,maxScale:se,scaleCaps:te,headingFamily:null,headingWeight:null,fontSources:fe,roles:J,typeScale:1}}var be={},ge=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var me={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(ge.standard),emphasized:cssCubicBezier(ge.emphasized),exit:cssCubicBezier(ge.exit)},reducedMotion:false},ye={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},ve=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:ye,space:re,radius:ne,type:he(),motion:me,slots:be}),_e={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"},we=deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:_e,space:re,radius:ne,type:he(),motion:me,slots:be});var Ce=/* @__PURE__ */Object.freeze({ink:"#262523",ink2:"#4A4845",ink3:"#6B6863",paper:"#F8F7F4",card:"#FFFFFF",line:"#E7E6E2",tile:"#F2F1EE",shadow:"rgba(38, 37, 35, .07)",riskBg:"#FFE3E1",riskInk:"#B0231B",riskDot:"#E5372B",clearBg:"#E6F4D3",clearInk:"#2F6A12",clearDot:"#5FA82B",watchDot:"#E5A000"}),xe=/* @__PURE__ */new WeakMap;function ke(e){let t=xe.get(e);if(t!==void 0)return t;let r=e.color,n=e.brightness==="dark",i=n?{dark:n,ink:r.text.primary,ink2:r.text.secondary,ink3:r.text.muted,paper:r.background,card:r.surface,line:r.borderRingCream,tile:r.surfaceSubtle,shadow:r.shadow,riskBg:r.badgeBgCritical,riskInk:r.danger,riskDot:r.danger,clearBg:r.badgeBgPositive,clearInk:r.success,clearDot:r.success,watchDot:r.warningStrong}:{dark:n,...Ce},a=(e,t)=>Z(e,t,W(t),ze),o=(e,t)=>contrastRatio(e,t)>=ze?e:q(t,ze),l=[i.card,i.paper].map(e=>Y(r.brandSoft,e)??e),s={primary:r.primary,onPrimary:o(r.onPrimary,r.primary),accent:r.accent,onAccent:o(r.onAccent,r.accent),link:a(r.linkInk,[i.card,i.paper,i.tile]),badge:r.brandSoft,onBadge:a(r.brandInk,l)},d=/* @__PURE__ */Object.freeze({...i,...s});return xe.set(e,d),d}var ze=4.5;function Se(e,t){for(let r of t)if(contrastRatio(r,e)>=ze)return r;return q(e,ze)}var Oe=/* @__PURE__ */Object.freeze({ink:"#10462E",go:"#07C168",muted:"#6B6B6B",line:"#E4E4E4",alert:"#C03410",alertDeep:"#6D1D14",tintSage:"#E6ECE8",tintBlue:"#EAEEF6",tintYellow:"#FCF0D6",tintRed:"#FBF1EE",tintGo:"#DCF6EA",icoSage:"#819E90",efWhite:"#FFFFFF",efBlack:"#000000",efCharcoal:"#3D3D3D",efSkyBlue:"#4E98C9",embCyan1:"#E0FDFF",bgMist:"#F1F5F2",paper:"#F8F7F4",embB1:"#FFCE34",embB2:"#5CC8F2",embB3:"#FF6665",embB4:"#A55BD8",embRiskDot:"#E5372B",embRiskInk:"#B0231B",embClearDot:"#5FA82B",embInk2:"#4A4845",embInk3:"#6B6863",embTealInk:"#00707C",embYellow:"#FFCE34",watch:"#F9E6B9",barTrack:"#ECECEC",topCard:"#FFCE34",topKicker:"#4A4845",topInk:"#262523",plainEdge:"rgba(16, 70, 46, 0.2)"}),je=/* @__PURE__ */Object.freeze({".rec-note":/* @__PURE__ */Object.freeze({fontSize:12.5}),".efh":/* @__PURE__ */Object.freeze({gap:12,fontSize:15}),".efh-sheet":/* @__PURE__ */Object.freeze({marginTop:20,paddingTop:20,paddingBottom:28,paddingLeft:16,borderTopLeftRadius:28}),".efh-ico":/* @__PURE__ */Object.freeze({width:22}),".efh-label":/* @__PURE__ */Object.freeze({fontSize:12}),".efh-pill":/* @__PURE__ */Object.freeze({minHeight:24,paddingLeft:10,fontSize:12,letterSpacing:.72}),".efh-card":/* @__PURE__ */Object.freeze({paddingTop:16,borderRadius:20}),".efh-card__title":/* @__PURE__ */Object.freeze({fontSize:18}),".efh-btn":/* @__PURE__ */Object.freeze({minHeight:48,paddingLeft:20,fontSize:16}),".efh-btn--row":/* @__PURE__ */Object.freeze({minHeight:40,paddingLeft:16,fontSize:15}),".efh-head":/* @__PURE__ */Object.freeze({marginBottom:8}),".efh-name":/* @__PURE__ */Object.freeze({fontSize:22}),".efh-meta":/* @__PURE__ */Object.freeze({fontSize:13}),".efh-stage":/* @__PURE__ */Object.freeze({height:236,marginTop:4,marginLeft:-16}),".efh-stage__grass":/* @__PURE__ */Object.freeze({height:"44%"}),".efh-stage__pet":/* @__PURE__ */Object.freeze({left:"58%",bottom:22,height:"86%"}),".efh-stage .efh-vitals":/* @__PURE__ */Object.freeze({top:14,left:16,gap:12}),".efh-head__from":/* @__PURE__ */Object.freeze({marginTop:12}),".efh-due":/* @__PURE__ */Object.freeze({marginLeft:-12}),".efh-due li":/* @__PURE__ */Object.freeze({gap:12,paddingTop:12,paddingLeft:12,borderRadius:10}),".efh-due__title":/* @__PURE__ */Object.freeze({fontSize:17,lineHeight:22.1}),".efh-sec":/* @__PURE__ */Object.freeze({marginTop:8,marginBottom:12}),".efh-tiles":/* @__PURE__ */Object.freeze({gap:10}),".efh-tile":/* @__PURE__ */Object.freeze({gap:8,paddingTop:16,borderRadius:20}),".efh-tile__title":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:18.75,letterSpacing:-.15}),".efh-tile__foot":/* @__PURE__ */Object.freeze({gap:8,minHeight:28}),".efh-tile__foot .efh-pill":/* @__PURE__ */Object.freeze({minHeight:22,paddingLeft:7,fontSize:10.5,letterSpacing:.21}),".efh-tile__foot:has(.efh-pill + .efh-pill)":/* @__PURE__ */Object.freeze({gap:6}),".efh-tile__num":/* @__PURE__ */Object.freeze({fontSize:20,lineHeight:20,letterSpacing:-.4}),".efh-wt":/* @__PURE__ */Object.freeze({gap:8}),".efh-wt b":/* @__PURE__ */Object.freeze({fontSize:32,lineHeight:32,letterSpacing:-.64}),".efh-emb":/* @__PURE__ */Object.freeze({gap:8,marginTop:12,fontSize:15,lineHeight:19.5}),".efh-wchart":/* @__PURE__ */Object.freeze({marginTop:20}),".efh-wchart__plot":/* @__PURE__ */Object.freeze({height:148}),".efh-wkey":/* @__PURE__ */Object.freeze({rowGap:4,columnGap:16,marginTop:12,fontSize:13,lineHeight:18.2}),".efh-wkey span":/* @__PURE__ */Object.freeze({gap:6}),".efh-key":/* @__PURE__ */Object.freeze({rowGap:8,columnGap:16,fontSize:13,lineHeight:18.2}),".efh-key span":/* @__PURE__ */Object.freeze({gap:6}),".efh-key span::before":/* @__PURE__ */Object.freeze({width:10}),".efh-tl__dot":/* @__PURE__ */Object.freeze({width:16,marginTop:3}),".efh-tl__year":/* @__PURE__ */Object.freeze({marginTop:20,marginBottom:12,marginLeft:40}),".efh-tl .efh-tl__year":/* @__PURE__ */Object.freeze({marginTop:4}),".efh-tl__item":/* @__PURE__ */Object.freeze({gap:16,paddingBottom:24}),".efh-tl__item::before":/* @__PURE__ */Object.freeze({left:11,top:22,bottom:-2}),".efh-tl__date":/* @__PURE__ */Object.freeze({fontSize:12,lineHeight:16.8,letterSpacing:.48}),".efh-tl__title":/* @__PURE__ */Object.freeze({marginTop:2,fontSize:17,lineHeight:22.1}),".efh-tl__text":/* @__PURE__ */Object.freeze({marginTop:2,lineHeight:22.5}),".efh-add":/* @__PURE__ */Object.freeze({gap:12}),".efh-add > p":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:22.5}),".efh-sheet .rec-note":/* @__PURE__ */Object.freeze({marginTop:4}),".efh-lab":/* @__PURE__ */Object.freeze({paddingTop:8,paddingBottom:96,paddingLeft:16}),".efh-titles":/* @__PURE__ */Object.freeze({gap:2,paddingTop:4}),".efh-title":/* @__PURE__ */Object.freeze({fontSize:22}),".efh-smeta":/* @__PURE__ */Object.freeze({fontSize:13}),".efh-mk__name":/* @__PURE__ */Object.freeze({fontSize:17}),".efh-mk__line":/* @__PURE__ */Object.freeze({rowGap:0,columnGap:6,marginTop:1,fontSize:13,lineHeight:18.2}),".efh-mk__line b":/* @__PURE__ */Object.freeze({fontSize:17}),".efh-none":/* @__PURE__ */Object.freeze({paddingTop:0}),".efh-none__scene":/* @__PURE__ */Object.freeze({marginBottom:16,marginLeft:-16}),".efh-none__t":/* @__PURE__ */Object.freeze({fontSize:22,lineHeight:25.3,letterSpacing:-.44}),".efh-none__lead":/* @__PURE__ */Object.freeze({marginTop:8,fontSize:15,lineHeight:22.5}),".efh-ways":/* @__PURE__ */Object.freeze({gap:12,marginTop:16}),".efh-way":/* @__PURE__ */Object.freeze({columnGap:12,paddingTop:16,borderRadius:20}),".efh-way__w":/* @__PURE__ */Object.freeze({gap:2}),".efh-way__t":/* @__PURE__ */Object.freeze({fontSize:16,lineHeight:20.8}),".efh-way__x":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:21.75}),".efh-peek__labs .efh-card__title":/* @__PURE__ */Object.freeze({marginBottom:8}),".efh-peek__g":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:21.75,marginBottom:6}),".efh-peek__g b":/* @__PURE__ */Object.freeze({fontSize:16}),".dot":/* @__PURE__ */Object.freeze({width:9}),".rec-top":/* @__PURE__ */Object.freeze({gap:8,paddingTop:16,paddingRight:18,paddingBottom:18,paddingLeft:18,borderRadius:22}),".rec-top__k":/* @__PURE__ */Object.freeze({gap:7,fontSize:10.5,letterSpacing:.63}),".rec-top .emb-btn":/* @__PURE__ */Object.freeze({marginTop:4}),".mixbar":/* @__PURE__ */Object.freeze({gap:2,height:10}),".mixlegend":/* @__PURE__ */Object.freeze({rowGap:6,columnGap:14,marginTop:12,fontSize:13.5}),".mixlegend li":/* @__PURE__ */Object.freeze({gap:7}),".mixlegend i":/* @__PURE__ */Object.freeze({width:9}),".mixlegend b":/* @__PURE__ */Object.freeze({fontSize:12}),".askbar":/* @__PURE__ */Object.freeze({gap:6,height:52,paddingRight:6,paddingLeft:8,borderWidth:1.5}),".askbar input":/* @__PURE__ */Object.freeze({fontSize:16}),".askbar__add":/* @__PURE__ */Object.freeze({width:38}),".askbar__add svg":/* @__PURE__ */Object.freeze({width:22}),".askbar__send":/* @__PURE__ */Object.freeze({width:40}),".askbar__send svg":/* @__PURE__ */Object.freeze({width:20}),".ph-head":/* @__PURE__ */Object.freeze({height:58,paddingLeft:14}),".ph-back":/* @__PURE__ */Object.freeze({width:44,marginLeft:-6}),".ph-back svg":/* @__PURE__ */Object.freeze({width:26}),".ph-title":/* @__PURE__ */Object.freeze({fontSize:17}),".emb-card":/* @__PURE__ */Object.freeze({borderRadius:22}),".emb-tile":/* @__PURE__ */Object.freeze({width:46,height:46,borderRadius:13}),".ask-pill":/* @__PURE__ */Object.freeze({right:16,bottom:16,gap:8,minHeight:48,paddingRight:18,paddingLeft:14,fontSize:15.5}),".ask-pill svg":/* @__PURE__ */Object.freeze({width:22}),".ph-askbar":/* @__PURE__ */Object.freeze({paddingTop:10,paddingRight:14,paddingBottom:10,paddingLeft:14}),".rec":/* @__PURE__ */Object.freeze({paddingTop:18,paddingLeft:16}),".rec-dna":/* @__PURE__ */Object.freeze({paddingTop:16,marginTop:16}),".rec-dna__top":/* @__PURE__ */Object.freeze({gap:12,marginBottom:14}),".rec-dna__top h3":/* @__PURE__ */Object.freeze({fontSize:17}),".rec-dna__top p":/* @__PURE__ */Object.freeze({fontSize:10.5,letterSpacing:.53,marginTop:2}),".rec-dna__risk":/* @__PURE__ */Object.freeze({gap:10,marginTop:14,paddingTop:12,paddingRight:12,paddingBottom:12,paddingLeft:14,borderRadius:14}),".rec-dna__risk small":/* @__PURE__ */Object.freeze({fontSize:13}),".rec-dna__risk strong":/* @__PURE__ */Object.freeze({marginTop:1,fontSize:16,lineHeight:20}),".rec-dna__clear":/* @__PURE__ */Object.freeze({gap:7,minHeight:36,marginTop:4,paddingLeft:4,fontSize:14}),".rec-dna__clear .dot":/* @__PURE__ */Object.freeze({width:7})});var Te=je;function Ee(e,t){let r=Te[e]?.[t];return typeof r=="number"?r:Number.NaN}var Re=Ee;var Fe=/* @__PURE__ */Object.freeze({gap:Re(".efh","gap"),sheetPadTop:Re(".efh-sheet","paddingTop"),sheetPadX:Re(".efh-sheet","paddingLeft"),sheetPadBottom:Re(".efh-sheet","paddingBottom"),sheetRadius:Re(".efh-sheet","borderTopLeftRadius"),sheetGap:Re(".efh-sheet","marginTop"),cardPad:Re(".efh-card","paddingTop"),cardRadius:Re(".efh-card","borderRadius"),name:Re(".efh-name","fontSize"),cardTitle:Re(".efh-card__title","fontSize"),rowTitle:Re(".efh-mk__name","fontSize"),body:Re(".efh","fontSize"),small:Re(".efh-meta","fontSize"),mono:Re(".efh-label","fontSize"),tileNum:Re(".efh-tile__num","fontSize"),big:Re(".efh-wt b","fontSize"),button:Re(".efh-btn","minHeight"),rowButton:Re(".efh-btn--row","minHeight"),pill:Re(".efh-pill","minHeight"),plot:Re(".efh-wchart__plot","height"),rowRadius:Re(".efh-due li","borderRadius"),tileGap:Re(".efh-tiles","gap"),icon:Re(".efh-ico","width")});function Ie(e,t){return e.trim().toLowerCase()===t.trim().toLowerCase()}function De(e,t,r){let n=Q(e,r);return(n!==null?Y(n,t):null)??t}var Be=(e,t)=>parseColor(e)===parseColor(t);function Le(e){if(e.brightness!=="light")return false;let t=e.color,r=ve.color;return Be(t.primary,r.primary)&&Be(t.brandInk,r.brandInk)&&Be(t.onPrimary,r.onPrimary)&&Be(t.accent,r.accent)&&Be(t.accentEdge,r.accentEdge)}function He(e){let t=e.color,r=Oe,n=ke(e),i=e.brightness==="dark",a=Le(e),o=(i?we:ve).color,l=!Be(t.accent,o.accent),s=i?t.surface:r.efWhite,d=(e,t)=>De(e,s,i?.18:t),c=a?r.tintSage:d(n.primary,.105),u=a?r.topCard:l?n.accent:c;return{tintSage:c,chevron:a?r.icoSage:De(t.brandInk,s,.527),rowGround:a?r.bgMist:d(n.primary,.059),tintPartner:l?d(n.accent,.14):r.embCyan1,topFill:u,plainEdge:a?r.plainEdge:Q(t.brandInk,.2)??t.structureEdge,topKicker:Se(u,[l?n.onAccent:i?n.ink3:r.topKicker,r.topInk]),topInk:Se(u,[l?n.onAccent:i?n.ink:r.topInk,r.topInk])}}function recordsSheetLook(e){let t=e.color,r=Oe,n=ke(e),i=He(e),a=Le(e)?r.go:Ie(t.accent,t.primary)?t.onPrimary:t.accent;return e.brightness==="dark"?/* @__PURE__ */Object.freeze({dark:true,paper:n.paper,ground:t.background,card:n.card,text:n.ink,muted:n.ink3,line:t.structureEdge,ink:t.brandInk,fill:n.primary,onFill:n.onPrimary,accentOnFill:a,accent:n.accent,go:t.success,goTint:t.badgeBgPositive,alert:n.riskInk,alertDeep:n.riskInk,alertTint:t.badgeBgCritical,watch:t.badgeBgCaution,wind:r.efSkyBlue,tintBlue:t.surfaceSubtle,tintYellow:t.surfaceSubtle,barTrack:t.structureEdge,...i}):/* @__PURE__ */Object.freeze({dark:false,paper:n.paper,ground:r.efWhite,card:r.efWhite,text:r.efBlack,muted:r.muted,line:r.line,ink:t.brandInk,fill:n.primary,onFill:n.onPrimary,accentOnFill:a,accent:n.accent,go:r.go,goTint:r.tintGo,alert:r.alert,alertDeep:r.alertDeep,alertTint:r.tintRed,watch:r.watch,wind:r.efSkyBlue,tintBlue:r.tintBlue,tintYellow:r.tintYellow,barTrack:r.barTrack,...i})}var Ae=createContext("sheet");Ae.Provider;function Ne(){return l(Ae)}function Pe(e,t={}){return{padding:e.cardPad,gap:12,...t,...e.card}}function Me(e,t){let r={...e};for(let n of Object.keys(t)){let i=t[n];i!==void 0&&(r[n]={...e[n],...i})}return r}var $e=/* @__PURE__ */new WeakMap;function qe(e){let t=$e.get(e);if(t!==void 0)return t;let r=recordsSheetLook(e),n=k(e.slots),i=face(e,"bold"),a={...i,fontSize:16,lineHeight:20},o=/* @__PURE__ */Object.freeze({look:r,ground:r.ground,card:{backgroundColor:r.card,borderRadius:e.radius.lg,borderWidth:r.dark?1:0,borderColor:r.line,shadowColor:"#000000",shadowOpacity:r.dark?0:.09,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:r.dark?0:1,...C(n,1)},cardPad:Fe.cardPad,cardTitle:{...i,fontSize:Fe.cardTitle,lineHeight:Math.round(Fe.cardTitle*1.25*100)/100,letterSpacing:-.36,color:r.ink,...x(n)},body:{...face(e,"regular"),fontSize:15,lineHeight:21,color:r.ink,...x(n)},title:{...face(e,"medium"),fontSize:Fe.name,lineHeight:Math.round(Fe.name*1.2*100)/100,letterSpacing:-.33,color:r.ink},button:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,minHeight:Fe.button,paddingHorizontal:20,borderRadius:999},buttonInk:{backgroundColor:r.fill,borderWidth:0,...C(e.slots.primaryButton)},buttonInkLabel:{...a,color:r.onFill,...x(e.slots.primaryButton)},buttonOutline:{backgroundColor:"transparent",borderWidth:1.5,borderColor:r.ink},buttonOutlineLabel:{...a,color:r.ink},askPill:{backgroundColor:Oe.embYellow,borderWidth:0,paddingLeft:Ee(".ask-pill","paddingLeft"),paddingRight:Ee(".ask-pill","paddingRight")},askPillLabel:{...i,fontSize:Ee(".ask-pill","fontSize"),lineHeight:Ee(".ask-pill","fontSize")*1.2,color:Oe.topInk}});return $e.set(e,o),o}var We=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Ue=globalThis,Ge=Ue[We]??(Ue[We]=createContext(ve));Ge.displayName??="EverfurThemeContext";function useEverfurTheme(){return l(Ge)}function Ve(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:e,variant:r,...n}){let i=useEverfurTheme(),a=r===void 0?void 0:i.type.roles[r],o=Ve(i.type,e??a?.tier??"content"),l=r===void 0?n:{...n,style:[{...textRole(i,r),color:i.color.text.primary,flexShrink:1},n.style]};return t(g,o===void 0?l:{maxFontSizeMultiplier:o,...l})}e(function(e,r){return t(c,{...e,...r===null?{}:{ref:r}})});var Ke="your pet";function Ye(e){let t=e?.trim()??"";return t.length>0?t:Ke}var Qe=/* @__PURE__ */Object.freeze({title:"Health records",titleWeb:e=>{let t=e?.trim()??"";return t.length>0?`${t}’s Records`:"Health records"},titleNative:e=>{let t=e?.trim()??"";return t.length>0?t:"Health records"},openTimeline:"Open timeline",loading:"Loading health records",lead:e=>`${Ye(e)}’s lab trends`,retryMarkers:"Retry loading lab trends",viewFullRecord:"View full medical record",viewTimeline:"View full timeline",important:e=>`Important: ${e}`});var Xe=/* @__PURE__ */Object.freeze({pressScale:.97,pressMs:160,riseWebPx:16,riseNativePx:14,fadeMs:320,moveMs:480,staggerMs:55,maxSteps:8});var Ze=/* @__PURE__ */Object.freeze({loading:"Loading",empty:"No records yet",upload:"Upload records",consentRequired:"Consent required",allow:"Allow",allPetsConsent:"This covers all your pets. You can withdraw it at any time.",sessionRequired:"Sign in required",recordUnavailable:"Record unavailable",retry:"Try again",records:"Records",beingReviewed:"being reviewed"}),Je="Everfur summarizes what your vet recorded. It is informational, not diagnostic.";function et(e){let t=(e.brightness==="dark"?we:ve).color,r=e.color,n=(e,t)=>parseColor(e)===parseColor(t);return{success:!n(r.success,t.success),warning:!n(r.warningStrong,t.warningStrong)||!n(r.cautionAccent,t.cautionAccent),info:!(n(r.info,r.brandInk)&&n(r.badgeBgInfo,r.brandSoft)&&n(r.infoEdge,r.structureEdge))}}var tt=4.5;function rt(e){if(!et(e).success)return null;let t=[e.color.surface];return Z(e.color.success,t,W(t),tt)}var nt=52;function it(){let e=useEverfurTheme(),t=at();return r(()=>ot(e,t),[e,t])}function at(){let e=useEverfurTheme();return Ne()==="sheet"?qe(e):null}function ot(e,t=null){let{color:r,space:n,radius:i,type:a,slots:o}=e,{size:l,lineHeight:s}=a,d=(e,t)=>Math.round(e*t),c=h.hairlineWidth,u=n.xxl+n.md,p=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:d(t,r),color:n}),f=k(o),b=x(f),g=x(o.banner),m=o.banner?.textColor,y=e.brightness==="dark"?r.errorRed:r.danger,v=(e,t)=>({bg:{backgroundColor:e,borderColor:"transparent"},fg:{color:t}}),_=(e,t)=>({bg:{backgroundColor:r.surface,borderColor:e},fg:{color:t}});return{chipTones:{neutral:_(r.brandBorderStrong,r.text.primary),info:v(r.brandSoft,r.brandInk),warning:_(r.cautionAccent,r.text.primary),critical:_(r.danger,r.danger),positive:_(r.success,rt(e)??r.brandInk)},...h.create({root:{flex:1,backgroundColor:r.background},body:{flex:1},content:{paddingHorizontal:n.lg,paddingBottom:n.xxl,gap:n.lg},contentTight:{paddingHorizontal:n.sm,paddingBottom:n.xxl,gap:n.lg},inset:{paddingHorizontal:n.sm},section:{gap:n.sm+n.xs/2},sectionHeader:{flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.xs},sectionTitle:{...p(l.subtitle,s.snug,r.text.primary,"bold"),...headingFace(e,"bold"),letterSpacing:-.4},sectionCount:{...p(l.bodyTight,s.snug,r.text.muted,"medium")},card:{borderRadius:i.lg,borderWidth:1,borderColor:r.borderRingCream,backgroundColor:r.surface,paddingHorizontal:n.lg,paddingVertical:n.xs,...C(f,c)},creamCard:{borderRadius:i.lg,borderWidth:1,borderColor:r.borderRingCream,backgroundColor:r.surfaceCream,padding:n.lg,gap:n.md,...C(f,c)},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.md,paddingVertical:n.md},rowDivider:{borderTopWidth:c,borderTopColor:r.borderHairlineGreen},rowMain:{flex:1},rowRight:{alignItems:"flex-end",gap:n.xs+n.xs/2},rowTitle:{...p(l.body,s.snug,r.text.primary,"medium"),...b},rowDetail:{...p(l.caption,s.normal,r.text.secondary),marginTop:n.xs/2,...b},rowValue:{...p(l.body+1,s.snug,r.text.primary,"bold"),marginTop:n.xs/2,...b},rowMuted:{...p(l.caption,s.normal,r.text.muted),...b},chip:{minHeight:24,justifyContent:"center",borderRadius:i.pill,borderWidth:1.5,paddingHorizontal:n.sm+n.xs/2,alignSelf:"flex-start"},chipText:{...p(l.tiny+1,s.snug,r.text.primary,"monoBold"),letterSpacing:.7,textTransform:"uppercase"},chipSentence:{borderRadius:i.md,paddingVertical:n.xs,alignSelf:"stretch"},chipSentenceText:{...p(l.caption,s.normal,r.text.primary,"medium"),letterSpacing:0,textTransform:"none"},pill:{minHeight:nt,borderRadius:i.pill,paddingHorizontal:n.lg+n.xs/2,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:n.sm},pillPrimary:{backgroundColor:r.brand,...C(o.primaryButton)},pillPrimaryLabel:{...p(l.body,s.snug,r.onPrimary,"bold"),...x(o.primaryButton)},pillOutline:{borderWidth:1.5,borderColor:r.brandInk,backgroundColor:"transparent"},pillOutlineLabel:{...p(l.body,s.snug,r.brandInk,"bold")},pillDanger:{borderWidth:1.4,borderColor:r.danger,backgroundColor:r.surface},pillDangerLabel:{...p(l.bodyTight,s.snug,r.danger,"bold")},pillAsk:{borderWidth:c,borderColor:r.borderRingCream,backgroundColor:r.surface},pillAskLabel:{...p(l.body,s.snug,r.text.primary,"bold")},pillLink:{minHeight:u,backgroundColor:"transparent",paddingHorizontal:n.sm},pillLinkLabel:{...p(l.body,s.snug,r.linkInk,"bold")},pillDisabled:{opacity:.5},pressed:{transform:[{scale:Xe.pressScale}]},infoNote:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,borderRadius:i.md-n.xs/2,backgroundColor:r.brandSoft,paddingHorizontal:n.md,paddingVertical:n.sm+n.xs/2,...C(o.banner)},infoNoteText:{flex:1,...p(l.bodyTight,s.normal,r.text.primary),...g},cautionNote:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,borderRadius:i.md-n.xs/2,backgroundColor:r.badgeBgCaution,paddingHorizontal:n.md,paddingVertical:n.sm+n.xs/2},cautionNoteText:{flex:1,...p(l.bodyTight,s.normal,r.warningStrong)},statusCard:{borderRadius:i.md,backgroundColor:r.brandSoft,padding:n.md+n.xs/2},statusText:p(l.bodyTight,s.relaxed,r.text.primary),errorBanner:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,borderRadius:i.md-n.xs/2,backgroundColor:r.badgeBgCritical,padding:n.md},errorText:{flex:1,...p(l.bodyTight,s.normal,y)},band:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,borderRadius:i.md-n.xs/2,padding:n.md,backgroundColor:r.brandSoft,...C(o.banner)},bandText:{flex:1,...p(l.caption,s.normal,r.text.secondary),...g},infoGlyph:{width:n.md+n.xs/2,height:n.md+n.xs/2,borderRadius:i.pill,borderWidth:1,borderColor:m??r.text.secondary,alignItems:"center",justifyContent:"center"},infoGlyphText:{...p(l.small,s.tight,r.text.secondary,"bold"),...g},chevron:{width:n.sm,height:n.sm,borderTopWidth:n.xs/2,borderRightWidth:n.xs/2,borderColor:r.text.muted},lead:{paddingHorizontal:n.sm,...p(l.body+1,s.snug,r.text.primary,"bold")},field:{minHeight:u,paddingHorizontal:n.md,paddingVertical:n.sm,borderWidth:1,borderColor:r.borderHairlineGreen,borderRadius:i.sm,color:r.text.primary,backgroundColor:r.surface,...face(e,"regular"),fontSize:l.body,...C(o.input,1),...x(o.input)},fieldLabel:{...p(l.bodyTight,s.normal,r.text.secondary,"medium")},muted:p(l.caption,s.normal,r.text.muted),bodyText:p(l.body,s.normal,r.text.primary)}),...t!==null?lt(t):{}}}function lt(e){return h.create({root:{flex:1,backgroundColor:e.ground},sectionTitle:e.cardTitle,card:{...e.card,paddingHorizontal:e.cardPad,paddingVertical:e.cardPad/4},creamCard:{...e.card,padding:e.cardPad,gap:12},pill:e.button,pillPrimary:e.buttonInk,pillPrimaryLabel:e.buttonInkLabel,pillOutline:e.buttonOutline,pillOutlineLabel:e.buttonOutlineLabel,pillAsk:e.askPill,pillAskLabel:e.askPillLabel,lead:{paddingHorizontal:8,...e.cardTitle}})}function st(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function dt(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function ct(e,...t){if(typeof e=="function")try{let r=e(...t);return dt(r)&&Promise.resolve(r).then(void 0,st),r}catch(e){st(e);return}}var ut=/* @__PURE__ */new WeakMap;function pt(e){if(typeof e!="function")return;let t=ut.get(e);if(t!==void 0)return t;let r=(...t)=>{ct(e,...t)};return ut.set(e,r),r}function ft(e){return e?.httpStatus===429?"rate_limited":e?.httpStatus===502?"service_unavailable":"error"}function ht(e,t){return e===null?"":t?`${e} ${t}`:e}var bt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function gt(e){if(!e)return"-";let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(t!==null)return mt(Number(t[1]),Number(t[2])-1,Number(t[3]));let r=Date.parse(e);if(Number.isNaN(r))return"-";let n=new Date(r);return mt(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate())}function mt(e,t,r){let n=bt[t];return n===void 0?"-":`${n} ${r}, ${e}`}function yt(e){let t=e?/^([\d-]{10}T[\d:]+)(\.\d+)?(.*)$/.exec(e):null,r=t?Date.parse(`${t[1]}${(t[2]??"").slice(0,4)}${t[3]||"Z"}`):Number.NaN;if(Number.isNaN(r))return gt(e);let n=new Date(r);return mt(n.getFullYear(),n.getMonth(),n.getDate())}var vt=/* @__PURE__ */Object.freeze({timeline:"Timeline",loadingTimeline:"Loading timeline",labResults:"Blood & lab work",visits:"Visits",physicalExams:"Physical exams",visitNotes:"Visit notes",visit:"Visit",exam:"Exam",visitNote:"Visit note",notRecorded:"Not recorded",abnormal:"Abnormal",notExamined:"Not examined",normal:"Normal",measured:e=>`Measured ${e}`,uploadedDocument:"Uploaded document",kind:/* @__PURE__ */Object.freeze({visit:"Visit",vaccine:"Vaccine",weight:"Weight",medication:"Medication"}),clinicVisit:"Clinic visit",doctor:e=>`Dr. ${e}`,lot:e=>`Lot ${e}`,expires:e=>`Expires ${e}`});function _t(e){switch(e){case"above":return{label:"Above range",outOfRange:true};case"below":return{label:"Below range",outOfRange:true};case"in_range":return{label:"In range",outOfRange:false};default:return{label:"No range on file",outOfRange:false}}}function wt(e,t){return t<2?null:`${e==="flat"?"Holding steady":`Trending ${e==="down"?"down":e==="up"?"up":"steady"}`} over ${t} visits`}function Ct(e){let t=e.replace(/_/g," ").trim();return t.length===0?e:t.charAt(0).toUpperCase()+t.slice(1)}var xt=/* @__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 kt(e){return Object.prototype.hasOwnProperty.call(xt,e)?xt[e]:Ct(e)}var zt=/* @__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 St(e){return Object.prototype.hasOwnProperty.call(zt,e)?zt[e]:Ct(e)}function Ot(e){return e===null||!Number.isFinite(e)?"-":`${e.toFixed(3).replace(/\.?0+$/,"")} kg`}function jt(e,t,r){if((e===null||!Number.isFinite(e))&&r)return r;if(e===null||!Number.isFinite(e))return"-";let n=e.toFixed(3).replace(/\.?0+$/,"");return t?`${n} ${t}`:n}function Tt(e,t,r){let n=wt(t,r);return e?`${vt.measured(gt(e))}${n?` · ${n}`:""}`:n}var Et=/* @__PURE__ */Object.freeze({lab_report:"Lab report",pims_export:"Practice export",vaccination_certificate:"Vaccination certificate",imaging_report:"Imaging report",discharge_summary:"Discharge summary",referral_letter:"Referral letter",clinician_note:"Clinician note",consent_form:"Consent form",invoice_estimate:"Invoice",prescription:"Prescription",genetic_report:"Genetic report"});function Rt(e){let t=e.title?.trim()??"";if(t.length>0)return t;let r=e.documentClass;return(r&&Object.prototype.hasOwnProperty.call(Et,r)?Et[r]:void 0)??vt.uploadedDocument}var Ft=/* @__PURE__ */Object.freeze({visit:0,vaccine:1,weight:2,medication:3});function It(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function buildTimelineRows(e){let t=[...e.visits.map((e,t)=>({key:`visit-${t}-${e.visitId}`,kind:"visit",kindLabel:vt.kind.visit,at:e.visitDate,date:gt(e.visitDate),title:e.summary??vt.clinicVisit,detail:e.veterinarian?vt.doctor(e.veterinarian):null,docId:e.docId})),...e.vaccines.map((e,t)=>{let r=[];return e.lot&&r.push(vt.lot(e.lot)),e.expiresOn&&r.push(vt.expires(gt(e.expiresOn))),{key:`vaccine-${t}-${e.vaccineId}`,kind:"vaccine",kindLabel:vt.kind.vaccine,at:e.administeredOn,date:gt(e.administeredOn),title:e.product||vt.kind.vaccine,detail:r.length?r.join(" · "):null,docId:e.docId}}),...e.weights.map((e,t)=>({key:`weight-${t}-${e.weightId}`,kind:"weight",kindLabel:vt.kind.weight,at:e.observedOn,date:gt(e.observedOn),title:Ot(e.weightKg),detail:null,docId:e.docId})),...e.medications.map((e,t)=>{let r=[e.dose,e.route,e.frequency].filter(e=>!!e);return{key:`medication-${t}-${e.medicationId}`,kind:"medication",kindLabel:vt.kind.medication,at:e.startedOn,date:gt(e.startedOn),title:e.drugName||vt.kind.medication,detail:r.length?r.join(" · "):null,docId:e.docId}})];/* @__PURE__ */
|
|
3
|
-
return Object.freeze(t.sort((e,t)=>{let r=It(e.at),n=It(t.at);return r===null&&n===null?Ft[e.kind]-Ft[t.kind]:r===null?1:n===null?-1:n!==r?n-r:Ft[e.kind]-Ft[t.kind]}))}var Dt=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],Bt=/* @__PURE__ */Object.freeze(Dt.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Bt.map(e=>e.wireCode));var Lt=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),Ht=/* @__PURE__ */Object.freeze(Bt.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Lt[e.wireCode]}))),At=new Map(Ht.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Nt=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(Ht.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...Nt]){let t=At.get(e+r);if(t)return t}}var Pt=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return Pt[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var Mt=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return Mt.has(e)}var $t=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||$t.has(e)}var qt=500,Wt=8e3,Ut=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(qt*2**r,Wt);return Math.floor(t()*n)}var Gt="This feature isn't available on your account right now.",Vt="Something in that request was not right. Check the details and try again.",Kt=/* @__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:Gt,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:Vt,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:Gt,runtimeDisposed:Vt,unknown:"Something went wrong. Please try again."}),Yt="This session has ended. Please sign in again.",Qt="linked_account_read_only";function Xt(e,t,r){return e==="conflict"&&r===Qt?Gt:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?Yt:userFacingError(e)}function userFacingError(e){return Kt[e]}function Zt(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var Jt=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===Qt,i={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:Xt(e,t?.wireCode,n?Qt:null)};t?.httpStatus!==void 0&&(i.httpStatus=t.httpStatus),t?.requestId&&(i.requestId=t.requestId),typeof t?.reasonCode=="string"&&Jt.test(t.reasonCode)&&(i.reasonCode=t.reasonCode);let a=t?.retryAfterSeconds;if(typeof a=="number"&&Number.isFinite(a)&&a>=0&&(i.retryAfterSeconds=Math.round(a)),r);return t?.wireMessage&&Zt(i,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Zt(i,"raw",t.raw),/* @__PURE__ */Object.freeze(i)}function ok(e,t){/* @__PURE__ */
|
|
2
|
+
import{createContext,forwardRef as e,createElement as t,useMemo as r,useState as n,useRef as i,useCallback as a,useEffect as o,useContext as l,useSyncExternalStore as s,Component as d}from"react";import*as c from"react-native";import{TextInput as u,View as p,ActivityIndicator as f,ScrollView as h,StyleSheet as b,Pressable as g,Text as m,Image as y}from"react-native";import{jsx as v,jsxs as _,Fragment as w}from"react/jsx-runtime";import{z as C}from"zod";function x(e,t){if(e===void 0)return{};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}function k(e){return e?.textColor===void 0?{}:{color:e.textColor}}function z(e){return e.recordCard??e.card}var S=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[S[t]]}}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type;if(r===null&&n===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:n??e.type.weight[S[t]]};let i=face(e,t);return i.fontWeight===void 0||n===null?i:{fontFamily:i.fontFamily,fontWeight:n}}function O(e){return e<=450?"regular":e<=650?"medium":"bold"}var j={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=T.get(e);r===void 0&&(r=/* @__PURE__ */new Map,T.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=E(e,t);return r.set(t,i),i}var T=/* @__PURE__ */new WeakMap;function E(e,t){let r=e.type.roles[t],n=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,i=O(Number(n)),a=r.face==="mono"?face(e,j[i]):r.face==="heading"?headingFace(e,i):face(e,i),o=r.face==="heading"?e.type.headingWeight??n:n,l=a.fontWeight===void 0?a:{fontFamily:a.fontFamily,fontWeight:o},s=r.size,d={...l,fontSize:s,lineHeight:Math.round(s*r.lineHeight*100)/100};return r.letterSpacing!==0&&(d.letterSpacing=Math.round(s*r.letterSpacing*100)/100),r.uppercase&&(d.textTransform="uppercase"),/* @__PURE__ */Object.freeze(d)}function parseColor(e){let t=R(e);return t===null?null:A(t)}function R(e){if(typeof e=="number")return D(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return F(t.slice(1));if(t.toLowerCase().startsWith("0x"))return F(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return I(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=F(t);if(e!==null)return e}return/^\d+$/.test(t)?D(Number.parseInt(t,10)):null}function F(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:L(t[0]),g:L(t[1]),b:L(t[2]),a:1};if(t.length===6)return{r:B(t,0),g:B(t,2),b:B(t,4),a:1};if(t.length===8){let e=B(t,0);return{r:B(t,2),g:B(t,4),b:B(t,6),a:e/255}}return null}function I(e){let t=e.indexOf("("),r=e.indexOf(")");if(t<0||r<0||r<t)return null;let n=e.slice(t+1,r).split(",").map(e=>e.trim());if(n.length<3)return null;let i=H(Number(n[0])),a=H(Number(n[1])),o=H(Number(n[2]));if(i===null||a===null||o===null)return null;let l=1;if(n.length>=4){let e=Number(n[3]);if(!Number.isFinite(e))return null;l=Math.min(1,Math.max(0,e))}return{r:i,g:a,b:o,a:l}}function D(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,r=t>>>24&255;return{r:t>>>16&255,g:t>>>8&255,b:t&255,a:r===0?1:r/255}}function B(e,t){return Number.parseInt(e.slice(t,t+2),16)}function L(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function H(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function A(e){if(e.a>=1)return N(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function N(e,t,r){return`#${P(e)}${P(t)}${P(r)}`.toUpperCase()}function P(e){return e.toString(16).padStart(2,"0")}var M="#111111",$="#FFFFFF",q="#000000";function readableOn(e){let t=R(e);if(t===null)return $;let r=G(t),n=G({r:17,g:17,b:17}),i=G({r:255,g:255,b:255});return K(r,i)>=K(r,n)?$:M}function W(e,t){let r=readableOn(e);return contrastRatio(r,e)>=t?r:contrastRatio($,e)>=contrastRatio(q,e)?$:q}function U(e){let t=t=>e.reduce((e,r)=>Math.min(e,contrastRatio(t,r)),Number.POSITIVE_INFINITY);return t($)>=t(q)?$:q}function G(e){let t=V(e.r/255),r=V(e.g/255),n=V(e.b/255);return.2126*t+.7152*r+.0722*n}function V(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function K(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}function contrastRatio(e,t){let r=R(e),n=R(t);if(r===null||n===null)return 1;let i=n.a>=1?n:{...n},a=r.a>=1?r:Y(r,i);return K(G(a),G(i))}function Y(e,t){let r=e.a,n=(e,t)=>Math.round(e*r+t*(1-r));return{r:n(e.r,t.r),g:n(e.g,t.g),b:n(e.b,t.b),a:1}}function Q(e,t){let r=R(e),n=R(t);if(r===null||n===null)return null;let i=r.a>=1?r:Y(r,{...n});return N(i.r,i.g,i.b)}function X(e,t){let r=R(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return`rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}var Z=.05;function J(e,t,r,n){let i=t[0];if(i===void 0)return r;let a=e=>t.every(t=>contrastRatio(e,t)>=n);if(R(e)===null)return r;if(a(e))return e;let o=Q(e,i),l=o===null?null:R(o),s=R(r);if(l===null||s===null)return r;for(let e=1;e<1/Z;e+=1){let t=e*Z,r=(e,r)=>Math.round(e+(r-e)*t),n=N(r(l.r,s.r),r(l.g,s.g),r(l.b,s.b));if(a(n))return n}return r}var ee=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var te=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){te(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var re=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var ne={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},ie={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},ae={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},oe={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},le={regular:"400",medium:"500",bold:"700"},se={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},de=0,ce="System",ue="monospace",pe=["content","heading","control","compact","badge"];function fe(e){let t={};for(let r of pe)t[r]=e;return t}var he=[];function be(){return{family:ce,mono:ue,fontUrl:null,families:{regular:ce,medium:ce,bold:ce,mono:ue,monoMedium:ue,monoBold:ue},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:ae,tierSizes:fe(ae),lineHeight:oe,weight:le,letterSpacing:se,scale:1,maxScale:de,scaleCaps:re,headingFamily:null,headingWeight:null,fontSources:he,roles:ee,typeScale:1}}var ge={},me=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var ye={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(me.standard),emphasized:cssCubicBezier(me.emphasized),exit:cssCubicBezier(me.exit)},reducedMotion:false},ve={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},_e=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:ve,space:ne,radius:ie,type:be(),motion:ye,slots:ge}),we={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"},Ce=deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:we,space:ne,radius:ie,type:be(),motion:ye,slots:ge});var xe=/* @__PURE__ */Object.freeze({ink:"#262523",ink2:"#4A4845",ink3:"#6B6863",paper:"#F8F7F4",card:"#FFFFFF",line:"#E7E6E2",tile:"#F2F1EE",shadow:"rgba(38, 37, 35, .07)",riskBg:"#FFE3E1",riskInk:"#B0231B",riskDot:"#E5372B",clearBg:"#E6F4D3",clearInk:"#2F6A12",clearDot:"#5FA82B",watchDot:"#E5A000"}),ke=/* @__PURE__ */new WeakMap;function ze(e){let t=ke.get(e);if(t!==void 0)return t;let r=e.color,n=e.brightness==="dark",i=n?{dark:n,ink:r.text.primary,ink2:r.text.secondary,ink3:r.text.muted,paper:r.background,card:r.surface,line:r.borderRingCream,tile:r.surfaceSubtle,shadow:r.shadow,riskBg:r.badgeBgCritical,riskInk:r.danger,riskDot:r.danger,clearBg:r.badgeBgPositive,clearInk:r.success,clearDot:r.success,watchDot:r.warningStrong}:{dark:n,...xe},a=(e,t)=>J(e,t,U(t),Se),o=(e,t)=>contrastRatio(e,t)>=Se?e:W(t,Se),l=[i.card,i.paper].map(e=>Q(r.brandSoft,e)??e),s={primary:r.primary,onPrimary:o(r.onPrimary,r.primary),accent:r.accent,onAccent:o(r.onAccent,r.accent),link:a(r.linkInk,[i.card,i.paper,i.tile]),badge:r.brandSoft,onBadge:a(r.brandInk,l)},d=/* @__PURE__ */Object.freeze({...i,...s});return ke.set(e,d),d}var Se=4.5;function Oe(e,t){for(let r of t)if(contrastRatio(r,e)>=Se)return r;return W(e,Se)}var je=/* @__PURE__ */Object.freeze({ink:"#10462E",go:"#07C168",muted:"#6B6B6B",line:"#E4E4E4",alert:"#C03410",alertDeep:"#6D1D14",tintSage:"#E6ECE8",tintBlue:"#EAEEF6",tintYellow:"#FCF0D6",tintRed:"#FBF1EE",tintGo:"#DCF6EA",icoSage:"#819E90",efWhite:"#FFFFFF",efBlack:"#000000",efCharcoal:"#3D3D3D",efSkyBlue:"#4E98C9",embCyan1:"#E0FDFF",bgMist:"#F1F5F2",paper:"#F8F7F4",embB1:"#FFCE34",embB2:"#5CC8F2",embB3:"#FF6665",embB4:"#A55BD8",embRiskDot:"#E5372B",embRiskInk:"#B0231B",embClearDot:"#5FA82B",embInk2:"#4A4845",embInk3:"#6B6863",embTealInk:"#00707C",embYellow:"#FFCE34",watch:"#F9E6B9",barTrack:"#ECECEC",topCard:"#FFCE34",topKicker:"#4A4845",topInk:"#262523",plainEdge:"rgba(16, 70, 46, 0.2)"}),Te=/* @__PURE__ */Object.freeze({".rec-note":/* @__PURE__ */Object.freeze({fontSize:12.5}),".efh":/* @__PURE__ */Object.freeze({gap:12,fontSize:15}),".efh-sheet":/* @__PURE__ */Object.freeze({marginTop:20,paddingTop:20,paddingBottom:28,paddingLeft:16,borderTopLeftRadius:28}),".efh-ico":/* @__PURE__ */Object.freeze({width:22}),".efh-label":/* @__PURE__ */Object.freeze({fontSize:12}),".efh-pill":/* @__PURE__ */Object.freeze({minHeight:24,paddingLeft:10,fontSize:12,letterSpacing:.72}),".efh-card":/* @__PURE__ */Object.freeze({paddingTop:16,borderRadius:20}),".efh-card__title":/* @__PURE__ */Object.freeze({fontSize:18}),".efh-btn":/* @__PURE__ */Object.freeze({minHeight:48,paddingLeft:20,fontSize:16}),".efh-btn--row":/* @__PURE__ */Object.freeze({minHeight:40,paddingLeft:16,fontSize:15}),".efh-head":/* @__PURE__ */Object.freeze({marginBottom:8}),".efh-name":/* @__PURE__ */Object.freeze({fontSize:22}),".efh-meta":/* @__PURE__ */Object.freeze({fontSize:13}),".efh-stage":/* @__PURE__ */Object.freeze({height:236,marginTop:4,marginLeft:-16}),".efh-stage__grass":/* @__PURE__ */Object.freeze({height:"44%"}),".efh-stage__pet":/* @__PURE__ */Object.freeze({left:"58%",bottom:22,height:"86%"}),".efh-stage .efh-vitals":/* @__PURE__ */Object.freeze({top:14,left:16,gap:12}),".efh-head__from":/* @__PURE__ */Object.freeze({marginTop:12}),".efh-due":/* @__PURE__ */Object.freeze({marginLeft:-12}),".efh-due li":/* @__PURE__ */Object.freeze({gap:12,paddingTop:12,paddingLeft:12,borderRadius:10}),".efh-due__title":/* @__PURE__ */Object.freeze({fontSize:17,lineHeight:22.1}),".efh-sec":/* @__PURE__ */Object.freeze({marginTop:8,marginBottom:12}),".efh-tiles":/* @__PURE__ */Object.freeze({gap:10}),".efh-tile":/* @__PURE__ */Object.freeze({gap:8,paddingTop:16,borderRadius:20}),".efh-tile__title":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:18.75,letterSpacing:-.15}),".efh-tile__foot":/* @__PURE__ */Object.freeze({gap:8,minHeight:28}),".efh-tile__foot .efh-pill":/* @__PURE__ */Object.freeze({minHeight:22,paddingLeft:7,fontSize:10.5,letterSpacing:.21}),".efh-tile__foot:has(.efh-pill + .efh-pill)":/* @__PURE__ */Object.freeze({gap:6}),".efh-tile__num":/* @__PURE__ */Object.freeze({fontSize:20,lineHeight:20,letterSpacing:-.4}),".efh-wt":/* @__PURE__ */Object.freeze({gap:8}),".efh-wt b":/* @__PURE__ */Object.freeze({fontSize:32,lineHeight:32,letterSpacing:-.64}),".efh-emb":/* @__PURE__ */Object.freeze({gap:8,marginTop:12,fontSize:15,lineHeight:19.5}),".efh-wchart":/* @__PURE__ */Object.freeze({marginTop:20}),".efh-wchart__plot":/* @__PURE__ */Object.freeze({height:148}),".efh-wkey":/* @__PURE__ */Object.freeze({rowGap:4,columnGap:16,marginTop:12,fontSize:13,lineHeight:18.2}),".efh-wkey span":/* @__PURE__ */Object.freeze({gap:6}),".efh-key":/* @__PURE__ */Object.freeze({rowGap:8,columnGap:16,fontSize:13,lineHeight:18.2}),".efh-key span":/* @__PURE__ */Object.freeze({gap:6}),".efh-key span::before":/* @__PURE__ */Object.freeze({width:10}),".efh-tl__dot":/* @__PURE__ */Object.freeze({width:16,marginTop:3}),".efh-tl__year":/* @__PURE__ */Object.freeze({marginTop:20,marginBottom:12,marginLeft:40}),".efh-tl .efh-tl__year":/* @__PURE__ */Object.freeze({marginTop:4}),".efh-tl__item":/* @__PURE__ */Object.freeze({gap:16,paddingBottom:24}),".efh-tl__item::before":/* @__PURE__ */Object.freeze({left:11,top:22,bottom:-2}),".efh-tl__date":/* @__PURE__ */Object.freeze({fontSize:12,lineHeight:16.8,letterSpacing:.48}),".efh-tl__title":/* @__PURE__ */Object.freeze({marginTop:2,fontSize:17,lineHeight:22.1}),".efh-tl__text":/* @__PURE__ */Object.freeze({marginTop:2,lineHeight:22.5}),".efh-add":/* @__PURE__ */Object.freeze({gap:12}),".efh-add > p":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:22.5}),".efh-sheet .rec-note":/* @__PURE__ */Object.freeze({marginTop:4}),".efh-lab":/* @__PURE__ */Object.freeze({paddingTop:8,paddingBottom:96,paddingLeft:16}),".efh-titles":/* @__PURE__ */Object.freeze({gap:2,paddingTop:4}),".efh-title":/* @__PURE__ */Object.freeze({fontSize:22}),".efh-smeta":/* @__PURE__ */Object.freeze({fontSize:13}),".efh-mk__name":/* @__PURE__ */Object.freeze({fontSize:17}),".efh-mk__line":/* @__PURE__ */Object.freeze({rowGap:0,columnGap:6,marginTop:1,fontSize:13,lineHeight:18.2}),".efh-mk__line b":/* @__PURE__ */Object.freeze({fontSize:17}),".efh-none":/* @__PURE__ */Object.freeze({paddingTop:0}),".efh-none__scene":/* @__PURE__ */Object.freeze({marginBottom:16,marginLeft:-16}),".efh-none__t":/* @__PURE__ */Object.freeze({fontSize:22,lineHeight:25.3,letterSpacing:-.44}),".efh-none__lead":/* @__PURE__ */Object.freeze({marginTop:8,fontSize:15,lineHeight:22.5}),".efh-ways":/* @__PURE__ */Object.freeze({gap:12,marginTop:16}),".efh-way":/* @__PURE__ */Object.freeze({columnGap:12,paddingTop:16,borderRadius:20}),".efh-way__w":/* @__PURE__ */Object.freeze({gap:2}),".efh-way__t":/* @__PURE__ */Object.freeze({fontSize:16,lineHeight:20.8}),".efh-way__x":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:21.75}),".efh-peek__labs .efh-card__title":/* @__PURE__ */Object.freeze({marginBottom:8}),".efh-peek__g":/* @__PURE__ */Object.freeze({fontSize:15,lineHeight:21.75,marginBottom:6}),".efh-peek__g b":/* @__PURE__ */Object.freeze({fontSize:16}),".dot":/* @__PURE__ */Object.freeze({width:9}),".rec-top":/* @__PURE__ */Object.freeze({gap:8,paddingTop:16,paddingRight:18,paddingBottom:18,paddingLeft:18,borderRadius:22}),".rec-top__k":/* @__PURE__ */Object.freeze({gap:7,fontSize:10.5,letterSpacing:.63}),".rec-top .emb-btn":/* @__PURE__ */Object.freeze({marginTop:4}),".mixbar":/* @__PURE__ */Object.freeze({gap:2,height:10}),".mixlegend":/* @__PURE__ */Object.freeze({rowGap:6,columnGap:14,marginTop:12,fontSize:13.5}),".mixlegend li":/* @__PURE__ */Object.freeze({gap:7}),".mixlegend i":/* @__PURE__ */Object.freeze({width:9}),".mixlegend b":/* @__PURE__ */Object.freeze({fontSize:12}),".askbar":/* @__PURE__ */Object.freeze({gap:6,height:52,paddingRight:6,paddingLeft:8,borderWidth:1.5}),".askbar input":/* @__PURE__ */Object.freeze({fontSize:16}),".askbar__add":/* @__PURE__ */Object.freeze({width:38}),".askbar__add svg":/* @__PURE__ */Object.freeze({width:22}),".askbar__send":/* @__PURE__ */Object.freeze({width:40}),".askbar__send svg":/* @__PURE__ */Object.freeze({width:20}),".ph-head":/* @__PURE__ */Object.freeze({height:58,paddingLeft:14}),".ph-back":/* @__PURE__ */Object.freeze({width:44,marginLeft:-6}),".ph-back svg":/* @__PURE__ */Object.freeze({width:26}),".ph-title":/* @__PURE__ */Object.freeze({fontSize:17}),".emb-card":/* @__PURE__ */Object.freeze({borderRadius:22}),".emb-tile":/* @__PURE__ */Object.freeze({width:46,height:46,borderRadius:13}),".ask-pill":/* @__PURE__ */Object.freeze({right:16,bottom:16,gap:8,minHeight:48,paddingRight:18,paddingLeft:14,fontSize:15.5}),".ask-pill svg":/* @__PURE__ */Object.freeze({width:22}),".ph-askbar":/* @__PURE__ */Object.freeze({paddingTop:10,paddingRight:14,paddingBottom:10,paddingLeft:14}),".rec":/* @__PURE__ */Object.freeze({paddingTop:18,paddingLeft:16}),".rec-dna":/* @__PURE__ */Object.freeze({paddingTop:16,marginTop:16}),".rec-dna__top":/* @__PURE__ */Object.freeze({gap:12,marginBottom:14}),".rec-dna__top h3":/* @__PURE__ */Object.freeze({fontSize:17}),".rec-dna__top p":/* @__PURE__ */Object.freeze({fontSize:10.5,letterSpacing:.53,marginTop:2}),".rec-dna__risk":/* @__PURE__ */Object.freeze({gap:10,marginTop:14,paddingTop:12,paddingRight:12,paddingBottom:12,paddingLeft:14,borderRadius:14}),".rec-dna__risk small":/* @__PURE__ */Object.freeze({fontSize:13}),".rec-dna__risk strong":/* @__PURE__ */Object.freeze({marginTop:1,fontSize:16,lineHeight:20}),".rec-dna__clear":/* @__PURE__ */Object.freeze({gap:7,minHeight:36,marginTop:4,paddingLeft:4,fontSize:14}),".rec-dna__clear .dot":/* @__PURE__ */Object.freeze({width:7})});var Ee=Te;function Re(e,t){let r=Ee[e]?.[t];return typeof r=="number"?r:Number.NaN}var Fe=Re;var Ie=/* @__PURE__ */Object.freeze({gap:Fe(".efh","gap"),sheetPadTop:Fe(".efh-sheet","paddingTop"),sheetPadX:Fe(".efh-sheet","paddingLeft"),sheetPadBottom:Fe(".efh-sheet","paddingBottom"),sheetRadius:Fe(".efh-sheet","borderTopLeftRadius"),sheetGap:Fe(".efh-sheet","marginTop"),cardPad:Fe(".efh-card","paddingTop"),cardRadius:Fe(".efh-card","borderRadius"),name:Fe(".efh-name","fontSize"),cardTitle:Fe(".efh-card__title","fontSize"),rowTitle:Fe(".efh-mk__name","fontSize"),body:Fe(".efh","fontSize"),small:Fe(".efh-meta","fontSize"),mono:Fe(".efh-label","fontSize"),tileNum:Fe(".efh-tile__num","fontSize"),big:Fe(".efh-wt b","fontSize"),button:Fe(".efh-btn","minHeight"),rowButton:Fe(".efh-btn--row","minHeight"),pill:Fe(".efh-pill","minHeight"),plot:Fe(".efh-wchart__plot","height"),rowRadius:Fe(".efh-due li","borderRadius"),tileGap:Fe(".efh-tiles","gap"),icon:Fe(".efh-ico","width")});function De(e,t){return e.trim().toLowerCase()===t.trim().toLowerCase()}function Be(e,t,r){let n=X(e,r);return(n!==null?Q(n,t):null)??t}var Le=(e,t)=>parseColor(e)===parseColor(t);function He(e){if(e.brightness!=="light")return false;let t=e.color,r=_e.color;return Le(t.primary,r.primary)&&Le(t.brandInk,r.brandInk)&&Le(t.onPrimary,r.onPrimary)&&Le(t.accent,r.accent)&&Le(t.accentEdge,r.accentEdge)}function Ae(e){let t=e.color,r=je,n=ze(e),i=e.brightness==="dark",a=He(e),o=(i?Ce:_e).color,l=!Le(t.accent,o.accent),s=i?t.surface:r.efWhite,d=(e,t)=>Be(e,s,i?.18:t),c=a?r.tintSage:d(n.primary,.105),u=a?r.topCard:l?n.accent:c;return{tintSage:c,chevron:a?r.icoSage:Be(t.brandInk,s,.527),rowGround:a?r.bgMist:d(n.primary,.059),tintPartner:l?d(n.accent,.14):r.embCyan1,topFill:u,plainEdge:a?r.plainEdge:X(t.brandInk,.2)??t.structureEdge,topKicker:Oe(u,[l?n.onAccent:i?n.ink3:r.topKicker,r.topInk]),topInk:Oe(u,[l?n.onAccent:i?n.ink:r.topInk,r.topInk])}}function recordsSheetLook(e){let t=e.color,r=je,n=ze(e),i=Ae(e),a=He(e)?r.go:De(t.accent,t.primary)?t.onPrimary:t.accent;return e.brightness==="dark"?/* @__PURE__ */Object.freeze({dark:true,paper:n.paper,ground:t.background,card:n.card,text:n.ink,muted:n.ink3,line:t.structureEdge,ink:t.brandInk,fill:n.primary,onFill:n.onPrimary,accentOnFill:a,accent:n.accent,go:t.success,goTint:t.badgeBgPositive,alert:n.riskInk,alertDeep:n.riskInk,alertTint:t.badgeBgCritical,watch:t.badgeBgCaution,wind:r.efSkyBlue,tintBlue:t.surfaceSubtle,tintYellow:t.surfaceSubtle,barTrack:t.structureEdge,...i}):/* @__PURE__ */Object.freeze({dark:false,paper:n.paper,ground:r.efWhite,card:r.efWhite,text:r.efBlack,muted:r.muted,line:r.line,ink:t.brandInk,fill:n.primary,onFill:n.onPrimary,accentOnFill:a,accent:n.accent,go:r.go,goTint:r.tintGo,alert:r.alert,alertDeep:r.alertDeep,alertTint:r.tintRed,watch:r.watch,wind:r.efSkyBlue,tintBlue:r.tintBlue,tintYellow:r.tintYellow,barTrack:r.barTrack,...i})}var Ne=createContext("sheet");Ne.Provider;function Pe(){return l(Ne)}function Me(e,t={}){return{padding:e.cardPad,gap:12,...t,...e.card}}function $e(e,t){let r={...e};for(let n of Object.keys(t)){let i=t[n];i!==void 0&&(r[n]={...e[n],...i})}return r}var qe=/* @__PURE__ */new WeakMap;function We(e){let t=qe.get(e);if(t!==void 0)return t;let r=recordsSheetLook(e),n=z(e.slots),i=face(e,"bold"),a={...i,fontSize:16,lineHeight:20},o=/* @__PURE__ */Object.freeze({look:r,ground:r.ground,card:{backgroundColor:r.card,borderRadius:e.radius.lg,borderWidth:r.dark?1:0,borderColor:r.line,shadowColor:"#000000",shadowOpacity:r.dark?0:.09,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:r.dark?0:1,...x(n,1)},cardPad:Ie.cardPad,cardTitle:{...i,fontSize:Ie.cardTitle,lineHeight:Math.round(Ie.cardTitle*1.25*100)/100,letterSpacing:-.36,color:r.ink,...k(n)},body:{...face(e,"regular"),fontSize:15,lineHeight:21,color:r.ink,...k(n)},title:{...face(e,"medium"),fontSize:Ie.name,lineHeight:Math.round(Ie.name*1.2*100)/100,letterSpacing:-.33,color:r.ink},button:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,minHeight:Ie.button,paddingHorizontal:20,borderRadius:999},buttonInk:{backgroundColor:r.fill,borderWidth:0,...x(e.slots.primaryButton)},buttonInkLabel:{...a,color:r.onFill,...k(e.slots.primaryButton)},buttonOutline:{backgroundColor:"transparent",borderWidth:1.5,borderColor:r.ink},buttonOutlineLabel:{...a,color:r.ink},askPill:{backgroundColor:je.embYellow,borderWidth:0,paddingLeft:Re(".ask-pill","paddingLeft"),paddingRight:Re(".ask-pill","paddingRight")},askPillLabel:{...i,fontSize:Re(".ask-pill","fontSize"),lineHeight:Re(".ask-pill","fontSize")*1.2,color:je.topInk}});return qe.set(e,o),o}var Ue=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Ge=globalThis,Ve=Ge[Ue]??(Ge[Ue]=createContext(_e));Ve.displayName??="EverfurThemeContext";function useEverfurTheme(){return l(Ve)}function Ke(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:e,variant:r,...n}){let i=useEverfurTheme(),a=r===void 0?void 0:i.type.roles[r],o=Ke(i.type,e??a?.tier??"content"),l=r===void 0?n:{...n,style:[{...textRole(i,r),color:i.color.text.primary,flexShrink:1},n.style]};return t(m,o===void 0?l:{maxFontSizeMultiplier:o,...l})}e(function(e,r){return t(u,{...e,...r===null?{}:{ref:r}})});var Ye="your pet";function Qe(e){let t=e?.trim()??"";return t.length>0?t:Ye}var Xe=/* @__PURE__ */Object.freeze({title:"Health records",titleWeb:e=>{let t=e?.trim()??"";return t.length>0?`${t}’s Records`:"Health records"},titleNative:e=>{let t=e?.trim()??"";return t.length>0?t:"Health records"},openTimeline:"Open timeline",loading:"Loading health records",lead:e=>`${Qe(e)}’s lab trends`,retryMarkers:"Retry loading lab trends",viewFullRecord:"View full medical record",viewTimeline:"View full timeline",important:e=>`Important: ${e}`});var Ze=/* @__PURE__ */Object.freeze({pressScale:.97,pressMs:160,riseWebPx:16,riseNativePx:14,fadeMs:320,moveMs:480,staggerMs:55,maxSteps:8});var Je=/* @__PURE__ */Object.freeze({loading:"Loading",empty:"No records yet",upload:"Upload records",consentRequired:"Consent required",allow:"Allow",allPetsConsent:"This covers all your pets. You can withdraw it at any time.",sessionRequired:"Sign in required",recordUnavailable:"Record unavailable",retry:"Try again",records:"Records",beingReviewed:"being reviewed"}),et="Everfur summarizes what your vet recorded. It is informational, not diagnostic.";function tt(e){let t=(e.brightness==="dark"?Ce:_e).color,r=e.color,n=(e,t)=>parseColor(e)===parseColor(t);return{success:!n(r.success,t.success),warning:!n(r.warningStrong,t.warningStrong)||!n(r.cautionAccent,t.cautionAccent),info:!(n(r.info,r.brandInk)&&n(r.badgeBgInfo,r.brandSoft)&&n(r.infoEdge,r.structureEdge))}}var rt=4.5;function nt(e){if(!tt(e).success)return null;let t=[e.color.surface];return J(e.color.success,t,U(t),rt)}var it=52;function at(){let e=useEverfurTheme(),t=ot();return r(()=>lt(e,t),[e,t])}function ot(){let e=useEverfurTheme();return Pe()==="sheet"?We(e):null}function lt(e,t=null){let{color:r,space:n,radius:i,type:a,slots:o}=e,{size:l,lineHeight:s}=a,d=(e,t)=>Math.round(e*t),c=b.hairlineWidth,u=n.xxl+n.md,p=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:d(t,r),color:n}),f=z(o),h=k(f),g=k(o.banner),m=o.banner?.textColor,y=e.brightness==="dark"?r.errorRed:r.danger,v=(e,t)=>({bg:{backgroundColor:e,borderColor:"transparent"},fg:{color:t}}),_=(e,t)=>({bg:{backgroundColor:r.surface,borderColor:e},fg:{color:t}});return{chipTones:{neutral:_(r.brandBorderStrong,r.text.primary),info:v(r.brandSoft,r.brandInk),warning:_(r.cautionAccent,r.text.primary),critical:_(r.danger,r.danger),positive:_(r.success,nt(e)??r.brandInk)},...b.create({root:{flex:1,backgroundColor:r.background},body:{flex:1},content:{paddingHorizontal:n.lg,paddingBottom:n.xxl,gap:n.lg},contentTight:{paddingHorizontal:n.sm,paddingBottom:n.xxl,gap:n.lg},inset:{paddingHorizontal:n.sm},section:{gap:n.sm+n.xs/2},sectionHeader:{flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.xs},sectionTitle:{...p(l.subtitle,s.snug,r.text.primary,"bold"),...headingFace(e,"bold"),letterSpacing:-.4},sectionCount:{...p(l.bodyTight,s.snug,r.text.muted,"medium")},card:{borderRadius:i.lg,borderWidth:1,borderColor:r.borderRingCream,backgroundColor:r.surface,paddingHorizontal:n.lg,paddingVertical:n.xs,...x(f,c)},creamCard:{borderRadius:i.lg,borderWidth:1,borderColor:r.borderRingCream,backgroundColor:r.surfaceCream,padding:n.lg,gap:n.md,...x(f,c)},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.md,paddingVertical:n.md},rowDivider:{borderTopWidth:c,borderTopColor:r.borderHairlineGreen},rowMain:{flex:1},rowRight:{alignItems:"flex-end",gap:n.xs+n.xs/2},rowTitle:{...p(l.body,s.snug,r.text.primary,"medium"),...h},rowDetail:{...p(l.caption,s.normal,r.text.secondary),marginTop:n.xs/2,...h},rowValue:{...p(l.body+1,s.snug,r.text.primary,"bold"),marginTop:n.xs/2,...h},rowMuted:{...p(l.caption,s.normal,r.text.muted),...h},chip:{minHeight:24,justifyContent:"center",borderRadius:i.pill,borderWidth:1.5,paddingHorizontal:n.sm+n.xs/2,alignSelf:"flex-start"},chipText:{...p(l.tiny+1,s.snug,r.text.primary,"monoBold"),letterSpacing:.7,textTransform:"uppercase"},chipSentence:{borderRadius:i.md,paddingVertical:n.xs,alignSelf:"stretch"},chipSentenceText:{...p(l.caption,s.normal,r.text.primary,"medium"),letterSpacing:0,textTransform:"none"},pill:{minHeight:it,borderRadius:i.pill,paddingHorizontal:n.lg+n.xs/2,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:n.sm},pillPrimary:{backgroundColor:r.brand,...x(o.primaryButton)},pillPrimaryLabel:{...p(l.body,s.snug,r.onPrimary,"bold"),...k(o.primaryButton)},pillOutline:{borderWidth:1.5,borderColor:r.brandInk,backgroundColor:"transparent"},pillOutlineLabel:{...p(l.body,s.snug,r.brandInk,"bold")},pillDanger:{borderWidth:1.4,borderColor:r.danger,backgroundColor:r.surface},pillDangerLabel:{...p(l.bodyTight,s.snug,r.danger,"bold")},pillAsk:{borderWidth:c,borderColor:r.borderRingCream,backgroundColor:r.surface},pillAskLabel:{...p(l.body,s.snug,r.text.primary,"bold")},pillLink:{minHeight:u,backgroundColor:"transparent",paddingHorizontal:n.sm},pillLinkLabel:{...p(l.body,s.snug,r.linkInk,"bold")},pillDisabled:{opacity:.5},pressed:{transform:[{scale:Ze.pressScale}]},infoNote:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,borderRadius:i.md-n.xs/2,backgroundColor:r.brandSoft,paddingHorizontal:n.md,paddingVertical:n.sm+n.xs/2,...x(o.banner)},infoNoteText:{flex:1,...p(l.bodyTight,s.normal,r.text.primary),...g},cautionNote:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,borderRadius:i.md-n.xs/2,backgroundColor:r.badgeBgCaution,paddingHorizontal:n.md,paddingVertical:n.sm+n.xs/2},cautionNoteText:{flex:1,...p(l.bodyTight,s.normal,r.warningStrong)},statusCard:{borderRadius:i.md,backgroundColor:r.brandSoft,padding:n.md+n.xs/2},statusText:p(l.bodyTight,s.relaxed,r.text.primary),errorBanner:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,borderRadius:i.md-n.xs/2,backgroundColor:r.badgeBgCritical,padding:n.md},errorText:{flex:1,...p(l.bodyTight,s.normal,y)},band:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,borderRadius:i.md-n.xs/2,padding:n.md,backgroundColor:r.brandSoft,...x(o.banner)},bandText:{flex:1,...p(l.caption,s.normal,r.text.secondary),...g},infoGlyph:{width:n.md+n.xs/2,height:n.md+n.xs/2,borderRadius:i.pill,borderWidth:1,borderColor:m??r.text.secondary,alignItems:"center",justifyContent:"center"},infoGlyphText:{...p(l.small,s.tight,r.text.secondary,"bold"),...g},chevron:{width:n.sm,height:n.sm,borderTopWidth:n.xs/2,borderRightWidth:n.xs/2,borderColor:r.text.muted},lead:{paddingHorizontal:n.sm,...p(l.body+1,s.snug,r.text.primary,"bold")},field:{minHeight:u,paddingHorizontal:n.md,paddingVertical:n.sm,borderWidth:1,borderColor:r.borderHairlineGreen,borderRadius:i.sm,color:r.text.primary,backgroundColor:r.surface,...face(e,"regular"),fontSize:l.body,...x(o.input,1),...k(o.input)},fieldLabel:{...p(l.bodyTight,s.normal,r.text.secondary,"medium")},muted:p(l.caption,s.normal,r.text.muted),bodyText:p(l.body,s.normal,r.text.primary)}),...t!==null?st(t):{}}}function st(e){return b.create({root:{flex:1,backgroundColor:e.ground},sectionTitle:e.cardTitle,card:{...e.card,paddingHorizontal:e.cardPad,paddingVertical:e.cardPad/4},creamCard:{...e.card,padding:e.cardPad,gap:12},pill:e.button,pillPrimary:e.buttonInk,pillPrimaryLabel:e.buttonInkLabel,pillOutline:e.buttonOutline,pillOutlineLabel:e.buttonOutlineLabel,pillAsk:e.askPill,pillAskLabel:e.askPillLabel,lead:{paddingHorizontal:8,...e.cardTitle}})}function dt(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function ct(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function ut(e,...t){if(typeof e=="function")try{let r=e(...t);return ct(r)&&Promise.resolve(r).then(void 0,dt),r}catch(e){dt(e);return}}var pt=/* @__PURE__ */new WeakMap;function ft(e){if(typeof e!="function")return;let t=pt.get(e);if(t!==void 0)return t;let r=(...t)=>{ut(e,...t)};return pt.set(e,r),r}function ht(e){return e?.httpStatus===429?"rate_limited":e?.httpStatus===502?"service_unavailable":"error"}function bt(e,t){return e===null?"":t?`${e} ${t}`:e}var gt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function mt(e){if(!e)return"-";let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(t!==null)return yt(Number(t[1]),Number(t[2])-1,Number(t[3]));let r=Date.parse(e);if(Number.isNaN(r))return"-";let n=new Date(r);return yt(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate())}function yt(e,t,r){let n=gt[t];return n===void 0?"-":`${n} ${r}, ${e}`}function vt(e){let t=e?/^([\d-]{10}T[\d:]+)(\.\d+)?(.*)$/.exec(e):null,r=t?Date.parse(`${t[1]}${(t[2]??"").slice(0,4)}${t[3]||"Z"}`):Number.NaN;if(Number.isNaN(r))return mt(e);let n=new Date(r);return yt(n.getFullYear(),n.getMonth(),n.getDate())}var _t=/* @__PURE__ */Object.freeze({timeline:"Timeline",loadingTimeline:"Loading timeline",labResults:"Blood & lab work",visits:"Visits",physicalExams:"Physical exams",visitNotes:"Visit notes",visit:"Visit",exam:"Exam",visitNote:"Visit note",notRecorded:"Not recorded",abnormal:"Abnormal",notExamined:"Not examined",normal:"Normal",measured:e=>`Measured ${e}`,uploadedDocument:"Uploaded document",kind:/* @__PURE__ */Object.freeze({visit:"Visit",vaccine:"Vaccine",weight:"Weight",medication:"Medication"}),clinicVisit:"Clinic visit",doctor:e=>`Dr. ${e}`,lot:e=>`Lot ${e}`,expires:e=>`Expires ${e}`});function wt(e){switch(e){case"above":return{label:"Above range",outOfRange:true};case"below":return{label:"Below range",outOfRange:true};case"in_range":return{label:"In range",outOfRange:false};default:return{label:"No range on file",outOfRange:false}}}function Ct(e,t){return t<2?null:`${e==="flat"?"Holding steady":`Trending ${e==="down"?"down":e==="up"?"up":"steady"}`} over ${t} visits`}function xt(e){let t=e.replace(/_/g," ").trim();return t.length===0?e:t.charAt(0).toUpperCase()+t.slice(1)}var kt=/* @__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 zt(e){return Object.prototype.hasOwnProperty.call(kt,e)?kt[e]:xt(e)}var St=/* @__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 Ot(e){return Object.prototype.hasOwnProperty.call(St,e)?St[e]:xt(e)}function jt(e){return e===null||!Number.isFinite(e)?"-":`${e.toFixed(3).replace(/\.?0+$/,"")} kg`}function Tt(e,t,r){if((e===null||!Number.isFinite(e))&&r)return r;if(e===null||!Number.isFinite(e))return"-";let n=e.toFixed(3).replace(/\.?0+$/,"");return t?`${n} ${t}`:n}function Et(e,t,r){let n=Ct(t,r);return e?`${_t.measured(mt(e))}${n?` · ${n}`:""}`:n}var Rt=/* @__PURE__ */Object.freeze({lab_report:"Lab report",pims_export:"Practice export",vaccination_certificate:"Vaccination certificate",imaging_report:"Imaging report",discharge_summary:"Discharge summary",referral_letter:"Referral letter",clinician_note:"Clinician note",consent_form:"Consent form",invoice_estimate:"Invoice",prescription:"Prescription",genetic_report:"Genetic report"});function Ft(e){let t=e.title?.trim()??"";if(t.length>0)return t;let r=e.documentClass;return(r&&Object.prototype.hasOwnProperty.call(Rt,r)?Rt[r]:void 0)??_t.uploadedDocument}var It=/* @__PURE__ */Object.freeze({visit:0,vaccine:1,weight:2,medication:3});function Dt(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function buildTimelineRows(e){let t=[...e.visits.map((e,t)=>({key:`visit-${t}-${e.visitId}`,kind:"visit",kindLabel:_t.kind.visit,at:e.visitDate,date:mt(e.visitDate),title:e.summary??_t.clinicVisit,detail:e.veterinarian?_t.doctor(e.veterinarian):null,docId:e.docId})),...e.vaccines.map((e,t)=>{let r=[];return e.lot&&r.push(_t.lot(e.lot)),e.expiresOn&&r.push(_t.expires(mt(e.expiresOn))),{key:`vaccine-${t}-${e.vaccineId}`,kind:"vaccine",kindLabel:_t.kind.vaccine,at:e.administeredOn,date:mt(e.administeredOn),title:e.product||_t.kind.vaccine,detail:r.length?r.join(" · "):null,docId:e.docId}}),...e.weights.map((e,t)=>({key:`weight-${t}-${e.weightId}`,kind:"weight",kindLabel:_t.kind.weight,at:e.observedOn,date:mt(e.observedOn),title:jt(e.weightKg),detail:null,docId:e.docId})),...e.medications.map((e,t)=>{let r=[e.dose,e.route,e.frequency].filter(e=>!!e);return{key:`medication-${t}-${e.medicationId}`,kind:"medication",kindLabel:_t.kind.medication,at:e.startedOn,date:mt(e.startedOn),title:e.drugName||_t.kind.medication,detail:r.length?r.join(" · "):null,docId:e.docId}})];/* @__PURE__ */
|
|
3
|
+
return Object.freeze(t.sort((e,t)=>{let r=Dt(e.at),n=Dt(t.at);return r===null&&n===null?It[e.kind]-It[t.kind]:r===null?1:n===null?-1:n!==r?n-r:It[e.kind]-It[t.kind]}))}var Bt=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],Lt=/* @__PURE__ */Object.freeze(Bt.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Lt.map(e=>e.wireCode));var Ht=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),At=/* @__PURE__ */Object.freeze(Lt.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Ht[e.wireCode]}))),Nt=new Map(At.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Pt=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(At.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...Pt]){let t=Nt.get(e+r);if(t)return t}}var Mt=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return Mt[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var $t=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return $t.has(e)}var qt=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||qt.has(e)}var Wt=500,Ut=8e3,Gt=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Wt*2**r,Ut);return Math.floor(t()*n)}var Vt="This feature isn't available on your account right now.",Kt="Something in that request was not right. Check the details and try again.",Yt=/* @__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:Vt,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:Kt,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:Vt,runtimeDisposed:Kt,unknown:"Something went wrong. Please try again."}),Qt="This session has ended. Please sign in again.",Xt="linked_account_read_only";function Zt(e,t,r){return e==="conflict"&&r===Xt?Vt:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?Qt:userFacingError(e)}function userFacingError(e){return Yt[e]}function Jt(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var er=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===Xt,i={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:Zt(e,t?.wireCode,n?Xt:null)};t?.httpStatus!==void 0&&(i.httpStatus=t.httpStatus),t?.requestId&&(i.requestId=t.requestId),typeof t?.reasonCode=="string"&&er.test(t.reasonCode)&&(i.reasonCode=t.reasonCode);let a=t?.retryAfterSeconds;if(typeof a=="number"&&Number.isFinite(a)&&a>=0&&(i.retryAfterSeconds=Math.round(a)),r);return t?.wireMessage&&Jt(i,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Jt(i,"raw",t.raw),/* @__PURE__ */Object.freeze(i)}function ok(e,t){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
5
|
-
return Object.freeze({ok:false,error:e})}var
|
|
6
|
-
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var
|
|
5
|
+
return Object.freeze({ok:false,error:e})}var tr=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
|
|
6
|
+
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var rr="x-everfur-anon-token",nr="anonTokenInvalid";async function ir(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function ar(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...r?{wireMessage:r}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[rr]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...or(e.headers),...authHeaders(t)}}}function or(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let e=r.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===rr||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await ir(t),n=await t.transport.request(withAuthHeaders(e,lr(t,r)));if(n.ok||dr(n.error.raw)!==nr||t.anonIdentity===void 0||t.userRef!==null)return n;let i=await t.anonIdentity.token({forceRefresh:true});return i===null||i===r?n:t.transport.request(withAuthHeaders(e,lr(t,i)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(ar(e))}let n=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(ar(e,{wireCode:dr(n.error.raw),requestId:n.error.requestId}))}let a=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!a.ok&&a.error.httpStatus===401?(t.identity.reportRejected?.(),err(sr(a.error))):a}function lr(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function sr(e){let t=e.raw,r=dr(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...r?{wireCode:r}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function dr(e){if(typeof e!="object"||e===null)return null;let t=e,r=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof r=="string"&&r.length>0?r:null}var cr=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;function ur(e,t){let r=globalThis.URL;if(typeof r=="function"){let n;try{n=t===void 0?new r(e):new r(e,t)}catch{return null}try{if(n.protocol)return n}catch{}}return br(e,t)}var pr=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,fr=/[\s\u0000-\u001f\u007f\\]/,hr={"http:":"80","https:":"443"};function br(e,t){let r=e.trim();if(t!==void 0&&!cr.test(r)){let e=br(t);if(e===null||!r.startsWith("/")||r.startsWith("//"))return null;r=e.origin+r}let n=fr.test(r)?null:pr.exec(r);if(n===null)return null;let[,i="",a="",o="",l="",s="",d="",c="",u=""]=n,p=`${i.toLowerCase()}:`,f=Number(s);if(f>65535)return null;let h=s===""||String(f)===hr[p]?"":String(f),b=hr[p]!==void 0,g=l.toLowerCase()+(h&&`:${h}`),m=d||(b?"/":""),y=a||o?`${a}${o&&`:${o}`}@`:"";return{href:`${p}//${y}${g}${m}${c}${u}`,protocol:p,username:a,password:o,hostname:l.toLowerCase(),port:h,origin:b?`${p}//${g}`:"null",pathname:m,search:c==="?"?"":c,hash:u==="#"?"":u}}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:gr(e)})}function gr(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var mr=3e4,yr=Ut*2,vr="idempotency-key",_r=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),wr=/* @__PURE__ */Object.freeze({onEvent(){}}),Cr=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function xr(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??wr,r=e.timers??Cr,n=e.rng??Math.random,i=e.sleep??((e,t)=>Nr(e,r,t)),a=e.maxAttempts??Gt,o=e.unaryTimeoutMs??mr,l=e.newIdempotencyKey??zr(),s=e=>{try{t.onEvent(e)}catch{}};async function d(t,d,c){let u=c?.maxAttempts,p=Math.max(1,u??a),f=c?.idempotent??_r.has(d.method),h=c?.idempotencyKey===void 0?null:xr(c.idempotencyKey),b=f?h??l():null,g=kr(d,b),m=0;for(;;){let a=e=>/* @__PURE__ */Object.freeze({call:t,method:d.method,path:d.path,attempt:m,...b?{idempotencyKey:b}:{},...e});s(a({phase:"attempt"}));let l=Hr(o,r),c=Ar(l.signal,d.signal),f;try{f=await authedSend({...g,signal:c.signal},e.auth)}catch(e){f=err(networkError(e))}finally{c.dispose(),l.cancel()}if(f.ok)return s(a({phase:"settled",ok:true,reason:"ok"})),f;let h=f.error,y=Or(h,m,{maxAttempts:p,rng:n,now:r.now(),aborted:d.signal?.aborted===true,...u!==void 0?{perCallMaxAttempts:u}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),v={ok:false,code:h.code,reason:y.reason,...h.httpStatus!==void 0?{httpStatus:h.httpStatus}:{},...h.requestId!==void 0?{requestId:h.requestId}:{}};if(!y.retry)return s(a({phase:"settled",...v})),err(h);if(s(a({phase:"retry",...v,delayMs:y.delayMs})),await i(y.delayMs,d.signal),d.signal?.aborted===true)return s(a({phase:"settled",...v,reason:"aborted"})),err(h);m+=1}}async function c(t){return withAuthHeaders(t,await Lr(e.auth))}async function*u(t,r,n){s(
|
|
7
7
|
/* @__PURE__ */Object.freeze({call:t,phase:"stream.open",method:r.method,path:r.path,attempt:0}));try{yield*e.auth.transport.stream(r,n)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
8
|
-
return Object.freeze({send:d,authorize:c,stream:u})}function
|
|
9
|
-
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:
|
|
10
|
-
return Object.freeze({docId:e.doc_id,title:e.title??null,documentClass:e.document_class??null,pageCount:e.page_count??null,receivedAt:e.received_at??null})}var
|
|
11
|
-
return Object.freeze({petRef:e,withheld:true,markers:/* @__PURE__ */Object.freeze([]),summary:null,disclaimer:"",featuredMarkerId:null})}function mapRecordMarkers(petRef,e){let t=
|
|
12
|
-
return Object.freeze({petRef:r,withheld:false,markers:/* @__PURE__ */Object.freeze(o),summary:i.summary?/* @__PURE__ */Object.freeze({totalMarkers:i.summary.total_markers,inRangeCount:i.summary.in_range_count,outOfRangeCount:i.summary.out_of_range_count,unknownCount:i.summary.unknown_count}):null,disclaimer:i.disclaimer??"",featuredMarkerId:i.featured_marker_id??null})}var
|
|
8
|
+
return Object.freeze({send:d,authorize:c,stream:u})}function kr(e,t){let r={};for(let[t,n]of Object.entries(e.headers??{}))t.toLowerCase()!==vr&&(r[t]=n);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}function zr(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var Sr=10;function Or(e,t,r){if(r.aborted)return{retry:false,reason:"aborted"};let n=jr(e);if(n==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if((()=>{if(r.policy===void 0)return false;try{return!r.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let a=()=>{if(r.policy===void 0)return null;let t;try{t=r.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(Sr,Math.floor(t)))},o=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let l=Tr(e,r.now);return l!==null?l>yr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:l}:{retry:true,reason:i,delayMs:backoffDelayMs(t,r.rng)}}function jr(e){let t=e.code==="unknown"?fromWire(Dr(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function Tr(e,t){let r=Rr(e.raw);if(r!==null){let e=r-t;return e>0?e:0}let n=Er(e.raw);return n===null?null:Math.round(n*1e3)}function Er(e){for(let t of Fr(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function Rr(e){for(let t of Fr(e)){let e=t.resets_at,r=Ir(e);if(r!==null)return r}return null}function Fr(e){if(!Br(e))return[];let t=[e];for(let r of["error","detail"]){let n=e[r];Br(n)&&t.push(n)}return t}function Ir(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}function Dr(e){for(let t of Fr(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function Br(e){return typeof e=="object"&&e!==null}async function Lr(e){if(e.mode==="anonymous"){let t=await ir(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function Hr(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return{signal:r.signal,cancel:()=>t.clearTimeout(n)}}function Ar(e,t){let r=()=>{};if(!t)return{signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let i=()=>n.abort();return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i)}}}function Nr(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",a),n()},e),a=()=>{t.clearTimeout(i),n()};r?.addEventListener("abort",a,{once:true})})}function Pr(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let r=e.charCodeAt(t+1);if(!(r>=56320&&r<=57343))return true;t+=1}else if(r>=56320&&r<=57343)return true}return false}function Mr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var $r=64,qr=512;function Wr(e){return e==="owner_reported"||e==="clinic_document"?e:null}var Ur=/* @__PURE__ */C.object({key:/* @__PURE__ */C.string(),category:/* @__PURE__ */C.string().optional(),label:/* @__PURE__ */C.string().optional(),value:/* @__PURE__ */C.string().nullish(),unit:/* @__PURE__ */C.string().nullish(),observed_at:/* @__PURE__ */C.string().nullish(),status:/* @__PURE__ */C.string().nullish(),origin:/* @__PURE__ */C.string().nullish(),canonical_key:/* @__PURE__ */C.string().nullish()});var Gr=/* @__PURE__ */C.object({doc_id:/* @__PURE__ */C.string(),title:/* @__PURE__ */C.string().nullish(),document_class:/* @__PURE__ */C.string().nullish(),page_count:/* @__PURE__ */C.number().nullish(),received_at:/* @__PURE__ */C.string().nullish()});function Vr(e){/* @__PURE__ */
|
|
9
|
+
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:Wr(e.origin),canonicalKey:e.canonical_key??null})}function Kr(e){/* @__PURE__ */
|
|
10
|
+
return Object.freeze({docId:e.doc_id,title:e.title??null,documentClass:e.document_class??null,pageCount:e.page_count??null,receivedAt:e.received_at??null})}var Yr=/* @__PURE__ */C.string().nullish(),Qr=/* @__PURE__ */C.number().nullish(),Xr=/* @__PURE__ */C.object({collected_at:Yr,at:Yr,value:Qr,unit:Yr,qualitative_result:Yr,ref_low:Qr,ref_high:Qr,status:Yr,source_clinic:Yr,source_doc_id:Yr,doc_id:Yr,reviewed:/* @__PURE__ */C.boolean().nullish()}),Zr=/* @__PURE__ */C.object({collected_at:Yr,at:Yr,value:Qr,unit:Yr,qualitative_result:Yr,status:Yr}),Jr=/* @__PURE__ */C.object({marker_id:/* @__PURE__ */C.string().min(1),canonical_name:Yr,name:Yr,loinc_code:Yr,canonical_unit:Yr,unit:Yr,panel_name:Yr,panel:Yr,meaning_text:Yr,meaning:Yr,latest:/* @__PURE__ */Zr.nullish(),trajectory:Yr,points:/* @__PURE__ */C.array(Xr).optional()}),en=/* @__PURE__ */C.object({total_markers:/* @__PURE__ */C.number().int().nonnegative(),in_range_count:/* @__PURE__ */C.number().int().nonnegative(),out_of_range_count:/* @__PURE__ */C.number().int().nonnegative(),unknown_count:/* @__PURE__ */C.number().int().nonnegative()}),tn=/* @__PURE__ */C.object({markers:/* @__PURE__ */C.array(Jr).optional(),summary:/* @__PURE__ */en.nullish(),disclaimer:/* @__PURE__ */C.string().optional(),featured_marker_id:Yr});function rn(e){/* @__PURE__ */
|
|
11
|
+
return Object.freeze({petRef:e,withheld:true,markers:/* @__PURE__ */Object.freeze([]),summary:null,disclaimer:"",featuredMarkerId:null})}function mapRecordMarkers(petRef,e){let t=Mr(e)?e:{},r=typeof t.pet_ref=="string"&&t.pet_ref.length>0?t.pet_ref:petRef;if(t.withheld===true)return rn(r);let n=tn.safeParse(t);if(!n.success)return rn(r);let i=n.data,a=e=>/* @__PURE__ */Object.freeze({at:e.collected_at??e.at??null,value:e.value??null,unit:e.unit??null,qualitativeResult:e.qualitative_result??null,refLow:e.ref_low??null,refHigh:e.ref_high??null,status:e.status??null,sourceClinic:e.source_clinic??null,docId:e.source_doc_id??e.doc_id??null,reviewed:e.reviewed===true}),o=(i.markers??[]).map(e=>/* @__PURE__ */Object.freeze({markerId:e.marker_id,name:e.canonical_name??e.name??e.marker_id,loincCode:e.loinc_code??null,unit:e.canonical_unit??e.unit??null,panel:e.panel_name??e.panel??null,meaning:e.meaning_text??e.meaning??null,latest:e.latest?/* @__PURE__ */Object.freeze({at:e.latest.collected_at??e.latest.at??null,value:e.latest.value??null,unit:e.latest.unit??null,qualitativeResult:e.latest.qualitative_result??null,status:e.latest.status??null}):null,trajectory:e.trajectory??null,points:/* @__PURE__ */Object.freeze((e.points??[]).map(a))}));/* @__PURE__ */
|
|
12
|
+
return Object.freeze({petRef:r,withheld:false,markers:/* @__PURE__ */Object.freeze(o),summary:i.summary?/* @__PURE__ */Object.freeze({totalMarkers:i.summary.total_markers,inRangeCount:i.summary.in_range_count,outOfRangeCount:i.summary.out_of_range_count,unknownCount:i.summary.unknown_count}):null,disclaimer:i.disclaimer??"",featuredMarkerId:i.featured_marker_id??null})}var nn=128,an=128;var on=/* @__PURE__ */C.string().min(1).refine(e=>e.startsWith("https://")),ln=/* @__PURE__ */C.object({source_doc_id:/* @__PURE__ */C.string().min(1),file_name:/* @__PURE__ */C.string().nullish(),doc_format:/* @__PURE__ */C.string().nullish(),byte_size:/* @__PURE__ */C.number().int().nonnegative().nullish(),received_at:/* @__PURE__ */C.string().nullish(),download_url:on,expires_in_seconds:/* @__PURE__ */C.number().int().nonnegative().nullish()}),sn=/* @__PURE__ */C.object({items:/* @__PURE__ */C.array(/* @__PURE__ */C.unknown()).optional()});function dn(e){let t=sn.safeParse(e);if(!t.success)return null;let r=[];for(let e of t.data.items??[]){let t=ln.safeParse(e);t.success&&r.push(
|
|
13
13
|
/* @__PURE__ */Object.freeze({sourceDocId:t.data.source_doc_id,fileName:t.data.file_name??null,docFormat:t.data.doc_format??null,byteSize:t.data.byte_size??null,receivedAt:t.data.received_at??null,downloadUrl:t.data.download_url,expiresInSeconds:t.data.expires_in_seconds??0}))}/* @__PURE__ */
|
|
14
|
-
return Object.freeze(r)}var
|
|
15
|
-
return Object.freeze({features:/* @__PURE__ */Object.freeze({...t.data.features}),uploadContentTypes:/* @__PURE__ */Object.freeze([
|
|
16
|
-
return Object.freeze({petRef:e,available:false,withheld:t,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,e){let t=
|
|
17
|
-
return Object.freeze({petRef:r,available:true,withheld:false,labResults:/* @__PURE__ */Object.freeze((i.lab_results??[]).map(e=>/* @__PURE__ */Object.freeze({markerId:e.marker_id,name:e.name,loincCode:e.loinc_code??null,unit:e.unit??null,panel:e.panel??null,meaning:e.meaning??null,latest:/* @__PURE__ */Object.freeze({at:e.latest?.at??null,value:e.latest?.value??null,unit:e.latest?.unit??null,qualitativeResult:e.latest?.qualitative_result??null,status:e.latest?.status??null}),trajectory:e.trajectory??null,points:/* @__PURE__ */Object.freeze((e.points??[]).map(a))}))),encounters:/* @__PURE__ */Object.freeze((i.encounters??[]).map(e=>/* @__PURE__ */Object.freeze({encounterId:e.encounter_id,date:e.date??null,type:e.type??null,clinicName:e.clinic_name??null,veterinarian:e.veterinarian??null,docId:e.doc_id??null}))),clinicianNotes:/* @__PURE__ */Object.freeze((i.clinician_notes??[]).map(e=>/* @__PURE__ */Object.freeze({noteId:e.note_id,encounterId:e.encounter_id??null,observedOn:e.observed_on??null,sections:/* @__PURE__ */Object.freeze((e.sections??[]).map(e=>/* @__PURE__ */Object.freeze({section:e.section,text:e.text})))}))),physicalExams:/* @__PURE__ */Object.freeze((i.physical_exams??[]).map(e=>/* @__PURE__ */Object.freeze({examId:e.exam_id,encounterId:e.encounter_id??null,observedOn:e.observed_on??null,docId:e.doc_id??null,systems:/* @__PURE__ */Object.freeze(Object.entries(e.systems??{}).map(([e,t])=>/* @__PURE__ */Object.freeze({system:e,findingStatus:t.finding_status??null,finding:t.finding??null})))}))),completeness:i.completeness?/* @__PURE__ */Object.freeze({hasLabHistory:i.completeness.has_lab_history===true,hasVaccinationHistory:i.completeness.has_vaccination_history===true,hasWeightHistory:i.completeness.has_weight_history===true,hasVitalsHistory:i.completeness.has_vitals_history===true,hasPhysicalExamHistory:i.completeness.has_physical_exam_history===true,hasProcedureHistory:i.completeness.has_procedure_history===true,hasGeneticHistory:i.completeness.has_genetic_history===true,hasReproductiveHistory:i.completeness.has_reproductive_history===true,hasParasitePreventionHistory:i.completeness.has_parasite_prevention_history===true,earliestRecordAt:i.completeness.earliest_record_at??null,latestRecordAt:i.completeness.latest_record_at??null,documentsIngested:i.completeness.documents_ingested??0,documentsInReview:i.completeness.documents_in_review??0,entitiesPendingReview:/* @__PURE__ */Object.freeze({...i.completeness.entities_pending_review??{}}),heldTotal:i.completeness.held_total??0}):null,conflicts:/* @__PURE__ */Object.freeze((i.conflicts??[]).map(e=>/* @__PURE__ */Object.freeze({conflictId:e.conflict_id,entityType:e.entity_type,field:e.field??null,severity:e.severity??"needs_review",candidates:/* @__PURE__ */Object.freeze((e.candidates??[]).map(e=>/* @__PURE__ */Object.freeze({value:e.value,docId:e.source_doc_id??e.doc_id??null,collectedAt:e.collected_at??null})))})))})}function
|
|
18
|
-
return Object.freeze({petRef:e,withheld:true,isEmpty:false,visits:/* @__PURE__ */Object.freeze([]),vaccines:/* @__PURE__ */Object.freeze([]),weights:/* @__PURE__ */Object.freeze([]),medications:/* @__PURE__ */Object.freeze([]),disclaimer:""})}function mapRecordsTimeline(petRef,e){let t=
|
|
19
|
-
return Object.freeze({petRef:r,withheld:false,isEmpty:a.length===0&&o.length===0&&l.length===0&&s.length===0,visits:/* @__PURE__ */Object.freeze(a),vaccines:/* @__PURE__ */Object.freeze(o),weights:/* @__PURE__ */Object.freeze(l),medications:/* @__PURE__ */Object.freeze(s),disclaimer:i.disclaimer??""})}function mapDocumentContributions(petRef,e){let t=
|
|
20
|
-
return Object.freeze({petRef:r,withheld:false,document:
|
|
14
|
+
return Object.freeze(r)}var cn=/* @__PURE__ */Object.freeze(["vet","groomer","boarding"]),un=/* @__PURE__ */C.string().min(1).refine(e=>e.startsWith("https://")),pn=/* @__PURE__ */C.string().nullish(),fn=/* @__PURE__ */C.unknown().optional(),hn=/* @__PURE__ */C.object({share_id:/* @__PURE__ */C.string().min(1),share_url:/* @__PURE__ */C.string().min(1),expires_at:pn,audience:fn}),bn=/* @__PURE__ */C.object({shares:/* @__PURE__ */C.array(/* @__PURE__ */C.object({share_id:/* @__PURE__ */C.string().min(1),expires_at:pn,created_at:pn,view_count:/* @__PURE__ */C.number().int().nonnegative().nullish(),last_viewed_at:pn,audience:fn})).optional()}),gn=/* @__PURE__ */C.object({download_url:un,expires_at:pn}),mn=/* @__PURE__ */C.object({share_id:/* @__PURE__ */C.string().min(1),expires_at:pn,audience:fn}),yn=/* @__PURE__ */C.object({audience:/* @__PURE__ */C.string().min(1),sections:/* @__PURE__ */C.array(/* @__PURE__ */C.string()),entity_types:/* @__PURE__ */C.array(/* @__PURE__ */C.string()).nullable()}),vn=254;function isShareRecipientEmail(e){let t=e.trim();return t.length>0&&t.length<=vn&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)}var _n=e=>typeof e=="string"&&cn.includes(e);function wn(e){return _n(e)?e:null}function mapShareAudiences(e){let t=C.array(yn).safeParse(e);if(!t.success)/* @__PURE__ */return Object.freeze([]);let r=/* @__PURE__ */new Set,n=[];for(let e of t.data)!_n(e.audience)||r.has(e.audience)||(r.add(e.audience),n.push(/* @__PURE__ */Object.freeze({audience:e.audience,sections:/* @__PURE__ */Object.freeze([...e.sections]),entityTypes:e.entity_types===null?null:/* @__PURE__ */Object.freeze([...e.entity_types])}))/* @__PURE__ */);return Object.freeze(n)}function resolveShareUrl(e,t){let r=e.trim();if(r.length===0)return null;let n=/^[a-z][a-z0-9+.-]*:/i.test(r)?ur(r):t!==void 0?ur(r,t):null;return n===null||n.protocol!=="https:"?null:n.href}function mapRecordShareLink(e,t){let r=hn.safeParse(e);if(!r.success)return null;let n=resolveShareUrl(r.data.share_url,t);return n===null?null:/* @__PURE__ */Object.freeze({shareId:r.data.share_id,shareUrl:n,expiresAt:r.data.expires_at??null,audience:wn(r.data.audience)})}function mapRecordShareList(e){let t=bn.safeParse(e);return t.success?/* @__PURE__ */Object.freeze((t.data.shares??[]).map(e=>/* @__PURE__ */Object.freeze({shareId:e.share_id,expiresAt:e.expires_at??null,createdAt:e.created_at??null,viewCount:e.view_count??0,lastViewedAt:e.last_viewed_at??null,audience:wn(e.audience)}))):null}function mapRecordShareEmailReceipt(e){let t=mn.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({shareId:t.data.share_id,expiresAt:t.data.expires_at??null,audience:wn(t.data.audience)}):null}function mapRecordPdfLink(e){let t=gn.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({downloadUrl:t.data.download_url,expiresAt:t.data.expires_at??null}):null}var Cn="application/pdf",xn=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/heic","image/heif"]);var kn=/* @__PURE__ */Object.freeze({features:/* @__PURE__ */Object.freeze({}),uploadContentTypes:/* @__PURE__ */Object.freeze([Cn]),shareAudiences:/* @__PURE__ */Object.freeze([])}),zn=/* @__PURE__ */C.object({features:/* @__PURE__ */C.record(/* @__PURE__ */C.boolean()),upload_content_types:/* @__PURE__ */C.array(/* @__PURE__ */C.string()).nullish(),share_audiences:/* @__PURE__ */C.unknown().optional()});function Sn(e){let t=zn.safeParse(e);if(!t.success)return kn;let r=t.data.upload_content_types??[],n=xn.filter(e=>r.includes(e));/* @__PURE__ */
|
|
15
|
+
return Object.freeze({features:/* @__PURE__ */Object.freeze({...t.data.features}),uploadContentTypes:/* @__PURE__ */Object.freeze([Cn,...n]),shareAudiences:mapShareAudiences(t.data.share_audiences)})}var On=/* @__PURE__ */C.object({signatures:/* @__PURE__ */C.array(/* @__PURE__ */C.object({signature_id:/* @__PURE__ */C.string().min(1),preview_url:/* @__PURE__ */C.string().min(1).refine(e=>e.startsWith("https://")),created_at:/* @__PURE__ */C.string().nullish()})).optional()});function mapSignatureSuggestions(e){let t=On.safeParse(e);return t.success?/* @__PURE__ */Object.freeze((t.data.signatures??[]).map(e=>/* @__PURE__ */Object.freeze({signatureId:e.signature_id,previewUrl:e.preview_url,createdAt:e.created_at??null}))):null}function jn(e){return e.code!=="conversationNotFound"?e:makeEverfurError("resourceNotFound",{retryable:false,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},...e.requestId===void 0?{}:{requestId:e.requestId},...e.reasonCode===void 0?{}:{reasonCode:e.reasonCode},...e.wireMessage===void 0?{}:{wireMessage:e.wireMessage},...e.raw===void 0?{}:{raw:e.raw}})}function Tn(e){return e.ok?e:err(jn(e.error))}function En(e){return{send:async(...t)=>Tn(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,r,n)=>e.stream(t,r,n)}}var Rn=/* @__PURE__ */C.string().nullish(),Fn=/* @__PURE__ */C.number().nullish(),In=/* @__PURE__ */C.object({at:Rn,value:Fn,unit:Rn,qualitative_result:Rn,ref_low:Fn,ref_high:Fn,status:Rn,doc_id:Rn}),Dn=/* @__PURE__ */C.object({marker_id:/* @__PURE__ */C.string(),name:/* @__PURE__ */C.string(),loinc_code:Rn,unit:Rn,panel:Rn,meaning:Rn,latest:/* @__PURE__ */C.object({at:Rn,value:Fn,unit:Rn,qualitative_result:Rn,status:Rn}).nullish(),trajectory:Rn,points:/* @__PURE__ */C.array(In).optional()}),Bn=/* @__PURE__ */C.object({encounter_id:/* @__PURE__ */C.string(),date:Rn,type:Rn,clinic_name:Rn,veterinarian:Rn,doc_id:Rn}),Ln=/* @__PURE__ */C.object({note_id:/* @__PURE__ */C.string(),encounter_id:Rn,observed_on:Rn,sections:/* @__PURE__ */C.array(/* @__PURE__ */C.object({section:/* @__PURE__ */C.string(),text:/* @__PURE__ */C.string()})).optional()}),Hn=/* @__PURE__ */C.object({exam_id:/* @__PURE__ */C.string(),encounter_id:Rn,observed_on:Rn,doc_id:Rn,systems:/* @__PURE__ */C.record(/* @__PURE__ */C.object({finding_status:Rn,finding:Rn})).optional()}),An=/* @__PURE__ */C.object({has_lab_history:/* @__PURE__ */C.boolean().optional(),has_vaccination_history:/* @__PURE__ */C.boolean().optional(),has_weight_history:/* @__PURE__ */C.boolean().optional(),has_vitals_history:/* @__PURE__ */C.boolean().optional(),has_physical_exam_history:/* @__PURE__ */C.boolean().optional(),has_procedure_history:/* @__PURE__ */C.boolean().optional(),has_genetic_history:/* @__PURE__ */C.boolean().optional(),has_reproductive_history:/* @__PURE__ */C.boolean().optional(),has_parasite_prevention_history:/* @__PURE__ */C.boolean().optional(),earliest_record_at:Rn,latest_record_at:Rn,documents_ingested:/* @__PURE__ */C.number().int().nonnegative().optional(),documents_in_review:/* @__PURE__ */C.number().int().nonnegative().optional(),entities_pending_review:/* @__PURE__ */C.record(/* @__PURE__ */C.number().int().nonnegative()).optional(),held_total:/* @__PURE__ */C.number().int().nonnegative().optional()}),Nn=/* @__PURE__ */C.object({conflict_id:/* @__PURE__ */C.string(),entity_type:/* @__PURE__ */C.string(),field:Rn,severity:Rn,candidates:/* @__PURE__ */C.array(/* @__PURE__ */C.object({value:/* @__PURE__ */C.string(),source_doc_id:Rn,doc_id:Rn,collected_at:Rn})).optional()}),Pn=/* @__PURE__ */C.object({lab_results:/* @__PURE__ */C.array(Dn).optional(),encounters:/* @__PURE__ */C.array(Bn).optional(),clinician_notes:/* @__PURE__ */C.array(Ln).optional(),physical_exams:/* @__PURE__ */C.array(Hn).optional(),completeness:/* @__PURE__ */An.nullish(),conflicts:/* @__PURE__ */C.array(Nn).optional()}),Mn=/* @__PURE__ */C.object({visits:/* @__PURE__ */C.array(/* @__PURE__ */C.object({visit_id:/* @__PURE__ */C.string(),visit_date:Rn,veterinarian:Rn,summary:Rn,doc_id:Rn})),vaccines:/* @__PURE__ */C.array(/* @__PURE__ */C.object({vaccine_id:/* @__PURE__ */C.string(),product:Rn,lot:Rn,administered_on:Rn,expires_on:Rn,doc_id:Rn})),weights:/* @__PURE__ */C.array(/* @__PURE__ */C.object({weight_id:/* @__PURE__ */C.string(),observed_on:Rn,weight_kg:Fn,doc_id:Rn})),medications:/* @__PURE__ */C.array(/* @__PURE__ */C.object({medication_id:/* @__PURE__ */C.string(),drug_name:Rn,dose:Rn,route:Rn,frequency:Rn,sig:Rn,rx_number:Rn,started_on:Rn,stopped_on:Rn,doc_id:Rn})),disclaimer:/* @__PURE__ */C.string().optional()}),$n=/* @__PURE__ */C.object({document:Gr,contributions:/* @__PURE__ */C.array(Ur),contribution_count:/* @__PURE__ */C.number().int().nonnegative().optional()});function qn(e,petRef){return typeof e.pet_ref=="string"&&e.pet_ref.length>0?e.pet_ref:petRef}function Wn(e,t){/* @__PURE__ */
|
|
16
|
+
return Object.freeze({petRef:e,available:false,withheld:t,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,e){let t=Mr(e)?e:{},r=qn(t,petRef);if(t.withheld===true)return Wn(r,true);if(!["lab_results","encounters","clinician_notes","physical_exams","completeness","conflicts"].some(e=>e in t))return Wn(r,false);let n=Pn.safeParse(t);if(!n.success)return Wn(r,true);let i=n.data,a=e=>/* @__PURE__ */Object.freeze({at:e.at??null,value:e.value??null,unit:e.unit??null,qualitativeResult:e.qualitative_result??null,refLow:e.ref_low??null,refHigh:e.ref_high??null,status:e.status??null,docId:e.doc_id??null});/* @__PURE__ */
|
|
17
|
+
return Object.freeze({petRef:r,available:true,withheld:false,labResults:/* @__PURE__ */Object.freeze((i.lab_results??[]).map(e=>/* @__PURE__ */Object.freeze({markerId:e.marker_id,name:e.name,loincCode:e.loinc_code??null,unit:e.unit??null,panel:e.panel??null,meaning:e.meaning??null,latest:/* @__PURE__ */Object.freeze({at:e.latest?.at??null,value:e.latest?.value??null,unit:e.latest?.unit??null,qualitativeResult:e.latest?.qualitative_result??null,status:e.latest?.status??null}),trajectory:e.trajectory??null,points:/* @__PURE__ */Object.freeze((e.points??[]).map(a))}))),encounters:/* @__PURE__ */Object.freeze((i.encounters??[]).map(e=>/* @__PURE__ */Object.freeze({encounterId:e.encounter_id,date:e.date??null,type:e.type??null,clinicName:e.clinic_name??null,veterinarian:e.veterinarian??null,docId:e.doc_id??null}))),clinicianNotes:/* @__PURE__ */Object.freeze((i.clinician_notes??[]).map(e=>/* @__PURE__ */Object.freeze({noteId:e.note_id,encounterId:e.encounter_id??null,observedOn:e.observed_on??null,sections:/* @__PURE__ */Object.freeze((e.sections??[]).map(e=>/* @__PURE__ */Object.freeze({section:e.section,text:e.text})))}))),physicalExams:/* @__PURE__ */Object.freeze((i.physical_exams??[]).map(e=>/* @__PURE__ */Object.freeze({examId:e.exam_id,encounterId:e.encounter_id??null,observedOn:e.observed_on??null,docId:e.doc_id??null,systems:/* @__PURE__ */Object.freeze(Object.entries(e.systems??{}).map(([e,t])=>/* @__PURE__ */Object.freeze({system:e,findingStatus:t.finding_status??null,finding:t.finding??null})))}))),completeness:i.completeness?/* @__PURE__ */Object.freeze({hasLabHistory:i.completeness.has_lab_history===true,hasVaccinationHistory:i.completeness.has_vaccination_history===true,hasWeightHistory:i.completeness.has_weight_history===true,hasVitalsHistory:i.completeness.has_vitals_history===true,hasPhysicalExamHistory:i.completeness.has_physical_exam_history===true,hasProcedureHistory:i.completeness.has_procedure_history===true,hasGeneticHistory:i.completeness.has_genetic_history===true,hasReproductiveHistory:i.completeness.has_reproductive_history===true,hasParasitePreventionHistory:i.completeness.has_parasite_prevention_history===true,earliestRecordAt:i.completeness.earliest_record_at??null,latestRecordAt:i.completeness.latest_record_at??null,documentsIngested:i.completeness.documents_ingested??0,documentsInReview:i.completeness.documents_in_review??0,entitiesPendingReview:/* @__PURE__ */Object.freeze({...i.completeness.entities_pending_review??{}}),heldTotal:i.completeness.held_total??0}):null,conflicts:/* @__PURE__ */Object.freeze((i.conflicts??[]).map(e=>/* @__PURE__ */Object.freeze({conflictId:e.conflict_id,entityType:e.entity_type,field:e.field??null,severity:e.severity??"needs_review",candidates:/* @__PURE__ */Object.freeze((e.candidates??[]).map(e=>/* @__PURE__ */Object.freeze({value:e.value,docId:e.source_doc_id??e.doc_id??null,collectedAt:e.collected_at??null})))})))})}function Un(e){/* @__PURE__ */
|
|
18
|
+
return Object.freeze({petRef:e,withheld:true,isEmpty:false,visits:/* @__PURE__ */Object.freeze([]),vaccines:/* @__PURE__ */Object.freeze([]),weights:/* @__PURE__ */Object.freeze([]),medications:/* @__PURE__ */Object.freeze([]),disclaimer:""})}function mapRecordsTimeline(petRef,e){let t=Mr(e)?e:{},r=qn(t,petRef);if(t.withheld===true)return Un(r);let n=Mn.safeParse(t);if(!n.success)return Un(r);let i=n.data,a=i.visits.map(e=>/* @__PURE__ */Object.freeze({visitId:e.visit_id,visitDate:e.visit_date??null,veterinarian:e.veterinarian??null,summary:e.summary??null,docId:e.doc_id??null})),o=i.vaccines.map(e=>/* @__PURE__ */Object.freeze({vaccineId:e.vaccine_id,product:e.product??null,lot:e.lot??null,administeredOn:e.administered_on??null,expiresOn:e.expires_on??null,docId:e.doc_id??null})),l=i.weights.map(e=>/* @__PURE__ */Object.freeze({weightId:e.weight_id,observedOn:e.observed_on??null,weightKg:e.weight_kg??null,docId:e.doc_id??null})),s=i.medications.map(e=>/* @__PURE__ */Object.freeze({medicationId:e.medication_id,drugName:e.drug_name??null,dose:e.dose??null,route:e.route??null,frequency:e.frequency??null,sig:e.sig??null,rxNumber:e.rx_number??null,startedOn:e.started_on??null,stoppedOn:e.stopped_on??null,docId:e.doc_id??null}));/* @__PURE__ */
|
|
19
|
+
return Object.freeze({petRef:r,withheld:false,isEmpty:a.length===0&&o.length===0&&l.length===0&&s.length===0,visits:/* @__PURE__ */Object.freeze(a),vaccines:/* @__PURE__ */Object.freeze(o),weights:/* @__PURE__ */Object.freeze(l),medications:/* @__PURE__ */Object.freeze(s),disclaimer:i.disclaimer??""})}function mapDocumentContributions(petRef,e){let t=Mr(e)?e:{},r=qn(t,petRef),n=()=>/* @__PURE__ */Object.freeze({petRef:r,withheld:true,document:null,contributions:/* @__PURE__ */Object.freeze([]),contributionCount:0});if(t.withheld===true)return n();let i=$n.safeParse(t);if(!i.success)return n();let a=/* @__PURE__ */Object.freeze(i.data.contributions.map(Vr));/* @__PURE__ */
|
|
20
|
+
return Object.freeze({petRef:r,withheld:false,document:Kr(i.data.document),contributions:a,contributionCount:i.data.contribution_count??a.length})}var Gn="/widget/v1/records/pets";function createRecordsDepthClient(e){let t=En(e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})),r=(e,t)=>typeof e=="string"&&e.length>0&&!Pr(e)&&[...e].length<=t,n=async(e,petRef,n,i)=>{if(!r(petRef,an))return Vn();let a=await t.send(e,{method:"GET",path:n});if(!a.ok)return a;let o=i(a.value);return o.petRef===petRef?ok(o):err(makeEverfurError("internalError",{retryable:false}))},i=petRef=>`${Gn}/${encodeURIComponent(petRef)}`,a=petRef=>`${i(petRef)}/everfur_record`,o=async(e,r,n)=>{let i=await t.send(e,r,r.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!i.ok)return i;let a=n(i.value);return a===null?err(makeEverfurError("internalError",{retryable:false})):ok(a)},l=(e,t)=>!r(e.entityType,$r)||!r(e.canonicalKey,qr)||e.idempotencyKey!==void 0&&!r(e.idempotencyKey,nn)||t!==void 0&&Object.keys(t).length===0?null:{entity_type:e.entityType,canonical_key:e.canonicalKey,...t!==void 0?{corrected_fields:t}:{},...e.idempotencyKey!==void 0?{idempotency_key:e.idempotencyKey}:{}};return{getRecordDepth:petRef=>n("records.depth.record",petRef,`${i(petRef)}/record`,e=>mapRecordDepth(petRef,e)),getTimeline:petRef=>n("records.depth.timeline",petRef,`${i(petRef)}/timeline`,e=>mapRecordsTimeline(petRef,e)),getDocumentContributions(petRef,e){return r(e,64)?n("records.depth.contributions",petRef,`${i(petRef)}/documents/${encodeURIComponent(e)}/contributions`,e=>mapDocumentContributions(petRef,e)):Vn()},getMarkers:petRef=>n("records.depth.markers",petRef,`${i(petRef)}/markers`,e=>mapRecordMarkers(petRef,e)),createShare(petRef,t){if(!r(petRef,an))return Vn();let n=t?.audience;return n!==void 0&&!cn.includes(n)?Vn():o("records.share.create",{method:"POST",path:`${a(petRef)}/share`,...n!==void 0?{body:{audience:n}}:{}},t=>mapRecordShareLink(t,e.apiBaseUrl))},emailShare(petRef,e){let t=e.recipientKind,n=typeof e.recipientEmail=="string"?e.recipientEmail.trim():"",i=t==="other"||cn.includes(t);return!r(petRef,an)||!i||!isShareRecipientEmail(n)||Pr(n)?Vn():o("records.share.email",{method:"POST",path:`${a(petRef)}/share/email`,body:{recipient_email:n,recipient_kind:t}},mapRecordShareEmailReceipt)},async readFeatures(){try{let e=await t.send("records.getFeatures",{method:"GET",path:"/widget/v1/records/features"});return e.ok?Sn(e.value):kn}catch{return kn}},listShares(petRef){return r(petRef,an)?o("records.share.list",{method:"GET",path:`${a(petRef)}/shares`},mapRecordShareList):Vn()},async revokeShare(petRef,e){if(!r(petRef,an)||!r(e,64))return Vn();let n=await t.send("records.share.revoke",{method:"DELETE",path:`${a(petRef)}/shares/${encodeURIComponent(e)}`},{idempotent:false,maxAttempts:1});return n.ok?ok(void 0):n},getPdfLink(petRef){return r(petRef,an)?o("records.pdf.link",{method:"GET",path:`${a(petRef)}/pdf-link`},mapRecordPdfLink):Vn()},async editFact(petRef,e){let n=r(petRef,an)?l(e,e.correctedFields):null;if(n===null)return Vn();let i=await t.send("records.fact.edit",{method:"POST",path:`${a(petRef)}/facts/edit`,body:n},{idempotent:false,maxAttempts:1});return i.ok?ok(void 0):i},async removeFact(petRef,e){let n=r(petRef,an)?l(e):null;if(n===null)return Vn();let i=await t.send("records.fact.remove",{method:"POST",path:`${a(petRef)}/facts/remove`,body:n},{idempotent:false,maxAttempts:1});return i.ok?ok(void 0):i},listRequestDocuments(e){return r(e,64)?o("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(e)}/documents`},dn):Vn()},listAuthorizationSignatures:()=>o("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},mapSignatureSuggestions)}}function Vn(){return Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false})))}var Kn=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),Yn=globalThis,Qn=Yn[Kn]??(Yn[Kn]=createContext(null));Qn.displayName??="EverfurContext";function Xn(){let e=l(Qn);if(e===null)throw new tr("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}var Zn=/* @__PURE__ */new Map,Jn=/* @__PURE__ */new Set;function ei(petRef){return Zn.get(petRef)??0}function ti(e){return Jn.add(e),()=>{Jn.delete(e)}}function ri(petRef){let e=a(()=>ei(petRef),[petRef]);return s(ti,e,e)}function useEverfurRecordsDepthClient(){let{runtime:e,userRef:userRef,scopeEpoch:t}=Xn();return r(()=>{let{services:t}=e.registry;return createRecordsDepthClient({auth:t.authFor(userRef),...t.errorPolicy?{errorPolicy:t.errorPolicy}:{},...typeof t.apiBaseUrl=="string"?{apiBaseUrl:t.apiBaseUrl}:{}})},[e,userRef,t])}function useRecordsDepthRead(petRef,e,t,l=""){let s=useEverfurRecordsDepthClient(),{userRef:userRef}=Xn(),d=ri(petRef),c=r(()=>({}),[s,petRef,l,d]),[u,p]=n({scope:c,value:null,error:null,loading:true}),f=i(0),h=a(async()=>{let t=f.current+=1;if(p({scope:c,value:null,error:null,loading:true}),userRef===null){p({scope:c,value:null,error:null,loading:false});return}let r=await e(s,petRef);t===f.current&&(r.ok?p({scope:c,value:r.value,error:null,loading:false}):p({scope:c,value:null,error:r.error,loading:false}))},[s,petRef,e,c,userRef]);o(()=>(h(),()=>{f.current+=1}),[h]);let b=u.scope===c?u:{value:null,error:null,loading:true},g=a(()=>{h()},[h]),m=b.error===null||b.error.httpStatus!==404,y=m?b.error:null,v=b.loading?"loading":y!==null?"error":b.value===null?"empty":b.value.withheld?"populated":t(b.value)?"empty":"populated";return r(()=>({status:v,value:b.value,error:y,available:m,refresh:g}),[v,b.value,y,m,g])}var ni=class extends d{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:e,fallback:r,resetKey:n}){return t(ni,{fallback:r,resetKey:n,children:t(RenderHost,{render:e})})}var ii=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(e){return ii[e]}function decideCapability(e,t,r){let n=requires(e),i=/* @__PURE__ */new Map;for(let e of t)i.set(e.resource,e);if(r?.isPending===true&&n.some(e=>!i.has(e)))return li({name:e,enabled:false,isPending:true,limits:{}});let a=ai(n,i);return n.filter(e=>i.get(e)?.granted!==true).length===0?li({name:e,enabled:true,isPending:false,limits:a}):li({name:e,enabled:false,isPending:false,limits:a,disabled:oi(n,i)})}function ai(e,t){let r={};for(let n of e){let e=t.get(n)?.limits;if(e)for(let[t,n]of Object.entries(e)){let e=r[t];r[t]=e===void 0?n:Math.min(e,n)}}return r}function oi(e,t){for(let r of e){let e=t.get(r)?.disabled;if(e)/* @__PURE__ */
|
|
21
21
|
return Object.freeze({reason:e.reason,level:e.level,recoverable:e.recoverable})}/* @__PURE__ */
|
|
22
|
-
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function
|
|
23
|
-
return
|
|
24
|
-
return
|
|
25
|
-
return
|
|
26
|
-
return
|
|
27
|
-
return
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
return
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
return
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
return
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
return
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
return
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
return
|
|
54
|
-
return
|
|
55
|
-
return
|
|
56
|
-
return
|
|
57
|
-
return
|
|
58
|
-
return
|
|
59
|
-
return
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
return
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
return
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
return
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
return
|
|
73
|
-
return
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
return
|
|
83
|
-
return
|
|
84
|
-
return
|
|
85
|
-
return
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
return
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
return
|
|
97
|
-
return
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
return
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
return
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
return
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
return
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
22
|
+
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function li(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:/* @__PURE__ */Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),/* @__PURE__ */Object.freeze(t)}function useCapability(e){let{runtime:t}=Xn(),n=t.entitlements,i=s(n.subscribe,n.getSnapshot,n.getSnapshot);return r(()=>decideCapability(e,i.decisions,{isPending:i.isPending}),[e,i])}var si=48;function di(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(e){let{capability:t,children:n,renderDisabled:i,renderPending:a,style:o}=e,l=useCapability(t),s=r(()=>di(l),[l]);switch(s){case"enabled":return n;case"pending":return a?/* @__PURE__ */v(HostRender,{render:a,fallback:/* @__PURE__ */v(PendingSkeleton,{capability:t,style:o})}):/* @__PURE__ */v(PendingSkeleton,{capability:t,style:o});case"disabled":return i?/* @__PURE__ */v(HostRender,{render:()=>i(l),fallback:/* @__PURE__ */v(OffState,{decision:l,style:o}),resetKey:l}):/* @__PURE__ */v(OffState,{decision:l,style:o});default:return assertNever(s)}}function PendingSkeleton({capability:e,style:t}){let n=useEverfurTheme(),i=r(()=>ci(n),[n]);/* @__PURE__ */
|
|
23
|
+
return v(p,{style:[i.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:/* @__PURE__ */v(p,{style:i.skeletonBar})})}function OffState({decision:e,style:t}){let n=useEverfurTheme(),i=r(()=>ci(n),[n]),a=e.disabled?.reason??"";/* @__PURE__ */
|
|
24
|
+
return v(p,{style:[i.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:a,children:a.length>0?/* @__PURE__ */v(Text,{style:i.offstateText,children:a}):null})}function ci(e){let{color:t,space:r,radius:n,type:i}=e;return b.create({offstate:{minHeight:si,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:b.hairlineWidth,borderColor:t.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}function RecordsFootnote(e){let t=useEverfurTheme(),n=r(()=>ui(t),[t]);/* @__PURE__ */
|
|
25
|
+
return v(Text,{style:[n.footnote,e.style],accessibilityRole:"text",testID:"records-footnote",children:et})}function ui(e){let{color:t,space:r,type:n}=e;return b.create({footnote:{...face(e,"regular"),paddingHorizontal:r.lg,paddingTop:r.md,paddingBottom:r.lg,textAlign:"center",fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.normal),color:t.text.muted,backgroundColor:t.background}})}var pi=/* @__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"})}),fi=60;function hi(e){return`Try again in ${e}s`}var bi="Try again, available shortly";var gi={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function mi(e){return{width:e,height:e,alignItems:"center",justifyContent:"center"}}function yi(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}var vi={down:{rotate:"45deg",marginTop:-.4,marginLeft:0},up:{rotate:"225deg",marginTop:.4,marginLeft:0},right:{rotate:"-45deg",marginTop:0,marginLeft:-.4}};function ChevronGlyph({size:e,color:t,strokeWidth:r,direction:n}){let i=yi(e,r),a=e*.46,o=vi[n];/* @__PURE__ */
|
|
26
|
+
return v(p,{style:mi(e),...gi,children:/* @__PURE__ */v(p,{style:{width:a,height:a,borderRightWidth:i,borderBottomWidth:i,borderColor:t,marginTop:a*o.marginTop,marginLeft:a*o.marginLeft,transform:[{rotate:o.rotate}]}})})}function SearchGlyph({size:e,color:t,strokeWidth:r}){let n=yi(e,r),i=e/24,a=16*i+n,o=11*i-a/2,l=11+8/Math.SQRT2,s=(21-l)*Math.SQRT2*i,d=(l+21)/2*i;/* @__PURE__ */
|
|
27
|
+
return _(p,{style:mi(e),...gi,children:[
|
|
28
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:o,left:o,width:a,height:a,borderRadius:a,borderWidth:n,borderColor:t}}),
|
|
29
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:d-n/2,left:d-(s+n)/2,width:s+n,height:n,borderRadius:n,backgroundColor:t,transform:[{rotate:"45deg"}]}})]})}var _i={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function wi(e){return{width:e,height:e,alignItems:"center",justifyContent:"center"}}function Ci(e){return Math.max(1.5,Math.round(e/11*10)/10)}function xi(e,t,r,n,i=0){return{position:"absolute",top:n.top-t/2,left:n.left-r/2,width:r,height:t,borderRadius:t,backgroundColor:e,transform:[{rotate:`${i}deg`}]}}function InboxGlyph({size:e,color:t}){let r=Ci(e);/* @__PURE__ */
|
|
30
|
+
return _(p,{style:wi(e),..._i,children:[
|
|
31
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:e*.2,left:e*.06,width:e*.88,height:e*.66,borderWidth:r,borderColor:t,borderRadius:e*.12}}),
|
|
32
|
+
/* @__PURE__ */v(p,{style:xi(t,r,e*.26,{top:e*.54,left:e*.2})}),
|
|
33
|
+
/* @__PURE__ */v(p,{style:xi(t,r,e*.26,{top:e*.54,left:e*.8})}),
|
|
34
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:e*.54-r/2,left:e*.34,width:e*.32,height:e*.14,borderBottomWidth:r,borderLeftWidth:r,borderRightWidth:r,borderColor:t,borderBottomLeftRadius:r,borderBottomRightRadius:r}})]})}function ActivityGlyph({size:e,color:t}){let r=Ci(e),n=e*.5;/* @__PURE__ */
|
|
35
|
+
return _(p,{style:wi(e),..._i,children:[
|
|
36
|
+
/* @__PURE__ */v(p,{style:xi(t,r,e*.24,{top:n,left:e*.12})}),
|
|
37
|
+
/* @__PURE__ */v(p,{style:xi(t,r,e*.42,{top:e*.32,left:e*.32},-68)}),
|
|
38
|
+
/* @__PURE__ */v(p,{style:xi(t,r,e*.62,{top:e*.5,left:e*.5},72)}),
|
|
39
|
+
/* @__PURE__ */v(p,{style:xi(t,r,e*.42,{top:e*.68,left:e*.68},-68)}),
|
|
40
|
+
/* @__PURE__ */v(p,{style:xi(t,r,e*.14,{top:n,left:e*.9})})]})}function ClockGlyph({size:e,color:t}){let r=Ci(e),n=e/2;/* @__PURE__ */
|
|
41
|
+
return _(p,{style:wi(e),..._i,children:[
|
|
42
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:e*.04,left:e*.04,width:e*.92,height:e*.92,borderRadius:e,borderWidth:r,borderColor:t}}),
|
|
43
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:e*.24,left:n-r/2,width:r,height:n-e*.24+r/2,borderRadius:r,backgroundColor:t}}),
|
|
44
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:n-r/2,left:n-r/2,width:e*.22,height:r,borderRadius:r,backgroundColor:t}})]})}function ToolGlyph({size:e,color:t}){let r=Ci(e),n=e*.42;/* @__PURE__ */
|
|
45
|
+
return _(p,{style:wi(e),..._i,children:[
|
|
46
|
+
/* @__PURE__ */v(p,{style:xi(t,r*1.2,e*.62,{top:e*.62,left:e*.38},-45)}),
|
|
47
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:e*.06,right:e*.06,width:n,height:n,borderRadius:n,borderWidth:r,borderColor:t,borderTopColor:"transparent",transform:[{rotate:"45deg"}]}})]})}function WifiOffGlyph({size:e,color:t}){let r=Ci(e),n=(n,i)=>({position:"absolute",top:e*i,left:(e-n)/2,width:n,height:n,borderRadius:n,borderWidth:r,borderColor:"transparent",borderTopColor:t});/* @__PURE__ */
|
|
48
|
+
return _(p,{style:wi(e),..._i,children:[
|
|
49
|
+
/* @__PURE__ */v(p,{style:n(e*.96,.12)}),
|
|
50
|
+
/* @__PURE__ */v(p,{style:n(e*.56,.38)}),
|
|
51
|
+
/* @__PURE__ */v(p,{style:{position:"absolute",top:e*.78,left:e/2-r,width:r*2,height:r*2,borderRadius:r,backgroundColor:t}}),
|
|
52
|
+
/* @__PURE__ */v(p,{style:xi(t,r,e*1.1,{top:e/2,left:e/2},45)})]})}function RecordsEmptyGlyph({variant:e,size:t,color:r}){switch(e){case"idle":/* @__PURE__ */
|
|
53
|
+
return v(SearchGlyph,{size:t,color:r});case"no_requests":/* @__PURE__ */
|
|
54
|
+
return v(InboxGlyph,{size:t,color:r});case"no_records":/* @__PURE__ */
|
|
55
|
+
return v(ActivityGlyph,{size:t,color:r});case"rate_limited":/* @__PURE__ */
|
|
56
|
+
return v(ClockGlyph,{size:t,color:r});case"service_unavailable":/* @__PURE__ */
|
|
57
|
+
return v(ToolGlyph,{size:t,color:r});case"error":/* @__PURE__ */
|
|
58
|
+
return v(WifiOffGlyph,{size:t,color:r});default:return null}}function RecordsEmptyState({variant:e,onAction:t,message:r,testID:i}){let a=ki(),l=useEverfurTheme(),s=pi[e],[d,c]=n(e==="rate_limited"?fi:0);o(()=>{e==="rate_limited"&&c(fi)},[e]),o(()=>{if(d<=0)return;let e=setTimeout(()=>c(e=>Math.max(0,e-1)),1e3);return()=>clearTimeout(e)},[d]);let u=e==="rate_limited"&&d>0,f=u?hi(d):s.action;/* @__PURE__ */
|
|
59
|
+
return _(p,{style:a.container,accessibilityRole:"summary",testID:i,children:[
|
|
60
|
+
/* @__PURE__ */v(p,{style:a.glyph,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:"records-empty-glyph",children:/* @__PURE__ */v(RecordsEmptyGlyph,{variant:e,size:zi,color:l.color.brandInk})}),
|
|
61
|
+
/* @__PURE__ */v(Text,{style:a.title,children:s.title}),
|
|
62
|
+
/* @__PURE__ */v(Text,{style:a.body,children:r??s.body}),f!==null&&t?/* @__PURE__ */v(g,{onPress:t,disabled:u,accessibilityRole:"button",accessibilityLabel:u?bi:f,accessibilityState:{disabled:u},style:[a.action,u?a.actionDisabled:null],testID:i?`${i}-action`:`records-empty-${e}-action`,children:/* @__PURE__ */v(Text,{style:a.actionLabel,children:f})}):null]})}function ki(){let e=useEverfurTheme();return r(()=>Oi(e),[e])}var zi=22,Si=48;function Oi(e){let{color:t,space:r,radius:n,type:i,slots:a}=e;return b.create({container:{paddingVertical:r.xxl,paddingHorizontal:r.xl,alignItems:"center",gap:r.sm+r.xs/2},glyph:{width:Si,height:Si,alignItems:"center",justifyContent:"center",marginBottom:r.xs},title:{...headingFace(e,"bold"),fontSize:i.size.subtitle,lineHeight:Math.round(i.size.subtitle*i.lineHeight.snug)-1,color:t.brandInk,textAlign:"center"},body:{...face(e,"regular"),fontSize:i.size.bodyTight,lineHeight:Math.round(i.size.bodyTight*i.lineHeight.normal),color:t.text.muted,textAlign:"center",maxWidth:320},action:{marginTop:r.sm,minHeight:r.xxl+r.sm,borderRadius:n.pill,paddingHorizontal:r.lg+r.xs/2,backgroundColor:t.brand,alignItems:"center",justifyContent:"center",...x(a.primaryButton)},actionDisabled:{opacity:.5},actionLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:i.size.bodyTight,lineHeight:Math.round(i.size.bodyTight*i.lineHeight.snug)-1,...k(a.primaryButton)}})}var ji=120,Ti=44;function RecordsGateOffState({reason:e,onExit:t,exitLabel:r,style:n}){let{color:i,space:a,radius:o,type:l}=useEverfurTheme();/* @__PURE__ */
|
|
63
|
+
return _(p,{testID:"records-gate-off",style:[{minHeight:ji,justifyContent:"center",gap:a.md,padding:a.lg,borderRadius:o.md,borderWidth:1,borderColor:i.brandBorder,backgroundColor:i.surfaceCream},n],children:[e.length>0?/* @__PURE__ */v(Text,{style:{fontSize:l.size.bodyTight,color:i.text.muted},children:e}):null,
|
|
64
|
+
/* @__PURE__ */v(g,{onPress:t,accessibilityRole:"button",accessibilityLabel:r,testID:"records-gate-off-exit",style:{minHeight:Ti,alignSelf:"flex-start",justifyContent:"center",paddingHorizontal:a.lg,borderRadius:o.pill,borderWidth:1.5,borderColor:i.brandInk},children:/* @__PURE__ */v(Text,{style:{fontSize:l.size.body,color:i.brandInk},children:r})})]})}function Ei(e,t){return e===void 0?{}:{renderDisabled:r=>/* @__PURE__ */v(RecordsGateOffState,{reason:r.disabled?.reason??"",onExit:e,exitLabel:t})}}var Ri=/* @__PURE__ */Object.freeze({note:"Test account: clinics are never contacted. Use records test mode to move a request forward.",clinicNotContacted:"Clinic not contacted",notEmailed:e=>`This is a test account, so no email went to ${e}.`,newClinicDirectSendNote:"This is a test account, so this clinic will not be emailed."});var NO_SUBSCRIPTION=()=>()=>{};function Fi(e){return e?.livemode===false}function Ii(){try{return Xn().runtime.entitlements??null}catch{return null}}function Di(){let e=Ii(),t=a(t=>e===null?NO_SUBSCRIPTION():e.subscribe(t),[e]),r=a(()=>e===null?false:Fi(e.getSnapshot()),[e]);return s(t,r,r)}function Bi(e){let[t,r]=n(null);return{shown:e!==null&&t!==e,onError:()=>r(e)}}function BrandLogo({logoUrl:e,name:t,barStyle:r,logoStyle:n,testID:i}){let a=Bi(e);return e===null||!a.shown?null:/* @__PURE__ */v(p,{style:r,...i===void 0?{}:{testID:i},children:/* @__PURE__ */v(y,{source:{uri:e},style:n,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:a.onError})})}var Li="Back";function RecordsPushHeader({title:e,onBack:t,right:n,testID:i,look:a}){let o=useEverfurTheme(),l=r(()=>a===void 0?recordsSheetLook(o):null,[a,o]),s=a??l,d=o.slots.header,c=d?.textColor??(s.dark?s.text:je.topInk),u=Re(".ph-back","width"),f=Re(".ph-head","paddingLeft"),h={minWidth:u+Re(".ph-back","marginLeft"),flexShrink:0};/* @__PURE__ */
|
|
65
|
+
return _(p,{style:{minHeight:Re(".ph-head","height"),paddingHorizontal:f,flexDirection:"row",alignItems:"center",gap:8,backgroundColor:s.paper,...x(d)},testID:i,children:[
|
|
66
|
+
/* @__PURE__ */v(p,{style:[h,{alignItems:"flex-start"}],children:t!==void 0?/* @__PURE__ */v(g,{onPress:t,accessibilityRole:"button",accessibilityLabel:Li,hitSlop:6,style:{width:u,height:u,marginLeft:Re(".ph-back","marginLeft"),alignItems:"center",justifyContent:"center"},testID:i!==void 0?`${i}-back`:void 0,children:/* @__PURE__ */v(p,{style:{transform:[{scaleX:-1}]},accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */v(ChevronGlyph,{size:Re(".ph-back svg","width"),color:c,direction:"right"})})}):null}),e.trim().length>0?/* @__PURE__ */v(Text,{accessibilityRole:"header",numberOfLines:1,tier:"heading",style:{...face(o,"bold"),flex:1,minWidth:0,textAlign:"center",fontSize:Re(".ph-title","fontSize"),lineHeight:Re(".ph-title","fontSize")*1.2,color:c},children:e}):/* @__PURE__ */v(p,{style:{flex:1},accessibilityElementsHidden:true,importantForAccessibility:"no",testID:i!==void 0?`${i}-spacer`:void 0}),
|
|
67
|
+
/* @__PURE__ */v(p,{style:[h,{flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:4}],children:n})]})}var Hi=28,Ai=160,Ni="Back";function ScreenHeader({title:e,onBack:t,right:r,testID:n,variant:i="brand"}){let a=Pi(),o=useEverfurTheme(),l=o.meta.logoUrl,s=Pe()==="sheet"?/* @__PURE__ */v(RecordsPushHeader,{title:e,onBack:t,right:r,testID:n}):/* @__PURE__ */_(p,{style:l===null?a.row:a.rowUnderLogo,testID:n,children:[t?/* @__PURE__ */v(g,{onPress:t,accessibilityRole:"button",accessibilityLabel:Ni,hitSlop:12,style:a.back,testID:n?`${n}-back`:void 0,children:/* @__PURE__ */v(p,{style:a.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}):/* @__PURE__ */v(p,{style:a.back}),e.trim().length>0?/* @__PURE__ */v(Text,{style:i==="document"?a.documentTitle:a.title,accessibilityRole:"header",numberOfLines:1,children:e}):/* @__PURE__ */v(p,{style:a.spacer,accessibilityElementsHidden:true,importantForAccessibility:"no",testID:n?`${n}-spacer`:void 0}),
|
|
68
|
+
/* @__PURE__ */v(p,{style:a.right,children:r??/* @__PURE__ */v(p,{style:a.back})})]}),d=l===null?s:/* @__PURE__ */_(p,{style:a.bar,children:[
|
|
69
|
+
/* @__PURE__ */v(BrandLogo,{logoUrl:l,name:o.meta.displayName,barStyle:a.logoBar,logoStyle:a.logo,testID:n?`${n}-logo`:void 0}),s]});/* @__PURE__ */
|
|
70
|
+
return _(w,{children:[d,
|
|
71
|
+
/* @__PURE__ */v(SandboxNote,{})]})}function SandboxNote(){let e=Di(),t=at(),r=Pi();return e?/* @__PURE__ */v(p,{style:[t.band,r.sandboxNote],accessible:true,accessibilityRole:"text",testID:"records-sandbox-note",children:/* @__PURE__ */v(Text,{style:t.bandText,children:Ri.note})}):null}function Pi(){let e=useEverfurTheme();return r(()=>Mi(e),[e])}function Mi(e){let{color:t,space:r,type:n}=e,i=e.slots.header,a=i?.textColor??t.brandInk,o={flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:r.lg,paddingTop:r.xs,paddingBottom:r.md,gap:r.sm},l=r.xxl+r.md,s=r.md,d=r.xs/2,c=r.lg+r.xs+r.xs/2;return b.create({row:{...o,...x(i)},rowUnderLogo:o,bar:{...x(i)},logoBar:{alignItems:"center",paddingTop:r.sm,paddingHorizontal:r.lg},logo:{height:Hi,width:Ai},back:{width:l,height:l,alignItems:"center",justifyContent:"center"},chevron:{width:s,height:s,borderLeftWidth:d,borderBottomWidth:d,borderColor:a,transform:[{rotate:"45deg"}],marginLeft:r.xs},title:{flex:1,...headingFace(e,"bold"),fontSize:n.size.heading,lineHeight:Math.round(n.size.heading*n.lineHeight.tight)+1,color:a},spacer:{flex:1},sandboxNote:{marginHorizontal:r.lg,marginBottom:r.md},documentTitle:{flex:1,textAlign:"center",...headingFace(e,"bold"),fontSize:n.size.subtitle,lineHeight:Math.round(n.size.subtitle*n.lineHeight.snug),color:t.text.primary,...k(i)},right:{flexDirection:"row",alignItems:"center",gap:r.sm+r.xs/2},listGlyph:{width:c,height:c,justifyContent:"space-evenly"},listBar:{height:d,borderRadius:d,backgroundColor:a},shareGlyph:{width:c-r.xs,height:c-r.xs},shareDot:{position:"absolute",width:r.xs+r.xs/2,height:r.xs+r.xs/2,borderRadius:r.xs,borderWidth:d,borderColor:a},shareDotTop:{right:0,top:0},shareDotLeft:{left:0,top:r.xs+r.xs/2},shareDotBottom:{right:0,bottom:0},shareStroke:{position:"absolute",left:r.xs,top:r.sm,width:r.sm+r.xs/2,height:d,backgroundColor:a},shareStrokeUp:{transform:[{rotate:"-30deg"}]},shareStrokeDown:{transform:[{rotate:"30deg"}]},sendGlyph:{width:c-r.xs,height:c-r.xs},downloadGlyph:{width:c-r.xs,height:c-r.xs,alignItems:"center"},downloadStem:{width:d,height:r.sm+r.xs/2,backgroundColor:a},downloadHead:{width:r.sm,height:r.sm,borderRightWidth:d,borderBottomWidth:d,borderColor:a,transform:[{rotate:"45deg"}],marginTop:-r.sm},downloadTray:{position:"absolute",bottom:0,left:0,right:0,height:r.xs+r.xs/2,borderLeftWidth:d,borderRightWidth:d,borderBottomWidth:d,borderColor:a}})}function SkeletonBlock({width:e,height:t,radius:r,style:n}){let{color:i,radius:a}=useEverfurTheme();/* @__PURE__ */
|
|
72
|
+
return v(p,{style:[{width:e,height:t,borderRadius:r??a.xs,backgroundColor:i.skeleton},n],accessibilityElementsHidden:true,importantForAccessibility:"no"})}var $i=44,qi=24,Wi=34,Ui=6;function TimelineSkeleton({testID:e}){let t=Vi();/* @__PURE__ */
|
|
73
|
+
return _(p,{style:t.timeline,accessible:true,accessibilityRole:"progressbar",accessibilityLabel:_t.loadingTimeline,testID:e,children:[
|
|
74
|
+
/* @__PURE__ */v(p,{style:t.timelineDisclaimer,children:/* @__PURE__ */v(SkeletonBlock,{width:"100%",height:$i,radius:12})}),Array.from({length:Ui},(e,r)=>/* @__PURE__ */_(p,{children:[r>0?/* @__PURE__ */v(p,{style:t.timelineSeparator}):null,
|
|
75
|
+
/* @__PURE__ */_(p,{style:t.timelineRow,children:[
|
|
76
|
+
/* @__PURE__ */v(SkeletonBlock,{width:Wi,height:Wi,radius:Wi/2}),
|
|
77
|
+
/* @__PURE__ */_(p,{style:t.timelineBody,children:[
|
|
78
|
+
/* @__PURE__ */_(p,{style:t.timelineTop,children:[
|
|
79
|
+
/* @__PURE__ */v(SkeletonBlock,{width:44,height:10,radius:5}),
|
|
80
|
+
/* @__PURE__ */v(SkeletonBlock,{width:56,height:12,radius:6})]}),
|
|
81
|
+
/* @__PURE__ */v(SkeletonBlock,{width:"70%",height:14,radius:7}),r%2===0?/* @__PURE__ */v(SkeletonBlock,{width:"45%",height:12,radius:6}):null]})]})]},r))]})}var Gi=62;function Vi(){let e=useEverfurTheme();return r(()=>Ki(e),[e])}function Ki(e){let{color:t,space:r,radius:n}=e,i=b.hairlineWidth;return b.create({dashboard:{flex:1,paddingHorizontal:r.sm,paddingTop:r.xs,gap:r.lg,backgroundColor:t.background},inset:{paddingHorizontal:r.sm},summaryCard:{alignItems:"center",borderRadius:n.lg-r.xs,borderWidth:i,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:r.lg,paddingVertical:r.lg+r.xs,gap:r.md+r.xs/2},badges:{flexDirection:"row",gap:r.md},carouselCard:{borderRadius:n.lg-r.xs,borderWidth:i,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.lg},dots:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:r.xs+r.xs/2},centered:{alignSelf:"center"},actions:{gap:r.sm+r.xs/2},actionRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderRadius:n.md,borderWidth:i,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:r.lg,paddingVertical:r.lg},actionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:r.md},request:{paddingHorizontal:r.lg,paddingTop:r.xs,gap:r.lg+r.xs/2,backgroundColor:t.background},railRow:{flexDirection:"row",alignItems:"flex-start",gap:r.md},railColumn:{alignItems:"center",width:qi},connector:{marginVertical:r.xs/2},railBody:{flex:1,paddingBottom:r.lg+r.xs/2,gap:r.xs+r.xs/2},statusCard:{borderRadius:n.md,backgroundColor:t.brandSoft,padding:r.md+r.xs/2,gap:r.sm},timeline:{flex:1,backgroundColor:t.background},timelineDisclaimer:{paddingHorizontal:r.lg,paddingTop:r.xs,paddingBottom:r.md},timelineRow:{flexDirection:"row",gap:r.md,paddingHorizontal:r.lg,paddingVertical:r.md+r.xs/2},timelineBody:{flex:1,gap:r.xs-1},timelineTop:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},timelineSeparator:{height:i,backgroundColor:t.brandBorder,marginLeft:Gi},clinics:{gap:r.md},clinicRow:{borderRadius:n.lg-r.xs/2,borderWidth:i,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:r.md+r.xs/2,paddingVertical:r.md+r.xs/2,gap:r.sm},shares:{gap:r.md,padding:r.md,borderRadius:n.md,backgroundColor:t.surfaceCream,borderWidth:i,borderColor:t.brandBorder},shareRow:{gap:r.xs+r.xs/2},record:{flex:1,paddingHorizontal:r.lg,paddingTop:r.xs,gap:r.lg+r.xs,backgroundColor:t.background},recordSection:{gap:r.sm+r.xs/2},recordHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},recordCard:{borderRadius:n.lg,borderWidth:i,borderColor:t.brandBorder,backgroundColor:t.surface,paddingHorizontal:r.lg,paddingVertical:r.xs},recordRow:{gap:r.xs+r.xs/2,paddingVertical:r.md},recordDivider:{borderTopWidth:i,borderTopColor:t.borderHairlineGreen},document:{flex:1,paddingHorizontal:r.lg+r.xs,paddingTop:r.md,gap:r.lg},letterhead:{alignItems:"center",gap:r.sm,paddingBottom:r.lg,borderBottomWidth:2,borderBottomColor:t.skeleton},documentSection:{gap:r.xs},documentHead:{flexDirection:"row",alignItems:"center",gap:r.sm+r.xs/2,marginBottom:r.xs},documentRule:{flex:1,height:i,backgroundColor:t.borderHairlineGreen},documentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.md,paddingVertical:r.sm+1}})}var Yi=640,Qi=600,Xi=/* @__PURE__ */Object.freeze({width:0,height:0}),Zi="useWindowDimensions"in c&&typeof c.useWindowDimensions=="function"?c.useWindowDimensions:()=>Xi,Ji=/* @__PURE__ */Object.freeze({width:"100%",maxWidth:Yi,alignSelf:"center"});/* @__PURE__ */Object.freeze({...Ji,flex:1});var ea=/* @__PURE__ */Object.freeze({...Ji,flexGrow:1,flexShrink:1});function ta(){return Zi().width>=Qi}var ra=/* @__PURE__ */Symbol.for("@everfur/sdk#InSdkColumn@v1"),na=globalThis,ia=na[ra]??(na[ra]=createContext(false));ia.displayName??="EverfurInSdkColumn";function SdkTabletColumn({children:e,style:t,testID:r}){let n=ta(),i=l(ia);return!n||i?e:/* @__PURE__ */v(p,{style:t===void 0?ea:[ea,t],testID:r??"everfur-tablet-column",children:/* @__PURE__ */v(ia.Provider,{value:true,children:e})})}var aa=300,oa=(e,petRef)=>e.getTimeline(petRef),la=e=>e.isEmpty,sa=(e,petRef)=>e.getRecordDepth(petRef),da=e=>!e.available||e.labResults.length+e.encounters.length+e.clinicianNotes.length+e.physicalExams.length===0,ca=e=>e.contributions.length===0;function EverfurRecordsTimeline({petRef:petRef,style:e,onBack:t}){let r=useRecordsDepthRead(petRef,oa,la);/* @__PURE__ */
|
|
82
|
+
return v(DepthSurface,{state:r,style:e,onBack:t,header:/* @__PURE__ */v(ScreenHeader,{title:_t.timeline,onBack:ft(t),testID:"timeline-header"}),loading:/* @__PURE__ */v(TimelineSkeleton,{testID:"timeline-loading"}),empty:/* @__PURE__ */v(RecordsEmptyState,{variant:"no_records",testID:"timeline-empty"}),render:e=>/* @__PURE__ */v(TimelineBody,{timeline:e})})}function EverfurRecordDepth({petRef:petRef,style:e,onBack:t}){let r=useRecordsDepthRead(petRef,sa,da);/* @__PURE__ */
|
|
83
|
+
return v(DepthSurface,{state:r,style:e,onBack:t,header:t?/* @__PURE__ */v(ScreenHeader,{title:Je.records,onBack:ft(t)}):null,render:e=>/* @__PURE__ */v(DepthBody,{depth:e})})}function EverfurDocumentContributions({petRef:petRef,docId:e,style:t,onBack:r}){let n=a((t,r)=>t.getDocumentContributions(r,e),[e]),i=useRecordsDepthRead(petRef,n,ca,e),o=i.value?.document??null,l=o!==null?Ft(o):_t.uploadedDocument;/* @__PURE__ */
|
|
84
|
+
return v(DepthSurface,{state:i,style:t,onBack:r,header:/* @__PURE__ */v(ScreenHeader,{title:l,onBack:ft(r),testID:"contributions-header"}),empty:/* @__PURE__ */v(RecordsEmptyState,{variant:"no_records",testID:"contributions-empty"}),render:e=>/* @__PURE__ */v(ContributionsBody,{view:e})})}function DepthSurface({state:e,style:t,header:r,loading:n,empty:i,render:a,onBack:o}){let l=pa();/* @__PURE__ */
|
|
85
|
+
return v(CapabilityGate,{capability:"records",style:t,...Ei(ft(o),Ni),children:/* @__PURE__ */v(p,{style:[l.container,t],children:/* @__PURE__ */_(SdkTabletColumn,{children:[r??null,
|
|
86
|
+
/* @__PURE__ */v(p,{style:l.body,children:ua(e,a,l,n,i)}),
|
|
87
|
+
/* @__PURE__ */v(RecordsFootnote,{})]})})})}function ua(e,t,r,n,i){switch(e.status){case"loading":return n??/* @__PURE__ */v(LoadingState,{styles:r});case"empty":return i??/* @__PURE__ */v(p,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:Je.empty,children:/* @__PURE__ */v(p,{style:r.emptyGlyph})});case"error":return e.error?/* @__PURE__ */v(RecordsEmptyState,{variant:ht(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:t(e.value);default:return null}}function LoadingState({styles:e}){let[t,r]=n(false);return o(()=>{let e=setTimeout(()=>r(true),aa);return()=>clearTimeout(e)},[]),/* @__PURE__ */v(p,{style:e.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:Je.loading,children:t?/* @__PURE__ */v(f,{}):null})}function TimelineBody({timeline:e}){let t=pa(),r=buildTimelineRows(e);/* @__PURE__ */
|
|
88
|
+
return _(h,{style:t.list,contentContainerStyle:t.timelineContent,accessibilityLabel:_t.timeline,children:[e.disclaimer.length>0?/* @__PURE__ */v(p,{style:t.timelineBand,accessible:true,accessibilityRole:"text",accessibilityLabel:Xe.important(e.disclaimer),children:/* @__PURE__ */v(Text,{style:t.timelineBandText,children:e.disclaimer})}):null,r.map((e,r)=>/* @__PURE__ */_(p,{children:[r>0?/* @__PURE__ */v(p,{style:t.timelineSeparator}):null,
|
|
89
|
+
/* @__PURE__ */_(p,{style:t.timelineRow,accessible:true,accessibilityRole:"text",accessibilityLabel:[e.kindLabel,e.date,e.title,e.detail].filter(Boolean).join(", "),testID:`records-timeline-row-${e.kind}`,children:[
|
|
90
|
+
/* @__PURE__ */v(p,{style:t.timelineBubble,accessibilityElementsHidden:true,importantForAccessibility:"no"}),
|
|
91
|
+
/* @__PURE__ */_(p,{style:t.timelineBody,children:[
|
|
92
|
+
/* @__PURE__ */_(p,{style:t.topLine,children:[
|
|
93
|
+
/* @__PURE__ */v(Text,{style:t.timelineKind,children:e.kindLabel}),
|
|
94
|
+
/* @__PURE__ */v(Text,{style:t.date,children:e.date})]}),
|
|
95
|
+
/* @__PURE__ */v(Text,{style:t.timelineTitle,children:e.title}),e.detail?/* @__PURE__ */v(Text,{style:t.rowDetail,children:e.detail}):null]})]})]},e.key))]})}function SectionHeader({title:e,count:t,styles:r}){/* @__PURE__ */
|
|
96
|
+
return v(Text,{style:r.heading,accessibilityRole:"header",children:`${e} (${t})`})}function DepthBody({depth:e}){let t=pa();/* @__PURE__ */
|
|
97
|
+
return _(h,{style:t.list,contentContainerStyle:t.listContent,accessibilityLabel:Je.records,children:[e.labResults.length>0?/* @__PURE__ */_(p,{style:t.section,children:[
|
|
98
|
+
/* @__PURE__ */v(SectionHeader,{title:_t.labResults,count:e.labResults.length,styles:t}),
|
|
99
|
+
/* @__PURE__ */v(p,{style:t.card,children:e.labResults.map(e=>{let r=wt(e.latest.status),n=Et(e.latest.at,e.trajectory,e.points.length);/* @__PURE__ */
|
|
100
|
+
return _(p,{style:t.row,accessible:true,accessibilityRole:"text",accessibilityLabel:[e.name,Tt(e.latest.value,e.latest.unit,e.latest.qualitativeResult),r.label,n].filter(Boolean).join(", "),children:[
|
|
101
|
+
/* @__PURE__ */v(Text,{style:t.rowTitle,children:e.name}),
|
|
102
|
+
/* @__PURE__ */v(Text,{style:t.rowValue,children:Tt(e.latest.value,e.latest.unit,e.latest.qualitativeResult)}),n?/* @__PURE__ */v(Text,{style:t.rowDetail,children:n}):null,
|
|
103
|
+
/* @__PURE__ */v(Text,{style:[t.chip,r.outOfRange?t.chipCritical:t.chipNeutral],children:r.label}),e.meaning?/* @__PURE__ */v(Text,{style:t.rowDetail,children:e.meaning}):null]},e.markerId)})})]}):null,e.encounters.length>0?/* @__PURE__ */_(p,{style:t.section,children:[
|
|
104
|
+
/* @__PURE__ */v(SectionHeader,{title:_t.visits,count:e.encounters.length,styles:t}),
|
|
105
|
+
/* @__PURE__ */v(p,{style:t.card,children:e.encounters.map(e=>{let r=[e.date?mt(e.date):null,e.clinicName,e.veterinarian].filter(e=>e&&e!=="-").join(" · ");/* @__PURE__ */
|
|
106
|
+
return _(p,{style:t.row,accessible:true,accessibilityRole:"text",children:[
|
|
107
|
+
/* @__PURE__ */v(Text,{style:t.rowTitle,children:e.type?xt(e.type):_t.visit}),r?/* @__PURE__ */v(Text,{style:t.rowDetail,children:r}):null]},e.encounterId)})})]}):null,e.physicalExams.length>0?/* @__PURE__ */_(p,{style:t.section,children:[
|
|
108
|
+
/* @__PURE__ */v(SectionHeader,{title:_t.physicalExams,count:e.physicalExams.length,styles:t}),e.physicalExams.map(e=>/* @__PURE__ */_(p,{style:t.card,children:[
|
|
109
|
+
/* @__PURE__ */v(Text,{style:t.rowTitle,accessibilityRole:"header",children:e.observedOn?mt(e.observedOn):_t.exam}),e.systems.map(e=>{let r=e.findingStatus==="abnormal",n=r?_t.abnormal:e.findingStatus==="not_examined"?_t.notExamined:_t.normal;/* @__PURE__ */
|
|
110
|
+
return _(p,{style:t.row,accessible:true,accessibilityRole:"text",accessibilityLabel:[zt(e.system),n,r?e.finding:null].filter(Boolean).join(", "),children:[
|
|
111
|
+
/* @__PURE__ */v(Text,{style:t.rowTitle,children:zt(e.system)}),r&&e.finding?/* @__PURE__ */v(Text,{style:t.rowDetail,children:e.finding}):null,
|
|
112
|
+
/* @__PURE__ */v(Text,{style:[t.chip,r?t.chipCaution:t.chipNeutral],children:n})]},e.system)})]},e.examId))]}):null,e.clinicianNotes.length>0?/* @__PURE__ */_(p,{style:t.section,children:[
|
|
113
|
+
/* @__PURE__ */v(SectionHeader,{title:_t.visitNotes,count:e.clinicianNotes.length,styles:t}),e.clinicianNotes.map(e=>/* @__PURE__ */_(p,{style:t.card,children:[
|
|
114
|
+
/* @__PURE__ */v(Text,{style:t.rowTitle,accessibilityRole:"header",children:e.observedOn?mt(e.observedOn):_t.visitNote}),e.sections.map((e,r)=>/* @__PURE__ */_(p,{style:t.row,accessible:true,accessibilityRole:"text",children:[
|
|
115
|
+
/* @__PURE__ */v(Text,{style:t.kindLabel,children:Ot(e.section)}),
|
|
116
|
+
/* @__PURE__ */v(Text,{style:e.text?t.rowDetail:t.rowMuted,children:e.text||_t.notRecorded})]},`${e.section}:${r}`))]},e.noteId))]}):null]})}function ContributionsBody({view:e}){let t=pa();/* @__PURE__ */
|
|
117
|
+
return _(h,{style:t.list,contentContainerStyle:t.listContent,accessibilityLabel:Je.records,children:[e.document?.receivedAt?/* @__PURE__ */v(Text,{style:t.rowDetail,children:vt(e.document.receivedAt)}):null,
|
|
118
|
+
/* @__PURE__ */v(p,{style:t.card,children:e.contributions.map(e=>/* @__PURE__ */_(p,{style:t.row,accessible:true,accessibilityRole:"text",children:[
|
|
119
|
+
/* @__PURE__ */v(Text,{style:t.rowTitle,children:e.label}),
|
|
120
|
+
/* @__PURE__ */v(Text,{style:t.rowValue,children:bt(e.value,e.unit)}),e.observedAt?/* @__PURE__ */v(Text,{style:t.rowDetail,children:mt(e.observedAt)}):null]},e.key))})]})}function pa(){let e=useEverfurTheme(),t=ot();return r(()=>t===null?ha(e):$e(ha(e),fa(t)),[e,t])}function fa(e){return{container:{backgroundColor:e.ground},card:Me(e,{padding:e.cardPad,gap:8}),heading:e.cardTitle,primaryButton:{...e.button,...e.buttonInk},primaryLabel:e.buttonInkLabel}}function ha(e){let{color:t,space:r,radius:n,type:i,slots:a}=e,{size:o,lineHeight:l}=i,s=(e,t)=>Math.round(e*t),d=b.hairlineWidth,c=r.xxl*3+r.xl,u=r.xxl+r.md,p=e.brightness==="dark"?t.errorRed:t.danger,f=k(z(a)),h=(t,r,n,i="regular")=>({...face(e,i),fontSize:t,lineHeight:s(t,r),color:n}),g=(e,t,r,n="regular")=>({...h(e,t,r,n),...f});return b.create({container:{flex:1,minHeight:c,backgroundColor:t.background},body:{flex:1},centered:{minHeight:c,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl,gap:r.lg},emptyGlyph:{width:r.xxl+r.sm,height:r.xxl+r.sm,borderRadius:n.lg,backgroundColor:t.brandSoft,borderWidth:d,borderColor:t.brandBorder},errorText:{...h(o.subtitle,l.snug,p),textAlign:"center",marginBottom:r.md},primaryButton:{minHeight:u,minWidth:u,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.md,borderRadius:n.pill,backgroundColor:t.primary,...x(a.primaryButton)},primaryLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:o.body,...k(a.primaryButton)},list:{flex:1},listContent:{padding:r.lg,gap:r.md},section:{gap:r.sm},heading:{...h(o.heading,l.snug,t.text.primary,"bold"),...headingFace(e,"bold")},card:{gap:r.sm,padding:r.md,borderRadius:n.md,backgroundColor:t.surfaceCream,borderWidth:d,borderColor:t.brandBorder,...x(z(a),d)},row:{gap:r.xs,paddingVertical:r.xs,borderBottomWidth:d,borderBottomColor:t.borderHairlineGreen},topLine:{flexDirection:"row",justifyContent:"space-between",gap:r.md},kindLabel:{...g(o.caption,l.normal,t.text.muted,"medium")},date:g(o.caption,l.normal,t.text.muted),rowTitle:{...g(o.body,l.normal,t.text.primary,"bold"),...headingFace(e,"bold")},rowValue:{...g(o.body,l.normal,t.text.primary,"medium")},rowDetail:g(o.bodyTight,l.normal,t.text.muted),rowMuted:{...g(o.bodyTight,l.normal,t.text.muted),opacity:.7},chip:{...h(o.caption,l.normal,t.text.primary),alignSelf:"flex-start",paddingHorizontal:r.sm,paddingVertical:r.xs,borderRadius:n.pill},chipNeutral:{backgroundColor:t.badgeBgNeutral},chipCaution:{backgroundColor:t.badgeBgCaution},chipCritical:{backgroundColor:t.badgeBgCritical},disclaimer:{...h(o.caption,l.normal,t.text.muted),marginTop:r.md},timelineContent:{paddingBottom:r.xxl},timelineBand:{flexDirection:"row",gap:r.sm,borderRadius:n.md-r.xs/2,padding:r.md,backgroundColor:t.brandSoft,marginHorizontal:r.lg,marginTop:r.xs,marginBottom:r.md},timelineBandText:{flex:1,...h(o.caption,l.normal,t.text.secondary)},timelineSeparator:{height:d,backgroundColor:t.brandBorder,marginLeft:Gi},timelineRow:{flexDirection:"row",gap:r.md,paddingHorizontal:r.lg,paddingVertical:r.md+r.xs/2},timelineBubble:{width:r.xxl+r.xs/2,height:r.xxl+r.xs/2,borderRadius:n.pill,backgroundColor:t.brandSoft,borderWidth:d,borderColor:t.brandBorder},timelineBody:{flex:1,gap:r.xs-1},timelineKind:{...face(e,"mono"),fontSize:o.micro,lineHeight:o.bodyTight,letterSpacing:i.letterSpacing.eyebrow/3,textTransform:"uppercase",color:t.text.secondary},timelineTitle:{...h(o.body,l.normal,t.text.primary,"medium")}})}export{EverfurDocumentContributions,EverfurRecordDepth,EverfurRecordsTimeline,buildTimelineRows,mapDocumentContributions,mapRecordDepth,mapRecordsTimeline,useEverfurRecordsDepthClient,useRecordsDepthRead};
|