@everfur/sdk 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/README.md +9 -8
  3. package/dist/{Chat-BZZ-Py5l.d.ts → Chat-Rzplrf5M.d.ts} +17 -3
  4. package/dist/{Chat-Dq4fffIO.d.cts → Chat-ypo6miKm.d.cts} +17 -3
  5. package/dist/{DepthViews-BG3E25MD.d.ts → DepthViews-CeTfPUBX.d.ts} +1 -1
  6. package/dist/{DepthViews-B_hIypI6.d.cts → DepthViews-ClykXOJj.d.cts} +1 -1
  7. package/dist/{DepthViews-CL75jyRA.d.cts → DepthViews-Cui3oonj.d.cts} +1 -1
  8. package/dist/{DepthViews-CkYri51q.d.ts → DepthViews-baYLMNQ-.d.ts} +1 -1
  9. package/dist/{ErrorPolicyPort-CwbfmxzJ.d.ts → ErrorPolicyPort-D22LUVrK.d.ts} +1 -1
  10. package/dist/{ErrorPolicyPort-CNf4uQZP.d.cts → ErrorPolicyPort-D6CybiqJ.d.cts} +1 -1
  11. package/dist/{EverfurResult-DN9pL2Ab.d.cts → EverfurError-DmELDpXp.d.cts} +1 -67
  12. package/dist/{EverfurResult-DN9pL2Ab.d.ts → EverfurError-DmELDpXp.d.ts} +1 -67
  13. package/dist/EverfurResult-SGvHKsCB.d.ts +69 -0
  14. package/dist/EverfurResult-ZtH-YV1h.d.cts +69 -0
  15. package/dist/animations/index.cjs +1 -1
  16. package/dist/animations/index.d.cts +6 -5
  17. package/dist/animations/index.d.ts +6 -5
  18. package/dist/animations/index.js +1 -1
  19. package/dist/{attachments-D_SECjr1.d.cts → attachments-CwsR-bPN.d.cts} +7 -6
  20. package/dist/{attachments-BrUWQYNK.d.ts → attachments-CzZ7in24.d.ts} +7 -6
  21. package/dist/{attachments-DpldrvIW.d.ts → attachments-D3HCBmOE.d.ts} +3 -3
  22. package/dist/{attachments-BorG422I.d.cts → attachments-Nk73Lll8.d.cts} +3 -3
  23. package/dist/{bookingCopy-SREvkG19.d.cts → bookingCopy-Dv8rKqyV.d.cts} +417 -14
  24. package/dist/{bookingCopy-CqtDYvCR.d.ts → bookingCopy-SDkXaxDf.d.ts} +417 -14
  25. package/dist/branding-Xb_wL8N1.d.cts +212 -0
  26. package/dist/branding-xpQ056sM.d.ts +212 -0
  27. package/dist/callCopy-rDH9JTFo.d.cts +45 -0
  28. package/dist/callCopy-rDH9JTFo.d.ts +45 -0
  29. package/dist/callRoom-7wrE3RP2.d.ts +62 -0
  30. package/dist/callRoom-B_EqaUzx.d.cts +62 -0
  31. package/dist/{casesRepository-v6QczS9N.d.ts → casesRepository-BTAecTnF.d.ts} +14 -2
  32. package/dist/{casesRepository-DwtZVsbj.d.cts → casesRepository-aryld7fJ.d.cts} +14 -2
  33. package/dist/chat/index.cjs +1 -1
  34. package/dist/chat/index.d.cts +12 -11
  35. package/dist/chat/index.d.ts +12 -11
  36. package/dist/chat/index.js +1 -1
  37. package/dist/client/index.cjs +5 -5
  38. package/dist/client/index.d.cts +14 -12
  39. package/dist/client/index.d.ts +14 -12
  40. package/dist/client/index.js +5 -5
  41. package/dist/{config-C7eb_IMD.d.ts → config-6qS7Sohy.d.cts} +3 -2
  42. package/dist/{config--Wu1Umhd.d.cts → config-X6BtwDwQ.d.ts} +3 -2
  43. package/dist/consent/index.cjs +1 -1
  44. package/dist/consent/index.d.cts +9 -8
  45. package/dist/consent/index.d.ts +9 -8
  46. package/dist/consent/index.js +1 -1
  47. package/dist/{context-CahAEha8.d.ts → context-7f3Nb_xE.d.ts} +9 -8
  48. package/dist/{context-CL3lyuy1.d.cts → context-CkqPM4Ml.d.cts} +9 -8
  49. package/dist/{copy-UeUJVk8X.d.cts → copy-Bd__Pw5s.d.cts} +5 -4
  50. package/dist/{copy-DdVFDL01.d.ts → copy-NgKgOOET.d.ts} +5 -4
  51. package/dist/core/index.cjs +9 -9
  52. package/dist/core/index.d.cts +19 -17
  53. package/dist/core/index.d.ts +19 -17
  54. package/dist/core/index.js +9 -9
  55. package/dist/{depth-DvPwPuT_.d.ts → depth-CYPH92jE.d.ts} +6 -5
  56. package/dist/{depth-D5HwcvKC.d.cts → depth-CyjaJJ6V.d.cts} +6 -5
  57. package/dist/{entitlementRepository-B7egEdW6.d.ts → entitlementRepository-DdeFuEKp.d.ts} +4 -4
  58. package/dist/{entitlementRepository-BpJ7tiwl.d.cts → entitlementRepository-Dl1qRLcJ.d.cts} +4 -4
  59. package/dist/{identity-C2-08BZW.d.cts → identity-DjqhDm5Z.d.cts} +2 -2
  60. package/dist/{identity-CEi9GRFZ.d.ts → identity-Dy_L7Yq4.d.ts} +2 -2
  61. package/dist/index.cjs +6 -6
  62. package/dist/index.d.cts +19 -17
  63. package/dist/index.d.ts +19 -17
  64. package/dist/index.js +6 -6
  65. package/dist/{models-D2EUxPZY.d.cts → models-Bn2z0NNo.d.cts} +1 -1
  66. package/dist/{models-B-Uh2LTf.d.ts → models-DSqA5Ahs.d.ts} +1 -1
  67. package/dist/notifications/index.cjs +2 -2
  68. package/dist/notifications/index.d.cts +5 -4
  69. package/dist/notifications/index.d.ts +5 -4
  70. package/dist/notifications/index.js +2 -2
  71. package/dist/{pets-JVCXgRgR.d.cts → pets-BSG2qbr_.d.cts} +2 -2
  72. package/dist/{pets-DJv2sj2H.d.ts → pets-D7cZutrX.d.ts} +2 -2
  73. package/dist/{petsRepository-B_gKbAzJ.d.cts → petsRepository-D1bnxDZg.d.cts} +2 -2
  74. package/dist/{petsRepository-Bk6GDwLs.d.ts → petsRepository-DhsX3GLw.d.ts} +2 -2
  75. package/dist/photo/index.cjs +1 -1
  76. package/dist/photo/index.d.cts +3 -2
  77. package/dist/photo/index.d.ts +3 -2
  78. package/dist/photo/index.js +1 -1
  79. package/dist/{ports-D7YW8qz9.d.ts → ports-C0m1G1fS.d.ts} +13 -6
  80. package/dist/{ports-BY2ph0_y.d.cts → ports-DNXyyzZF.d.cts} +13 -6
  81. package/dist/records/depth/index.cjs +2 -2
  82. package/dist/records/depth/index.d.cts +11 -10
  83. package/dist/records/depth/index.d.ts +11 -10
  84. package/dist/records/depth/index.js +2 -2
  85. package/dist/records/index.cjs +3 -3
  86. package/dist/records/index.d.cts +25 -14
  87. package/dist/records/index.d.ts +25 -14
  88. package/dist/records/index.js +3 -3
  89. package/dist/{requestFunnel-BjDpqqvm.d.cts → requestFunnel-Bqc1inM9.d.cts} +5 -4
  90. package/dist/{requestFunnel-DFMGcluw.d.ts → requestFunnel-FvE5yLDD.d.ts} +5 -4
  91. package/dist/{runtimeTypes-w5KqBMcs.d.ts → runtimeTypes-C0yPBz89.d.ts} +7 -7
  92. package/dist/{runtimeTypes-gZEJu-da.d.cts → runtimeTypes-RN-VXTFV.d.cts} +7 -7
  93. package/dist/server/events/index.cjs +1 -1
  94. package/dist/server/events/index.d.cts +4 -3
  95. package/dist/server/events/index.d.ts +4 -3
  96. package/dist/server/events/index.js +1 -1
  97. package/dist/server/index.cjs +1 -1
  98. package/dist/server/index.d.cts +5 -4
  99. package/dist/server/index.d.ts +5 -4
  100. package/dist/server/index.js +1 -1
  101. package/dist/televet/booking/index.cjs +1 -1
  102. package/dist/televet/booking/index.d.cts +310 -32
  103. package/dist/televet/booking/index.d.ts +310 -32
  104. package/dist/televet/booking/index.js +1 -1
  105. package/dist/televet/call/index.cjs +1 -1
  106. package/dist/televet/call/index.d.cts +25 -5
  107. package/dist/televet/call/index.d.ts +25 -5
  108. package/dist/televet/call/index.js +1 -1
  109. package/dist/televet/index.cjs +1 -1
  110. package/dist/televet/index.d.cts +41 -71
  111. package/dist/televet/index.d.ts +41 -71
  112. package/dist/televet/index.js +1 -1
  113. package/dist/televetGlobal-CEk0_cW9.d.cts +34 -0
  114. package/dist/televetGlobal-Cs9Wbqsy.d.ts +34 -0
  115. package/dist/testing/index.cjs +3 -3
  116. package/dist/testing/index.d.cts +3 -2
  117. package/dist/testing/index.d.ts +3 -2
  118. package/dist/testing/index.js +3 -3
  119. package/dist/testing/rn/index.cjs +1 -1
  120. package/dist/testing/rn/index.d.cts +13 -11
  121. package/dist/testing/rn/index.d.ts +13 -11
  122. package/dist/testing/rn/index.js +1 -1
  123. package/dist/testing/web/index.cjs +1 -1
  124. package/dist/testing/web/index.d.cts +14 -13
  125. package/dist/testing/web/index.d.ts +14 -13
  126. package/dist/testing/web/index.js +1 -1
  127. package/dist/{timelineRows-C15jxFFH.d.ts → timelineRows-D4U6A8zE.d.ts} +1 -1
  128. package/dist/{timelineRows-odO8g9r2.d.cts → timelineRows-DAB5dpjF.d.cts} +1 -1
  129. package/dist/{branding-CsRdeNwK.d.cts → tokens-CIngRkvt.d.cts} +7 -211
  130. package/dist/{branding-CsRdeNwK.d.ts → tokens-CIngRkvt.d.ts} +7 -211
  131. package/dist/{typeStyle-DmoyacDG.d.ts → typeStyle-DHJzDaUo.d.cts} +2 -1
  132. package/dist/{typeStyle-CKqVYD6L.d.cts → typeStyle-YPS_MXeI.d.ts} +2 -1
  133. package/dist/{useRecordsDepth-crhBllQK.d.ts → useRecordsDepth--ObtMyjH.d.ts} +24 -5
  134. package/dist/{useRecordsDepth-C6rjEaLn.d.cts → useRecordsDepth-B35y8bV-.d.cts} +24 -5
  135. package/dist/{useVetVisit-CjmMa896.d.ts → useVetVisit-BsjoDO-n.d.ts} +21 -6
  136. package/dist/{useVetVisit-Bc84hWUU.d.cts → useVetVisit-Ds8f1peV.d.cts} +21 -6
  137. package/dist/video/index.cjs +1 -1
  138. package/dist/video/index.d.cts +3 -2
  139. package/dist/video/index.d.ts +3 -2
  140. package/dist/video/index.js +1 -1
  141. package/dist/{view-DyitEO0m.d.cts → view-B-Toym_j.d.cts} +5 -4
  142. package/dist/{view-Bxwxp4xD.d.ts → view-D9JqNQai.d.ts} +5 -4
  143. package/dist/web/consent/index.cjs +1 -1
  144. package/dist/web/consent/index.d.cts +9 -8
  145. package/dist/web/consent/index.d.ts +9 -8
  146. package/dist/web/consent/index.js +1 -1
  147. package/dist/web/index.cjs +10 -10
  148. package/dist/web/index.d.cts +42 -19
  149. package/dist/web/index.d.ts +42 -19
  150. package/dist/web/index.js +10 -10
  151. package/dist/web/notifications/index.cjs +2 -2
  152. package/dist/web/notifications/index.d.cts +7 -6
  153. package/dist/web/notifications/index.d.ts +7 -6
  154. package/dist/web/notifications/index.js +2 -2
  155. package/dist/web/records/depth/index.cjs +2 -2
  156. package/dist/web/records/depth/index.d.cts +11 -10
  157. package/dist/web/records/depth/index.d.ts +11 -10
  158. package/dist/web/records/depth/index.js +2 -2
  159. package/dist/web/records/index.cjs +3 -3
  160. package/dist/web/records/index.d.cts +53 -35
  161. package/dist/web/records/index.d.ts +53 -35
  162. package/dist/web/records/index.js +3 -3
  163. package/dist/web/televet/booking/index.cjs +2 -1
  164. package/dist/web/televet/booking/index.d.cts +458 -33
  165. package/dist/web/televet/booking/index.d.ts +458 -33
  166. package/dist/web/televet/booking/index.js +2 -1
  167. package/dist/web/televet/call/index.cjs +1 -1
  168. package/dist/web/televet/call/index.d.cts +3 -1
  169. package/dist/web/televet/call/index.d.ts +3 -1
  170. package/dist/web/televet/call/index.js +1 -1
  171. package/dist/web/televet/index.cjs +1 -1
  172. package/dist/web/televet/index.d.cts +40 -74
  173. package/dist/web/televet/index.d.ts +40 -74
  174. package/dist/web/televet/index.js +1 -1
  175. package/package.json +3 -2
  176. package/dist/callCopy-DoQKG3-L.d.cts +0 -40
  177. package/dist/callCopy-DoQKG3-L.d.ts +0 -40
