@everfur/sdk 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/{Chat-BOX-03ho.d.ts → Chat-Rzplrf5M.d.ts} +3 -3
- package/dist/{Chat-TA-aTcVF.d.cts → Chat-ypo6miKm.d.cts} +3 -3
- package/dist/{DepthViews-D2dRqWRq.d.ts → DepthViews-CeTfPUBX.d.ts} +1 -1
- package/dist/{DepthViews-DSFyaSeL.d.cts → DepthViews-ClykXOJj.d.cts} +1 -1
- package/dist/{DepthViews-Cviea-ri.d.cts → DepthViews-Cui3oonj.d.cts} +1 -1
- package/dist/{DepthViews-CgjX2AJ5.d.ts → DepthViews-baYLMNQ-.d.ts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/animations/index.js +1 -1
- package/dist/{attachments-DHvnITuE.d.cts → attachments-CwsR-bPN.d.cts} +5 -5
- package/dist/{attachments-C_vtFu2f.d.ts → attachments-CzZ7in24.d.ts} +5 -5
- package/dist/{attachments-oD5U2fXI.d.ts → attachments-D3HCBmOE.d.ts} +2 -2
- package/dist/{attachments-pIdGOQfm.d.cts → attachments-Nk73Lll8.d.cts} +2 -2
- package/dist/{bookingCopy-DfuA13dh.d.cts → bookingCopy-Dv8rKqyV.d.cts} +2 -2
- package/dist/{bookingCopy-CJir9mjb.d.ts → bookingCopy-SDkXaxDf.d.ts} +2 -2
- package/dist/{casesRepository-DHgIYKN9.d.ts → casesRepository-BTAecTnF.d.ts} +1 -1
- package/dist/{casesRepository-B-Eg8ZJ3.d.cts → casesRepository-aryld7fJ.d.cts} +1 -1
- package/dist/chat/index.cjs +1 -1
- package/dist/chat/index.d.cts +9 -9
- package/dist/chat/index.d.ts +9 -9
- package/dist/chat/index.js +1 -1
- package/dist/client/index.cjs +5 -5
- package/dist/client/index.d.cts +6 -6
- package/dist/client/index.d.ts +6 -6
- package/dist/client/index.js +5 -5
- package/dist/{config-DAFbf721.d.cts → config-6qS7Sohy.d.cts} +1 -1
- package/dist/{config-ClI7QxB0.d.ts → config-X6BtwDwQ.d.ts} +1 -1
- package/dist/consent/index.cjs +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/consent/index.js +1 -1
- package/dist/{context-CZbgF_OH.d.ts → context-7f3Nb_xE.d.ts} +5 -5
- package/dist/{context-B-dUM1Qf.d.cts → context-CkqPM4Ml.d.cts} +5 -5
- package/dist/{copy-CneuYdrO.d.cts → copy-Bd__Pw5s.d.cts} +2 -2
- package/dist/{copy-CeRH3NXy.d.ts → copy-NgKgOOET.d.ts} +2 -2
- package/dist/core/index.cjs +7 -7
- package/dist/core/index.d.cts +12 -12
- package/dist/core/index.d.ts +12 -12
- package/dist/core/index.js +7 -7
- package/dist/{depth-DO3Ko_qs.d.ts → depth-CYPH92jE.d.ts} +2 -2
- package/dist/{depth-B3NFKlF9.d.cts → depth-CyjaJJ6V.d.cts} +2 -2
- package/dist/{entitlementRepository-74kW5mK0.d.ts → entitlementRepository-DdeFuEKp.d.ts} +2 -2
- package/dist/{entitlementRepository-m6zLUmiB.d.cts → entitlementRepository-Dl1qRLcJ.d.cts} +2 -2
- package/dist/{identity-C7uxGwfT.d.cts → identity-DjqhDm5Z.d.cts} +1 -1
- package/dist/{identity-CLAUq-K4.d.ts → identity-Dy_L7Yq4.d.ts} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +6 -6
- package/dist/notifications/index.cjs +2 -2
- package/dist/notifications/index.d.cts +2 -2
- package/dist/notifications/index.d.ts +2 -2
- package/dist/notifications/index.js +2 -2
- package/dist/{pets-BoB5B7kp.d.cts → pets-BSG2qbr_.d.cts} +1 -1
- package/dist/{pets-w4M9d-Dn.d.ts → pets-D7cZutrX.d.ts} +1 -1
- package/dist/{petsRepository-DZZoEG3r.d.cts → petsRepository-D1bnxDZg.d.cts} +1 -1
- package/dist/{petsRepository-BjKJ8UsN.d.ts → petsRepository-DhsX3GLw.d.ts} +1 -1
- package/dist/photo/index.cjs +1 -1
- package/dist/photo/index.js +1 -1
- package/dist/{ports-BO3bzTJg.d.ts → ports-C0m1G1fS.d.ts} +4 -4
- package/dist/{ports-C2EVK416.d.cts → ports-DNXyyzZF.d.cts} +4 -4
- package/dist/records/depth/index.cjs +2 -2
- package/dist/records/depth/index.d.cts +7 -7
- package/dist/records/depth/index.d.ts +7 -7
- package/dist/records/depth/index.js +2 -2
- package/dist/records/index.cjs +3 -3
- package/dist/records/index.d.cts +9 -9
- package/dist/records/index.d.ts +9 -9
- package/dist/records/index.js +3 -3
- package/dist/{requestFunnel-Djjwgoe9.d.cts → requestFunnel-Bqc1inM9.d.cts} +2 -2
- package/dist/{requestFunnel-D7ipek3e.d.ts → requestFunnel-FvE5yLDD.d.ts} +2 -2
- package/dist/{runtimeTypes-CTL3yToK.d.ts → runtimeTypes-C0yPBz89.d.ts} +4 -4
- package/dist/{runtimeTypes-D2C9uD85.d.cts → runtimeTypes-RN-VXTFV.d.cts} +4 -4
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/televet/booking/index.cjs +1 -1
- package/dist/televet/booking/index.d.cts +20 -14
- package/dist/televet/booking/index.d.ts +20 -14
- package/dist/televet/booking/index.js +1 -1
- package/dist/televet/index.cjs +1 -1
- package/dist/televet/index.js +1 -1
- package/dist/testing/index.cjs +3 -3
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +3 -3
- package/dist/testing/rn/index.cjs +1 -1
- package/dist/testing/rn/index.d.cts +7 -7
- package/dist/testing/rn/index.d.ts +7 -7
- package/dist/testing/rn/index.js +1 -1
- package/dist/testing/web/index.cjs +1 -1
- package/dist/testing/web/index.d.cts +7 -7
- package/dist/testing/web/index.d.ts +7 -7
- package/dist/testing/web/index.js +1 -1
- package/dist/{timelineRows-7yFNK_rU.d.ts → timelineRows-D4U6A8zE.d.ts} +1 -1
- package/dist/{timelineRows-CzR1T2DR.d.cts → timelineRows-DAB5dpjF.d.cts} +1 -1
- package/dist/{useRecordsDepth-DFF7Faxx.d.ts → useRecordsDepth--ObtMyjH.d.ts} +1 -1
- package/dist/{useRecordsDepth-Bnw36jPr.d.cts → useRecordsDepth-B35y8bV-.d.cts} +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.js +1 -1
- package/dist/{view-CaJs8WFH.d.cts → view-B-Toym_j.d.cts} +2 -2
- package/dist/{view-BqcOYFTr.d.ts → view-D9JqNQai.d.ts} +2 -2
- package/dist/web/consent/index.cjs +1 -1
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/consent/index.js +1 -1
- package/dist/web/index.cjs +7 -7
- package/dist/web/index.d.cts +14 -14
- package/dist/web/index.d.ts +14 -14
- package/dist/web/index.js +7 -7
- package/dist/web/notifications/index.cjs +2 -2
- package/dist/web/notifications/index.d.cts +3 -3
- package/dist/web/notifications/index.d.ts +3 -3
- package/dist/web/notifications/index.js +2 -2
- package/dist/web/records/depth/index.cjs +2 -2
- package/dist/web/records/depth/index.d.cts +7 -7
- package/dist/web/records/depth/index.d.ts +7 -7
- package/dist/web/records/depth/index.js +2 -2
- package/dist/web/records/index.cjs +3 -3
- package/dist/web/records/index.d.cts +9 -9
- package/dist/web/records/index.d.ts +9 -9
- package/dist/web/records/index.js +3 -3
- package/dist/web/televet/booking/index.cjs +2 -2
- package/dist/web/televet/booking/index.d.cts +12 -8
- package/dist/web/televet/booking/index.d.ts +12 -8
- package/dist/web/televet/booking/index.js +2 -2
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/televet/index.cjs +1 -1
- package/dist/web/televet/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var Ge=Object.defineProperty;var n=(e,r)=>Ge(e,"name",{value:r,configurable:true});var ye=Object.freeze({track(){},trackExpectedFailure(){}});function pe(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}n(pe,"isSafeRoomUrl");function W(e,r){return pe(e)&&r.trim().length>0}n(W,"isUsableRoomCredential");function me(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(me,"reportHostFailure");function $e(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n($e,"isThenable");function S(e,...r){if(typeof e=="function")try{let t=e(...r);return $e(t)&&Promise.resolve(t).then(void 0,me),t}catch(t){me(t);return}}n(S,"callHost");var ge=new WeakMap;function Ye(e){if(typeof e!="function")return;let r=ge.get(e);if(r!==void 0)return r;let t=n((...o)=>{S(e,...o);},"guarded");return ge.set(e,t),t}n(Ye,"guardHost");function be(e,r){let t=null;for(let o of r){let a=e[o];typeof a=="function"&&(t??={...e},t[o]=Ye(a));}return t??e}n(be,"guardHostProps");var G=10,d=Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"Usually under a minute",lobbyPrepLabel:"WHILE YOU WAIT",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:n(e=>{let r=e?.trim()??"";return r.length>0?`${r} is joining`:d.lobbyTitleNoName},"lobbyTitle"),lobbyPrep:n(e=>{let r=e?.trim()??"";return r.length>0?`Have ${r} nearby and somewhere well lit.`:d.lobbyPrepNoPet},"lobbyPrep"),lobbyDuration:n(e=>`${e} MINUTE VISIT`,"lobbyDuration"),joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function q(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))q(e[r]);}return e}n(q,"deepFreeze");var qe=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Ee={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},he={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},ve={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Ke={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Je={regular:"400",medium:"500",bold:"700"},Xe={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Ze=0,V="System",N="monospace",Qe=["content","heading","control","compact","badge"];function er(e){let r={};for(let t of Qe)r[t]=e;return r}n(er,"authoredTierSizes");function Te(){return {family:V,mono:N,fontUrl:null,families:{regular:V,medium:V,bold:V,mono:N,monoMedium:N,monoBold:N},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:ve,tierSizes:er(ve),lineHeight:Ke,weight:Je,letterSpacing:Xe,scale:1,maxScale:Ze,scaleCaps:qe}}n(Te,"baseType");var Ce={},$=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function Y(e){return `cubic-bezier(${e.join(", ")})`}n(Y,"cssCubicBezier");var xe={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:Y($.standard),emphasized:Y($.emphasized),exit:Y($.exit)},reducedMotion:false},rr={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},ke=q({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:rr,space:Ee,radius:he,type:Te(),motion:xe,slots:Ce}),nr={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};q({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:nr,space:Ee,radius:he,type:Te(),motion:xe,slots:Ce});var Fe=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Re=globalThis,K=Re[Fe]??(Re[Fe]=react.createContext(ke));K.displayName??="EverfurThemeContext";function w(){return react.useContext(K)}n(w,"useEverfurTheme");var Se=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var we='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',ar="System";function lr(e){let r=e.trim();return r.length===0||r===ar?we:`${Pe(r)}, ${we}`}n(lr,"cssFontFamily");function ir(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Pe(r)}, ui-monospace, Menlo, Consolas, monospace`}n(ir,"cssMonoFamily");function Pe(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}n(Pe,"quote");function m(e,r){let t=e.type,o=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?ir(o):lr(o),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[Se[r]]}}n(m,"faceCss");var Le=Symbol.for("@everfur/sdk/televet");function sr(){let e=globalThis,r=e[Le];if(r!==void 0)return r;let t={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[Le]=t,t}n(sr,"televetGlobal");function Ae(e){sr().dailyRegistered=e;}n(Ae,"markEverfurDailyRegistered");var X=`[everfur] The in-page vet call needs @daily-co/daily-js, which this app has not registered. Install it and call registerEverfurDaily(() => import('@daily-co/daily-js')) once in your app entry, before any Everfur call surface mounts. Until then the in-page visit tells the member the call cannot be joined; <VetVisitButton prefer="redirect" /> is the explicit way to the hosted visit in a new tab instead.`,Z="@daily-co/daily-js",dr=`optional peer '${Z}' has no registered loader`,ur=`optional peer '${Z}' is present but failed its shape check`;function Q(e){return typeof e=="object"&&e!==null}n(Q,"isRecordLike");function cr(e){let r=e;for(let t=0;t<3;t+=1){if(_e(r))return r;if(!Q(r)||!("default"in r))return null;r=r.default;}return null}n(cr,"normalizeDailyModule");function _e(e){return !Q(e)&&typeof e!="function"?false:typeof e.createFrame=="function"}n(_e,"isEverfurDailyModule");var De=null,M=null;function J(e){return Object.freeze({available:false,module:null,reason:e})}n(J,"unavailable");function fr(e){De=e,M=null,Ae(e!==null);}n(fr,"registerEverfurDaily");function ee(){if(M!==null)return M;let e=De;if(e===null)return Promise.resolve(J(dr));let r=(async()=>{let t;try{t=await e();}catch(a){return J(`optional peer '${Z}' is not installed: ${yr(a)}`)}let o=cr(t);return o===null?J(ur):Object.freeze({available:true,module:o})})();return M=r,r}n(ee,"loadEverfurDaily");function yr(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}n(yr,"describe");function Be(e){if(!Q(e)||!("errorMsg"in e))return null;let r=e.errorMsg;return typeof r=="string"&&r.length>0?r:null}n(Be,"dailyErrorMessage");function Ve(e){return e?Object.keys(e).filter(r=>r!=="local").length:0}n(Ve,"remoteParticipantCount");var br=44,Ne=3,vr=420,Er=.35,hr=1,Tr=.6;function Cr({theme:e}){let r=e.motion.reducedMotion,[t,o]=react.useState(0);return react.useEffect(()=>{if(r)return;let a=setInterval(()=>o(l=>(l+1)%Ne),vr);return ()=>clearInterval(a)},[r]),jsxRuntime.jsx("div",{"aria-hidden":"true","data-testid":"everfur-vet-call-lobby-dots",style:{display:"flex",gap:e.space.xs,justifyContent:"center"},children:Array.from({length:Ne},(a,l)=>jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:e.radius.pill,backgroundColor:e.color.text.onBrand,opacity:r?Tr:l===t?hr:Er,transition:r?"none":`opacity ${e.motion.duration.fast}ms ${e.motion.easing.standard}`}},l))})}n(Cr,"WaitingDots");function re(e){let{clinicianName:r,petName:t,consultMinutes:o=10,onLeave:a,style:l,className:u}=e,h=w(),i=react.useMemo(()=>xr(h),[h]),A=d.lobbyTitle(r),_=d.lobbyPrep(t);return jsxRuntime.jsxs("section",{className:u,"data-testid":"everfur-vet-call-lobby",style:{...i.root,...l},children:[jsxRuntime.jsx("div",{style:i.topRow,children:jsxRuntime.jsx("button",{type:"button",onClick:a,"data-testid":"everfur-vet-call-lobby-leave",style:i.leave,children:d.leaveCta})}),jsxRuntime.jsxs("div",{style:i.center,children:[jsxRuntime.jsxs("div",{"aria-hidden":"true","data-testid":"everfur-vet-call-lobby-avatar",style:i.avatar,children:[jsxRuntime.jsx("span",{style:i.avatarHead}),jsxRuntime.jsx("span",{style:i.avatarBody})]}),jsxRuntime.jsxs("div",{"aria-live":"polite",style:i.titleBlock,children:[jsxRuntime.jsx("p",{"data-testid":"everfur-vet-call-lobby-title",style:i.title,children:A}),jsxRuntime.jsx("p",{style:i.subtitle,children:d.lobbySubtitle})]}),jsxRuntime.jsx(Cr,{theme:h})]}),jsxRuntime.jsxs("div",{"data-testid":"everfur-vet-call-lobby-prep",style:i.prepCard,children:[jsxRuntime.jsx("p",{style:i.prepLabel,children:d.lobbyPrepLabel}),jsxRuntime.jsx("p",{style:i.prepBody,children:_})]}),jsxRuntime.jsx("p",{"data-testid":"everfur-vet-call-lobby-duration",style:i.duration,children:d.lobbyDuration(o)})]})}n(re,"EverfurVetCallLobby");function xr(e){let{color:r,space:t,radius:o,type:a}=e,l=r.text.onBrand,u=132;return {root:{boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.lg,padding:t.lg,borderRadius:o.lg,backgroundColor:r.brand,color:l},topRow:{display:"flex",alignItems:"center"},leave:{minHeight:br,padding:`0 ${t.md}px`,margin:0,border:0,background:"transparent",color:l,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body},center:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.md},avatar:{position:"relative",width:u,height:u,borderRadius:o.pill,overflow:"hidden",backgroundColor:r.brandSoft,display:"flex",alignItems:"center",justifyContent:"center"},avatarHead:{position:"absolute",top:u*.24,width:u*.28,height:u*.28,borderRadius:o.pill,backgroundColor:l,opacity:.55},avatarBody:{position:"absolute",top:u*.58,width:u*.52,height:u*.34,borderTopLeftRadius:u*.26,borderTopRightRadius:u*.26,backgroundColor:l,opacity:.55},titleBlock:{textAlign:"center"},title:{margin:0,...m(e,"bold"),fontSize:a.size.heading,color:l},subtitle:{margin:`${e.space.xs}px 0 0`,fontSize:a.size.bodyTight,color:l,opacity:.75},prepCard:{display:"flex",flexDirection:"column",gap:t.xs,padding:t.md,borderRadius:o.md,backgroundColor:r.brandSoft},prepLabel:{margin:0,...m(e,"medium"),fontSize:a.size.micro,letterSpacing:a.letterSpacing.eyebrow,color:l,opacity:.75},prepBody:{margin:0,fontSize:a.size.bodyTight,color:l},duration:{margin:0,textAlign:"center",...m(e,"medium"),fontSize:a.size.micro,letterSpacing:a.letterSpacing.eyebrow,color:l,opacity:.75}}}n(xr,"makeLobbyStyles");var Oe=44,Rr="16 / 9",Sr="16px",wr=["participant-joined","participant-updated","participant-left"];function Pr(e){let{roomUrl:r,token:t,onLeave:o,clinicianName:a,petName:l,displayName:u,daily:h,telemetry:i,onUnavailable:A,renderUnavailable:_,style:ne,className:te}=be(e,["onLeave","onUnavailable"]),oe=w(),c=react.useMemo(()=>Ar(oe),[oe]),ae=`${react.useId()}-recording-notice`,[D,k]=react.useState("joining"),[je,le]=react.useState(0),[H,ie]=react.useState(null),[B,z]=react.useState(null),[I,se]=react.useState(false),de=react.useRef(null),F=react.useRef(null),ue=react.useRef(false),T=react.useRef({onLeave:o,onUnavailable:A,daily:h,telemetry:i});T.current={onLeave:o,onUnavailable:A,daily:h,telemetry:i};let C=react.useCallback(()=>{ue.current||(ue.current=true,S(T.current.onLeave));},[]);react.useEffect(()=>{let s=false;z(null),se(false);let f=n((b,j)=>{s||(ie({reason:b,detail:j}),S(T.current.onUnavailable,b,j));},"refuse");if(!W(r,t)){f("roomUnusable","the call needs an https room URL and a non-empty join token");return}let R=T.current.daily;return R!==void 0?(z(()=>R),()=>{s=true;}):(ee().then(b=>{if(!s){if(!b.available){Lr(X),f("dailyMissing",b.reason);return}z(()=>b.module);}}),()=>{s=true;})},[r,t]),react.useEffect(()=>{if(B===null||!I)return;let s=false,f=null,R=[],b=n((E,v)=>{s||(ie({reason:E,detail:v}),S(T.current.onUnavailable,E,v));},"refuse");return n(async()=>{let E=de.current;if(!E)return;let v=T.current.telemetry??ye;try{f=B.createFrame(E,{showLeaveButton:!0,showFullscreenButton:!1,iframeStyle:{width:"100%",height:"100%",border:"0",borderRadius:Sr}});}catch(p){b("dailyMissing",`createFrame failed: ${ze(p)}`);return}F.current=f;let x=n((p,fe)=>{R.push({event:p,handler:fe}),f?.on(p,fe);},"attach"),We=n(()=>{s||f===null||le(He(f));},"syncParticipants");for(let p of wr)x(p,We);x("joined-meeting",()=>{s||f===null||(k("joined"),le(He(f)));}),x("left-meeting",()=>{s||(k("left"),C());}),x("error",p=>{s||(k("error"),v.trackExpectedFailure("televet.call.join_failed",{provider:"daily",detail:Be(p)??"unknown"}));});try{if(await f.join({url:r,token:t,userName:u}),s)return;v.track("televet.call.joined",{provider:"daily"});}catch(p){if(s)return;k("error"),v.trackExpectedFailure("televet.call.join_failed",{provider:"daily",detail:ze(p)});}},"start")(),()=>{s=true;for(let{event:v,handler:x}of R)try{f?.off(v,x);}catch{}let E=F.current;F.current=null,E?.destroy().catch(()=>{});}},[B,I,r,t,u,C]);let ce=react.useCallback(()=>{let s=F.current;if(F.current=null,k("left"),!s){C();return}(async()=>{try{await s.leave();}catch{}try{await s.destroy();}catch{}C();})();},[C]);return H!==null?_?jsxRuntime.jsx(jsxRuntime.Fragment,{children:_(H.reason,H.detail)}):null:B===null?null:I?jsxRuntime.jsxs("div",{className:te,"data-testid":"everfur-vet-call",style:{...c.root,...ne},children:[D==="left"?null:jsxRuntime.jsx("div",{ref:de,"data-testid":"everfur-vet-call-frame",style:{...c.frame,...D==="error"?c.frameHidden:null}}),D==="joined"&&je===0?jsxRuntime.jsx(re,{clinicianName:a,petName:l,onLeave:ce}):null,D==="error"?jsxRuntime.jsxs("div",{role:"alert","data-testid":"everfur-vet-call-failed",style:c.failed,children:[jsxRuntime.jsx("p",{style:c.failedText,children:d.joinFailedReason}),jsxRuntime.jsx("button",{type:"button",onClick:ce,"data-testid":"everfur-vet-call-failed-leave",style:c.failedLeave,children:d.leaveCta})]}):null]}):jsxRuntime.jsx("div",{className:te,"data-testid":"everfur-vet-call",style:{...c.root,...ne},children:jsxRuntime.jsxs("div",{role:"alertdialog","aria-labelledby":ae,"data-testid":"everfur-vet-call-recording-notice",style:c.notice,children:[jsxRuntime.jsx("p",{id:ae,style:c.noticeTitle,children:d.recordingNoticeTitle}),jsxRuntime.jsxs("div",{style:c.noticeActions,children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>se(true),"data-testid":"everfur-vet-call-recording-continue",style:c.noticeContinue,children:d.recordingNoticeCta}),jsxRuntime.jsx("button",{type:"button",onClick:C,"data-testid":"everfur-vet-call-recording-decline",style:c.failedLeave,children:d.recordingNoticeDecline})]})]})})}n(Pr,"EverfurVetCall");function He(e){try{return Ve(e.participants())}catch{return 0}}n(He,"countRemotes");function ze(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown error"}n(ze,"describe");var Ie=false;function Lr(e){if(Ie)return;Ie=true;let r=globalThis.console;try{r?.warn?.(e);}catch{}}n(Lr,"warnOnce");function Ar(e){let{color:r,space:t,radius:o,type:a}=e;return {root:{boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.md,width:"100%"},frame:{position:"relative",width:"100%",aspectRatio:Rr,overflow:"hidden",borderRadius:o.lg,backgroundColor:r.brandInk},frameHidden:{display:"none"},failed:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:t.md,padding:t.lg,borderRadius:o.md,border:`1px solid ${r.brandBorder}`,backgroundColor:r.surfaceCream,color:r.text.primary},failedText:{margin:0,fontSize:a.size.bodyTight,color:r.text.primary},notice:{display:"flex",flexDirection:"column",gap:t.md,padding:t.lg,borderRadius:o.md,border:`1px solid ${r.brandBorder}`,backgroundColor:r.surface,color:r.text.primary},noticeTitle:{margin:0,...m(e,"medium"),fontSize:a.size.subtitle,color:r.text.primary},noticeActions:{display:"flex",flexWrap:"wrap",gap:t.md},noticeContinue:{minHeight:Oe,padding:`0 ${t.lg}px`,borderRadius:o.pill,border:0,backgroundColor:r.primary,color:r.onPrimary,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body},failedLeave:{minHeight:Oe,padding:`0 ${t.lg}px`,borderRadius:o.pill,border:`1.5px solid ${r.brand}`,backgroundColor:"transparent",color:r.brand,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body}}}n(Ar,"makeCallStyles");exports.EVERFUR_DAILY_SETUP=X;exports.EverfurVetCall=Pr;exports.EverfurVetCallLobby=re;exports.VET_CALL_CONSULT_MINUTES=G;exports.VET_CALL_COPY=d;exports.isEverfurDailyModule=_e;exports.isSafeRoomUrl=pe;exports.isUsableRoomCredential=W;exports.loadEverfurDaily=ee;exports.registerEverfurDaily=fr;
|
|
1
|
+
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var $e=Object.defineProperty;var n=(e,r)=>$e(e,"name",{value:r,configurable:true});var pe=Object.freeze({track(){},trackExpectedFailure(){}});function me(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}n(me,"isSafeRoomUrl");function G(e,r){return me(e)&&r.trim().length>0}n(G,"isUsableRoomCredential");function ge(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(ge,"reportHostFailure");function Ye(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(Ye,"isThenable");function S(e,...r){if(typeof e=="function")try{let t=e(...r);return Ye(t)&&Promise.resolve(t).then(void 0,ge),t}catch(t){ge(t);return}}n(S,"callHost");var be=new WeakMap;function qe(e){if(typeof e!="function")return;let r=be.get(e);if(r!==void 0)return r;let t=n((...o)=>{S(e,...o);},"guarded");return be.set(e,t),t}n(qe,"guardHost");function ve(e,r){let t=null;for(let o of r){let a=e[o];typeof a=="function"&&(t??={...e},t[o]=qe(a));}return t??e}n(ve,"guardHostProps");var $=10,d=Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"Usually under a minute",lobbyPrepLabel:"WHILE YOU WAIT",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:n(e=>{let r=e?.trim()??"";return r.length>0?`${r} is joining`:d.lobbyTitleNoName},"lobbyTitle"),lobbyPrep:n(e=>{let r=e?.trim()??"";return r.length>0?`Have ${r} nearby and somewhere well lit.`:d.lobbyPrepNoPet},"lobbyPrep"),lobbyDuration:n(e=>`${e} MINUTE VISIT`,"lobbyDuration"),joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function K(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))K(e[r]);}return e}n(K,"deepFreeze");var Ke=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Te={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},he={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Ee={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Je={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Xe={regular:"400",medium:"500",bold:"700"},Ze={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Qe=0,V="System",N="monospace",er=["content","heading","control","compact","badge"];function rr(e){let r={};for(let t of er)r[t]=e;return r}n(rr,"authoredTierSizes");function Ce(){return {family:V,mono:N,fontUrl:null,families:{regular:V,medium:V,bold:V,mono:N,monoMedium:N,monoBold:N},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Ee,tierSizes:rr(Ee),lineHeight:Je,weight:Xe,letterSpacing:Ze,scale:1,maxScale:Qe,scaleCaps:Ke}}n(Ce,"baseType");var xe={},Y=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function q(e){return `cubic-bezier(${e.join(", ")})`}n(q,"cssCubicBezier");var ke={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:q(Y.standard),emphasized:q(Y.emphasized),exit:q(Y.exit)},reducedMotion:false},nr={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},Fe=K({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:nr,space:Te,radius:he,type:Ce(),motion:ke,slots:xe}),tr={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};K({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:tr,space:Te,radius:he,type:Ce(),motion:ke,slots:xe});var Re=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Se=globalThis,J=Se[Re]??(Se[Re]=react.createContext(Fe));J.displayName??="EverfurThemeContext";function w(){return react.useContext(J)}n(w,"useEverfurTheme");var we=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var Pe='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',lr="System";function ir(e){let r=e.trim();return r.length===0||r===lr?Pe:`${Le(r)}, ${Pe}`}n(ir,"cssFontFamily");function sr(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Le(r)}, ui-monospace, Menlo, Consolas, monospace`}n(sr,"cssMonoFamily");function Le(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}n(Le,"quote");function m(e,r){let t=e.type,o=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?sr(o):ir(o),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[we[r]]}}n(m,"faceCss");var U=Object.freeze({textAlign:"start"});var _e=Symbol.for("@everfur/sdk/televet");function dr(){let e=globalThis,r=e[_e];if(r!==void 0)return r;let t={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[_e]=t,t}n(dr,"televetGlobal");function Ae(e){dr().dailyRegistered=e;}n(Ae,"markEverfurDailyRegistered");var Z=`[everfur] The in-page vet call needs @daily-co/daily-js, which this app has not registered. Install it and call registerEverfurDaily(() => import('@daily-co/daily-js')) once in your app entry, before any Everfur call surface mounts. Until then the in-page visit tells the member the call cannot be joined; <VetVisitButton prefer="redirect" /> is the explicit way to the hosted visit in a new tab instead.`,Q="@daily-co/daily-js",ur=`optional peer '${Q}' has no registered loader`,cr=`optional peer '${Q}' is present but failed its shape check`;function ee(e){return typeof e=="object"&&e!==null}n(ee,"isRecordLike");function fr(e){let r=e;for(let t=0;t<3;t+=1){if(De(r))return r;if(!ee(r)||!("default"in r))return null;r=r.default;}return null}n(fr,"normalizeDailyModule");function De(e){return !ee(e)&&typeof e!="function"?false:typeof e.createFrame=="function"}n(De,"isEverfurDailyModule");var Be=null,M=null;function X(e){return Object.freeze({available:false,module:null,reason:e})}n(X,"unavailable");function yr(e){Be=e,M=null,Ae(e!==null);}n(yr,"registerEverfurDaily");function re(){if(M!==null)return M;let e=Be;if(e===null)return Promise.resolve(X(ur));let r=(async()=>{let t;try{t=await e();}catch(a){return X(`optional peer '${Q}' is not installed: ${pr(a)}`)}let o=fr(t);return o===null?X(cr):Object.freeze({available:true,module:o})})();return M=r,r}n(re,"loadEverfurDaily");function pr(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}n(pr,"describe");function Ve(e){if(!ee(e)||!("errorMsg"in e))return null;let r=e.errorMsg;return typeof r=="string"&&r.length>0?r:null}n(Ve,"dailyErrorMessage");function Ne(e){return e?Object.keys(e).filter(r=>r!=="local").length:0}n(Ne,"remoteParticipantCount");var vr=44,Ue=3,Er=420,Tr=.35,hr=1,Cr=.6;function xr({theme:e}){let r=e.motion.reducedMotion,[t,o]=react.useState(0);return react.useEffect(()=>{if(r)return;let a=setInterval(()=>o(l=>(l+1)%Ue),Er);return ()=>clearInterval(a)},[r]),jsxRuntime.jsx("div",{"aria-hidden":"true","data-testid":"everfur-vet-call-lobby-dots",style:{display:"flex",gap:e.space.xs,justifyContent:"center"},children:Array.from({length:Ue},(a,l)=>jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:e.radius.pill,backgroundColor:e.color.text.onBrand,opacity:r?Cr:l===t?hr:Tr,transition:r?"none":`opacity ${e.motion.duration.fast}ms ${e.motion.easing.standard}`}},l))})}n(xr,"WaitingDots");function ne(e){let{clinicianName:r,petName:t,consultMinutes:o=10,onLeave:a,style:l,className:u}=e,T=w(),i=react.useMemo(()=>kr(T),[T]),_=d.lobbyTitle(r),A=d.lobbyPrep(t);return jsxRuntime.jsxs("section",{className:u,"data-testid":"everfur-vet-call-lobby",style:{...i.root,...l},children:[jsxRuntime.jsx("div",{style:i.topRow,children:jsxRuntime.jsx("button",{type:"button",onClick:a,"data-testid":"everfur-vet-call-lobby-leave",style:i.leave,children:d.leaveCta})}),jsxRuntime.jsxs("div",{style:i.center,children:[jsxRuntime.jsxs("div",{"aria-hidden":"true","data-testid":"everfur-vet-call-lobby-avatar",style:i.avatar,children:[jsxRuntime.jsx("span",{style:i.avatarHead}),jsxRuntime.jsx("span",{style:i.avatarBody})]}),jsxRuntime.jsxs("div",{"aria-live":"polite",style:i.titleBlock,children:[jsxRuntime.jsx("p",{"data-testid":"everfur-vet-call-lobby-title",style:i.title,children:_}),jsxRuntime.jsx("p",{style:i.subtitle,children:d.lobbySubtitle})]}),jsxRuntime.jsx(xr,{theme:T})]}),jsxRuntime.jsxs("div",{"data-testid":"everfur-vet-call-lobby-prep",style:i.prepCard,children:[jsxRuntime.jsx("p",{style:i.prepLabel,children:d.lobbyPrepLabel}),jsxRuntime.jsx("p",{style:i.prepBody,children:A})]}),jsxRuntime.jsx("p",{"data-testid":"everfur-vet-call-lobby-duration",style:i.duration,children:d.lobbyDuration(o)})]})}n(ne,"EverfurVetCallLobby");function kr(e){let{color:r,space:t,radius:o,type:a}=e,l=r.text.onBrand,u=132;return {root:{...U,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.lg,padding:t.lg,borderRadius:o.lg,backgroundColor:r.brand,color:l},topRow:{display:"flex",alignItems:"center"},leave:{minHeight:vr,padding:`0 ${t.md}px`,margin:0,border:0,background:"transparent",color:l,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body},center:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.md},avatar:{position:"relative",width:u,height:u,borderRadius:o.pill,overflow:"hidden",backgroundColor:r.brandSoft,display:"flex",alignItems:"center",justifyContent:"center"},avatarHead:{position:"absolute",top:u*.24,width:u*.28,height:u*.28,borderRadius:o.pill,backgroundColor:l,opacity:.55},avatarBody:{position:"absolute",top:u*.58,width:u*.52,height:u*.34,borderTopLeftRadius:u*.26,borderTopRightRadius:u*.26,backgroundColor:l,opacity:.55},titleBlock:{textAlign:"center"},title:{margin:0,...m(e,"bold"),fontSize:a.size.heading,color:l},subtitle:{margin:`${e.space.xs}px 0 0`,fontSize:a.size.bodyTight,color:l,opacity:.75},prepCard:{display:"flex",flexDirection:"column",gap:t.xs,padding:t.md,borderRadius:o.md,backgroundColor:r.brandSoft},prepLabel:{margin:0,...m(e,"medium"),fontSize:a.size.micro,letterSpacing:a.letterSpacing.eyebrow,color:l,opacity:.75},prepBody:{margin:0,fontSize:a.size.bodyTight,color:l},duration:{margin:0,textAlign:"center",...m(e,"medium"),fontSize:a.size.micro,letterSpacing:a.letterSpacing.eyebrow,color:l,opacity:.75}}}n(kr,"makeLobbyStyles");var He=44,Sr="16 / 9",wr="16px",Pr=["participant-joined","participant-updated","participant-left"];function Lr(e){let{roomUrl:r,token:t,onLeave:o,clinicianName:a,petName:l,displayName:u,daily:T,telemetry:i,onUnavailable:_,renderUnavailable:A,style:te,className:oe}=ve(e,["onLeave","onUnavailable"]),ae=w(),c=react.useMemo(()=>Ar(ae),[ae]),le=`${react.useId()}-recording-notice`,[D,k]=react.useState("joining"),[We,ie]=react.useState(0),[z,se]=react.useState(null),[B,I]=react.useState(null),[j,de]=react.useState(false),ue=react.useRef(null),F=react.useRef(null),ce=react.useRef(false),h=react.useRef({onLeave:o,onUnavailable:_,daily:T,telemetry:i});h.current={onLeave:o,onUnavailable:_,daily:T,telemetry:i};let C=react.useCallback(()=>{ce.current||(ce.current=true,S(h.current.onLeave));},[]);react.useEffect(()=>{let s=false;I(null),de(false);let f=n((b,W)=>{s||(se({reason:b,detail:W}),S(h.current.onUnavailable,b,W));},"refuse");if(!G(r,t)){f("roomUnusable","the call needs an https room URL and a non-empty join token");return}let R=h.current.daily;return R!==void 0?(I(()=>R),()=>{s=true;}):(re().then(b=>{if(!s){if(!b.available){_r(Z),f("dailyMissing",b.reason);return}I(()=>b.module);}}),()=>{s=true;})},[r,t]),react.useEffect(()=>{if(B===null||!j)return;let s=false,f=null,R=[],b=n((E,v)=>{s||(se({reason:E,detail:v}),S(h.current.onUnavailable,E,v));},"refuse");return n(async()=>{let E=ue.current;if(!E)return;let v=h.current.telemetry??pe;try{f=B.createFrame(E,{showLeaveButton:!0,showFullscreenButton:!1,iframeStyle:{width:"100%",height:"100%",border:"0",borderRadius:wr}});}catch(p){b("dailyMissing",`createFrame failed: ${Ie(p)}`);return}F.current=f;let x=n((p,ye)=>{R.push({event:p,handler:ye}),f?.on(p,ye);},"attach"),Ge=n(()=>{s||f===null||ie(ze(f));},"syncParticipants");for(let p of Pr)x(p,Ge);x("joined-meeting",()=>{s||f===null||(k("joined"),ie(ze(f)));}),x("left-meeting",()=>{s||(k("left"),C());}),x("error",p=>{s||(k("error"),v.trackExpectedFailure("televet.call.join_failed",{provider:"daily",detail:Ve(p)??"unknown"}));});try{if(await f.join({url:r,token:t,userName:u}),s)return;v.track("televet.call.joined",{provider:"daily"});}catch(p){if(s)return;k("error"),v.trackExpectedFailure("televet.call.join_failed",{provider:"daily",detail:Ie(p)});}},"start")(),()=>{s=true;for(let{event:v,handler:x}of R)try{f?.off(v,x);}catch{}let E=F.current;F.current=null,E?.destroy().catch(()=>{});}},[B,j,r,t,u,C]);let fe=react.useCallback(()=>{let s=F.current;if(F.current=null,k("left"),!s){C();return}(async()=>{try{await s.leave();}catch{}try{await s.destroy();}catch{}C();})();},[C]);return z!==null?A?jsxRuntime.jsx(jsxRuntime.Fragment,{children:A(z.reason,z.detail)}):null:B===null?null:j?jsxRuntime.jsxs("div",{className:oe,"data-testid":"everfur-vet-call",style:{...c.root,...te},children:[D==="left"?null:jsxRuntime.jsx("div",{ref:ue,"data-testid":"everfur-vet-call-frame",style:{...c.frame,...D==="error"?c.frameHidden:null}}),D==="joined"&&We===0?jsxRuntime.jsx(ne,{clinicianName:a,petName:l,onLeave:fe}):null,D==="error"?jsxRuntime.jsxs("div",{role:"alert","data-testid":"everfur-vet-call-failed",style:c.failed,children:[jsxRuntime.jsx("p",{style:c.failedText,children:d.joinFailedReason}),jsxRuntime.jsx("button",{type:"button",onClick:fe,"data-testid":"everfur-vet-call-failed-leave",style:c.failedLeave,children:d.leaveCta})]}):null]}):jsxRuntime.jsx("div",{className:oe,"data-testid":"everfur-vet-call",style:{...c.root,...te},children:jsxRuntime.jsxs("div",{role:"alertdialog","aria-labelledby":le,"data-testid":"everfur-vet-call-recording-notice",style:c.notice,children:[jsxRuntime.jsx("p",{id:le,style:c.noticeTitle,children:d.recordingNoticeTitle}),jsxRuntime.jsxs("div",{style:c.noticeActions,children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>de(true),"data-testid":"everfur-vet-call-recording-continue",style:c.noticeContinue,children:d.recordingNoticeCta}),jsxRuntime.jsx("button",{type:"button",onClick:C,"data-testid":"everfur-vet-call-recording-decline",style:c.failedLeave,children:d.recordingNoticeDecline})]})]})})}n(Lr,"EverfurVetCall");function ze(e){try{return Ne(e.participants())}catch{return 0}}n(ze,"countRemotes");function Ie(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown error"}n(Ie,"describe");var je=false;function _r(e){if(je)return;je=true;let r=globalThis.console;try{r?.warn?.(e);}catch{}}n(_r,"warnOnce");function Ar(e){let{color:r,space:t,radius:o,type:a}=e;return {root:{...U,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.md,width:"100%"},frame:{position:"relative",width:"100%",aspectRatio:Sr,overflow:"hidden",borderRadius:o.lg,backgroundColor:r.brandInk},frameHidden:{display:"none"},failed:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:t.md,padding:t.lg,borderRadius:o.md,border:`1px solid ${r.brandBorder}`,backgroundColor:r.surfaceCream,color:r.text.primary},failedText:{margin:0,fontSize:a.size.bodyTight,color:r.text.primary},notice:{display:"flex",flexDirection:"column",gap:t.md,padding:t.lg,borderRadius:o.md,border:`1px solid ${r.brandBorder}`,backgroundColor:r.surface,color:r.text.primary},noticeTitle:{margin:0,...m(e,"medium"),fontSize:a.size.subtitle,color:r.text.primary},noticeActions:{display:"flex",flexWrap:"wrap",gap:t.md},noticeContinue:{minHeight:He,padding:`0 ${t.lg}px`,borderRadius:o.pill,border:0,backgroundColor:r.primary,color:r.onPrimary,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body},failedLeave:{minHeight:He,padding:`0 ${t.lg}px`,borderRadius:o.pill,border:`1.5px solid ${r.brand}`,backgroundColor:"transparent",color:r.brand,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body}}}n(Ar,"makeCallStyles");exports.EVERFUR_DAILY_SETUP=Z;exports.EverfurVetCall=Lr;exports.EverfurVetCallLobby=ne;exports.VET_CALL_CONSULT_MINUTES=$;exports.VET_CALL_COPY=d;exports.isEverfurDailyModule=De;exports.isSafeRoomUrl=me;exports.isUsableRoomCredential=G;exports.loadEverfurDaily=re;exports.registerEverfurDaily=yr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {createContext,useMemo,useId,useState,useRef,useCallback,useEffect,useContext}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var Ge=Object.defineProperty;var n=(e,r)=>Ge(e,"name",{value:r,configurable:true});var ye=Object.freeze({track(){},trackExpectedFailure(){}});function pe(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}n(pe,"isSafeRoomUrl");function W(e,r){return pe(e)&&r.trim().length>0}n(W,"isUsableRoomCredential");function me(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(me,"reportHostFailure");function $e(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n($e,"isThenable");function S(e,...r){if(typeof e=="function")try{let t=e(...r);return $e(t)&&Promise.resolve(t).then(void 0,me),t}catch(t){me(t);return}}n(S,"callHost");var ge=new WeakMap;function Ye(e){if(typeof e!="function")return;let r=ge.get(e);if(r!==void 0)return r;let t=n((...o)=>{S(e,...o);},"guarded");return ge.set(e,t),t}n(Ye,"guardHost");function be(e,r){let t=null;for(let o of r){let a=e[o];typeof a=="function"&&(t??={...e},t[o]=Ye(a));}return t??e}n(be,"guardHostProps");var G=10,d=Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"Usually under a minute",lobbyPrepLabel:"WHILE YOU WAIT",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:n(e=>{let r=e?.trim()??"";return r.length>0?`${r} is joining`:d.lobbyTitleNoName},"lobbyTitle"),lobbyPrep:n(e=>{let r=e?.trim()??"";return r.length>0?`Have ${r} nearby and somewhere well lit.`:d.lobbyPrepNoPet},"lobbyPrep"),lobbyDuration:n(e=>`${e} MINUTE VISIT`,"lobbyDuration"),joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function q(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))q(e[r]);}return e}n(q,"deepFreeze");var qe=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Ee={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},he={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},ve={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Ke={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Je={regular:"400",medium:"500",bold:"700"},Xe={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Ze=0,V="System",N="monospace",Qe=["content","heading","control","compact","badge"];function er(e){let r={};for(let t of Qe)r[t]=e;return r}n(er,"authoredTierSizes");function Te(){return {family:V,mono:N,fontUrl:null,families:{regular:V,medium:V,bold:V,mono:N,monoMedium:N,monoBold:N},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:ve,tierSizes:er(ve),lineHeight:Ke,weight:Je,letterSpacing:Xe,scale:1,maxScale:Ze,scaleCaps:qe}}n(Te,"baseType");var Ce={},$=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function Y(e){return `cubic-bezier(${e.join(", ")})`}n(Y,"cssCubicBezier");var xe={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:Y($.standard),emphasized:Y($.emphasized),exit:Y($.exit)},reducedMotion:false},rr={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},ke=q({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:rr,space:Ee,radius:he,type:Te(),motion:xe,slots:Ce}),nr={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};q({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:nr,space:Ee,radius:he,type:Te(),motion:xe,slots:Ce});var Fe=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Re=globalThis,K=Re[Fe]??(Re[Fe]=createContext(ke));K.displayName??="EverfurThemeContext";function w(){return useContext(K)}n(w,"useEverfurTheme");var Se=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var we='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',ar="System";function lr(e){let r=e.trim();return r.length===0||r===ar?we:`${Pe(r)}, ${we}`}n(lr,"cssFontFamily");function ir(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Pe(r)}, ui-monospace, Menlo, Consolas, monospace`}n(ir,"cssMonoFamily");function Pe(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}n(Pe,"quote");function m(e,r){let t=e.type,o=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?ir(o):lr(o),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[Se[r]]}}n(m,"faceCss");var Le=Symbol.for("@everfur/sdk/televet");function sr(){let e=globalThis,r=e[Le];if(r!==void 0)return r;let t={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[Le]=t,t}n(sr,"televetGlobal");function Ae(e){sr().dailyRegistered=e;}n(Ae,"markEverfurDailyRegistered");var X=`[everfur] The in-page vet call needs @daily-co/daily-js, which this app has not registered. Install it and call registerEverfurDaily(() => import('@daily-co/daily-js')) once in your app entry, before any Everfur call surface mounts. Until then the in-page visit tells the member the call cannot be joined; <VetVisitButton prefer="redirect" /> is the explicit way to the hosted visit in a new tab instead.`,Z="@daily-co/daily-js",dr=`optional peer '${Z}' has no registered loader`,ur=`optional peer '${Z}' is present but failed its shape check`;function Q(e){return typeof e=="object"&&e!==null}n(Q,"isRecordLike");function cr(e){let r=e;for(let t=0;t<3;t+=1){if(_e(r))return r;if(!Q(r)||!("default"in r))return null;r=r.default;}return null}n(cr,"normalizeDailyModule");function _e(e){return !Q(e)&&typeof e!="function"?false:typeof e.createFrame=="function"}n(_e,"isEverfurDailyModule");var De=null,M=null;function J(e){return Object.freeze({available:false,module:null,reason:e})}n(J,"unavailable");function fr(e){De=e,M=null,Ae(e!==null);}n(fr,"registerEverfurDaily");function ee(){if(M!==null)return M;let e=De;if(e===null)return Promise.resolve(J(dr));let r=(async()=>{let t;try{t=await e();}catch(a){return J(`optional peer '${Z}' is not installed: ${yr(a)}`)}let o=cr(t);return o===null?J(ur):Object.freeze({available:true,module:o})})();return M=r,r}n(ee,"loadEverfurDaily");function yr(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}n(yr,"describe");function Be(e){if(!Q(e)||!("errorMsg"in e))return null;let r=e.errorMsg;return typeof r=="string"&&r.length>0?r:null}n(Be,"dailyErrorMessage");function Ve(e){return e?Object.keys(e).filter(r=>r!=="local").length:0}n(Ve,"remoteParticipantCount");var br=44,Ne=3,vr=420,Er=.35,hr=1,Tr=.6;function Cr({theme:e}){let r=e.motion.reducedMotion,[t,o]=useState(0);return useEffect(()=>{if(r)return;let a=setInterval(()=>o(l=>(l+1)%Ne),vr);return ()=>clearInterval(a)},[r]),jsx("div",{"aria-hidden":"true","data-testid":"everfur-vet-call-lobby-dots",style:{display:"flex",gap:e.space.xs,justifyContent:"center"},children:Array.from({length:Ne},(a,l)=>jsx("span",{style:{width:6,height:6,borderRadius:e.radius.pill,backgroundColor:e.color.text.onBrand,opacity:r?Tr:l===t?hr:Er,transition:r?"none":`opacity ${e.motion.duration.fast}ms ${e.motion.easing.standard}`}},l))})}n(Cr,"WaitingDots");function re(e){let{clinicianName:r,petName:t,consultMinutes:o=10,onLeave:a,style:l,className:u}=e,h=w(),i=useMemo(()=>xr(h),[h]),A=d.lobbyTitle(r),_=d.lobbyPrep(t);return jsxs("section",{className:u,"data-testid":"everfur-vet-call-lobby",style:{...i.root,...l},children:[jsx("div",{style:i.topRow,children:jsx("button",{type:"button",onClick:a,"data-testid":"everfur-vet-call-lobby-leave",style:i.leave,children:d.leaveCta})}),jsxs("div",{style:i.center,children:[jsxs("div",{"aria-hidden":"true","data-testid":"everfur-vet-call-lobby-avatar",style:i.avatar,children:[jsx("span",{style:i.avatarHead}),jsx("span",{style:i.avatarBody})]}),jsxs("div",{"aria-live":"polite",style:i.titleBlock,children:[jsx("p",{"data-testid":"everfur-vet-call-lobby-title",style:i.title,children:A}),jsx("p",{style:i.subtitle,children:d.lobbySubtitle})]}),jsx(Cr,{theme:h})]}),jsxs("div",{"data-testid":"everfur-vet-call-lobby-prep",style:i.prepCard,children:[jsx("p",{style:i.prepLabel,children:d.lobbyPrepLabel}),jsx("p",{style:i.prepBody,children:_})]}),jsx("p",{"data-testid":"everfur-vet-call-lobby-duration",style:i.duration,children:d.lobbyDuration(o)})]})}n(re,"EverfurVetCallLobby");function xr(e){let{color:r,space:t,radius:o,type:a}=e,l=r.text.onBrand,u=132;return {root:{boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.lg,padding:t.lg,borderRadius:o.lg,backgroundColor:r.brand,color:l},topRow:{display:"flex",alignItems:"center"},leave:{minHeight:br,padding:`0 ${t.md}px`,margin:0,border:0,background:"transparent",color:l,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body},center:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.md},avatar:{position:"relative",width:u,height:u,borderRadius:o.pill,overflow:"hidden",backgroundColor:r.brandSoft,display:"flex",alignItems:"center",justifyContent:"center"},avatarHead:{position:"absolute",top:u*.24,width:u*.28,height:u*.28,borderRadius:o.pill,backgroundColor:l,opacity:.55},avatarBody:{position:"absolute",top:u*.58,width:u*.52,height:u*.34,borderTopLeftRadius:u*.26,borderTopRightRadius:u*.26,backgroundColor:l,opacity:.55},titleBlock:{textAlign:"center"},title:{margin:0,...m(e,"bold"),fontSize:a.size.heading,color:l},subtitle:{margin:`${e.space.xs}px 0 0`,fontSize:a.size.bodyTight,color:l,opacity:.75},prepCard:{display:"flex",flexDirection:"column",gap:t.xs,padding:t.md,borderRadius:o.md,backgroundColor:r.brandSoft},prepLabel:{margin:0,...m(e,"medium"),fontSize:a.size.micro,letterSpacing:a.letterSpacing.eyebrow,color:l,opacity:.75},prepBody:{margin:0,fontSize:a.size.bodyTight,color:l},duration:{margin:0,textAlign:"center",...m(e,"medium"),fontSize:a.size.micro,letterSpacing:a.letterSpacing.eyebrow,color:l,opacity:.75}}}n(xr,"makeLobbyStyles");var Oe=44,Rr="16 / 9",Sr="16px",wr=["participant-joined","participant-updated","participant-left"];function Pr(e){let{roomUrl:r,token:t,onLeave:o,clinicianName:a,petName:l,displayName:u,daily:h,telemetry:i,onUnavailable:A,renderUnavailable:_,style:ne,className:te}=be(e,["onLeave","onUnavailable"]),oe=w(),c=useMemo(()=>Ar(oe),[oe]),ae=`${useId()}-recording-notice`,[D,k]=useState("joining"),[je,le]=useState(0),[H,ie]=useState(null),[B,z]=useState(null),[I,se]=useState(false),de=useRef(null),F=useRef(null),ue=useRef(false),T=useRef({onLeave:o,onUnavailable:A,daily:h,telemetry:i});T.current={onLeave:o,onUnavailable:A,daily:h,telemetry:i};let C=useCallback(()=>{ue.current||(ue.current=true,S(T.current.onLeave));},[]);useEffect(()=>{let s=false;z(null),se(false);let f=n((b,j)=>{s||(ie({reason:b,detail:j}),S(T.current.onUnavailable,b,j));},"refuse");if(!W(r,t)){f("roomUnusable","the call needs an https room URL and a non-empty join token");return}let R=T.current.daily;return R!==void 0?(z(()=>R),()=>{s=true;}):(ee().then(b=>{if(!s){if(!b.available){Lr(X),f("dailyMissing",b.reason);return}z(()=>b.module);}}),()=>{s=true;})},[r,t]),useEffect(()=>{if(B===null||!I)return;let s=false,f=null,R=[],b=n((E,v)=>{s||(ie({reason:E,detail:v}),S(T.current.onUnavailable,E,v));},"refuse");return n(async()=>{let E=de.current;if(!E)return;let v=T.current.telemetry??ye;try{f=B.createFrame(E,{showLeaveButton:!0,showFullscreenButton:!1,iframeStyle:{width:"100%",height:"100%",border:"0",borderRadius:Sr}});}catch(p){b("dailyMissing",`createFrame failed: ${ze(p)}`);return}F.current=f;let x=n((p,fe)=>{R.push({event:p,handler:fe}),f?.on(p,fe);},"attach"),We=n(()=>{s||f===null||le(He(f));},"syncParticipants");for(let p of wr)x(p,We);x("joined-meeting",()=>{s||f===null||(k("joined"),le(He(f)));}),x("left-meeting",()=>{s||(k("left"),C());}),x("error",p=>{s||(k("error"),v.trackExpectedFailure("televet.call.join_failed",{provider:"daily",detail:Be(p)??"unknown"}));});try{if(await f.join({url:r,token:t,userName:u}),s)return;v.track("televet.call.joined",{provider:"daily"});}catch(p){if(s)return;k("error"),v.trackExpectedFailure("televet.call.join_failed",{provider:"daily",detail:ze(p)});}},"start")(),()=>{s=true;for(let{event:v,handler:x}of R)try{f?.off(v,x);}catch{}let E=F.current;F.current=null,E?.destroy().catch(()=>{});}},[B,I,r,t,u,C]);let ce=useCallback(()=>{let s=F.current;if(F.current=null,k("left"),!s){C();return}(async()=>{try{await s.leave();}catch{}try{await s.destroy();}catch{}C();})();},[C]);return H!==null?_?jsx(Fragment,{children:_(H.reason,H.detail)}):null:B===null?null:I?jsxs("div",{className:te,"data-testid":"everfur-vet-call",style:{...c.root,...ne},children:[D==="left"?null:jsx("div",{ref:de,"data-testid":"everfur-vet-call-frame",style:{...c.frame,...D==="error"?c.frameHidden:null}}),D==="joined"&&je===0?jsx(re,{clinicianName:a,petName:l,onLeave:ce}):null,D==="error"?jsxs("div",{role:"alert","data-testid":"everfur-vet-call-failed",style:c.failed,children:[jsx("p",{style:c.failedText,children:d.joinFailedReason}),jsx("button",{type:"button",onClick:ce,"data-testid":"everfur-vet-call-failed-leave",style:c.failedLeave,children:d.leaveCta})]}):null]}):jsx("div",{className:te,"data-testid":"everfur-vet-call",style:{...c.root,...ne},children:jsxs("div",{role:"alertdialog","aria-labelledby":ae,"data-testid":"everfur-vet-call-recording-notice",style:c.notice,children:[jsx("p",{id:ae,style:c.noticeTitle,children:d.recordingNoticeTitle}),jsxs("div",{style:c.noticeActions,children:[jsx("button",{type:"button",onClick:()=>se(true),"data-testid":"everfur-vet-call-recording-continue",style:c.noticeContinue,children:d.recordingNoticeCta}),jsx("button",{type:"button",onClick:C,"data-testid":"everfur-vet-call-recording-decline",style:c.failedLeave,children:d.recordingNoticeDecline})]})]})})}n(Pr,"EverfurVetCall");function He(e){try{return Ve(e.participants())}catch{return 0}}n(He,"countRemotes");function ze(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown error"}n(ze,"describe");var Ie=false;function Lr(e){if(Ie)return;Ie=true;let r=globalThis.console;try{r?.warn?.(e);}catch{}}n(Lr,"warnOnce");function Ar(e){let{color:r,space:t,radius:o,type:a}=e;return {root:{boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.md,width:"100%"},frame:{position:"relative",width:"100%",aspectRatio:Rr,overflow:"hidden",borderRadius:o.lg,backgroundColor:r.brandInk},frameHidden:{display:"none"},failed:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:t.md,padding:t.lg,borderRadius:o.md,border:`1px solid ${r.brandBorder}`,backgroundColor:r.surfaceCream,color:r.text.primary},failedText:{margin:0,fontSize:a.size.bodyTight,color:r.text.primary},notice:{display:"flex",flexDirection:"column",gap:t.md,padding:t.lg,borderRadius:o.md,border:`1px solid ${r.brandBorder}`,backgroundColor:r.surface,color:r.text.primary},noticeTitle:{margin:0,...m(e,"medium"),fontSize:a.size.subtitle,color:r.text.primary},noticeActions:{display:"flex",flexWrap:"wrap",gap:t.md},noticeContinue:{minHeight:Oe,padding:`0 ${t.lg}px`,borderRadius:o.pill,border:0,backgroundColor:r.primary,color:r.onPrimary,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body},failedLeave:{minHeight:Oe,padding:`0 ${t.lg}px`,borderRadius:o.pill,border:`1.5px solid ${r.brand}`,backgroundColor:"transparent",color:r.brand,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body}}}n(Ar,"makeCallStyles");export{X as EVERFUR_DAILY_SETUP,Pr as EverfurVetCall,re as EverfurVetCallLobby,G as VET_CALL_CONSULT_MINUTES,d as VET_CALL_COPY,_e as isEverfurDailyModule,pe as isSafeRoomUrl,W as isUsableRoomCredential,ee as loadEverfurDaily,fr as registerEverfurDaily};
|
|
1
|
+
import {createContext,useMemo,useId,useState,useRef,useCallback,useEffect,useContext}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var $e=Object.defineProperty;var n=(e,r)=>$e(e,"name",{value:r,configurable:true});var pe=Object.freeze({track(){},trackExpectedFailure(){}});function me(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}n(me,"isSafeRoomUrl");function G(e,r){return me(e)&&r.trim().length>0}n(G,"isUsableRoomCredential");function ge(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(ge,"reportHostFailure");function Ye(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(Ye,"isThenable");function S(e,...r){if(typeof e=="function")try{let t=e(...r);return Ye(t)&&Promise.resolve(t).then(void 0,ge),t}catch(t){ge(t);return}}n(S,"callHost");var be=new WeakMap;function qe(e){if(typeof e!="function")return;let r=be.get(e);if(r!==void 0)return r;let t=n((...o)=>{S(e,...o);},"guarded");return be.set(e,t),t}n(qe,"guardHost");function ve(e,r){let t=null;for(let o of r){let a=e[o];typeof a=="function"&&(t??={...e},t[o]=qe(a));}return t??e}n(ve,"guardHostProps");var $=10,d=Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"Usually under a minute",lobbyPrepLabel:"WHILE YOU WAIT",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:n(e=>{let r=e?.trim()??"";return r.length>0?`${r} is joining`:d.lobbyTitleNoName},"lobbyTitle"),lobbyPrep:n(e=>{let r=e?.trim()??"";return r.length>0?`Have ${r} nearby and somewhere well lit.`:d.lobbyPrepNoPet},"lobbyPrep"),lobbyDuration:n(e=>`${e} MINUTE VISIT`,"lobbyDuration"),joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function K(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))K(e[r]);}return e}n(K,"deepFreeze");var Ke=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Te={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},he={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Ee={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Je={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Xe={regular:"400",medium:"500",bold:"700"},Ze={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Qe=0,V="System",N="monospace",er=["content","heading","control","compact","badge"];function rr(e){let r={};for(let t of er)r[t]=e;return r}n(rr,"authoredTierSizes");function Ce(){return {family:V,mono:N,fontUrl:null,families:{regular:V,medium:V,bold:V,mono:N,monoMedium:N,monoBold:N},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Ee,tierSizes:rr(Ee),lineHeight:Je,weight:Xe,letterSpacing:Ze,scale:1,maxScale:Qe,scaleCaps:Ke}}n(Ce,"baseType");var xe={},Y=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function q(e){return `cubic-bezier(${e.join(", ")})`}n(q,"cssCubicBezier");var ke={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:q(Y.standard),emphasized:q(Y.emphasized),exit:q(Y.exit)},reducedMotion:false},nr={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},Fe=K({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:nr,space:Te,radius:he,type:Ce(),motion:ke,slots:xe}),tr={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};K({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:tr,space:Te,radius:he,type:Ce(),motion:ke,slots:xe});var Re=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Se=globalThis,J=Se[Re]??(Se[Re]=createContext(Fe));J.displayName??="EverfurThemeContext";function w(){return useContext(J)}n(w,"useEverfurTheme");var we=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var Pe='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',lr="System";function ir(e){let r=e.trim();return r.length===0||r===lr?Pe:`${Le(r)}, ${Pe}`}n(ir,"cssFontFamily");function sr(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Le(r)}, ui-monospace, Menlo, Consolas, monospace`}n(sr,"cssMonoFamily");function Le(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}n(Le,"quote");function m(e,r){let t=e.type,o=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?sr(o):ir(o),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[we[r]]}}n(m,"faceCss");var U=Object.freeze({textAlign:"start"});var _e=Symbol.for("@everfur/sdk/televet");function dr(){let e=globalThis,r=e[_e];if(r!==void 0)return r;let t={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[_e]=t,t}n(dr,"televetGlobal");function Ae(e){dr().dailyRegistered=e;}n(Ae,"markEverfurDailyRegistered");var Z=`[everfur] The in-page vet call needs @daily-co/daily-js, which this app has not registered. Install it and call registerEverfurDaily(() => import('@daily-co/daily-js')) once in your app entry, before any Everfur call surface mounts. Until then the in-page visit tells the member the call cannot be joined; <VetVisitButton prefer="redirect" /> is the explicit way to the hosted visit in a new tab instead.`,Q="@daily-co/daily-js",ur=`optional peer '${Q}' has no registered loader`,cr=`optional peer '${Q}' is present but failed its shape check`;function ee(e){return typeof e=="object"&&e!==null}n(ee,"isRecordLike");function fr(e){let r=e;for(let t=0;t<3;t+=1){if(De(r))return r;if(!ee(r)||!("default"in r))return null;r=r.default;}return null}n(fr,"normalizeDailyModule");function De(e){return !ee(e)&&typeof e!="function"?false:typeof e.createFrame=="function"}n(De,"isEverfurDailyModule");var Be=null,M=null;function X(e){return Object.freeze({available:false,module:null,reason:e})}n(X,"unavailable");function yr(e){Be=e,M=null,Ae(e!==null);}n(yr,"registerEverfurDaily");function re(){if(M!==null)return M;let e=Be;if(e===null)return Promise.resolve(X(ur));let r=(async()=>{let t;try{t=await e();}catch(a){return X(`optional peer '${Q}' is not installed: ${pr(a)}`)}let o=fr(t);return o===null?X(cr):Object.freeze({available:true,module:o})})();return M=r,r}n(re,"loadEverfurDaily");function pr(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}n(pr,"describe");function Ve(e){if(!ee(e)||!("errorMsg"in e))return null;let r=e.errorMsg;return typeof r=="string"&&r.length>0?r:null}n(Ve,"dailyErrorMessage");function Ne(e){return e?Object.keys(e).filter(r=>r!=="local").length:0}n(Ne,"remoteParticipantCount");var vr=44,Ue=3,Er=420,Tr=.35,hr=1,Cr=.6;function xr({theme:e}){let r=e.motion.reducedMotion,[t,o]=useState(0);return useEffect(()=>{if(r)return;let a=setInterval(()=>o(l=>(l+1)%Ue),Er);return ()=>clearInterval(a)},[r]),jsx("div",{"aria-hidden":"true","data-testid":"everfur-vet-call-lobby-dots",style:{display:"flex",gap:e.space.xs,justifyContent:"center"},children:Array.from({length:Ue},(a,l)=>jsx("span",{style:{width:6,height:6,borderRadius:e.radius.pill,backgroundColor:e.color.text.onBrand,opacity:r?Cr:l===t?hr:Tr,transition:r?"none":`opacity ${e.motion.duration.fast}ms ${e.motion.easing.standard}`}},l))})}n(xr,"WaitingDots");function ne(e){let{clinicianName:r,petName:t,consultMinutes:o=10,onLeave:a,style:l,className:u}=e,T=w(),i=useMemo(()=>kr(T),[T]),_=d.lobbyTitle(r),A=d.lobbyPrep(t);return jsxs("section",{className:u,"data-testid":"everfur-vet-call-lobby",style:{...i.root,...l},children:[jsx("div",{style:i.topRow,children:jsx("button",{type:"button",onClick:a,"data-testid":"everfur-vet-call-lobby-leave",style:i.leave,children:d.leaveCta})}),jsxs("div",{style:i.center,children:[jsxs("div",{"aria-hidden":"true","data-testid":"everfur-vet-call-lobby-avatar",style:i.avatar,children:[jsx("span",{style:i.avatarHead}),jsx("span",{style:i.avatarBody})]}),jsxs("div",{"aria-live":"polite",style:i.titleBlock,children:[jsx("p",{"data-testid":"everfur-vet-call-lobby-title",style:i.title,children:_}),jsx("p",{style:i.subtitle,children:d.lobbySubtitle})]}),jsx(xr,{theme:T})]}),jsxs("div",{"data-testid":"everfur-vet-call-lobby-prep",style:i.prepCard,children:[jsx("p",{style:i.prepLabel,children:d.lobbyPrepLabel}),jsx("p",{style:i.prepBody,children:A})]}),jsx("p",{"data-testid":"everfur-vet-call-lobby-duration",style:i.duration,children:d.lobbyDuration(o)})]})}n(ne,"EverfurVetCallLobby");function kr(e){let{color:r,space:t,radius:o,type:a}=e,l=r.text.onBrand,u=132;return {root:{...U,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.lg,padding:t.lg,borderRadius:o.lg,backgroundColor:r.brand,color:l},topRow:{display:"flex",alignItems:"center"},leave:{minHeight:vr,padding:`0 ${t.md}px`,margin:0,border:0,background:"transparent",color:l,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body},center:{display:"flex",flexDirection:"column",alignItems:"center",gap:t.md},avatar:{position:"relative",width:u,height:u,borderRadius:o.pill,overflow:"hidden",backgroundColor:r.brandSoft,display:"flex",alignItems:"center",justifyContent:"center"},avatarHead:{position:"absolute",top:u*.24,width:u*.28,height:u*.28,borderRadius:o.pill,backgroundColor:l,opacity:.55},avatarBody:{position:"absolute",top:u*.58,width:u*.52,height:u*.34,borderTopLeftRadius:u*.26,borderTopRightRadius:u*.26,backgroundColor:l,opacity:.55},titleBlock:{textAlign:"center"},title:{margin:0,...m(e,"bold"),fontSize:a.size.heading,color:l},subtitle:{margin:`${e.space.xs}px 0 0`,fontSize:a.size.bodyTight,color:l,opacity:.75},prepCard:{display:"flex",flexDirection:"column",gap:t.xs,padding:t.md,borderRadius:o.md,backgroundColor:r.brandSoft},prepLabel:{margin:0,...m(e,"medium"),fontSize:a.size.micro,letterSpacing:a.letterSpacing.eyebrow,color:l,opacity:.75},prepBody:{margin:0,fontSize:a.size.bodyTight,color:l},duration:{margin:0,textAlign:"center",...m(e,"medium"),fontSize:a.size.micro,letterSpacing:a.letterSpacing.eyebrow,color:l,opacity:.75}}}n(kr,"makeLobbyStyles");var He=44,Sr="16 / 9",wr="16px",Pr=["participant-joined","participant-updated","participant-left"];function Lr(e){let{roomUrl:r,token:t,onLeave:o,clinicianName:a,petName:l,displayName:u,daily:T,telemetry:i,onUnavailable:_,renderUnavailable:A,style:te,className:oe}=ve(e,["onLeave","onUnavailable"]),ae=w(),c=useMemo(()=>Ar(ae),[ae]),le=`${useId()}-recording-notice`,[D,k]=useState("joining"),[We,ie]=useState(0),[z,se]=useState(null),[B,I]=useState(null),[j,de]=useState(false),ue=useRef(null),F=useRef(null),ce=useRef(false),h=useRef({onLeave:o,onUnavailable:_,daily:T,telemetry:i});h.current={onLeave:o,onUnavailable:_,daily:T,telemetry:i};let C=useCallback(()=>{ce.current||(ce.current=true,S(h.current.onLeave));},[]);useEffect(()=>{let s=false;I(null),de(false);let f=n((b,W)=>{s||(se({reason:b,detail:W}),S(h.current.onUnavailable,b,W));},"refuse");if(!G(r,t)){f("roomUnusable","the call needs an https room URL and a non-empty join token");return}let R=h.current.daily;return R!==void 0?(I(()=>R),()=>{s=true;}):(re().then(b=>{if(!s){if(!b.available){_r(Z),f("dailyMissing",b.reason);return}I(()=>b.module);}}),()=>{s=true;})},[r,t]),useEffect(()=>{if(B===null||!j)return;let s=false,f=null,R=[],b=n((E,v)=>{s||(se({reason:E,detail:v}),S(h.current.onUnavailable,E,v));},"refuse");return n(async()=>{let E=ue.current;if(!E)return;let v=h.current.telemetry??pe;try{f=B.createFrame(E,{showLeaveButton:!0,showFullscreenButton:!1,iframeStyle:{width:"100%",height:"100%",border:"0",borderRadius:wr}});}catch(p){b("dailyMissing",`createFrame failed: ${Ie(p)}`);return}F.current=f;let x=n((p,ye)=>{R.push({event:p,handler:ye}),f?.on(p,ye);},"attach"),Ge=n(()=>{s||f===null||ie(ze(f));},"syncParticipants");for(let p of Pr)x(p,Ge);x("joined-meeting",()=>{s||f===null||(k("joined"),ie(ze(f)));}),x("left-meeting",()=>{s||(k("left"),C());}),x("error",p=>{s||(k("error"),v.trackExpectedFailure("televet.call.join_failed",{provider:"daily",detail:Ve(p)??"unknown"}));});try{if(await f.join({url:r,token:t,userName:u}),s)return;v.track("televet.call.joined",{provider:"daily"});}catch(p){if(s)return;k("error"),v.trackExpectedFailure("televet.call.join_failed",{provider:"daily",detail:Ie(p)});}},"start")(),()=>{s=true;for(let{event:v,handler:x}of R)try{f?.off(v,x);}catch{}let E=F.current;F.current=null,E?.destroy().catch(()=>{});}},[B,j,r,t,u,C]);let fe=useCallback(()=>{let s=F.current;if(F.current=null,k("left"),!s){C();return}(async()=>{try{await s.leave();}catch{}try{await s.destroy();}catch{}C();})();},[C]);return z!==null?A?jsx(Fragment,{children:A(z.reason,z.detail)}):null:B===null?null:j?jsxs("div",{className:oe,"data-testid":"everfur-vet-call",style:{...c.root,...te},children:[D==="left"?null:jsx("div",{ref:ue,"data-testid":"everfur-vet-call-frame",style:{...c.frame,...D==="error"?c.frameHidden:null}}),D==="joined"&&We===0?jsx(ne,{clinicianName:a,petName:l,onLeave:fe}):null,D==="error"?jsxs("div",{role:"alert","data-testid":"everfur-vet-call-failed",style:c.failed,children:[jsx("p",{style:c.failedText,children:d.joinFailedReason}),jsx("button",{type:"button",onClick:fe,"data-testid":"everfur-vet-call-failed-leave",style:c.failedLeave,children:d.leaveCta})]}):null]}):jsx("div",{className:oe,"data-testid":"everfur-vet-call",style:{...c.root,...te},children:jsxs("div",{role:"alertdialog","aria-labelledby":le,"data-testid":"everfur-vet-call-recording-notice",style:c.notice,children:[jsx("p",{id:le,style:c.noticeTitle,children:d.recordingNoticeTitle}),jsxs("div",{style:c.noticeActions,children:[jsx("button",{type:"button",onClick:()=>de(true),"data-testid":"everfur-vet-call-recording-continue",style:c.noticeContinue,children:d.recordingNoticeCta}),jsx("button",{type:"button",onClick:C,"data-testid":"everfur-vet-call-recording-decline",style:c.failedLeave,children:d.recordingNoticeDecline})]})]})})}n(Lr,"EverfurVetCall");function ze(e){try{return Ne(e.participants())}catch{return 0}}n(ze,"countRemotes");function Ie(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown error"}n(Ie,"describe");var je=false;function _r(e){if(je)return;je=true;let r=globalThis.console;try{r?.warn?.(e);}catch{}}n(_r,"warnOnce");function Ar(e){let{color:r,space:t,radius:o,type:a}=e;return {root:{...U,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:t.md,width:"100%"},frame:{position:"relative",width:"100%",aspectRatio:Sr,overflow:"hidden",borderRadius:o.lg,backgroundColor:r.brandInk},frameHidden:{display:"none"},failed:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:t.md,padding:t.lg,borderRadius:o.md,border:`1px solid ${r.brandBorder}`,backgroundColor:r.surfaceCream,color:r.text.primary},failedText:{margin:0,fontSize:a.size.bodyTight,color:r.text.primary},notice:{display:"flex",flexDirection:"column",gap:t.md,padding:t.lg,borderRadius:o.md,border:`1px solid ${r.brandBorder}`,backgroundColor:r.surface,color:r.text.primary},noticeTitle:{margin:0,...m(e,"medium"),fontSize:a.size.subtitle,color:r.text.primary},noticeActions:{display:"flex",flexWrap:"wrap",gap:t.md},noticeContinue:{minHeight:He,padding:`0 ${t.lg}px`,borderRadius:o.pill,border:0,backgroundColor:r.primary,color:r.onPrimary,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body},failedLeave:{minHeight:He,padding:`0 ${t.lg}px`,borderRadius:o.pill,border:`1.5px solid ${r.brand}`,backgroundColor:"transparent",color:r.brand,cursor:"pointer",...m(e,"medium"),fontSize:a.size.body}}}n(Ar,"makeCallStyles");export{Z as EVERFUR_DAILY_SETUP,Lr as EverfurVetCall,ne as EverfurVetCallLobby,$ as VET_CALL_CONSULT_MINUTES,d as VET_CALL_COPY,De as isEverfurDailyModule,me as isSafeRoomUrl,G as isUsableRoomCredential,re as loadEverfurDaily,yr as registerEverfurDaily};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var zr=Object.defineProperty;var n=(e,r)=>zr(e,"name",{value:r,configurable:true});var we=Symbol.for("@everfur/sdk/televet");function w(){let e=globalThis,r=e[we];if(r!==void 0)return r;let t={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[we]=t,t}n(w,"televetGlobal");function U(e){let r=w();r.snapshot=Object.freeze({...r.snapshot,...e});for(let t of [...r.listeners])try{t();}catch{}}n(U,"publish");function xe(e){w().presenter=e;}n(xe,"setTelevetPresenter");function Se(){return w().presenter!==null}n(Se,"hasTelevetPresenter");function q(e){let r=w().presenter;if(r===null)return "absent";try{return r(e)===!1?"declined":"presented"}catch(t){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",t),"threw"}}n(q,"callTelevetPresenter");function Fe(e){let r=w();return r.listeners.add(e),()=>{r.listeners.delete(e);}}n(Fe,"subscribeTelevetExperience");function ne(){return w().snapshot}n(ne,"televetExperienceSnapshot");function jr(){return w().hosts.length>0}n(jr,"hasTelevetHost");function ke(e){if(!jr())return false;let r=Object.freeze({...e});return U({request:r,serial:w().snapshot.serial+1}),true}n(ke,"presentTelevetExperience");function oe(){w().snapshot.request!==null&&U({request:null});}n(oe,"dismissTelevetExperience");function Oe(){let e=w(),r=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,r],U({activeHost:e.hosts[0]??null}),r}n(Oe,"claimTelevetHost");function Ve(e){let r=w();r.hosts=r.hosts.filter(o=>o!==e);let t=r.hosts[0]??null;U(t===null?{activeHost:t,request:null}:{activeHost:t});}n(Ve,"releaseTelevetHost");function Dr(e){xe(e);}n(Dr,"registerEverfurTelevetFlow");function Mr(){return Se()}n(Mr,"hasEverfurTelevetFlow");function Nr(e){return q(e)==="presented"}n(Nr,"presentEverfurTelevetFlow");function Pe(e){let r=null;return ()=>{if(r!==null)return r;let t=e();return r=t,t.then(void 0,()=>{r===t&&(r=null);}),t}}n(Pe,"memoizeTelevetLoader");function ze(e){let[r,t]=react.useState(null);react.useEffect(()=>{let d=Oe();return t(d),()=>{Ve(d);}},[]);let o=react.useSyncExternalStore(Fe,ne,ne),a=r!==null&&o.activeHost===r?o.request:null,[u,s]=react.useState(null),l=a!==null&&u===null;return react.useEffect(()=>{if(!l)return;let d=true;return e().then(b=>{d&&s(()=>b);},b=>{d&&(console.warn("[everfur] The in-app vet visit could not load its screens.",b),oe());}),()=>{d=false;}},[l,e]),a===null||u===null?null:{module:u,request:a,serial:o.serial,dismiss:oe}}n(ze,"useTelevetExperienceHost");var Ur=Pe(()=>import('@everfur/sdk/web/televet/booking'));function B(){let e=ze(Ur);if(e===null)return null;let{EverfurTelevetDialog:r}=e.module;return jsxRuntime.jsx(r,{request:e.request,onClose:e.dismiss},e.serial)}n(B,"EverfurTelevetHost");var ie=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(ie.map(e=>e.wireCode));var Br=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),De=Object.freeze(ie.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Br[e.wireCode]}))),Hr=new Map(De.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Wr=Object.freeze(["http_envelope",...[...new Set(De.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function H(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...Wr]){let i=Hr.get(o+t);if(i)return i}}n(H,"contractErrorFor");function Yr(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Yr,"contractDocUrl");function Me(e){return null}n(Me,"publishedDocUrl");var Kr=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function Ne(e){return Kr[e]}n(Ne,"categoryFor");function Le(e){let r=H(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),o=t.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(t.startsWith("AUTH"))return "authExpired";switch(o){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}n(Le,"fromWire");var Gr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ae(e){return Gr.has(e)}n(ae,"isAutoRetryable");var $r=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Ue(e){return ae(e)||$r.has(e)}n(Ue,"isRetryableCode");var Qr=500,se=8e3,qe=4;function Be(e,r=Math.random){let t=Math.max(0,e),o=Math.min(Qr*2**t,se);return Math.floor(r()*o)}n(Be,"backoffDelayMs");var Xr=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function le(e){return Xr[e]}n(le,"userFacingError");function He(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(He,"defineHidden");var Zr=/^[a-z][a-z0-9_]{0,63}$/;function k(e,r){let t=H(r?.wireCode,r?.wireEnvelope),o={code:e,category:Ne(e),retryable:r?.retryable??Ue(e),displayMessage:le(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&Zr.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&He(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&He(o,"raw",r.raw),Object.freeze(o)}n(k,"makeEverfurError");function ue(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(ue,"ok");function T(e){return Object.freeze({ok:false,error:e})}n(T,"err");var W=class W extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,W.prototype);}};n(W,"EverfurConfigError");var M=W;function We(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}n(We,"errorFrame");function rt(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}n(rt,"authHeaders");function N(e,r){return {...e,headers:{...tt(e.headers),...rt(r)}}}n(N,"withAuthHeaders");function tt(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=o);}return r}n(tt,"stripAuthHeaders");async function Ye(e,r){if(r.mode==="anonymous")return r.transport.request(N(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return T(de())}let o=await r.transport.request(N(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return T(de())}let a=await r.transport.request(N(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?T(de(a.error.httpStatus)):a}n(Ye,"authedSend");function de(e){return k("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(de,"authRejectedError");function Ke(e){return k("internalError",{retryable:true,wireMessage:nt(e)})}n(Ke,"networkError");function nt(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(nt,"describeCause");var ot=3e4,it=se*2,at="idempotency-key",st=new Set(["POST","PUT","PATCH","DELETE"]),lt=Object.freeze({onEvent(){}}),ut=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function dt(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}n(dt,"seededIdempotencyKey");function $e(e){let r=e.observer??lt,t=e.timers??ut,o=e.rng??Math.random,i=e.sleep??((f,p)=>Tt(f,t,p)),a=e.maxAttempts??qe,u=e.unaryTimeoutMs??ot,s=e.newIdempotencyKey??ft(),l=n(f=>{try{r.onEvent(f);}catch{}},"emit");async function d(f,p,y){let h=y?.maxAttempts,c=Math.max(1,h??a),O=y?.idempotent??st.has(p.method),x=y?.idempotencyKey===void 0?null:dt(y.idempotencyKey),_=O?x??s():null,S=ct(p,_),I=0;for(;;){let E=n(R=>Object.freeze({call:f,method:p.method,path:p.path,attempt:I,..._?{idempotencyKey:_}:{},...R}),"stamp");l(E({phase:"attempt"}));let A=_t(u,t),P=Rt(A.signal,p.signal),z;try{z=await Ye({...S,signal:P.signal},e.auth);}catch(R){z=T(Ke(R));}finally{P.dispose(),A.cancel();}if(z.ok)return l(E({phase:"settled",ok:true,reason:"ok"})),z;let F=z.error,m=yt(F,I,{maxAttempts:c,rng:o,now:t.now(),aborted:p.signal?.aborted===true,...h!==void 0?{perCallMaxAttempts:h}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),g={ok:false,code:F.code,reason:m.reason,...F.httpStatus!==void 0?{httpStatus:F.httpStatus}:{},...F.requestId!==void 0?{requestId:F.requestId}:{}};if(!m.retry)return l(E({phase:"settled",...g})),T(F);if(l(E({phase:"retry",...g,delayMs:m.delayMs})),await i(m.delayMs,p.signal),p.signal?.aborted===true)return l(E({phase:"settled",...g,reason:"aborted"})),T(F);I+=1;}}n(d,"send");async function b(f){return N(f,await ht(e.auth))}n(b,"authorize");async function*v(f,p,y){l(Object.freeze({call:f,phase:"stream.open",method:p.method,path:p.path,attempt:0}));try{yield*e.auth.transport.stream(p,y);}catch{yield We({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(v,"stream"),Object.freeze({send:d,authorize:b,stream:v})}n($e,"createRequestFunnel");function ct(e,r){let t={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==at&&(t[o]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(ct,"assembleHeaders");function ft(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(ft,"defaultIdempotencyKeyFactory");var pt=10;function yt(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=mt(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!ae(e.code))return {retry:false,reason:"terminal-code"};let i=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let u=n(()=>{if(t.policy===void 0)return null;let d;try{d=t.policy.maxAttempts(e.code);}catch{return null}return typeof d!="number"||!Number.isFinite(d)?null:Math.max(1,Math.min(pt,Math.floor(d)))},"policyCeiling"),s=t.perCallMaxAttempts??u()??t.maxAttempts;if(r+1>=s)return {retry:false,reason:"attempts-exhausted"};let l=vt(e,t.now);return l!==null?l>it?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:l}:{retry:true,reason:i,delayMs:Be(r,t.rng)}}n(yt,"decideRetry");function mt(e){let r=e.code==="unknown"?Le(gt(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(mt,"throttleKind");function vt(e,r){let t=bt(e.raw);if(t===null)return null;let o=t-r;return o>0?o:0}n(vt,"retryOverrideMs");function bt(e){for(let r of Qe(e)){let t=r.resets_at,o=Et(t);if(o!==null)return o}return null}n(bt,"findResetsAt");function Qe(e){if(!Ge(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];Ge(o)&&r.push(o);}return r}n(Qe,"candidateScopes");function Et(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let r=Date.parse(e);return Number.isFinite(r)?r:null}return null}n(Et,"parseInstantMs");function gt(e){for(let r of Qe(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(gt,"rawWireCode");function Ge(e){return typeof e=="object"&&e!==null}n(Ge,"isRecord");async function ht(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}n(ht,"resolveDeviceAuth");function _t(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(_t,"boundedSignal");function Rt(e,r){let t=n(()=>{},"noop");if(!r)return {signal:e,dispose:t};let o=new AbortController;if(e.aborted||r.aborted)return o.abort(),{signal:o.signal,dispose:t};let i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}n(Rt,"mergeSignals");function Tt(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),o();},e),a=n(()=>{r.clearTimeout(i),o();},"onAbort");t?.addEventListener("abort",a,{once:true});})}n(Tt,"delayAbortable");var Y=Object.freeze(["visit","join","summary","messages"]);function K(e){return typeof e=="string"&&Y.includes(e)}n(K,"isVetVisitIntent");var Ct="/widget/v1/televet/handoffs",wt="/widget/v1/televet/availability",xt="/widget/v1/televet/chat-entry",St=/^[a-z0-9][a-z0-9_-]{0,39}$/,nr=/^[A-Za-z0-9_-]{22}$/,Xe="everfur_flow",Ze=32,Je=128,er=64;function G(e){let r=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return r===void 0?e.code==="internalError"?"network":"unknown":r===429?"rateLimited":r===404?"unavailable":r===403?"accessDenied":r===401?"authRejected":r===400||r===422?"invalidRequest":r>=500?"serverError":"unknown"}n(G,"vetVisitErrorReasonOf");function rr(e){return T(k("validationFailed",{retryable:false,wireMessage:e}))}n(rr,"invalid");function ce(e){return T(k("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}n(ce,"unusable");function Ft(e,r){let t={};e!==void 0&&(t.pet_ref=e);let o=r?.returnTo;if(o!=null){if(typeof o!="string"||!St.test(o))return {ok:false,message:"returnTo must be a registered return destination key"};t.return_to=o;}let i=r?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};t.entry=i;}let a=r?.visitRef,u=r?.intent,s=a!=null;if(s){let l=typeof a=="string"?a.trim():"";if(l.length<1||[...l].length>er)return {ok:false,message:`visitRef must be 1..${er} characters`};t.visit_ref=l;}if(u!=null){if(!s)return {ok:false,message:"intent needs the visitRef it opens"};if(!K(u))return {ok:false,message:`intent must be one of ${Y.join(", ")}`};t.intent=u;}return {ok:true,body:t}}n(Ft,"handoffBody");function kt(e){if(typeof e!="object"||e===null)return null;let{visit_ref:r,intent:t}=e;return typeof r!="string"||r.length===0||!K(t)?null:Object.freeze({visitRef:r,intent:t})}n(kt,"parseVisitEcho");function or(e){let r=e.funnel??$e({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=e.telemetry,o=n(i=>(tr(t,"televet.visit.handoff_failed",{reason:G(i)}),T(i)),"failed");return {async createHandoff(i,a){let u;if(i!=null){let c=typeof i=="string"?[...i].length:0;if(c<1||c>Je)return o(k("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Je} characters`}));u=i;}let s=Ft(u,a);if(!s.ok){let c=rr(s.message);return c.ok?c:o(c.error)}let l=s.body,d=await r.send("televet.visit.handoff",{method:"POST",path:Ct,body:l},{idempotent:false,maxAttempts:1});if(!d.ok)return o(d.error);let b=Vt(d.value),v=l.return_to!==void 0,f=v?d.value?.flow_id:void 0;if(v&&(typeof f!="string"||!nr.test(f))){let c=ce("the handoff response carried no usable return flow id");return c.ok?c:o(c.error)}let p=l.visit_ref!==void 0,y=p?kt(d.value?.visit):null;if(p&&y===null){let c=ce("the handoff response did not confirm the visit it opens");return c.ok?c:o(c.error)}let h=b===null?null:Object.freeze({...b,...v?{flowId:f}:{},...y!==null?{visit:y}:{}});return h===null?o(k("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(tr(t,"televet.visit.handoff_created",{pet_scoped:l.pet_ref!==void 0}),ue(h))},async checkAvailability(i){if(typeof i!="string"||i.length>Ze)return rr(`state must be at most ${Ze} characters`);let a=await r.send("televet.visit.availability",{method:"POST",path:wt,body:{state:i}},{idempotent:false,maxAttempts:1});if(!a.ok)return T(a.error);let u=a.value?.available;return typeof u!="boolean"?ce("the availability response carried no usable answer"):ue(Object.freeze({available:u}))},async chatEntryOpen(){try{let i=await r.send("televet.visit.chat_entry",{method:"GET",path:xt},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}n(or,"createVetVisitController");function Ot(e){if(typeof e!="string")return null;let r=e.indexOf("#"),t=r<0?e:e.slice(0,r),o=t.indexOf("?");if(o<0)return null;let i=t.slice(o+1).split("&").filter(a=>a.startsWith(`${Xe}=`)).map(a=>a.slice(Xe.length+1));return i.length!==1||!nr.test(i[0]??"")?null:Object.freeze({flowId:i[0]})}n(Ot,"parseVetVisitReturn");function Vt(e){if(typeof e!="object"||e===null)return null;let{url:r,expires_at:t}=e;return typeof r!="string"||typeof t!="string"||t.length===0||!zt(r)?null:Object.freeze({url:r,expiresAt:t})}n(Vt,"parseHandoff");var It=new Set(["localhost","127.0.0.1","[::1]"]),At=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Pt=/[\s\u0000-\u001f\u007f]/;function zt(e){if(Pt.test(e))return false;let r=At.exec(e);if(r===null)return false;let t=(r[1]??"").toLowerCase(),o=r[2]??"";if(o.length===0||o.includes("@"))return false;let i=o.replace(/:\d+$/,"").toLowerCase(),a=t==="https",u=t==="http"&&It.has(i);if(!a&&!u)return false;let s=e.indexOf("#");if(s<0)return false;let l=e.slice(s);return l.startsWith("#h=")&&l.length>3}n(zt,"isOpenableVisitUrl");function tr(e,r,t){if(e)try{e.track(r,t);}catch{}}n(tr,"safeTrack");var ir=Symbol.for("@everfur/sdk#EverfurContext@v1"),ar=globalThis,sr=ar[ir]??(ar[ir]=react.createContext(null));sr.displayName??="EverfurContext";function $(){let e=react.useContext(sr);if(e===null)throw new M("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n($,"useEverfurContext");var Mt=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function Nt(e){return Mt[e]}n(Nt,"requires");function lr(e,r,t){let o=Nt(e),i=new Map;for(let s of r)i.set(s.resource,s);if(t?.isPending===true&&o.some(s=>!i.has(s)))return fe({name:e,enabled:false,isPending:true,limits:{}});let a=Lt(o,i);return o.filter(s=>i.get(s)?.granted!==true).length===0?fe({name:e,enabled:true,isPending:false,limits:a}):fe({name:e,enabled:false,isPending:false,limits:a,disabled:Ut(o,i)})}n(lr,"decideCapability");function Lt(e,r){let t={};for(let o of e){let i=r.get(o)?.limits;if(i)for(let[a,u]of Object.entries(i)){let s=t[a];t[a]=s===void 0?u:Math.min(s,u);}}return t}n(Lt,"mergeLimits");function Ut(e,r){for(let t of e){let o=r.get(t)?.disabled;if(o)return Object.freeze({reason:o.reason,level:o.level,recoverable:o.recoverable})}return Object.freeze({reason:le("accessDenied"),level:"user_entitlement",recoverable:false})}n(Ut,"disabledFor");function fe(e){let r={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(r.disabled=e.disabled),Object.freeze(r)}n(fe,"freezeDecision");function ur(e){let{runtime:r}=$(),t=r.entitlements,o=react.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return react.useMemo(()=>lr(e,o.decisions,{isPending:o.isPending}),[e,o])}n(ur,"useCapability");function dr(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(dr,"reportHostFailure");function Ht(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(Ht,"isThenable");function j(e,...r){if(typeof e=="function")try{let t=e(...r);return Ht(t)&&Promise.resolve(t).then(void 0,dr),t}catch(t){dr(t);return}}n(j,"callHost");var cr=false;function Q(e,r){return r!==void 0?(j(r,e),"onStartInApp"):q(e)==="presented"?"presenter":ke(e)?"experience":(cr||(cr=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}n(Q,"openVetVisitInApp");var pe=Object.freeze({status:"idle",error:null,errorReason:null});function Yt(e,r,t){let{usState:o,chat:i,scope:a}=t,u=r&&(o!==null||i),s=`${o??""}|${i?"chat":""}`,[l,d]=react.useState(null);if(react.useEffect(()=>{if(!u)return;let v=true,f=e.current;return d(null),n(async()=>{try{if(i&&!(f.chatEntryOpen&&await f.chatEntryOpen()))return !1;if(o===null)return !0;if(!f.checkAvailability)return !1;let y=await f.checkAvailability(o);return y.ok&&y.value.available}catch{return false}},"ask")().then(y=>{v&&d({key:s,open:y});}),()=>{v=false;}},[u,s,o,i,a,e]),!u)return null;let b=l!==null&&l.key===s;return {open:b&&l.open,pending:!b}}n(Yt,"usePreflight");var Kt=Object.freeze({status:"opening",error:null,errorReason:null});function yr(e,r={}){let{runtime:t,userRef:o,scopeEpoch:i}=$(),a=ur("televet"),u=a.enabled&&o!==null,s=r.usState??null,l=r.entry==="chat",d=r.petRef??null,b=r.prefer==="redirect",v=react.useMemo(()=>{if(r.controller)return r.controller;let{services:m}=t.registry;return or({auth:m.authFor(o),telemetry:m.telemetry,...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}})},[t,o,i,r.controller]),f=react.useRef(v);f.current=v;let p=react.useMemo(()=>({runtime:t,userRef:o,scopeEpoch:i}),[t,o,i]),y=Yt(f,u,{usState:s,chat:l,scope:p}),h=u&&(y===null||y.open)&&(!l||d!==null),c=r.returnTo??null,[O,x]=react.useState(pe),_=react.useRef(null),S=react.useRef({runtime:t,userRef:o,scopeEpoch:i});S.current={runtime:t,userRef:o,scopeEpoch:i};let I=react.useRef(v);I.current=v;let E=react.useRef(h);E.current=h;let A=react.useCallback((m,g)=>{if(_.current)return _.current;let R=n((C,D)=>(x({status:C==="cancelled"?"idle":"error",error:D,errorReason:C==="cancelled"?null:C}),Object.freeze({opened:false,reason:C,error:D})),"fail");if(!E.current)return Promise.resolve(R("unavailable",null));let V=e.prepare();if(!V.ok)return Promise.resolve(R(V.reason,null));let ee=S.current,_e=I.current;x(Kt);let re=(async()=>{let C,D={...c!==null?{returnTo:c}:{},...l?{entry:"chat"}:{},...g!==null?{visitRef:g.visitRef}:{},...g!==null&&g.intent!==null&&g.intent!==void 0?{intent:g.intent}:{}},Re=Object.keys(D).length===0?void 0:D,Te=m===void 0?d:m;try{C=await(Re===void 0?_e.createHandoff(Te):_e.createHandoff(Te,Re));}catch{return e.abandon(V.value),R("unknown",null)}let te=S.current;if(te.runtime!==ee.runtime||te.userRef!==ee.userRef||te.scopeEpoch!==ee.scopeEpoch)return e.abandon(V.value),R("cancelled",null);if(!C.ok)return e.abandon(V.value),R(G(C.error),C.error);let Ce=await e.finish(V.value,C.value);return Ce!==null?R(Ce,null):(x(pe),Object.freeze(C.value.flowId===void 0?{opened:true}:{opened:true,flowId:C.value.flowId}))})().finally(()=>{_.current===re&&(_.current=null);});return _.current=re,re},[e,d,c,l]),P=react.useCallback((m,g)=>{if(!E.current)return x({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}));let R=m===void 0?d:m,V={...R!==null?{petRef:R}:{},...s!==null?{usState:s}:{},...g!==null?{visitRef:g.visitRef,intent:g.intent}:{}};return Q(V)===null?(x({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}))):(x(pe),Promise.resolve(Object.freeze({opened:true})))},[d,s]),z=react.useCallback(m=>b?A(m,null):P(m,null),[b,A,P]),F=react.useCallback((m,g)=>b?A(void 0,{visitRef:m,intent:g??null}):P(void 0,{visitRef:m,intent:g??null}),[b,A,P]);return {available:h,isPending:a.isPending||(y?.pending??false),status:O.status,error:O.error,errorReason:O.errorReason,open:z,openVisit:F}}n(yr,"useVetVisitWith");function mr(e){try{e.closed||e.close();}catch{}}n(mr,"closeQuietly");var Gt=Object.freeze({prepare(){let e=null;try{e=typeof window>"u"?null:window.open("about:blank","_blank");}catch{e=null;}if(e===null)return {ok:false,reason:"popupBlocked"};try{e.opener=null;}catch{}return {ok:true,value:{tab:e}}},async finish({tab:e},r){if(e.closed)return "cancelled";try{return e.location.replace(r.url),null}catch{return mr(e),"popupBlocked"}},abandon({tab:e}){mr(e);}});function ye(e){return yr(Gt,e)}n(ye,"useVetVisit");function $t(e,r){if(e===void 0)return {};let t={};return e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(t.borderColor=e.borderColor,t.borderWidth=r??1),e.borderRadius!==void 0&&(t.borderRadius=e.borderRadius),t}n($t,"slotBox");function vr(e){return e?.textColor===void 0?{}:{color:e.textColor}}n(vr,"slotText");function br(e,r){let t=$t(e,r),o={};return t.backgroundColor!==void 0&&(o.backgroundColor=t.backgroundColor),t.borderColor!==void 0&&(o.border=`${t.borderWidth??1}px solid ${t.borderColor}`),t.borderRadius!==void 0&&(o.borderRadius=t.borderRadius),o}n(br,"slotBoxCss");var Er=Object.freeze({visitButton:"Talk to a vet"});function be(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))be(e[r]);}return e}n(be,"deepFreeze");var Qt=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),hr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},_r={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},gr={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Xt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Zt={regular:"400",medium:"500",bold:"700"},Jt={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},en=0,Z="System",J="monospace",rn=["content","heading","control","compact","badge"];function tn(e){let r={};for(let t of rn)r[t]=e;return r}n(tn,"authoredTierSizes");function Rr(){return {family:Z,mono:J,fontUrl:null,families:{regular:Z,medium:Z,bold:Z,mono:J,monoMedium:J,monoBold:J},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:gr,tierSizes:tn(gr),lineHeight:Xt,weight:Zt,letterSpacing:Jt,scale:1,maxScale:en,scaleCaps:Qt}}n(Rr,"baseType");var Tr={},me=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function ve(e){return `cubic-bezier(${e.join(", ")})`}n(ve,"cssCubicBezier");var Cr={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:ve(me.standard),emphasized:ve(me.emphasized),exit:ve(me.exit)},reducedMotion:false},nn={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},wr=be({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:nn,space:hr,radius:_r,type:Rr(),motion:Cr,slots:Tr}),on={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};be({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:on,space:hr,radius:_r,type:Rr(),motion:Cr,slots:Tr});var xr=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Sr=globalThis,Ee=Sr[xr]??(Sr[xr]=react.createContext(wr));Ee.displayName??="EverfurThemeContext";function ge(){return react.useContext(Ee)}n(ge,"useEverfurTheme");var Fr=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var kr='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',ln="System";function un(e){let r=e.trim();return r.length===0||r===ln?kr:`${Or(r)}, ${kr}`}n(un,"cssFontFamily");function dn(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Or(r)}, ui-monospace, Menlo, Consolas, monospace`}n(dn,"cssMonoFamily");function Or(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}n(Or,"quote");function Vr(e,r){let t=e.type,o=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?dn(o):un(o),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[Fr[r]]}}n(Vr,"faceCss");var Ir=44,pn=.6;function yn(e){let{petRef:r,children:t,onOpened:o,onError:i,style:a,className:u,controller:s,returnTo:l,usState:d,entry:b,visitRef:v,intent:f,onStartInApp:p,prefer:y}=e,h=y==="redirect",c=ye({...l!==void 0?{returnTo:l}:{},...d!==void 0?{usState:d}:{},...b!==void 0?{entry:b}:{},...r!==void 0?{petRef:r}:{},...s!==void 0?{controller:s}:{},prefer:h?"redirect":"in-app"}),O=ge(),x=react.useMemo(()=>mn(O),[O]),_=react.useRef(false);if(!c.available)return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[null,jsxRuntime.jsx(B,{})]});let S=c.status==="opening";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:n(()=>{if(!(S||_.current)){if(!h){let E={...r!==void 0?{petRef:r}:{},...d!==void 0?{usState:d}:{},...v!=null?{visitRef:v,intent:f??null}:{}};Q(E,p)===null&&j(i,"unavailable",null);return}_.current=true,(v==null?c.open():c.openVisit(v,f??null)).then(E=>{E.opened?j(o,E.flowId??null):E.reason!=="cancelled"&&j(i,E.reason,E.error);}).finally(()=>{_.current=false;});}},"onClick"),"aria-busy":S,"aria-disabled":S,className:u,style:{...x,...S?{opacity:pn,cursor:"progress"}:null,...a},children:t??Er.visitButton}),jsxRuntime.jsx(B,{})]})}n(yn,"VetVisitButton");function mn(e){let{color:r,space:t,radius:o,type:i,slots:a}=e;return {boxSizing:"border-box",minHeight:Ir,minWidth:Ir,display:"inline-flex",alignItems:"center",justifyContent:"center",margin:0,border:0,cursor:"pointer",padding:`${t.sm}px ${t.xl}px`,borderRadius:o.pill,backgroundColor:r.primary,color:r.onPrimary,...Vr(e,"medium"),fontSize:i.size.body,...br(a.vetVisitButton),...vr(a.vetVisitButton)}}n(mn,"buttonStyle");exports.EverfurTelevetHost=B;exports.VET_VISIT_INTENTS=Y;exports.VetVisitButton=yn;exports.hasEverfurTelevetFlow=Mr;exports.isVetVisitIntent=K;exports.parseVetVisitReturn=Ot;exports.presentEverfurTelevetFlow=Nr;exports.registerEverfurTelevetFlow=Dr;exports.useVetVisit=ye;exports.vetVisitErrorReasonOf=G;
|
|
1
|
+
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var zr=Object.defineProperty;var n=(e,r)=>zr(e,"name",{value:r,configurable:true});var xe=Symbol.for("@everfur/sdk/televet");function w(){let e=globalThis,r=e[xe];if(r!==void 0)return r;let t={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[xe]=t,t}n(w,"televetGlobal");function U(e){let r=w();r.snapshot=Object.freeze({...r.snapshot,...e});for(let t of [...r.listeners])try{t();}catch{}}n(U,"publish");function Se(e){w().presenter=e;}n(Se,"setTelevetPresenter");function Fe(){return w().presenter!==null}n(Fe,"hasTelevetPresenter");function q(e){let r=w().presenter;if(r===null)return "absent";try{return r(e)===!1?"declined":"presented"}catch(t){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",t),"threw"}}n(q,"callTelevetPresenter");function ke(e){let r=w();return r.listeners.add(e),()=>{r.listeners.delete(e);}}n(ke,"subscribeTelevetExperience");function ne(){return w().snapshot}n(ne,"televetExperienceSnapshot");function jr(){return w().hosts.length>0}n(jr,"hasTelevetHost");function Oe(e){if(!jr())return false;let r=Object.freeze({...e});return U({request:r,serial:w().snapshot.serial+1}),true}n(Oe,"presentTelevetExperience");function oe(){w().snapshot.request!==null&&U({request:null});}n(oe,"dismissTelevetExperience");function Ve(){let e=w(),r=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,r],U({activeHost:e.hosts[0]??null}),r}n(Ve,"claimTelevetHost");function Ie(e){let r=w();r.hosts=r.hosts.filter(o=>o!==e);let t=r.hosts[0]??null;U(t===null?{activeHost:t,request:null}:{activeHost:t});}n(Ie,"releaseTelevetHost");function Dr(e){Se(e);}n(Dr,"registerEverfurTelevetFlow");function Mr(){return Fe()}n(Mr,"hasEverfurTelevetFlow");function Nr(e){return q(e)==="presented"}n(Nr,"presentEverfurTelevetFlow");function ze(e){let r=null;return ()=>{if(r!==null)return r;let t=e();return r=t,t.then(void 0,()=>{r===t&&(r=null);}),t}}n(ze,"memoizeTelevetLoader");function je(e){let[r,t]=react.useState(null);react.useEffect(()=>{let d=Ve();return t(d),()=>{Ie(d);}},[]);let o=react.useSyncExternalStore(ke,ne,ne),a=r!==null&&o.activeHost===r?o.request:null,[u,s]=react.useState(null),l=a!==null&&u===null;return react.useEffect(()=>{if(!l)return;let d=true;return e().then(b=>{d&&s(()=>b);},b=>{d&&(console.warn("[everfur] The in-app vet visit could not load its screens.",b),oe());}),()=>{d=false;}},[l,e]),a===null||u===null?null:{module:u,request:a,serial:o.serial,dismiss:oe}}n(je,"useTelevetExperienceHost");var Ur=ze(()=>import('@everfur/sdk/web/televet/booking'));function B(){let e=je(Ur);if(e===null)return null;let{EverfurTelevetDialog:r}=e.module;return jsxRuntime.jsx(r,{request:e.request,onClose:e.dismiss},e.serial)}n(B,"EverfurTelevetHost");var ie=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(ie.map(e=>e.wireCode));var Br=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),Me=Object.freeze(ie.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Br[e.wireCode]}))),Hr=new Map(Me.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Wr=Object.freeze(["http_envelope",...[...new Set(Me.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function H(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...Wr]){let i=Hr.get(o+t);if(i)return i}}n(H,"contractErrorFor");function Yr(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Yr,"contractDocUrl");function Ne(e){return null}n(Ne,"publishedDocUrl");var Kr=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function Le(e){return Kr[e]}n(Le,"categoryFor");function Ue(e){let r=H(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),o=t.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(t.startsWith("AUTH"))return "authExpired";switch(o){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":case "TELEVETRATELIMITED":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}n(Ue,"fromWire");var Gr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ae(e){return Gr.has(e)}n(ae,"isAutoRetryable");var $r=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function qe(e){return ae(e)||$r.has(e)}n(qe,"isRetryableCode");var Qr=500,se=8e3,Be=4;function He(e,r=Math.random){let t=Math.max(0,e),o=Math.min(Qr*2**t,se);return Math.floor(r()*o)}n(He,"backoffDelayMs");var Xr=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function le(e){return Xr[e]}n(le,"userFacingError");function We(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(We,"defineHidden");var Zr=/^[a-z][a-z0-9_]{0,63}$/;function k(e,r){let t=H(r?.wireCode,r?.wireEnvelope),o={code:e,category:Le(e),retryable:r?.retryable??qe(e),displayMessage:le(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&Zr.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&We(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&We(o,"raw",r.raw),Object.freeze(o)}n(k,"makeEverfurError");function ue(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(ue,"ok");function T(e){return Object.freeze({ok:false,error:e})}n(T,"err");var W=class W extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,W.prototype);}};n(W,"EverfurConfigError");var M=W;function Ye(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}n(Ye,"errorFrame");function rt(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}n(rt,"authHeaders");function N(e,r){return {...e,headers:{...tt(e.headers),...rt(r)}}}n(N,"withAuthHeaders");function tt(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=o);}return r}n(tt,"stripAuthHeaders");async function Ke(e,r){if(r.mode==="anonymous")return r.transport.request(N(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return T(de())}let o=await r.transport.request(N(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return T(de())}let a=await r.transport.request(N(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?T(de(a.error.httpStatus)):a}n(Ke,"authedSend");function de(e){return k("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(de,"authRejectedError");function Ge(e){return k("internalError",{retryable:true,wireMessage:nt(e)})}n(Ge,"networkError");function nt(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(nt,"describeCause");var ot=3e4,it=se*2,at="idempotency-key",st=new Set(["POST","PUT","PATCH","DELETE"]),lt=Object.freeze({onEvent(){}}),ut=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function dt(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}n(dt,"seededIdempotencyKey");function Qe(e){let r=e.observer??lt,t=e.timers??ut,o=e.rng??Math.random,i=e.sleep??((f,p)=>Ct(f,t,p)),a=e.maxAttempts??Be,u=e.unaryTimeoutMs??ot,s=e.newIdempotencyKey??ft(),l=n(f=>{try{r.onEvent(f);}catch{}},"emit");async function d(f,p,y){let h=y?.maxAttempts,c=Math.max(1,h??a),O=y?.idempotent??st.has(p.method),x=y?.idempotencyKey===void 0?null:dt(y.idempotencyKey),_=O?x??s():null,S=ct(p,_),I=0;for(;;){let E=n(R=>Object.freeze({call:f,method:p.method,path:p.path,attempt:I,..._?{idempotencyKey:_}:{},...R}),"stamp");l(E({phase:"attempt"}));let A=Rt(u,t),P=Tt(A.signal,p.signal),z;try{z=await Ke({...S,signal:P.signal},e.auth);}catch(R){z=T(Ge(R));}finally{P.dispose(),A.cancel();}if(z.ok)return l(E({phase:"settled",ok:true,reason:"ok"})),z;let F=z.error,m=yt(F,I,{maxAttempts:c,rng:o,now:t.now(),aborted:p.signal?.aborted===true,...h!==void 0?{perCallMaxAttempts:h}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),g={ok:false,code:F.code,reason:m.reason,...F.httpStatus!==void 0?{httpStatus:F.httpStatus}:{},...F.requestId!==void 0?{requestId:F.requestId}:{}};if(!m.retry)return l(E({phase:"settled",...g})),T(F);if(l(E({phase:"retry",...g,delayMs:m.delayMs})),await i(m.delayMs,p.signal),p.signal?.aborted===true)return l(E({phase:"settled",...g,reason:"aborted"})),T(F);I+=1;}}n(d,"send");async function b(f){return N(f,await _t(e.auth))}n(b,"authorize");async function*v(f,p,y){l(Object.freeze({call:f,phase:"stream.open",method:p.method,path:p.path,attempt:0}));try{yield*e.auth.transport.stream(p,y);}catch{yield Ye({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(v,"stream"),Object.freeze({send:d,authorize:b,stream:v})}n(Qe,"createRequestFunnel");function ct(e,r){let t={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==at&&(t[o]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(ct,"assembleHeaders");function ft(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(ft,"defaultIdempotencyKeyFactory");var pt=10;function yt(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=mt(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!ae(e.code))return {retry:false,reason:"terminal-code"};let i=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let u=n(()=>{if(t.policy===void 0)return null;let d;try{d=t.policy.maxAttempts(e.code);}catch{return null}return typeof d!="number"||!Number.isFinite(d)?null:Math.max(1,Math.min(pt,Math.floor(d)))},"policyCeiling"),s=t.perCallMaxAttempts??u()??t.maxAttempts;if(r+1>=s)return {retry:false,reason:"attempts-exhausted"};let l=vt(e,t.now);return l!==null?l>it?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:l}:{retry:true,reason:i,delayMs:He(r,t.rng)}}n(yt,"decideRetry");function mt(e){let r=e.code==="unknown"?Ue(ht(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(mt,"throttleKind");function vt(e,r){let t=Et(e.raw);if(t!==null){let i=t-r;return i>0?i:0}let o=bt(e.raw);return o===null?null:Math.round(o*1e3)}n(vt,"retryOverrideMs");function bt(e){for(let r of ce(e)){let t=r.retry_after_seconds;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t}return null}n(bt,"findRetryAfterSeconds");function Et(e){for(let r of ce(e)){let t=r.resets_at,o=gt(t);if(o!==null)return o}return null}n(Et,"findResetsAt");function ce(e){if(!$e(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];$e(o)&&r.push(o);}return r}n(ce,"candidateScopes");function gt(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let r=Date.parse(e);return Number.isFinite(r)?r:null}return null}n(gt,"parseInstantMs");function ht(e){for(let r of ce(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(ht,"rawWireCode");function $e(e){return typeof e=="object"&&e!==null}n($e,"isRecord");async function _t(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}n(_t,"resolveDeviceAuth");function Rt(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(Rt,"boundedSignal");function Tt(e,r){let t=n(()=>{},"noop");if(!r)return {signal:e,dispose:t};let o=new AbortController;if(e.aborted||r.aborted)return o.abort(),{signal:o.signal,dispose:t};let i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}n(Tt,"mergeSignals");function Ct(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),o();},e),a=n(()=>{r.clearTimeout(i),o();},"onAbort");t?.addEventListener("abort",a,{once:true});})}n(Ct,"delayAbortable");var Y=Object.freeze(["visit","join","summary","messages"]);function K(e){return typeof e=="string"&&Y.includes(e)}n(K,"isVetVisitIntent");var wt="/widget/v1/televet/handoffs",xt="/widget/v1/televet/availability",St="/widget/v1/televet/chat-entry",Ft=/^[a-z0-9][a-z0-9_-]{0,39}$/,nr=/^[A-Za-z0-9_-]{22}$/,Xe="everfur_flow",Ze=32,Je=128,er=64;function G(e){let r=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return r===void 0?e.code==="internalError"?"network":"unknown":r===429?"rateLimited":r===404?"unavailable":r===403?"accessDenied":r===401?"authRejected":r===400||r===422?"invalidRequest":r>=500?"serverError":"unknown"}n(G,"vetVisitErrorReasonOf");function rr(e){return T(k("validationFailed",{retryable:false,wireMessage:e}))}n(rr,"invalid");function fe(e){return T(k("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}n(fe,"unusable");function kt(e,r){let t={};e!==void 0&&(t.pet_ref=e);let o=r?.returnTo;if(o!=null){if(typeof o!="string"||!Ft.test(o))return {ok:false,message:"returnTo must be a registered return destination key"};t.return_to=o;}let i=r?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};t.entry=i;}let a=r?.visitRef,u=r?.intent,s=a!=null;if(s){let l=typeof a=="string"?a.trim():"";if(l.length<1||[...l].length>er)return {ok:false,message:`visitRef must be 1..${er} characters`};t.visit_ref=l;}if(u!=null){if(!s)return {ok:false,message:"intent needs the visitRef it opens"};if(!K(u))return {ok:false,message:`intent must be one of ${Y.join(", ")}`};t.intent=u;}return {ok:true,body:t}}n(kt,"handoffBody");function Ot(e){if(typeof e!="object"||e===null)return null;let{visit_ref:r,intent:t}=e;return typeof r!="string"||r.length===0||!K(t)?null:Object.freeze({visitRef:r,intent:t})}n(Ot,"parseVisitEcho");function or(e){let r=e.funnel??Qe({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=e.telemetry,o=n(i=>(tr(t,"televet.visit.handoff_failed",{reason:G(i)}),T(i)),"failed");return {async createHandoff(i,a){let u;if(i!=null){let c=typeof i=="string"?[...i].length:0;if(c<1||c>Je)return o(k("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Je} characters`}));u=i;}let s=kt(u,a);if(!s.ok){let c=rr(s.message);return c.ok?c:o(c.error)}let l=s.body,d=await r.send("televet.visit.handoff",{method:"POST",path:wt,body:l},{idempotent:false,maxAttempts:1});if(!d.ok)return o(d.error);let b=It(d.value),v=l.return_to!==void 0,f=v?d.value?.flow_id:void 0;if(v&&(typeof f!="string"||!nr.test(f))){let c=fe("the handoff response carried no usable return flow id");return c.ok?c:o(c.error)}let p=l.visit_ref!==void 0,y=p?Ot(d.value?.visit):null;if(p&&y===null){let c=fe("the handoff response did not confirm the visit it opens");return c.ok?c:o(c.error)}let h=b===null?null:Object.freeze({...b,...v?{flowId:f}:{},...y!==null?{visit:y}:{}});return h===null?o(k("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(tr(t,"televet.visit.handoff_created",{pet_scoped:l.pet_ref!==void 0}),ue(h))},async checkAvailability(i){if(typeof i!="string"||i.length>Ze)return rr(`state must be at most ${Ze} characters`);let a=await r.send("televet.visit.availability",{method:"POST",path:xt,body:{state:i}},{idempotent:false,maxAttempts:1});if(!a.ok)return T(a.error);let u=a.value?.available;return typeof u!="boolean"?fe("the availability response carried no usable answer"):ue(Object.freeze({available:u}))},async chatEntryOpen(){try{let i=await r.send("televet.visit.chat_entry",{method:"GET",path:St},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}n(or,"createVetVisitController");function Vt(e){if(typeof e!="string")return null;let r=e.indexOf("#"),t=r<0?e:e.slice(0,r),o=t.indexOf("?");if(o<0)return null;let i=t.slice(o+1).split("&").filter(a=>a.startsWith(`${Xe}=`)).map(a=>a.slice(Xe.length+1));return i.length!==1||!nr.test(i[0]??"")?null:Object.freeze({flowId:i[0]})}n(Vt,"parseVetVisitReturn");function It(e){if(typeof e!="object"||e===null)return null;let{url:r,expires_at:t}=e;return typeof r!="string"||typeof t!="string"||t.length===0||!jt(r)?null:Object.freeze({url:r,expiresAt:t})}n(It,"parseHandoff");var At=new Set(["localhost","127.0.0.1","[::1]"]),Pt=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,zt=/[\s\u0000-\u001f\u007f]/;function jt(e){if(zt.test(e))return false;let r=Pt.exec(e);if(r===null)return false;let t=(r[1]??"").toLowerCase(),o=r[2]??"";if(o.length===0||o.includes("@"))return false;let i=o.replace(/:\d+$/,"").toLowerCase(),a=t==="https",u=t==="http"&&At.has(i);if(!a&&!u)return false;let s=e.indexOf("#");if(s<0)return false;let l=e.slice(s);return l.startsWith("#h=")&&l.length>3}n(jt,"isOpenableVisitUrl");function tr(e,r,t){if(e)try{e.track(r,t);}catch{}}n(tr,"safeTrack");var ir=Symbol.for("@everfur/sdk#EverfurContext@v1"),ar=globalThis,sr=ar[ir]??(ar[ir]=react.createContext(null));sr.displayName??="EverfurContext";function $(){let e=react.useContext(sr);if(e===null)throw new M("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n($,"useEverfurContext");var Nt=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function Lt(e){return Nt[e]}n(Lt,"requires");function lr(e,r,t){let o=Lt(e),i=new Map;for(let s of r)i.set(s.resource,s);if(t?.isPending===true&&o.some(s=>!i.has(s)))return pe({name:e,enabled:false,isPending:true,limits:{}});let a=Ut(o,i);return o.filter(s=>i.get(s)?.granted!==true).length===0?pe({name:e,enabled:true,isPending:false,limits:a}):pe({name:e,enabled:false,isPending:false,limits:a,disabled:qt(o,i)})}n(lr,"decideCapability");function Ut(e,r){let t={};for(let o of e){let i=r.get(o)?.limits;if(i)for(let[a,u]of Object.entries(i)){let s=t[a];t[a]=s===void 0?u:Math.min(s,u);}}return t}n(Ut,"mergeLimits");function qt(e,r){for(let t of e){let o=r.get(t)?.disabled;if(o)return Object.freeze({reason:o.reason,level:o.level,recoverable:o.recoverable})}return Object.freeze({reason:le("accessDenied"),level:"user_entitlement",recoverable:false})}n(qt,"disabledFor");function pe(e){let r={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(r.disabled=e.disabled),Object.freeze(r)}n(pe,"freezeDecision");function ur(e){let{runtime:r}=$(),t=r.entitlements,o=react.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return react.useMemo(()=>lr(e,o.decisions,{isPending:o.isPending}),[e,o])}n(ur,"useCapability");function dr(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(dr,"reportHostFailure");function Wt(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(Wt,"isThenable");function j(e,...r){if(typeof e=="function")try{let t=e(...r);return Wt(t)&&Promise.resolve(t).then(void 0,dr),t}catch(t){dr(t);return}}n(j,"callHost");var cr=false;function Q(e,r){return r!==void 0?(j(r,e),"onStartInApp"):q(e)==="presented"?"presenter":Oe(e)?"experience":(cr||(cr=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}n(Q,"openVetVisitInApp");var ye=Object.freeze({status:"idle",error:null,errorReason:null});function Kt(e,r,t){let{usState:o,chat:i,scope:a}=t,u=r&&(o!==null||i),s=`${o??""}|${i?"chat":""}`,[l,d]=react.useState(null);if(react.useEffect(()=>{if(!u)return;let v=true,f=e.current;return d(null),n(async()=>{try{if(i&&!(f.chatEntryOpen&&await f.chatEntryOpen()))return !1;if(o===null)return !0;if(!f.checkAvailability)return !1;let y=await f.checkAvailability(o);return y.ok&&y.value.available}catch{return false}},"ask")().then(y=>{v&&d({key:s,open:y});}),()=>{v=false;}},[u,s,o,i,a,e]),!u)return null;let b=l!==null&&l.key===s;return {open:b&&l.open,pending:!b}}n(Kt,"usePreflight");var Gt=Object.freeze({status:"opening",error:null,errorReason:null});function yr(e,r={}){let{runtime:t,userRef:o,scopeEpoch:i}=$(),a=ur("televet"),u=a.enabled&&o!==null,s=r.usState??null,l=r.entry==="chat",d=r.petRef??null,b=r.prefer==="redirect",v=react.useMemo(()=>{if(r.controller)return r.controller;let{services:m}=t.registry;return or({auth:m.authFor(o),telemetry:m.telemetry,...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}})},[t,o,i,r.controller]),f=react.useRef(v);f.current=v;let p=react.useMemo(()=>({runtime:t,userRef:o,scopeEpoch:i}),[t,o,i]),y=Kt(f,u,{usState:s,chat:l,scope:p}),h=u&&(y===null||y.open)&&(!l||d!==null),c=r.returnTo??null,[O,x]=react.useState(ye),_=react.useRef(null),S=react.useRef({runtime:t,userRef:o,scopeEpoch:i});S.current={runtime:t,userRef:o,scopeEpoch:i};let I=react.useRef(v);I.current=v;let E=react.useRef(h);E.current=h;let A=react.useCallback((m,g)=>{if(_.current)return _.current;let R=n((C,D)=>(x({status:C==="cancelled"?"idle":"error",error:D,errorReason:C==="cancelled"?null:C}),Object.freeze({opened:false,reason:C,error:D})),"fail");if(!E.current)return Promise.resolve(R("unavailable",null));let V=e.prepare();if(!V.ok)return Promise.resolve(R(V.reason,null));let ee=S.current,Re=I.current;x(Gt);let re=(async()=>{let C,D={...c!==null?{returnTo:c}:{},...l?{entry:"chat"}:{},...g!==null?{visitRef:g.visitRef}:{},...g!==null&&g.intent!==null&&g.intent!==void 0?{intent:g.intent}:{}},Te=Object.keys(D).length===0?void 0:D,Ce=m===void 0?d:m;try{C=await(Te===void 0?Re.createHandoff(Ce):Re.createHandoff(Ce,Te));}catch{return e.abandon(V.value),R("unknown",null)}let te=S.current;if(te.runtime!==ee.runtime||te.userRef!==ee.userRef||te.scopeEpoch!==ee.scopeEpoch)return e.abandon(V.value),R("cancelled",null);if(!C.ok)return e.abandon(V.value),R(G(C.error),C.error);let we=await e.finish(V.value,C.value);return we!==null?R(we,null):(x(ye),Object.freeze(C.value.flowId===void 0?{opened:true}:{opened:true,flowId:C.value.flowId}))})().finally(()=>{_.current===re&&(_.current=null);});return _.current=re,re},[e,d,c,l]),P=react.useCallback((m,g)=>{if(!E.current)return x({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}));let R=m===void 0?d:m,V={...R!==null?{petRef:R}:{},...s!==null?{usState:s}:{},...g!==null?{visitRef:g.visitRef,intent:g.intent}:{}};return Q(V)===null?(x({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}))):(x(ye),Promise.resolve(Object.freeze({opened:true})))},[d,s]),z=react.useCallback(m=>b?A(m,null):P(m,null),[b,A,P]),F=react.useCallback((m,g)=>b?A(void 0,{visitRef:m,intent:g??null}):P(void 0,{visitRef:m,intent:g??null}),[b,A,P]);return {available:h,isPending:a.isPending||(y?.pending??false),status:O.status,error:O.error,errorReason:O.errorReason,open:z,openVisit:F}}n(yr,"useVetVisitWith");function mr(e){try{e.closed||e.close();}catch{}}n(mr,"closeQuietly");var $t=Object.freeze({prepare(){let e=null;try{e=typeof window>"u"?null:window.open("about:blank","_blank");}catch{e=null;}if(e===null)return {ok:false,reason:"popupBlocked"};try{e.opener=null;}catch{}return {ok:true,value:{tab:e}}},async finish({tab:e},r){if(e.closed)return "cancelled";try{return e.location.replace(r.url),null}catch{return mr(e),"popupBlocked"}},abandon({tab:e}){mr(e);}});function me(e){return yr($t,e)}n(me,"useVetVisit");function Qt(e,r){if(e===void 0)return {};let t={};return e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(t.borderColor=e.borderColor,t.borderWidth=r??1),e.borderRadius!==void 0&&(t.borderRadius=e.borderRadius),t}n(Qt,"slotBox");function vr(e){return e?.textColor===void 0?{}:{color:e.textColor}}n(vr,"slotText");function br(e,r){let t=Qt(e,r),o={};return t.backgroundColor!==void 0&&(o.backgroundColor=t.backgroundColor),t.borderColor!==void 0&&(o.border=`${t.borderWidth??1}px solid ${t.borderColor}`),t.borderRadius!==void 0&&(o.borderRadius=t.borderRadius),o}n(br,"slotBoxCss");var Er=Object.freeze({visitButton:"Talk to a vet"});function Ee(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))Ee(e[r]);}return e}n(Ee,"deepFreeze");var Xt=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),hr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},_r={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},gr={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Zt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Jt={regular:"400",medium:"500",bold:"700"},en={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},rn=0,Z="System",J="monospace",tn=["content","heading","control","compact","badge"];function nn(e){let r={};for(let t of tn)r[t]=e;return r}n(nn,"authoredTierSizes");function Rr(){return {family:Z,mono:J,fontUrl:null,families:{regular:Z,medium:Z,bold:Z,mono:J,monoMedium:J,monoBold:J},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:gr,tierSizes:nn(gr),lineHeight:Zt,weight:Jt,letterSpacing:en,scale:1,maxScale:rn,scaleCaps:Xt}}n(Rr,"baseType");var Tr={},ve=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function be(e){return `cubic-bezier(${e.join(", ")})`}n(be,"cssCubicBezier");var Cr={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:be(ve.standard),emphasized:be(ve.emphasized),exit:be(ve.exit)},reducedMotion:false},on={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},wr=Ee({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:on,space:hr,radius:_r,type:Rr(),motion:Cr,slots:Tr}),an={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};Ee({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:an,space:hr,radius:_r,type:Rr(),motion:Cr,slots:Tr});var xr=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Sr=globalThis,ge=Sr[xr]??(Sr[xr]=react.createContext(wr));ge.displayName??="EverfurThemeContext";function he(){return react.useContext(ge)}n(he,"useEverfurTheme");var Fr=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var kr='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',un="System";function dn(e){let r=e.trim();return r.length===0||r===un?kr:`${Or(r)}, ${kr}`}n(dn,"cssFontFamily");function cn(e){let r=e.trim();return r.length===0||r==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Or(r)}, ui-monospace, Menlo, Consolas, monospace`}n(cn,"cssMonoFamily");function Or(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}n(Or,"quote");function Vr(e,r){let t=e.type,o=t.families[r];return {fontFamily:r==="mono"||r==="monoMedium"||r==="monoBold"?cn(o):dn(o),fontWeight:t.namedFaces[r]?t.weight.regular:t.weight[Fr[r]]}}n(Vr,"faceCss");var Ir=44,yn=.6;function mn(e){let{petRef:r,children:t,onOpened:o,onError:i,style:a,className:u,controller:s,returnTo:l,usState:d,entry:b,visitRef:v,intent:f,onStartInApp:p,prefer:y}=e,h=y==="redirect",c=me({...l!==void 0?{returnTo:l}:{},...d!==void 0?{usState:d}:{},...b!==void 0?{entry:b}:{},...r!==void 0?{petRef:r}:{},...s!==void 0?{controller:s}:{},prefer:h?"redirect":"in-app"}),O=he(),x=react.useMemo(()=>vn(O),[O]),_=react.useRef(false);if(!c.available)return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[null,jsxRuntime.jsx(B,{})]});let S=c.status==="opening";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:n(()=>{if(!(S||_.current)){if(!h){let E={...r!==void 0?{petRef:r}:{},...d!==void 0?{usState:d}:{},...v!=null?{visitRef:v,intent:f??null}:{}};Q(E,p)===null&&j(i,"unavailable",null);return}_.current=true,(v==null?c.open():c.openVisit(v,f??null)).then(E=>{E.opened?j(o,E.flowId??null):E.reason!=="cancelled"&&j(i,E.reason,E.error);}).finally(()=>{_.current=false;});}},"onClick"),"aria-busy":S,"aria-disabled":S,className:u,style:{...x,...S?{opacity:yn,cursor:"progress"}:null,...a},children:t??Er.visitButton}),jsxRuntime.jsx(B,{})]})}n(mn,"VetVisitButton");function vn(e){let{color:r,space:t,radius:o,type:i,slots:a}=e;return {boxSizing:"border-box",minHeight:Ir,minWidth:Ir,display:"inline-flex",alignItems:"center",justifyContent:"center",margin:0,border:0,cursor:"pointer",padding:`${t.sm}px ${t.xl}px`,borderRadius:o.pill,backgroundColor:r.primary,color:r.onPrimary,...Vr(e,"medium"),fontSize:i.size.body,...br(a.vetVisitButton),...vr(a.vetVisitButton)}}n(vn,"buttonStyle");exports.EverfurTelevetHost=B;exports.VET_VISIT_INTENTS=Y;exports.VetVisitButton=mn;exports.hasEverfurTelevetFlow=Mr;exports.isVetVisitIntent=K;exports.parseVetVisitReturn=Vt;exports.presentEverfurTelevetFlow=Nr;exports.registerEverfurTelevetFlow=Dr;exports.useVetVisit=me;exports.vetVisitErrorReasonOf=G;
|