@everfur/sdk 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -22
- package/dist/{Chat.d-C76mPD5M.d.cts → Chat.d-CGuvQApZ.d.cts} +1 -1
- package/dist/{Chat.d-Dn_DEpGG.d.ts → Chat.d-DQkMkRlv.d.ts} +1 -1
- package/dist/{DepthViews.d-v6sBxjrf.d.cts → DepthViews.d-Bs79si_g.d.cts} +1 -1
- package/dist/{DepthViews.d-4teBIBu-.d.cts → DepthViews.d-C9HdQhC2.d.cts} +1 -1
- package/dist/{DepthViews.d-DXGAGojW.d.ts → DepthViews.d-DrCO-wqQ.d.ts} +1 -1
- package/dist/{DepthViews.d-B5RHCzGS.d.ts → DepthViews.d-v8fVFY4g.d.ts} +1 -1
- package/dist/{RecordsPage.d-D2J5rMWk.d.ts → RecordsPage.d-BDZ8JRSw.d.ts} +1 -1
- package/dist/{RecordsPage.d-BF4EIVKg.d.cts → RecordsPage.d-a_h8Hlxr.d.cts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/animations/index.js +1 -1
- package/dist/{attachments.d-DMZ8xCT9.d.cts → attachments.d-DjwKMpb0.d.cts} +1 -1
- package/dist/{attachments.d-CedhQFlI.d.ts → attachments.d-HxQiuR6k.d.ts} +1 -1
- package/dist/{bookingCopy.d-DJmo8fzQ.d.cts → bookingCopy.d-CX1IaYNX.d.cts} +2 -2
- package/dist/{bookingCopy.d-CnKq4gvc.d.ts → bookingCopy.d-DFhHqNkX.d.ts} +2 -2
- package/dist/{casesRepository.d-BcmH2Du1.d.cts → casesRepository.d-BvHziaN3.d.cts} +1 -1
- package/dist/{casesRepository.d-CG3psWUQ.d.ts → casesRepository.d-CsXp5ZbO.d.ts} +1 -1
- package/dist/chat/index.cjs +20 -19
- package/dist/chat/index.d.cts +10 -10
- package/dist/chat/index.d.ts +10 -10
- package/dist/chat/index.js +20 -19
- package/dist/chat/lite/index.cjs +20 -19
- package/dist/chat/lite/index.d.cts +10 -10
- package/dist/chat/lite/index.d.ts +10 -10
- package/dist/chat/lite/index.js +20 -19
- package/dist/{chatHandoffToken.d-DETK_czu.d.ts → chatHandoffToken.d-D8ziljrV.d.ts} +5 -5
- package/dist/{chatHandoffToken.d-BRODOPfQ.d.cts → chatHandoffToken.d-N8D7LgiG.d.cts} +5 -5
- package/dist/{checkin.d-CJoVeku7.d.ts → checkin.d-C6v2akWa.d.ts} +4 -4
- package/dist/{checkin.d-CQaV4WL2.d.cts → checkin.d-CVo0MpeG.d.cts} +4 -4
- package/dist/{chunk-PTO64HJN.js → chunk-4YMKIILX.js} +5 -5
- package/dist/{chunk-PSBCFPJG.js → chunk-D5AYE7FR.js} +3 -3
- package/dist/chunk-LFCCBV3J.js +47 -0
- package/dist/{chunk-HGQOS366.js → chunk-OMWBGNXK.js} +1 -1
- package/dist/client/index.cjs +8 -7
- package/dist/client/index.d.cts +10 -10
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.js +8 -7
- package/dist/{clinicBatch.d-CSr_YFGU.d.ts → clinicBatch.d-DUCpGy47.d.ts} +2 -2
- package/dist/{clinicBatch.d-CyXyJab_.d.cts → clinicBatch.d-h4AzQhUH.d.cts} +2 -2
- package/dist/{config.d-Bf15Q27G.d.ts → config.d-Ds1iysW4.d.ts} +20 -1
- package/dist/{config.d-D-7_tLb8.d.cts → config.d-DwLvHCYP.d.cts} +20 -1
- package/dist/consent/index.cjs +2 -2
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/consent/index.js +2 -2
- package/dist/{context.d-CFFj57ZA.d.ts → context.d-CsoglkHv.d.ts} +4 -4
- package/dist/{context.d-CCsGIBuw.d.cts → context.d-_IdRcaaC.d.cts} +4 -4
- package/dist/{copy.d-Dan0WfJS.d.ts → copy.d-CprpMJD2.d.ts} +2 -2
- package/dist/{copy.d-uQ8jl0d3.d.cts → copy.d-Du3C9Itf.d.cts} +2 -2
- package/dist/core/index.cjs +10 -9
- package/dist/core/index.d.cts +14 -14
- package/dist/core/index.d.ts +14 -14
- package/dist/core/index.js +10 -9
- package/dist/{depth.d-DFsi6qtf.d.ts → depth.d-4CAnnHdv.d.ts} +2 -2
- package/dist/{depth.d-DFPfFTPF.d.cts → depth.d-B45A8uzH.d.cts} +2 -2
- package/dist/{entitlementRepository.d-BnvMk7Tc.d.ts → entitlementRepository.d-BVKx1U_k.d.ts} +2 -2
- package/dist/{entitlementRepository.d-t6g97KZm.d.cts → entitlementRepository.d-Cp2ZU7pQ.d.cts} +2 -2
- package/dist/{focus.d-_6rD03Ap.d.ts → focus.d-BmER-Wo9.d.ts} +1 -1
- package/dist/{focus.d-BkPLN-2r.d.cts → focus.d-DkRwLTEB.d.cts} +1 -1
- package/dist/health-plan/index.cjs +11 -6
- package/dist/health-plan/index.d.cts +13 -13
- package/dist/health-plan/index.d.ts +13 -13
- package/dist/health-plan/index.js +11 -6
- package/dist/{healthPlanRepository.d-D6qYjNMQ.d.cts → healthPlanRepository.d-B3je3K9s.d.cts} +2 -2
- package/dist/{healthPlanRepository.d-CuumbPDh.d.ts → healthPlanRepository.d-D8a8n9Jj.d.ts} +2 -2
- package/dist/{idempotency.d-BGhv20mx.d.cts → idempotency.d-CqQ4xvQT.d.cts} +1 -1
- package/dist/{idempotency.d-RxPkjLqJ.d.ts → idempotency.d-Cs5pjjdA.d.ts} +1 -1
- package/dist/{identity.d--2ec4agf.d.ts → identity.d-Bj7WLFXU.d.ts} +1 -1
- package/dist/{identity.d-CFc4KrK0.d.cts → identity.d-Dg3l3zT5.d.cts} +1 -1
- package/dist/{inbox.d-B6kD0a9r.d.ts → inbox.d-DVfTwkEB.d.ts} +1 -1
- package/dist/{inbox.d-CzIVX_ji.d.cts → inbox.d-DYCjhSnO.d.cts} +1 -1
- package/dist/index.cjs +25 -24
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +25 -24
- package/dist/{introEvents.d-wshlRCrU.d.ts → introEvents.d-CmC7ag_3.d.ts} +1 -1
- package/dist/{introEvents.d-BUCbS8oX.d.cts → introEvents.d-Wc0-QPLf.d.cts} +1 -1
- package/dist/{layout.d-C8UKQW3I.d.ts → layout.d-BZbIqvZ_.d.ts} +1 -1
- package/dist/{layout.d-ChcRUbC4.d.cts → layout.d-yLooG8Z0.d.cts} +1 -1
- package/dist/notifications/inbox/index.cjs +2 -2
- package/dist/notifications/inbox/index.d.cts +6 -6
- package/dist/notifications/inbox/index.d.ts +6 -6
- package/dist/notifications/inbox/index.js +2 -2
- package/dist/notifications/index.cjs +2 -2
- package/dist/notifications/index.d.cts +7 -7
- package/dist/notifications/index.d.ts +7 -7
- package/dist/notifications/index.js +2 -2
- package/dist/{optInView.d-DbSRM8qR.d.ts → optInView.d-B_yFAfKk.d.ts} +2 -2
- package/dist/{optInView.d-Cu3J440l.d.cts → optInView.d-Td2Uv3iq.d.cts} +2 -2
- package/dist/{pets.d-BRNg79qq.d.cts → pets.d-CE8_oDjM.d.cts} +1 -1
- package/dist/{pets.d-CS21gvuN.d.ts → pets.d-UFpQT-q3.d.ts} +1 -1
- package/dist/{petsRepository.d-uMbhgEsh.d.cts → petsRepository.d-BVSrxwKa.d.cts} +1 -1
- package/dist/{petsRepository.d-BRL_wPcE.d.ts → petsRepository.d-BvmFXjTc.d.ts} +1 -1
- package/dist/photo/index.cjs +2 -2
- package/dist/photo/index.js +2 -2
- package/dist/records/depth/index.cjs +2 -2
- package/dist/records/depth/index.d.cts +9 -9
- package/dist/records/depth/index.d.ts +9 -9
- package/dist/records/depth/index.js +2 -2
- package/dist/records/index.cjs +2 -2
- package/dist/records/index.d.cts +10 -10
- package/dist/records/index.d.ts +10 -10
- package/dist/records/index.js +2 -2
- package/dist/{requestFunnel.d-BDuYHZMa.d.ts → requestFunnel.d-D8UsEFed.d.ts} +2 -2
- package/dist/{requestFunnel.d-BdTkSu0W.d.cts → requestFunnel.d-fmBVWfsj.d.cts} +2 -2
- package/dist/{route.d-HALH1t37.d.ts → route.d-BnWvGpNN.d.ts} +2 -2
- package/dist/{route.d-BhfmB7Pl.d.cts → route.d-DOXnhbtt.d.cts} +2 -2
- package/dist/{runtimeTypes.d-BrEWaDPX.d.cts → runtimeTypes.d-BlejmEU1.d.cts} +6 -6
- package/dist/{runtimeTypes.d-C7HFG1ev.d.ts → runtimeTypes.d-C6fYXNx2.d.ts} +6 -6
- package/dist/{screenProps.d-BjIsq_NY.d.cts → screenProps.d-BfYg9Eaz.d.cts} +1 -1
- package/dist/{screenProps.d-C_q_3Lj7.d.ts → screenProps.d-Bp0vHiov.d.ts} +1 -1
- package/dist/{sdkConfigStore.d-Cxj2n79d.d.cts → sdkConfigStore.d-BHrzkVpP.d.cts} +5 -0
- package/dist/{sdkConfigStore.d-BKqjpahR.d.ts → sdkConfigStore.d-VPvsIL8E.d.ts} +5 -0
- package/dist/server/events/index.cjs +3 -2
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +3 -2
- package/dist/server/index.cjs +5 -4
- package/dist/server/index.d.cts +9 -3
- package/dist/server/index.d.ts +9 -3
- package/dist/server/index.js +5 -4
- package/dist/shop/index.cjs +12 -6
- package/dist/shop/index.d.cts +3 -3
- package/dist/shop/index.d.ts +3 -3
- package/dist/shop/index.js +13 -7
- package/dist/slots/index.cjs +14 -15
- package/dist/slots/index.d.cts +5 -5
- package/dist/slots/index.d.ts +5 -5
- package/dist/slots/index.js +14 -15
- package/dist/slots/weather-glyphs/index.cjs +1 -1
- package/dist/slots/weather-glyphs/index.js +1 -1
- package/dist/tabs/index.cjs +7 -7
- package/dist/tabs/index.d.cts +10 -10
- package/dist/tabs/index.d.ts +10 -10
- package/dist/tabs/index.js +7 -7
- package/dist/televet/booking/index.cjs +2 -2
- package/dist/televet/booking/index.d.cts +6 -6
- package/dist/televet/booking/index.d.ts +6 -6
- package/dist/televet/booking/index.js +2 -2
- package/dist/televet/index.cjs +2 -2
- package/dist/televet/index.js +2 -2
- package/dist/testing/index.cjs +4 -3
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +4 -3
- package/dist/testing/rn/index.cjs +3 -3
- package/dist/testing/rn/index.d.cts +8 -8
- package/dist/testing/rn/index.d.ts +8 -8
- package/dist/testing/rn/index.js +3 -3
- package/dist/testing/web/index.cjs +2 -2
- package/dist/testing/web/index.d.cts +8 -8
- package/dist/testing/web/index.d.ts +8 -8
- package/dist/testing/web/index.js +2 -2
- package/dist/texting/index.cjs +2 -2
- package/dist/texting/index.d.cts +5 -5
- package/dist/texting/index.d.ts +5 -5
- package/dist/texting/index.js +2 -2
- package/dist/{threadOptions.d-RBSqklk5.d.cts → threadOptions.d-B9OndNS2.d.cts} +4 -4
- package/dist/{threadOptions.d-Suof8GCE.d.ts → threadOptions.d-BlpnY5xP.d.ts} +4 -4
- package/dist/{timelineRows.d-CDA00bav.d.ts → timelineRows.d-BPOMlI-P.d.ts} +1 -1
- package/dist/{timelineRows.d-CXIvLZW0.d.cts → timelineRows.d-BmHu_XLI.d.cts} +1 -1
- package/dist/ui/index.cjs +5 -4
- package/dist/ui/index.js +5 -4
- package/dist/{useHealthPlanSubscription.d-mOHP3D8V.d.ts → useHealthPlanSubscription.d-BAU8x02a.d.ts} +3 -3
- package/dist/{useHealthPlanSubscription.d-BJyHm00W.d.cts → useHealthPlanSubscription.d-CuJMQc_d.d.cts} +3 -3
- package/dist/{useInboxUnread.d-B6WPb-Qs.d.ts → useInboxUnread.d-BUpXjNnT.d.ts} +1 -1
- package/dist/{useInboxUnread.d-BZC4Td0f.d.cts → useInboxUnread.d-By1CkCy2.d.cts} +1 -1
- package/dist/{usePresentation.d-BP8u0FS2.d.cts → usePresentation.d-CgEJRm6Q.d.cts} +2 -2
- package/dist/{usePresentation.d-j0xDpOoe.d.ts → usePresentation.d-kSW7ttTl.d.ts} +2 -2
- package/dist/{useRecordsDepth.d-CvxrlzGi.d.cts → useRecordsDepth.d-BHQgBRBw.d.cts} +1 -1
- package/dist/{useRecordsDepth.d-Cu7-cKAn.d.ts → useRecordsDepth.d-diEF_tFF.d.ts} +1 -1
- package/dist/{useUnread.d-C4wKv3th.d.cts → useUnread.d-CoQKIHVD.d.cts} +3 -3
- package/dist/{useUnread.d-DMicYM85.d.ts → useUnread.d-aRej_wU8.d.ts} +3 -3
- package/dist/video/index.cjs +2 -2
- package/dist/video/index.js +2 -2
- package/dist/{view.d-Bq7d05Pv.d.ts → view.d-CevohC1l.d.ts} +3 -3
- package/dist/{view.d-odmWgaGw.d.cts → view.d-DgXlfcxR.d.cts} +3 -3
- package/dist/web/consent/index.cjs +2 -2
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/consent/index.js +2 -2
- package/dist/web/health-plan/index.cjs +7 -7
- package/dist/web/health-plan/index.d.cts +15 -15
- package/dist/web/health-plan/index.d.ts +15 -15
- package/dist/web/health-plan/index.js +3 -3
- package/dist/web/health-plan/styles.css +59 -0
- package/dist/web/inbox/index.cjs +2 -2
- package/dist/web/inbox/index.d.cts +7 -7
- package/dist/web/inbox/index.d.ts +7 -7
- package/dist/web/inbox/index.js +2 -2
- package/dist/web/index.cjs +22 -21
- package/dist/web/index.d.cts +26 -26
- package/dist/web/index.d.ts +26 -26
- package/dist/web/index.js +22 -21
- package/dist/web/intro/index.cjs +2 -2
- package/dist/web/intro/index.d.cts +7 -7
- package/dist/web/intro/index.d.ts +7 -7
- package/dist/web/intro/index.js +2 -2
- package/dist/web/notifications/index.cjs +2 -2
- package/dist/web/notifications/index.d.cts +6 -6
- package/dist/web/notifications/index.d.ts +6 -6
- package/dist/web/notifications/index.js +2 -2
- package/dist/web/records/depth/index.cjs +2 -2
- package/dist/web/records/depth/index.d.cts +9 -9
- package/dist/web/records/depth/index.d.ts +9 -9
- package/dist/web/records/depth/index.js +2 -2
- package/dist/web/records/index.cjs +2 -2
- package/dist/web/records/index.d.cts +11 -11
- package/dist/web/records/index.d.ts +11 -11
- package/dist/web/records/index.js +2 -2
- package/dist/web/records-sheet/index.cjs +2 -2
- package/dist/web/records-sheet/index.js +2 -2
- package/dist/web/shop/index.cjs +9 -9
- package/dist/web/shop/index.d.cts +3 -3
- package/dist/web/shop/index.d.ts +3 -3
- package/dist/web/shop/index.js +4 -4
- package/dist/web/televet/booking/index.cjs +2 -2
- package/dist/web/televet/booking/index.d.cts +6 -6
- package/dist/web/televet/booking/index.d.ts +6 -6
- package/dist/web/televet/booking/index.js +2 -2
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/televet/index.cjs +2 -2
- package/dist/web/televet/index.js +2 -2
- package/dist/web/texting/index.cjs +2 -2
- package/dist/web/texting/index.d.cts +5 -5
- package/dist/web/texting/index.d.ts +5 -5
- package/dist/web/texting/index.js +2 -2
- package/dist/web/ui/index.cjs +8 -8
- package/dist/web/ui/index.js +1 -1
- package/dist/web/ui/styles.css +66 -0
- package/package.json +5 -5
- package/dist/chunk-QMYYV67E.js +0 -47
package/dist/tabs/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
|
-
import{EverfurChat,useEverfurUnread,EverfurPoweredBy}from"@everfur/sdk/chat";import{useHealthPlanPage,HealthPlanScrollScope,EverfurHealthPlan,useEverfurHealthPlan}from"@everfur/sdk/health-plan";import{useEverfurRecordsClinic,EverfurRecords,EverfurRecordsConsent,useEverfurRecords}from"@everfur/sdk/records";import{createContext,forwardRef,createElement,useRef,useState,useMemo,useEffect,useCallback,useContext,useLayoutEffect,useSyncExternalStore}from"react";import{TextInput as TextInput$1,StyleSheet,View,Pressable,Easing,Platform,Text as Text$1,Image,Animated,PanResponder,Modal,KeyboardAvoidingView,ScrollView,Dimensions,AccessibilityInfo,AppState,useWindowDimensions,ActivityIndicator}from"react-native";import{jsx,jsxs,Fragment}from"react/jsx-runtime";import{EverfurInboxBell,EverfurInboxSheet}from"@everfur/sdk/notifications/inbox";import{useVetVisit}from"@everfur/sdk/televet";var SIGNALS_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanSignals@v1"),signalHost=globalThis;function isSignalState(value){if(typeof value!="object"||value===null)return false;let v=value;return v.landed instanceof Set&&v.noVet instanceof Set&&v.noVetByPet instanceof Map}var stored=signalHost[SIGNALS_SYMBOL],fresh=()=>({landed:/* @__PURE__ */new Set,noVet:/* @__PURE__ */new Set,noVetByPet:/* @__PURE__ */new Map}),state=isSignalState(stored)?stored:signalHost[SIGNALS_SYMBOL]=fresh(),landedListeners=state.landed,noVetListeners=state.noVet,noVetByPet=state.noVetByPet;function notifyHealthPlanRecordsLanded(petRef,source="host"){for(let listener of[...landedListeners])try{listener(petRef,source)}catch{}}function onHealthPlanRecordsLanded(listener){return landedListeners.add(listener),()=>{landedListeners.delete(listener)}}function setHealthPlanNoVet(petRef,noVet){if((noVetByPet.get(petRef)??false)!==noVet){noVet?noVetByPet.set(petRef,true):noVetByPet.delete(petRef);for(let listener of[...noVetListeners])try{listener(petRef,noVet)}catch{}}}function healthPlanNoVet(petRef){return noVetByPet.get(petRef)??false}function onHealthPlanNoVet(listener){return noVetListeners.add(listener),()=>{noVetListeners.delete(listener)}}var RETRYABILITY_ROWS=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze(RETRYABILITY_ROWS.map(row=>/* @__PURE__ */Object.freeze(row)));/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
|
|
2
|
+
import{EverfurChat,useEverfurUnread,EverfurPoweredBy}from"@everfur/sdk/chat";import{useHealthPlanPage,HealthPlanScrollScope,EverfurHealthPlan,useEverfurHealthPlan}from"@everfur/sdk/health-plan";import{useEverfurRecordsClinic,EverfurRecords,EverfurRecordsConsent,useEverfurRecords}from"@everfur/sdk/records";import{createContext,forwardRef,createElement,useRef,useState,useMemo,useEffect,useCallback,useContext,useLayoutEffect,useSyncExternalStore}from"react";import{TextInput as TextInput$1,StyleSheet,View,Pressable,Easing,Platform,Text as Text$1,Image,Animated,PanResponder,Modal,KeyboardAvoidingView,ScrollView,Dimensions,AccessibilityInfo,AppState,useWindowDimensions,ActivityIndicator}from"react-native";import{jsx,jsxs,Fragment}from"react/jsx-runtime";import{EverfurInboxBell,EverfurInboxSheet}from"@everfur/sdk/notifications/inbox";import{useVetVisit}from"@everfur/sdk/televet";var SIGNALS_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanSignals@v1"),signalHost=globalThis;function isSignalState(value){if(typeof value!="object"||value===null)return false;let v=value;return v.landed instanceof Set&&v.noVet instanceof Set&&v.noVetByPet instanceof Map}var stored=signalHost[SIGNALS_SYMBOL],fresh=()=>({landed:/* @__PURE__ */new Set,noVet:/* @__PURE__ */new Set,noVetByPet:/* @__PURE__ */new Map}),state=isSignalState(stored)?stored:signalHost[SIGNALS_SYMBOL]=fresh(),landedListeners=state.landed,noVetListeners=state.noVet,noVetByPet=state.noVetByPet;function notifyHealthPlanRecordsLanded(petRef,source="host"){for(let listener of[...landedListeners])try{listener(petRef,source)}catch{}}function onHealthPlanRecordsLanded(listener){return landedListeners.add(listener),()=>{landedListeners.delete(listener)}}function setHealthPlanNoVet(petRef,noVet){if((noVetByPet.get(petRef)??false)!==noVet){noVet?noVetByPet.set(petRef,true):noVetByPet.delete(petRef);for(let listener of[...noVetListeners])try{listener(petRef,noVet)}catch{}}}function healthPlanNoVet(petRef){return noVetByPet.get(petRef)??false}function onHealthPlanNoVet(listener){return noVetListeners.add(listener),()=>{noVetListeners.delete(listener)}}var RETRYABILITY_ROWS=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze(RETRYABILITY_ROWS.map(row=>/* @__PURE__ */Object.freeze(row)));/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function errorFrame(fields){/* @__PURE__ */
|
|
5
|
-
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
5
|
+
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null,...fields.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...fields.freeCap})}:{}})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
6
6
|
/* @__PURE__ */Object.freeze({call:call,phase:"stream.open",method:req.method,path:req.path,attempt:0}));try{yield*deps.auth.transport.stream(req,signal)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
7
7
|
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop2=()=>{};if(!caller)return{signal:deadline,dispose:noop2};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop2};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}var INTRO_PATH="/widget/v1/me/intro";function disposed(verb){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${verb} was called after unmount`})}function malformed(call){return makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:`${call}: the response was not the documented shape`})}function introStateFromWire(raw){if(raw===null||typeof raw!="object"||Array.isArray(raw))return null;let o=raw;if(!("seen_at"in o))return null;let at=o.seen_at;return at===null?/* @__PURE__ */Object.freeze({seenAt:null}):typeof at!="string"||at.length===0||at.length>64||Number.isNaN(Date.parse(at))?null:/* @__PURE__ */Object.freeze({seenAt:at})}function createIntroRepository(runtime){let over=()=>{let{services:services}=runtime.registry;return createIntroRepositoryOver({auth:services.authFor(null),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{}})},gone=verb=>Promise.resolve(err(disposed(verb)));return{read:opts=>runtime.isDisposed?gone("read"):over().read(opts),markSeen:()=>runtime.isDisposed?gone("markSeen"):over().markSeen()}}function createIntroRepositoryOver(deps){let funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),call=async(name,req,opts)=>{let res=await funnel.send(name,req,opts);if(!res.ok)return err(res.error);let state3=introStateFromWire(res.value);return state3===null?err(malformed(name)):ok(state3)};return{read(opts){let req=opts?.signal?{method:"GET",path:INTRO_PATH,signal:opts.signal}:{method:"GET",path:INTRO_PATH};return call("intro.read",req,{maxAttempts:1})},markSeen(){return call("intro.markSeen",{method:"PUT",path:INTRO_PATH,body:{seen:true}})}}}var INTRO_SEEN_KV_PREFIX="everfur.intro.seen.v1:",keyFor=userRef=>`${INTRO_SEEN_KV_PREFIX}${userRef}`;async function readIntroSeenLocally(kv,userRef){try{return await kv.getItem(keyFor(userRef))!==null}catch{return false}}async function keepIntroSeenLocally(kv,userRef,at){try{await kv.setItem(keyFor(userRef),at)}catch{}}async function shouldPlayIntro(deps){let{repo:repo,kv:kv,userRef:userRef,signal:signal}=deps;if(userRef===null||await readIntroSeenLocally(kv,userRef))return false;let read;try{read=await repo.read(signal?{signal:signal}:void 0)}catch{return false}return signal?.aborted===true||!read.ok?false:read.value.seenAt!==null?(await keepIntroSeenLocally(kv,userRef,read.value.seenAt),false):true}async function markIntroSeen(deps){let{repo:repo,kv:kv,userRef:userRef}=deps;if(userRef!==null){await keepIntroSeenLocally(kv,userRef,(deps.now?.()??/* @__PURE__ */new Date).toISOString());try{await repo.markSeen()}catch{}}}var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}function healthPlanPetWords(name,sex){let n=name?.trim()??"",named=n===""?"your pet":n,Named=n===""?"Your pet":n;return sex==="female"?{name:named,Name:Named,poss:"her",Poss:"Her",obj:"her"}:sex==="male"?{name:named,Name:Named,poss:"his",Poss:"His",obj:"him"}:{name:named,Name:Named,poss:`${named}'s`,Poss:`${Named}'s`,obj:named}}var cartRenewal=p=>p===null?"":`${p.productName} renews every ${p.intervalDays} days at ${p.box??""} until you cancel; skip or cancel anytime in the app.`;function healthPlanFocusCopyFor(pet){let w=healthPlanPetWords(pet.name,pet.sex),nameOf=p=>p.petName?.trim()||w.name,NameOf=p=>p.petName?.trim()||w.Name,copy=/* @__PURE__ */Object.freeze({jumpKicker:(p,subscribed)=>subscribed?`In ${w.poss} plan, every ${p.intervalDays} days`:p.offer?`${p.discountPercent}% off ${w.poss} first box`:p.intervalDays>0?`Ships every ${p.intervalDays} days`:copy.onceLine(p),optionsLabel:"How to buy",subscribe:"Subscribe",bestValue:"Best value",subscribeLine:p=>p.offer?`First box, then ${p.box??""}`:`${p.box??""} every ${p.intervalDays} days`,priceLine:p=>p.offer?`${p.discountPercent}% off the first box. Ships every ${p.intervalDays} days.`:p.intervalDays>0?`Ships every ${p.intervalDays} days.`:copy.onceOffer(p),once:"One box",onceLine:p=>p.onceDiscountPercent>0?`${p.onceDiscountPercent}% off, ships once`:"Ships once",buyOnce:p=>`Buy one box, ${p.once??p.box??""}`,subscribed:"Subscribed",subscribedLine:(p,next)=>next===null?`Every ${p.intervalDays} days`:`Every ${p.intervalDays} days · next box ${next}`,manage:"Manage",checkoutKicker:"Checkout",checkoutTitle:p=>`Checkout: ${p.productName}`,checkoutOffer:p=>`${p.discountPercent}% off your first box.`,shipsEvery:"Ships every",days:n=>`${n} days`,buyOnceOption:"Buy once",checkoutGo:(_p,subscribe,today)=>`${subscribe?"Subscribe":"Buy now"} · ${today} today`,renews:p=>`Renews every ${p.intervalDays} days at ${p.box??""} until you cancel; skip or cancel anytime in the app.`,onceFine:"One box, ships tomorrow.",onceOffer:p=>p.onceDiscountPercent>0?`${p.onceDiscountPercent}% off, ships once.`:"Ships once.",checkoutNote:"",close:"Close",startedTitle:p=>`${NameOf(p)}'s plan has started.`,orderedTitle:()=>"Order placed.",startedWhat:p=>`${p.productName} ships tomorrow.`,startedNote:"",startedSteps:"What happens next",tomorrow:"Tomorrow",firstBoxShips:`${w.Poss} first box ships.`,trackingComesByText:"Tracking comes by text.",checkin:q=>q===null?"A 2-week check-in by text.":`A 2-week check-in by text: ${q}`,refill:`A text 3 days before ${w.poss} next box. Reply SKIP to skip it.`,nextBoxShips:p=>`${w.Poss} next box ships, ${p.box??""}.`,startedDone:`Back to ${w.poss} plan`,manageKicker:"Your subscription",manageTitle:p=>`Manage ${p.productName}`,skip:"Skip the next box",cancel:"Cancel subscription",skipped:(_p,next)=>next===null?"Skipped.":`Skipped. ${w.Poss} next box ships ${next}.`,cancelled:p=>`${p.productName} is cancelled. Restart it from ${w.poss} plan anytime.`,orders:"Orders",startedHeader:"Subscribed",placedHeader:"Order placed",cartCheckoutTitle:"Checkout",orderNote:"",cartLabel:n=>n>0?`Cart, ${n} item${n>1?"s":""}`:"Cart, empty",addToCart:price=>`Add to cart · ${price}`,viewCart:"View cart",addedToCart:(p,subscription)=>`${p.productName} is in your cart${subscription?", as a subscription":""}.`,removedFromCart:name=>`${name} is out of your cart.`,cartTitle:"Cart",cartEmptyTitle:"Your cart is empty",cartEmptyBody:p=>`${NameOf(p)}'s plan pick lands here when you add it.`,seeOrders:`See ${w.poss} orders`,quantityLabel:name=>`How many: ${name}`,fewer:"One fewer",more:"One more",remove:"Remove",cartSubLine:p=>p.offer?`First box ${p.discountPercent}% off, then ${p.box??""} every ${p.intervalDays} days`:`Every ${p.intervalDays} days`,cartOnceLine:(p,subscribed)=>subscribed?`An extra box. ${w.Poss} plan keeps shipping.`:p.onceDiscountPercent>0?`One box, ${p.onceDiscountPercent}% off`:"One box",cartModeLabel:name=>`How to buy ${name}`,cartModeSubscribe:p=>p.offer?`Subscribe, ${p.discountPercent}% off the first box`:"Subscribe",cartModeOnce:p=>p.onceDiscountPercent>0?`One box, ${p.onceDiscountPercent}% off`:"One box",subtotal:"Subtotal",shipping:"Shipping",shippingValue:"",shippingTag:"",total:"Total",dueToday:"Due today",thenRenews:p=>`Then ${p.productName}`,renewsEvery:p=>`${p.box??""} every ${p.intervalDays} days`,checkoutCart:total=>`Checkout · ${total}`,cartOneAtATime:"",cartSubscriptionApart:"",cartItemSubscription:p=>`Subscription, every ${p.intervalDays} days`,cartItemQuantity:n=>`Qty ${n}`,placeOrder:(total,subscribe)=>`${subscribe?"Place order and subscribe":"Place order"} · ${total}`,cartFine:p=>`${p===null?"":`${cartRenewal(p)} `}Ships tomorrow.`,placedSteps:"What's coming",placedShips:"It ships.",placedArrives:"It arrives at home.",viewOrder:"View order",herSubscription:`${w.Poss} subscription`,nextBox:day=>`Next box ${day}`,everyDays:n=>`Every ${n} days`,ordersHeading:afterSubscription=>afterSubscription?"Orders":`${w.Poss} orders`,ordersFine:"",ordersEmptyTitle:"No orders yet",ordersEmptyBody:p=>`The boxes from ${nameOf(p)}'s plan show up here.`,moreOrders:"",orderSteps:["Ordered","Shipped","Out for delivery","Delivered"],subscriptionBox:"Subscription box",orderTitle:n=>n===null?"Order":`Order ${n}`,arrivesBy:day=>`Arrives by ${day}`,deliveredOn:day=>`Delivered ${day}`,expected:day=>`Expected ${day}`,tracking:"Tracking",trackingByText:"The tracking number comes by text when it ships.",trackOn:carrier=>`Track on ${carrier}`,trackLink:"",inThisOrder:"In this order",orderItemLine:(n,box2)=>`Qty ${n}${box2?" · subscription box":""}`,paidWith:"Paid with",buyAgain:"Buy again",orderHelp:"Get help with this order",addWeightTitle:`Add ${w.poss} weight to size ${w.poss} dose`,addWeightBody:`From a home scale or ${w.poss} last vet visit.`,connectRecordsTitle:`Connect ${w.poss} vet records`,connectRecordsBody:`${w.Poss} weight, visits and labs make ${w.poss} plan sharper.`,weightKicker:`${w.Poss} weight`,weightTitle:p=>`Add ${nameOf(p)}'s weight`,weightBody:`From a home scale or ${w.poss} last vet visit. ${w.Poss} plan uses it to size ${w.poss} dose.`,weightField:`${w.Poss} weight`,weightUnit:"lb",weightUnitKg:"kg",weightErrorKg:"Enter your pet’s weight",weightError:`Enter ${w.poss} weight in pounds, like 14.1.`,weightSave:`Save ${w.poss} weight`,weightSaved:lb=>`Saved: ${lb} lb. ${w.Poss} dose is sized for ${w.obj}.`,weightSavedKg:kg=>`Saved: ${kg} kg. ${w.Poss} dose is sized for ${w.obj}.`,checkoutFailed:"That didn't go through. Please try again.",builtWith:vet=>`Built with ${vet}`,fromVet:shortName=>`From ${shortName}`,waitVetTips:vet=>`Free tips from ${vet}, built around that risk`,signalsFit:count=>`${count} of ${count} signals fit ${w.Name}`,signalsValue:count=>`${count}/${count}`,noPick:`No supplement for this one. ${w.Poss} vet comes first.`,callYourVet:"Call your vet today",callAVet:"Call a vet today",saveForCheckup:`Save for ${w.poss} next checkup`,savedForCheckup:`Saved for ${w.poss} next checkup`,blanksLabel:`${w.Poss} three blanks`,blanksAsked:clinic=>`Asked ${clinic}`,blanksAskedNoClinic:"",blanksWaitPill:"2 to 5 days",blanksFilledKicker:`From ${w.poss} vet records`,blanksFilled:(filled,total)=>`${filled} of ${total} filled`,blanksWeight:`Keep ${w.obj} at `,blanksWeightSource:`From ${w.poss} vet visits`,blanksDose:(dose,product)=>`${dose} of ${product}`,blanksDoseSource:`Sized to ${w.poss} weight`,blanksShots:`${w.Poss} next shots are due `,blanksShotsSource:`From ${w.poss} clinic`,blankEmpty:"blank",recordsLanded:`${w.Poss} records are in. ${w.Poss} plan now uses ${w.poss} weight and ${w.poss} visits.`,todayLabel:`${w.Poss} Health Plan`,poweredBy:"powered by",poweredByName:"Everfur",seeMore:"See more",seeLess:"See less",reportActions:"Actions to take",openReport:`Open it in ${w.poss} report`,askReport:"Ask about it",fullOpen:`See ${w.poss} full plan`,fullOpenLine:`${w.Poss} vet, reviews and ${w.poss} checkup`,fullClose:`Show ${w.poss} brief plan`,fullCloseLine:`${w.Poss} risk, tips, pick and signs`,hopeNoted:phrases=>`Noted. When ${w.poss} results land, we'll start with ${phrases}.`,productLink:product=>`${product}, see the product`,productPhotos:product=>`${product} photos, swipe for more`,shopAll:"Shop all",madeFor:`Made for ${w.name}`,ratingLine:count=>`· ${count} reviews`,productOffer:p=>`${p.discountPercent}% off ${w.poss} first box`,productEvery:p=>`Every ${p.intervalDays} days`,productOnce:p=>p.onceDiscountPercent>0?`One box, ${p.onceDiscountPercent}% off`:"One box",productExtraBox:"An extra box",productOnPlan:p=>`On ${w.poss} plan, every ${p.intervalDays} days. This adds one extra box.`,quantity:"Quantity",description:"Description",readMore:"Read more",readLess:"Read less",whatsInside:"What's inside",howMuch:"How much",reviewsTitle:"Reviews",reviewCount:count=>`${count} reviews`,reviewsSwipe:"Reviews, swipe for more",readAllReviews:count=>`Read all ${count} reviews`,starsLabel:rating=>`${rating} out of 5 stars`,buyNow:"Buy now"});return copy}healthPlanFocusCopyFor({sex:"female"});var EVERFUR_INTRO_COPY=/* @__PURE__ */Object.freeze({eyebrow:"",lede:"",pendingLede:"",recordsRowMore:"",planTopic:"",askTitle:"",noVetTitle:"",sentFine:"",clinicEta:"",blanksDetail:"",bannerBody:"",appName:""});function introPetWords(name,sex){let words=healthPlanPetWords(name,sex);return{...words,subj:sex==="female"?"she":sex==="male"?"he":words.name}}var NUMBER_WORDS=["","one","two","three","four","five","six","seven","eight","nine","ten"];function numberWord(n){return Number.isInteger(n)&&n>=1&&n<=10?NUMBER_WORDS[n]??null:null}var cap=s=>s===""?s:s.charAt(0).toUpperCase()+s.slice(1);function defaultIntroBlanks(p){return[{before:`Keep ${p.obj} at `,after:" lb",source:`From ${p.poss} vet visits`},{before:`${p.Poss} next shots are due `,after:"",source:`From ${p.poss} clinic`,width:"l"}]}function introFacts(page,petName){let name=page?.pet.name??petName??null,design=page?.page??null,byline=design?.byline?.name?.trim()??"";return{pet:introPetWords(name,page?.pet.sex??null),planTitle:design?.title.trim()??"",vetName:page?.vetReviewed===true&&byline!==""?byline:null,tips:design?.routine?.steps.length??0}}function introText(input){let{facts:facts,copy:copy,resultsPending:resultsPending}=input,p=facts.pet,n=numberWord(input.blanks),tips=numberWord(facts.tips),topic=copy.planTopic.trim(),vet=facts.vetName===null?null:facts.vetName.replace(/ /g," "),planFor=topic===""?"":`One plan for ${p.poss} ${topic}${vet===null?"":`, built with ${vet}`}.`,tipsLine=tips===null?"":`${cap(tips)} tips, one thing to add.`,planRow=resultsPending?`${p.Poss} plan arrives with ${p.poss} results.`:[planFor,tipsLine].filter(s=>s!=="").join(" "),recordsRow=[`What could go wrong for ${p.name}, and what's changed.`,copy.recordsRowMore.trim()].filter(s=>s!=="").join(" ");return{sheetLabel:{intro:`Welcome to ${p.Name}'s tab`,records:`Request ${p.poss} records`},back:"Back",skip:"Skip",close:"Close",poweredBy:"powered by",tabs:{eyebrow:copy.eyebrow,title:`${p.Name}'s health, in three tabs.`,lede:resultsPending?copy.pendingLede:copy.lede,ask:`Trained on 50,000+ peer-reviewed vet publications. Ask about ${p.name} any hour (the 2 am ones too).`,plan:planRow,records:recordsRow,next:"Next",seePlan:`See ${p.poss} plan`},ask:{title:copy.askTitle,lede:n===null?"":`${p.Poss} plan has ${n} blanks only ${p.poss} vet can fill (we ask the clinic for you).`,blanksPill:`${input.blanks} blanks`,blankLabel:"blank",later:"Later",connect:`Connect ${p.poss} vet`,fine:`We send ${p.poss} clinic a secure request and read every page they send back.`,noVet:`${p.Name} doesn't have a vet yet`},clinic:{title:`Where does ${p.name} see ${p.poss} vet?`,search:"Clinic name, city or zip",searchLabel:`Search for ${p.poss} clinic`,list:"Clinics",more:`Sees more than one? Start with the one ${p.subj} sees most.`,request:`Request ${p.poss} records`,upload:"Upload a PDF or a photo instead",add:`Add ${p.poss} clinic`},sent:{eyebrow:"Request sent",title:"Sent. Now it's the clinic's turn.",track:`${p.Poss} records request`,sentStep:"Request sent",sentTo:clinic=>`Today, to ${clinic}`,clinicStep:`${p.Poss} clinic sends ${p.poss} records`,clinicEta:copy.clinicEta,blanksStep:n===null?"":`${p.Poss} ${n} blanks fill in`,blanksDetail:copy.blanksDetail,lede:`Turn on notifications and we'll tell you the minute ${p.name}'s records are in.`,notify:"Turn on notifications",notNow:"Not now",fine:copy.sentFine},noVet:{title:copy.noVetTitle,lede:n===null?"":`When ${p.subj} does, connect ${p.poss} vet in Records and ${p.poss} ${n} blanks fill in.`,seePlan:`See ${p.poss} plan`},toast:{on:`Notifications on. We'll tell you the minute ${p.name}'s records are in.`,off:`Requested. ${p.Name}'s records will show up here when they're in.`,landed:`${p.Poss} records are in. ${p.Poss} plan now uses ${p.poss} weight and ${p.poss} visits.`},banner:{app:copy.appName,now:"now",title:`${p.Name}'s records are in`,body:copy.bannerBody}}}var INTRO_OPEN_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#IntroOpen@v1"),host=globalThis;function isIntroOpenState(value){if(typeof value!="object"||value===null)return false;let v=value;return v.holds instanceof Set&&v.listeners instanceof Set}var stored2=host[INTRO_OPEN_SYMBOL],fresh2=()=>({holds:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set}),state2=isIntroOpenState(stored2)?stored2:host[INTRO_OPEN_SYMBOL]=fresh2();function notify(){for(let listener of[...state2.listeners])try{listener()}catch{}}function holdIntroOpen(){let token={};return state2.holds.add(token),state2.holds.size===1&¬ify(),()=>{state2.holds.delete(token)&&state2.holds.size===0&¬ify()}}function useIntroOpenHold(held){useEffect(()=>held?holdIntroOpen():void 0,[held])}function definedProps(props){let out={};if(props==null)return out;for(let key of Object.keys(props))props[key]!==void 0&&(out[key]=props[key]);return out}var HISTORY_COPY=/* @__PURE__ */Object.freeze({heading:"Chats",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No chats match that.",loading:"Loading your chats…",loadFailed:"Couldn’t load your chats",loadingMore:"Loading more…",untitled:"New conversation",newChat:"New chat",searchPlaceholder:"Search chats…",search:"Search chats",countLabel:"Chats and vet messages",countSeparator:" · ",newReply:"New reply · {date}",retry:"Try again",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages…",openConversation:"Open conversation",unreadPrefix:"Unread. "});var INBOX_COPY=/* @__PURE__ */Object.freeze({title:"Notifications",loading:"Loading notifications",emptyTitle:"You’re all caught up",emptyBody:"Updates about your pet’s care will show up here.",errorTitle:"Could not load your notifications",errorBody:"Check your connection and try again.",retry:"Try again",rowFallbackTitle:"Notification",unreadPrefix:"Unread.",timeAgoSuffix:"ago",now:"Now",more:"Show more",detailErrorTitle:"Could not load this notification",detailErrorBody:"Check your connection and try again.",notFoundTitle:"This notification is no longer available",notFoundBody:"The notification may have expired or been removed.",back:"Back to inbox"});function surfaceForNotification(notification){let{target:target}=notification;switch(target.kind){case"case":case"chat":/* @__PURE__ */
|
|
8
8
|
return Object.freeze({surface:"chat",petRef:target.petRef,checkinTarget:target});case"pet":return notification.eventType==="chat.reminder_due"?/* @__PURE__ */Object.freeze({surface:"chat",petRef:target.petRef,checkinTarget:/* @__PURE__ */Object.freeze({kind:"chat",petRef:target.petRef,conversationId:null})}):notification.eventType.startsWith("care.")?null:/* @__PURE__ */Object.freeze({surface:"records",petRef:target.petRef,requestId:null});case"tip":/* @__PURE__ */
|
|
@@ -142,7 +142,7 @@ return Object.freeze({videoAndRx:stateList(gate.video_and_rx),adviceOnly:stateLi
|
|
|
142
142
|
return Object.freeze({schemaVersion:schemaVersion,partner:typeof raw.partner=="string"?raw.partner:"",revision:revision,settings:resolveSettings(settings).settings,fixedStrings:resolveFixedStrings(raw.fixed_strings),stateGate:parseStateGate(raw.state_gate)})}function serializeSdkConfig(config){return JSON.stringify({schema_version:config.schemaVersion,partner:config.partner,revision:config.revision,settings:config.settings,fixed_strings:config.fixedStrings,state_gate:{video_and_rx:config.stateGate.videoAndRx,advice_only:config.stateGate.adviceOnly}})}var THEME_SLOT_NAMES=/* @__PURE__ */Object.freeze(["composerInput","sendButton","userBubble","assistantBubble","vetBubble","recordCard","vetVisitButton","primaryButton","link","header","banner","chip","card","input","tab","bookingStep","dialog","cartBar","planCard","planReasonLabel","planWash","planChip"]);var PRESENTATION_LOCK="presentation";var LOCKABLE_THEME_FIELDS=/* @__PURE__ */Object.freeze(["display_name","logo_url","logo_url_dark","primary_color","accent_color","primary_color_dark","accent_color_dark","brightness","color_scheme","font_family","font_url","fonts","font_urls","chat_placeholder","surface_style","radius_scale","accessibility_max_font_scale","slots","background_color","background_color_dark","text_color","text_color_dark","danger_color","danger_color_dark","font_size_base","border_radius","spacing_unit","success_color","success_color_dark","warning_color","warning_color_dark","info_color","info_color_dark","heading_font_family","font_weight_body","font_weight_heading","line_height","assistant_avatar_url","font_sources"]);function hardenHttpsUrl(url){if(url===null)return null;let trimmed=url.trim();return trimmed.length===0?null:/^https:\/\/\S+$/i.test(trimmed)?trimmed:null}var BRAND_ASSET_URL=/^https:\/\/sdk(-staging)?\.everfur\.com\/brand\/[0-9a-f]{16}\.(png|jpg|webp)$/;function hardenBrandAssetUrl(url){let https=hardenHttpsUrl(url);return https!==null&&BRAND_ASSET_URL.test(https)?https:null}var EVERFUR_ASK_ICON="everfur-ask";function weightsOf(file){let parts=file.weight.trim().split(/\s+/).map(Number).filter(n=>Number.isFinite(n)),lo=parts[0]??400,hi=parts[1]??lo,out=[];for(let w=Math.ceil(lo/100)*100;w<=hi;w+=100)w>=100&&w<=900&&out.push(String(w));return out.length===0?["400"]:out}function fontSourcesOf(settings){let out=[];for(let file of settings["look.font.files"])for(let weight of weightsOf(file))out.push(/* @__PURE__ */Object.freeze({family:file.family,src:file.url,weight:weight}));/* @__PURE__ */
|
|
143
143
|
return Object.freeze(out)}function slotsOf(settings){let button=buttonFill(settings),heading=settings["look.color.heading"],bubble=settings["look.color.bubble"],firstChip=settings["look.color.chips"][0]??settings["look.color.tint"],card=settings["look.radius.card"];/* @__PURE__ */
|
|
144
144
|
return Object.freeze({primaryButton:{backgroundColor:button.fill,textColor:button.ink},sendButton:{backgroundColor:button.fill,textColor:button.ink},vetVisitButton:{backgroundColor:button.fill,textColor:button.ink},userBubble:bubble==="none"?{backgroundColor:settings["look.color.surface"],textColor:settings["look.color.ink"]}:{backgroundColor:bubble,textColor:bubbleInk(bubble,settings["look.color.ink"])},composerInput:{borderColor:heading,backgroundColor:"#FFFFFF",textColor:settings["look.color.ink"]},chip:{backgroundColor:firstChip,textColor:chipInk(firstChip,heading)},card:{backgroundColor:"#FFFFFF",borderColor:settings["look.color.line"],borderRadius:card,textColor:settings["look.color.ink"]},recordCard:{backgroundColor:"#FFFFFF",borderColor:settings["look.color.line"],borderRadius:card},dialog:{borderRadius:settings["look.radius.sheet"]},header:{backgroundColor:settings["look.color.surface"],textColor:heading},tab:{textColor:heading,borderColor:settings["look.color.primary"]},link:{textColor:settings["look.color.accent"]}})}var V3_LOCKED_FIELDS=/* @__PURE__ */Object.freeze([...LOCKABLE_THEME_FIELDS,...THEME_SLOT_NAMES.map(name=>`slots.${name}`),"hide_powered_by",PRESENTATION_LOCK]);function sdkConfigBranding(config){let s=config.settings,askIcon=s["look.ask_icon"],weight=s["look.font.heading_weight"];/* @__PURE__ */
|
|
145
|
-
return Object.freeze({schemaVersion:2,displayName:s["text.partner_name"],logoUrl:s["look.logo.mark"],primaryColor:s["look.color.primary"],accentColor:s["look.color.accent"],brightness:"light",fontFamily:s["look.font.body"],fontUrl:null,headingFontFamily:s["look.font.heading"],fontWeightHeading:String(weight),fontSources:fontSourcesOf(s),placeholder:s["text.ask.placeholder"],placeholderFillsPet:true,hidePoweredBy:false,backgroundColor:s["look.color.surface"],textColor:s["look.color.ink"],borderRadius:s["look.radius.card"],assistantAvatarUrl:askIcon===EVERFUR_ASK_ICON?null:askIcon,slots:slotsOf(s),presentation:{chatComposerMic:true,chatComposerUpload:true,chatComposerStyle:"compact",chatComposerPlaceholder:"generic",safetyDisclaimerPlacement:"composer",chatGeneralBanner:s["layout.severity"]!=="off"},lockedFields:V3_LOCKED_FIELDS})}var SDK_CONFIG_PATH="/widget/v1/sdk-config",SDK_CONFIG_SCHEMA_HEADER="x-everfur-sdk-config-schema";function sdkConfigRequest(cachedRevision){let headers={[SDK_CONFIG_SCHEMA_HEADER]:String(3)};return typeof cachedRevision=="number"&&Number.isFinite(cachedRevision)&&(headers["if-none-match"]=`"r${cachedRevision}.s${3}"`),{method:"GET",path:SDK_CONFIG_PATH,headers:headers}}async function fetchSdkConfig(funnel,cachedRevision){let result=await funnel.send("sdkConfig.fetch",sdkConfigRequest(cachedRevision));if(!result.ok)return result.error.httpStatus===304?{kind:"notModified"}:result.error.httpStatus===404?{kind:"notEnabled"}:{kind:"failed",error:result.error};let config=parseSdkConfig(result.value);return config===null?{kind:"failed",error:makeEverfurError("internalError",{retryable:true,wireMessage:"malformed sdk-config response"})}:{kind:"updated",config:config}}function utf8Bytes(text){let out=[];for(let ch of text){let cp=ch.codePointAt(0);cp<128?out.push(cp):cp<2048?out.push(192|cp>>6,128|cp&63):cp<65536?out.push(224|cp>>12,128|cp>>6&63,128|cp&63):out.push(240|cp>>18,128|cp>>12&63,128|cp>>6&63,128|cp&63)}return out}function fnv1a64Hex(text){let hi=3421674724,lo=2216829733;for(let byte2 of utf8Bytes(text)){lo=(lo^byte2)>>>0;let loProduct=lo*435,carry=Math.floor(loProduct/4294967296),nextLo=loProduct>>>0;hi=hi*435+carry+lo*256>>>0,lo=nextLo}return hi.toString(16).padStart(8,"0")+lo.toString(16).padStart(8,"0")}var SDK_CONFIG_CACHE_KEY_PREFIX="everfur.sdkconfig.v3.";function sdkConfigCacheKey(scope){return`${SDK_CONFIG_CACHE_KEY_PREFIX}${fnv1a64Hex(scope)}`}function freeUsedKey(scope,who,month){return`everfur.sdkconfig.freecap.v1.${fnv1a64Hex(`${scope}|${who}|${month}`)}`}var SDK_CONFIG_REFRESH_MS=300*1e3,INITIAL=/* @__PURE__ */Object.freeze({status:"idle",active:null,pending:null});async function readCached(kv,scope){try{let raw=await kv.getItem(sdkConfigCacheKey(scope));return raw===null?null:parseSdkConfig(JSON.parse(raw))}catch{return null}}async function writeCached(kv,scope,config){try{config===null?await kv.removeItem(sdkConfigCacheKey(scope)):await kv.setItem(sdkConfigCacheKey(scope),serializeSdkConfig(config))}catch{}}function createSdkConfigStore(deps){let snapshot=INITIAL,disposed3=false,inFlight=null,restored=false,fetchedAt=null,legacyNext=false,now=deps.now??Date.now,listeners=/* @__PURE__ */new Set,counts=/* @__PURE__ */new Map,countReads=/* @__PURE__ */new Map,writes=Promise.resolve(),set=next=>{if(!disposed3){snapshot=/* @__PURE__ */Object.freeze({...snapshot,...next});for(let listener of[...listeners])try{listener()}catch{}}},readCount=key=>{if(counts.has(key))return Promise.resolve();let read=countReads.get(key);return read===void 0&&(read=(async()=>{let n=0;try{let raw=await deps.kv.getItem(key),parsed=raw===null?0:Number.parseInt(raw,10);n=Number.isFinite(parsed)&&parsed>0?parsed:0}catch{n=0}counts.has(key)||counts.set(key,n)})(),countReads.set(key,read)),read},newest=()=>snapshot.pending??snapshot.active,fetchOnce=async()=>{let resolution;try{resolution=await deps.fetch(newest()?.revision??null)}catch(error){resolution={kind:"failed",error:error}}if(!disposed3)switch(fetchedAt=now(),resolution.kind){case"updated":{writeCached(deps.kv,deps.scope,resolution.config),legacyNext=false,snapshot.status==="legacy"?set({pending:resolution.config}):snapshot.active===null?set({status:"ready",active:resolution.config,pending:null}):resolution.config.revision===snapshot.active.revision?set({status:"ready",pending:null}):set({status:"ready",pending:resolution.config});return}case"notModified":snapshot.pending===null&&(legacyNext=false),set({status:snapshot.active===null?"failed":"ready"});return;case"notEnabled":if(writeCached(deps.kv,deps.scope,null),snapshot.active===null){set({status:"legacy",pending:null});return}legacyNext=true,set({status:"ready",pending:null});return;default:set({status:snapshot.active===null?"failed":"ready"})}},run=()=>(inFlight!==null||(inFlight=(async()=>{if(snapshot.active===null&&snapshot.status!=="legacy"&&set({status:"loading"}),!restored){restored=true;let cached=await readCached(deps.kv,deps.scope);cached!==null&&snapshot.active===null&&set({status:"ready",active:cached})}await fetchOnce()})().finally(()=>{inFlight=null})),inFlight);return{subscribe(listener){return listeners.add(listener),()=>{listeners.delete(listener)}},getSnapshot:()=>snapshot,load(){if(inFlight!==null)return inFlight;let stale=fetchedAt===null||now()-fetchedAt>=SDK_CONFIG_REFRESH_MS;return snapshot.status==="idle"||snapshot.status==="failed"||stale?run():Promise.resolve()},retry:run,readFreeUsed(who,month){let key=freeUsedKey(deps.scope,who,month);return readCount(key).then(()=>counts.get(key)??0)},peekFreeUsed(who,month){return counts.get(freeUsedKey(deps.scope,who,month))??null},addFreeUsed(who,month){let key=freeUsedKey(deps.scope,who,month);return readCount(key).then(()=>{let next=(counts.get(key)??0)+1;return counts.set(key,next),writes=writes.then(async()=>{try{await deps.kv.setItem(key,String(counts.get(key)??next))}catch{}}),next})},adoptLatest(){if(legacyNext){legacyNext=false,set({status:"legacy",active:null,pending:null});return}snapshot.pending!==null&&set({status:"ready",active:snapshot.pending,pending:null})},dispose(){disposed3=true,listeners.clear()}}}function attachSdkConfigStore(host2,store){host2.store=store;let drawn=null,follow=()=>{let active=store.getSnapshot().active;active!==drawn&&(drawn=active,host2.branding.set(active===null?null:sdkConfigBranding(active)))};return store.subscribe(follow),follow(),store}function sdkConfigStoreFor(host2){return host2==null||host2.disposed?null:host2.store!==null?host2.store:attachSdkConfigStore(host2,createSdkConfigStore({kv:host2.kv,scope:host2.scope,fetch:cachedRevision=>fetchSdkConfig(host2.funnel(),cachedRevision)}))}var LEGACY=/* @__PURE__ */Object.freeze({status:"legacy",active:null,pending:null}),noSubscribe=()=>()=>{},legacySnapshot=()=>LEGACY;function useSdkConfigStore(){return sdkConfigStoreFor(useContext(EverfurContext)?.runtime?.sdkConfigHost)}function useEverfurSdkConfig(){return useSdkConfigSnapshotOf(useSdkConfigStore())}function useSdkConfigSnapshotOf(store){return useSyncExternalStore(store?.subscribe??noSubscribe,store?.getSnapshot??legacySnapshot,store?.getSnapshot??legacySnapshot)}function useLoadEverfurSdkConfig(){let store=useSdkConfigStore();return useEffect(()=>{store!==null&&(store.adoptLatest(),store.load())},[store]),useEverfurSdkConfig()}function surfaceHooksContext(){let key=/* @__PURE__ */Symbol.for("@everfur/sdk#SdkSurfaceHooks@v1"),host2=globalThis;return host2[key]??(host2[key]=createContext(null))}var SdkSurfaceHooksContext=/* @__PURE__ */surfaceHooksContext();var EMERGENCY_ER_LINE="Go to the nearest emergency vet now.";var CHAT_COPY=/* @__PURE__ */Object.freeze({placeholder:"Ask anything about {petName}…",placeholderFollowUpWeb:"Ask a follow-up…",placeholderUrgentWeb:"Tell us what’s happening…",composerLabel:"Message",attachPhotoOrFileNative:"Add a photo or file",footnoteNative:"Educational, not a diagnosis. Emergency? Call a vet.",footnoteWeb:"Everfur’s assistant isn’t a vet and doesn’t diagnose. Your vet makes the calls. Not for emergencies: if {petName} is in distress, go to the nearest emergency animal hospital now.",suggestions:"Suggestions",reading:"Reading {petName}’s records…",answered:"Everfur answered.",assistantName:"Everfur",followUpsHeadingNative:"Follow-up questions",turnFailedTitleWeb:"Everfur couldn’t answer that just now.",send:"Send",stop:"Stop",retry:"Try again",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",loading:"Loading",empty:"No messages yet",transcript:"Chat with Everfur",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting…",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",sourcesHeading:"Sources",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",nearestEmergencyVet:"Nearest emergency vet",goToNearestEmergencyVet:EMERGENCY_ER_LINE,poisonControlWeb:"ASPCA Poison Control",poisonControlNative:"ASPCA Animal Poison Control, (888) 426-4435",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openHistoryNative:"Chats and vet messages",openHistoryWeb:"Chats",showChatsWeb:"Show chats",hideChatsWeb:"Hide chats",newReplySuffix:", a new reply",yourPets:"Your pets",yourPet:"Your pet",switchActivePet:"{name}. Switch pet",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active · ",close:"Close",addAnotherPet:"Add a pet",addPet:"Add a pet",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});var KEY3=/* @__PURE__ */Symbol.for("everfur.sdk.rn.poweredBy");function placed(){let g=globalThis,hit=g[KEY3];if(hit!==void 0)return hit;let fresh3={count:0,listeners:/* @__PURE__ */new Set};return g[KEY3]=fresh3,fresh3}function EverfurPoweredBy2({children:children,style:style}){let hidden=useEverfurTheme().meta.hidePoweredBy;return useEffect(()=>{if(hidden)return;let p=placed();return p.count+=1,p.listeners.forEach(listener=>listener()),()=>{p.count-=1,p.listeners.forEach(listener=>listener())}},[hidden]),hidden?null:children??/* @__PURE__ */jsx(Text,{tier:"compact",style:style,accessibilityRole:"text",children:CHAT_COPY.poweredBy})}function optionalModule(name,load,validate){let candidate;try{candidate=load()}catch(cause){return frozenUnavailable(`optional peer '${name}' is not installed: ${describe(cause)}`)}let resolved=unwrapDefault(candidate);return resolved==null?frozenUnavailable(`optional peer '${name}' resolved to no module`):validate&&!validate(resolved)?frozenUnavailable(`optional peer '${name}' is present but failed its shape check`):/* @__PURE__ */Object.freeze({available:true,module:resolved})}function unwrapDefault(candidate){return typeof candidate=="object"&&candidate!==null&&"default"in candidate&&Object.keys(candidate).length<=2?candidate.default:candidate}function frozenUnavailable(reason){/* @__PURE__ */
|
|
145
|
+
return Object.freeze({schemaVersion:2,displayName:s["text.partner_name"],logoUrl:s["look.logo.mark"],primaryColor:s["look.color.primary"],accentColor:s["look.color.accent"],brightness:"light",fontFamily:s["look.font.body"],fontUrl:null,headingFontFamily:s["look.font.heading"],fontWeightHeading:String(weight),fontSources:fontSourcesOf(s),placeholder:s["text.ask.placeholder"],placeholderFillsPet:true,hidePoweredBy:false,backgroundColor:s["look.color.surface"],textColor:s["look.color.ink"],borderRadius:s["look.radius.card"],assistantAvatarUrl:askIcon===EVERFUR_ASK_ICON?null:askIcon,slots:slotsOf(s),presentation:{chatComposerMic:true,chatComposerUpload:true,chatComposerStyle:"compact",chatComposerPlaceholder:"generic",safetyDisclaimerPlacement:"composer",chatGeneralBanner:s["layout.severity"]!=="off"},lockedFields:V3_LOCKED_FIELDS})}var SDK_CONFIG_PATH="/widget/v1/sdk-config",SDK_CONFIG_SCHEMA_HEADER="x-everfur-sdk-config-schema";function sdkConfigRequest(cachedRevision){let headers={[SDK_CONFIG_SCHEMA_HEADER]:String(3)};return typeof cachedRevision=="number"&&Number.isFinite(cachedRevision)&&(headers["if-none-match"]=`"r${cachedRevision}.s${3}"`),{method:"GET",path:SDK_CONFIG_PATH,headers:headers}}async function fetchSdkConfig(funnel,cachedRevision){let result=await funnel.send("sdkConfig.fetch",sdkConfigRequest(cachedRevision));if(!result.ok)return result.error.httpStatus===304?{kind:"notModified"}:result.error.httpStatus===404?{kind:"notEnabled"}:{kind:"failed",error:result.error};let config=parseSdkConfig(result.value);return config===null?{kind:"failed",error:makeEverfurError("internalError",{retryable:true,wireMessage:"malformed sdk-config response"})}:{kind:"updated",config:config}}function utf8Bytes(text){let out=[];for(let ch of text){let cp=ch.codePointAt(0);cp<128?out.push(cp):cp<2048?out.push(192|cp>>6,128|cp&63):cp<65536?out.push(224|cp>>12,128|cp>>6&63,128|cp&63):out.push(240|cp>>18,128|cp>>12&63,128|cp>>6&63,128|cp&63)}return out}function fnv1a64Hex(text){let hi=3421674724,lo=2216829733;for(let byte2 of utf8Bytes(text)){lo=(lo^byte2)>>>0;let loProduct=lo*435,carry=Math.floor(loProduct/4294967296),nextLo=loProduct>>>0;hi=hi*435+carry+lo*256>>>0,lo=nextLo}return hi.toString(16).padStart(8,"0")+lo.toString(16).padStart(8,"0")}var SDK_CONFIG_CACHE_KEY_PREFIX="everfur.sdkconfig.v3.";function sdkConfigCacheKey(scope){return`${SDK_CONFIG_CACHE_KEY_PREFIX}${fnv1a64Hex(scope)}`}function freeUsedKey(scope,who,month){return`everfur.sdkconfig.freecap.v1.${fnv1a64Hex(`${scope}|${who}|${month}`)}`}var SDK_CONFIG_REFRESH_MS=300*1e3,INITIAL=/* @__PURE__ */Object.freeze({status:"idle",active:null,pending:null});async function readCached(kv,scope){try{let raw=await kv.getItem(sdkConfigCacheKey(scope));return raw===null?null:parseSdkConfig(JSON.parse(raw))}catch{return null}}async function writeCached(kv,scope,config){try{config===null?await kv.removeItem(sdkConfigCacheKey(scope)):await kv.setItem(sdkConfigCacheKey(scope),serializeSdkConfig(config))}catch{}}function createSdkConfigStore(deps){let snapshot=INITIAL,disposed3=false,inFlight=null,restored=false,fetchedAt=null,legacyNext=false,now=deps.now??Date.now,listeners=/* @__PURE__ */new Set,counts=/* @__PURE__ */new Map,countReads=/* @__PURE__ */new Map,writes=Promise.resolve(),set=next=>{if(!disposed3){snapshot=/* @__PURE__ */Object.freeze({...snapshot,...next});for(let listener of[...listeners])try{listener()}catch{}}},readCount=key=>{if(counts.has(key))return Promise.resolve();let read=countReads.get(key);return read===void 0&&(read=(async()=>{let n=0;try{let raw=await deps.kv.getItem(key),parsed=raw===null?0:Number.parseInt(raw,10);n=Number.isFinite(parsed)&&parsed>0?parsed:0}catch{n=0}counts.has(key)||counts.set(key,n)})(),countReads.set(key,read)),read},newest=()=>snapshot.pending??snapshot.active,fetchOnce=async()=>{let resolution;try{resolution=await deps.fetch(newest()?.revision??null)}catch(error){resolution={kind:"failed",error:error}}if(!disposed3)switch(fetchedAt=now(),resolution.kind){case"updated":{writeCached(deps.kv,deps.scope,resolution.config),legacyNext=false,snapshot.status==="legacy"?set({pending:resolution.config}):snapshot.active===null?set({status:"ready",active:resolution.config,pending:null}):resolution.config.revision===snapshot.active.revision?set({status:"ready",pending:null}):set({status:"ready",pending:resolution.config});return}case"notModified":snapshot.pending===null&&(legacyNext=false),set({status:snapshot.active===null?"failed":"ready"});return;case"notEnabled":if(writeCached(deps.kv,deps.scope,null),snapshot.active===null){set({status:"legacy",pending:null});return}legacyNext=true,set({status:"ready",pending:null});return;default:set({status:snapshot.active===null?"failed":"ready"})}},run=()=>(inFlight!==null||(inFlight=(async()=>{if(snapshot.active===null&&snapshot.status!=="legacy"&&set({status:"loading"}),!restored){restored=true;let cached=await readCached(deps.kv,deps.scope);cached!==null&&snapshot.active===null&&set({status:"ready",active:cached})}await fetchOnce()})().finally(()=>{inFlight=null})),inFlight);return{subscribe(listener){return listeners.add(listener),()=>{listeners.delete(listener)}},getSnapshot:()=>snapshot,load(){if(inFlight!==null)return inFlight;let stale=fetchedAt===null||now()-fetchedAt>=SDK_CONFIG_REFRESH_MS;return snapshot.status==="idle"||snapshot.status==="failed"||stale?run():Promise.resolve()},retry:run,readFreeUsed(who,month){let key=freeUsedKey(deps.scope,who,month);return readCount(key).then(()=>counts.get(key)??0)},peekFreeUsed(who,month){return counts.get(freeUsedKey(deps.scope,who,month))??null},addFreeUsed(who,month){let key=freeUsedKey(deps.scope,who,month);return readCount(key).then(()=>{let next=(counts.get(key)??0)+1;return counts.set(key,next),writes=writes.then(async()=>{try{await deps.kv.setItem(key,String(counts.get(key)??next))}catch{}}),next})},setFreeUsed(who,month,used){let key=freeUsedKey(deps.scope,who,month),n=Number.isInteger(used)&&used>0?used:0;return readCount(key).then(()=>(counts.set(key,n),writes=writes.then(async()=>{try{await deps.kv.setItem(key,String(counts.get(key)??n))}catch{}}),n))},adoptLatest(){if(legacyNext){legacyNext=false,set({status:"legacy",active:null,pending:null});return}snapshot.pending!==null&&set({status:"ready",active:snapshot.pending,pending:null})},dispose(){disposed3=true,listeners.clear()}}}function attachSdkConfigStore(host2,store){host2.store=store;let drawn=null,follow=()=>{let active=store.getSnapshot().active;active!==drawn&&(drawn=active,host2.branding.set(active===null?null:sdkConfigBranding(active)))};return store.subscribe(follow),follow(),store}function sdkConfigStoreFor(host2){return host2==null||host2.disposed?null:host2.store!==null?host2.store:attachSdkConfigStore(host2,createSdkConfigStore({kv:host2.kv,scope:host2.scope,fetch:cachedRevision=>fetchSdkConfig(host2.funnel(),cachedRevision)}))}var LEGACY=/* @__PURE__ */Object.freeze({status:"legacy",active:null,pending:null}),noSubscribe=()=>()=>{},legacySnapshot=()=>LEGACY;function useSdkConfigStore(){return sdkConfigStoreFor(useContext(EverfurContext)?.runtime?.sdkConfigHost)}function useEverfurSdkConfig(){return useSdkConfigSnapshotOf(useSdkConfigStore())}function useSdkConfigSnapshotOf(store){return useSyncExternalStore(store?.subscribe??noSubscribe,store?.getSnapshot??legacySnapshot,store?.getSnapshot??legacySnapshot)}function useLoadEverfurSdkConfig(){let store=useSdkConfigStore();return useEffect(()=>{store!==null&&(store.adoptLatest(),store.load())},[store]),useEverfurSdkConfig()}function surfaceHooksContext(){let key=/* @__PURE__ */Symbol.for("@everfur/sdk#SdkSurfaceHooks@v1"),host2=globalThis;return host2[key]??(host2[key]=createContext(null))}var SdkSurfaceHooksContext=/* @__PURE__ */surfaceHooksContext();var EMERGENCY_ER_LINE="Go to the nearest emergency vet now.";var CHAT_COPY=/* @__PURE__ */Object.freeze({placeholder:"Ask anything about {petName}…",placeholderFollowUpWeb:"Ask a follow-up…",placeholderUrgentWeb:"Tell us what’s happening…",composerLabel:"Message",attachPhotoOrFileNative:"Add a photo or file",footnoteNative:"Educational, not a diagnosis. Emergency? Call a vet.",footnoteWeb:"Everfur’s assistant isn’t a vet and doesn’t diagnose. Your vet makes the calls. Not for emergencies: if {petName} is in distress, go to the nearest emergency animal hospital now.",suggestions:"Suggestions",reading:"Reading {petName}’s records…",answered:"Everfur answered.",assistantName:"Everfur",followUpsHeadingNative:"Follow-up questions",turnFailedTitleWeb:"Everfur couldn’t answer that just now.",send:"Send",stop:"Stop",retry:"Try again",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",loading:"Loading",empty:"No messages yet",transcript:"Chat with Everfur",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting…",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",sourcesHeading:"Sources",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",nearestEmergencyVet:"Nearest emergency vet",goToNearestEmergencyVet:EMERGENCY_ER_LINE,poisonControlWeb:"ASPCA Poison Control",poisonControlNative:"ASPCA Animal Poison Control, (888) 426-4435",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openHistoryNative:"Chats and vet messages",openHistoryWeb:"Chats",showChatsWeb:"Show chats",hideChatsWeb:"Hide chats",newReplySuffix:", a new reply",yourPets:"Your pets",yourPet:"Your pet",switchActivePet:"{name}. Switch pet",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active · ",close:"Close",addAnotherPet:"Add a pet",addPet:"Add a pet",capReached:"You've used your {cap} free messages this month.",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});var KEY3=/* @__PURE__ */Symbol.for("everfur.sdk.rn.poweredBy");function placed(){let g=globalThis,hit=g[KEY3];if(hit!==void 0)return hit;let fresh3={count:0,listeners:/* @__PURE__ */new Set};return g[KEY3]=fresh3,fresh3}function EverfurPoweredBy2({children:children,style:style}){let hidden=useEverfurTheme().meta.hidePoweredBy;return useEffect(()=>{if(hidden)return;let p=placed();return p.count+=1,p.listeners.forEach(listener=>listener()),()=>{p.count-=1,p.listeners.forEach(listener=>listener())}},[hidden]),hidden?null:children??/* @__PURE__ */jsx(Text,{tier:"compact",style:style,accessibilityRole:"text",children:CHAT_COPY.poweredBy})}function optionalModule(name,load,validate){let candidate;try{candidate=load()}catch(cause){return frozenUnavailable(`optional peer '${name}' is not installed: ${describe(cause)}`)}let resolved=unwrapDefault(candidate);return resolved==null?frozenUnavailable(`optional peer '${name}' resolved to no module`):validate&&!validate(resolved)?frozenUnavailable(`optional peer '${name}' is present but failed its shape check`):/* @__PURE__ */Object.freeze({available:true,module:resolved})}function unwrapDefault(candidate){return typeof candidate=="object"&&candidate!==null&&"default"in candidate&&Object.keys(candidate).length<=2?candidate.default:candidate}function frozenUnavailable(reason){/* @__PURE__ */
|
|
146
146
|
return Object.freeze({available:false,module:null,reason:reason})}function describe(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"unknown load error"}var SVG_BRAND_ASSET_URL=/^https:\/\/sdk(-staging)?\.everfur\.com\/brand\/[0-9a-f]{16}\.svg$/;function isSvgModule(candidate){if(typeof candidate!="object"||candidate===null)return false;let uri=candidate.SvgUri;return typeof uri=="function"||typeof uri=="object"&&uri!==null}var registered=null;function registerEverfurSvg(load){if(load===null)return registered=null,false;let result=optionalModule("react-native-svg",load,isSvgModule);return registered=result.available?result.module:null,result.available}function sdkSvgUrl(url){let https=hardenHttpsUrl(url);return https!==null&&SVG_BRAND_ASSET_URL.test(https)?https:null}function size(style){let flat=StyleSheet.flatten(style),width=flat?.width,height=flat?.height;return typeof width=="number"&&typeof height=="number"?{width:width,height:height}:null}function SdkBrandArt({url:url,style:style,fallback:fallback=null,testID:testID}){let[svgFailed,setSvgFailed]=useState(false),svg=sdkSvgUrl(url);if(svg!==null){let box2=size(style),Svg=registered?.SvgUri;return Svg===void 0||box2===null||svgFailed?fallback:/* @__PURE__ */jsx(View,{style:style,accessible:false,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:testID??"everfur-sdk-svg",children:/* @__PURE__ */jsx(Svg,{uri:svg,width:box2.width,height:box2.height,onError:()=>setSvgFailed(true)})})}let raster=url.trim()===""?null:hardenBrandAssetUrl(url);/* @__PURE__ */
|
|
147
147
|
return jsx(BrandImage,{uri:raster,decorative:true,style:style,fallback:fallback,...testID===void 0?{}:{testID:testID}})}var EVERFUR_DARK_GREEN="#10462E",SDK_TABLET_COLUMN=640,SDK_TABLET_MIN_WIDTH=600,WHITE2="#FFFFFF",NEUTRAL_GREY="#8A8A8A";function useSdkColumn(){let{width:width}=useWindowDimensions(),tablet=width>=SDK_TABLET_MIN_WIDTH;return{tablet:tablet,column:tablet?{width:"100%",maxWidth:SDK_TABLET_COLUMN,alignSelf:"center",flex:1}:{flex:1}}}function SdkNeutralScreen({failed:failed,onRetry:onRetry}){/* @__PURE__ */
|
|
148
148
|
return jsx(View,{style:{flex:1,backgroundColor:WHITE2,alignItems:"center",justifyContent:"center",padding:24},testID:failed?"everfur-sdk-error":"everfur-sdk-loading",children:failed?/* @__PURE__ */jsxs(Fragment,{children:[
|
|
@@ -151,8 +151,8 @@ return jsx(View,{style:{flex:1,backgroundColor:WHITE2,alignItems:"center",justif
|
|
|
151
151
|
/* @__PURE__ */jsx(Text,{tier:"badge",style:{fontFamily:settings["look.font.body"],fontSize:12,lineHeight:12,color:settings["look.color.muted"]},children:EVERFUR_TABS_SHELL_COPY.poweredBy}),
|
|
152
152
|
/* @__PURE__ */jsx(ShellIcon,{name:"wordmark",style:{width:stacked?44:52,height:stacked?16:19,tintColor:EVERFUR_DARK_GREEN}})]});/* @__PURE__ */
|
|
153
153
|
return jsx(EverfurPoweredBy2,{children:/* @__PURE__ */jsxs(View,{accessible:true,accessibilityLabel:`${name}, ${EVERFUR_TABS_SHELL_COPY.poweredByLabel}`,style:stacked?{flexDirection:"column",alignItems:"center",gap:3}:{flexDirection:"row",alignItems:"center",gap:8,flexShrink:1},testID:stacked?"everfur-sdk-lockup-stacked":"everfur-sdk-lockup-side",children:[
|
|
154
|
-
/* @__PURE__ */jsx(SdkBrandArt,{url:logo,style:stacked?{height:20,width:110}:{height:30,width:92,borderRadius:7}}),stacked?null:/* @__PURE__ */jsx(View,{style:{width:1,height:28,backgroundColor:settings["look.color.line"]}}),by]})})}function SdkSheet({sheet:sheet,settings:settings,onPrimary:onPrimary,onDismiss:onDismiss}){let{tablet:tablet}=useSdkColumn(),heading=settings["look.color.heading"],body=settings["look.font.body"];/* @__PURE__ */
|
|
155
|
-
return jsx(View,{style:{position:"absolute",left:0,right:0,top:0,bottom:0,justifyContent:"flex-end",backgroundColor:"rgba(0,0,0,0.32)"},testID:`everfur-sdk-sheet-${sheet.kind}`,children:/* @__PURE__ */jsxs(View,{accessibilityViewIsModal:true,style:[{backgroundColor:WHITE2,borderTopLeftRadius:settings["look.radius.sheet"],borderTopRightRadius:settings["look.radius.sheet"],paddingTop:10,paddingHorizontal:18,paddingBottom:tablet?40:30,gap:12},tablet?{width:SDK_TABLET_COLUMN,alignSelf:"center"}:null],children:[sheet.badge!==null?/* @__PURE__ */jsx(Text,{tier:"badge",style:{alignSelf:"flex-start",fontFamily:body,fontSize:12,color:heading,backgroundColor:settings["look.color.tint"],paddingHorizontal:10,paddingVertical:4,borderRadius:12,overflow:"hidden"},children:sheet.badge}):null,sheet.title!==null?/* @__PURE__ */jsx(Text,{tier:"heading",accessibilityRole:"header",style:{fontFamily:settings["look.font.heading"],fontWeight:String(settings["look.font.heading_weight"]),fontSize:20,color:heading},children:sheet.title}):null,sheet.locked.map(line=>/* @__PURE__ */jsx(Text,{style:{fontFamily:body,fontSize:15,color:settings["look.color.ink"]},children:line},line)),sheet.price.map(line=>/* @__PURE__ */jsx(Text,{style:{fontFamily:body,fontSize:15,color:settings["look.color.muted"]},testID:"everfur-sdk-price",children:line},line)),
|
|
154
|
+
/* @__PURE__ */jsx(SdkBrandArt,{url:logo,style:stacked?{height:20,width:110}:{height:30,width:92,borderRadius:7}}),stacked?null:/* @__PURE__ */jsx(View,{style:{width:1,height:28,backgroundColor:settings["look.color.line"]}}),by]})})}function SdkSheet({sheet:sheet,settings:settings,onPrimary:onPrimary,onDismiss:onDismiss,notice:notice=null}){let{tablet:tablet}=useSdkColumn(),heading=settings["look.color.heading"],body=settings["look.font.body"];/* @__PURE__ */
|
|
155
|
+
return jsx(View,{style:{position:"absolute",left:0,right:0,top:0,bottom:0,justifyContent:"flex-end",backgroundColor:"rgba(0,0,0,0.32)"},testID:`everfur-sdk-sheet-${sheet.kind}`,children:/* @__PURE__ */jsxs(View,{accessibilityViewIsModal:true,style:[{backgroundColor:WHITE2,borderTopLeftRadius:settings["look.radius.sheet"],borderTopRightRadius:settings["look.radius.sheet"],paddingTop:10,paddingHorizontal:18,paddingBottom:tablet?40:30,gap:12},tablet?{width:SDK_TABLET_COLUMN,alignSelf:"center"}:null],children:[sheet.badge!==null?/* @__PURE__ */jsx(Text,{tier:"badge",style:{alignSelf:"flex-start",fontFamily:body,fontSize:12,color:heading,backgroundColor:settings["look.color.tint"],paddingHorizontal:10,paddingVertical:4,borderRadius:12,overflow:"hidden"},children:sheet.badge}):null,sheet.title!==null?/* @__PURE__ */jsx(Text,{tier:"heading",accessibilityRole:"header",style:{fontFamily:settings["look.font.heading"],fontWeight:String(settings["look.font.heading_weight"]),fontSize:20,color:heading},children:sheet.title}):null,sheet.locked.map(line=>/* @__PURE__ */jsx(Text,{style:{fontFamily:body,fontSize:15,color:settings["look.color.ink"]},children:line},line)),sheet.price.map(line=>/* @__PURE__ */jsx(Text,{style:{fontFamily:body,fontSize:15,color:settings["look.color.muted"]},testID:"everfur-sdk-price",children:line},line)),notice!==null?/* @__PURE__ */jsx(Text,{style:{fontFamily:body,fontSize:15,color:settings["look.color.ink"]},testID:"everfur-sdk-sheet-notice",children:notice}):null,
|
|
156
156
|
/* @__PURE__ */jsx(SdkButton,{settings:settings,label:sheet.button,onPress:onPrimary,testID:"everfur-sdk-sheet-primary"}),
|
|
157
157
|
/* @__PURE__ */jsx(Pressable,{accessibilityRole:"button",onPress:onDismiss,style:{minHeight:44,alignItems:"center",justifyContent:"center"},testID:"everfur-sdk-sheet-dismiss",children:/* @__PURE__ */jsx(Text,{tier:"control",style:{fontFamily:body,fontSize:15,color:settings["look.color.muted"]},children:sheet.dismiss})})]})})}function SdkButton({settings:settings,label:label,onPress:onPress,testID:testID}){let{fill:fill,ink:ink}=buttonFill(settings);/* @__PURE__ */
|
|
158
158
|
return jsx(Pressable,{accessibilityRole:"button",onPress:onPress,style:{minHeight:48,borderRadius:24,backgroundColor:fill,alignItems:"center",justifyContent:"center",paddingHorizontal:20},...testID===void 0?{}:{testID:testID},children:/* @__PURE__ */jsx(Text,{tier:"control",style:{fontFamily:settings["look.font.body"],fontSize:16,fontWeight:"600",color:ink},children:label})})}function SdkMemoryChip({settings:settings,label:label}){/* @__PURE__ */
|
|
@@ -169,11 +169,11 @@ return jsxs(ScrollView,{style:style,contentContainerStyle:{gap:14,paddingHorizon
|
|
|
169
169
|
return jsxs(View,{style:[{alignItems:"flex-end",gap:8},style],pointerEvents:"box-none",testID:"everfur-sdk-launcher",children:[tipOpen?/* @__PURE__ */jsx(Pressable,{accessibilityRole:"button",onPress:closeTip,style:{maxWidth:240,backgroundColor:WHITE2,borderRadius:14,borderWidth:1,borderColor:s["look.color.line"],paddingHorizontal:14,paddingVertical:10},testID:"everfur-sdk-launcher-tip",children:/* @__PURE__ */jsx(Text,{style:{fontFamily:s["look.font.body"],fontSize:14,color:s["look.color.ink"]},children:sdkText(config,"text.launcher.tip")})}):null,
|
|
170
170
|
/* @__PURE__ */jsxs(Pressable,{accessibilityRole:"button",accessibilityLabel:launcherLabel(config),onPress:()=>{tipOpen&&closeTip(),onPress()},style:{width:60,height:60,borderRadius:30,backgroundColor:s["look.color.launcher"],alignItems:"center",justifyContent:"center"},testID:"everfur-sdk-launcher-button",children:[
|
|
171
171
|
/* @__PURE__ */jsx(SdkBrandArt,{url:icon,style:{width:full?24:30,height:full?24:30},fallback:/* @__PURE__ */jsx(ShellIcon,{name:"wordmark",style:{width:36,height:13,tintColor:s["look.color.on_launcher"]}})}),full?/* @__PURE__ */jsx(Text,{tier:"badge",style:{fontFamily:s["look.font.body"],fontSize:10,color:s["look.color.on_launcher"]},children:launcherLabel(config)}):null,full&&replyWaiting?/* @__PURE__ */jsx(View,{style:{position:"absolute",top:2,right:2,width:12,height:12,borderRadius:6,backgroundColor:"#C03410",borderWidth:2,borderColor:WHITE2},testID:"everfur-sdk-launcher-dot"}):null]})]})}function activePet(host2){let ref=host2.activePetRef;return host2.pets.find(p=>p.petRef===ref)??host2.pets[0]??null}function EverfurSdkApp(props){let store=useSdkConfigStore(),snapshot=useEverfurSdkConfig();useEffect(()=>{if(store===null)return;store.adoptLatest(),store.load();let subscription=AppState.addEventListener("change",state3=>{state3==="active"&&store.retry()});return()=>subscription.remove()},[store]);let retry=useCallback(()=>{store?.retry()},[store]);return snapshot.active!==null?/* @__PURE__ */jsx(SdkShell,{...props,config:snapshot.active}):snapshot.status==="legacy"?/* @__PURE__ */jsx(LegacyPath,{...props}):/* @__PURE__ */jsx(SdkNeutralScreen,{failed:snapshot.status==="failed",onRetry:retry})}function LegacyPath({host:host2,renderLegacy:renderLegacy}){if(renderLegacy!==void 0)return renderLegacy();let pet=activePet(host2);/* @__PURE__ */
|
|
172
|
-
return jsx(EverfurTabs,{petRef:pet?.petRef??null,petName:pet?.name??null,opened:{via:"plain"}})}function useFreeCount(config,who){let store=useSdkConfigStore(),counting=config.settings["access.mode"]==="free_cap",month=capMonth(/* @__PURE__ */new Date),[used,setUsed]=useState(()=>store?.peekFreeUsed(who,month)??0),live=useRef(true);useEffect(()=>{if(live.current=true,!(store===null||!counting))return store.readFreeUsed(who,month).then(n=>{live.current&&setUsed(n)}),()=>{live.current=false}},[store,counting,who,month]);let hooks=useMemo(()=>!counting||store===null?null:{onMessageSent:()=>{store.addFreeUsed(who,month).then(n=>{live.current&&setUsed(n)})}},[counting,store,who,month]);return{used:used,hooks:hooks}}var HISTORY_CHATS=HISTORY_COPY.heading;function SdkShell({host:host2,section:requested,onSectionChange:onSectionChange,chat:chat,records:records,style:style,config:config}){let s=config.settings,ctx=useContext(EverfurContext),pet=activePet(host2),level=vetLevelFor(config.stateGate,pet?.location??null),layout=useMemo(()=>resolveLayout(s,level),[s,level]),membership=host2.membership??"unknown",who=host2.userId??ctx?.userRef??"anonymous",{used:used,hooks:hooks}=useFreeCount(config,who),access=askAccess(config,membership,used),{tablet:tablet,column:column}=useSdkColumn(),[section,setSection]=useState(requested??layout.sections[0]??"ask");useEffect(()=>{requested!==void 0&&setSection(requested)},[requested]);let go=useCallback(next=>{setSection(next),onSectionChange?.(next)},[onSectionChange]),vetReachable=layout.vetOnAsk!=="none",shown=section==="vet"&&!vetReachable?"ask":section,[sheet,setSheet]=useState(null),openPlan=useCallback(reason=>{
|
|
172
|
+
return jsx(EverfurTabs,{petRef:pet?.petRef??null,petName:pet?.name??null,opened:{via:"plain"}})}function useFreeCount(config,who,onCap){let store=useSdkConfigStore(),counting=config.settings["access.mode"]==="free_cap",month=capMonth(/* @__PURE__ */new Date),[used,setUsed]=useState(()=>store?.peekFreeUsed(who,month)??0),live=useRef(true),capRef=useRef(onCap);capRef.current=onCap,useEffect(()=>{if(live.current=true,!(store===null||!counting))return store.readFreeUsed(who,month).then(n=>{live.current&&setUsed(n)}),()=>{live.current=false}},[store,counting,who,month]);let hooks=useMemo(()=>!counting||store===null?null:{onMessageSent:()=>{store.addFreeUsed(who,month).then(n=>{live.current&&setUsed(n)})},onFreeCapReached:refusal=>{store.setFreeUsed(who,month,refusal.used).then(n=>{live.current&&setUsed(n)}),capRef.current(refusal)}},[counting,store,who,month]);return{used:used,hooks:hooks}}var HISTORY_CHATS=HISTORY_COPY.heading;function SdkShell({host:host2,section:requested,onSectionChange:onSectionChange,chat:chat,records:records,style:style,config:config}){let s=config.settings,ctx=useContext(EverfurContext),pet=activePet(host2),level=vetLevelFor(config.stateGate,pet?.location??null),layout=useMemo(()=>resolveLayout(s,level),[s,level]),membership=host2.membership??"unknown",who=host2.userId??ctx?.userRef??"anonymous",capOpener=useRef(()=>{}),{used:used,hooks:hooks}=useFreeCount(config,who,refusal=>capOpener.current(refusal)),access=askAccess(config,membership,used),{tablet:tablet,column:column}=useSdkColumn(),[section,setSection]=useState(requested??layout.sections[0]??"ask");useEffect(()=>{requested!==void 0&&setSection(requested)},[requested]);let go=useCallback(next=>{setSection(next),onSectionChange?.(next)},[onSectionChange]),vetReachable=layout.vetOnAsk!=="none",shown=section==="vet"&&!vetReachable?"ask":section,[sheet,setSheet]=useState(null),openPlan=useCallback((reason,notice=null)=>{let next={sheet:reason.kind==="members"?membersSheet(config):planSheet(config,pet?.name),reason:reason,notice:notice};setSheet(open=>notice===null&&reason.kind==="cap"&&open?.reason.kind==="cap"?{...next,notice:open.notice}:next)},[config,pet?.name]);capOpener.current=refusal=>openPlan({kind:"cap"},refusal.emergencyGuidance??null);let onSheetPrimary=()=>{sheet!==null&&(host2.onOpenPlan?.(sheet.reason,sheet.sheet.soldBy),setSheet(null))};useEffect(()=>{access.kind==="members_only"?openPlan({kind:"members"}):access.kind==="cap_reached"&&openPlan({kind:"cap"})},[access.kind,openPlan]);let locked=part=>isLocked(config,membership,part),ground={flex:1,backgroundColor:s["look.color.surface"]},pane=shown==="vet"?/* @__PURE__ */jsx(VetPane,{config:config,pet:pet,level:level,locked:locked("video_visits"),onLocked:()=>openPlan({kind:"locked",part:"video_visits"}),onAsk:()=>go("ask")}):shown==="records"?/* @__PURE__ */jsx(RecordsPane,{config:config,host:host2,pet:pet,vetShown:vetReachable,records:records,onPlan:part=>openPlan({kind:"locked",part:part}),onVet:()=>vetReachable?go("vet"):void 0,locked:locked,onAsk:()=>go("ask")}):/* @__PURE__ */jsx(AskPane,{config:config,layout:layout,pet:pet,level:level,access:access,hooks:hooks,chat:chat,locked:locked,onVet:()=>go("vet"),onPlan:()=>openPlan({kind:access.kind==="members_only"?"members":"cap"})});/* @__PURE__ */
|
|
173
173
|
return jsxs(View,{style:[ground,style],testID:`everfur-sdk-app-${layout.nav}`,children:[
|
|
174
174
|
/* @__PURE__ */jsxs(View,{style:column,testID:tablet?"everfur-sdk-column-tablet":"everfur-sdk-column-phone",children:[
|
|
175
175
|
/* @__PURE__ */jsx(Header,{config:config,layout:layout,host:host2,pet:pet,section:shown,level:level,onSection:go}),layout.nav==="bottom_tabs"||layout.nav==="chat_first"?null:/* @__PURE__ */jsx(SectionNav,{config:config,layout:layout,level:level,section:shown,onSection:go,vetDot:host2.vetMessageWaiting===true}),
|
|
176
|
-
/* @__PURE__ */jsx(View,{style:{flex:1},children:pane}),layout.nav==="bottom_tabs"?/* @__PURE__ */jsx(SectionNav,{config:config,layout:layout,level:level,section:shown,onSection:go,vetDot:host2.vetMessageWaiting===true,bottom:true}):null]}),sheet!==null?/* @__PURE__ */jsx(SdkSheet,{sheet:sheet.sheet,settings:s,onPrimary:onSheetPrimary,onDismiss:()=>setSheet(null)}):null]})}function tabLabel(config,section,level){return section==="vet"?vetTabLabel(config,level):sdkText(config,section==="ask"?"text.tabs.ask":"text.tabs.records")}function SectionNav({config:config,layout:layout,level:level,section:section,onSection:onSection,vetDot:vetDot,bottom:bottom=false}){let s=config.settings;return layout.sections.length<2?null:/* @__PURE__ */jsx(View,{accessibilityRole:"tablist",style:[{flexDirection:"row",borderColor:s["look.color.line"],backgroundColor:s["look.color.surface"]},bottom?{borderTopWidth:1,paddingBottom:6}:{borderBottomWidth:1,paddingHorizontal:8}],testID:bottom?"everfur-sdk-tabs-bottom":"everfur-sdk-tabs-top",children:layout.sections.map(id=>{let on=id===section;/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */jsx(View,{style:{flex:1},children:pane}),layout.nav==="bottom_tabs"?/* @__PURE__ */jsx(SectionNav,{config:config,layout:layout,level:level,section:shown,onSection:go,vetDot:host2.vetMessageWaiting===true,bottom:true}):null]}),sheet!==null?/* @__PURE__ */jsx(SdkSheet,{sheet:sheet.sheet,settings:s,onPrimary:onSheetPrimary,onDismiss:()=>setSheet(null),notice:sheet.notice}):null]})}function tabLabel(config,section,level){return section==="vet"?vetTabLabel(config,level):sdkText(config,section==="ask"?"text.tabs.ask":"text.tabs.records")}function SectionNav({config:config,layout:layout,level:level,section:section,onSection:onSection,vetDot:vetDot,bottom:bottom=false}){let s=config.settings;return layout.sections.length<2?null:/* @__PURE__ */jsx(View,{accessibilityRole:"tablist",style:[{flexDirection:"row",borderColor:s["look.color.line"],backgroundColor:s["look.color.surface"]},bottom?{borderTopWidth:1,paddingBottom:6}:{borderBottomWidth:1,paddingHorizontal:8}],testID:bottom?"everfur-sdk-tabs-bottom":"everfur-sdk-tabs-top",children:layout.sections.map(id=>{let on=id===section;/* @__PURE__ */
|
|
177
177
|
return jsxs(Pressable,{accessibilityRole:"tab",accessibilityState:{selected:on},onPress:()=>onSection(id),style:{flex:bottom?1:0,minHeight:44,paddingHorizontal:12,alignItems:"center",justifyContent:"center",flexDirection:"row",gap:6,borderBottomWidth:bottom?0:2,borderBottomColor:on?s["look.color.primary"]:"transparent"},testID:`everfur-sdk-tab-${id}`,children:[
|
|
178
178
|
/* @__PURE__ */jsx(Text,{tier:"control",style:{fontFamily:s["look.font.body"],fontSize:15,fontWeight:on?"600":"400",color:on?s["look.color.heading"]:s["look.color.muted"]},children:tabLabel(config,id,level)}),id==="vet"&&vetDot&&layout.vetBadge==="tab_dot"?/* @__PURE__ */jsx(View,{style:{width:7,height:7,borderRadius:4,backgroundColor:s["look.color.dot"]},testID:"everfur-sdk-vet-dot"}):null]},id)})})}function Header({config:config,layout:layout,host:host2,pet:pet,section:section,level:level,onSection:onSection}){let s=config.settings,heading=s["look.color.heading"],iconButton=(glyph,onPress,testID)=>/* @__PURE__ */jsx(Pressable,{accessibilityRole:"button",onPress:onPress,style:{minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},testID:testID,children:/* @__PURE__ */jsx(Text,{tier:"control",style:{fontSize:20,color:heading},children:glyph})});if(layout.nav==="sections_page"){let title=sdkText(config,"text.nav.page_title"),titleRow=/* @__PURE__ */jsxs(View,{style:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:16,paddingTop:12,paddingBottom:8},testID:"everfur-sdk-header-sections",children:[title!==""?/* @__PURE__ */jsx(Text,{tier:"heading",accessibilityRole:"header",style:{fontFamily:s["look.font.heading"],fontWeight:String(s["look.font.heading_weight"]),fontSize:24,color:heading},children:title}):null,
|
|
179
179
|
/* @__PURE__ */jsx(SdkLockup,{settings:s})]});return section==="ask"?/* @__PURE__ */jsxs(View,{children:[titleRow,
|