@@ -1 +1,2 @@
1
- import {createContext,useMemo,useId,useState,useRef,useEffect,useCallback,useReducer,Component,createElement,useContext,useSyncExternalStore}from'react';import {jsxs,jsx}from'react/jsx-runtime';var Ji=Object.defineProperty;var o=(e,t)=>Ji(e,"name",{value:t,configurable:true});function vt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(vt,"assertNever");function vn(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}o(vn,"errorFrame");function or(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(or,"reportHostFailure");function ta(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(ta,"isThenable");function $e(e,...t){if(typeof e=="function")try{let r=e(...t);return ta(r)&&Promise.resolve(r).then(void 0,or),r}catch(r){or(r);return}}o($e,"callHost");var bn=new WeakMap;function ra(e){if(typeof e!="function")return;let t=bn.get(e);if(t!==void 0)return t;let r=o((...n)=>{$e(e,...n);},"guarded");return bn.set(e,r),r}o(ra,"guardHost");function He(e,t){let r=null;for(let n of t){let i=e[n];typeof i=="function"&&(r??={...e},r[n]=ra(i));}return r??e}o(He,"guardHostProps");function bt(e,...t){let r;try{r=e(...t);}catch(n){return or(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}o(bt,"callHostAsync");var v=o(e=>e,"DRAFT"),na=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function oa(e){return na.some(t=>e.toUpperCase().includes(t.toUpperCase()))}o(oa,"isPlaceholderCopy");function te(e,t){let r=e;for(let[n,i]of Object.entries(t))r=r.split(`{${n}}`).join(i);return r}o(te,"fill");var f=Object.freeze({stateBlockedTitle:v("Not available in this state yet"),noCliniciansTitle:v("No vets available right now"),noCliniciansBody:v("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:v("Check again"),yourVetTitle:v("Your Vet"),reviewsLabel:v("reviews"),rescheduleFromTemplate:v("Moving your visit on {when}"),rescheduleFailed:v("That did not move. Your original time is unchanged."),keepExistingCta:v("Keep my current time"),bookingPausedTitle:v("Booking is not available right now."),slotsErrorTitle:v("Could not load times"),noSlotsTitle:v("No times available"),nextOpeningTemplate:v("Next opening across our vets: {when}"),seeOtherVetsCta:v("See other vets"),retryCta:v("Try again"),holdExpired:v("That time is no longer held. Pick another."),slotTaken:v("That time was just taken. Pick another."),reasonPlaceholder:v("What is going on with your pet?"),reasonTooLong:v("That is too long. Please shorten it."),shareRecordsOff:v("Share health records with this vet"),confirmNotEntitled:v("A Pro membership is needed to book a video visit."),confirmFailed:v("That did not book. Try again."),navTitle:v("Book a visit"),rescheduleNavTitle:v("Change your visit"),close:v("Close"),continueCta:v("Continue"),petSelectTitle:v("Who is this visit for?"),addPetCta:v("Add a pet"),locationUnknownTitle:v("We need your location to find a vet"),locationUnknownBody:v("Turn on location for Everfur, then try again."),locationUnknownCta:v("Allow location"),locationBlockedTitle:v("Location is turned off"),locationBlockedBody:v("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:v("Open Settings"),locationUnavailableTitle:v("We could not read your location"),locationUnavailableBody:v("Try again in a moment."),stateAttestTemplate:v("I confirm my pet and I are in {state} right now."),describeHeading:v("or Type to the vet what you're seeing"),describeHelpLong:v("A few sentences is plenty. When it started, what changed, anything you've already tried."),addPhotoCta:v("ADD PHOTO OR VIDEO"),removePhotoLabel:v("Remove photo"),summaryPet:v("Pet"),summaryVet:v("Vet"),summaryWhen:v("When"),summaryLength:v("Length"),summaryReason:v("Reason"),summaryLengthTemplate:v("{n} minutes"),confirmCta:v("Confirm visit"),bookedTitle:v("You are booked."),addToCalendarCta:v("Add to calendar"),doneCta:v("Done"),booked:Object.freeze({remindPromise:v("We will notify you 30 minutes before."),summaryPromise:v("{pet}'s summary goes to the vet ahead of the call."),joinPromise:v("Join right here in the app. No links to hunt for."),backToPet:v("Back to {pet}"),calendarAdded:v("Added to your calendar"),calendarFailedBody:v("That did not save to your calendar.")}),chrome:Object.freeze({closeHint:v("Closes without saving"),discardTitle:v("Leave without booking?"),discardBody:v("Your answers will not be saved."),discardConfirmCta:v("Leave"),discardKeepCta:v("Keep going"),noPetsTitle:v("No pets on this account"),loadFailedTitle:v("Could not load"),retryCta:v("Try again")}),emergency:Object.freeze({bannerTitle:v("This cannot wait for a scheduled call."),keepBookingCta:v("I have handled this, keep booking"),lede:v("What you are describing is the kind of thing vets want to see in person, now. Please call one of these first.")}),visit:Object.freeze({title:v("Your visit")}),loading:Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function hn(e=f){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(t=>hn(t))}o(hn,"televetBookingCopyValues");function ce(){return hn().every(e=>e.trim().length>0&&!oa(e))}o(ce,"isTelevetBookingCopyReady");var lr=class lr extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(lr,"HostRenderBoundary");var ir=lr;function la({render:e}){return e()}o(la,"RenderHost");function ar({render:e,fallback:t,resetKey:r}){return createElement(ir,{fallback:t,resetKey:r,children:createElement(la,{render:e})})}o(ar,"HostRender");function ur(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))ur(e[t]);}return e}o(ur,"deepFreeze");var sa=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Tn={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Cn={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},En={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},da={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},ua={regular:"400",medium:"500",bold:"700"},ca={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},pa=0,ht="System",St="monospace",fa=["content","heading","control","compact","badge"];function ya(e){let t={};for(let r of fa)t[r]=e;return t}o(ya,"authoredTierSizes");function kn(){return {family:ht,mono:St,fontUrl:null,families:{regular:ht,medium:ht,bold:ht,mono:St,monoMedium:St,monoBold:St},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:En,tierSizes:ya(En),lineHeight:da,weight:ua,letterSpacing:ca,scale:1,maxScale:pa,scaleCaps:sa}}o(kn,"baseType");var Rn={},sr=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function dr(e){return `cubic-bezier(${e.join(", ")})`}o(dr,"cssCubicBezier");var _n={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:dr(sr.standard),emphasized:dr(sr.emphasized),exit:dr(sr.exit)},reducedMotion:false},ma={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)"},xn=ur({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ma,space:Tn,radius:Cn,type:kn(),motion:_n,slots:Rn}),ga={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)"};ur({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ga,space:Tn,radius:Cn,type:kn(),motion:_n,slots:Rn});var Pn=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),wn=globalThis,cr=wn[Pn]??(wn[Pn]=createContext(xn));cr.displayName??="EverfurThemeContext";function w(){return useContext(cr)}o(w,"useEverfurTheme");var In=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var On='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',ha="System";function Sa(e){let t=e.trim();return t.length===0||t===ha?On:`${An(t)}, ${On}`}o(Sa,"cssFontFamily");function Ea(e){let t=e.trim();return t.length===0||t==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${An(t)}, ui-monospace, Menlo, Consolas, monospace`}o(Ea,"cssMonoFamily");function An(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}o(An,"quote");function E(e,t){let r=e.type,n=r.families[t];return {fontFamily:t==="mono"||t==="monoMedium"||t==="monoBold"?Ea(n):Sa(n),fontWeight:r.namedFaces[t]?r.weight.regular:r.weight[In[t]]}}o(E,"faceCss");var pr=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(pr.map(e=>e.wireCode));var Ta=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"}),Dn=Object.freeze(pr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Ta[e.wireCode]}))),Ca=new Map(Dn.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),ka=Object.freeze(["http_envelope",...[...new Set(Dn.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function Et(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...ka]){let i=Ca.get(n+r);if(i)return i}}o(Et,"contractErrorFor");function Ra(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Ra,"contractDocUrl");function Bn(e){return null}o(Bn,"publishedDocUrl");var _a=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 Ln(e){return _a[e]}o(Ln,"categoryFor");function Nn(e){let t=Et(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}o(Nn,"fromWire");var xa=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function fr(e){return xa.has(e)}o(fr,"isAutoRetryable");var Pa=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Vn(e){return fr(e)||Pa.has(e)}o(Vn,"isRetryableCode");var wa=500,yr=8e3,zn=4;function Hn(e,t=Math.random){let r=Math.max(0,e),n=Math.min(wa*2**r,yr);return Math.floor(t()*n)}o(Hn,"backoffDelayMs");var Ia=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 mr(e){return Ia[e]}o(mr,"userFacingError");function Mn(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}o(Mn,"defineHidden");var Oa=/^[a-z][a-z0-9_]{0,63}$/;function $(e,t){let r=Et(t?.wireCode,t?.wireEnvelope),n={code:e,category:Ln(e),retryable:t?.retryable??Vn(e),displayMessage:mr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&Oa.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Mn(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Mn(n,"raw",t.raw),Object.freeze(n)}o($,"makeEverfurError");var Aa=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 Fa(e){return Aa[e]}o(Fa,"requires");function jn(e,t,r){let n=Fa(e),i=new Map;for(let a of t)i.set(a.resource,a);if(r?.isPending===true&&n.some(a=>!i.has(a)))return gr({name:e,enabled:false,isPending:true,limits:{}});let l=Da(n,i);return n.filter(a=>i.get(a)?.granted!==true).length===0?gr({name:e,enabled:true,isPending:false,limits:l}):gr({name:e,enabled:false,isPending:false,limits:l,disabled:Ba(n,i)})}o(jn,"decideCapability");function Da(e,t){let r={};for(let n of e){let i=t.get(n)?.limits;if(i)for(let[l,s]of Object.entries(i)){let a=r[l];r[l]=a===void 0?s:Math.min(a,s);}}return r}o(Da,"mergeLimits");function Ba(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:mr("accessDenied"),level:"user_entitlement",recoverable:false})}o(Ba,"disabledFor");function gr(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}o(gr,"freezeDecision");function O(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}o(O,"ok");function C(e){return Object.freeze({ok:false,error:e})}o(C,"err");var Tt=class Tt extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Tt.prototype);}};o(Tt,"EverfurConfigError");var Ye=Tt;var Un=Symbol.for("@everfur/sdk#EverfurContext@v1"),Wn=globalThis,qn=Wn[Un]??(Wn[Un]=createContext(null));qn.displayName??="EverfurContext";function pe(){let e=useContext(qn);if(e===null)throw new Ye("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(pe,"useEverfurContext");function Re(e){let{runtime:t}=pe(),r=t.entitlements,n=useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return useMemo(()=>jn(e,n.decisions,{isPending:n.isPending}),[e,n])}o(Re,"useCapability");var Ha=48;function Ma(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(Ma,"selectView");function Yn(e){let{capability:t,children:r,renderDisabled:n,renderPending:i,style:l,className:s}=e,a=Re(t),d=useMemo(()=>Ma(a),[a]);switch(d){case "enabled":return r;case "pending":return i?jsx(ar,{render:i,fallback:jsx(Kn,{capability:t,style:l,className:s})}):jsx(Kn,{capability:t,style:l,className:s});case "disabled":return n?jsx(ar,{render:()=>n(a),fallback:jsx($n,{decision:a,style:l,className:s}),resetKey:a}):jsx($n,{decision:a,style:l,className:s});default:return vt(d)}}o(Yn,"CapabilityGate");function Kn({capability:e,style:t,className:r}){let n=w(),i=useMemo(()=>Gn(n),[n]);return jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${e}`,className:r,style:{...i.offstate,...t},children:jsx("div",{style:i.skeletonBar})})}o(Kn,"PendingSkeleton");function $n({decision:e,style:t,className:r}){let n=w(),i=useMemo(()=>Gn(n),[n]),l=e.disabled?.reason??"";return jsx("div",{className:r,style:{...i.offstate,...t},children:l.length>0?jsx("p",{style:i.offstateText,children:l}):null})}o($n,"OffState");function Gn(e){let{color:t,space:r,radius:n,type:i}=e;return {offstate:{boxSizing:"border-box",minHeight:Ha,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${r.md}px ${r.lg}px`,backgroundColor:t.surfaceCream,borderRadius:n.md,border:`1px solid ${t.brandBorder}`},offstateText:{margin:0,...E(e,"regular"),fontSize:i.size.body,lineHeight:`${Math.round(i.size.body*i.lineHeight.normal)}px`,color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}}}o(Gn,"makeStyles");function ja(e,t){if(e===void 0)return {};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}o(ja,"slotBox");function Ct(e){return e?.textColor===void 0?{}:{color:e.textColor}}o(Ct,"slotText");function kt(e,t){let r=ja(e,t),n={};return r.backgroundColor!==void 0&&(n.backgroundColor=r.backgroundColor),r.borderColor!==void 0&&(n.border=`${r.borderWidth??1}px solid ${r.borderColor}`),r.borderRadius!==void 0&&(n.borderRadius=r.borderRadius),n}o(kt,"slotBoxCss");var Xn=Object.freeze({visitButton:"Talk to a vet"});var Qn=null;function Jn(){return Qn!==null}o(Jn,"hasEverfurTelevetFlow");function Zn(e){return false;}o(Zn,"presentEverfurTelevetFlow");function Ua(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}o(Ua,"authHeaders");function Ge(e,t){return {...e,headers:{...Wa(e.headers),...Ua(t)}}}o(Ge,"withAuthHeaders");function Wa(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let i=r.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(t[r]=n);}return t}o(Wa,"stripAuthHeaders");async function eo(e,t){if(t.mode==="anonymous")return t.transport.request(Ge(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return C(br())}let n=await t.transport.request(Ge(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await t.identity.currentToken({forceRefresh:!0});}catch{return C(br())}let l=await t.transport.request(Ge(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !l.ok&&l.error.httpStatus===401?C(br(l.error.httpStatus)):l}o(eo,"authedSend");function br(e){return $("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(br,"authRejectedError");function to(e){return $("internalError",{retryable:true,wireMessage:qa(e)})}o(to,"networkError");function qa(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(qa,"describeCause");var Ka=3e4,$a=yr*2,Ya="idempotency-key",Ga=new Set(["POST","PUT","PATCH","DELETE"]),Xa=Object.freeze({onEvent(){}}),Qa=Object.freeze({setTimeout:o((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function Ja(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}o(Ja,"seededIdempotencyKey");function _e(e){let t=e.observer??Xa,r=e.timers??Qa,n=e.rng??Math.random,i=e.sleep??((m,y)=>cl(m,r,y)),l=e.maxAttempts??zn,s=e.unaryTimeoutMs??Ka,a=e.newIdempotencyKey??el(),d=o(m=>{try{t.onEvent(m);}catch{}},"emit");async function c(m,y,b){let S=b?.maxAttempts,h=Math.max(1,S??l),I=b?.idempotent??Ga.has(y.method),P=b?.idempotencyKey===void 0?null:Ja(b.idempotencyKey),R=I?P??a():null,D=Za(y,R),B=0;for(;;){let k=o(_=>Object.freeze({call:m,method:y.method,path:y.path,attempt:B,...R?{idempotencyKey:R}:{},..._}),"stamp");d(k({phase:"attempt"}));let A=dl(s,r),U=ul(A.signal,y.signal),x;try{x=await eo({...D,signal:U.signal},e.auth);}catch(_){x=C(to(_));}finally{U.dispose(),A.cancel();}if(x.ok)return d(k({phase:"settled",ok:true,reason:"ok"})),x;let F=x.error,z=rl(F,B,{maxAttempts:h,rng:n,now:r.now(),aborted:y.signal?.aborted===true,...S!==void 0?{perCallMaxAttempts:S}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),K={ok:false,code:F.code,reason:z.reason,...F.httpStatus!==void 0?{httpStatus:F.httpStatus}:{},...F.requestId!==void 0?{requestId:F.requestId}:{}};if(!z.retry)return d(k({phase:"settled",...K})),C(F);if(d(k({phase:"retry",...K,delayMs:z.delayMs})),await i(z.delayMs,y.signal),y.signal?.aborted===true)return d(k({phase:"settled",...K,reason:"aborted"})),C(F);B+=1;}}o(c,"send");async function u(m){return Ge(m,await sl(e.auth))}o(u,"authorize");async function*p(m,y,b){d(Object.freeze({call:m,phase:"stream.open",method:y.method,path:y.path,attempt:0}));try{yield*e.auth.transport.stream(y,b);}catch{yield vn({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(p,"stream"),Object.freeze({send:c,authorize:u,stream:p})}o(_e,"createRequestFunnel");function Za(e,t){let r={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==Ya&&(r[n]=i);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}o(Za,"assembleHeaders");function el(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(el,"defaultIdempotencyKeyFactory");var tl=10;function rl(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=nl(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!fr(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=o(()=>{if(r.policy===void 0)return null;let c;try{c=r.policy.maxAttempts(e.code);}catch{return null}return typeof c!="number"||!Number.isFinite(c)?null:Math.max(1,Math.min(tl,Math.floor(c)))},"policyCeiling"),a=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=a)return {retry:false,reason:"attempts-exhausted"};let d=ol(e,r.now);return d!==null?d>$a?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:d}:{retry:true,reason:i,delayMs:Hn(t,r.rng)}}o(rl,"decideRetry");function nl(e){let t=e.code==="unknown"?Nn(ll(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}o(nl,"throttleKind");function ol(e,t){let r=il(e.raw);if(r===null)return null;let n=r-t;return n>0?n:0}o(ol,"retryOverrideMs");function il(e){for(let t of no(e)){let r=t.resets_at,n=al(r);if(n!==null)return n}return null}o(il,"findResetsAt");function no(e){if(!ro(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];ro(n)&&t.push(n);}return t}o(no,"candidateScopes");function al(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}o(al,"parseInstantMs");function ll(e){for(let t of no(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}o(ll,"rawWireCode");function ro(e){return typeof e=="object"&&e!==null}o(ro,"isRecord");async function sl(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}o(sl,"resolveDeviceAuth");function dl(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:o(()=>t.clearTimeout(n),"cancel")}}o(dl,"boundedSignal");function ul(e,t){let r=o(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i);},"dispose")}}o(ul,"mergeSignals");function cl(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",l),n();},e),l=o(()=>{t.clearTimeout(i),n();},"onAbort");r?.addEventListener("abort",l,{once:true});})}o(cl,"delayAbortable");var hr=Object.freeze(["visit","join","summary","messages"]);function Sr(e){return typeof e=="string"&&hr.includes(e)}o(Sr,"isVetVisitIntent");var pl="/widget/v1/televet/handoffs",fl="/widget/v1/televet/availability",yl="/widget/v1/televet/chat-entry",ml=/^[a-z0-9][a-z0-9_-]{0,39}$/,gl=/^[A-Za-z0-9_-]{22}$/;var oo=32,io=128,ao=64;function Tr(e){let t=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 t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}o(Tr,"vetVisitErrorReasonOf");function lo(e){return C($("validationFailed",{retryable:false,wireMessage:e}))}o(lo,"invalid");function Er(e){return C($("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(Er,"unusable");function vl(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!ml.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let i=t?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=i;}let l=t?.visitRef,s=t?.intent,a=l!=null;if(a){let d=typeof l=="string"?l.trim():"";if(d.length<1||[...d].length>ao)return {ok:false,message:`visitRef must be 1..${ao} characters`};r.visit_ref=d;}if(s!=null){if(!a)return {ok:false,message:"intent needs the visitRef it opens"};if(!Sr(s))return {ok:false,message:`intent must be one of ${hr.join(", ")}`};r.intent=s;}return {ok:true,body:r}}o(vl,"handoffBody");function bl(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!Sr(r)?null:Object.freeze({visitRef:t,intent:r})}o(bl,"parseVisitEcho");function uo(e){let t=e.funnel??_e({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=o(i=>(so(r,"televet.visit.handoff_failed",{reason:Tr(i)}),C(i)),"failed");return {async createHandoff(i,l){let s;if(i!=null){let h=typeof i=="string"?[...i].length:0;if(h<1||h>io)return n($("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${io} characters`}));s=i;}let a=vl(s,l);if(!a.ok){let h=lo(a.message);return h.ok?h:n(h.error)}let d=a.body,c=await t.send("televet.visit.handoff",{method:"POST",path:pl,body:d},{idempotent:false,maxAttempts:1});if(!c.ok)return n(c.error);let u=hl(c.value),p=d.return_to!==void 0,m=p?c.value?.flow_id:void 0;if(p&&(typeof m!="string"||!gl.test(m))){let h=Er("the handoff response carried no usable return flow id");return h.ok?h:n(h.error)}let y=d.visit_ref!==void 0,b=y?bl(c.value?.visit):null;if(y&&b===null){let h=Er("the handoff response did not confirm the visit it opens");return h.ok?h:n(h.error)}let S=u===null?null:Object.freeze({...u,...p?{flowId:m}:{},...b!==null?{visit:b}:{}});return S===null?n($("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(so(r,"televet.visit.handoff_created",{pet_scoped:d.pet_ref!==void 0}),O(S))},async checkAvailability(i){if(typeof i!="string"||i.length>oo)return lo(`state must be at most ${oo} characters`);let l=await t.send("televet.visit.availability",{method:"POST",path:fl,body:{state:i}},{idempotent:false,maxAttempts:1});if(!l.ok)return C(l.error);let s=l.value?.available;return typeof s!="boolean"?Er("the availability response carried no usable answer"):O(Object.freeze({available:s}))},async chatEntryOpen(){try{let i=await t.send("televet.visit.chat_entry",{method:"GET",path:yl},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}o(uo,"createVetVisitController");function hl(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Cl(t)?null:Object.freeze({url:t,expiresAt:r})}o(hl,"parseHandoff");var Sl=new Set(["localhost","127.0.0.1","[::1]"]),El=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Tl=/[\s\u0000-\u001f\u007f]/;function Cl(e){if(Tl.test(e))return false;let t=El.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let i=n.replace(/:\d+$/,"").toLowerCase(),l=r==="https",s=r==="http"&&Sl.has(i);if(!l&&!s)return false;let a=e.indexOf("#");if(a<0)return false;let d=e.slice(a);return d.startsWith("#h=")&&d.length>3}o(Cl,"isOpenableVisitUrl");function so(e,t,r){if(e)try{e.track(t,r);}catch{}}o(so,"safeTrack");var po=Object.freeze({status:"idle",error:null,errorReason:null});function Rl(e,t,r){let{usState:n,chat:i,scope:l}=r,s=t&&(n!==null||i),a=`${n??""}|${i?"chat":""}`,[d,c]=useState(null);if(useEffect(()=>{if(!s)return;let p=true,m=e.current;return c(null),o(async()=>{try{if(i&&!(m.chatEntryOpen&&await m.chatEntryOpen()))return !1;if(n===null)return !0;if(!m.checkAvailability)return !1;let b=await m.checkAvailability(n);return b.ok&&b.value.available}catch{return false}},"ask")().then(b=>{p&&c({key:a,open:b});}),()=>{p=false;}},[s,a,n,i,l,e]),!s)return null;let u=d!==null&&d.key===a;return {open:u&&d.open,pending:!u}}o(Rl,"usePreflight");var _l=Object.freeze({status:"opening",error:null,errorReason:null});function yo(e,t={}){let{runtime:r,userRef:n,scopeEpoch:i}=pe(),l=Re("televet"),s=l.enabled&&n!==null,a=t.usState??null,d=t.entry==="chat",c=t.petRef??null,u=useMemo(()=>{if(t.controller)return t.controller;let{services:x}=r.registry;return uo({auth:x.authFor(n),telemetry:x.telemetry,...x.errorPolicy?{errorPolicy:x.errorPolicy}:{}})},[r,n,i,t.controller]),p=useRef(u);p.current=u;let m=useMemo(()=>({runtime:r,userRef:n,scopeEpoch:i}),[r,n,i]),y=Rl(p,s,{usState:a,chat:d,scope:m}),b=s&&(y===null||y.open)&&(!d||c!==null),S=t.returnTo??null,[h,I]=useState(po),P=useRef(null),R=useRef({runtime:r,userRef:n,scopeEpoch:i});R.current={runtime:r,userRef:n,scopeEpoch:i};let D=useRef(u);D.current=u;let B=useRef(b);B.current=b;let k=useCallback((x,F)=>{if(P.current)return P.current;let z=o((N,Te)=>(I({status:N==="cancelled"?"idle":"error",error:Te,errorReason:N==="cancelled"?null:N}),Object.freeze({opened:false,reason:N,error:Te})),"fail");if(!B.current)return Promise.resolve(z("unavailable",null));let K=e.prepare();if(!K.ok)return Promise.resolve(z(K.reason,null));let _=R.current,ne=D.current;I(_l);let Ee=(async()=>{let N,Te={...S!==null?{returnTo:S}:{},...d?{entry:"chat"}:{},...F!==null?{visitRef:F.visitRef}:{},...F!==null&&F.intent!==null&&F.intent!==void 0?{intent:F.intent}:{}},ft=Object.keys(Te).length===0?void 0:Te,yt=x===void 0?c:x;try{N=await(ft===void 0?ne.createHandoff(yt):ne.createHandoff(yt,ft));}catch{return e.abandon(K.value),z("unknown",null)}let Ne=R.current;if(Ne.runtime!==_.runtime||Ne.userRef!==_.userRef||Ne.scopeEpoch!==_.scopeEpoch)return e.abandon(K.value),z("cancelled",null);if(!N.ok)return e.abandon(K.value),z(Tr(N.error),N.error);let Ce=await e.finish(K.value,N.value);return Ce!==null?z(Ce,null):(I(po),Object.freeze(N.value.flowId===void 0?{opened:true}:{opened:true,flowId:N.value.flowId}))})().finally(()=>{P.current===Ee&&(P.current=null);});return P.current=Ee,Ee},[e,c,S,d]),A=useCallback(x=>k(x,null),[k]),U=useCallback((x,F)=>k(void 0,{visitRef:x,intent:F??null}),[k]);return {available:b,isPending:l.isPending||(y?.pending??false),status:h.status,error:h.error,errorReason:h.errorReason,open:A,openVisit:U}}o(yo,"useVetVisitWith");function mo(e){try{e.closed||e.close();}catch{}}o(mo,"closeQuietly");var xl=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},t){if(e.closed)return "cancelled";try{return e.location.replace(t.url),null}catch{return mo(e),"popupBlocked"}},abandon({tab:e}){mo(e);}});function go(e){return yo(xl,e)}o(go,"useVetVisit");var vo=44,Il=.6;function Rt(e){let{petRef:t,children:r,onOpened:n,onError:i,style:l,className:s,controller:a,returnTo:d,usState:c,entry:u,visitRef:p,intent:m,onStartInApp:y,prefer:b}=e,S=go({...d!==void 0?{returnTo:d}:{},...c!==void 0?{usState:c}:{},...u!==void 0?{entry:u}:{},...t!==void 0?{petRef:t}:{},...a!==void 0?{controller:a}:{}}),h=w(),I=useMemo(()=>Ol(h),[h]),P=useRef(false);if(!S.available)return null;let R=S.status==="opening",D=p!=null,B=b==="redirect"||D,k=!B&&y!==void 0;return jsx("button",{type:"button",onClick:o(()=>{if(!(R||P.current)){if(k){$e(y);return}(P.current=true,(p==null?S.open():S.openVisit(p,m??null)).then(x=>{x.opened?$e(n,x.flowId??null):x.reason!=="cancelled"&&$e(i,x.reason,x.error);}).finally(()=>{P.current=false;}));}},"onClick"),"aria-busy":R,"aria-disabled":R,className:s,style:{...I,...R?{opacity:Il,cursor:"progress"}:null,...l},children:r??Xn.visitButton})}o(Rt,"VetVisitButton");function Ol(e){let{color:t,space:r,radius:n,type:i,slots:l}=e;return {boxSizing:"border-box",minHeight:vo,minWidth:vo,display:"inline-flex",alignItems:"center",justifyContent:"center",margin:0,border:0,cursor:"pointer",padding:`${r.sm}px ${r.xl}px`,borderRadius:n.pill,backgroundColor:t.primary,color:t.onPrimary,...E(e,"medium"),fontSize:i.size.body,...kt(l.vetVisitButton),...Ct(l.vetVisitButton)}}o(Ol,"buttonStyle");function _t(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t,n=r.detail??r.error;return typeof n=="object"&&n!==null?n:r}o(_t,"details");function Fl(e){let t=_t(e)?.categories;return Array.isArray(t)?Object.freeze(t.filter(r=>typeof r=="string")):Object.freeze([])}o(Fl,"categoriesOf");function bo(e){let t=_t(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}o(bo,"retryAfterOf");function ho(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let r=_t(e)?.message;return typeof r=="string"&&r.trim().length>0?r.trim():null}o(ho,"messageOf");function Dl(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let r=_t(e),n=r?.code??r?.error_code;return typeof n=="string"&&n.length>0?n:null}o(Dl,"codeOf");function xe(e){let t=e.httpStatus;if(t===402)return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")return Object.freeze({kind:"rate_limited",retryAfterSeconds:bo(e),message:ho(e)});if(t===404)return Object.freeze({kind:"unavailable"});switch(Dl(e)){case "televet_rate_limited":return Object.freeze({kind:"rate_limited",retryAfterSeconds:bo(e),message:ho(e)});case "televet_emergency_ack_required":return Object.freeze({kind:"emergency",categories:Fl(e)});case "televet_not_entitled":return Object.freeze({kind:"not_entitled"});case "televet_slot_conflict":return Object.freeze({kind:"slot_taken"});case "televet_hold_invalid":return Object.freeze({kind:"slot_taken"});case "televet_clinician_cannot_prescribe":case "televet_clinician_unavailable":case "televet_clinician_not_bookable":return Object.freeze({kind:"clinician_unavailable"});case "televet_membership_conflict":return Object.freeze({kind:"not_entitled"});case "televet_registry_unavailable":return Object.freeze({kind:"failed"});}return Object.freeze({kind:"failed"})}o(xe,"televetBookingRefusal");function xt(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}o(xt,"hasLoneSurrogate");function Pt(e){return [...e].length}o(Pt,"serverLength");var So=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Eo(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(So,t)?So[t]:null}o(Eo,"canonicalPetSpecies");var To=50,Bl=128,kr=120,Co=120,Ll=2e3,ko=120,Nl=80,xo=new Set(["male","female","unknown"]),Po=new Set(["day","month","year"]),wo=new Set(["low","medium","high","athletic"]),Io=new Set(["indoor","outdoor","both"]),Oo=new Set(["mild","moderate","severe"]),Vl=/^(\d{4})-(\d{2})-(\d{2})$/,Ao=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],Fo=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...Ao,...Fo].map(([e])=>e));function zl(e){let t=Vl.exec(e);if(t===null)return false;let[r,n,i]=[Number(t[1]),Number(t[2]),Number(t[3])],l=new Date(Date.UTC(r,n-1,i));return l.getUTCFullYear()===r&&l.getUTCMonth()===n-1&&l.getUTCDate()===i}o(zl,"isRealDate");var Je=o(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),Hl=o((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),It=o((e,t)=>typeof t=="string"&&zl(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),ae=o((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(xt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let i=t.trimmed?n.trim():n;if(t.required&&i.length===0)return `${r} is required and must not be blank`;let l=Pt(i);return l<=e?null:`${r} is ${l} characters; the server accepts at most ${e}`},"text"),Ml={sex:Je(xo),spayedNeutered:Hl,birthDate:It,birthDatePrecision:Je(Po),activityLevel:Je(wo),indoorOutdoor:Je(Io),foodBrand:ae(ko),foodType:ae(ko),microchipId:ae(Nl)},Rr=["ref","ref",false,ae(Bl,{required:true,trimmed:true})],_r=["notes","notes",false,ae(Ll,{trimmed:true})],Ro=[Rr,["name","name",true,ae(kr,{required:true,trimmed:true})],["dose","dose",false,ae(Co,{trimmed:true})],["frequency","frequency",false,ae(Co,{trimmed:true})],["startDate","start_date",false,It],["endDate","end_date",false,It],_r],jl={allergies:[Rr,["allergen","allergen",true,ae(kr,{required:true,trimmed:true})],["severity","severity",false,Je(Oo)],_r],medications:Ro,supplements:Ro,conditions:[Rr,["conditionName","condition_name",true,ae(kr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,It],_r]};function Ul(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let i=r,l={};for(let[d,c,u,p]of jl[e]){let m=i[d];if(m==null){if(u)return {error:`${n}.${d} is required`};m===null&&(l[c]=null);continue}let y=p(`${n}.${d}`,m);if(y!==null)return {error:y};l[c]=m;}let s=l.start_date,a=l.end_date;return typeof s=="string"&&typeof a=="string"&&a<s?{error:`${n}.endDate must not be before startDate`}:{item:l}}o(Ul,"itemToWire");function Wl(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>To)return {error:`${e} has ${t.length} items; the server accepts at most ${To}`};let r=[],n=new Set;for(let i=0;i<t.length;i+=1){let l=Ul(e,i,t[i]);if("error"in l)return l;let s=l.item.ref;if(typeof s=="string"){let a=s.trim();if(n.has(a))return {error:`${e}: ref ${JSON.stringify(a)} is used twice; a ref names one item`};n.add(a);}r.push(l.item);}return {items:r}}o(Wl,"listToWire");function Do(e,t){let r=e,n={};for(let[s,a]of Ao){let d=r[s];if(d!==void 0){if(d!==null){let c=Ml[s](s,d);if(c!==null)return {error:c}}n[a]=d;}}let i=r.birthDate!==void 0,l=r.birthDatePrecision!==void 0;if(i!==l||i&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[s,a]of Fo){let d=r[s];if(d===void 0)continue;let c=Wl(s,d);if("error"in c)return c;n[a]=c.items;}return Object.keys(n).length>0&&t!==void 0&&Eo(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}o(Do,"petHealthToWire");var H=o(e=>typeof e=="string"?e:null,"str"),Qe=o((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),ql=o(e=>typeof e=="boolean"?e:null,"bool");function wt(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}o(wt,"itemsFromWire");function _o(e){let t=H(e.name);return t===null||t.length===0?null:Object.freeze({ref:H(e.ref),name:t,dose:H(e.dose),frequency:H(e.frequency),startDate:H(e.start_date),endDate:H(e.end_date),notes:H(e.notes)})}o(_o,"medicationFromWire");function Bo(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Qe(xo,e.sex),spayedNeutered:ql(e.spayed_neutered),birthDate:H(e.birth_date),birthDatePrecision:Qe(Po,e.birth_date_precision),activityLevel:Qe(wo,e.activity_level),indoorOutdoor:Qe(Io,e.indoor_outdoor),foodBrand:H(e.food_brand),foodType:H(e.food_type),microchipId:H(e.microchip_id),allergies:wt(e.allergies,r=>{let n=H(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:H(r.ref),allergen:n,severity:Qe(Oo,r.severity),notes:H(r.notes)})}),medications:wt(e.medications,_o),supplements:wt(e.supplements,_o),conditions:wt(e.conditions,r=>{let n=H(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:H(r.ref),conditionName:n,diagnosedDate:H(r.diagnosed_date),notes:H(r.notes)})})})}o(Bo,"petHealthFromWire");var Vo=100,zo=50,Ho=100,Mo=50,jo=500,Kl=128,$l=6e4;function se(e){return $("validationFailed",{retryable:false,wireMessage:e})}o(se,"invalid");function Pe(e,t,r){if(typeof t!="string")return se(`${e} must be a string`);let n=Pt(t);return n<=r?null:se(`${e} is ${n} characters; the server accepts at most ${r}`)}o(Pe,"checkString");function Ot(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:se(`${e} must be a finite number between 0 and ${r}`)}o(Ot,"outOfRange");function Lo(e,t){if(typeof e!="string")return se("pet_ref must be a string");if(e.trim().length===0)return se("pet_ref must not be blank");if(xt(e))return se("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return se("profile must be an object");let r=[Pe("pet_ref",e,Kl)];return t?.name!==void 0&&r.push(Pe("name",t.name,Vo)),t?.species!==void 0&&r.push(Pe("species",t.species,zo)),t?.breed!==void 0&&r.push(Pe("breed",t.breed,Ho)),t?.ageYears!==void 0&&r.push(Ot("age_years",t.ageYears,Mo)),t?.weightKg!==void 0&&r.push(Ot("weight_kg",t.weightKg,jo)),r.find(n=>n!==null)??null}o(Lo,"validate");function Uo(e,t){let r=Do(e,t);return "error"in r?{error:se(r.error)}:r}o(Uo,"healthToWire");function Yl(e){if(typeof e!="object"||e===null)return {error:se("patch must be an object")};let t=e,r=[["name","name",l=>Pe("name",l,Vo)],["species","species",l=>Pe("species",l,zo)],["breed","breed",l=>Pe("breed",l,Ho)],["ageYears","age_years",l=>Ot("age_years",l,Mo)],["weightKg","weight_kg",l=>Ot("weight_kg",l,jo)]],n={};for(let[l,s,a]of r){let d=t[l];if(d!==void 0){if(d!==null){let c=a(d);if(c!==null)return {error:c}}n[s]=d;}}let i=Uo(t,t.species);return "error"in i?i:(Object.assign(n,i.body),Object.keys(n).length===0?{error:se("patch must change at least one field")}:{body:n})}o(Yl,"patchToWire");function Gl(e){if(e==null)return {body:{}};let t=Uo(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}o(Gl,"toWire");var le=o(e=>typeof e=="string"?e:null,"str"),At=o(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function No(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:le(r.pet_ref)??t,name:le(r.name),species:le(r.species),breed:le(r.breed),ageYears:At(r.age_years),weightKg:At(r.weight_kg)})}o(No,"fromWire");function Wo(e){if(typeof e!="object"||e===null)return null;let t=e,r=le(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:le(t.pet_id),petRef:r,name:le(t.name),species:le(t.species),breed:le(t.breed),ageYears:At(t.age_years),weightKg:At(t.weight_kg),updatedAt:le(t.updated_at)})}o(Wo,"widgetPetFromWire");function Xl(e){let t=Wo(e);return t===null?null:Object.freeze({...t,...Bo(e)})}o(Xl,"widgetPetProfileFromWire");function Ql(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=Wo(r);return n===null?[]:[n]}))}o(Ql,"petListFromWire");function qo(e){return Jl(_e({auth:e}),_e({auth:e,unaryTimeoutMs:$l}))}o(qo,"createPetsRepository");function Jl(e,t=e){let r=o((i,l)=>l?{...i,signal:l}:i,"withSignal"),n=o(i=>Lo(i,void 0)??`/widget/v1/pets/${encodeURIComponent(i)}`,"petPath");return {async list(i){let l=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},i?.signal));return l.ok?O(Ql(l.value)):C(l.error)},async registerPet(i,l,s){let a=Lo(i,l);if(a!==null)return C(a);let d=Gl(l);if("error"in d)return C(d.error);let u={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(i)}`,body:d.body},p=await e.send("pets.registerPet",s?.signal?{...u,signal:s.signal}:u);return p.ok?O(No(p.value,i)):C(p.error)},async updatePet(i,l,s){let a=n(i);if(typeof a!="string")return C(a);let d=Yl(l);if("error"in d)return C(d.error);let c=await e.send("pets.updatePet",r({method:"PATCH",path:a,body:d.body},s?.signal));return c.ok?O(No(c.value,i)):C(c.error)},async getPetProfile(i,l){let s=n(i);if(typeof s!="string")return C(s);let a=await e.send("pets.getPetProfile",r({method:"GET",path:`${s}/profile`},l?.signal));if(!a.ok)return C(a.error);let d=Xl(a.value);return d===null?C($("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):O(d)},async deletePet(i,l){let s=n(i);if(typeof s!="string")return C(s);let a=await e.send("pets.deletePet",r({method:"DELETE",path:s},l?.signal));return a.ok?O(void 0):C(a.error)},async eraseUserData(i){let l=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},i?.signal),{maxAttempts:1});return l.ok?O(void 0):C(l.error)}}}o(Jl,"createPetsRepositoryOver");function Ko(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=pe(),i=useMemo(()=>qo(e.registry.services.authFor(t)),[e,t,n]),[l,s]=useState({repository:i,pets:[],loading:true,error:null}),a=l.repository===i?l:{pets:[],loading:true,error:null},d=useRef(0),c=useCallback(async()=>{let p=++d.current;s(y=>({...y,repository:i,loading:true,error:null,pets:y.repository===i?y.pets:[]}));let m=await i.list();p===d.current&&s(m.ok?{repository:i,pets:m.value,loading:false,error:null}:y=>({repository:i,pets:y.repository===i?y.pets:[],loading:false,error:m.error}));},[i]);useEffect(()=>(c(),()=>{d.current+=1;}),[c]);let u=useMemo(()=>r===null?null:a.pets.find(p=>p.petRef===r)??null,[r,a.pets]);return useMemo(()=>({pets:a.pets,activePet:u,loading:a.loading,error:a.error,refresh:c}),[a.pets,a.loading,a.error,u,c])}o(Ko,"useEverfurPets");var Go=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],ns=new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),Xo=["wellness","prescription"],Ft=64,me=2e3,Dt=10;function de(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}o(de,"isWellFormedStateCode");function ye(e){return typeof e=="object"&&e!==null?e:null}o(ye,"row");function Y(e){return typeof e=="string"&&e.length>0?e:null}o(Y,"str");function we(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}o(we,"trimmedOrNull");function Ze(e,t){return typeof e=="boolean"?e:t}o(Ze,"bool");function $o(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o($o,"num");function Yo(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}o(Yo,"closed");function et(e,t){if(!Array.isArray(e))return Object.freeze([]);let r=[];for(let n of e){let i=t(n);i!==null&&r.push(i);}return Object.freeze(r)}o(et,"parseList");function Qo(e,t){let r=ye(e);return r===null?null:Object.freeze({state:Y(r.state)??t,wellnessAvailable:Ze(r.wellness_available,false),prescriptionsAvailable:Ze(r.prescriptions_available,false),cancellationPolicyText:we(r.cancellation_policy_text)})}o(Qo,"parseStatePolicy");function Jo(e){let t=ye(e);if(t===null)return null;let r=we(t.summary),n=we(t.version);return r===null||n===null?null:Object.freeze({summary:r,version:n})}o(Jo,"parseCancellationPolicy");function Zo(e){let t=ye(e);if(t===null)return null;let r=Y(t.clinician_id),n=Y(t.display_name);return r===null||n===null?null:Object.freeze({clinicianId:r,displayName:n,credentials:we(t.credentials_text),rating:$o(t.rating),ratingCount:$o(t.rating_count),bio:we(t.bio),photoRef:Y(t.photo_ref),licensedStates:et(t.licensed_states,i=>{let l=ye(i),s=l===null?null:Y(l.state);return s===null?null:Object.freeze({state:s,canPrescribe:Ze(l?.can_prescribe,false)})})})}o(Zo,"parseClinician");function Pr(e){let t=ye(e);if(t===null)return null;let r=Y(t.slot_id),n=Y(t.starts_at);return r===null||n===null?null:Object.freeze({slotId:r,startsAt:n,endsAt:Y(t.ends_at)??n})}o(Pr,"parseSlot");function ei(e){let t=ye(e);if(t===null)return null;let r=Y(t.slot_id),n=Y(t.hold_expires_at);return r===null||n===null?null:Object.freeze({slotId:r,expiresAt:n})}o(ei,"parseSlotHold");function wr(e){let t=ye(e);if(t===null)return null;let r=Y(t.consult_id),n=Y(t.scheduled_at);return r===null||n===null?null:Object.freeze({consultId:r,petId:Y(t.pet_id)??"",clinicianId:Y(t.clinician_id)??"",clinicianName:we(t.display_name),reasonText:we(t.reason_text),mediaRefs:et(t.media_refs,i=>Y(i)),status:Yo(Go,t.status),kind:Yo(Xo,t.kind),scheduledAt:n,emergencyFlagged:Ze(t.emergency_flagged,false)})}o(wr,"parseConsult");function ti(e){let t=ye(e);return Object.freeze({active:Ze(t?.active,false)})}o(ti,"parseBookingEntitlement");var Ie=Object.freeze(["pet","reason","clinician","time","review","booked"]),ri=Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function Or(e,t={}){let r=Object.freeze({...ri,...t}),n=Ir(0,e);return Object.freeze({index:n,draft:r,furthestIndex:n})}o(Or,"initialTelevetBookingState");function Bt(e,t){return e==="pet"?t.ownedPetCount<=1:false}o(Bt,"isSkipped");function Lt(e){return Ie[e]}o(Lt,"stepAt");function Ir(e,t){for(let r=e;r<Ie.length;r+=1){let n=Lt(r);if(n&&!Bt(n,t))return r}return Ie.length-1}o(Ir,"nextVisible");function ni(e,t){for(let r=e;r>=0;r-=1){let n=Lt(r);if(n&&!Bt(n,t))return r}return null}o(ni,"previousVisible");function Ar(e,t){return ni(e.index-1,t)!==null}o(Ar,"hasPreviousStep");function Fr(e,t,r){switch(t.type){case "patch":{let n={...e.draft,...t.patch};return ("petId"in t.patch&&t.patch.petId!==e.draft.petId||"state"in t.patch&&t.patch.state!==e.draft.state||"clinicianId"in t.patch&&t.patch.clinicianId!==e.draft.clinicianId)&&e.draft.slot?Object.freeze({...e,draft:Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):Object.freeze({...e,draft:Object.freeze(n)})}case "next":{let n=Ir(e.index+1,r);return Object.freeze({...e,index:n,furthestIndex:Math.max(e.furthestIndex,n)})}case "back":{if(Lt(e.index)==="booked")return e;let n=ni(e.index-1,r);return n===null?e:Object.freeze({...e,index:n})}case "goTo":{let n=Ie.indexOf(t.step);if(n<0)return e;let i=Bt(t.step,r)?Ir(n,r):n;return Object.freeze({...e,index:i,furthestIndex:Math.max(e.furthestIndex,i)})}default:return e}}o(Fr,"televetBookingReducer");function Dr(e){return Lt(e.index)??"pet"}o(Dr,"currentStep");function Nt(e,t){let r=t.trim();return !!e.petId&&!!e.clinicianId&&!!e.slot&&de(e.state)&&r.length>0&&r.length<=me}o(Nt,"canConfirm");function Br(e,t){if(!e.holdExpiresAt)return false;let r=Date.parse(e.holdExpiresAt);return Number.isNaN(r)?false:r<=t}o(Br,"isHoldExpired");function Lr(e){return `televet.book.${e}`}o(Lr,"televetBookingKey");function Nr(e,t,r){let n=r?.version?.trim()??"";return !e||!t||n.length===0?Object.freeze({}):Object.freeze({state_attested:true,cancellation_policy_version:n})}o(Nr,"attestation");function ge(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}o(ge,"parse");function tt(e){let t=ge(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}o(tt,"formatClock");function os(e){let t=ge(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}o(os,"formatDate");var Me=10;function Vt(e){let t=ge(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??"":""}o(Vt,"formatZone");function is(e){let t=ge(e);if(!t)return "";let r=new Date(t.getTime()+Me*6e4).toISOString(),n=Vt(e),i=`${tt(e)} - ${tt(r)}`;return n&&n!==""?`${i} ${n}`:i}o(is,"formatVisitRange");function oi(e){let t=os(e),r=[tt(e),Vt(e)].filter(Boolean).join(" ");return [t,r].filter(Boolean).join(", ")}o(oi,"formatWhen");function re(e){let t=ge(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),oi(e)].filter(Boolean).join(", "):""}o(re,"formatWhenWithDay");function zt(e){let t=ge(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}o(zt,"localDayKey");function ii(e){let t=ge(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}o(ii,"formatMonthLabel");function ai(e){let t=ge(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}o(ai,"formatFullDayLabel");var be="/widget/v1/televet",as=`${be}/state-policy`,ls=`${be}/vets`,si=`${be}/slots`,ss=`${be}/slots/next`,di=`${be}/consults`,ds=`${be}/entitlement`,us=`${be}/cancellation-policy`;function ui(e){return `${si}/${encodeURIComponent(e)}/hold`}o(ui,"televetHoldCall");function ci(e){return `${di}/${encodeURIComponent(e)}/reschedule`}o(ci,"televetRescheduleCall");function ve(e){return C($("validationFailed",{retryable:false,wireMessage:e}))}o(ve,"invalid");function Ht(e){return C($("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(Ht,"unusable");function Mt(e){return e.httpStatus===404}o(Mt,"isDark");function Vr(e,t,r){try{e?.track(t,r);}catch{}}o(Vr,"safeTrack");function pi(e){if(e.pet_id.trim().length===0)return "pet_id is required";if(e.clinician_id.trim().length===0)return "clinician_id is required";if(e.slot_id.trim().length===0)return "slot_id is required";if(!de(e.state))return "state must be a two-letter US state code";let t=e.reason_text.trim();return t.length===0?"reason_text is required":t.length>me?`reason_text must be at most ${me} characters`:cs(e)}o(pi,"validateBookingBody");function cs(e){let t=e.state_attested===true,r=e.cancellation_policy_version?.trim()??"";return t!==r.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":r.length>Ft?`cancellation_policy_version must be at most ${Ft} characters`:null}o(cs,"attestationRefusal");function zr(e){let t=e.funnel??_e({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry;return {async statePolicy(n,i){let l=n.trim();if(!de(l))return ve("state must be a two-letter US state code");let s=await t.send("televet.booking.state_policy",{method:"GET",path:`${as}/${encodeURIComponent(l)}`,...i?{signal:i}:{}});if(!s.ok)return Mt(s.error)?O(Object.freeze({state:l,wellnessAvailable:false,prescriptionsAvailable:false,cancellationPolicyText:null})):C(s.error);let a=Qo(s.value,l);return a===null?Ht("the state policy response was unreadable"):O(a)},async entitlement(n){let i=await t.send("televet.booking.entitlement",{method:"GET",path:ds,...n?{signal:n}:{}});return i.ok?O(ti(i.value)):Mt(i.error)?O(Object.freeze({active:false})):C(i.error)},async cancellationPolicy(n){let i=await t.send("televet.booking.cancellation_policy",{method:"GET",path:us,...n?{signal:n}:{}});return i.ok?O(Jo(i.value)):O(null)},async clinicians(n,i){let l=n.trim();if(!de(l))return ve("state must be a two-letter US state code");let s=await t.send("televet.booking.clinicians",{method:"GET",path:ls,query:{state:l},...i?{signal:i}:{}});return s.ok?O(et(li(s.value,"vets"),Zo)):Mt(s.error)?O(Object.freeze([])):C(s.error)},async slots(n,i){let l=n.trim();if(l.length===0)return ve("clinicianId is required");let s=await t.send("televet.booking.slots",{method:"GET",path:si,query:{clinician_id:l},...i?{signal:i}:{}});return s.ok?O(et(li(s.value,"slots"),Pr)):Mt(s.error)?O(Object.freeze([])):C(s.error)},async nextSlot(n){let i=await t.send("televet.booking.next_slot",{method:"GET",path:ss,...n?{signal:n}:{}});return i.ok?O(Pr(fs(i.value,"slot"))):O(null)},async holdSlot(n){let i=n.trim();if(i.length===0)return ve("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:ui(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return Vr(r,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),C(l.error);let s=ei(l.value);return s===null?Ht("the hold response carried no usable expiry"):O(s)},async book(n,i){let l=pi(n);if(l!==null)return ve(l);let s=i.trim();if(s.length===0)return ve("idempotencyKey is required");let a=await t.send("televet.booking.book",{method:"POST",path:di,body:ps(n)},{idempotent:true,idempotencyKey:s,maxAttempts:1});if(!a.ok)return Vr(r,"televet.booking.book_failed",{status:a.error.httpStatus??null}),C(a.error);let d=wr(a.value);return d===null?Ht("the booking response was unreadable"):O(d)},async reschedule(n,i){let l=n.trim(),s=i.trim();if(l.length===0)return ve("consultId is required");if(s.length===0)return ve("slotId is required");let a=await t.send("televet.booking.reschedule",{method:"POST",path:ci(l),body:{new_slot_id:s}},{idempotent:false,maxAttempts:1});if(!a.ok)return Vr(r,"televet.booking.reschedule_failed",{status:a.error.httpStatus??null}),C(a.error);let d=wr(a.value);return d===null?Ht("the reschedule response was unreadable"):O(d)}}}o(zr,"createTelevetBookingController");function ps(e){let t=e.cancellation_policy_version?.trim()??"",r=e.state_attested===true&&t.length>0;return {pet_id:e.pet_id,clinician_id:e.clinician_id,slot_id:e.slot_id,state:e.state,reason_text:e.reason_text.trim(),species:e.species,media_refs:[...e.media_refs],emergency_acknowledged:e.emergency_acknowledged,share_health_records:e.share_health_records,...r?{state_attested:true,cancellation_policy_version:t}:{}}}o(ps,"bookingWireBody");function li(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let r=e,n=r[t]??r.items??r.data;if(Array.isArray(n))return n}return e}o(li,"rows");function fs(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let r=e,n=r[t]??r.data;if(typeof n=="object"&&n!==null)return n}return e}o(fs,"unwrap");function rt(e){let{runtime:t,userRef:r,scopeEpoch:n}=pe();return useMemo(()=>{if(e)return e;if(r===null)return null;let{services:i}=t.registry;return zr({auth:i.authFor(r),telemetry:i.telemetry,...i.errorPolicy?{errorPolicy:i.errorPolicy}:{}})},[t,r,n,e])}o(rt,"useTelevetBookingController");function ys(){let{userRef:e}=pe(),t=Re("televet");return useMemo(()=>({available:t.enabled&&e!==null,isPending:t.isPending}),[t.enabled,t.isPending,e])}o(ys,"useTelevetBookingAvailable");function je(e,t,r){let[n,i]=useState(()=>({key:e,data:null,isPending:t&&r!==null,error:null})),[l,s]=useState(0),a=useRef(r);a.current=r,useEffect(()=>{let u=a.current;if(!t||u===null){i({key:e,data:null,isPending:false,error:null});return}let p=new AbortController,m=true;return i(y=>y.key===e?{...y,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let y;try{y=await u(p.signal);}catch{m&&i({key:e,data:null,isPending:false,error:null});return}m&&(y.ok?i({key:e,data:y.value,isPending:false,error:null}):i({key:e,data:null,isPending:false,error:y.error}));})(),()=>{m=false,p.abort();}},[e,t,l]);let d=useCallback(()=>s(u=>u+1),[]),c=n.key===e;return useMemo(()=>({enabled:t,data:c?n.data:null,isPending:t&&(!c||n.isPending),isError:c&&n.error!==null,error:c?n.error:null,refetch:d}),[t,c,n.data,n.isPending,n.error,d])}o(je,"useTelevetRead");function Mr(e,t){let r=e?.trim()??"",n=t?.statePolicy!==void 0&&de(r),i=t?.statePolicy;return je(`state-policy:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(Mr,"useTelevetStatePolicy");function jr(e){let t=e?.entitlement!==void 0,r=e?.entitlement;return je("entitlement",t,t&&r?n=>r.call(e,n):null)}o(jr,"useTelevetBookingEntitlement");function Ur(e){let t=e?.cancellationPolicy!==void 0,r=e?.cancellationPolicy;return je("cancellation-policy",t,t&&r?n=>r.call(e,n):null)}o(Ur,"useTelevetCancellationPolicy");function Wr(e,t){let r=e?.trim()??"",n=t?.clinicians!==void 0&&de(r),i=t?.clinicians;return je(`clinicians:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(Wr,"useTelevetClinicians");function nt(e,t){let r=e?.trim()??"",n=t!==null&&r.length>0;return je(`slots:${r}`,n,n&&t?i=>t.slots(r,i):null)}o(nt,"useTelevetSlots");function qr(e){let t=e?.nextSlot!==void 0,r=e?.nextSlot;return je("next-slot",t,t&&r?n=>r.call(e,n):null)}o(qr,"useTelevetNextSlot");function Kr(e){let[t,r]=useState(null),n=useRef(true),i=useRef(false),l=useRef(e);l.current=e,useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=useCallback((...a)=>{let d=l.current;if(d===null||i.current)return;let c=a[a.length-1],u=typeof c=="object"&&c!==null&&("onSuccess"in c||"onError"in c),p=u?c:void 0,m=u?a.slice(0,-1):a;i.current=true,r({variables:m[0]??null}),(async()=>{let y=null;try{y=await d(...m);}catch{y=null;}i.current=false,n.current&&r(null),y!==null&&(y.ok?p?.onSuccess?.(y.value):p?.onError?.(y.error));})();},[]);return useMemo(()=>({isPending:t!==null,variables:t?.variables??null,mutate:s}),[t,s])}o(Kr,"useTelevetWrite");function ot(e){return Kr(e?t=>e.holdSlot(t):null)}o(ot,"useTelevetHoldSlot");function $r(e){return Kr(e?(t,r)=>e.book(t,r):null)}o($r,"useTelevetBookConsult");function Yr(e,t){return Kr(t&&e?r=>t.reschedule(e,r):null)}o(Yr,"useTelevetRescheduleConsult");var Ue=2;function mi(e){return typeof e!="number"||!Number.isInteger(e)?Ue:e<1?1:e>6?6:e}o(mi,"headingLevel");function it(e){return e>=6?6:e+1}o(it,"nextHeadingLevel");function fe(e){return `h${String(e)}`}o(fe,"headingTag");var vs=it(Ue),Gr=createContext(vs);function Oe(){return useContext(Gr)}o(Oe,"useNestedHeadingLevel");var ee=44;function M(){let e=w();return useMemo(()=>hs(e),[e])}o(M,"useBookingStyles");function W({label:e,onPress:t,kind:r="primary",disabled:n=false,loading:i=false,fullWidth:l=true,accessibilityLabel:s,testID:a,style:d}){let c=M(),u=n||i;return jsx("button",{type:"button",onClick:t,disabled:u,"aria-busy":i||void 0,...s&&s!==e?{"aria-label":s}:{},"data-testid":a,style:{...c.button,...r==="primary"?c.buttonPrimary:c.buttonSecondary,...l?c.buttonFull:c.buttonAuto,...u?c.buttonDisabled:null,...d},children:e})}o(W,"TelevetButton");function V({title:e,message:t,actionLabel:r,onAction:n,testID:i}){let l=M(),s=fe(Oe()),a=typeof r=="string"&&r.length>0&&typeof n=="function";return jsxs("div",{style:l.stateCard,"data-testid":i,children:[jsx(s,{style:l.stateTitle,children:e}),t?jsx("p",{style:l.stateMessage,children:t}):null,a?jsx(W,{label:r,onPress:n,kind:"secondary",fullWidth:false}):null]})}o(V,"TelevetStateCard");function Ae({height:e,width:t="100%",testID:r}){let n=M();return jsx("span",{"aria-hidden":"true","data-testid":r,style:{...n.skeleton,height:e,width:t}})}o(Ae,"TelevetSkeletonBlock");function J({message:e,assertive:t=false,testID:r,style:n}){let i=M();return jsx("p",{role:t?"alert":"status","data-testid":r,style:{...i.failure,...n},children:e})}o(J,"TelevetFailureLine");function hs(e){let{color:t,space:r,radius:n,type:i,slots:l}=e,{size:s,lineHeight:a}=i,d=o(c=>`${String(c)}px`,"rem");return {screen:{display:"flex",flexDirection:"column",minHeight:0,flex:"1 1 auto",gap:d(r.md),paddingLeft:d(r.xl),paddingRight:d(r.xl),boxSizing:"border-box"},stepFill:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,gap:d(r.md)},list:{display:"flex",flexDirection:"column",gap:d(r.sm)},button:{minHeight:ee,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:d(r.sm),paddingLeft:d(r.xl),paddingRight:d(r.xl),paddingTop:d(r.sm),paddingBottom:d(r.sm),borderRadius:d(n.pill),borderStyle:"solid",borderWidth:0,cursor:"pointer",textAlign:"center",...E(e,"medium"),fontSize:d(s.body),lineHeight:String(a.snug),boxSizing:"border-box"},buttonFull:{alignSelf:"stretch",width:"100%"},buttonAuto:{alignSelf:"flex-start",minWidth:ee},buttonPrimary:{backgroundColor:t.primary,color:t.onPrimary,...kt(l.primaryButton),...Ct(l.primaryButton)},buttonSecondary:{borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",color:t.brand,...l.primaryButton?.borderRadius===void 0?null:{borderRadius:d(l.primaryButton.borderRadius)},...l.primaryButton?.borderColor===void 0?null:{borderColor:l.primaryButton.borderColor}},buttonDisabled:{opacity:.45,cursor:"not-allowed"},stateCard:{minHeight:140,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:d(r.sm),padding:d(r.lg),borderRadius:d(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,boxSizing:"border-box"},stateTitle:{margin:0,...E(e,"medium"),color:t.brand,fontSize:d(s.subtitle),lineHeight:String(a.snug)},stateMessage:{margin:0,...E(e,"regular"),color:t.text.metaCool,fontSize:d(s.body),lineHeight:String(a.normal)},skeleton:{display:"block",borderRadius:d(n.md),backgroundColor:t.skeleton,flexShrink:0},failure:{margin:0,...E(e,"regular"),color:t.danger,fontSize:d(s.caption),lineHeight:String(a.normal)},stepTitle:{margin:0,...E(e,"bold"),color:t.brand,fontSize:d(s.verdict),lineHeight:String(a.snug),textAlign:"center"},stepHelp:{margin:0,...E(e,"regular"),color:t.text.metaCool,fontSize:d(s.body),lineHeight:String(a.normal),textAlign:"center"},divider:{height:1,backgroundColor:t.brandBorder,flexShrink:0},scrollRoot:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0},scrollBody:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},scrollFooter:{flexShrink:0,paddingTop:d(r.md),paddingBottom:d(r.lg)}}}o(hs,"makeBookingStyles");function gi(e){return `televet-consult-${e}`}o(gi,"televetConsultCalendarKey");function Qr({consult:e,petName:t,onDone:r,onAddToCalendar:n,canJoinInApp:i=false}){let l=w(),s=M(),a=useMemo(()=>ks(l),[l]),d=`${useId()}-booked-title`,c=fe(Oe()),[u,p]=useState("idle"),m=o(async()=>{if(!n)return;p("saving");let b=new Date(e.scheduledAt);if(Number.isNaN(b.getTime())){p("failed");return}let S=await bt(n,{key:gi(e.consultId),title:f.visit.title,startDate:b,endDate:new Date(b.getTime()+Me*6e4),alarmOffsetMinutes:-30});p(S.ok&&S.value===true?"saved":"failed");},"addToCalendar"),y=[f.booked.remindPromise,te(f.booked.summaryPromise,{pet:t??""}),...i?[f.booked.joinPromise]:[]];return ce()?jsxs("section",{style:a.screen,"aria-labelledby":d,"data-testid":"televet-booked",children:[jsx("div",{style:a.header,children:jsx(W,{label:f.doneCta,kind:"secondary",fullWidth:false,onPress:r,testID:"televet-booked-done"})}),jsx("div",{"aria-hidden":"true",style:a.avatar}),jsx(c,{id:d,style:a.title,children:f.bookedTitle}),jsx("p",{style:a.when,children:jsx("time",{dateTime:e.scheduledAt,children:re(e.scheduledAt)})}),jsx("ol",{style:a.steps,"data-testid":"televet-booked-steps",children:y.map((b,S)=>jsxs("li",{style:a.step,children:[jsx("span",{"aria-hidden":"true",style:a.stepNumber,children:String(S+1)}),jsx("span",{style:a.stepText,children:b.trim()})]},b))}),jsxs("div",{style:a.actions,children:[n?jsx(W,{label:u==="saved"?f.booked.calendarAdded:f.addToCalendarCta,kind:"primary",loading:u==="saving",disabled:u==="saving"||u==="saved",onPress:()=>{m();},testID:"televet-booked-calendar"}):null,u==="failed"?jsx("p",{role:"status",style:{...s.failure,...a.calendarNote},"data-testid":"televet-booked-calendar-failed",children:f.booked.calendarFailedBody}):null,jsx(W,{label:t?te(f.booked.backToPet,{pet:t}):f.doneCta,kind:"secondary",onPress:r,testID:"televet-booked-back"})]})]}):jsx("div",{style:a.screen,"data-testid":"televet-booked-copy-unapproved"})}o(Qr,"TelevetBookedScreen");function ks(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {screen:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,gap:a(r.md),paddingLeft:a(r.xl),paddingRight:a(r.xl),boxSizing:"border-box"},header:{display:"flex",justifyContent:"flex-end",paddingBottom:a(r.lg)},avatar:{alignSelf:"center",width:120,height:120,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,borderStyle:"solid",borderWidth:2,borderColor:t.success,boxSizing:"border-box"},title:{margin:0,textAlign:"center",...E(e,"bold"),color:t.brand,fontSize:a(l.verdict),lineHeight:String(s.tight),letterSpacing:"-0.7px",paddingTop:a(r.lg)},when:{margin:0,textAlign:"center",...E(e,"regular"),color:t.text.metaCool,fontSize:a(l.subtitle),lineHeight:String(s.normal)},steps:{listStyle:"none",margin:0,marginTop:a(r.xl),padding:a(r.lg),borderRadius:a(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,display:"flex",flexDirection:"column",gap:a(r.lg),boxSizing:"border-box"},step:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:a(r.md)},stepNumber:{width:26,height:26,flexShrink:0,borderRadius:"50%",backgroundColor:t.primary,display:"inline-flex",alignItems:"center",justifyContent:"center",...E(e,"medium"),color:t.onPrimary,fontSize:a(l.caption),lineHeight:"1"},stepText:{flex:"1 1 auto",minWidth:0,...E(e,"regular"),color:t.brand,fontSize:a(l.body),lineHeight:String(s.normal)},actions:{marginTop:"auto",paddingBottom:a(r.xl),display:"flex",flexDirection:"column",gap:a(r.md)},calendarNote:{textAlign:"center"}}}o(ks,"makeStyles");var at=Object.freeze({position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0});var bi='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function hi(e){return e.tagName==="DIALOG"}o(hi,"isDialogElement");function Si(e,t,r){let n=useRef(null),i=useRef(false),l=useRef(null),s=useRef(r);s.current=r;let a=useCallback(()=>{if(!i.current)return;i.current=false;let u=s.current===void 0?l.current:s.current.current;l.current=null,u&&u.isConnected&&u.focus();},[]);useEffect(()=>{if(!e){a();return}if(!i.current){let m=typeof document>"u"?null:document.activeElement;l.current=m instanceof HTMLElement?m:null;}i.current=true;let u=n.current;if(u===null)return;if(!hi(u)){u.contains(document.activeElement)||(u.querySelector(bi)??u).focus();return}let p=u;typeof p.showModal=="function"?p.open||p.showModal():p.setAttribute("open","");},[e,a]),useEffect(()=>a,[a]);let d=useCallback(u=>{let p=n.current;if(p===null)return;if(u.key==="Escape"&&!hi(p)){u.preventDefault(),u.stopPropagation(),t();return}if(u.key!=="Tab")return;let m=Array.from(p.querySelectorAll(bi)),y=m[0],b=m[m.length-1];if(!y||!b){u.preventDefault();return}let S=document.activeElement;u.shiftKey&&(S===y||!p.contains(S))?(u.preventDefault(),b.focus()):!u.shiftKey&&(S===b||!p.contains(S))&&(u.preventDefault(),y.focus());},[t]),c=useCallback(u=>{u.preventDefault(),t();},[t]);return {dialogRef:n,onKeyDown:d,onCancel:c}}o(Si,"useModalDialog");function Zr({step:e,furthestIndex:t,title:r,canGoBack:n,isDirty:i,onBack:l,onClose:s,onConfirmDiscard:a,headingLevel:d=Ue}){let c=w(),u=useMemo(()=>ki(c),[c]),[p,m]=useState(false),y=useRef(null),S=`${useId()}-close-hint`,h=fe(d);useEffect(()=>{if(!i||typeof window>"u")return;let k=o(A=>{A.preventDefault(),A.returnValue="";},"onBeforeUnload");return window.addEventListener("beforeunload",k),()=>window.removeEventListener("beforeunload",k)},[i]);let I=useCallback(()=>{if(!i){s();return}let k={title:f.chrome.discardTitle,body:f.chrome.discardBody,confirmLabel:f.chrome.discardConfirmCta,keepLabel:f.chrome.discardKeepCta};if(a){Promise.resolve(a(k)).then(A=>{A&&s();},()=>{});return}m(true);},[i,s,a]),P=Ie.length,D=e==="booked"?P:Math.min(P,t+1),B=D/P;return jsxs("div",{style:u.wrap,children:[jsxs("header",{style:u.bar,children:[jsx("div",{style:u.side,children:n?jsx("button",{type:"button",onClick:l,"aria-label":Ci,"data-testid":"televet-booking-back",style:u.tap,children:jsx("span",{"aria-hidden":"true",style:u.chevron})}):null}),jsx(h,{style:u.title,children:r??f.navTitle}),jsxs("div",{style:{...u.side,...u.sideRight},children:[jsx("button",{type:"button",ref:y,onClick:I,"aria-describedby":S,"data-testid":"televet-booking-close",style:{...u.tap,...u.closeTap},children:jsx("span",{style:u.close,children:f.close})}),jsx("span",{id:S,style:at,children:f.chrome.closeHint})]})]}),jsx("p",{style:at,"data-testid":"televet-booking-progress-label",children:te(f.loading.progressTemplate,{step:String(D),total:String(P)})}),jsx("div",{"aria-hidden":"true",style:u.railTrack,children:jsx("div",{style:{...u.railFill,width:`${String(Math.round(B*100))}%`},"data-testid":"televet-booking-rail"})}),p?jsx(ws,{onKeep:()=>m(false),onLeave:()=>{m(false),s();},returnFocusTo:y}):null]})}o(Zr,"TelevetBookingChrome");function ws({onKeep:e,onLeave:t,returnFocusTo:r}){let n=w(),i=useMemo(()=>ki(n),[n]),{dialogRef:l,onKeyDown:s,onCancel:a}=Si(true,e,r),d=useId(),c=`${d}-discard-title`,u=`${d}-discard-body`;return jsxs("dialog",{ref:l,onKeyDown:s,onCancel:a,"aria-labelledby":c,"aria-describedby":u,"data-testid":"televet-booking-discard",style:i.dialog,children:[jsx("h2",{id:c,style:i.dialogTitle,children:f.chrome.discardTitle}),jsx("p",{id:u,style:i.dialogBody,children:f.chrome.discardBody}),jsxs("div",{style:i.dialogActions,children:[jsx(W,{label:f.chrome.discardKeepCta,onPress:e,kind:"primary",fullWidth:false,testID:"televet-booking-discard-keep"}),jsx(W,{label:f.chrome.discardConfirmCta,onPress:t,kind:"secondary",fullWidth:false,testID:"televet-booking-discard-leave"})]})]})}o(ws,"DiscardDialog");var Ci="Back";function ki(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(c=>`${String(c)}px`,"rem"),d={background:"transparent",borderStyle:"none",padding:0,cursor:"pointer"};return {wrap:{backgroundColor:t.surface,flexShrink:0},bar:{display:"flex",flexDirection:"row",alignItems:"center",paddingLeft:a(r.lg),paddingRight:a(r.lg),minHeight:56,boxSizing:"border-box"},side:{width:64,flexShrink:0,display:"flex",alignItems:"center"},sideRight:{justifyContent:"flex-end"},tap:{...d,minHeight:ee,minWidth:ee,display:"inline-flex",alignItems:"center",justifyContent:"center"},closeTap:{justifyContent:"flex-end"},chevron:{display:"block",width:10,height:10,borderLeftStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:2,borderBottomWidth:2,borderColor:t.brand,transform:"rotate(45deg)"},title:{margin:0,flex:"1 1 auto",minWidth:0,textAlign:"center",...E(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.normal)},close:{...E(e,"medium"),color:t.linkInk,fontSize:a(l.subtitle),lineHeight:String(s.normal)},railTrack:{height:4,backgroundColor:t.brandBorder},railFill:{height:4,backgroundColor:t.success},dialog:{margin:"auto",maxWidth:420,width:"calc(100% - 32px)",boxSizing:"border-box",padding:a(r.lg),borderRadius:a(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,color:t.text.primary},dialogTitle:{margin:0,...E(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},dialogBody:{margin:0,paddingTop:a(r.sm),...E(e,"regular"),color:t.text.metaCool,fontSize:a(l.body),lineHeight:String(s.normal)},dialogActions:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:a(r.sm),paddingTop:a(r.lg)}}}o(ki,"makeStyles");function Ri(e){let t=[],r=Is(e.ageYears);r!==null&&t.push(`${String(r)} yr${r===1?"":"s"} old`);let n=e.weightKg;typeof n=="number"&&Number.isFinite(n)&&n>0&&t.push(`${String(Math.round(n))} kg`);let i=e.breed?.trim();return i&&t.push(i),t.join(" \xB7 ")}o(Ri,"formatTelevetPetMetaLine");function Is(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}o(Is,"wholeYears");function en({media:e,onChange:t,onPickMedia:r,listLabel:n}){let i=w(),l=useMemo(()=>Bs(i),[i]),s=Dt-e.length,[a,d]=useState(false);if(!r)return null;let c=o(async()=>{if(!(a||s<=0)){d(true);try{let u=await bt(r,s);if(!u.ok||u.value===null||u.value.length===0)return;let p=new Set(e.map(y=>y.uri)),m=u.value.filter(y=>typeof y?.uri=="string"&&y.uri.length>0&&!p.has(y.uri));if(m.length===0)return;t([...e,...m].slice(0,Dt));}finally{d(false);}}},"pick");return jsxs("ul",{role:"list","aria-label":n,style:l.row,children:[e.map((u,p)=>jsxs("li",{style:l.thumb,children:[jsx("img",{src:u.uri,alt:u.filename,style:l.thumbImage}),u.mimeType.startsWith("video/")?jsx("span",{"aria-hidden":"true",style:l.videoBadge,"data-testid":`televet-intake-media-video-${String(p)}`,children:Ds}):null,jsx("button",{type:"button",onClick:()=>t(e.filter((m,y)=>y!==p)),"aria-label":`${f.removePhotoLabel}: ${u.filename}`,"data-testid":`televet-intake-media-remove-${String(p)}`,style:l.remove,children:jsx("span",{"aria-hidden":"true",style:l.removeGlyph,children:Fs})})]},`${u.uri}-${String(p)}`)),s>0?jsx("li",{style:l.addItem,children:jsx("button",{type:"button",onClick:()=>{c();},disabled:a,"aria-busy":a||void 0,"data-testid":"televet-intake-add-media",style:{...l.dropzone,...a?l.dropzoneBusy:null},children:jsx("span",{style:l.dropzoneText,children:f.addPhotoCta})})}):null]})}o(en,"TelevetIntakeMedia");var Fs="\xD7",Ds="\u25B6",qt=92;function Bs(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {row:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"row",flexWrap:"wrap",gap:a(r.md),paddingTop:a(r.sm)},thumb:{position:"relative",width:qt,height:qt,borderRadius:a(n.md),backgroundColor:t.surfaceSubtle},thumbImage:{width:"100%",height:"100%",objectFit:"cover",borderRadius:a(n.md),display:"block"},videoBadge:{position:"absolute",left:6,bottom:6,paddingLeft:6,paddingRight:6,paddingTop:2,paddingBottom:2,borderRadius:a(n.sm),backgroundColor:t.shadow,color:t.text.onBrand,fontSize:a(l.nano),lineHeight:"1"},addItem:{display:"flex"},remove:{position:"absolute",top:-8,right:-8,width:ee-16,height:ee-16,borderRadius:"50%",borderStyle:"none",backgroundColor:t.text.metaCool,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},removeGlyph:{...E(e,"medium"),color:t.surface,fontSize:a(l.subtitle),lineHeight:"1"},dropzone:{width:qt,height:qt,borderRadius:a(n.md),borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:a(r.sm),paddingRight:a(r.sm),cursor:"pointer",boxSizing:"border-box"},dropzoneBusy:{opacity:.6,cursor:"progress"},dropzoneText:{...E(e,"mono"),color:t.text.metaCool,fontSize:a(l.nano),lineHeight:String(s.normal),letterSpacing:"0.3px",textAlign:"center"}}}o(Bs,"makeStyles");function Be({label:e,value:t,last:r=false,testID:n}){let i=w(),l=useMemo(()=>nn(i),[i]);return jsxs("div",{style:{...l.row,...r?l.rowLast:null},"data-testid":n,children:[jsx("dt",{style:l.rowLabel,children:e}),jsx("dd",{style:l.rowValue,children:t})]})}o(Be,"TelevetSummaryRow");function st({label:e,checked:t,onToggle:r,testID:n}){let i=w(),l=useMemo(()=>nn(i),[i]);return jsxs("label",{style:l.consent,children:[jsx("input",{type:"checkbox",checked:t,onChange:s=>r(s.currentTarget.checked),"data-testid":n,style:at}),jsx("span",{"aria-hidden":"true",style:{...l.box,...t?l.boxChecked:null},children:t?jsx("span",{style:l.tick,children:Ls}):null}),jsx("span",{style:l.consentLabel,children:e})]})}o(st,"TelevetConsentCheckbox");var Ls="\u2713";function rn({children:e,testID:t}){let r=w(),n=useMemo(()=>nn(r),[r]);return jsx("dl",{style:n.card,"data-testid":t,children:e})}o(rn,"TelevetSummaryCard");function nn(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {card:{margin:0,borderRadius:a(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,paddingLeft:a(r.lg),paddingRight:a(r.lg),boxSizing:"border-box"},row:{display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:a(r.lg),paddingTop:a(r.lg),paddingBottom:a(r.lg),borderBottomStyle:"solid",borderBottomWidth:1,borderBottomColor:t.brandBorder},rowLast:{borderBottomWidth:0},rowLabel:{margin:0,flexShrink:0,...E(e,"regular"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},rowValue:{margin:0,marginInlineStart:0,minWidth:0,textAlign:"right",overflowWrap:"anywhere",...E(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},consent:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:a(r.md),minHeight:ee,padding:a(r.lg),borderRadius:a(n.md),backgroundColor:t.surfaceSubtle,cursor:"pointer",boxSizing:"border-box"},box:{width:22,height:22,flexShrink:0,borderRadius:a(n.xs),borderStyle:"solid",borderWidth:1.5,borderColor:t.brand,backgroundColor:t.surface,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},boxChecked:{backgroundColor:t.primary,borderColor:t.primary},tick:{...E(e,"bold"),color:t.onPrimary,fontSize:a(l.caption),lineHeight:"1"},consentLabel:{flex:"1 1 auto",minWidth:0,overflowWrap:"anywhere",...E(e,"regular"),color:t.text.metaCool,fontSize:a(l.body),lineHeight:String(s.normal)}}}o(nn,"makeStyles");function on({slots:e,selectedDayKey:t,onSelectDay:r,groupLabel:n}){let i=w(),l=useMemo(()=>zs(i),[i]),s=useMemo(()=>$t(e),[e]),a=useRef(new Map),d=s[0],c=t??d?.key??null,u=useCallback(p=>{let m=p.key==="ArrowRight"||p.key==="ArrowDown"?1:p.key==="ArrowLeft"||p.key==="ArrowUp"?-1:0,y=p.key==="Home"?0:p.key==="End"?s.length-1:null;if(m===0&&y===null)return;let b=s.findIndex(I=>I.key===c);if(b<0)return;let S=y??Math.min(s.length-1,Math.max(0,b+m)),h=s[S];h===void 0||h.key===c||(p.preventDefault(),r(h),a.current.get(h.key)?.focus());},[s,c,r]);return d===void 0?null:jsxs("div",{children:[jsx("p",{"aria-hidden":"true",style:l.month,"data-testid":"televet-day-strip-month",children:ii(d.iso)}),jsx("div",{role:"radiogroup","aria-label":n,onKeyDown:u,style:l.strip,"data-testid":"televet-day-strip",children:s.map(p=>{let m=p.key===c;return jsxs("button",{ref:y=>{y?a.current.set(p.key,y):a.current.delete(p.key);},type:"button",role:"radio","aria-checked":m,tabIndex:m?0:-1,onClick:()=>r(p),"aria-label":ai(p.iso),"data-testid":`televet-day-${p.key}`,style:{...l.day,...m?l.daySelected:null},children:[jsx("span",{"aria-hidden":"true",style:{...l.dayWeekday,...m?l.dayTextSelected:null},children:p.weekday}),jsx("span",{"aria-hidden":"true",style:{...l.dayNumber,...m?l.dayTextSelected:null},children:p.dayNumber})]},p.key)})})]})}o(on,"TelevetDayStrip");function $t(e){let t=new Map;for(let r of e){let n=zt(r.startsAt);if(t.has(n))continue;let i=new Date(r.startsAt);Number.isNaN(i.getTime())||t.set(n,Object.freeze({key:n,iso:r.startsAt,weekday:i.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(i.getDate())}));}return Object.freeze([...t.values()])}o($t,"televetDaysFromSlots");function zs(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {month:{margin:0,textAlign:"center",...E(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug),paddingBottom:a(r.md)},strip:{display:"flex",flexDirection:"row",gap:a(r.sm),paddingLeft:a(r.xs),paddingRight:a(r.xs),overflowX:"auto",overscrollBehaviorX:"contain",scrollSnapType:"x proximity"},day:{width:52,flexShrink:0,scrollSnapAlign:"center",minHeight:ee,paddingTop:a(r.md),paddingBottom:a(r.md),borderRadius:a(n.md),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",boxSizing:"border-box"},daySelected:{backgroundColor:t.primary,borderColor:t.primary},dayWeekday:{...E(e,"mono"),color:t.text.secondary,fontSize:a(l.tiny),lineHeight:String(s.tight)},dayNumber:{...E(e,"medium"),color:t.brand,fontSize:a(l.heading),lineHeight:String(s.tight)},dayTextSelected:{color:t.onPrimary}}}o(zs,"makeStyles");function dt({slots:e,busySlotId:t,onPick:r,header:n,dayGroupLabel:i,timeGroupLabel:l,rowTestIdPrefix:s="televet-slot",testID:a="televet-slot-list"}){let d=w(),c=useMemo(()=>js(d),[d]),u=useMemo(()=>$t(e),[e]),p=`${useId()}-zone`,[m,y]=useState(null),b=m??u[0]?.key??null,S=useMemo(()=>b?e.filter(R=>zt(R.startsAt)===b):[],[e,b]),h=S[0],I=t!==null,P=h?Vt(h.startsAt):null;return jsxs("div",{style:c.root,"data-testid":a,children:[n,jsx(on,{slots:e,selectedDayKey:b,onSelectDay:R=>y(R.key),groupLabel:i}),P?jsx("p",{id:p,style:c.zone,"data-testid":"televet-slot-zone",children:P}):null,jsx("div",{style:c.gridScroll,children:jsx("ul",{role:"list","aria-label":l,...P?{"aria-describedby":p}:{},"aria-busy":I||void 0,style:c.grid,children:S.map(R=>{let D=t===R.slotId;return jsx("li",{style:c.gridItem,children:jsx("button",{type:"button",onClick:()=>r(R),disabled:I,"aria-busy":D||void 0,"aria-label":re(R.startsAt),"data-testid":`${s}-${R.slotId}`,style:{...c.chip,...D?c.chipBusy:null,...I&&!D?c.chipDisabled:null},children:jsx("span",{"aria-hidden":"true",style:{...c.chipLabel,...D?c.chipLabelBusy:null},children:tt(R.startsAt)})})},R.slotId)})})})]})}o(dt,"TelevetSlotPicker");function js(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {root:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0},gridScroll:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},zone:{margin:0,textAlign:"center",...E(e,"mono"),color:t.text.secondary,fontSize:a(l.tiny),lineHeight:String(s.normal),letterSpacing:"0.4px",paddingTop:a(r.md),paddingBottom:a(r.md)},grid:{listStyle:"none",margin:0,padding:0,paddingBottom:a(r.xl),display:"flex",flexDirection:"row",flexWrap:"wrap",gap:a(r.md)},gridItem:{display:"flex",flexGrow:1,flexBasis:"28%",minWidth:96},chip:{width:"100%",minHeight:48,borderRadius:a(n.pill),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:a(r.md),paddingRight:a(r.md),cursor:"pointer",boxSizing:"border-box"},chipBusy:{backgroundColor:t.primary,borderColor:t.primary},chipDisabled:{opacity:.45,cursor:"not-allowed"},chipLabel:{...E(e,"regular"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.tight)},chipLabelBusy:{color:t.onPrimary}}}o(js,"makeStyles");function he(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {marker:{minHeight:1},stepScroll:{paddingBottom:a(r.md)},visuallyHiddenHeading:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},petRow:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",gap:a(r.sm),minHeight:64,paddingLeft:a(r.md),paddingRight:a(r.md),paddingTop:a(r.sm),paddingBottom:a(r.sm),borderRadius:a(n.pill),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",textAlign:"left",cursor:"pointer",boxSizing:"border-box"},petRowSelected:{borderColor:t.primary},petDisc:{width:28,height:28,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,display:"inline-flex",alignItems:"center",justifyContent:"center",...E(e,"medium"),color:t.brand,fontSize:a(l.caption),lineHeight:"1"},petRowText:{display:"flex",flexDirection:"column",minWidth:0,gap:2},petRowName:{...E(e,"medium"),color:t.brand,fontSize:a(l.body),lineHeight:String(s.snug),overflowWrap:"anywhere"},petRowMeta:{...E(e,"regular"),color:t.text.metaCool,fontSize:a(l.caption),lineHeight:String(s.normal),overflowWrap:"anywhere"},vetRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:a(r.md)},vetAvatar:{width:64,height:64,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,display:"inline-flex",alignItems:"center",justifyContent:"center",...E(e,"medium"),color:t.brand,fontSize:a(l.heading),lineHeight:"1"},vetIdentity:{display:"flex",flexDirection:"column",flex:"1 1 auto",minWidth:0,gap:2},vetName:{margin:0,...E(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},vetCredentials:{margin:0,...E(e,"regular"),color:t.text.metaCool,fontSize:a(l.caption),lineHeight:String(s.normal)},vetRating:{margin:0,...E(e,"regular"),color:t.text.secondary,fontSize:a(l.caption),lineHeight:String(s.normal)},vetBio:{margin:0,...E(e,"regular"),color:t.brand,fontSize:a(l.body),lineHeight:String(s.normal)},reasonInput:{width:"100%",minHeight:120,resize:"vertical",borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,borderRadius:a(n.md),padding:a(r.md),backgroundColor:t.surface,...E(e,"regular"),color:t.text.primary,fontSize:a(l.body),lineHeight:String(s.normal),boxSizing:"border-box"},emergencyBanner:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:a(r.md),padding:a(r.lg),borderRadius:a(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.errorRed,backgroundColor:t.badgeBgCritical,boxSizing:"border-box"},emergencyTitle:{margin:0,...E(e,"bold"),color:t.errorRed,fontSize:a(l.subtitle),lineHeight:String(s.snug)},emergencyLede:{margin:0,...E(e,"regular"),color:t.text.primary,fontSize:a(l.body),lineHeight:String(s.normal)}}}o(he,"makeLocalStyles");function Yt(e,t){return t?e.find(n=>n.petRef===t||n.petId===t)?.name??null:null}o(Yt,"nameOf");function ct({headingRef:e,style:t,id:r,children:n}){let i=fe(Oe());return jsx(i,{ref:e,tabIndex:-1,style:t,...r===void 0?{}:{id:r},children:n})}o(ct,"StepHeading");function qs({style:e,children:t}){let r=fe(it(Oe()));return jsx(r,{style:e,children:t})}o(qs,"SubHeading");function Oi({headingRef:e,pets:t,isPending:r,isError:n,onRetry:i,selectedId:l,onSelect:s,onAddPet:a}){let d=M(),c=w(),u=useMemo(()=>he(c),[c]);return r?jsx("div",{role:"progressbar","aria-label":f.loading.pets,"aria-busy":"true",style:d.list,"data-testid":"televet-pets-loading",children:[0,1].map(p=>jsx(Ae,{height:64},p))}):n?jsx("div",{"data-testid":"televet-pets-error",children:jsx(V,{title:f.chrome.loadFailedTitle,actionLabel:f.chrome.retryCta,onAction:i})}):t.length===0?jsx("div",{"data-testid":"televet-pets-empty",children:jsx(V,{title:f.chrome.noPetsTitle,actionLabel:f.addPetCta,onAction:a})}):jsxs("div",{style:d.stepFill,children:[jsx(ct,{headingRef:e,style:d.stepTitle,children:f.petSelectTitle}),jsx("div",{style:{...d.scrollBody,...u.stepScroll},children:jsxs("ul",{role:"list",style:d.list,"data-testid":"televet-pets",children:[t.map(p=>{let m=l===p.petRef;return jsx(Ii,{name:p.name??"",meta:Ri(p),selected:m,onPress:()=>s(p.petRef),testID:`televet-pet-${p.petRef}`},p.petRef)}),a?jsx(Ii,{name:f.addPetCta,meta:"",selected:false,onPress:a,testID:"televet-pet-add",glyph:$s}):null]})})]})}o(Oi,"PetStep");function Ii({name:e,meta:t,selected:r,onPress:n,testID:i,glyph:l}){let s=w(),a=useMemo(()=>he(s),[s]);return jsx("li",{children:jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"data-testid":i,style:{...a.petRow,...r?a.petRowSelected:null},children:[jsx("span",{"aria-hidden":"true",style:a.petDisc,children:l??Ai(e)}),jsxs("span",{style:a.petRowText,children:[jsx("span",{style:a.petRowName,children:e}),t?jsx("span",{style:a.petRowMeta,children:t}):null]})]})})}o(Ii,"PetRow");function Ai(e){let t=e.trim();return t.length===0?Ks:t.slice(0,1).toUpperCase()}o(Ai,"initialOf");function Fi({headingRef:e,clinicians:t,isPending:r,isError:n,selectedId:i,onSelect:l,onRetry:s}){let a=M(),d=w(),c=useMemo(()=>he(d),[d]);if(r)return jsx("div",{role:"progressbar","aria-label":f.loading.clinicians,"aria-busy":"true",style:a.list,"data-testid":"televet-clinicians-loading",children:jsx(Ae,{height:96})});if(n)return jsx("div",{"data-testid":"televet-clinicians-error",children:jsx(V,{title:f.chrome.loadFailedTitle,actionLabel:f.chrome.retryCta,onAction:s})});if(t.length===0)return jsx("div",{"data-testid":"televet-clinicians-empty",children:jsx(V,{title:f.noCliniciansTitle,message:f.noCliniciansBody,actionLabel:f.noCliniciansRetryCta,onAction:s})});let u=t.find(p=>p.clinicianId===i)??t[0];return u===void 0?null:jsxs("div",{style:a.list,"data-testid":"televet-clinicians",children:[jsx(ct,{headingRef:e,style:a.stepTitle,children:f.yourVetTitle}),jsxs("div",{style:c.vetRow,children:[jsx("span",{"aria-hidden":"true",style:c.vetAvatar,children:Ai(u.displayName)}),jsxs("div",{style:c.vetIdentity,children:[jsx("p",{style:c.vetName,children:u.displayName}),u.credentials?jsx("p",{style:c.vetCredentials,children:u.credentials}):null,u.rating!==null&&u.ratingCount!==null?jsx("p",{style:c.vetRating,"data-testid":"televet-vet-rating",children:`\u2605 ${String(u.rating)} \xB7 ${String(u.ratingCount)} ${f.reviewsLabel}`}):null]})]}),u.bio?jsx("p",{style:c.vetBio,"data-testid":"televet-vet-bio",children:u.bio}):null,jsx("div",{style:a.divider}),jsx(W,{label:f.continueCta,kind:"primary",onPress:()=>l(u.clinicianId),testID:`televet-clinician-${u.clinicianId}`})]})}o(Fi,"ClinicianStep");function Di({headingRef:e,slots:t,enabled:r,isPending:n,isError:i,busySlotId:l,failure:s,nextOpening:a,onPick:d,onRetry:c,onSeeOtherVets:u}){let p=M();return r?n?jsx("div",{role:"progressbar","aria-label":f.loading.slots,"aria-busy":"true",style:p.list,"data-testid":"televet-slots-loading",children:[0,1,2].map(m=>jsx(Ae,{height:48},m))}):i?jsx(V,{title:f.slotsErrorTitle,actionLabel:f.retryCta,onAction:c,testID:"televet-slots-error"}):t.length===0?jsx("div",{"data-testid":"televet-slots-empty",children:jsx(V,{title:f.noSlotsTitle,message:a?te(f.nextOpeningTemplate,{when:re(a.startsAt)}):void 0,actionLabel:a?f.seeOtherVetsCta:void 0,onAction:a?u:void 0})}):jsxs("div",{style:p.stepFill,"data-testid":"televet-slots",children:[jsx(ct,{headingRef:e,style:p.stepHelp,children:f.summaryWhen}),s==="expired"?jsx(J,{message:f.holdExpired}):null,s==="taken"?jsx(J,{message:f.slotTaken}):null,jsx(dt,{slots:t,busySlotId:l,onPick:d,dayGroupLabel:f.summaryWhen,timeGroupLabel:f.navTitle})]}):jsx("div",{"data-testid":"televet-slots-unavailable",children:jsx(V,{title:f.bookingPausedTitle})})}o(Di,"SlotStep");function Bi({headingRef:e,value:t,onChange:r,onNext:n,media:i,onChangeMedia:l,onPickMedia:s}){let a=M(),d=w(),c=useMemo(()=>he(d),[d]),u=useId(),p=`${u}-reason-heading`,m=`${u}-reason-help`,y=t.trim(),b=y.length>me,S=y.length>0&&!b;return jsxs("div",{style:a.scrollRoot,"data-testid":"televet-booking-reason",children:[jsx("div",{style:a.scrollBody,"data-testid":"televet-booking-reason-scroll",children:jsxs("div",{style:a.list,children:[jsx(ct,{headingRef:e,id:p,style:a.stepTitle,children:f.describeHeading}),jsx("p",{id:m,style:a.stepHelp,children:f.describeHelpLong}),jsx("textarea",{value:t,onChange:h=>r(h.currentTarget.value),"aria-labelledby":p,"aria-describedby":m,"aria-invalid":b||void 0,placeholder:f.reasonPlaceholder,style:c.reasonInput,"data-testid":"televet-reason-input"}),b?jsx(J,{message:f.reasonTooLong}):null,jsx(en,{media:i,onChange:l,listLabel:f.addPhotoCta,...s?{onPickMedia:s}:{}})]})}),jsx("div",{style:a.scrollFooter,children:jsx(W,{label:f.continueCta,kind:"primary",disabled:!S,onPress:n,testID:"televet-reason-next"})})]})}o(Bi,"ReasonStep");function Li({headingRef:e,when:t,clinician:r,petName:n,reason:i,shareRecords:l,onToggleShare:s,stateCode:a,stateAttested:d,onToggleStateAttest:c,cancellationTerms:u,termsAttested:p,onToggleTermsAttest:m,canConfirm:y,busy:b,failure:S,rateLimitMessage:h,onConfirm:I,emergency:P,onAcknowledgeEmergency:R,onSeeOtherVets:D}){let B=M(),k=w(),A=useMemo(()=>he(k),[k]);return jsxs("div",{style:B.scrollRoot,"data-testid":"televet-booking-review",children:[jsx("div",{style:B.scrollBody,"data-testid":"televet-booking-review-scroll",children:jsxs("div",{style:B.list,children:[jsx(ct,{headingRef:e,style:A.visuallyHiddenHeading,children:f.confirmCta}),jsxs(rn,{testID:"televet-review-summary",children:[n?jsx(Be,{label:f.summaryPet,value:n,testID:"televet-review-row-pet"}):null,r?jsx(Be,{label:f.summaryVet,value:r,testID:"televet-review-row-vet"}):null,jsx(Be,{label:f.summaryWhen,value:t,testID:"televet-review-row-when"}),jsx(Be,{label:f.summaryLength,value:te(f.summaryLengthTemplate,{n:String(Me)}),testID:"televet-review-row-length"}),i?jsx(Be,{label:f.summaryReason,value:i,last:true,testID:"televet-review-row-reason"}):null]}),jsx(st,{label:f.shareRecordsOff,checked:l,onToggle:s,testID:"televet-review-share-records"}),u?jsx(st,{label:u,checked:p,onToggle:m,testID:"televet-review-terms-attest"}):null,a?jsx(st,{label:te(f.stateAttestTemplate,{state:a}),checked:d,onToggle:c,testID:"televet-review-state-attest"}):null,P?jsxs("div",{role:"alert",style:A.emergencyBanner,"data-testid":"televet-review-emergency",children:[jsx(qs,{style:A.emergencyTitle,children:f.emergency.bannerTitle}),jsx("p",{style:A.emergencyLede,children:f.emergency.lede}),P.length>0?jsx("p",{style:A.emergencyLede,"data-testid":"televet-review-emergency-categories",children:P.join(", ")}):null,jsx(W,{label:f.emergency.keepBookingCta,kind:"secondary",loading:b,disabled:b,onPress:R,testID:"televet-review-emergency-ack"})]}):null,S==="failed"?jsx(J,{message:f.confirmFailed}):null,S==="clinician_unavailable"?jsxs("div",{style:B.list,"data-testid":"televet-review-clinician-unavailable",children:[jsx(J,{message:f.confirmFailed}),jsx(W,{label:f.seeOtherVetsCta,kind:"secondary",onPress:D,testID:"televet-review-see-other-vets"})]}):null,S==="rate_limited"&&h?jsx(J,{message:h,testID:"televet-review-rate-limited"}):null,S==="rate_limited"&&!h?jsx(J,{message:f.confirmFailed}):null,S==="not_entitled"?jsx(J,{message:f.confirmNotEntitled,testID:"televet-review-not-entitled"}):null]})}),P?null:jsx("div",{style:B.scrollFooter,children:jsx(W,{label:f.confirmCta,kind:"primary",loading:b,disabled:!y||b||!!a&&!d||!!u&&!p,onPress:I,testID:"televet-review-confirm"})})]})}o(Li,"ReviewStep");var Ks="\u25CB",$s="+";function ln(e){let{petRef:t,usState:r,controller:n,onBooked:i,onExit:l,onAddPet:s,onPickMedia:a,onAddToCalendar:d,onConfirmDiscard:c,onRequestLocation:u,locationStatus:p="unknown",canJoinInApp:m=false,renderUnavailable:y,headingLevel:b,style:S,testID:h}=He(e,["onBooked","onExit","onAddPet","onRequestLocation"]),I=mi(b??Ue),P=it(I),R=M(),D=w(),B=useMemo(()=>he(D),[D]),k=rt(n),A=Ko(),U=A.pets,x=U.length,F=useMemo(()=>({ownedPetCount:x}),[x]),[z,K]=useReducer((j,oe)=>Fr(j,oe,F),void 0,()=>Or({ownedPetCount:0},{petId:t??null,state:r??null})),_=useCallback(j=>K(j),[]),[ne,dn]=useState(""),[Ee,N]=useState(null),[Te,ft]=useState(null),[yt,Ne]=useState(null),[Ce,un]=useState(false),[mt,cn]=useState(false),[ji,Ui]=useState([]),[Xt,Wi]=useState(null),{draft:T}=z,Q=Dr(z),pn=useRef(T.state);pn.current!==T.state&&(pn.current=T.state,Ce&&un(false),mt&&cn(false));let Qt=Mr(T.state,k),Jt=Ur(k),fn=jr(k),ke=Wr(T.state,k),Ve=nt(T.clinicianId,k),qi=qr(k).data??null,gt=ot(k),Zt=$r(k),er=r??null;useEffect(()=>{er&&!T.state&&_({type:"patch",patch:{state:er}});},[er,T.state,_]),useEffect(()=>{t&&!T.petId&&_({type:"patch",patch:{petId:t}});},[t,T.petId,_]);let tr=U.length===1?U[0]?.petRef??null:null;useEffect(()=>{tr&&!T.petId&&_({type:"patch",patch:{petId:tr}});},[tr,T.petId,_]);let yn=useRef(Q);yn.current=Q;let mn=useRef(0);useEffect(()=>{x!==mn.current&&(mn.current=x,_({type:"goTo",step:yn.current}));},[x,_]);let rr=ke.data?.[0]?.clinicianId??null;useEffect(()=>{rr&&!T.clinicianId&&_({type:"patch",patch:{clinicianId:rr}});},[rr,T.clinicianId,_]);let ze=useRef(null),gn=useRef(false);useEffect(()=>{if(!gn.current){gn.current=true;return}ze.current?.focus();},[Q]);let Ki=useCallback(j=>{N(null),gt.mutate(j.slotId,{onSuccess:o(oe=>{_({type:"patch",patch:{slot:j,holdExpiresAt:oe.expiresAt,idempotencyKey:Lr(j.slotId)}}),_({type:"next"});},"onSuccess"),onError:o(oe=>N(xe(oe).kind==="unavailable"?"unavailable":"taken"),"onError")});},[gt,_]),nr=useCallback(j=>{if(!(!Nt(T,ne)||!T.idempotencyKey)){if(Br(T,Date.now())){N("expired"),_({type:"goTo",step:"time"});return}N(null),Ne(null),Zt.mutate({pet_id:T.petId,clinician_id:T.clinicianId,slot_id:T.slot.slotId,state:T.state,reason_text:ne.trim(),species:null,media_refs:[],emergency_acknowledged:j,share_health_records:T.shareHealthRecords,...Nr(Ce,mt,Jt.data)},T.idempotencyKey,{onSuccess:o(oe=>{Wi(oe),_({type:"goTo",step:"booked"}),i?.(oe);},"onSuccess"),onError:o(oe=>{let ue=xe(oe);if(ue.kind==="emergency"){Ne(ue.categories);return}if(ue.kind==="rate_limited"){ft(ue.message),N("rate_limited");return}N(ue.kind==="not_entitled"?"not_entitled":ue.kind==="slot_taken"?"taken":ue.kind==="clinician_unavailable"?"clinician_unavailable":ue.kind==="unavailable"?"unavailable":"failed"),ue.kind==="slot_taken"&&_({type:"goTo",step:"time"});},"onError")});}},[T,ne,Zt,_,i,Ce,mt,Jt.data]),$i=useCallback(()=>nr(false),[nr]),Yi=Qt.enabled&&Qt.data!==null&&!Qt.data.wellnessAvailable,Gi=fn.enabled&&fn.data?.active===false,Xi=ne.trim().length>0||!!T.slot||!!T.clinicianId,Qi=k===null||Ee==="unavailable";return ce()?jsx(Gr.Provider,{value:P,children:jsxs("div",{style:{...R.screen,...S},"data-testid":h??"televet-booking",children:[jsx(Zr,{step:Q,furthestIndex:z.furthestIndex,canGoBack:Ar(z,F)&&Q!=="booked",isDirty:Xi,onBack:()=>_({type:"back"}),onClose:()=>l?.(),headingLevel:I,...c?{onConfirmDiscard:c}:{}}),Qi?jsx("div",{style:R.stepFill,"data-testid":"televet-booking-unavailable",children:y?y():jsx(V,{title:f.bookingPausedTitle})}):Gi?jsx("div",{"data-testid":"televet-booking-not-entitled",children:jsx(V,{title:f.confirmNotEntitled})}):Yi?jsx("div",{"data-testid":"televet-booking-state-blocked",children:jsx(V,{title:f.stateBlockedTitle})}):Q==="time"?jsx(Di,{headingRef:ze,slots:Ve.data??[],enabled:Ve.enabled,isPending:Ve.enabled&&Ve.isPending,isError:Ve.isError,busySlotId:gt.isPending?gt.variables:null,failure:Ee,nextOpening:qi,onPick:Ki,onRetry:()=>Ve.refetch(),onSeeOtherVets:()=>_({type:"goTo",step:"clinician"})}):Q==="review"?jsx(Li,{headingRef:ze,when:T.slot?re(T.slot.startsAt):"",petName:Yt(U,T.petId),reason:ne.trim(),clinician:ke.data?.find(j=>j.clinicianId===T.clinicianId)?.displayName??null,shareRecords:T.shareHealthRecords,stateCode:T.state,stateAttested:Ce,onToggleStateAttest:un,cancellationTerms:Jt.data?.summary??null,termsAttested:mt,onToggleTermsAttest:cn,onToggleShare:j=>_({type:"patch",patch:{shareHealthRecords:j}}),canConfirm:Nt(T,ne),busy:Zt.isPending,failure:Ee,rateLimitMessage:Te,onConfirm:$i,emergency:yt,onAcknowledgeEmergency:()=>nr(true),onSeeOtherVets:()=>_({type:"goTo",step:"clinician"})}):Q==="booked"?jsx("div",{style:R.stepFill,"data-testid":"televet-booking-booked",children:Xt?jsx(Qr,{consult:Xt,petName:Yt(U,Xt.petId)??Yt(U,T.petId),onDone:()=>l?.(),canJoinInApp:m,...d?{onAddToCalendar:d}:{}}):null}):Q==="clinician"&&!T.state?jsx("div",{"data-testid":"televet-booking-location-unknown",children:jsx(V,{title:p==="blocked"?f.locationBlockedTitle:p==="unavailable"?f.locationUnavailableTitle:f.locationUnknownTitle,message:p==="blocked"?f.locationBlockedBody:p==="unavailable"?f.locationUnavailableBody:f.locationUnknownBody,actionLabel:u?p==="blocked"?f.locationBlockedCta:f.locationUnknownCta:void 0,onAction:u})}):Q==="clinician"?jsx(Fi,{headingRef:ze,clinicians:ke.data??[],isPending:ke.enabled&&ke.isPending,isError:ke.isError,selectedId:T.clinicianId,onRetry:()=>ke.refetch(),onSelect:j=>{_({type:"patch",patch:{clinicianId:j}}),_({type:"next"});}}):Q==="reason"?jsx(Bi,{headingRef:ze,value:ne,onChange:dn,media:ji,onChangeMedia:Ui,...a?{onPickMedia:a}:{},onNext:()=>_({type:"next"})}):Q==="pet"?jsx(Oi,{headingRef:ze,pets:U,isPending:A.loading,isError:A.error!==null,onRetry:()=>{A.refresh();},onAddPet:s,selectedId:T.petId,onSelect:j=>{_({type:"patch",patch:{petId:j}}),_({type:"next"});}}):jsx("div",{style:B.marker,"data-testid":`televet-booking-step-${Q}`})]})}):jsx("div",{style:{...R.screen,...S},"data-testid":h??"televet-booking",children:jsx("div",{style:R.stepFill,"data-testid":"televet-booking-copy-unapproved",children:y?y():jsx(Rt,{...t!==void 0?{petRef:t}:{},...r!==void 0?{usState:r}:{}})})})}o(ln,"EverfurTelevetBooking");function sn(e){let{consult:t,onRescheduled:r,onCancel:n,controller:i,style:l,testID:s}=He(e,["onRescheduled","onCancel"]),a=M(),d=rt(i),c=nt(t?.clinicianId??null,d),u=ot(d),p=Yr(t?.consultId??null,d),[m,y]=useState(null),b=useCallback(h=>{y(null),u.mutate(h.slotId,{onSuccess:o(()=>{p.mutate(h.slotId,{onSuccess:o(I=>r?.(I),"onSuccess"),onError:o(I=>y(xe(I).kind==="unavailable"?"unavailable":"failed"),"onError")});},"onSuccess"),onError:o(I=>y(xe(I).kind==="unavailable"?"unavailable":"taken"),"onError")});},[u,p,r]),S=u.isPending||p.isPending;return ce()?t?jsxs("section",{style:{...a.stepFill,...l},"aria-label":f.rescheduleNavTitle,"data-testid":s??"televet-reschedule",children:[jsx("p",{style:a.stepHelp,children:te(f.rescheduleFromTemplate,{when:re(t.scheduledAt)})}),m==="taken"?jsx(J,{message:f.slotTaken}):null,m==="failed"?jsx(J,{message:f.rescheduleFailed}):null,m==="unavailable"?jsx(J,{message:f.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,c.enabled?c.isPending?jsx("div",{role:"progressbar","aria-label":f.loading.slots,"aria-busy":"true",style:a.list,"data-testid":"televet-reschedule-slots-loading",children:[0,1,2].map(h=>jsx(Ae,{height:48},h))}):c.isError?jsx(V,{title:f.slotsErrorTitle,actionLabel:f.retryCta,onAction:()=>c.refetch(),testID:"televet-reschedule-slots-error"}):(c.data??[]).length===0?jsx("div",{"data-testid":"televet-reschedule-empty",children:jsx(V,{title:f.noSlotsTitle})}):jsx(dt,{slots:c.data??[],busySlotId:S?u.variables:null,onPick:b,dayGroupLabel:f.summaryWhen,timeGroupLabel:f.rescheduleNavTitle,rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):jsx("div",{"data-testid":"televet-reschedule-paused",children:jsx(V,{title:f.bookingPausedTitle})}),jsx(W,{label:f.keepExistingCta,kind:"secondary",disabled:S,onPress:()=>n?.(),testID:"televet-reschedule-keep"})]}):jsx("div",{role:"progressbar","aria-label":f.loading.consult,"aria-busy":"true",style:{...a.list,...l},"data-testid":"televet-reschedule-loading",children:[0,1].map(h=>jsx(Ae,{height:48},h))}):jsx("div",{style:{...a.stepFill,...l},"data-testid":"televet-reschedule-copy-unapproved"})}o(sn,"EverfurTelevetReschedule");var Hi=Object.freeze({name:"booking"});function td(e,t){switch(t.type){case "push":return Object.freeze({stack:Object.freeze([...e.stack,t.screen])});case "pop":return e.stack.length<=1?e:Object.freeze({stack:Object.freeze(e.stack.slice(0,-1))});default:return e}}o(td,"navReducer");function Mi(e){let{style:t,renderPending:r,className:n,...i}=He(e,["onExit","onBooked","onAddPet","onRequestLocation"]);return jsx(Yn,{capability:"televet",style:t,...n!==void 0?{className:n}:{},...r?{renderPending:r}:{},children:jsx(rd,{...i,...t!==void 0?{style:t}:{}})})}o(Mi,"EverfurTelevetFlow");function rd({petRef:e,usState:t,controller:r,onBooked:n,onExit:i,onAddPet:l,onPickMedia:s,onAddToCalendar:a,onConfirmDiscard:d,onRequestLocation:c,locationStatus:u,historyMode:p="memory",canJoinInApp:m=false,renderUnavailable:y,initialScreen:b,headingLevel:S,style:h}){let I=M(),[P,R]=useReducer(td,b??Hi,F=>Object.freeze({stack:Object.freeze([F])})),D=P.stack[P.stack.length-1]??Hi,B=P.stack.length,k=useRef(0),A=useRef(B);A.current=B,useEffect(()=>{if(p!=="browser"||typeof window>"u")return;let F=o(z=>{let K=z.state?.efTelevet;typeof K=="number"&&K<A.current&&(k.current=Math.max(0,k.current-1),R({type:"pop"}));},"onPopState");return window.addEventListener("popstate",F),()=>window.removeEventListener("popstate",F)},[p]);let U=useCallback(()=>{if(p==="browser"&&typeof window<"u"&&k.current>0){k.current-=1,window.history.go(-1);return}R({type:"pop"});},[p]),x=useCallback(()=>y?y():jsxs("div",{style:I.list,"data-testid":"televet-hosted-fallback",children:[ce()?jsx(V,{title:f.bookingPausedTitle}):null,jsx(Rt,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{}})]}),[y,I.list,e,t]);switch(D.name){case "booking":return jsx(ln,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{},...r?{controller:r}:{},...n?{onBooked:n}:{},...i?{onExit:i}:{},...l?{onAddPet:l}:{},...s?{onPickMedia:s}:{},...a?{onAddToCalendar:a}:{},...d?{onConfirmDiscard:d}:{},...c?{onRequestLocation:c}:{},...u?{locationStatus:u}:{},canJoinInApp:m,renderUnavailable:x,...S!==void 0?{headingLevel:S}:{},...h?{style:h}:{}});case "reschedule":return jsx(sn,{consult:D.consult,...r?{controller:r}:{},onRescheduled:()=>U(),onCancel:()=>U(),...h?{style:h}:{}});default:return vt(D)}}o(rd,"TelevetFlowBody");var nd=Mi;export{Ci as BACK_LABEL,Ft as CANCELLATION_POLICY_VERSION_MAX,Xo as CONSULT_KINDS,Me as CONSULT_MINUTES,Go as CONSULT_STATUSES,nd as EverfurTelevet,ln as EverfurTelevetBooking,Mi as EverfurTelevetFlow,sn as EverfurTelevetReschedule,Dt as MEDIA_REFS_MAX,me as REASON_TEXT_MAX,be as TELEVET_BOOKING_BASE,f as TELEVET_BOOKING_COPY,Ie as TELEVET_BOOKING_STEPS,ns as TERMINAL_CONSULT_STATUSES,Qr as TelevetBookedScreen,Zr as TelevetBookingChrome,st as TelevetConsentCheckbox,on as TelevetDayStrip,en as TelevetIntakeMedia,dt as TelevetSlotPicker,rn as TelevetSummaryCard,Be as TelevetSummaryRow,Nr as attestation,Nt as canConfirm,zr as createTelevetBookingController,Dr as currentStep,ri as emptyTelevetDraft,is as formatVisitRange,oi as formatWhen,re as formatWhenWithDay,Ar as hasPreviousStep,Or as initialTelevetBookingState,Br as isHoldExpired,Bt as isSkipped,ce as isTelevetBookingCopyReady,de as isWellFormedStateCode,Lr as televetBookingKey,Fr as televetBookingReducer,xe as televetBookingRefusal,gi as televetConsultCalendarKey,$t as televetDaysFromSlots,ui as televetHoldCall,ci as televetRescheduleCall,$r as useTelevetBookConsult,ys as useTelevetBookingAvailable,rt as useTelevetBookingController,jr as useTelevetBookingEntitlement,Ur as useTelevetCancellationPolicy,Wr as useTelevetClinicians,ot as useTelevetHoldSlot,qr as useTelevetNextSlot,Yr as useTelevetRescheduleConsult,nt as useTelevetSlots,Mr as useTelevetStatePolicy,pi as validateBookingBody};
1
+ import {createContext,useMemo,useState,useRef,useEffect,useCallback,useId,useReducer,useContext,useSyncExternalStore,Component,createElement}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var Ua=Object.defineProperty;var o=(e,t)=>Ua(e,"name",{value:t,configurable:true});function qt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(qt,"assertNever");function zo(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}o(zo,"errorFrame");function Dr(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(Dr,"reportHostFailure");function Ka(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(Ka,"isThenable");function Yt(e,...t){if(typeof e=="function")try{let r=e(...t);return Ka(r)&&Promise.resolve(r).then(void 0,Dr),r}catch(r){Dr(r);return}}o(Yt,"callHost");var jo=new WeakMap;function qa(e){if(typeof e!="function")return;let t=jo.get(e);if(t!==void 0)return t;let r=o((...n)=>{Yt(e,...n);},"guarded");return jo.set(e,r),r}o(qa,"guardHost");function nt(e,t){let r=null;for(let n of t){let l=e[n];typeof l=="function"&&(r??={...e},r[n]=qa(l));}return r??e}o(nt,"guardHostProps");function Gt(e,...t){let r;try{r=e(...t);}catch(n){return Dr(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}o(Gt,"callHostAsync");var g=o(e=>e,"DRAFT"),Ya=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function Ga(e){return Ya.some(t=>e.toUpperCase().includes(t.toUpperCase()))}o(Ga,"isPlaceholderCopy");function G(e,t){let r=e;for(let[n,l]of Object.entries(t))r=r.split(`{${n}}`).join(l);return r}o(G,"fill");var oe=Object.freeze({stateBlockedTitle:g("Not available in this state yet"),noCliniciansTitle:g("No vets available right now"),noCliniciansBody:g("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:g("Check again"),noCliniciansRegionBody:g("Video visits have to be with a vet licensed in your state, and we don\u2019t have one there yet."),yourVetTitle:g("Your Vet"),reviewsLabel:g("reviews"),rescheduleFromTemplate:g("Moving your visit on {when}"),rescheduleFailed:g("That did not move. Your original time is unchanged."),keepExistingCta:g("Keep my current time"),bookingPausedTitle:g("Booking is not available right now."),slotsErrorTitle:g("Could not load times"),noSlotsTitle:g("No times available"),nextOpeningTemplate:g("Next opening across our vets: {when}"),seeOtherVetsCta:g("See other vets"),retryCta:g("Try again"),holdExpired:g("That time is no longer held. Pick another."),slotTaken:g("That time was just taken. Pick another."),reasonPlaceholder:g("What is going on with your pet?"),reasonTooLong:g("That is too long. Please shorten it."),shareRecordsOff:g("Share health records with this vet"),confirmNotEntitled:g("A Pro membership is needed to book a video visit."),confirmFailed:g("That did not book. Try again."),checkAvailabilityCta:g("Check availability"),stateInterest:Object.freeze({cta:g("Add me to the list"),submitting:g("Adding you to the list\u2026"),joinedTitle:g("You are on the list"),joinedBody:g("We will let you know when this changes."),failed:g("That did not save. Try again.")}),media:Object.freeze({droppedTemplate:g("{n} attachment did not upload."),droppedPluralTemplate:g("{n} attachments did not upload."),refusedSizeTemplate:g("{n} attachment was too large to send."),refusedSizePluralTemplate:g("{n} attachments were too large to send."),refusedTypeTemplate:g("{n} attachment is a file type that cannot be sent."),refusedTypePluralTemplate:g("{n} attachments are file types that cannot be sent."),refusedUnreadableTemplate:g("{n} attachment could not be read."),refusedUnreadablePluralTemplate:g("{n} attachments could not be read.")}),navTitle:g("Book a visit"),rescheduleNavTitle:g("Change your visit"),close:g("Close"),continueCta:g("Continue"),petSelectTitle:g("Who is this visit for?"),addPetCta:g("Add a pet"),locationUnknownTitle:g("We need your location to find a vet"),locationUnknownBody:g("Turn on location for Everfur, then try again."),locationUnknownCta:g("Allow location"),locationBlockedTitle:g("Location is turned off"),locationBlockedBody:g("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:g("Open Settings"),locationUnavailableTitle:g("We could not read your location"),locationUnavailableBody:g("Try again in a moment."),stateAttestTemplate:g("I confirm my pet and I are in {state} right now."),describeHeading:g("Tell the vet what you are seeing"),describeHelpLong:g("A few sentences is plenty. When it started, what changed, anything you've already tried."),addPhotoCta:g("ADD PHOTO OR VIDEO"),removePhotoLabel:g("Remove photo"),summaryPet:g("Pet"),summaryVet:g("Vet"),summaryWhen:g("When"),summaryLength:g("Length"),summaryReason:g("Reason"),summaryLengthTemplate:g("{n} minutes"),confirmCta:g("Confirm visit"),bookedTitle:g("You are booked."),addToCalendarCta:g("Add to calendar"),doneCta:g("Done"),booked:Object.freeze({remindPromise:g("We will notify you 30 minutes before."),summaryPromise:g("{pet}'s summary goes to the vet ahead of the call."),joinPromise:g("Join right here in the app. No links to hunt for."),backToPet:g("Back to {pet}"),calendarAdded:g("Added to your calendar"),calendarFailedBody:g("That did not save to your calendar.")}),chrome:Object.freeze({closeHint:g("Closes without saving"),discardTitle:g("Leave without booking?"),discardBody:g("Your answers will not be saved."),discardConfirmCta:g("Leave"),discardKeepCta:g("Keep going"),noPetsTitle:g("No pets on this account"),loadFailedTitle:g("Could not load"),retryCta:g("Try again")}),emergency:Object.freeze({bannerTitle:g("This cannot wait for a scheduled call."),keepBookingCta:g("I have handled this, keep booking"),lede:g("What you are describing is the kind of thing vets want to see in person, now."),exitPrimaryVetTitle:g("Call {petName}'s primary vet"),exitFindErTitle:g("Find an emergency vet near you"),startCallHint:g("Starts a phone call")}),visit:Object.freeze({title:g("Your visit")}),loading:Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function Ho(e=oe){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(t=>Ho(t))}o(Ho,"televetBookingCopyValues");function we(){return Ho().every(e=>e.trim().length>0&&!Ga(e))}o(we,"isTelevetBookingCopyReady");var ot=Object.freeze({findEmergencyVet:"Find an emergency vet near you",poisonControl:"ASPCA Animal Poison Control",poisonControlDetail:"(888) 426-4435 \xB7 a fee may apply",poisonControlTel:"tel:+18884264435"}),p=Object.freeze({...oe,petSelectTitle:"Who is this visit for?",describeHeading:"Type to the vet what you're seeing",describeHelpLong:"Describe the issues your pet is experiencing",reasonPlaceholder:"She's been scratching her left ear a lot this week...",yourVetTitle:"Which vet would you like to see?",timeHeading:"Pick a date and time",reviewHeading:"Does this look right?",issuesHeadingTemplate:"Select {pet}\u2019s main issues",issuesHint:"Can select more than 1",otherIssue:"Other",bookedHeadingTemplate:"You're booked with {vet}",addToCalendarCta:"Add to Calendar",backLabel:"Back",emergency:Object.freeze({...oe.emergency,bannerTitle:"This can't wait for a scheduled call.",lede:"What you're describing is the kind of thing vets want to see in person, now. Please call one of these first.",ledeWithoutExits:oe.emergency.lede,keepBookingCta:"I've handled this, continue with booking",exitPrimaryVetTitle:"Call {petName}'s primary vet"})});var Mr=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(Mr.map(e=>e.wireCode));var Xa=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"}),Uo=Object.freeze(Mr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Xa[e.wireCode]}))),Qa=new Map(Uo.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Za=Object.freeze(["http_envelope",...[...new Set(Uo.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function Jt(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...Za]){let l=Qa.get(n+r);if(l)return l}}o(Jt,"contractErrorFor");function es(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(es,"contractDocUrl");function Wo(e){return null}o(Wo,"publishedDocUrl");var ts=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 $o(e){return ts[e]}o($o,"categoryFor");function Ko(e){let t=Jt(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":case "TELEVETRATELIMITED":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}o(Ko,"fromWire");var rs=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function zr(e){return rs.has(e)}o(zr,"isAutoRetryable");var ns=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function qo(e){return zr(e)||ns.has(e)}o(qo,"isRetryableCode");var os=500,jr=8e3,Yo=4;function Go(e,t=Math.random){let r=Math.max(0,e),n=Math.min(os*2**r,jr);return Math.floor(t()*n)}o(Go,"backoffDelayMs");var is=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 Hr(e){return is[e]}o(Hr,"userFacingError");function Jo(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}o(Jo,"defineHidden");var ls=/^[a-z][a-z0-9_]{0,63}$/;function Se(e,t){let r=Jt(t?.wireCode,t?.wireEnvelope),n={code:e,category:$o(e),retryable:t?.retryable??qo(e),displayMessage:Hr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&ls.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Jo(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Jo(n,"raw",t.raw),Object.freeze(n)}o(Se,"makeEverfurError");function D(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}o(D,"ok");function R(e){return Object.freeze({ok:false,error:e})}o(R,"err");var Xt=class Xt extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Xt.prototype);}};o(Xt,"EverfurConfigError");var Tt=Xt;function as(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}o(as,"authHeaders");function St(e,t){return {...e,headers:{...ss(e.headers),...as(t)}}}o(St,"withAuthHeaders");function ss(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let l=r.toLowerCase();l==="authorization"||l==="x-everfur-partner-key"||(t[r]=n);}return t}o(ss,"stripAuthHeaders");async function Xo(e,t){if(t.mode==="anonymous")return t.transport.request(St(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return R(Vr())}let n=await t.transport.request(St(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let l;try{l=await t.identity.currentToken({forceRefresh:!0});}catch{return R(Vr())}let a=await t.transport.request(St(e,{mode:"personalized",token:l,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?R(Vr(a.error.httpStatus)):a}o(Xo,"authedSend");function Vr(e){return Se("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(Vr,"authRejectedError");function Qo(e){return Se("internalError",{retryable:true,wireMessage:ds(e)})}o(Qo,"networkError");function ds(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(ds,"describeCause");var us=3e4,cs=jr*2,ps="idempotency-key",fs=new Set(["POST","PUT","PATCH","DELETE"]),ys=Object.freeze({onEvent(){}}),ms=Object.freeze({setTimeout:o((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function gs(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}o(gs,"seededIdempotencyKey");function Et(e){let t=e.observer??ys,r=e.timers??ms,n=e.rng??Math.random,l=e.sleep??((y,m)=>Is(y,r,m)),a=e.maxAttempts??Yo,s=e.unaryTimeoutMs??us,i=e.newIdempotencyKey??bs(),d=o(y=>{try{t.onEvent(y);}catch{}},"emit");async function c(y,m,b){let h=b?.maxAttempts,S=Math.max(1,h??a),C=b?.idempotent??fs.has(m.method),E=b?.idempotencyKey===void 0?null:gs(b.idempotencyKey),k=C?E??i():null,A=vs(m,k),V=0;for(;;){let L=o(Z=>Object.freeze({call:y,method:m.method,path:m.path,attempt:V,...k?{idempotencyKey:k}:{},...Z}),"stamp");d(L({phase:"attempt"}));let W=Ps(s,r),U=ws(W.signal,m.signal),Q;try{Q=await Xo({...A,signal:U.signal},e.auth);}catch(Z){Q=R(Qo(Z));}finally{U.dispose(),W.cancel();}if(Q.ok)return d(L({phase:"settled",ok:true,reason:"ok"})),Q;let B=Q.error,Y=Ts(B,V,{maxAttempts:S,rng:n,now:r.now(),aborted:m.signal?.aborted===true,...h!==void 0?{perCallMaxAttempts:h}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),j={ok:false,code:B.code,reason:Y.reason,...B.httpStatus!==void 0?{httpStatus:B.httpStatus}:{},...B.requestId!==void 0?{requestId:B.requestId}:{}};if(!Y.retry)return d(L({phase:"settled",...j})),R(B);if(d(L({phase:"retry",...j,delayMs:Y.delayMs})),await l(Y.delayMs,m.signal),m.signal?.aborted===true)return d(L({phase:"settled",...j,reason:"aborted"})),R(B);V+=1;}}o(c,"send");async function u(y){return St(y,await Rs(e.auth))}o(u,"authorize");async function*f(y,m,b){d(Object.freeze({call:y,phase:"stream.open",method:m.method,path:m.path,attempt:0}));try{yield*e.auth.transport.stream(m,b);}catch{yield zo({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(f,"stream"),Object.freeze({send:c,authorize:u,stream:f})}o(Et,"createRequestFunnel");function vs(e,t){let r={};for(let[n,l]of Object.entries(e.headers??{}))n.toLowerCase()!==ps&&(r[n]=l);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}o(vs,"assembleHeaders");function bs(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(bs,"defaultIdempotencyKeyFactory");var hs=10;function Ts(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=Ss(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!zr(e.code))return {retry:false,reason:"terminal-code"};let l=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=o(()=>{if(r.policy===void 0)return null;let c;try{c=r.policy.maxAttempts(e.code);}catch{return null}return typeof c!="number"||!Number.isFinite(c)?null:Math.max(1,Math.min(hs,Math.floor(c)))},"policyCeiling"),i=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=i)return {retry:false,reason:"attempts-exhausted"};let d=Es(e,r.now);return d!==null?d>cs?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:l,delayMs:d}:{retry:true,reason:l,delayMs:Go(t,r.rng)}}o(Ts,"decideRetry");function Ss(e){let t=e.code==="unknown"?Ko(_s(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}o(Ss,"throttleKind");function Es(e,t){let r=ks(e.raw);if(r!==null){let l=r-t;return l>0?l:0}let n=Cs(e.raw);return n===null?null:Math.round(n*1e3)}o(Es,"retryOverrideMs");function Cs(e){for(let t of Ur(e)){let r=t.retry_after_seconds;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r}return null}o(Cs,"findRetryAfterSeconds");function ks(e){for(let t of Ur(e)){let r=t.resets_at,n=xs(r);if(n!==null)return n}return null}o(ks,"findResetsAt");function Ur(e){if(!Zo(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];Zo(n)&&t.push(n);}return t}o(Ur,"candidateScopes");function xs(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}o(xs,"parseInstantMs");function _s(e){for(let t of Ur(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}o(_s,"rawWireCode");function Zo(e){return typeof e=="object"&&e!==null}o(Zo,"isRecord");async function Rs(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}o(Rs,"resolveDeviceAuth");function Ps(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:o(()=>t.clearTimeout(n),"cancel")}}o(Ps,"boundedSignal");function ws(e,t){let r=o(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let l=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",l,{once:true}),t.addEventListener("abort",l,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",l),t.removeEventListener("abort",l);},"dispose")}}o(ws,"mergeSignals");function Is(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let l=t.setTimeout(()=>{r?.removeEventListener("abort",a),n();},e),a=o(()=>{t.clearTimeout(l),n();},"onAbort");r?.addEventListener("abort",a,{once:true});})}o(Is,"delayAbortable");function Os(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}o(Os,"isSafeRoomUrl");function As(e,t){return Os(e)&&t.trim().length>0}o(As,"isUsableRoomCredential");function Qt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Qt,"isRecord");function Wr(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:null}o(Wr,"wholeNumber");function Bs(e){if(!Qt(e))return null;let t=Wr(e.consult_minutes,1),r=Wr(e.auto_end_minutes,0),n=Wr(e.warn_before_seconds,0);return t===null||r===null||n===null?null:Object.freeze({consultMinutes:t,autoEndMinutes:r,warnBeforeSeconds:n})}o(Bs,"parseCallLimits");function $r(e){if(!Qt(e))return null;let t=e.room_url??e.url,r=e.token;if(typeof t!="string"||typeof r!="string"||!As(t,r))return null;let n=e.recording_notice;return Object.freeze({roomUrl:t.trim(),token:r,recordingNotice:typeof n=="boolean"?n:true,callLimits:Bs(e.call_limits)})}o($r,"parseVetCallCredential");function Kr(e){let t=ei(e.raw);return t!==null&&t.length>0?t:null}o(Kr,"vetCallJoinReason");function ei(e){if(!Qt(e))return null;let t=e.detail??e.error,n=(Qt(t)?t:e).reason;return typeof n=="string"?n:null}o(ei,"reasonOf");function qr(e){if(e.httpStatus===404)return "unavailable";let t=ei(e.raw);return t==="too_early"||t==="too_late"||t==="room_not_ready"?t:t!==null&&t.startsWith("status_")?"not_joinable":"unknown"}o(qr,"vetCallJoinRefusal");var ri=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],Zt=new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),ni=["wellness","prescription"],er=64,Fe=2e3,tr=10;function Ee(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}o(Ee,"isWellFormedStateCode");function Ie(e){return typeof e=="object"&&e!==null?e:null}o(Ie,"row");function X(e){return typeof e=="string"&&e.length>0?e:null}o(X,"str");function Ne(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}o(Ne,"trimmedOrNull");function it(e,t){return typeof e=="boolean"?e:t}o(it,"bool");function Yr(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o(Yr,"num");function ti(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}o(ti,"closed");function lt(e,t){if(!Array.isArray(e))return Object.freeze([]);let r=[];for(let n of e){let l=t(n);l!==null&&r.push(l);}return Object.freeze(r)}o(lt,"parseList");function oi(e,t){let r=Ie(e);return r===null?null:Object.freeze({state:X(r.state)??t,wellnessAvailable:it(r.wellness_available,false),prescriptionsAvailable:it(r.prescriptions_available,false),cancellationPolicyText:Ne(r.cancellation_policy_text)})}o(oi,"parseStatePolicy");function ii(e){let t=Ie(e);if(t===null)return null;let r=Ne(t.summary),n=Ne(t.version);return r===null||n===null?null:Object.freeze({summary:r,version:n})}o(ii,"parseCancellationPolicy");function li(e){let t=Ie(e);if(t===null)return null;let r=X(t.clinician_id),n=X(t.display_name);return r===null||n===null?null:Object.freeze({clinicianId:r,displayName:n,credentials:Ne(t.credentials_text),rating:Yr(t.rating),ratingCount:Yr(t.rating_count),bio:Ne(t.bio),photoRef:X(t.photo_ref),licensedStates:lt(t.licensed_states,l=>{let a=Ie(l),s=a===null?null:X(a.state);return s===null?null:Object.freeze({state:s,canPrescribe:it(a?.can_prescribe,false)})})})}o(li,"parseClinician");function Gr(e){let t=Ie(e);if(t===null)return null;let r=X(t.slot_id),n=X(t.starts_at);return r===null||n===null?null:Object.freeze({slotId:r,startsAt:n,endsAt:X(t.ends_at)??n})}o(Gr,"parseSlot");function ai(e){let t=Ie(e);if(t===null)return null;let r=X(t.slot_id),n=X(t.hold_expires_at);return r===null||n===null?null:Object.freeze({slotId:r,expiresAt:n})}o(ai,"parseSlotHold");function Ct(e){let t=Ie(e);if(t===null)return null;let r=X(t.consult_id),n=X(t.scheduled_at);return r===null||n===null?null:Object.freeze({consultId:r,petId:X(t.pet_id)??"",clinicianId:X(t.clinician_id)??"",clinicianName:Ne(t.display_name),reasonText:Ne(t.reason_text),mediaRefs:lt(t.media_refs,l=>X(l)),status:ti(ri,t.status),kind:ti(ni,t.kind),scheduledAt:n,emergencyFlagged:it(t.emergency_flagged,false),hasRoom:X(t.meeting_url)!==null})}o(Ct,"parseConsult");function si(e){let t=Ie(e);return Object.freeze({active:it(t?.active,false)})}o(si,"parseBookingEntitlement");var De=240;function di(e){let t=Ie(e);if(t===null)return null;let r=Yr(t.fee_cents);return r===null||r<0?null:Object.freeze({feeCents:r,currency:X(t.currency)??"usd",feeRecorded:it(t.fee_recorded,r>0),summary:Ne(t.summary)})}o(di,"parseCancelReceipt");var Me="/widget/v1/televet",Ls=`${Me}/state-policy`,Ns=`${Me}/vets`,ui=`${Me}/slots`,Fs=`${Me}/slots/next`,rr=`${Me}/consults`,Ds=`${Me}/entitlement`,Ms=`${Me}/cancellation-policy`;function ci(e){return `${ui}/${encodeURIComponent(e)}/hold`}o(ci,"televetHoldCall");function pi(e){return `${rr}/${encodeURIComponent(e)}/reschedule`}o(pi,"televetRescheduleCall");function nr(e){return `${rr}/${encodeURIComponent(e)}`}o(nr,"televetConsultCall");function fi(e){return `${nr(e)}/join`}o(fi,"televetJoinCall");function yi(e){return `${nr(e)}/cancel`}o(yi,"televetCancelCall");var mi=100;function ce(e){return R(Se("validationFailed",{retryable:false,wireMessage:e}))}o(ce,"invalid");function Ue(e){return R(Se("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(Ue,"unusable");function Jr(e){return e.httpStatus===404}o(Jr,"isDark");function kt(e,t,r){try{e?.track(t,r);}catch{}}o(kt,"safeTrack");function gi(e){if(e.pet_id.trim().length===0)return "pet_id is required";if(e.clinician_id.trim().length===0)return "clinician_id is required";if(e.slot_id.trim().length===0)return "slot_id is required";if(!Ee(e.state))return "state must be a two-letter US state code";let t=e.reason_text.trim();return t.length===0?"reason_text is required":t.length>Fe?`reason_text must be at most ${Fe} characters`:zs(e)}o(gi,"validateBookingBody");function zs(e){let t=e.state_attested===true,r=e.cancellation_policy_version?.trim()??"";return t!==r.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":r.length>er?`cancellation_policy_version must be at most ${er} characters`:null}o(zs,"attestationRefusal");function Qr(e){let t=e.funnel??Et({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry;return {async statePolicy(n,l){let a=n.trim();if(!Ee(a))return ce("state must be a two-letter US state code");let s=await t.send("televet.booking.state_policy",{method:"GET",path:`${Ls}/${encodeURIComponent(a)}`,...l?{signal:l}:{}});if(!s.ok)return R(s.error);let i=oi(s.value,a);return i===null?Ue("the state policy response was unreadable"):D(i)},async entitlement(n){let l=await t.send("televet.booking.entitlement",{method:"GET",path:Ds,...n?{signal:n}:{}});return l.ok?D(si(l.value)):R(l.error)},async cancellationPolicy(n){let l=await t.send("televet.booking.cancellation_policy",{method:"GET",path:Ms,...n?{signal:n}:{}});return l.ok?D(ii(l.value)):D(null)},async clinicians(n,l){let a=n.trim();if(!Ee(a))return ce("state must be a two-letter US state code");let s=await t.send("televet.booking.clinicians",{method:"GET",path:Ns,query:{state:a},...l?{signal:l}:{}});return s.ok?D(lt(Xr(s.value,"vets"),li)):Jr(s.error)?D(Object.freeze([])):R(s.error)},async slots(n,l){let a=n.trim();if(a.length===0)return ce("clinicianId is required");let s=await t.send("televet.booking.slots",{method:"GET",path:ui,query:{clinician_id:a},...l?{signal:l}:{}});return s.ok?D(lt(Xr(s.value,"slots"),Gr)):Jr(s.error)?D(Object.freeze([])):R(s.error)},async nextSlot(n){let l=await t.send("televet.booking.next_slot",{method:"GET",path:Fs,...n?{signal:n}:{}});return l.ok?D(Gr(Hs(l.value,"slot"))):D(null)},async holdSlot(n){let l=n.trim();if(l.length===0)return ce("slotId is required");let a=await t.send("televet.booking.hold",{method:"POST",path:ci(l)},{idempotent:false,maxAttempts:1});if(!a.ok)return kt(r,"televet.booking.hold_failed",{status:a.error.httpStatus??null}),R(a.error);let s=ai(a.value);return s===null?Ue("the hold response carried no usable expiry"):D(s)},async book(n,l){let a=gi(n);if(a!==null)return ce(a);let s=l.trim();if(s.length===0)return ce("idempotencyKey is required");let i=await t.send("televet.booking.book",{method:"POST",path:rr,body:js(n)},{idempotent:true,idempotencyKey:s,maxAttempts:1});if(!i.ok)return kt(r,"televet.booking.book_failed",{status:i.error.httpStatus??null}),R(i.error);let d=Ct(i.value);return d===null?Ue("the booking response was unreadable"):D(d)},async reschedule(n,l){let a=n.trim(),s=l.trim();if(a.length===0)return ce("consultId is required");if(s.length===0)return ce("slotId is required");let i=await t.send("televet.booking.reschedule",{method:"POST",path:pi(a),body:{new_slot_id:s}},{idempotent:false,maxAttempts:1});if(!i.ok)return kt(r,"televet.booking.reschedule_failed",{status:i.error.httpStatus??null}),R(i.error);let d=Ct(i.value);return d===null?Ue("the reschedule response was unreadable"):D(d)},async listConsults(n){let l=await t.send("televet.booking.consults",{method:"GET",path:rr,query:{limit:String(mi)},...n?{signal:n}:{}});return l.ok?D(lt(Xr(l.value,"consults"),Ct)):Jr(l.error)?D(Object.freeze([])):R(l.error)},async getConsult(n,l){let a=n.trim();if(a.length===0)return ce("consultId is required");let s=await t.send("televet.booking.consult",{method:"GET",path:nr(a),...l?{signal:l}:{}});if(!s.ok)return R(s.error);let i=Ct(s.value);return i===null?Ue("the consult response was unreadable"):D(i)},async joinConsult(n){let l=n.trim();if(l.length===0)return ce("consultId is required");let a=await t.send("televet.booking.join",{method:"POST",path:fi(l)},{idempotent:false,maxAttempts:1});if(!a.ok)return kt(r,"televet.booking.join_failed",{status:a.error.httpStatus??null}),R(a.error);let s=$r(a.value);return s===null?Ue("the join response carried no usable room credential"):D(s)},async cancelConsult(n,l){let a=n.trim(),s=l.trim();if(a.length===0)return ce("consultId is required");if(s.length===0)return ce("reason is required");if(s.length>De)return ce(`reason must be at most ${De} characters`);let i=await t.send("televet.booking.cancel",{method:"POST",path:yi(a),body:{reason:s}},{idempotent:false,maxAttempts:1});if(!i.ok)return kt(r,"televet.booking.cancel_failed",{status:i.error.httpStatus??null}),R(i.error);let d=di(i.value);return d===null?Ue("the cancel response was unreadable"):D(d)}}}o(Qr,"createTelevetBookingController");function js(e){let t=e.cancellation_policy_version?.trim()??"",r=e.state_attested===true&&t.length>0;return {pet_id:e.pet_id,clinician_id:e.clinician_id,slot_id:e.slot_id,state:e.state,reason_text:e.reason_text.trim(),species:e.species,media_refs:[...e.media_refs],emergency_acknowledged:e.emergency_acknowledged,share_health_records:e.share_health_records,...r?{state_attested:true,cancellation_policy_version:t}:{}}}o(js,"bookingWireBody");function Xr(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let r=e,n=r[t]??r.items??r.data;if(Array.isArray(n))return n}return e}o(Xr,"rows");function Hs(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let r=e,n=r[t]??r.data;if(typeof n=="object"&&n!==null)return n}return e}o(Hs,"unwrap");var vi=Symbol.for("@everfur/sdk#EverfurContext@v1"),bi=globalThis,hi=bi[vi]??(bi[vi]=createContext(null));hi.displayName??="EverfurContext";function We(){let e=useContext(hi);if(e===null)throw new Tt("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(We,"useEverfurContext");var Ws=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 $s(e){return Ws[e]}o($s,"requires");function Ti(e,t,r){let n=$s(e),l=new Map;for(let i of t)l.set(i.resource,i);if(r?.isPending===true&&n.some(i=>!l.has(i)))return Zr({name:e,enabled:false,isPending:true,limits:{}});let a=Ks(n,l);return n.filter(i=>l.get(i)?.granted!==true).length===0?Zr({name:e,enabled:true,isPending:false,limits:a}):Zr({name:e,enabled:false,isPending:false,limits:a,disabled:qs(n,l)})}o(Ti,"decideCapability");function Ks(e,t){let r={};for(let n of e){let l=t.get(n)?.limits;if(l)for(let[a,s]of Object.entries(l)){let i=r[a];r[a]=i===void 0?s:Math.min(i,s);}}return r}o(Ks,"mergeLimits");function qs(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:Hr("accessDenied"),level:"user_entitlement",recoverable:false})}o(qs,"disabledFor");function Zr(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}o(Zr,"freezeDecision");function xt(e){let{runtime:t}=We(),r=t.entitlements,n=useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return useMemo(()=>Ti(e,n.decisions,{isPending:n.isPending}),[e,n])}o(xt,"useCapability");function ve(e){let{runtime:t,userRef:r,scopeEpoch:n}=We();return useMemo(()=>{if(e)return e;if(r===null)return null;let{services:l}=t.registry;return Qr({auth:l.authFor(r),telemetry:l.telemetry,...l.errorPolicy?{errorPolicy:l.errorPolicy}:{}})},[t,r,n,e])}o(ve,"useTelevetBookingController");function Js(){let{userRef:e}=We(),t=xt("televet");return useMemo(()=>({available:t.enabled&&e!==null,isPending:t.isPending}),[t.enabled,t.isPending,e])}o(Js,"useTelevetBookingAvailable");function $e(e,t,r){let[n,l]=useState(()=>({key:e,data:null,isPending:t&&r!==null,error:null})),[a,s]=useState(0),i=useRef(r);i.current=r,useEffect(()=>{let u=i.current;if(!t||u===null){l({key:e,data:null,isPending:false,error:null});return}let f=new AbortController,y=true;return l(m=>m.key===e?{...m,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let m;try{m=await u(f.signal);}catch{y&&l({key:e,data:null,isPending:false,error:null});return}y&&(m.ok?l({key:e,data:m.value,isPending:false,error:null}):l({key:e,data:null,isPending:false,error:m.error}));})(),()=>{y=false,f.abort();}},[e,t,a]);let d=useCallback(()=>s(u=>u+1),[]),c=n.key===e;return useMemo(()=>({enabled:t,data:c?n.data:null,isPending:t&&(!c||n.isPending),isError:c&&n.error!==null,error:c?n.error:null,refetch:d}),[t,c,n.data,n.isPending,n.error,d])}o($e,"useTelevetRead");function tn(e,t){let r=e?.trim()??"",n=t?.statePolicy!==void 0&&Ee(r),l=t?.statePolicy;return $e(`state-policy:${r}`,n,n&&l?a=>l.call(t,r,a):null)}o(tn,"useTelevetStatePolicy");function rn(e){let t=e?.entitlement!==void 0,r=e?.entitlement;return $e("entitlement",t,t&&r?n=>r.call(e,n):null)}o(rn,"useTelevetBookingEntitlement");function _t(e){let t=e?.cancellationPolicy!==void 0,r=e?.cancellationPolicy;return $e("cancellation-policy",t,t&&r?n=>r.call(e,n):null)}o(_t,"useTelevetCancellationPolicy");function nn(e,t){let r=e?.trim()??"",n=t?.clinicians!==void 0&&Ee(r),l=t?.clinicians;return $e(`clinicians:${r}`,n,n&&l?a=>l.call(t,r,a):null)}o(nn,"useTelevetClinicians");function Rt(e,t){let r=e?.trim()??"",n=t!==null&&r.length>0;return $e(`slots:${r}`,n,n&&t?l=>t.slots(r,l):null)}o(Rt,"useTelevetSlots");function on(e){let t=e?.nextSlot!==void 0,r=e?.nextSlot;return $e("next-slot",t,t&&r?n=>r.call(e,n):null)}o(on,"useTelevetNextSlot");function ln(e){let[t,r]=useState(null),n=useRef(true),l=useRef(false),a=useRef(e);a.current=e,useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=useCallback((...i)=>{let d=a.current;if(d===null||l.current)return;let c=i[i.length-1],u=typeof c=="object"&&c!==null&&("onSuccess"in c||"onError"in c),f=u?c:void 0,y=u?i.slice(0,-1):i;l.current=true,r({variables:y[0]??null}),(async()=>{let m=null;try{m=await d(...y);}catch{m=null;}l.current=false,n.current&&r(null),m!==null&&(m.ok?f?.onSuccess?.(m.value):f?.onError?.(m.error));})();},[]);return useMemo(()=>({isPending:t!==null,variables:t?.variables??null,mutate:s}),[t,s])}o(ln,"useTelevetWrite");function Pt(e){return ln(e?t=>e.holdSlot(t):null)}o(Pt,"useTelevetHoldSlot");function an(e){return ln(e?(t,r)=>e.book(t,r):null)}o(an,"useTelevetBookConsult");function sn(e,t){return ln(t&&e?r=>t.reschedule(e,r):null)}o(sn,"useTelevetRescheduleConsult");function lr(e,t=0){let r=e?.listConsults!==void 0,n=e?.listConsults;return $e(`consults:${t}`,r,r&&n?l=>n.call(e,l):null)}o(lr,"useTelevetConsults");function dn(e){return e.error!==null&&e.error.httpStatus===404}o(dn,"televetReadIsDark");var un=15,cn=250,Ci=new Set(["scheduled","in_progress"]);function Ke(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}o(Ke,"startsAtMs");function pn(e){let t=Ke(e);return t===null?null:t-un*6e4}o(pn,"televetJoinOpensAtMs");function fn(e,t){if(!Ci.has(e.status))return {joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return {joinable:false,reason:"room_not_ready"};let r=Ke(e);return r===null||t<r-un*6e4?{joinable:false,reason:"too_early"}:t>r+cn*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}o(fn,"televetJoinDecision");function wt(e,t){let r=[],n=[];for(let l of e){let a=Ke(l);(Ci.has(l.status)&&a!==null&&a+cn*6e4>t?r:n).push(l);}return r.sort((l,a)=>(Ke(l)??0)-(Ke(a)??0)),n.sort((l,a)=>(Ke(a)??0)-(Ke(l)??0)),Object.freeze({upcoming:Object.freeze(r),past:Object.freeze(n)})}o(wt,"splitTelevetVisits");function yn(e){return e==="scheduled"}o(yn,"canManageTelevetVisit");function ki(e){let t=lr(e);return t.enabled?t.isPending?"pending":t.isError||wt(t.data??[],Date.now()).upcoming.length>0?"visits":"booking":"booking"}o(ki,"useTelevetLanding");var _=Object.freeze({bookCardTitle:"Book a video visit",bookCardCta:"Find a time",upcomingTitle:"Upcoming visits",pastTitle:"Past visits",emptyTitle:"No visits yet",emptyBody:"When you book a video visit, it will appear here.",loading:"Loading your visits\u2026",loadErrorTitle:"Could not load your visits",loadErrorBody:"Check your connection and try again.",retry:"Try again",joinCta:"Join visit",joining:"Joining\u2026",rescheduleCta:"Reschedule",cancelCta:"Cancel visit",cancelConfirmTitle:"Cancel this visit?",cancellationReasonLabel:"Why are you cancelling?",cancelConfirmCta:"Cancel visit",cancellingVisit:"Cancelling visit\u2026",cancelDismissCta:"Keep visit",cancelledTitle:"Visit cancelled",cancellationFeeRecorded:"A late cancellation fee was recorded for this visit.",cancellationFeeNotRecorded:"No late cancellation fee was recorded for this visit.",loadingCancellationTerms:"Loading cancellation terms\u2026",cancellationTermsUnavailable:"We could not confirm the current cancellation terms. Try again before continuing.",cancellationReasonMissing:"Tell us why you are cancelling.",cancellationReasonTooLong:o(e=>`Keep the reason to ${String(e)} characters or fewer.`,"cancellationReasonTooLong"),cancelTermsFirst:"We could not confirm the cancellation terms. Please try again before cancelling.",cancelFailed:"We could not cancel this visit. Refresh your visits to confirm its status before trying again."});function xi(e){switch(e){case "scheduled":return "Scheduled";case "in_progress":return "In progress";case "awaiting_summary":return "Summary on its way";case "completed":return "Completed";case "cancelled_owner":return "Cancelled by you";case "cancelled_ops":return "Cancelled by Everfur";case "no_show_owner":return "Missed";case "no_show_vet":return "Vet couldn't attend";default:return null}}o(xi,"televetVisitStatusWeb");function _i(e,t){if(e==="too_early")return t?`This visit opens at ${t}. You can join from then.`:"This visit has not opened yet.";if(e==="too_late")return "This visit has ended.";if(e==="room_not_ready")return "We are still setting up the video room. Try again in a moment.";switch(e){case "status_cancelled_owner":return "You cancelled this visit.";case "status_cancelled_ops":return "This visit was cancelled. Please book another time.";case "status_no_show_owner":return "This visit was missed.";case "status_no_show_vet":return "The vet could not make this visit. Please book another time.";case "status_awaiting_summary":return "This visit has ended. Your summary is on its way.";case "status_completed":return "This visit has ended.";default:return "This visit cannot be joined right now."}}o(_i,"televetJoinBlockWeb");var vn=class vn extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(vn,"HostRenderBoundary");var mn=vn;function Qs({render:e}){return e()}o(Qs,"RenderHost");function gn({render:e,fallback:t,resetKey:r}){return createElement(mn,{fallback:t,resetKey:r,children:createElement(Qs,{render:e})})}o(gn,"HostRender");function Tn(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))Tn(e[t]);}return e}o(Tn,"deepFreeze");var Zs=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),wi={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Ii={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Pi={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},ed={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},td={regular:"400",medium:"500",bold:"700"},rd={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},nd=0,ar="System",sr="monospace",od=["content","heading","control","compact","badge"];function id(e){let t={};for(let r of od)t[r]=e;return t}o(id,"authoredTierSizes");function Oi(){return {family:ar,mono:sr,fontUrl:null,families:{regular:ar,medium:ar,bold:ar,mono:sr,monoMedium:sr,monoBold:sr},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Pi,tierSizes:id(Pi),lineHeight:ed,weight:td,letterSpacing:rd,scale:1,maxScale:nd,scaleCaps:Zs}}o(Oi,"baseType");var Ai={},bn=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function hn(e){return `cubic-bezier(${e.join(", ")})`}o(hn,"cssCubicBezier");var Bi={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:hn(bn.standard),emphasized:hn(bn.emphasized),exit:hn(bn.exit)},reducedMotion:false},ld={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)"},Li=Tn({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ld,space:wi,radius:Ii,type:Oi(),motion:Bi,slots:Ai}),ad={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)"};Tn({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ad,space:wi,radius:Ii,type:Oi(),motion:Bi,slots:Ai});var Ni=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Fi=globalThis,Sn=Fi[Ni]??(Fi[Ni]=createContext(Li));Sn.displayName??="EverfurThemeContext";function x(){return useContext(Sn)}o(x,"useEverfurTheme");var Di=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var Mi='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',ud="System";function cd(e){let t=e.trim();return t.length===0||t===ud?Mi:`${zi(t)}, ${Mi}`}o(cd,"cssFontFamily");function pd(e){let t=e.trim();return t.length===0||t==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${zi(t)}, ui-monospace, Menlo, Consolas, monospace`}o(pd,"cssMonoFamily");function zi(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}o(zi,"quote");function v(e,t){let r=e.type,n=r.families[t];return {fontFamily:t==="mono"||t==="monoMedium"||t==="monoBold"?pd(n):cd(n),fontWeight:r.namedFaces[t]?r.weight.regular:r.weight[Di[t]]}}o(v,"faceCss");var at=Object.freeze({textAlign:"start"});var fd=48;function yd(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(yd,"selectView");function Vi(e){let{capability:t,children:r,renderDisabled:n,renderPending:l,style:a,className:s}=e,i=xt(t),d=useMemo(()=>yd(i),[i]);switch(d){case "enabled":return r;case "pending":return l?jsx(gn,{render:l,fallback:jsx(ji,{capability:t,style:a,className:s})}):jsx(ji,{capability:t,style:a,className:s});case "disabled":return n?jsx(gn,{render:()=>n(i),fallback:jsx(Hi,{decision:i,style:a,className:s}),resetKey:i}):jsx(Hi,{decision:i,style:a,className:s});default:return qt(d)}}o(Vi,"CapabilityGate");function ji({capability:e,style:t,className:r}){let n=x(),l=useMemo(()=>Ui(n),[n]);return jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${e}`,className:r,style:{...l.offstate,...t},children:jsx("div",{style:l.skeletonBar})})}o(ji,"PendingSkeleton");function Hi({decision:e,style:t,className:r}){let n=x(),l=useMemo(()=>Ui(n),[n]),a=e.disabled?.reason??"";return jsx("div",{className:r,style:{...l.offstate,...t},children:a.length>0?jsx("p",{style:l.offstateText,children:a}):null})}o(Hi,"OffState");function Ui(e){let{color:t,space:r,radius:n,type:l}=e;return {offstate:{...at,boxSizing:"border-box",minHeight:fd,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${r.md}px ${r.lg}px`,backgroundColor:t.surfaceCream,borderRadius:n.md,border:`1px solid ${t.brandBorder}`},offstateText:{margin:0,...v(e,"regular"),fontSize:l.size.body,lineHeight:`${Math.round(l.size.body*l.lineHeight.normal)}px`,color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}}}o(Ui,"makeStyles");function dr(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t,n=r.detail??r.error;return typeof n=="object"&&n!==null?n:r}o(dr,"details");function md(e){let t=dr(e)?.categories;return Array.isArray(t)?Object.freeze(t.filter(r=>typeof r=="string")):Object.freeze([])}o(md,"categoriesOf");function Wi(e){let t=dr(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}o(Wi,"retryAfterOf");function $i(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let r=dr(e)?.message;return typeof r=="string"&&r.trim().length>0?r.trim():null}o($i,"messageOf");function gd(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let r=dr(e),n=r?.code??r?.error_code;return typeof n=="string"&&n.length>0?n:null}o(gd,"codeOf");function Oe(e){let t=e.httpStatus;if(t===402)return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")return Object.freeze({kind:"rate_limited",retryAfterSeconds:Wi(e),message:$i(e)});if(t===404)return Object.freeze({kind:"unavailable"});switch(gd(e)){case "televet_rate_limited":return Object.freeze({kind:"rate_limited",retryAfterSeconds:Wi(e),message:$i(e)});case "televet_emergency_ack_required":return Object.freeze({kind:"emergency",categories:md(e)});case "televet_not_entitled":return Object.freeze({kind:"not_entitled"});case "televet_slot_conflict":return Object.freeze({kind:"slot_taken"});case "televet_hold_invalid":return Object.freeze({kind:"slot_taken"});case "televet_clinician_cannot_prescribe":case "televet_clinician_unavailable":case "televet_clinician_not_bookable":return Object.freeze({kind:"clinician_unavailable"});case "televet_membership_conflict":return Object.freeze({kind:"not_entitled"});case "televet_registry_unavailable":return Object.freeze({kind:"failed"});}return Object.freeze({kind:"failed"})}o(Oe,"televetBookingRefusal");function Ki(e){if(e===null)return null;let t=Oe(e);return t.kind==="rate_limited"?t.message:null}o(Ki,"televetRateLimitMessage");function ur(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}o(ur,"hasLoneSurrogate");function cr(e){return [...e].length}o(cr,"serverLength");var qi=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Yi(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(qi,t)?qi[t]:null}o(Yi,"canonicalPetSpecies");var Gi=50,vd=128,Cn=120,Ji=120,bd=2e3,Xi=120,hd=80,el=new Set(["male","female","unknown"]),tl=new Set(["day","month","year"]),rl=new Set(["low","medium","high","athletic"]),nl=new Set(["indoor","outdoor","both"]),ol=new Set(["mild","moderate","severe"]),Td=/^(\d{4})-(\d{2})-(\d{2})$/,il=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],ll=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...il,...ll].map(([e])=>e));function Sd(e){let t=Td.exec(e);if(t===null)return false;let[r,n,l]=[Number(t[1]),Number(t[2]),Number(t[3])],a=new Date(Date.UTC(r,n-1,l));return a.getUTCFullYear()===r&&a.getUTCMonth()===n-1&&a.getUTCDate()===l}o(Sd,"isRealDate");var Ot=o(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),Ed=o((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),fr=o((e,t)=>typeof t=="string"&&Sd(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),ke=o((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(ur(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let l=t.trimmed?n.trim():n;if(t.required&&l.length===0)return `${r} is required and must not be blank`;let a=cr(l);return a<=e?null:`${r} is ${a} characters; the server accepts at most ${e}`},"text"),Cd={sex:Ot(el),spayedNeutered:Ed,birthDate:fr,birthDatePrecision:Ot(tl),activityLevel:Ot(rl),indoorOutdoor:Ot(nl),foodBrand:ke(Xi),foodType:ke(Xi),microchipId:ke(hd)},kn=["ref","ref",false,ke(vd,{required:true,trimmed:true})],xn=["notes","notes",false,ke(bd,{trimmed:true})],Qi=[kn,["name","name",true,ke(Cn,{required:true,trimmed:true})],["dose","dose",false,ke(Ji,{trimmed:true})],["frequency","frequency",false,ke(Ji,{trimmed:true})],["startDate","start_date",false,fr],["endDate","end_date",false,fr],xn],kd={allergies:[kn,["allergen","allergen",true,ke(Cn,{required:true,trimmed:true})],["severity","severity",false,Ot(ol)],xn],medications:Qi,supplements:Qi,conditions:[kn,["conditionName","condition_name",true,ke(Cn,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,fr],xn]};function xd(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let l=r,a={};for(let[d,c,u,f]of kd[e]){let y=l[d];if(y==null){if(u)return {error:`${n}.${d} is required`};y===null&&(a[c]=null);continue}let m=f(`${n}.${d}`,y);if(m!==null)return {error:m};a[c]=y;}let s=a.start_date,i=a.end_date;return typeof s=="string"&&typeof i=="string"&&i<s?{error:`${n}.endDate must not be before startDate`}:{item:a}}o(xd,"itemToWire");function _d(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>Gi)return {error:`${e} has ${t.length} items; the server accepts at most ${Gi}`};let r=[],n=new Set;for(let l=0;l<t.length;l+=1){let a=xd(e,l,t[l]);if("error"in a)return a;let s=a.item.ref;if(typeof s=="string"){let i=s.trim();if(n.has(i))return {error:`${e}: ref ${JSON.stringify(i)} is used twice; a ref names one item`};n.add(i);}r.push(a.item);}return {items:r}}o(_d,"listToWire");function al(e,t){let r=e,n={};for(let[s,i]of il){let d=r[s];if(d!==void 0){if(d!==null){let c=Cd[s](s,d);if(c!==null)return {error:c}}n[i]=d;}}let l=r.birthDate!==void 0,a=r.birthDatePrecision!==void 0;if(l!==a||l&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[s,i]of ll){let d=r[s];if(d===void 0)continue;let c=_d(s,d);if("error"in c)return c;n[i]=c.items;}return Object.keys(n).length>0&&t!==void 0&&Yi(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}o(al,"petHealthToWire");var J=o(e=>typeof e=="string"?e:null,"str"),It=o((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),Rd=o(e=>typeof e=="boolean"?e:null,"bool");function pr(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}o(pr,"itemsFromWire");function Zi(e){let t=J(e.name);return t===null||t.length===0?null:Object.freeze({ref:J(e.ref),name:t,dose:J(e.dose),frequency:J(e.frequency),startDate:J(e.start_date),endDate:J(e.end_date),notes:J(e.notes)})}o(Zi,"medicationFromWire");function sl(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:It(el,e.sex),spayedNeutered:Rd(e.spayed_neutered),birthDate:J(e.birth_date),birthDatePrecision:It(tl,e.birth_date_precision),activityLevel:It(rl,e.activity_level),indoorOutdoor:It(nl,e.indoor_outdoor),foodBrand:J(e.food_brand),foodType:J(e.food_type),microchipId:J(e.microchip_id),allergies:pr(e.allergies,r=>{let n=J(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:J(r.ref),allergen:n,severity:It(ol,r.severity),notes:J(r.notes)})}),medications:pr(e.medications,Zi),supplements:pr(e.supplements,Zi),conditions:pr(e.conditions,r=>{let n=J(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:J(r.ref),conditionName:n,diagnosedDate:J(r.diagnosed_date),notes:J(r.notes)})})})}o(sl,"petHealthFromWire");var cl=100,pl=50,fl=100,yl=50,ml=500,Pd=128,wd=6e4;function _e(e){return Se("validationFailed",{retryable:false,wireMessage:e})}o(_e,"invalid");function qe(e,t,r){if(typeof t!="string")return _e(`${e} must be a string`);let n=cr(t);return n<=r?null:_e(`${e} is ${n} characters; the server accepts at most ${r}`)}o(qe,"checkString");function yr(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:_e(`${e} must be a finite number between 0 and ${r}`)}o(yr,"outOfRange");function dl(e,t){if(typeof e!="string")return _e("pet_ref must be a string");if(e.trim().length===0)return _e("pet_ref must not be blank");if(ur(e))return _e("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return _e("profile must be an object");let r=[qe("pet_ref",e,Pd)];return t?.name!==void 0&&r.push(qe("name",t.name,cl)),t?.species!==void 0&&r.push(qe("species",t.species,pl)),t?.breed!==void 0&&r.push(qe("breed",t.breed,fl)),t?.ageYears!==void 0&&r.push(yr("age_years",t.ageYears,yl)),t?.weightKg!==void 0&&r.push(yr("weight_kg",t.weightKg,ml)),r.find(n=>n!==null)??null}o(dl,"validate");function gl(e,t){let r=al(e,t);return "error"in r?{error:_e(r.error)}:r}o(gl,"healthToWire");function Id(e){if(typeof e!="object"||e===null)return {error:_e("patch must be an object")};let t=e,r=[["name","name",a=>qe("name",a,cl)],["species","species",a=>qe("species",a,pl)],["breed","breed",a=>qe("breed",a,fl)],["ageYears","age_years",a=>yr("age_years",a,yl)],["weightKg","weight_kg",a=>yr("weight_kg",a,ml)]],n={};for(let[a,s,i]of r){let d=t[a];if(d!==void 0){if(d!==null){let c=i(d);if(c!==null)return {error:c}}n[s]=d;}}let l=gl(t,t.species);return "error"in l?l:(Object.assign(n,l.body),Object.keys(n).length===0?{error:_e("patch must change at least one field")}:{body:n})}o(Id,"patchToWire");function Od(e){if(e==null)return {body:{}};let t=gl(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}o(Od,"toWire");var xe=o(e=>typeof e=="string"?e:null,"str"),mr=o(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function ul(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:xe(r.pet_ref)??t,name:xe(r.name),species:xe(r.species),breed:xe(r.breed),ageYears:mr(r.age_years),weightKg:mr(r.weight_kg)})}o(ul,"fromWire");function vl(e){if(typeof e!="object"||e===null)return null;let t=e,r=xe(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:xe(t.pet_id),petRef:r,name:xe(t.name),species:xe(t.species),breed:xe(t.breed),ageYears:mr(t.age_years),weightKg:mr(t.weight_kg),updatedAt:xe(t.updated_at)})}o(vl,"widgetPetFromWire");function Ad(e){let t=vl(e);return t===null?null:Object.freeze({...t,...sl(e)})}o(Ad,"widgetPetProfileFromWire");function Bd(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=vl(r);return n===null?[]:[n]}))}o(Bd,"petListFromWire");function bl(e){return Ld(Et({auth:e}),Et({auth:e,unaryTimeoutMs:wd}))}o(bl,"createPetsRepository");function Ld(e,t=e){let r=o((l,a)=>a?{...l,signal:a}:l,"withSignal"),n=o(l=>dl(l,void 0)??`/widget/v1/pets/${encodeURIComponent(l)}`,"petPath");return {async list(l){let a=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},l?.signal));return a.ok?D(Bd(a.value)):R(a.error)},async registerPet(l,a,s){let i=dl(l,a);if(i!==null)return R(i);let d=Od(a);if("error"in d)return R(d.error);let u={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(l)}`,body:d.body},f=await e.send("pets.registerPet",s?.signal?{...u,signal:s.signal}:u);return f.ok?D(ul(f.value,l)):R(f.error)},async updatePet(l,a,s){let i=n(l);if(typeof i!="string")return R(i);let d=Id(a);if("error"in d)return R(d.error);let c=await e.send("pets.updatePet",r({method:"PATCH",path:i,body:d.body},s?.signal));return c.ok?D(ul(c.value,l)):R(c.error)},async getPetProfile(l,a){let s=n(l);if(typeof s!="string")return R(s);let i=await e.send("pets.getPetProfile",r({method:"GET",path:`${s}/profile`},a?.signal));if(!i.ok)return R(i.error);let d=Ad(i.value);return d===null?R(Se("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):D(d)},async deletePet(l,a){let s=n(l);if(typeof s!="string")return R(s);let i=await e.send("pets.deletePet",r({method:"DELETE",path:s},a?.signal));return i.ok?D(void 0):R(i.error)},async eraseUserData(l){let a=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},l?.signal),{maxAttempts:1});return a.ok?D(void 0):R(a.error)}}}o(Ld,"createPetsRepositoryOver");function gr(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=We(),l=useMemo(()=>bl(e.registry.services.authFor(t)),[e,t,n]),[a,s]=useState({repository:l,pets:[],loading:true,error:null}),i=a.repository===l?a:{pets:[],loading:true,error:null},d=useRef(0),c=useCallback(async()=>{let f=++d.current;s(m=>({...m,repository:l,loading:true,error:null,pets:m.repository===l?m.pets:[]}));let y=await l.list();f===d.current&&s(y.ok?{repository:l,pets:y.value,loading:false,error:null}:m=>({repository:l,pets:m.repository===l?m.pets:[],loading:false,error:y.error}));},[l]);useEffect(()=>(c(),()=>{d.current+=1;}),[c]);let u=useMemo(()=>r===null?null:i.pets.find(f=>f.petRef===r)??null,[r,i.pets]);return useMemo(()=>({pets:i.pets,activePet:u,loading:i.loading,error:i.error,refresh:c}),[i.pets,i.loading,i.error,u,c])}o(gr,"useEverfurPets");var At=Object.freeze(["pet","issues","reason","clinician","time","review","booked"]),hl=Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function Pn(e,t={}){let r=Object.freeze({...hl,...t}),n=Rn(0,e);return Object.freeze({index:n,draft:r,furthestIndex:n})}o(Pn,"initialTelevetBookingState");function vr(e,t){return e==="pet"?t.ownedPetCount<=1:e==="issues"?t.withIssues!==true:false}o(vr,"isSkipped");function br(e){return At[e]}o(br,"stepAt");function Rn(e,t){for(let r=e;r<At.length;r+=1){let n=br(r);if(n&&!vr(n,t))return r}return At.length-1}o(Rn,"nextVisible");function Tl(e,t){for(let r=e;r>=0;r-=1){let n=br(r);if(n&&!vr(n,t))return r}return null}o(Tl,"previousVisible");function wn(e,t){return Tl(e.index-1,t)!==null}o(wn,"hasPreviousStep");function In(e,t,r){switch(t.type){case "patch":{let n={...e.draft,...t.patch};return ("petId"in t.patch&&t.patch.petId!==e.draft.petId||"state"in t.patch&&t.patch.state!==e.draft.state||"clinicianId"in t.patch&&t.patch.clinicianId!==e.draft.clinicianId)&&e.draft.slot?Object.freeze({...e,draft:Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):Object.freeze({...e,draft:Object.freeze(n)})}case "next":{let n=Rn(e.index+1,r);return Object.freeze({...e,index:n,furthestIndex:Math.max(e.furthestIndex,n)})}case "back":{if(br(e.index)==="booked")return e;let n=Tl(e.index-1,r);return n===null?e:Object.freeze({...e,index:n})}case "goTo":{let n=At.indexOf(t.step);if(n<0)return e;let l=vr(t.step,r)?Rn(n,r):n;return Object.freeze({...e,index:l,furthestIndex:Math.max(e.furthestIndex,l)})}default:return e}}o(In,"televetBookingReducer");function On(e){return br(e.index)??"pet"}o(On,"currentStep");function Bt(e,t){let r=t.trim();return !!e.petId&&!!e.clinicianId&&!!e.slot&&Ee(e.state)&&r.length>0&&r.length<=Fe}o(Bt,"canConfirm");function An(e,t){if(!e.holdExpiresAt)return false;let r=Date.parse(e.holdExpiresAt);return Number.isNaN(r)?false:r<=t}o(An,"isHoldExpired");function Bn(e){return `televet.book.${e}`}o(Bn,"televetBookingKey");function Ln(e,t,r){let n=r?.version?.trim()??"";return !e||!t||n.length===0?Object.freeze({}):Object.freeze({state_attested:true,cancellation_policy_version:n})}o(Ln,"attestation");var zd=Object.freeze([{id:"itchy-skin",label:"Itchy skin and allergies"},{id:"upset-stomach",label:"Upset stomach"},{id:"ear-infections",label:"Ear infections"},{id:"anxiety",label:"Anxiety and behavior"},{id:"parasites",label:"Fleas, ticks, and heartworm"},{id:"joint-pain",label:"Joint pain and mobility"},{id:"eye-issues",label:"Eye issues"},{id:"urinary",label:"Urinary issues"},{id:"surgery-aftercare",label:"Surgery aftercare"},{id:"senior-dog-care",label:"Senior dog care",species:"dog"}]),jd="other";function Hd(e){let t=e?.trim().toLowerCase()??"";return t.startsWith("dog")?"dog":t.startsWith("cat")?"cat":null}o(Hd,"televetIssueSpecies");function Sl(e){let t=Hd(e),r=zd.filter(n=>!n.species||n.species===t).map(({id:n,label:l})=>Object.freeze({id:n,label:l}));return Object.freeze([...r,Object.freeze({id:jd,label:p.otherIssue})])}o(Sl,"televetIssueChips");function El(e,t){let r=e.filter(l=>l.trim().length>0),n=t.trim();return r.length===0?n:n.length===0?r.join(", "):`${r.join(", ")}
2
+ ${n}`}o(El,"composeTelevetReason");function Ae(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}o(Ae,"parse");function st(e){let t=Ae(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}o(st,"formatClock");function Vd(e){let t=Ae(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}o(Vd,"formatDate");var dt=10;function ut(e){let t=Ae(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??"":""}o(ut,"formatZone");function Ud(e){let t=Ae(e);if(!t)return "";let r=new Date(t.getTime()+dt*6e4).toISOString(),n=ut(e),l=`${st(e)} - ${st(r)}`;return n&&n!==""?`${l} ${n}`:l}o(Ud,"formatVisitRange");function Cl(e){let t=Vd(e),r=[st(e),ut(e)].filter(Boolean).join(" ");return [t,r].filter(Boolean).join(", ")}o(Cl,"formatWhen");function be(e){let t=Ae(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),Cl(e)].filter(Boolean).join(", "):""}o(be,"formatWhenWithDay");function kl(e){let t=Ae(e);if(!t)return "";let r=t.toLocaleString(void 0,{weekday:"short",day:"numeric",month:"short",hour:"numeric",minute:"2-digit"}),n=ut(e);return n?`${r} ${n}`:r}o(kl,"formatShortDateTimeWithZone");function xl(e){return [st(e),ut(e)].filter(Boolean).join(" ")}o(xl,"formatClockWithZone");function hr(e){let t=Ae(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}o(hr,"localDayKey");function _l(e){let t=Ae(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}o(_l,"formatMonthLabel");function Rl(e){let t=Ae(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}o(Rl,"formatFullDayLabel");function wl(e){let{draft:t,reasonText:r,book:n,stateAttested:l,termsAttested:a,cancellationPolicy:s,triage:i,goTo:d,setFailure:c,setRateLimitMessage:u,setEmergency:f,setBookedConsult:y,onBooked:m}=e,b=useCallback(S=>{if(!(!Bt(t,r)||!t.idempotencyKey)){if(An(t,Date.now())){c("expired"),d("time");return}c(null),f(null),n.mutate({pet_id:t.petId,clinician_id:t.clinicianId,slot_id:t.slot.slotId,state:t.state,reason_text:r.trim(),species:null,media_refs:[],emergency_acknowledged:S||i.isAcknowledged(r),share_health_records:t.shareHealthRecords,...Ln(l,a,s)},t.idempotencyKey,{onSuccess:o(C=>{y(C),d("booked"),m?.(C);},"onSuccess"),onError:o(C=>{let E=Oe(C);if(E.kind==="emergency"){f(E.categories);return}if(E.kind==="rate_limited"){u(E.message),c("rate_limited");return}c(E.kind==="not_entitled"?"not_entitled":E.kind==="slot_taken"?"taken":E.kind==="clinician_unavailable"?"clinician_unavailable":E.kind==="unavailable"?"unavailable":"failed"),E.kind==="slot_taken"&&d("time");},"onError")});}},[t,r,n,l,a,s,i,d,c,u,f,y,m]),h=useCallback(()=>b(false),[b]);return {submitBooking:b,confirm:h}}o(wl,"useBookingSubmit");function Nn(e){return Object.freeze(e==="dark"?{title:oe.noCliniciansTitle,message:oe.noCliniciansBody,retryLabel:oe.noCliniciansRetryCta,interestReason:null}:{title:oe.noCliniciansTitle,message:oe.noCliniciansRegionBody,retryLabel:null,interestReason:"no_licensed_vet"})}o(Nn,"televetEmptyRosterView");function Fn(e){return e?"roster":"dark"}o(Fn,"televetEmptyRosterCause");var Lt=Object.freeze({failed:0,refused:Object.freeze({size:0,type:0,unreadable:0})});function Dn(e){let{failed:t,refused:r}=e;return t<=0&&r.size<=0&&r.type<=0&&r.unreadable<=0}o(Dn,"isMediaShortfallEmpty");function Mn(e){let t=o(n=>Number.isFinite(n)&&n>0?Math.floor(n):0,"count"),r=oe.media;return [{n:t(e.failed),one:r.droppedTemplate,many:r.droppedPluralTemplate},{n:t(e.refused.size),one:r.refusedSizeTemplate,many:r.refusedSizePluralTemplate},{n:t(e.refused.type),one:r.refusedTypeTemplate,many:r.refusedTypePluralTemplate},{n:t(e.refused.unreadable),one:r.refusedUnreadableTemplate,many:r.refusedUnreadablePluralTemplate}].filter(n=>n.n>0).map(n=>G(n.n===1?n.one:n.many,{n:String(n.n)}))}o(Mn,"televetMediaShortfallLines");function Tr(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return t===0?Lt:Object.freeze({failed:t,refused:Lt.refused})}o(Tr,"mediaShortfallFromUnsentPicks");function Wd(e,t){let r=Tr(t);return r.failed===0?e:Object.freeze({failed:e.failed+r.failed,refused:e.refused})}o(Wd,"withUnsentPicks");function Hn(e){let[t,r]=useState(false),[n,l]=useState(false),[a,s]=useState(null),i=useRef(null),d=useRef(null),c=useRef(true);useEffect(()=>(c.current=true,()=>{c.current=false,d.current?.abort(),d.current=null;}),[]);let u=useCallback(()=>{d.current?.abort(),d.current=null,c.current&&l(false);},[]),f=useCallback(async S=>{if(d.current!==null)return false;let C=S.trim();if(a!==null&&a===C||!e)return true;let E=i.current!==null&&i.current.reason===C?i.current.emergency:null;if(E===null){let k=new AbortController;d.current=k,l(true);try{let A=await e(C,k.signal);if(k.signal.aborted||!c.current)return !1;A===null?E=!1:(E=A.isEmergency||A.fallback,i.current=Object.freeze({reason:C,emergency:E}));}catch{if(k.signal.aborted||!c.current)return false;E=false;}finally{d.current===k&&(d.current=null,c.current&&l(false));}}return E===true?(r(true),false):true},[a,e]),y=useCallback(S=>{s(S.trim()),r(false);},[]),m=useCallback(()=>r(false),[]),b=useCallback(()=>{u(),i.current=null,s(null),r(false);},[u]),h=useCallback(S=>a!==null&&a===S.trim(),[a]);return {open:t,checking:n,check:f,acknowledge:y,close:m,cancel:u,reset:b,isAcknowledged:h}}o(Hn,"useEarlyTriage");function Gd(e){let t=e?.trim().toUpperCase()??"";return /^[A-Z]{2}$/.test(t)?t:null}o(Gd,"normalizeStateCode");function Vn(e,t){let r=Gd(e),[n,l]=useState(()=>Object.freeze({})),a=useRef(0),s=useRef(null),i=useCallback(d=>{if(!t||r===null)return null;let c=`${r}:${d}`;s.current!==null&&s.current!==c&&(a.current+=1),s.current=c;let u=n[c]??"idle";return {joined:u==="joined",pending:u==="pending",failed:u==="failed",onPress:o(()=>{if(u==="pending"||u==="joined")return;let f=a.current+=1;l(y=>Object.freeze({...y,[c]:"pending"})),(async()=>{let y=false;try{y=await t(r,d);}catch{y=false;}a.current===f&&l(m=>Object.freeze({...m,[c]:y?"joined":"failed"}));})();},"onPress")}},[r,n,t]);return useMemo(()=>({actionFor:i}),[i])}o(Vn,"useStateInterest");var pt=2;function Ol(e){return typeof e!="number"||!Number.isInteger(e)?pt:e<1?1:e>6?6:e}o(Ol,"headingLevel");function Nt(e){return e>=6?6:e+1}o(Nt,"nextHeadingLevel");function ie(e){return `h${String(e)}`}o(ie,"headingTag");var Qd=Nt(pt),Un=createContext(Qd);function ye(){return useContext(Un)}o(ye,"useNestedHeadingLevel");function Zd(e,t){if(e===void 0)return {};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}o(Zd,"slotBox");function Al(e){return e?.textColor===void 0?{}:{color:e.textColor}}o(Al,"slotText");function Bl(e,t){let r=Zd(e,t),n={};return r.backgroundColor!==void 0&&(n.backgroundColor=r.backgroundColor),r.borderColor!==void 0&&(n.border=`${r.borderWidth??1}px solid ${r.borderColor}`),r.borderRadius!==void 0&&(n.borderRadius=r.borderRadius),n}o(Bl,"slotBoxCss");var le=44;function F(){let e=x();return useMemo(()=>tu(e),[e])}o(F,"useBookingStyles");function P({label:e,onPress:t,kind:r="primary",disabled:n=false,loading:l=false,fullWidth:a=true,accessibilityLabel:s,describedBy:i,testID:d,style:c}){let u=F(),f=n||l;return jsx("button",{type:"button",onClick:t,disabled:f,"aria-busy":l||void 0,...s&&s!==e?{"aria-label":s}:{},...i?{"aria-describedby":i}:{},"data-testid":d,style:{...u.button,...r==="primary"?u.buttonPrimary:r==="danger"?u.buttonDanger:u.buttonSecondary,...a?u.buttonFull:u.buttonAuto,...f?u.buttonDisabled:null,...c},children:e})}o(P,"TelevetButton");function $({title:e,message:t,actionLabel:r,onAction:n,testID:l}){let a=F(),s=ie(ye()),i=typeof r=="string"&&r.length>0&&typeof n=="function";return jsxs("div",{style:a.stateCard,"data-testid":l,children:[jsx(s,{style:a.stateTitle,children:e}),t?jsx("p",{style:a.stateMessage,children:t}):null,i?jsx(P,{label:r,onPress:n,kind:"secondary",fullWidth:false}):null]})}o($,"TelevetStateCard");function ae({height:e,width:t="100%",testID:r}){let n=F();return jsx("span",{"aria-hidden":"true","data-testid":r,style:{...n.skeleton,height:e,width:t}})}o(ae,"TelevetSkeletonBlock");function q({message:e,assertive:t=false,testID:r,style:n}){let l=F();return jsx("p",{role:t?"alert":"status","data-testid":r,style:{...l.failure,...n},children:e})}o(q,"TelevetFailureLine");function tu(e){let{color:t,space:r,radius:n,type:l,slots:a}=e,{size:s,lineHeight:i}=l,d=o(c=>`${String(c)}px`,"rem");return {screen:{...at,display:"flex",flexDirection:"column",minHeight:0,flex:"1 1 auto",gap:d(r.md),paddingLeft:d(r.xl),paddingRight:d(r.xl),boxSizing:"border-box"},stepFill:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,gap:d(r.md)},list:{display:"flex",flexDirection:"column",gap:d(r.sm)},button:{minHeight:le,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:d(r.sm),paddingLeft:d(r.xl),paddingRight:d(r.xl),paddingTop:d(r.sm),paddingBottom:d(r.sm),borderRadius:d(n.pill),borderStyle:"solid",borderWidth:0,cursor:"pointer",textAlign:"center",...v(e,"medium"),fontSize:d(s.body),lineHeight:String(i.snug),boxSizing:"border-box"},buttonFull:{alignSelf:"stretch",width:"100%"},buttonAuto:{alignSelf:"flex-start",minWidth:le},buttonPrimary:{backgroundColor:t.primary,color:t.onPrimary,...Bl(a.primaryButton),...Al(a.primaryButton)},buttonSecondary:{borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",color:t.brand,...a.primaryButton?.borderRadius===void 0?null:{borderRadius:d(a.primaryButton.borderRadius)},...a.primaryButton?.borderColor===void 0?null:{borderColor:a.primaryButton.borderColor}},buttonDanger:{backgroundColor:t.danger,color:t.onPrimary},buttonDisabled:{opacity:.45,cursor:"not-allowed"},stateCard:{minHeight:140,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:d(r.sm),padding:d(r.lg),borderRadius:d(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,boxSizing:"border-box"},stateTitle:{margin:0,...v(e,"medium"),color:t.brand,fontSize:d(s.subtitle),lineHeight:String(i.snug)},stateMessage:{margin:0,...v(e,"regular"),color:t.text.metaCool,fontSize:d(s.body),lineHeight:String(i.normal)},skeleton:{display:"block",borderRadius:d(n.md),backgroundColor:t.skeleton,flexShrink:0},failure:{margin:0,...v(e,"regular"),color:t.danger,fontSize:d(s.caption),lineHeight:String(i.normal)},stepTitle:{margin:0,...v(e,"bold"),color:t.brand,fontSize:d(s.verdict),lineHeight:String(i.snug),textAlign:"center"},stepHelp:{margin:0,...v(e,"regular"),color:t.text.metaCool,fontSize:d(s.body),lineHeight:String(i.normal),textAlign:"center"},divider:{height:1,backgroundColor:t.brandBorder,flexShrink:0},scrollRoot:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0},scrollBody:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},scrollFooter:{flexShrink:0,paddingTop:d(r.md),paddingBottom:d(r.lg)}}}o(tu,"makeBookingStyles");function Er({petName:e,primaryVet:t,onFindEmergencyVet:r}){return r?true:t!=null&&(e?.trim()??"").length>0}o(Er,"hasTelevetEmergencyExit");function Ft({petName:e,primaryVet:t,onFindEmergencyVet:r,testIDPrefix:n}){let l=x(),a=useMemo(()=>au(l),[l]),s=e?.trim()??"",i=`${useId()}-primary-vet-hint`;return jsxs("div",{style:a.exits,"data-testid":`${n}-exits`,children:[r?jsx("button",{type:"button",onClick:()=>{Yt(r);},style:{...a.card,...a.cardButton},"data-testid":`${n}-find-vet`,children:jsx("span",{style:a.title,children:ot.findEmergencyVet})}):null,null,t!=null&&s.length>0?jsx(iu,{petName:s,vet:t,hintId:i,local:a,testIDPrefix:n}):null]})}o(Ft,"TelevetEmergencyExits");function iu({petName:e,vet:t,hintId:r,local:n,testIDPrefix:l}){let a=G(p.emergency.exitPrimaryVetTitle,{petName:e}),s=t.detail?.trim()??"",i=jsxs("span",{style:n.text,children:[jsx("span",{style:n.title,children:a}),s.length>0?jsx("span",{style:n.detail,children:s}):null]});if(!t.dial)return jsx("div",{style:n.card,"data-testid":`${l}-primary-vet`,children:i});let d=t.dial;return jsxs("button",{type:"button",onClick:()=>{Yt(d);},"aria-label":s.length>0?`${a}, ${s}`:a,"aria-describedby":r,style:{...n.card,...n.cardButton},"data-testid":`${l}-primary-vet-call`,children:[i,jsx("span",{id:r,style:lu,children:p.emergency.startCallHint})]})}o(iu,"PrimaryVetCard");var lu=Object.freeze({position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0});function au(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l;return {exits:{display:"flex",flexDirection:"column",gap:r.sm},card:{display:"flex",alignItems:"center",gap:r.sm,minHeight:le,padding:r.lg,borderRadius:n.md,border:`1px solid ${t.brandBorder}`,background:t.surface,color:t.text.primary,textAlign:"start",textDecoration:"none",boxSizing:"border-box"},cardButton:{width:"100%",cursor:"pointer",font:"inherit",position:"relative"},text:{display:"flex",flexDirection:"column",gap:r.xs,flexShrink:1},title:{...v(e,"medium"),color:t.text.primary,fontSize:a.body,lineHeight:`${String(a.body*s.normal)}px`},detail:{...v(e,"regular"),color:t.text.metaCool,fontSize:a.caption,lineHeight:`${String(a.caption*s.normal)}px`}}}o(au,"makeExitStyles");function Nl({petName:e,primaryVet:t,onFindEmergencyVet:r,onContinue:n}){let l=x(),a=F(),s=useMemo(()=>qn(l),[l]),i=ie(ye()),d=Er({petName:e,primaryVet:t,onFindEmergencyVet:r})?p.emergency.lede:p.emergency.ledeWithoutExits;return jsxs("section",{role:"alert",style:{...a.stepFill,...s.emergencyPanel},"data-testid":"televet-early-emergency",children:[jsx(i,{style:s.emergencyTitle,children:p.emergency.bannerTitle}),jsx("p",{style:s.emergencyLede,children:d}),jsx(Ft,{petName:e,primaryVet:t,onFindEmergencyVet:r,testIDPrefix:"televet-early-emergency"}),jsx(P,{label:p.emergency.keepBookingCta,kind:"secondary",onPress:n,testID:"televet-early-emergency-continue"})]})}o(Nl,"TelevetEarlyEmergency");function $n({action:e,testIDPrefix:t}){let r=x(),n=useMemo(()=>qn(r),[r]),l=ie(ye());return e===null?null:e.joined?jsxs("div",{role:"status","data-testid":`${t}-joined`,style:n.interestFeedback,children:[jsx(l,{style:n.interestJoinedTitle,children:p.stateInterest.joinedTitle}),jsx("p",{style:n.interestBody,children:p.stateInterest.joinedBody})]}):jsxs("div",{"data-testid":t,style:n.interestAction,children:[jsx(P,{label:e.pending?p.stateInterest.submitting:p.stateInterest.cta,kind:"secondary",loading:e.pending,disabled:e.pending,onPress:e.onPress,testID:`${t}-submit`}),e.failed?jsx(q,{message:p.stateInterest.failed,assertive:true,testID:`${t}-error`}):null]})}o($n,"TelevetStateInterestAction");function Fl({cause:e,onRetry:t,stateInterest:r=null}){let n=Nn(e);return jsxs("div",{"data-testid":"televet-clinicians-empty",children:[jsx($,{title:n.title,message:n.message,...n.retryLabel!==null&&t?{actionLabel:n.retryLabel,onAction:t}:{}}),n.interestReason!==null?jsx($n,{action:r??null,testIDPrefix:"televet-state-interest-no-licensed-vet"}):null]})}o(Fl,"TelevetClinicianEmptyState");function su({onCheckAvailability:e}){return jsx(Kn,{...e?{onCheckAvailability:e}:{}})}o(su,"TelevetEntitlementInterestState");function Kn({onCheckAvailability:e,renderUnavailable:t}){let r=F();return jsxs("div",{"data-testid":"televet-booking-not-entitled",style:r.list,children:[t?t():jsx($,{title:p.bookingPausedTitle}),e?jsx(P,{label:p.checkAvailabilityCta,kind:"secondary",onPress:e,testID:"televet-check-state-availability"}):null]})}o(Kn,"EntitlementPausedState");function Dt({shortfall:e,testIDPrefix:t}){let r=x(),n=useMemo(()=>qn(r),[r]);if(Dn(e))return null;let l=Mn(e);return l.length===0?null:jsx("ul",{role:"status",style:n.mediaNotice,"data-testid":`${t}-media-notice`,children:l.map((a,s)=>jsx("li",{style:n.mediaLine,"data-testid":`${t}-media-line-${String(s)}`,children:a},a))})}o(Dt,"TelevetMediaDropNotice");function qn(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l;return {emergencyPanel:{display:"flex",flexDirection:"column",gap:r.sm,padding:r.lg,borderRadius:n.lg,border:`2px solid ${t.danger}`,background:t.surface},emergencyTitle:{...v(e,"medium"),margin:0,color:t.danger,fontSize:a.heading,lineHeight:`${String(a.heading*s.snug)}px`},emergencyLede:{...v(e,"regular"),margin:0,color:t.text.primary,fontSize:a.subtitle,lineHeight:`${String(a.subtitle*s.normal)}px`},interestAction:{display:"flex",flexDirection:"column",gap:r.sm,marginTop:r.sm},interestFeedback:{display:"flex",flexDirection:"column",gap:r.xs,marginTop:r.sm},interestJoinedTitle:{...v(e,"medium"),margin:0,color:t.brand,fontSize:a.body,lineHeight:`${String(a.body*s.snug)}px`},interestBody:{...v(e,"regular"),margin:0,color:t.text.metaCool,fontSize:a.body,lineHeight:`${String(a.body*s.normal)}px`},mediaNotice:{display:"flex",flexDirection:"column",gap:r.xs,margin:0,padding:0,listStyle:"none"},mediaLine:{...v(e,"regular"),color:t.text.metaCool,fontSize:a.caption,lineHeight:`${String(a.caption*s.normal)}px`}}}o(qn,"makeEdgeStyles");function Dl(e){let{surfaceUnavailable:t,notEntitled:r,policyBlocked:n,triageOpen:l,step:a}=e;return t||r&&a!=="clinician"||n?true:a==="reason"&&l}o(Dl,"televetBookingGateApplies");function Ml({state:e,petName:t,primaryVet:r,onFindEmergencyVet:n,stateInterest:l=null,onCheckAvailability:a,onAcknowledgeEmergency:s,renderUnavailable:i}){let d=F(),{surfaceUnavailable:c,notEntitled:u,policyBlocked:f,triageOpen:y,step:m}=e;return c?jsx("div",{style:d.stepFill,"data-testid":"televet-booking-unavailable",children:i?i():jsx($,{title:p.bookingPausedTitle})}):u&&m!=="clinician"?jsx(Kn,{...a?{onCheckAvailability:a}:{},...i?{renderUnavailable:i}:{}}):f?jsxs("div",{"data-testid":"televet-booking-state-blocked",children:[jsx($,{title:p.stateBlockedTitle}),jsx($n,{action:l,testIDPrefix:"televet-state-interest-state-blocked"})]}):m==="reason"&&y?jsx(Nl,{...t!==void 0?{petName:t}:{},...r?{primaryVet:r}:{},onFindEmergencyVet:n,onContinue:s}):null}o(Ml,"TelevetBookingGate");function zl(e){return e.noState?true:e.isPending||e.isError?false:e.isEmpty||e.notEntitled}o(zl,"televetClinicianOutcomeApplies");function jl({state:e,cause:t,locationStatus:r,onRequestLocation:n,onRetry:l,stateInterest:a=null,renderUnavailable:s}){return e.noState?jsx("div",{"data-testid":"televet-booking-location-unknown",children:jsx($,{title:r==="blocked"?p.locationBlockedTitle:r==="unavailable"?p.locationUnavailableTitle:p.locationUnknownTitle,message:r==="blocked"?p.locationBlockedBody:r==="unavailable"?p.locationUnavailableBody:p.locationUnknownBody,actionLabel:n&&r!=="blocked"?p.locationUnknownCta:void 0,onAction:r==="blocked"?void 0:n})}):e.isEmpty?jsx(Fl,{cause:t,onRetry:l,stateInterest:a}):jsx(Kn,{...s?{renderUnavailable:s}:{}})}o(jl,"TelevetClinicianOutcome");function Hl(e){return `televet-consult-${e}`}o(Hl,"televetConsultCalendarKey");function Gn({consult:e,petName:t,onDone:r,onAddToCalendar:n,canJoinInApp:l=false}){let a=x(),s=F(),i=useMemo(()=>pu(a),[a]),d=`${useId()}-booked-title`,c=ie(ye()),[u,f]=useState("idle"),y=o(async()=>{if(!n)return;f("saving");let b=new Date(e.scheduledAt);if(Number.isNaN(b.getTime())){f("failed");return}let h=await Gt(n,{key:Hl(e.consultId),title:p.visit.title,startDate:b,endDate:new Date(b.getTime()+dt*6e4),alarmOffsetMinutes:-30});f(h.ok&&h.value===true?"saved":"failed");},"addToCalendar"),m=[p.booked.remindPromise,G(p.booked.summaryPromise,{pet:t??""}),...l?[p.booked.joinPromise]:[]];return we()?jsxs("section",{style:i.screen,"aria-labelledby":d,"data-testid":"televet-booked",children:[jsx("div",{style:i.header,children:jsx(P,{label:p.doneCta,kind:"secondary",fullWidth:false,onPress:r,testID:"televet-booked-done"})}),jsx("div",{"aria-hidden":"true",style:i.avatar}),jsx(c,{id:d,style:i.title,children:e.clinicianName?G(p.bookedHeadingTemplate,{vet:e.clinicianName}):p.bookedTitle}),jsx("p",{style:i.when,children:jsx("time",{dateTime:e.scheduledAt,children:be(e.scheduledAt)})}),jsx("ol",{style:i.steps,"data-testid":"televet-booked-steps",children:m.map((b,h)=>jsxs("li",{style:i.step,children:[jsx("span",{"aria-hidden":"true",style:i.stepNumber,children:String(h+1)}),jsx("span",{style:i.stepText,children:b.trim()})]},b))}),jsxs("div",{style:i.actions,children:[n?jsx(P,{label:u==="saved"?p.booked.calendarAdded:p.addToCalendarCta,kind:"primary",loading:u==="saving",disabled:u==="saving"||u==="saved",onPress:()=>{y();},testID:"televet-booked-calendar"}):null,u==="failed"?jsx("p",{role:"status",style:{...s.failure,...i.calendarNote},"data-testid":"televet-booked-calendar-failed",children:p.booked.calendarFailedBody}):null,jsx(P,{label:t?G(p.booked.backToPet,{pet:t}):p.doneCta,kind:"secondary",onPress:r,testID:"televet-booked-back"})]})]}):jsx("div",{style:i.screen,"data-testid":"televet-booked-copy-unapproved"})}o(Gn,"TelevetBookedScreen");function pu(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l,i=o(d=>`${String(d)}px`,"rem");return {screen:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,gap:i(r.md),paddingLeft:i(r.xl),paddingRight:i(r.xl),boxSizing:"border-box"},header:{display:"flex",justifyContent:"flex-end",paddingBottom:i(r.lg)},avatar:{alignSelf:"center",width:120,height:120,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,borderStyle:"solid",borderWidth:2,borderColor:t.success,boxSizing:"border-box"},title:{margin:0,textAlign:"center",...v(e,"bold"),color:t.brand,fontSize:i(a.verdict),lineHeight:String(s.tight),letterSpacing:"-0.7px",paddingTop:i(r.lg)},when:{margin:0,textAlign:"center",...v(e,"regular"),color:t.text.metaCool,fontSize:i(a.subtitle),lineHeight:String(s.normal)},steps:{listStyle:"none",margin:0,marginTop:i(r.xl),padding:i(r.lg),borderRadius:i(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,display:"flex",flexDirection:"column",gap:i(r.lg),boxSizing:"border-box"},step:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:i(r.md)},stepNumber:{width:26,height:26,flexShrink:0,borderRadius:"50%",backgroundColor:t.primary,display:"inline-flex",alignItems:"center",justifyContent:"center",...v(e,"medium"),color:t.onPrimary,fontSize:i(a.caption),lineHeight:"1"},stepText:{flex:"1 1 auto",minWidth:0,...v(e,"regular"),color:t.brand,fontSize:i(a.body),lineHeight:String(s.normal)},actions:{marginTop:"auto",paddingBottom:i(r.xl),display:"flex",flexDirection:"column",gap:i(r.md)},calendarNote:{textAlign:"center"}}}o(pu,"makeStyles");function Vl(){let e=[];return {register(t){return e=[...e,t],()=>{e=e.filter(r=>r!==t);}},dispatch(){for(let t of [...e].reverse())try{if(t())return !0}catch{}return false}}}o(Vl,"createTelevetBackChannel");var Jn=createContext(null);function Cr(e,t=true){let r=useContext(Jn),n=useRef(e);n.current=e,useEffect(()=>{if(!(r===null||!t))return r.register(()=>n.current())},[r,t]);}o(Cr,"useTelevetBackChannel");var mt=Object.freeze({position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0});var Wl='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function $l(e){return e.tagName==="DIALOG"}o($l,"isDialogElement");function xr(e,t,r){let n=useRef(null),l=useRef(false),a=useRef(null),s=useRef(r);s.current=r;let i=useCallback(()=>{if(!l.current)return;l.current=false;let u=s.current===void 0?a.current:s.current.current;a.current=null,u&&u.isConnected&&u.focus();},[]);useEffect(()=>{if(!e){i();return}if(!l.current){let y=typeof document>"u"?null:document.activeElement;a.current=y instanceof HTMLElement?y:null;}l.current=true;let u=n.current;if(u===null)return;if(!$l(u)){u.contains(document.activeElement)||(u.querySelector(Wl)??u).focus();return}let f=u;typeof f.showModal=="function"?f.open||f.showModal():f.setAttribute("open","");},[e,i]),useEffect(()=>i,[i]);let d=useCallback(u=>{let f=n.current;if(f===null)return;if(u.key==="Escape"&&!$l(f)){u.preventDefault(),u.stopPropagation(),t();return}if(u.key!=="Tab")return;let y=Array.from(f.querySelectorAll(Wl)),m=y[0],b=y[y.length-1];if(!m||!b){u.preventDefault();return}let h=document.activeElement;u.shiftKey&&(h===m||!f.contains(h))?(u.preventDefault(),b.focus()):!u.shiftKey&&(h===b||!f.contains(h))&&(u.preventDefault(),m.focus());},[t]),c=useCallback(u=>{u.preventDefault(),t();},[t]);return {dialogRef:n,onKeyDown:d,onCancel:c}}o(xr,"useModalDialog");var Qn=["pet","issues","reason","triage","clinician","time","review","booked"];function Zn({step:e,furthestIndex:t,title:r,canGoBack:n,isDirty:l,onBack:a,onClose:s,onConfirmDiscard:i,headingLevel:d=pt,triageOpen:c=false}){let u=x(),f=useMemo(()=>Yl(u),[u]),[y,m]=useState(false),b=useRef(null),S=`${useId()}-close-hint`,C=ie(d);useEffect(()=>{if(!l||typeof window>"u")return;let V=o(L=>{L.preventDefault(),L.returnValue="";},"onBeforeUnload");return window.addEventListener("beforeunload",V),()=>window.removeEventListener("beforeunload",V)},[l]);let E=useCallback(()=>{if(!l){s();return}let V={title:p.chrome.discardTitle,body:p.chrome.discardBody,confirmLabel:p.chrome.discardConfirmCta,keepLabel:p.chrome.discardKeepCta};if(i){Promise.resolve(i(V)).then(L=>{L&&s();},()=>{});return}m(true);},[l,s,i]);Cr(()=>(E(),true));let k=Qn.length,A=Qn.indexOf(e==="reason"&&c?"triage":e)+1;return jsxs("div",{style:f.wrap,children:[jsxs("header",{style:f.bar,children:[jsx("div",{style:f.side,children:n?jsx("button",{type:"button",onClick:a,"data-testid":"televet-booking-back",style:{...f.tap,...f.back},children:p.backLabel}):null}),jsx(C,{style:mt,children:r??p.navTitle}),jsxs("div",{style:f.progress,children:[jsx("p",{style:mt,"data-testid":"televet-booking-progress-label",children:G(p.loading.progressTemplate,{step:String(A),total:String(k)})}),jsx("div",{"aria-hidden":"true",style:f.segments,"data-testid":"televet-booking-rail",children:Qn.map((V,L)=>jsx("span",{"data-lit":L<A?"true":"false",style:{...f.segment,...L<A?f.segmentLit:null}},V))})]}),jsxs("div",{style:{...f.side,...f.sideRight},children:[jsx("button",{type:"button",ref:b,onClick:E,"aria-label":p.close,"aria-describedby":S,"data-testid":"televet-booking-close",style:{...f.tap,...f.closeTap},children:jsx("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}),jsx("span",{id:S,style:mt,children:p.chrome.closeHint})]})]}),y?jsx(Su,{onKeep:()=>m(false),onLeave:()=>{m(false),s();},returnFocusTo:b}):null]})}o(Zn,"TelevetBookingChrome");function Su({onKeep:e,onLeave:t,returnFocusTo:r}){let n=x(),l=useMemo(()=>Yl(n),[n]),{dialogRef:a,onKeyDown:s,onCancel:i}=xr(true,e,r),d=useId(),c=`${d}-discard-title`,u=`${d}-discard-body`;return jsxs("dialog",{ref:a,onKeyDown:s,onCancel:i,"aria-labelledby":c,"aria-describedby":u,"data-testid":"televet-booking-discard",style:l.dialog,children:[jsx("h2",{id:c,style:l.dialogTitle,children:p.chrome.discardTitle}),jsx("p",{id:u,style:l.dialogBody,children:p.chrome.discardBody}),jsxs("div",{style:l.dialogActions,children:[jsx(P,{label:p.chrome.discardKeepCta,onPress:e,kind:"primary",fullWidth:false,testID:"televet-booking-discard-keep"}),jsx(P,{label:p.chrome.discardConfirmCta,onPress:t,kind:"secondary",fullWidth:false,testID:"televet-booking-discard-leave"})]})]})}o(Su,"DiscardDialog");var Eu="Back";function Yl(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l,i=o(c=>`${String(c)}px`,"rem"),d={background:"transparent",borderStyle:"none",padding:0,cursor:"pointer"};return {wrap:{backgroundColor:t.surface,flexShrink:0},bar:{display:"flex",flexDirection:"row",alignItems:"center",paddingLeft:i(r.lg),paddingRight:i(r.lg),minHeight:56,boxSizing:"border-box"},side:{width:64,flexShrink:0,display:"flex",alignItems:"center"},sideRight:{justifyContent:"flex-end"},tap:{...d,minHeight:le,minWidth:le,display:"inline-flex",alignItems:"center",justifyContent:"center"},closeTap:{justifyContent:"flex-end",color:t.text.primary},back:{...v(e,"bold"),color:t.brand,fontSize:i(a.body),paddingLeft:i(r.sm),paddingRight:i(r.sm)},progress:{flex:"1 1 auto",minWidth:0,display:"flex",justifyContent:"center"},segments:{display:"flex",alignItems:"center",gap:i(r.xs),width:"100%",maxWidth:480},segment:{display:"block",flex:"1 1 0",height:3,borderRadius:i(n.pill),backgroundColor:t.brandBorder},segmentLit:{backgroundColor:t.success},dialog:{margin:"auto",maxWidth:420,width:"calc(100% - 32px)",boxSizing:"border-box",padding:i(r.lg),borderRadius:i(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,color:t.text.primary},dialogTitle:{margin:0,...v(e,"medium"),color:t.brand,fontSize:i(a.subtitle),lineHeight:String(s.snug)},dialogBody:{margin:0,paddingTop:i(r.sm),...v(e,"regular"),color:t.text.metaCool,fontSize:i(a.body),lineHeight:String(s.normal)},dialogActions:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:i(r.sm),paddingTop:i(r.lg)}}}o(Yl,"makeStyles");function Gl(e){let t=[],r=Cu(e.ageYears);r!==null&&t.push(`${String(r)} yr${r===1?"":"s"} old`);let n=e.weightKg;typeof n=="number"&&Number.isFinite(n)&&n>0&&t.push(`${String(Math.round(n))} kg`);let l=e.breed?.trim();return l&&t.push(l),t.join(" \xB7 ")}o(Gl,"formatTelevetPetMetaLine");function Cu(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}o(Cu,"wholeYears");function eo({media:e,onChange:t,onPickMedia:r,listLabel:n}){let l=x(),a=useMemo(()=>Pu(l),[l]),s=tr-e.length,[i,d]=useState(false);if(!r)return null;let c=o(async()=>{if(!(i||s<=0)){d(true);try{let u=await Gt(r,s);if(!u.ok||u.value===null||u.value.length===0)return;let f=new Set(e.map(m=>m.uri)),y=u.value.filter(m=>typeof m?.uri=="string"&&m.uri.length>0&&!f.has(m.uri));if(y.length===0)return;t([...e,...y].slice(0,tr));}finally{d(false);}}},"pick");return jsxs("ul",{role:"list","aria-label":n,style:a.row,children:[e.map((u,f)=>jsxs("li",{style:a.thumb,children:[jsx("img",{src:u.uri,alt:u.filename,style:a.thumbImage}),u.mimeType.startsWith("video/")?jsx("span",{"aria-hidden":"true",style:a.videoBadge,"data-testid":`televet-intake-media-video-${String(f)}`,children:Ru}):null,jsx("button",{type:"button",onClick:()=>t(e.filter((y,m)=>m!==f)),"aria-label":`${p.removePhotoLabel}: ${u.filename}`,"data-testid":`televet-intake-media-remove-${String(f)}`,style:a.remove,children:jsx("span",{"aria-hidden":"true",style:a.removeGlyph,children:_u})})]},`${u.uri}-${String(f)}`)),s>0?jsx("li",{style:a.addItem,children:jsx("button",{type:"button",onClick:()=>{c();},disabled:i,"aria-busy":i||void 0,"data-testid":"televet-intake-add-media",style:{...a.dropzone,...i?a.dropzoneBusy:null},children:jsx("span",{style:a.dropzoneText,children:p.addPhotoCta})})}):null]})}o(eo,"TelevetIntakeMedia");var _u="\xD7",Ru="\u25B6",_r=92;function Pu(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l,i=o(d=>`${String(d)}px`,"rem");return {row:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"row",flexWrap:"wrap",gap:i(r.md),paddingTop:i(r.sm)},thumb:{position:"relative",width:_r,height:_r,borderRadius:i(n.md),backgroundColor:t.surfaceSubtle},thumbImage:{width:"100%",height:"100%",objectFit:"cover",borderRadius:i(n.md),display:"block"},videoBadge:{position:"absolute",left:6,bottom:6,paddingLeft:6,paddingRight:6,paddingTop:2,paddingBottom:2,borderRadius:i(n.sm),backgroundColor:t.shadow,color:t.text.onBrand,fontSize:i(a.nano),lineHeight:"1"},addItem:{display:"flex"},remove:{position:"absolute",top:-8,right:-8,width:le-16,height:le-16,borderRadius:"50%",borderStyle:"none",backgroundColor:t.text.metaCool,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},removeGlyph:{...v(e,"medium"),color:t.surface,fontSize:i(a.subtitle),lineHeight:"1"},dropzone:{width:_r,height:_r,borderRadius:i(n.md),borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:i(r.sm),paddingRight:i(r.sm),cursor:"pointer",boxSizing:"border-box"},dropzoneBusy:{opacity:.6,cursor:"progress"},dropzoneText:{...v(e,"mono"),color:t.text.metaCool,fontSize:i(a.nano),lineHeight:String(s.normal),letterSpacing:"0.3px",textAlign:"center"}}}o(Pu,"makeStyles");function to({slots:e,selectedDayKey:t,onSelectDay:r,groupLabel:n}){let l=x(),a=useMemo(()=>Ou(l),[l]),s=useMemo(()=>Pr(e),[e]),i=useRef(new Map),d=s[0],c=t??d?.key??null,u=useCallback(f=>{let y=f.key==="ArrowRight"||f.key==="ArrowDown"?1:f.key==="ArrowLeft"||f.key==="ArrowUp"?-1:0,m=f.key==="Home"?0:f.key==="End"?s.length-1:null;if(y===0&&m===null)return;let b=s.findIndex(C=>C.key===c);if(b<0)return;let h=m??Math.min(s.length-1,Math.max(0,b+y)),S=s[h];S===void 0||S.key===c||(f.preventDefault(),r(S),i.current.get(S.key)?.focus());},[s,c,r]);return d===void 0?null:jsxs("div",{children:[jsx("p",{"aria-hidden":"true",style:a.month,"data-testid":"televet-day-strip-month",children:_l(d.iso)}),jsx("div",{role:"radiogroup","aria-label":n,onKeyDown:u,style:a.strip,"data-testid":"televet-day-strip",children:s.map(f=>{let y=f.key===c;return jsxs("button",{ref:m=>{m?i.current.set(f.key,m):i.current.delete(f.key);},type:"button",role:"radio","aria-checked":y,tabIndex:y?0:-1,onClick:()=>r(f),"aria-label":Rl(f.iso),"data-testid":`televet-day-${f.key}`,style:{...a.day,...y?a.daySelected:null},children:[jsx("span",{"aria-hidden":"true",style:{...a.dayWeekday,...y?a.dayTextSelected:null},children:f.weekday}),jsx("span",{"aria-hidden":"true",style:{...a.dayNumber,...y?a.dayTextSelected:null},children:f.dayNumber})]},f.key)})})]})}o(to,"TelevetDayStrip");function Pr(e){let t=new Map;for(let r of e){let n=hr(r.startsAt);if(t.has(n))continue;let l=new Date(r.startsAt);Number.isNaN(l.getTime())||t.set(n,Object.freeze({key:n,iso:r.startsAt,weekday:l.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(l.getDate())}));}return Object.freeze([...t.values()])}o(Pr,"televetDaysFromSlots");function Ou(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l,i=o(d=>`${String(d)}px`,"rem");return {month:{margin:0,textAlign:"center",...v(e,"medium"),color:t.brand,fontSize:i(a.subtitle),lineHeight:String(s.snug),paddingBottom:i(r.md)},strip:{display:"flex",flexDirection:"row",gap:i(r.sm),paddingLeft:i(r.xs),paddingRight:i(r.xs),overflowX:"auto",overscrollBehaviorX:"contain",scrollSnapType:"x proximity"},day:{width:52,flexShrink:0,scrollSnapAlign:"center",minHeight:le,paddingTop:i(r.md),paddingBottom:i(r.md),borderRadius:i(n.md),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",boxSizing:"border-box"},daySelected:{backgroundColor:t.primary,borderColor:t.primary},dayWeekday:{...v(e,"mono"),color:t.text.secondary,fontSize:i(a.tiny),lineHeight:String(s.tight)},dayNumber:{...v(e,"medium"),color:t.brand,fontSize:i(a.heading),lineHeight:String(s.tight)},dayTextSelected:{color:t.onPrimary}}}o(Ou,"makeStyles");function Mt({slots:e,busySlotId:t,onPick:r,header:n,dayGroupLabel:l,timeGroupLabel:a,rowTestIdPrefix:s="televet-slot",testID:i="televet-slot-list"}){let d=x(),c=useMemo(()=>Lu(d),[d]),u=useMemo(()=>Pr(e),[e]),f=`${useId()}-zone`,[y,m]=useState(null),b=y??u[0]?.key??null,h=useMemo(()=>b?e.filter(k=>hr(k.startsAt)===b):[],[e,b]),S=h[0],C=t!==null,E=S?ut(S.startsAt):null;return jsxs("div",{style:c.root,"data-testid":i,children:[n,jsx(to,{slots:e,selectedDayKey:b,onSelectDay:k=>m(k.key),groupLabel:l}),E?jsx("p",{id:f,style:c.zone,"data-testid":"televet-slot-zone",children:E}):null,jsx("div",{style:c.gridScroll,children:jsx("ul",{role:"list","aria-label":a,...E?{"aria-describedby":f}:{},"aria-busy":C||void 0,style:c.grid,children:h.map(k=>{let A=t===k.slotId;return jsx("li",{style:c.gridItem,children:jsx("button",{type:"button",onClick:()=>r(k),disabled:C,"aria-busy":A||void 0,"aria-label":be(k.startsAt),"data-testid":`${s}-${k.slotId}`,style:{...c.chip,...A?c.chipBusy:null,...C&&!A?c.chipDisabled:null},children:jsx("span",{"aria-hidden":"true",style:{...c.chipLabel,...A?c.chipLabelBusy:null},children:st(k.startsAt)})})},k.slotId)})})})]})}o(Mt,"TelevetSlotPicker");function Lu(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l,i=o(d=>`${String(d)}px`,"rem");return {root:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0},gridScroll:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},zone:{margin:0,textAlign:"center",...v(e,"mono"),color:t.text.secondary,fontSize:i(a.tiny),lineHeight:String(s.normal),letterSpacing:"0.4px",paddingTop:i(r.md),paddingBottom:i(r.md)},grid:{listStyle:"none",margin:0,padding:0,paddingBottom:i(r.xl),display:"flex",flexDirection:"row",flexWrap:"wrap",gap:i(r.md)},gridItem:{display:"flex",flexGrow:1,flexBasis:"28%",minWidth:96},chip:{width:"100%",minHeight:48,borderRadius:i(n.pill),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:i(r.md),paddingRight:i(r.md),cursor:"pointer",boxSizing:"border-box"},chipBusy:{backgroundColor:t.primary,borderColor:t.primary},chipDisabled:{opacity:.45,cursor:"not-allowed"},chipLabel:{...v(e,"regular"),color:t.brand,fontSize:i(a.subtitle),lineHeight:String(s.tight)},chipLabelBusy:{color:t.onPrimary}}}o(Lu,"makeStyles");function Pe(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l,i=o(d=>`${String(d)}px`,"rem");return {marker:{minHeight:1},chipRow:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:i(r.sm)},chip:{minHeight:44,padding:`${i(r.sm)} ${i(r.lg)}`,borderRadius:i(n.pill),borderStyle:"solid",borderWidth:1,borderColor:t.brand,backgroundColor:t.surface,color:t.brand,cursor:"pointer",...v(e,"regular"),fontSize:i(a.body),lineHeight:String(s.snug)},chipOn:{borderColor:t.accent,backgroundColor:t.accent,color:t.onAccent,...v(e,"bold")},stepScroll:{paddingBottom:i(r.md)},visuallyHiddenHeading:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},petRow:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",gap:i(r.sm),minHeight:64,paddingLeft:i(r.md),paddingRight:i(r.md),paddingTop:i(r.sm),paddingBottom:i(r.sm),borderRadius:i(n.pill),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",textAlign:"left",cursor:"pointer",boxSizing:"border-box"},petRowSelected:{borderColor:t.primary},petDisc:{width:28,height:28,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,display:"inline-flex",alignItems:"center",justifyContent:"center",...v(e,"medium"),color:t.brand,fontSize:i(a.caption),lineHeight:"1"},petRowText:{display:"flex",flexDirection:"column",minWidth:0,gap:2},petRowName:{...v(e,"medium"),color:t.brand,fontSize:i(a.body),lineHeight:String(s.snug),overflowWrap:"anywhere"},petRowMeta:{...v(e,"regular"),color:t.text.metaCool,fontSize:i(a.caption),lineHeight:String(s.normal),overflowWrap:"anywhere"},vetRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:i(r.md)},vetAvatar:{width:64,height:64,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,display:"inline-flex",alignItems:"center",justifyContent:"center",...v(e,"medium"),color:t.brand,fontSize:i(a.heading),lineHeight:"1"},vetIdentity:{display:"flex",flexDirection:"column",flex:"1 1 auto",minWidth:0,gap:2},vetName:{margin:0,...v(e,"medium"),color:t.brand,fontSize:i(a.subtitle),lineHeight:String(s.snug)},vetCredentials:{margin:0,...v(e,"regular"),color:t.text.metaCool,fontSize:i(a.caption),lineHeight:String(s.normal)},vetRating:{margin:0,...v(e,"regular"),color:t.text.secondary,fontSize:i(a.caption),lineHeight:String(s.normal)},vetBio:{margin:0,...v(e,"regular"),color:t.brand,fontSize:i(a.body),lineHeight:String(s.normal)},reasonInput:{width:"100%",minHeight:120,resize:"vertical",borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,borderRadius:i(n.md),padding:i(r.md),backgroundColor:t.surface,...v(e,"regular"),color:t.text.primary,fontSize:i(a.body),lineHeight:String(s.normal),boxSizing:"border-box"},emergencyBanner:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i(r.md),padding:i(r.lg),borderRadius:i(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.errorRed,backgroundColor:t.badgeBgCritical,boxSizing:"border-box"},emergencyTitle:{margin:0,...v(e,"bold"),color:t.errorRed,fontSize:i(a.subtitle),lineHeight:String(s.snug)},emergencyLede:{margin:0,...v(e,"regular"),color:t.text.primary,fontSize:i(a.body),lineHeight:String(s.normal)}}}o(Pe,"makeLocalStyles");function Xe({label:e,value:t,last:r=false,testID:n}){let l=x(),a=useMemo(()=>io(l),[l]);return jsxs("div",{style:{...a.row,...r?a.rowLast:null},"data-testid":n,children:[jsx("dt",{style:a.rowLabel,children:e}),jsx("dd",{style:a.rowValue,children:t})]})}o(Xe,"TelevetSummaryRow");function zt({label:e,checked:t,onToggle:r,testID:n}){let l=x(),a=useMemo(()=>io(l),[l]);return jsxs("label",{style:a.consent,children:[jsx("input",{type:"checkbox",checked:t,onChange:s=>r(s.currentTarget.checked),"data-testid":n,style:mt}),jsx("span",{"aria-hidden":"true",style:{...a.box,...t?a.boxChecked:null},children:t?jsx("span",{style:a.tick,children:Fu}):null}),jsx("span",{style:a.consentLabel,children:e})]})}o(zt,"TelevetConsentCheckbox");var Fu="\u2713";function oo({children:e,testID:t}){let r=x(),n=useMemo(()=>io(r),[r]);return jsx("dl",{style:n.card,"data-testid":t,children:e})}o(oo,"TelevetSummaryCard");function io(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l,i=o(d=>`${String(d)}px`,"rem");return {card:{margin:0,borderRadius:i(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,paddingLeft:i(r.lg),paddingRight:i(r.lg),boxSizing:"border-box"},row:{display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:i(r.lg),paddingTop:i(r.lg),paddingBottom:i(r.lg),borderBottomStyle:"solid",borderBottomWidth:1,borderBottomColor:t.brandBorder},rowLast:{borderBottomWidth:0},rowLabel:{margin:0,flexShrink:0,...v(e,"regular"),color:t.brand,fontSize:i(a.subtitle),lineHeight:String(s.snug)},rowValue:{margin:0,marginInlineStart:0,minWidth:0,textAlign:"right",overflowWrap:"anywhere",...v(e,"medium"),color:t.brand,fontSize:i(a.subtitle),lineHeight:String(s.snug)},consent:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:i(r.md),minHeight:le,padding:i(r.lg),borderRadius:i(n.md),backgroundColor:t.surfaceSubtle,cursor:"pointer",boxSizing:"border-box"},box:{width:22,height:22,flexShrink:0,borderRadius:i(n.xs),borderStyle:"solid",borderWidth:1.5,borderColor:t.brand,backgroundColor:t.surface,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},boxChecked:{backgroundColor:t.primary,borderColor:t.primary},tick:{...v(e,"bold"),color:t.onPrimary,fontSize:i(a.caption),lineHeight:"1"},consentLabel:{flex:"1 1 auto",minWidth:0,overflowWrap:"anywhere",...v(e,"regular"),color:t.text.metaCool,fontSize:i(a.body),lineHeight:String(s.normal)}}}o(io,"makeStyles");function lo({headingRef:e,when:t,clinician:r,petName:n,reason:l,shareRecords:a,onToggleShare:s,stateCode:i,stateAttested:d,onToggleStateAttest:c,cancellationTerms:u,termsAttested:f,onToggleTermsAttest:y,canConfirm:m,busy:b,failure:h,rateLimitMessage:S,onConfirm:C,emergency:E,onAcknowledgeEmergency:k,onSeeOtherVets:A,mediaShortfall:V=Lt,primaryVet:L,onFindEmergencyVet:W}){let U=F(),Q=x(),B=useMemo(()=>Pe(Q),[Q]),Y=Er({petName:n,primaryVet:L,onFindEmergencyVet:W})?p.emergency.lede:p.emergency.ledeWithoutExits;return jsxs("div",{style:U.scrollRoot,"data-testid":"televet-booking-review",children:[jsx("div",{style:U.scrollBody,"data-testid":"televet-booking-review-scroll",children:jsxs("div",{style:U.list,children:[jsx(Qe,{headingRef:e,style:U.stepTitle,children:p.reviewHeading}),jsxs(oo,{testID:"televet-review-summary",children:[n?jsx(Xe,{label:p.summaryPet,value:n,testID:"televet-review-row-pet"}):null,r?jsx(Xe,{label:p.summaryVet,value:r,testID:"televet-review-row-vet"}):null,jsx(Xe,{label:p.summaryWhen,value:t,testID:"televet-review-row-when"}),jsx(Xe,{label:p.summaryLength,value:G(p.summaryLengthTemplate,{n:String(dt)}),testID:"televet-review-row-length"}),l?jsx(Xe,{label:p.summaryReason,value:l,last:true,testID:"televet-review-row-reason"}):null]}),jsx(zt,{label:p.shareRecordsOff,checked:a,onToggle:s,testID:"televet-review-share-records"}),u?jsx(zt,{label:u,checked:f,onToggle:y,testID:"televet-review-terms-attest"}):null,i?jsx(zt,{label:G(p.stateAttestTemplate,{state:i}),checked:d,onToggle:c,testID:"televet-review-state-attest"}):null,jsx(Dt,{shortfall:V,testIDPrefix:"televet-review"}),E?jsxs("div",{role:"alert",style:B.emergencyBanner,"data-testid":"televet-review-emergency",children:[jsx(ea,{style:B.emergencyTitle,children:p.emergency.bannerTitle}),jsx("p",{style:B.emergencyLede,children:Y}),E.length>0?jsx("p",{style:B.emergencyLede,"data-testid":"televet-review-emergency-categories",children:E.join(", ")}):null,jsx(Ft,{petName:n,primaryVet:L,onFindEmergencyVet:W,testIDPrefix:"televet-review-emergency"}),jsx(P,{label:p.emergency.keepBookingCta,kind:"secondary",loading:b,disabled:b,onPress:k,testID:"televet-review-emergency-ack"})]}):null,h==="failed"?jsx(q,{message:p.confirmFailed}):null,h==="clinician_unavailable"?jsxs("div",{style:U.list,"data-testid":"televet-review-clinician-unavailable",children:[jsx(q,{message:p.confirmFailed}),jsx(P,{label:p.seeOtherVetsCta,kind:"secondary",onPress:A,testID:"televet-review-see-other-vets"})]}):null,h==="rate_limited"&&S?jsx(q,{message:S,testID:"televet-review-rate-limited"}):null,h==="rate_limited"&&!S?jsx(q,{message:p.confirmFailed}):null,h==="not_entitled"?jsx(q,{message:p.bookingPausedTitle,testID:"televet-review-not-entitled"}):null]})}),E?null:jsx("div",{style:U.scrollFooter,children:jsx(P,{label:p.confirmCta,kind:"primary",loading:b,disabled:!m||b||!!i&&!d||!!u&&!f,onPress:C,testID:"televet-review-confirm"})})]})}o(lo,"ReviewStep");var zu="\u25CB",ju="+";function ze(e,t){return t?e.find(n=>n.petRef===t||n.petId===t)?.name??null:null}o(ze,"nameOf");function Qe({headingRef:e,style:t,id:r,children:n}){let l=ie(ye());return jsx(l,{ref:e,tabIndex:-1,style:t,...r===void 0?{}:{id:r},children:n})}o(Qe,"StepHeading");function ea({style:e,children:t}){let r=ie(Nt(ye()));return jsx(r,{style:e,children:t})}o(ea,"SubHeading");function ra({headingRef:e,pets:t,isPending:r,isError:n,onRetry:l,selectedId:a,onSelect:s,onAddPet:i}){let d=F(),c=x(),u=useMemo(()=>Pe(c),[c]);return r?jsx("div",{role:"progressbar","aria-label":p.loading.pets,"aria-busy":"true",style:d.list,"data-testid":"televet-pets-loading",children:[0,1].map(f=>jsx(ae,{height:64},f))}):n?jsx("div",{"data-testid":"televet-pets-error",children:jsx($,{title:p.chrome.loadFailedTitle,actionLabel:p.chrome.retryCta,onAction:l})}):t.length===0?jsx("div",{"data-testid":"televet-pets-empty",children:jsx($,{title:p.chrome.noPetsTitle,actionLabel:p.addPetCta,onAction:i})}):jsxs("div",{style:d.stepFill,children:[jsx(Qe,{headingRef:e,style:d.stepTitle,children:p.petSelectTitle}),jsx("div",{style:{...d.scrollBody,...u.stepScroll},children:jsxs("ul",{role:"list",style:d.list,"data-testid":"televet-pets",children:[t.map(f=>{let y=a===f.petRef;return jsx(ta,{name:f.name??"",meta:Gl(f),selected:y,onPress:()=>s(f.petRef),testID:`televet-pet-${f.petRef}`},f.petRef)}),i?jsx(ta,{name:p.addPetCta,meta:"",selected:false,onPress:i,testID:"televet-pet-add",glyph:ju}):null]})})]})}o(ra,"PetStep");function ta({name:e,meta:t,selected:r,onPress:n,testID:l,glyph:a}){let s=x(),i=useMemo(()=>Pe(s),[s]);return jsx("li",{children:jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"data-testid":l,style:{...i.petRow,...r?i.petRowSelected:null},children:[jsx("span",{"aria-hidden":"true",style:i.petDisc,children:a??na(e)}),jsxs("span",{style:i.petRowText,children:[jsx("span",{style:i.petRowName,children:e}),t?jsx("span",{style:i.petRowMeta,children:t}):null]})]})})}o(ta,"PetRow");function na(e){let t=e.trim();return t.length===0?zu:t.slice(0,1).toUpperCase()}o(na,"initialOf");function oa({headingRef:e,clinicians:t,isPending:r,isError:n,selectedId:l,onSelect:a,onRetry:s}){let i=F(),d=x(),c=useMemo(()=>Pe(d),[d]);if(r)return jsx("div",{role:"progressbar","aria-label":p.loading.clinicians,"aria-busy":"true",style:i.list,"data-testid":"televet-clinicians-loading",children:jsx(ae,{height:96})});if(n)return jsx("div",{"data-testid":"televet-clinicians-error",children:jsx($,{title:p.chrome.loadFailedTitle,actionLabel:p.chrome.retryCta,onAction:s})});if(t.length===0)return jsx("div",{"data-testid":"televet-clinicians-empty",children:jsx($,{title:p.noCliniciansTitle,message:p.noCliniciansBody,actionLabel:p.noCliniciansRetryCta,onAction:s})});let u=t.find(f=>f.clinicianId===l)??t[0];return u===void 0?null:jsxs("div",{style:i.list,"data-testid":"televet-clinicians",children:[jsx(Qe,{headingRef:e,style:i.stepTitle,children:p.yourVetTitle}),jsxs("div",{style:c.vetRow,children:[jsx("span",{"aria-hidden":"true",style:c.vetAvatar,children:na(u.displayName)}),jsxs("div",{style:c.vetIdentity,children:[jsx("p",{style:c.vetName,children:u.displayName}),u.credentials?jsx("p",{style:c.vetCredentials,children:u.credentials}):null,u.rating!==null&&u.ratingCount!==null?jsx("p",{style:c.vetRating,"data-testid":"televet-vet-rating",children:`\u2605 ${String(u.rating)} \xB7 ${String(u.ratingCount)} ${p.reviewsLabel}`}):null]})]}),u.bio?jsx("p",{style:c.vetBio,"data-testid":"televet-vet-bio",children:u.bio}):null,jsx("div",{style:i.divider}),jsx(P,{label:p.continueCta,kind:"primary",onPress:()=>a(u.clinicianId),testID:`televet-clinician-${u.clinicianId}`})]})}o(oa,"ClinicianStep");function ia({headingRef:e,slots:t,enabled:r,isPending:n,isError:l,busySlotId:a,failure:s,nextOpening:i,onPick:d,onRetry:c,onSeeOtherVets:u}){let f=F();return r?n?jsx("div",{role:"progressbar","aria-label":p.loading.slots,"aria-busy":"true",style:f.list,"data-testid":"televet-slots-loading",children:[0,1,2].map(y=>jsx(ae,{height:48},y))}):l?jsx($,{title:p.slotsErrorTitle,actionLabel:p.retryCta,onAction:c,testID:"televet-slots-error"}):t.length===0?jsx("div",{"data-testid":"televet-slots-empty",children:jsx($,{title:p.noSlotsTitle,message:i?G(p.nextOpeningTemplate,{when:be(i.startsAt)}):void 0,actionLabel:i?p.seeOtherVetsCta:void 0,onAction:i?u:void 0})}):jsxs("div",{style:f.stepFill,"data-testid":"televet-slots",children:[jsx(Qe,{headingRef:e,style:f.stepTitle,children:p.timeHeading}),s==="expired"?jsx(q,{message:p.holdExpired}):null,s==="taken"?jsx(q,{message:p.slotTaken}):null,jsx(Mt,{slots:t,busySlotId:a,onPick:d,dayGroupLabel:p.summaryWhen,timeGroupLabel:p.navTitle})]}):jsx("div",{"data-testid":"televet-slots-unavailable",children:jsx($,{title:p.bookingPausedTitle})})}o(ia,"SlotStep");function la({headingRef:e,petName:t,chips:r,selected:n,onToggle:l,onNext:a}){let s=F(),i=x(),d=useMemo(()=>Pe(i),[i]),c=G(p.issuesHeadingTemplate,{pet:t??""});return jsxs("div",{style:s.scrollRoot,"data-testid":"televet-booking-issues",children:[jsx("div",{style:s.scrollBody,children:jsxs("div",{style:s.list,children:[jsx(Qe,{headingRef:e,style:s.stepTitle,children:c}),jsx("p",{style:s.stepHelp,children:p.issuesHint}),jsx("div",{role:"group","aria-label":c,style:d.chipRow,children:r.map(u=>{let f=n.includes(u.id);return jsx("button",{type:"button","aria-pressed":f,onClick:()=>l(u.id),style:{...d.chip,...f?d.chipOn:null},"data-testid":`televet-issue-${u.id}`,children:u.label},u.id)})})]})}),jsx("div",{style:s.scrollFooter,children:jsx(P,{label:p.continueCta,kind:"primary",onPress:a,testID:"televet-issues-next"})})]})}o(la,"IssuesStep");function aa({headingRef:e,value:t,composed:r,onChange:n,onNext:l,media:a,onChangeMedia:s,onPickMedia:i,checking:d=false}){let c=F(),u=x(),f=useMemo(()=>Pe(u),[u]),y=useId(),m=`${y}-reason-heading`,b=`${y}-reason-help`,h=(r??t).trim(),S=h.length>Fe,C=h.length>0&&!S;return jsxs("div",{style:c.scrollRoot,"data-testid":"televet-booking-reason",children:[jsx("div",{style:c.scrollBody,"data-testid":"televet-booking-reason-scroll",children:jsxs("div",{style:c.list,children:[jsx(Qe,{headingRef:e,id:m,style:c.stepTitle,children:p.describeHeading}),jsx("p",{id:b,style:c.stepHelp,children:p.describeHelpLong}),jsx("textarea",{value:t,onChange:E=>n(E.currentTarget.value),"aria-labelledby":m,"aria-describedby":b,"aria-invalid":S||void 0,placeholder:p.reasonPlaceholder,style:f.reasonInput,"data-testid":"televet-reason-input"}),S?jsx(q,{message:p.reasonTooLong}):null,jsx(eo,{media:a,onChange:s,listLabel:p.addPhotoCta,...i?{onPickMedia:i}:{}})]})}),jsx("div",{style:c.scrollFooter,children:jsx(P,{label:p.continueCta,kind:"primary",disabled:!C,loading:d,onPress:l,testID:"televet-reason-next"})})]})}o(aa,"ReasonStep");function uo(e){let{petRef:t,usState:r,controller:n,onBooked:l,onExit:a,onAddPet:s,onPickMedia:i,onAddToCalendar:d,onConfirmDiscard:c,onRequestLocation:u,locationStatus:f="unknown",onTriageReason:y,onStateInterest:m,primaryVet:b,onFindEmergencyVet:h,canJoinInApp:S=false,renderUnavailable:C,headingLevel:E,style:k,testID:A}=nt(e,["onBooked","onExit","onAddPet","onRequestLocation","onFindEmergencyVet"]),V=Ol(E??pt),L=Nt(V),W=F(),U=x(),Q=useMemo(()=>Pe(U),[U]),B=ve(n),Y=gr(),j=Y.pets,Z=j.length,H=useMemo(()=>({ownedPetCount:Z,withIssues:true}),[Z]),[ue,Ze]=useReducer((N,ge)=>In(N,ge,H),void 0,()=>Pn({ownedPetCount:0,withIssues:true},{petId:t??null,state:r??null})),I=useCallback(N=>Ze(N),[]),[et,Ir]=useState(""),[Wt,K]=useState([]),[Le,tt]=useState(null),[_a,Ra]=useState(null),[Pa,wa]=useState(null),[Or,ko]=useState(false),[Ar,xo]=useState(false),[_o,Ia]=useState([]),[Br,Oa]=useState(null),{draft:O}=ue,re=On(ue),Ro=useMemo(()=>Sl(j.find(N=>N.petRef===O.petId||N.petId===O.petId)?.species??null),[j,O.petId]),He=El(Wt.map(N=>Ro.find(ge=>ge.id===N)?.label??""),et),Po=useRef(O.state);Po.current!==O.state&&(Po.current=O.state,Or&&ko(false),Ar&&xo(false));let $t=tn(O.state,B),wo=_t(B),ht=rn(B),fe=nn(O.state,B),rt=Rt(O.clinicianId,B),Aa=on(B).data??null,Kt=Pt(B),Io=an(B),Te=Hn(y??null),Oo=Vn(O.state,m??null).actionFor("no_licensed_vet"),Lr=r??null;useEffect(()=>{Lr&&!O.state&&I({type:"patch",patch:{state:Lr}});},[Lr,O.state,I]),useEffect(()=>{t&&!O.petId&&I({type:"patch",patch:{petId:t}});},[t,O.petId,I]);let Nr=j.length===1?j[0]?.petRef??null:null;useEffect(()=>{Nr&&!O.petId&&I({type:"patch",patch:{petId:Nr}});},[Nr,O.petId,I]);let Ao=useRef(re);Ao.current=re;let Bo=useRef(0);useEffect(()=>{Z!==Bo.current&&(Bo.current=Z,I({type:"goTo",step:Ao.current}));},[Z,I]);let Fr=fe.data?.[0]?.clinicianId??null;useEffect(()=>{Fr&&!O.clinicianId&&I({type:"patch",patch:{clinicianId:Fr}});},[Fr,O.clinicianId,I]);let Ve=useRef(null),Lo=useRef(false);useEffect(()=>{if(!Lo.current){Lo.current=true;return}Ve.current?.focus();},[re]);let Ba=useCallback(N=>{tt(null),Kt.mutate(N.slotId,{onSuccess:o(ge=>{I({type:"patch",patch:{slot:N,holdExpiresAt:ge.expiresAt,idempotencyKey:Bn(N.slotId)}}),I({type:"next"});},"onSuccess"),onError:o(ge=>tt(Oe(ge).kind==="unavailable"?"unavailable":"taken"),"onError")});},[Kt,I]),{submitBooking:La,confirm:Na}=wl({draft:O,reasonText:He,book:Io,stateAttested:Or,termsAttested:Ar,cancellationPolicy:wo.data??null,triage:Te,goTo:useCallback(N=>I({type:"goTo",step:N}),[I]),setFailure:tt,setRateLimitMessage:Ra,setEmergency:wa,setBookedConsult:Oa,...l?{onBooked:l}:{}}),Fa=$t.enabled&&$t.data!==null&&!$t.data.wellnessAvailable,No=ht.enabled&&ht.data?.active===false||Le==="not_entitled",Da=ht.enabled&&ht.data!==null,Ma=Fn(Da),Fo=Tr(_o.length),za=He.trim().length>0||!!O.slot,Do={surfaceUnavailable:B===null||Le==="unavailable"||dn(ht)||dn($t),notEntitled:No,policyBlocked:Fa,triageOpen:Te.open,step:re},ja=Dl(Do),Mo={noState:!O.state,isPending:fe.enabled&&fe.isPending,isError:fe.isError,isEmpty:(fe.data?.length??0)===0,notEntitled:No},Ha=zl(Mo);return we()?jsx(Un.Provider,{value:L,children:jsxs("div",{style:{...W.screen,...k},"data-testid":A??"televet-booking",children:[jsx(Zn,{step:re,furthestIndex:ue.furthestIndex,triageOpen:Te.open,canGoBack:(Te.open||wn(ue,H))&&re!=="booked",isDirty:za,onBack:()=>{if(Te.open){Te.close();return}Te.cancel(),I({type:"back"});},onClose:()=>a?.(),headingLevel:V,...c?{onConfirmDiscard:c}:{}}),ja?jsx(Ml,{state:Do,petName:ze(j,O.petId),...b?{primaryVet:b}:{},onFindEmergencyVet:h,stateInterest:Oo,...m?{onCheckAvailability:o(()=>I({type:"goTo",step:"clinician"}),"onCheckAvailability")}:{},onAcknowledgeEmergency:()=>{Te.acknowledge(He),I({type:"next"});},...C?{renderUnavailable:C}:{}}):re==="time"?jsx(ia,{headingRef:Ve,slots:rt.data??[],enabled:rt.enabled,isPending:rt.enabled&&rt.isPending,isError:rt.isError,busySlotId:Kt.isPending?Kt.variables:null,failure:Le,nextOpening:Aa,onPick:Ba,onRetry:()=>rt.refetch(),onSeeOtherVets:()=>I({type:"goTo",step:"clinician"})}):re==="review"?jsx(lo,{headingRef:Ve,when:O.slot?be(O.slot.startsAt):"",petName:ze(j,O.petId),reason:He.trim(),clinician:fe.data?.find(N=>N.clinicianId===O.clinicianId)?.displayName??null,shareRecords:O.shareHealthRecords,stateCode:O.state,stateAttested:Or,onToggleStateAttest:ko,cancellationTerms:wo.data?.summary??null,termsAttested:Ar,onToggleTermsAttest:xo,onToggleShare:N=>I({type:"patch",patch:{shareHealthRecords:N}}),canConfirm:Bt(O,He),busy:Io.isPending,failure:Le,rateLimitMessage:_a,onConfirm:Na,emergency:Pa,onAcknowledgeEmergency:()=>La(true),mediaShortfall:Fo,primaryVet:b,onFindEmergencyVet:h,onSeeOtherVets:()=>I({type:"goTo",step:"clinician"})}):re==="booked"?jsx("div",{style:W.stepFill,"data-testid":"televet-booking-booked",children:Br?jsxs(Fragment,{children:[jsx(Gn,{consult:Br,petName:ze(j,Br.petId)??ze(j,O.petId),onDone:()=>a?.(),canJoinInApp:S,...d?{onAddToCalendar:d}:{}}),jsx(Dt,{shortfall:Fo,testIDPrefix:"televet-booked"})]}):null}):re==="clinician"&&Ha?jsx(jl,{state:Mo,cause:Ma,locationStatus:f,...u?{onRequestLocation:u}:{},onRetry:()=>fe.refetch(),stateInterest:Oo,...C?{renderUnavailable:C}:{}}):re==="clinician"?jsx(oa,{headingRef:Ve,clinicians:fe.data??[],isPending:fe.enabled&&fe.isPending,isError:fe.isError,selectedId:O.clinicianId,onRetry:()=>fe.refetch(),onSelect:N=>{I({type:"patch",patch:{clinicianId:N}}),I({type:"next"});}}):re==="issues"?jsx(la,{headingRef:Ve,petName:ze(j,O.petId),chips:Ro,selected:Wt,onToggle:N=>K(ge=>ge.includes(N)?ge.filter(Va=>Va!==N):[...ge,N]),onNext:()=>I({type:"next"})}):re==="reason"?jsx(aa,{headingRef:Ve,value:et,composed:He,onChange:Ir,media:_o,onChangeMedia:Ia,...i?{onPickMedia:i}:{},checking:Te.checking,onNext:()=>{Te.check(He).then(N=>{N&&I({type:"next"});});}}):re==="pet"?jsx(ra,{headingRef:Ve,pets:j,isPending:Y.loading,isError:Y.error!==null,onRetry:()=>{Y.refresh();},onAddPet:s,selectedId:O.petId,onSelect:N=>{I({type:"patch",patch:{petId:N}}),I({type:"next"});}}):jsx("div",{style:Q.marker,"data-testid":`televet-booking-step-${re}`})]})}):jsx("div",{style:{...W.screen,...k},"data-testid":A??"televet-booking",children:jsx("div",{style:W.stepFill,"data-testid":"televet-booking-copy-unapproved",children:C?C():null})})}o(uo,"EverfurTelevetBooking");var Ut=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:o(e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:Ut.lobbyTitleNoName},"lobbyTitle"),lobbyPrep:o(e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:Ut.lobbyPrepNoPet},"lobbyPrep"),lobbyDuration:o(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 da(e){switch(e){case "too_early":return "This visit has not opened yet.";case "too_late":return "This visit has ended.";case "room_not_ready":return "We are still setting up the video room. Try again in a moment.";case "status_cancelled_owner":return "You cancelled this visit.";case "status_cancelled_ops":return "This visit was cancelled. Please book another time.";case "status_no_show_owner":return "This visit was missed.";case "status_no_show_vet":return "The vet could not make this visit. Please book another time.";case "status_awaiting_summary":return "This visit has ended. Your summary is on its way.";case "status_completed":return "This visit has ended.";default:return wr}}o(da,"televetJoinRefusalWebCopy");var wr="This visit cannot be joined right now.";function ua(e){return e==="room_not_ready"||e==="unknown"}o(ua,"televetJoinIsRetryable");var ca=Symbol.for("@everfur/sdk/televet");function Uu(){let e=globalThis,t=e[ca];if(t!==void 0)return t;let r={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[ca]=r,r}o(Uu,"televetGlobal");function pa(){return Uu().dailyRegistered}o(pa,"isEverfurDailyRegistered");function fa(e){let t=null;return ()=>{if(t!==null)return t;let r=e();return t=r,r.then(void 0,()=>{t===r&&(t=null);}),r}}o(fa,"memoizeTelevetLoader");var ma=Object.freeze({status:"joining"});function co(e,t){let[r,n]=useState(0),[l,a]=useState(ma),s=useRef(null);useEffect(()=>{let d=t?.joinConsult;if(t===null||d===void 0){a(Object.freeze({status:"refused",refusal:"unavailable",reason:null}));return}let c=`${e}#${String(r)}`,u=s.current;if(u===null||u.key!==c){let y;try{y=d.call(t,e);}catch(m){y=Promise.reject(m);}u={key:c,promise:y},s.current=u;}let f=true;return a(ma),u.promise.then(y=>{f&&(y.ok?a(Object.freeze({status:"ready",credential:y.value})):a(Object.freeze({status:"refused",refusal:qr(y.error),reason:Kr(y.error)})));},()=>{f&&a(Object.freeze({status:"refused",refusal:"unknown",reason:null}));}),()=>{f=false;}},[e,t,r]);let i=useCallback(()=>n(d=>d+1),[]);return {state:l,retry:i}}o(co,"useTelevetJoin");var Yu=fa(()=>import('@everfur/sdk/web/televet/call'));function po({consultId:e,controller:t,clinicianName:r,petName:n,onLeave:l,style:a}){let s=F(),i=ve(t),{state:d,retry:c}=co(e,i),[u,f]=useState(null),[y,m]=useState(false),b=d.status==="ready";useEffect(()=>{if(!b||u!==null)return;let C=true;return Yu().then(E=>{C&&f(()=>E);},()=>{C&&m(true);}),()=>{C=false;}},[b,u]);let h=b&&u!==null&&!y;if(Cr(()=>(h||l(),true)),d.status==="refused"||y){let C=d.status==="refused"?d.refusal:"unavailable",E=d.status==="refused"?da(d.reason):wr;return jsxs("div",{style:{...s.stepFill,...a},"data-testid":"televet-join-refused",children:[jsx(q,{message:E,testID:"televet-join-refused-message"}),ua(C)&&d.status==="refused"?jsx(P,{label:p.retryCta,kind:"primary",onPress:c,testID:"televet-join-retry"}):null,jsx(P,{label:Ut.leaveCta,kind:"secondary",onPress:l,testID:"televet-join-leave"})]})}if(d.status==="joining"||u===null)return jsx("div",{role:"progressbar","aria-label":p.loading.consult,"aria-busy":"true",style:{...s.list,...a},"data-testid":"televet-join-loading",children:jsx(ae,{height:48})});let{EverfurVetCall:S}=u;return jsx(S,{roomUrl:d.credential.roomUrl,token:d.credential.token,onLeave:l,clinicianName:r??null,petName:n??null,renderUnavailable:()=>jsxs("div",{style:s.stepFill,"data-testid":"televet-join-call-unavailable",children:[jsx(q,{message:wr}),jsx(P,{label:Ut.leaveCta,kind:"secondary",onPress:l,testID:"televet-join-unavailable-leave"})]}),...a?{style:a}:{}})}o(po,"TelevetJoinScreen");var Xu=2e4;function ba(e=true,t=Xu){let[r,n]=useState(()=>Date.now());return useEffect(()=>{if(!e)return;n(Date.now());let l=setInterval(()=>n(Date.now()),t);return ()=>clearInterval(l)},[e,t]),r}o(ba,"useNowMs");function Qu(e){let t=e.trim().length;return t<1?_.cancellationReasonMissing:t>De?_.cancellationReasonTooLong(De):null}o(Qu,"reasonRefusal");function yo({terms:e,submitting:t,failure:r,onConfirm:n,onDismiss:l,onRetryTerms:a,styles:s}){let[i,d]=useState(""),[c,u]=useState(null),f=useId(),y=useId(),m=e.status==="ready",b=o(()=>{if(t||!m)return;let h=Qu(i);u(h),h||n(i.trim());},"confirm");return jsxs("form",{onSubmit:h=>{h.preventDefault(),b();},"aria-label":_.cancelConfirmCta,noValidate:true,style:s.form,"data-testid":"televet-visit-cancel-form",children:[jsx("p",{style:s.noticeTitle,children:_.cancelConfirmTitle}),e.status==="ready"?jsx("div",{style:s.notice,"data-testid":"televet-visit-cancel-terms",children:jsx("p",{style:s.note,children:e.summary})}):e.status==="loading"?jsx("div",{role:"status",style:s.notice,children:jsx("p",{style:s.note,children:_.loadingCancellationTerms})}):jsxs("div",{role:"alert",style:{...s.notice,...s.noticeDanger},"data-testid":"televet-visit-cancel-terms-error",children:[jsx("p",{style:s.note,children:_.cancellationTermsUnavailable}),jsx(P,{label:_.retry,kind:"secondary",fullWidth:false,onPress:a})]}),jsx("label",{htmlFor:f,style:s.label,children:_.cancellationReasonLabel}),jsx("textarea",{id:f,value:i,onChange:h=>{d(h.target.value),c&&u(null);},maxLength:De,rows:3,disabled:t||!m,"aria-invalid":c?true:void 0,"aria-describedby":c?y:void 0,style:s.textarea,"data-testid":"televet-visit-cancel-reason"}),c?jsx("p",{id:y,role:"alert",style:s.fieldError,children:c}):null,r?jsx("div",{role:"alert",style:{...s.notice,...s.noticeDanger},"data-testid":"televet-visit-cancel-failed",children:jsx("p",{style:s.note,children:r})}):null,jsxs("div",{style:s.actions,children:[jsx(P,{label:t?_.cancellingVisit:_.cancelConfirmCta,kind:"danger",fullWidth:false,disabled:t||!m,loading:t,onPress:b,testID:"televet-visit-cancel-yes"}),jsx(P,{label:_.cancelDismissCta,kind:"secondary",fullWidth:false,disabled:t,onPress:l,testID:"televet-visit-cancel-keep"})]})]})}o(yo,"TelevetCancelVisitForm");function Sa(e){let{color:t,space:r,radius:n,type:l}=e,{size:a,lineHeight:s}=l,i=o(d=>`${String(d)}px`,"px");return {screen:{...at,display:"flex",flexDirection:"column",gap:i(r.md),paddingLeft:i(r.xl),paddingRight:i(r.xl),boxSizing:"border-box"},topBar:{display:"flex",alignItems:"center",justifyContent:"flex-end",minHeight:44},topBarStart:{justifyContent:"flex-start"},iconButton:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:44,height:44,padding:0,border:0,borderRadius:i(n.pill),background:"transparent",color:t.text.primary,cursor:"pointer"},textButton:{display:"inline-flex",alignItems:"center",minHeight:44,padding:`0 ${i(r.sm)}`,border:0,borderRadius:i(n.pill),background:"transparent",color:t.brand,cursor:"pointer",...v(e,"bold"),fontSize:i(a.body)},panel:{display:"flex",flexDirection:"column",borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,borderRadius:i(n.lg),backgroundColor:t.surface,overflow:"hidden"},panelBody:{display:"flex",flexDirection:"column",gap:i(r.md),padding:i(r.lg)},panelHeader:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:i(r.sm),padding:`${i(r.md)} ${i(r.lg)}`,borderBottom:`1px solid ${t.brandBorder}`},panelTitle:{margin:0,...v(e,"medium"),color:t.brand,fontSize:i(a.subtitle),lineHeight:String(s.snug)},count:{...v(e,"mono"),color:t.text.metaCool,fontSize:i(a.caption)},bookTitle:{margin:0,...v(e,"medium"),color:t.brand,fontSize:i(a.subtitle),lineHeight:String(s.snug)},list:{listStyle:"none",margin:0,padding:0},row:{display:"flex",flexDirection:"column",gap:i(r.sm),padding:`${i(r.md)} ${i(r.lg)}`,borderBottom:`1px solid ${t.brandBorder}`},rowHead:{display:"flex",flexWrap:"wrap",alignItems:"flex-start",justifyContent:"space-between",gap:i(r.sm)},when:{margin:0,...v(e,"medium"),color:t.text.primary,fontSize:i(a.subtitle),lineHeight:String(s.snug)},pet:{margin:0,...v(e,"regular"),color:t.text.metaCool,fontSize:i(a.caption)},chip:{display:"inline-flex",alignItems:"center",padding:`2px ${i(r.sm)}`,borderRadius:i(n.pill),backgroundColor:t.surfaceSubtle,...v(e,"mono"),color:t.text.metaCool,fontSize:i(a.micro),letterSpacing:"0.04em",textTransform:"uppercase"},chipPositive:{backgroundColor:t.badgeBgPositive,color:t.brand},actions:{display:"flex",flexWrap:"wrap",gap:i(r.sm)},note:{margin:0,...v(e,"regular"),color:t.text.metaCool,fontSize:i(a.body),lineHeight:String(s.normal)},notice:{display:"flex",flexDirection:"column",gap:i(r.xs),padding:i(r.md),borderRadius:i(n.md),backgroundColor:t.surfaceSubtle},noticeTitle:{margin:0,...v(e,"medium"),color:t.text.primary,fontSize:i(a.body),lineHeight:String(s.snug)},noticeDanger:{backgroundColor:t.badgeBgCritical},form:{display:"flex",flexDirection:"column",gap:i(r.sm),marginTop:i(r.sm),paddingTop:i(r.md),borderTop:`1px solid ${t.brandBorder}`},label:{...v(e,"medium"),color:t.text.primary,fontSize:i(a.body)},textarea:{minHeight:96,padding:i(r.sm),borderRadius:i(n.md),border:`1px solid ${t.brandBorder}`,...v(e,"regular"),fontSize:i(a.body),color:t.text.primary,backgroundColor:t.surface,resize:"vertical",boxSizing:"border-box"},fieldError:{margin:0,...v(e,"regular"),color:t.danger,fontSize:i(a.caption)},empty:{display:"flex",flexDirection:"column",gap:i(r.xs),padding:i(r.lg)},skeletons:{display:"flex",flexDirection:"column",gap:i(r.sm),padding:i(r.lg)}}}o(Sa,"makeVisitStyles");function vo({controller:e,onJoin:t,onReschedule:r,onBook:n,onBack:l,isRoot:a=true,revision:s=0,nowMs:i,style:d}){let c=x(),u=useMemo(()=>Sa(c),[c]),f=ie(ye()),y=ve(e),[m,b]=useState(0),h=lr(y,s+m),S=_t(y),{pets:C}=gr(),[E,k]=useState({status:"idle"}),[A,V]=useState(null),L=h.data??[],W=ba(L.some(H=>!Zt.has(H.status))),U=i??W,{upcoming:Q,past:B}=useMemo(()=>wt(L,U),[L,U]),Y=S.data!==null&&S.data!==void 0?{status:"ready",summary:S.data.summary}:S.enabled&&S.isPending?{status:"loading"}:{status:"error"},j=o((H,ue)=>{let Ze=y?.cancelConsult;if(Y.status!=="ready"||!y||!Ze){k({status:"failed",consultId:H.consultId,message:_.cancelTermsFirst});return}k({status:"submitting",consultId:H.consultId}),Ze.call(y,H.consultId,ue).then(I=>{I.ok?(V(I.value),k({status:"idle"})):k({status:"failed",consultId:H.consultId,message:_.cancelFailed}),b(et=>et+1);},()=>k({status:"failed",consultId:H.consultId,message:_.cancelFailed}));},"cancelVisit"),Z=o(H=>jsx(ec,{consult:H,petName:ze(C,H.petId),nowMs:U,styles:u,cancelling:E.status!=="idle"&&E.consultId===H.consultId?E:null,anyCancelInFlight:E.status==="submitting",terms:Y,onJoin:t,onReschedule:r,onAskCancel:()=>{V(null),k({status:"asking",consultId:H.consultId});},onDismissCancel:()=>k({status:"idle"}),onCancel:ue=>j(H,ue),onRetryTerms:()=>S.refetch()},H.consultId),"renderRow");return jsxs("div",{style:{...u.screen,...d},"data-testid":"televet-visits",children:[jsx("div",{style:a?u.topBar:{...u.topBar,...u.topBarStart},children:a?jsx("button",{type:"button",onClick:l,"aria-label":tc,style:u.iconButton,"data-testid":"televet-visits-close",children:jsx(nc,{})}):jsx("button",{type:"button",onClick:l,style:u.textButton,"data-testid":"televet-visits-back",children:rc})}),A?jsxs("div",{role:"status",style:u.notice,"data-testid":"televet-visits-cancel-receipt",children:[jsx("p",{style:u.noticeTitle,children:_.cancelledTitle}),A.summary?jsx("p",{style:u.note,children:A.summary}):null,jsx("p",{style:u.note,children:A.feeRecorded?_.cancellationFeeRecorded:_.cancellationFeeNotRecorded})]}):null,n?jsx("section",{style:u.panel,"data-testid":"televet-visits-book-card",children:jsxs("div",{style:u.panelBody,children:[jsx("p",{style:u.bookTitle,children:_.bookCardTitle}),jsx(P,{label:_.bookCardCta,onPress:n,testID:"televet-visits-book"})]})}):null,h.enabled&&h.isPending?jsxs("section",{style:u.panel,children:[jsx(go,{Title:f,title:_.pastTitle,count:null,styles:u}),jsx("div",{role:"progressbar","aria-label":_.loading,"aria-busy":"true",style:u.skeletons,"data-testid":"televet-visits-loading",children:[0,1,2].map(H=>jsx(ae,{height:56},H))})]}):h.isError&&h.data===null?jsxs("div",{role:"alert",style:{...u.notice,...u.noticeDanger},"data-testid":"televet-visits-error",children:[jsx("p",{style:u.noticeTitle,children:_.loadErrorTitle}),jsx("p",{style:u.note,"data-testid":"televet-visits-error-body",children:Ki(h.error)??_.loadErrorBody}),jsx(P,{label:_.retry,kind:"secondary",fullWidth:false,onPress:()=>h.refetch()})]}):jsxs(Fragment,{children:[Q.length>0?jsxs("section",{style:u.panel,"data-testid":"televet-visits-upcoming",children:[jsx(go,{Title:f,title:_.upcomingTitle,count:Q.length,styles:u}),jsx("ul",{"aria-label":_.upcomingTitle,style:u.list,children:Q.map(Z)})]}):null,jsxs("section",{style:u.panel,"data-testid":"televet-visits-past",children:[jsx(go,{Title:f,title:_.pastTitle,count:B.length,styles:u}),L.length===0?jsxs("div",{style:u.empty,"data-testid":"televet-visits-empty",children:[jsx("p",{style:u.noticeTitle,children:_.emptyTitle}),jsx("p",{style:u.note,children:_.emptyBody})]}):B.length===0?null:jsx("ul",{"aria-label":_.pastTitle,style:u.list,children:B.map(Z)})]})]})]})}o(vo,"TelevetVisitsScreen");function go({Title:e,title:t,count:r,styles:n}){return jsxs("div",{style:n.panelHeader,children:[jsx(e,{style:n.panelTitle,children:t}),r===null?null:jsx("span",{style:n.count,children:r})]})}o(go,"PanelHeader");function ec({consult:e,petName:t,nowMs:r,styles:n,cancelling:l,anyCancelInFlight:a,terms:s,onJoin:i,onReschedule:d,onAskCancel:c,onDismissCancel:u,onCancel:f,onRetryTerms:y}){let m=fn(e,r),b=Zt.has(e.status),h=xi(e.status),S=pn(e),C=yn(e.status),E=e.consultId,k=useId(),A=!m.joinable&&!b;return jsxs("li",{style:n.row,"data-testid":`televet-visits-row-${E}`,children:[jsxs("div",{style:n.rowHead,children:[jsxs("div",{children:[jsx("p",{style:n.when,children:kl(e.scheduledAt)}),t?jsx("p",{style:n.pet,children:t}):null]}),h?jsx("span",{style:m.joinable?{...n.chip,...n.chipPositive}:n.chip,"data-testid":`televet-visits-status-${E}`,children:h}):null]}),jsxs("div",{style:n.actions,children:[b?null:jsx(P,{label:_.joinCta,fullWidth:false,disabled:!m.joinable,onPress:()=>i(e,t),describedBy:A?k:void 0,testID:`televet-visits-join-${E}`}),C&&d?jsx(P,{label:_.rescheduleCta,kind:"secondary",fullWidth:false,onPress:()=>d(e),testID:`televet-visits-reschedule-${E}`}):null,C?jsx(P,{label:_.cancelCta,kind:"danger",fullWidth:false,disabled:a,onPress:c,testID:`televet-visits-cancel-${E}`}):null]}),A?jsx("p",{id:k,style:n.note,"data-testid":`televet-visits-join-note-${E}`,children:_i(m.reason,S===null?void 0:xl(new Date(S).toISOString()))}):null,l?jsx(yo,{terms:s,submitting:l.status==="submitting",failure:l.status==="failed"?l.message:null,onConfirm:f,onDismiss:u,onRetryTerms:y,styles:n}):null]})}o(ec,"VisitRow");var tc="Close",rc="Back";function nc(){return jsx("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}o(nc,"CloseGlyph");function bo(e){let{consult:t,onRescheduled:r,onCancel:n,controller:l,style:a,testID:s}=nt(e,["onRescheduled","onCancel"]),i=F(),d=ve(l),c=Rt(t?.clinicianId??null,d),u=Pt(d),f=sn(t?.consultId??null,d),[y,m]=useState(null),b=useCallback(S=>{m(null),u.mutate(S.slotId,{onSuccess:o(()=>{f.mutate(S.slotId,{onSuccess:o(C=>r?.(C),"onSuccess"),onError:o(C=>m(Oe(C).kind==="unavailable"?"unavailable":"failed"),"onError")});},"onSuccess"),onError:o(C=>m(Oe(C).kind==="unavailable"?"unavailable":"taken"),"onError")});},[u,f,r]),h=u.isPending||f.isPending;return we()?t?jsxs("section",{style:{...i.stepFill,...a},"aria-label":p.rescheduleNavTitle,"data-testid":s??"televet-reschedule",children:[jsx("p",{style:i.stepHelp,children:G(p.rescheduleFromTemplate,{when:be(t.scheduledAt)})}),y==="taken"?jsx(q,{message:p.slotTaken}):null,y==="failed"?jsx(q,{message:p.rescheduleFailed}):null,y==="unavailable"?jsx(q,{message:p.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,c.enabled?c.isPending?jsx("div",{role:"progressbar","aria-label":p.loading.slots,"aria-busy":"true",style:i.list,"data-testid":"televet-reschedule-slots-loading",children:[0,1,2].map(S=>jsx(ae,{height:48},S))}):c.isError?jsx($,{title:p.slotsErrorTitle,actionLabel:p.retryCta,onAction:()=>c.refetch(),testID:"televet-reschedule-slots-error"}):(c.data??[]).length===0?jsx("div",{"data-testid":"televet-reschedule-empty",children:jsx($,{title:p.noSlotsTitle})}):jsx(Mt,{slots:c.data??[],busySlotId:h?u.variables:null,onPick:b,dayGroupLabel:p.summaryWhen,timeGroupLabel:p.rescheduleNavTitle,rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):jsx("div",{"data-testid":"televet-reschedule-paused",children:jsx($,{title:p.bookingPausedTitle})}),jsx(P,{label:p.keepExistingCta,kind:"secondary",disabled:h,onPress:()=>n?.(),testID:"televet-reschedule-keep"})]}):jsx("div",{role:"progressbar","aria-label":p.loading.consult,"aria-busy":"true",style:{...i.list,...a},"data-testid":"televet-reschedule-loading",children:[0,1].map(S=>jsx(ae,{height:48},S))}):jsx("div",{style:{...i.stepFill,...a},"data-testid":"televet-reschedule-copy-unapproved"})}o(bo,"EverfurTelevetReschedule");function To(e){let t=e.visitRef?.trim()??"";return t.length>0?Object.freeze({name:"visit",visitRef:t,intent:e.intent??null}):ho}o(To,"televetScreenForRequest");var ho=Object.freeze({name:"home"}),uc=Object.freeze({name:"visits"}),cc=Object.freeze({name:"booking"});function pc(e,t){switch(t.type){case "push":return Object.freeze({stack:Object.freeze([...e.stack,t.screen])});case "pop":return e.stack.length<=1?e:Object.freeze({stack:Object.freeze(e.stack.slice(0,-1))});case "land":return e.stack[0]?.name!=="home"?e:Object.freeze({stack:Object.freeze([t.screen,...e.stack.slice(1)])});default:return e}}o(pc,"navReducer");function xa(e){let{style:t,renderPending:r,className:n,...l}=nt(e,["onExit","onBooked","onAddPet","onRequestLocation","onFindEmergencyVet"]);return jsx(Vi,{capability:"televet",style:t,...n!==void 0?{className:n}:{},...r?{renderPending:r}:{},children:jsx(fc,{...l,...t!==void 0?{style:t}:{}})})}o(xa,"EverfurTelevetFlow");function fc({petRef:e,usState:t,controller:r,onBooked:n,onExit:l,onAddPet:a,onPickMedia:s,onAddToCalendar:i,onConfirmDiscard:d,onRequestLocation:c,locationStatus:u,primaryVet:f,onFindEmergencyVet:y,onTriageReason:m,historyMode:b="memory",canJoinInApp:h=false,renderUnavailable:S,initialScreen:C,headingLevel:E,style:k}){let A=F(),[V,L]=useReducer(pc,C??ho,K=>Object.freeze({stack:Object.freeze([K])})),W=V.stack[V.stack.length-1]??ho,U=V.stack.length,[Q,B]=useState(0),Y=useCallback(()=>B(K=>K+1),[]),j=useRef(0),Z=useRef(U);Z.current=U,useEffect(()=>{if(b!=="browser"||typeof window>"u")return;let K=o(Le=>{let tt=Le.state?.efTelevet;typeof tt=="number"&&tt<Z.current&&(j.current=Math.max(0,j.current-1),L({type:"pop"}));},"onPopState");return window.addEventListener("popstate",K),()=>window.removeEventListener("popstate",K)},[b]);let H=useCallback(K=>{b==="browser"&&typeof window<"u"&&(j.current+=1,window.history.pushState({efTelevet:Z.current+1},"")),L({type:"push",screen:K});},[b]),ue=useCallback(()=>{if(b==="browser"&&typeof window<"u"&&j.current>0){j.current-=1,window.history.go(-1);return}L({type:"pop"});},[b]),Ze=useCallback(()=>S?S():jsx("div",{style:A.list,"data-testid":"televet-unavailable",children:we()?jsx($,{title:p.bookingPausedTitle}):null}),[S,A.list]),I=useCallback(()=>{U>1?ue():l?.();},[U,ue,l]),et=useCallback(K=>L({type:"land",screen:K==="visits"?uc:cc}),[]),Ir=jsx(uo,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{},...r?{controller:r}:{},onBooked:K=>{Y(),n?.(K);},onExit:I,...a?{onAddPet:a}:{},...s?{onPickMedia:s}:{},...i?{onAddToCalendar:i}:{},...d?{onConfirmDiscard:d}:{},...c?{onRequestLocation:c}:{},...u?{locationStatus:u}:{},...f?{primaryVet:f}:{},...y?{onFindEmergencyVet:y}:{},...m?{onTriageReason:m}:{},canJoinInApp:h,renderUnavailable:Ze,...E!==void 0?{headingLevel:E}:{},...k?{style:k}:{}}),Wt=jsx(vo,{...r?{controller:r}:{},revision:Q,isRoot:U<=1,onJoin:(K,Le)=>H({name:"call",consultId:K.consultId,clinicianName:K.clinicianName,petName:Le}),onReschedule:K=>H({name:"reschedule",consult:K}),onBook:()=>H({name:"booking"}),onBack:I,...k?{style:k}:{}});switch(W.name){case "home":return jsx(yc,{controller:r,onLand:et,style:k});case "booking":return Ir;case "visits":case "visit":return Wt;case "reschedule":return jsx(bo,{consult:W.consult,...r?{controller:r}:{},onRescheduled:()=>{Y(),ue();},onCancel:()=>ue(),...k?{style:k}:{}});case "call":return jsx(po,{consultId:W.consultId,...r?{controller:r}:{},...W.clinicianName!==void 0?{clinicianName:W.clinicianName}:{},...W.petName!==void 0?{petName:W.petName}:{},onLeave:()=>{Y(),I();},...k?{style:k}:{}});default:return qt(W)}}o(fc,"TelevetFlowBody");function yc({controller:e,onLand:t,style:r}){let n=F(),l=ve(e),a=ki(l);return useEffect(()=>{a!=="pending"&&t(a);},[a,t]),jsxs("div",{role:"progressbar","aria-label":_.loading,"aria-busy":"true",style:{...n.screen,...n.list,...r},"data-testid":"televet-landing-loading",children:[jsx(ae,{height:72}),jsx(ae,{height:72})]})}o(yc,"TelevetLandingScreen");var So=xa;function vc({request:e,onClose:t}){let r=x(),n=useMemo(()=>bc(r),[r]),l=useMemo(()=>Vl(),[]),a=useCallback(()=>{l.dispatch()||t();},[l,t]),{dialogRef:s,onKeyDown:i,onCancel:d}=xr(true,a),c=useMemo(()=>To(e),[e]);return jsx("dialog",{ref:s,onKeyDown:i,onCancel:d,"aria-label":p.visit.title,"data-testid":"everfur-televet-dialog",style:n,children:jsx(Jn.Provider,{value:l,children:jsx(So,{...e.petRef!==void 0?{petRef:e.petRef}:{},...e.usState!==void 0?{usState:e.usState}:{},initialScreen:c,onExit:t,canJoinInApp:pa(),historyMode:"memory"})})})}o(vc,"EverfurTelevetDialog");function bc(e){let{color:t,radius:r,space:n}=e;return {position:"fixed",inset:0,boxSizing:"border-box",width:"100%",maxWidth:640,height:"100%",maxHeight:"100%",margin:"0 auto",padding:`${String(n.lg)}px 0`,border:0,borderRadius:r.lg,display:"flex",flexDirection:"column",overflowY:"auto",backgroundColor:t.surface,color:t.text.primary}}o(bc,"dialogStyle");export{Eu as BACK_LABEL,er as CANCELLATION_POLICY_VERSION_MAX,De as CANCEL_REASON_MAX,ni as CONSULT_KINDS,dt as CONSULT_MINUTES,ri as CONSULT_STATUSES,So as EverfurTelevet,uo as EverfurTelevetBooking,vc as EverfurTelevetDialog,xa as EverfurTelevetFlow,bo as EverfurTelevetReschedule,tr as MEDIA_REFS_MAX,Lt as NO_MEDIA_SHORTFALL,Fe as REASON_TEXT_MAX,Me as TELEVET_BOOKING_BASE,oe as TELEVET_BOOKING_COPY,p as TELEVET_BOOKING_COPY_WEB,At as TELEVET_BOOKING_STEPS,mi as TELEVET_CONSULT_PAGE_LIMIT,ot as TELEVET_EMERGENCY_EXITS_WEB,cn as TELEVET_JOIN_CLOSES_MINUTES_AFTER,un as TELEVET_JOIN_OPENS_MINUTES_BEFORE,Zt as TERMINAL_CONSULT_STATUSES,Gn as TelevetBookedScreen,Zn as TelevetBookingChrome,yo as TelevetCancelVisitForm,Fl as TelevetClinicianEmptyState,zt as TelevetConsentCheckbox,to as TelevetDayStrip,Nl as TelevetEarlyEmergency,Ft as TelevetEmergencyExits,su as TelevetEntitlementInterestState,eo as TelevetIntakeMedia,po as TelevetJoinScreen,Dt as TelevetMediaDropNotice,Mt as TelevetSlotPicker,$n as TelevetStateInterestAction,oo as TelevetSummaryCard,Xe as TelevetSummaryRow,vo as TelevetVisitsScreen,Ln as attestation,Bt as canConfirm,yn as canManageTelevetVisit,Qr as createTelevetBookingController,On as currentStep,hl as emptyTelevetDraft,Ud as formatVisitRange,Cl as formatWhen,be as formatWhenWithDay,wn as hasPreviousStep,Pn as initialTelevetBookingState,An as isHoldExpired,Dn as isMediaShortfallEmpty,vr as isSkipped,we as isTelevetBookingCopyReady,Ee as isWellFormedStateCode,Tr as mediaShortfallFromUnsentPicks,$r as parseVetCallCredential,wt as splitTelevetVisits,Bn as televetBookingKey,In as televetBookingReducer,Oe as televetBookingRefusal,yi as televetCancelCall,Hl as televetConsultCalendarKey,nr as televetConsultCall,Pr as televetDaysFromSlots,Fn as televetEmptyRosterCause,Nn as televetEmptyRosterView,ci as televetHoldCall,fi as televetJoinCall,fn as televetJoinDecision,pn as televetJoinOpensAtMs,Mn as televetMediaShortfallLines,pi as televetRescheduleCall,To as televetScreenForRequest,Hn as useEarlyTriage,Vn as useStateInterest,an as useTelevetBookConsult,Js as useTelevetBookingAvailable,ve as useTelevetBookingController,rn as useTelevetBookingEntitlement,_t as useTelevetCancellationPolicy,nn as useTelevetClinicians,Pt as useTelevetHoldSlot,co as useTelevetJoin,on as useTelevetNextSlot,sn as useTelevetRescheduleConsult,Rt as useTelevetSlots,tn as useTelevetStatePolicy,gi as validateBookingBody,Kr as vetCallJoinReason,qr as vetCallJoinRefusal,Wd as withUnsentPicks};