@everfur/sdk 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Chat.d-D9n8tSDD.d.cts → Chat.d-Bl-_TsvQ.d.cts} +1 -1
- package/dist/{Chat.d-BXuEjJsg.d.ts → Chat.d-qQVN6VLp.d.ts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.js +1 -1
- package/dist/{attachments.d-Bsg6duaq.d.cts → attachments.d-DBlHzWYy.d.cts} +1 -1
- package/dist/{attachments.d-DjWUR-h9.d.ts → attachments.d-DOmkQ_8O.d.ts} +1 -1
- package/dist/{branding.d-Bzs4HJoN.d.cts → branding.d-CqDLKj1U.d.cts} +1 -1
- package/dist/{branding.d-CiC6xfGT.d.ts → branding.d-XrZYClN4.d.ts} +1 -1
- package/dist/chat/index.cjs +194 -194
- package/dist/chat/index.d.cts +7 -7
- package/dist/chat/index.d.ts +7 -7
- package/dist/chat/index.js +202 -202
- package/dist/chat/lite/index.cjs +205 -205
- package/dist/chat/lite/index.d.cts +7 -7
- package/dist/chat/lite/index.d.ts +7 -7
- package/dist/chat/lite/index.js +205 -205
- package/dist/{chatHandoffToken.d-sbumx0He.d.cts → chatHandoffToken.d-B4-iQ35P.d.cts} +3 -3
- package/dist/{chatHandoffToken.d-YJY6TZbj.d.ts → chatHandoffToken.d-Br3Gw3w-.d.ts} +3 -3
- package/dist/{checkin.d-DxpoRutq.d.cts → checkin.d-CAKQydg8.d.cts} +14 -2
- package/dist/{checkin.d-C6vh9KVr.d.ts → checkin.d-qvYXugN3.d.ts} +14 -2
- package/dist/{chunk-AJEELSFO.js → chunk-5OK2AF63.js} +14 -14
- package/dist/{chunk-II4QDD6F.js → chunk-6I4REU4U.js} +1 -1
- package/dist/{chunk-ZPIOCHKW.js → chunk-7MMJ7CYN.js} +1 -1
- package/dist/{chunk-FZ6DAQFH.js → chunk-PJHMKQ5C.js} +19 -19
- package/dist/client/index.cjs +2 -2
- package/dist/client/index.d.cts +7 -7
- package/dist/client/index.d.ts +7 -7
- package/dist/client/index.js +2 -2
- package/dist/consent/index.cjs +1 -1
- package/dist/consent/index.js +2 -2
- package/dist/{context.d-Cq2C4vdh.d.cts → context.d-DZfxKxNi.d.cts} +3 -3
- package/dist/{context.d-D1l56nFr.d.ts → context.d-FjU7dQP7.d.ts} +3 -3
- package/dist/core/index.cjs +21 -21
- package/dist/core/index.d.cts +10 -10
- package/dist/core/index.d.ts +10 -10
- package/dist/core/index.js +21 -21
- package/dist/{entitlementRepository.d-x2YFdgYD.d.ts → entitlementRepository.d-BltqS1W8.d.ts} +1 -1
- package/dist/{entitlementRepository.d-CEDU1gZE.d.cts → entitlementRepository.d-wfqpUIKN.d.cts} +1 -1
- package/dist/health-plan/index.cjs +1 -1
- package/dist/health-plan/index.d.cts +4 -4
- package/dist/health-plan/index.d.ts +4 -4
- package/dist/health-plan/index.js +1 -1
- package/dist/index.cjs +221 -221
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +221 -221
- package/dist/notifications/inbox/index.cjs +9 -9
- package/dist/notifications/inbox/index.js +9 -9
- package/dist/notifications/index.cjs +3 -3
- package/dist/notifications/index.d.cts +3 -3
- package/dist/notifications/index.d.ts +3 -3
- package/dist/notifications/index.js +6 -6
- package/dist/photo/index.cjs +1 -1
- package/dist/photo/index.js +23 -23
- package/dist/{presentation.d-CWGjwq8Z.d.cts → presentation.d-BkIvMtIl.d.cts} +3 -3
- package/dist/{presentation.d-CWGjwq8Z.d.ts → presentation.d-BkIvMtIl.d.ts} +3 -3
- package/dist/records/depth/index.cjs +1 -1
- package/dist/records/depth/index.js +1 -1
- package/dist/records/index.cjs +2 -2
- package/dist/records/index.d.cts +2 -2
- package/dist/records/index.d.ts +2 -2
- package/dist/records/index.js +71 -71
- package/dist/{route.d-IP_gkOWL.d.ts → route.d-B395-hNX.d.ts} +1 -1
- package/dist/{route.d-9wclfD-y.d.cts → route.d-DSSSpSB-.d.cts} +1 -1
- package/dist/{runtimeTypes.d-BdUe3tYs.d.ts → runtimeTypes.d-DAz0Tgw5.d.ts} +5 -5
- package/dist/{runtimeTypes.d-_UZ6rMUY.d.cts → runtimeTypes.d-DPh1Wh15.d.cts} +5 -5
- package/dist/server/events/index.cjs +3 -3
- package/dist/server/events/index.js +3 -3
- package/dist/server/index.cjs +8 -8
- package/dist/server/index.d.cts +15 -1
- package/dist/server/index.d.ts +15 -1
- package/dist/server/index.js +8 -8
- package/dist/slots/index.cjs +1 -1
- package/dist/slots/index.js +1 -1
- package/dist/tabs/index.cjs +2 -2
- package/dist/tabs/index.js +24 -24
- package/dist/televet/booking/index.cjs +51 -51
- package/dist/televet/booking/index.js +1 -1
- package/dist/televet/index.cjs +1 -1
- package/dist/televet/index.js +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/rn/index.cjs +8 -8
- package/dist/testing/rn/index.d.cts +5 -5
- package/dist/testing/rn/index.d.ts +5 -5
- package/dist/testing/rn/index.js +9 -9
- package/dist/testing/web/index.cjs +3 -3
- package/dist/testing/web/index.d.cts +5 -5
- package/dist/testing/web/index.d.ts +5 -5
- package/dist/testing/web/index.js +1 -1
- package/dist/texting/index.cjs +1 -1
- package/dist/texting/index.js +26 -26
- package/dist/{threadOptions.d-BW0rePcs.d.cts → threadOptions.d-DUQxxHyM.d.cts} +3 -3
- package/dist/{threadOptions.d-CrAb71J2.d.ts → threadOptions.d-DnM9UcMx.d.ts} +3 -3
- package/dist/{typeStyle.d-rzVzCfLz.d.ts → typeStyle.d-8mcLhtbH.d.ts} +1 -1
- package/dist/{typeStyle.d-B-YgiWcS.d.cts → typeStyle.d-CLrQZW-r.d.cts} +1 -1
- package/dist/{unreadStore.d-gCsleb6l.d.ts → unreadStore.d-CLnChKca.d.ts} +17 -9
- package/dist/{unreadStore.d-w5x6lEpR.d.cts → unreadStore.d-Donv4bcF.d.cts} +17 -9
- package/dist/{usePresentation.d-w5_oWKmh.d.ts → usePresentation.d-Buxz2Jkt.d.ts} +1 -1
- package/dist/{usePresentation.d-DefUwatV.d.cts → usePresentation.d-DUYzYXgA.d.cts} +1 -1
- package/dist/{useUnread.d-DeRDFtTb.d.cts → useUnread.d-7-cuCooM.d.cts} +3 -3
- package/dist/{useUnread.d-xDOpYyqx.d.ts → useUnread.d-B6Ehu0ao.d.ts} +3 -3
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.js +1 -1
- package/dist/web/consent/index.cjs +3 -3
- package/dist/web/consent/index.js +5 -5
- package/dist/web/health-plan/index.cjs +2 -2
- package/dist/web/health-plan/index.d.cts +5 -5
- package/dist/web/health-plan/index.d.ts +5 -5
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/inbox/index.cjs +5 -5
- package/dist/web/inbox/index.js +5 -5
- package/dist/web/index.cjs +176 -176
- package/dist/web/index.d.cts +18 -18
- package/dist/web/index.d.ts +18 -18
- package/dist/web/index.js +181 -181
- package/dist/web/intro/index.cjs +10 -10
- package/dist/web/intro/index.js +6 -6
- package/dist/web/notifications/index.cjs +5 -5
- package/dist/web/notifications/index.d.cts +2 -2
- package/dist/web/notifications/index.d.ts +2 -2
- package/dist/web/notifications/index.js +1 -1
- package/dist/web/records/depth/index.cjs +1 -1
- package/dist/web/records/depth/index.js +1 -1
- package/dist/web/records/index.cjs +1 -1
- package/dist/web/records/index.js +1 -1
- package/dist/web/records-sheet/index.cjs +2 -2
- package/dist/web/records-sheet/index.js +2 -2
- package/dist/web/shop/index.cjs +1 -1
- package/dist/web/shop/index.js +15 -15
- package/dist/web/televet/booking/index.cjs +2 -2
- package/dist/web/televet/booking/index.js +64 -64
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/televet/index.cjs +6 -6
- package/dist/web/televet/index.js +1 -1
- package/dist/web/texting/index.cjs +1 -1
- package/dist/web/texting/index.js +1 -1
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +33 -33
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
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
2
|
"use client";
|
|
3
|
-
import{createContext,useRef as e,useMemo as t,useState as r,useCallback as n,useEffect as i,useReducer as l,useId as a,useContext as o,useSyncExternalStore as s,createElement as d,Component as c,useLayoutEffect as u}from"react";import{z as p}from"zod";import{jsx as h,jsxs as f,Fragment as m}from"react/jsx-runtime";var g=[{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}],y=/* @__PURE__ */Object.freeze(g.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(y.map(e=>e.wireCode));var b=/* @__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"}),v=/* @__PURE__ */Object.freeze(y.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:b[e.wireCode]}))),w=new Map(v.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),k=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(v.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...k]){let t=w.get(e+r);if(t)return t}}var x=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return x[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var _=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return _.has(e)}var C=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||C.has(e)}var R=500,S=8e3,$=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(R*2**r,S);return Math.floor(t()*n)}var T="This feature isn't available on your account right now.",z="Something in that request was not right. Check the details and try again.",I=/* @__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:T,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:z,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:T,runtimeDisposed:z,unknown:"Something went wrong. Please try again."}),D="This session has ended. Please sign in again.",E="linked_account_read_only";function q(e,t,r){return e==="conflict"&&r===E?T:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?D:userFacingError(e)}function userFacingError(e){return I[e]}function O(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var P=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===E,i={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:q(e,t?.wireCode,n?E:null)};t?.httpStatus!==void 0&&(i.httpStatus=t.httpStatus),t?.requestId&&(i.requestId=t.requestId),typeof t?.reasonCode=="string"&&P.test(t.reasonCode)&&(i.reasonCode=t.reasonCode);let l=t?.retryAfterSeconds;if(typeof l=="number"&&Number.isFinite(l)&&l>=0&&(i.retryAfterSeconds=Math.round(l)),r);return t?.wireMessage&&O(i,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&O(i,"raw",t.raw),/* @__PURE__ */Object.freeze(i)}function ok(e,t){/* @__PURE__ */
|
|
3
|
+
import{createContext,useRef as e,useMemo as t,useState as r,useCallback as n,useEffect as i,useReducer as l,useId as a,useContext as o,useSyncExternalStore as s,createElement as d,Component as c,useLayoutEffect as u}from"react";import{z as p}from"zod";import{jsx as h,jsxs as f,Fragment as m}from"react/jsx-runtime";var g=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],y=/* @__PURE__ */Object.freeze(g.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(y.map(e=>e.wireCode));var b=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),v=/* @__PURE__ */Object.freeze(y.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:b[e.wireCode]}))),w=new Map(v.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),k=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(v.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...k]){let t=w.get(e+r);if(t)return t}}var x=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return x[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var _=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return _.has(e)}var C=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||C.has(e)}var R=500,S=8e3,$=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(R*2**r,S);return Math.floor(t()*n)}var T="This feature isn't available on your account right now.",z="Something in that request was not right. Check the details and try again.",I=/* @__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:T,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:z,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:T,runtimeDisposed:z,unknown:"Something went wrong. Please try again."}),D="This session has ended. Please sign in again.",E="linked_account_read_only";function q(e,t,r){return e==="conflict"&&r===E?T:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?D:userFacingError(e)}function userFacingError(e){return I[e]}function O(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var P=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===E,i={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:q(e,t?.wireCode,n?E:null)};t?.httpStatus!==void 0&&(i.httpStatus=t.httpStatus),t?.requestId&&(i.requestId=t.requestId),typeof t?.reasonCode=="string"&&P.test(t.reasonCode)&&(i.reasonCode=t.reasonCode);let l=t?.retryAfterSeconds;if(typeof l=="number"&&Number.isFinite(l)&&l>=0&&(i.retryAfterSeconds=Math.round(l)),r);return t?.wireMessage&&O(i,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&O(i,"raw",t.raw),/* @__PURE__ */Object.freeze(i)}function ok(e,t){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
5
5
|
return Object.freeze({ok:false,error:e})}var j=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var A=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;function N(e,t){let r=globalThis.URL;if(typeof r=="function"){let n;try{n=t===void 0?new r(e):new r(e,t)}catch{return null}try{if(n.protocol)return n}catch{}}return M(e,t)}var F=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,B=/[\s\u0000-\u001f\u007f\\]/,L={"http:":"80","https:":"443"};function M(e,t){let r=e.trim();if(t!==void 0&&!A.test(r)){let e=M(t);if(e===null||!r.startsWith("/")||r.startsWith("//"))return null;r=e.origin+r}let n=B.test(r)?null:F.exec(r);if(n===null)return null;let[,i="",l="",a="",o="",s="",d="",c="",u=""]=n,p=`${i.toLowerCase()}:`,h=Number(s);if(h>65535)return null;let f=s===""||String(h)===L[p]?"":String(h),m=L[p]!==void 0,g=o.toLowerCase()+(f&&`:${f}`),y=d||(m?"/":""),b=l||a?`${l}${a&&`:${a}`}@`:"";return{href:`${p}//${b}${g}${y}${c}${u}`,protocol:p,username:l,password:a,hostname:o.toLowerCase(),port:f,origin:m?`${p}//${g}`:"null",pathname:y,search:c==="?"?"":c,hash:u==="#"?"":u}}var H=/* @__PURE__ */Object.freeze(["vet","groomer","boarding"]),U=/* @__PURE__ */p.string().min(1).refine(e=>e.startsWith("https://")),W=/* @__PURE__ */p.string().nullish(),V=/* @__PURE__ */p.unknown().optional(),G=/* @__PURE__ */p.object({share_id:/* @__PURE__ */p.string().min(1),share_url:/* @__PURE__ */p.string().min(1),expires_at:W,audience:V}),K=/* @__PURE__ */p.object({shares:/* @__PURE__ */p.array(/* @__PURE__ */p.object({share_id:/* @__PURE__ */p.string().min(1),expires_at:W,created_at:W,view_count:/* @__PURE__ */p.number().int().nonnegative().nullish(),last_viewed_at:W,audience:V})).optional()}),Y=/* @__PURE__ */p.object({download_url:U,expires_at:W}),Q=/* @__PURE__ */p.object({share_id:/* @__PURE__ */p.string().min(1),expires_at:W,audience:V}),J=/* @__PURE__ */p.object({audience:/* @__PURE__ */p.string().min(1),sections:/* @__PURE__ */p.array(/* @__PURE__ */p.string()),entity_types:/* @__PURE__ */p.array(/* @__PURE__ */p.string()).nullable()}),Z=254;function isShareRecipientEmail(e){let t=e.trim();return t.length>0&&t.length<=Z&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)}var X=e=>typeof e=="string"&&H.includes(e);function ee(e){return X(e)?e:null}function mapShareAudiences(e){let t=p.array(J).safeParse(e);if(!t.success)/* @__PURE__ */return Object.freeze([]);let r=/* @__PURE__ */new Set,n=[];for(let e of t.data)!X(e.audience)||r.has(e.audience)||(r.add(e.audience),n.push(/* @__PURE__ */Object.freeze({audience:e.audience,sections:/* @__PURE__ */Object.freeze([...e.sections]),entityTypes:e.entity_types===null?null:/* @__PURE__ */Object.freeze([...e.entity_types])}))/* @__PURE__ */);return Object.freeze(n)}function resolveShareUrl(e,t){let r=e.trim();if(r.length===0)return null;let n=/^[a-z][a-z0-9+.-]*:/i.test(r)?N(r):t!==void 0?N(r,t):null;return n===null||n.protocol!=="https:"?null:n.href}function mapRecordShareLink(e,t){let r=G.safeParse(e);if(!r.success)return null;let n=resolveShareUrl(r.data.share_url,t);return n===null?null:/* @__PURE__ */Object.freeze({shareId:r.data.share_id,shareUrl:n,expiresAt:r.data.expires_at??null,audience:ee(r.data.audience)})}function mapRecordShareList(e){let t=K.safeParse(e);return t.success?/* @__PURE__ */Object.freeze((t.data.shares??[]).map(e=>/* @__PURE__ */Object.freeze({shareId:e.share_id,expiresAt:e.expires_at??null,createdAt:e.created_at??null,viewCount:e.view_count??0,lastViewedAt:e.last_viewed_at??null,audience:ee(e.audience)}))):null}function mapRecordShareEmailReceipt(e){let t=Q.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({shareId:t.data.share_id,expiresAt:t.data.expires_at??null,audience:ee(t.data.audience)}):null}function mapRecordPdfLink(e){let t=Y.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({downloadUrl:t.data.download_url,expiresAt:t.data.expires_at??null}):null}var te="application/pdf",re=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/heic","image/heif"]),ne=e=>re.includes(e);function ie(e,t){return e===te||t!==void 0&&ne(e)&&t.includes(e)}var le=/* @__PURE__ */Object.freeze({"application/pdf":"document.pdf","image/jpeg":"document.jpg","image/png":"document.png","image/heic":"document.heic","image/heif":"document.heif"});function ae(e){return ie(e,re)?le[e]:le["application/pdf"]}var oe=/* @__PURE__ */Object.freeze({features:/* @__PURE__ */Object.freeze({}),uploadContentTypes:/* @__PURE__ */Object.freeze([te]),shareAudiences:/* @__PURE__ */Object.freeze([])}),se=/* @__PURE__ */p.object({features:/* @__PURE__ */p.record(/* @__PURE__ */p.boolean()),upload_content_types:/* @__PURE__ */p.array(/* @__PURE__ */p.string()).nullish(),share_audiences:/* @__PURE__ */p.unknown().optional()});function de(e){let t=se.safeParse(e);if(!t.success)return oe;let r=t.data.upload_content_types??[],n=re.filter(e=>r.includes(e));/* @__PURE__ */
|
|
6
6
|
return Object.freeze({features:/* @__PURE__ */Object.freeze({...t.data.features}),uploadContentTypes:/* @__PURE__ */Object.freeze([te,...n]),shareAudiences:mapShareAudiences(t.data.share_audiences)})}function acceptsPhotos(e){return e!==void 0&&e.some(ne)}function ce(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ue=/* @__PURE__ */new Set(["requested","awaiting_clinic","awaiting_upload","received","parsing","in_review","published","failed","revoked"]),pe=/* @__PURE__ */Object.freeze({submitted:"requested",sent:"requested",dispatching:"requested",awaiting_response:"awaiting_clinic",clinic_responded_no_records:"awaiting_clinic",records_received:"received",parsing_failed:"in_review",review_email_failed:"in_review",clinic_declined:"failed"});function he(e){let t=Object.prototype.hasOwnProperty.call(pe,e)?pe[e]:void 0;if(t!==void 0)return t;let r=e;return ue.has(r)?r:"parsing"}function fe(e){return e==="owner_reported"||e==="clinic_document"?e:null}var me=/* @__PURE__ */p.object({request_id:/* @__PURE__ */p.string().min(1),pet_ref:/* @__PURE__ */p.string().min(1),status:/* @__PURE__ */p.string(),simple_status:/* @__PURE__ */p.string().nullish(),simple_status_detail:/* @__PURE__ */p.string().nullish(),status_label:/* @__PURE__ */p.string().optional(),dispatch_status:/* @__PURE__ */p.string().nullish(),can_retry_send:/* @__PURE__ */p.boolean().optional(),can_revoke:/* @__PURE__ */p.boolean().optional(),can_convert_to_upload:/* @__PURE__ */p.boolean().optional(),can_update_clinic_email:/* @__PURE__ */p.boolean().optional(),reminder_count:/* @__PURE__ */p.number().int().nonnegative().optional(),last_reminder_at:/* @__PURE__ */p.string().nullish(),waiting_expectation:/* @__PURE__ */p.string().nullish(),document_count:/* @__PURE__ */p.number().optional(),held_item_count:/* @__PURE__ */p.number().optional(),received_at:/* @__PURE__ */p.string().nullish(),parsing_started_at:/* @__PURE__ */p.string().nullish(),review_started_at:/* @__PURE__ */p.string().nullish(),created_at:/* @__PURE__ */p.string().optional(),updated_at:/* @__PURE__ */p.string().optional(),source:/* @__PURE__ */p.string().nullish().catch(null),action_needed_label:/* @__PURE__ */p.string().nullish().catch(null),failure_reason:/* @__PURE__ */p.string().nullish().catch(null),failure_code:/* @__PURE__ */p.string().nullish().catch(null),recovery_stage:/* @__PURE__ */p.string().nullish().catch(null),show_clinic_phone:/* @__PURE__ */p.boolean().optional().catch(void 0),clinic_name:/* @__PURE__ */p.string().nullish().catch(null),clinic_email:/* @__PURE__ */p.string().nullish().catch(null),clinic_phone:/* @__PURE__ */p.string().nullish().catch(null),converted_to_upload_at:/* @__PURE__ */p.string().nullish().catch(null),request_group_id:/* @__PURE__ */p.string().nullish().catch(null)}).passthrough();function ge(e){let t=me.safeParse(e);if(!t.success)return null;let r=t.data,n=ve(r.simple_status),i=n==="requested"&&(r.status==="awaiting_upload"||r.simple_status_detail==="awaiting_owner_upload")?"awaiting_upload":n==="parsing"&&(r.simple_status_detail==="in_review"||r.simple_status_detail==="review_email_failed")?"in_review":n??he(r.status);/* @__PURE__ */
|
|
@@ -1,10 +1,10 @@
|
|
|
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
2
|
"use client";
|
|
3
3
|
"use strict";var e=require("react"),t=require("zod"),r=require("react/jsx-runtime");var n=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;function l(e,t){let r=globalThis.URL;if(typeof r=="function"){let n;try{n=t===void 0?new r(e):new r(e,t)}catch{return null}try{if(n.protocol)return n}catch{}}return s(e,t)}var a=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,i=/[\s\u0000-\u001f\u007f\\]/,o={"http:":"80","https:":"443"};function s(e,t){let r=e.trim();if(t!==void 0&&!n.test(r)){let e=s(t);if(e===null||!r.startsWith("/")||r.startsWith("//"))return null;r=e.origin+r}let l=i.test(r)?null:a.exec(r);if(l===null)return null;let[,c="",u="",d="",f="",p="",h="",m="",b=""]=l,g=`${c.toLowerCase()}:`,w=Number(p);if(w>65535)return null;let y=p===""||String(w)===o[g]?"":String(w),_=o[g]!==void 0,v=f.toLowerCase()+(y&&`:${y}`),x=h||(_?"/":""),j=u||d?`${u}${d&&`:${d}`}@`:"";return{href:`${g}//${j}${v}${x}${m}${b}`,protocol:g,username:u,password:d,hostname:f.toLowerCase(),port:y,origin:_?`${g}//${v}`:"null",pathname:x,search:m==="?"?"":m,hash:b==="#"?"":b}}var c=/* @__PURE__ */Object.freeze(["vet","groomer","boarding"]),u=/* @__PURE__ */t.z.string().min(1).refine(e=>e.startsWith("https://")),d=/* @__PURE__ */t.z.string().nullish(),f=/* @__PURE__ */t.z.unknown().optional(),p=/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),share_url:/* @__PURE__ */t.z.string().min(1),expires_at:d,audience:f}),h=/* @__PURE__ */t.z.object({shares:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),expires_at:d,created_at:d,view_count:/* @__PURE__ */t.z.number().int().nonnegative().nullish(),last_viewed_at:d,audience:f})).optional()}),m=/* @__PURE__ */t.z.object({download_url:u,expires_at:d}),b=/* @__PURE__ */t.z.object({share_id:/* @__PURE__ */t.z.string().min(1),expires_at:d,audience:f}),g=/* @__PURE__ */t.z.object({audience:/* @__PURE__ */t.z.string().min(1),sections:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()),entity_types:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()).nullable()}),w=254;function isShareRecipientEmail(e){let t=e.trim();return t.length>0&&t.length<=w&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)}var y=e=>typeof e=="string"&&c.includes(e);function _(e){return y(e)?e:null}function mapShareAudiences(e){let r=t.z.array(g).safeParse(e);if(!r.success)/* @__PURE__ */return Object.freeze([]);let n=/* @__PURE__ */new Set,l=[];for(let e of r.data)!y(e.audience)||n.has(e.audience)||(n.add(e.audience),l.push(/* @__PURE__ */Object.freeze({audience:e.audience,sections:/* @__PURE__ */Object.freeze([...e.sections]),entityTypes:e.entity_types===null?null:/* @__PURE__ */Object.freeze([...e.entity_types])}))/* @__PURE__ */);return Object.freeze(l)}function resolveShareUrl(e,t){let r=e.trim();if(r.length===0)return null;let n=/^[a-z][a-z0-9+.-]*:/i.test(r)?l(r):t!==void 0?l(r,t):null;return n===null||n.protocol!=="https:"?null:n.href}function mapRecordShareLink(e,t){let r=p.safeParse(e);if(!r.success)return null;let n=resolveShareUrl(r.data.share_url,t);return n===null?null:/* @__PURE__ */Object.freeze({shareId:r.data.share_id,shareUrl:n,expiresAt:r.data.expires_at??null,audience:_(r.data.audience)})}function mapRecordShareList(e){let t=h.safeParse(e);return t.success?/* @__PURE__ */Object.freeze((t.data.shares??[]).map(e=>/* @__PURE__ */Object.freeze({shareId:e.share_id,expiresAt:e.expires_at??null,createdAt:e.created_at??null,viewCount:e.view_count??0,lastViewedAt:e.last_viewed_at??null,audience:_(e.audience)}))):null}function mapRecordShareEmailReceipt(e){let t=b.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({shareId:t.data.share_id,expiresAt:t.data.expires_at??null,audience:_(t.data.audience)}):null}function mapRecordPdfLink(e){let t=m.safeParse(e);return t.success?/* @__PURE__ */Object.freeze({downloadUrl:t.data.download_url,expiresAt:t.data.expires_at??null}):null}var v="application/pdf",x=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/heic","image/heif"]),j=e=>x.includes(e);var k=/* @__PURE__ */Object.freeze({features:/* @__PURE__ */Object.freeze({}),uploadContentTypes:/* @__PURE__ */Object.freeze([v]),shareAudiences:/* @__PURE__ */Object.freeze([])}),z=/* @__PURE__ */t.z.object({features:/* @__PURE__ */t.z.record(/* @__PURE__ */t.z.boolean()),upload_content_types:/* @__PURE__ */t.z.array(/* @__PURE__ */t.z.string()).nullish(),share_audiences:/* @__PURE__ */t.z.unknown().optional()});function O(e){let t=z.safeParse(e);if(!t.success)return k;let r=t.data.upload_content_types??[],n=x.filter(e=>r.includes(e));/* @__PURE__ */
|
|
4
|
-
return Object.freeze({features:/* @__PURE__ */Object.freeze({...t.data.features}),uploadContentTypes:/* @__PURE__ */Object.freeze([v,...n]),shareAudiences:mapShareAudiences(t.data.share_audiences)})}function acceptsPhotos(e){return e!==void 0&&e.some(j)}var C=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:r,resetKey:n}){return e.createElement(C,{fallback:r,resetKey:n,children:e.createElement(RenderHost,{render:t})})}var F="your pet";var S=e=>e.charAt(0).toUpperCase()+e.slice(1);function pronounForSex(e){let t=e?.trim().toLowerCase();return t==="female"?"her":t==="male"?"his":null}function E(e,t){let r=e.trim(),n=r.length>0?r:F,l=S(n);return t==="her"?{name:n,Name:l,poss:"her",Poss:"Her",subj:"she"}:t==="his"?{name:n,Name:l,poss:"his",Poss:"His",subj:"he"}:{name:n,Name:l,poss:`${n}'s`,Poss:`${l}'s`,subj:n}}var R=/* @__PURE__ */Object.freeze({vitalsFrom:(e,t,r)=>`Vitals from ${e.poss} ${t}, ${r}`,vitalsSource:e=>`Where ${e.name}'s vitals come from`,temperature:"Temperature",heartRate:"Heart rate",breathing:"Breathing",upcomingCare:"Upcoming care",overdueBy:e=>`Overdue · due by ${e}`,dueSoon:"Due soon",later:"Later",noDate:"No date",dueIn:(e,t)=>`Due ${e} · in ${t} ${t===1?"day":"days"}`,dueToday:e=>`Due ${e} · today`,overdueByDays:(e,t)=>`Overdue by ${t} ${t===1?"day":"days"} · due ${e}`,recordsHistory:"Records & history",labs:"Labs & bloodwork",results:"results",screenings:"Screenings",screeningsClear:"All clear",screeningsToReview:e=>`${e} to review`,noScreenings:"No screenings yet",visits:"Visits & records",timeline:"Timeline",events:e=>`${e} ${e===1?"event":"events"}`,weight:"Weight",vetVisits:e=>`${e} vet ${e===1?"visit":"visits"}`,history:"History",theirClinic:e=>`${e.Poss} clinic`,bloodPanel:"Blood panel",aboveRange:"above range",belowRange:"below range",othersInRange:"Other values in range.",addRecords:e=>`Add ${e.name}'s records`,moreThanOneClinic:"Records can come from more than one clinic over a lifetime.",visitsCount:e=>`${e} ${e===1?"visit":"visits"}`,panelsCount:e=>`${e} blood ${e===1?"panel":"panels"}`,requestFromClinic:"Request from a clinic",uploadDocument:"Upload a document",onFileNow:"On file now",firstRecord:e=>`Add ${e.name}'s first record`,firstLead:e=>`Records can come from more than one clinic over a lifetime. Start with the one ${e.subj} sees most, and this page fills in from there.`,requestFromTheirClinic:e=>`Request from ${e.poss} clinic`,requestDetail:"We send a secure request and read every page they send back.",uploadDetail:"A PDF, or a photo of a paper record.",findClinic:e=>`Find ${e.name}'s clinic`,chooseFile:"Choose a file",sayBeats:/* @__PURE__ */Object.freeze(["Hmmm","I wonder","what I may be","hiding"]),sayStill:"I wonder what I may be hiding",sample:"Sample",peekLead:e=>`A sneak peek at how ${e.name}'s records will read. Every number links back to the page it came from.`,sampleNote:e=>`Sample data until ${e.poss} records arrive.`,onTheWay:e=>`${e.Name}'s records are on the way`,clinicsTake:"Clinics usually take 2 to 5 days.",anotherClinic:"Another clinic",anotherClinicDetail:"Seen more than one vet? We ask each one.",noDueDate:"No due date on file",noLabs:e=>`No lab results on file for ${e.name} yet. They show up here when a record includes a blood or urine panel.`,noVisits:e=>`No visits in ${e.name}'s records yet. They show up here when a record includes one.`,oneReading:"One reading so far: we'll plot a trend as more come in.",takingNow:"Taking now",noCurrentMeds:"No current medications on file.",noVetTitle:e=>`When ${e.name} has a vet, start here.`,requestedFrom:e=>`Requested from ${e}. Clinics usually take 2 to 5 days.`,onTheWayFrom:(e,t)=>`${e.Name}'s records from ${t} are on the way.`,readingUpload:"We're reading the document you uploaded.",seeWhereItStands:"See where it stands",topRisk:e=>`${e.Poss} top risk`,seePlan:e=>`See ${e.poss} Health Plan`,panelOn:e=>`${e} blood panel`,latestReading:"Latest reading",rangeLine:(e,t,r)=>`range ${e} to ${t}${r?` ${r}`:""}`,noRange:"No range on the report",above:"Above",inRange:"In range",below:"Below",high:"High",belowRangePill:"Below range",changeUp:(e,t)=>`Up ${e}${t?` ${t}`:""}`,changeDown:(e,t)=>`Down ${e}${t?` ${t}`:""}`,changeSince:(e,t)=>` since ${e}, about ${t}%.`,whatIs:e=>`What ${e} is`,otherValues:e=>`Other ${e} values`,panelTitle:(e,t)=>`${e} · ${t}`,askAboutThis:"Ask about this"});function I(e){let t=e?.trim().toLowerCase()??"";return/^(dog|canine|k9|puppy)\b/.test(t)?"dog":/^(cat|feline|kitten)\b/.test(t)?"cat":"other"}var T=/* @__PURE__ */Object.freeze(["published","failed","revoked"]);function isTerminalStatus(e){return T.includes(e)}var $=864e5,A=30,D=2.20462,M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function L(e){if(e==null||e.length===0)return null;let t=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00Z`:e);return Number.isNaN(t)?null:t}function B(e){let t=new Date(e);return`${M[t.getUTCMonth()]??""} ${t.getUTCDate()}`}function P(e){return`${B(e)}, ${new Date(e).getUTCFullYear()}`}function N(e){let t=new Date(e);return`${t.getUTCMonth()+1}/${String(t.getUTCFullYear()%100).padStart(2,"0")}`}var H=e=>new Date(e).toISOString().slice(0,10);function W(e){return String(Math.round(e*100)/100)}var q=e=>Math.round(e*D*10)/10;function U(e){let t=e.trim();return t.length<2||t[1]===t[1]?.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)}function V(e){return/temp/i.test(e)?"temp":/heart|pulse/i.test(e)?"heart":/resp|breath/i.test(e)?"breath":null}var K=["temp","heart","breath"],Y={temp:R.temperature,heart:R.heartRate,breath:R.breathing};function G(e){if(e===null||e.withheld)return{vitals:[],observedMs:null};let t=/* @__PURE__ */new Map;for(let r of e.entities){if(r.category!=="vital"||r.value===null||r.value.trim().length===0)continue;let e=V(`${r.canonicalKey??""} ${r.key} ${r.label}`);if(e===null)continue;let n=L(r.observedAt)??0,l=t.get(e);(l===void 0||n>l.ms)&&t.set(e,{value:r.value.trim(),unit:r.unit,ms:n})}let r=K.flatMap(e=>{let r=t.get(e);return r===void 0?[]:[{kind:e,value:r.value,unit:r.unit,label:Y[e]}]}),n=[...t.values()].map(e=>e.ms).filter(e=>e>0);return{vitals:r,observedMs:n.length>0?Math.max(...n):null}}function J(e,t){let r=H(t);return e.find(e=>{let t=L(e.date);return t!==null&&H(t)===r})??null}function Z(e){return/vaccin|rabies|dhpp|booster|bordetella|lepto|lyme|parvo|distemper/i.test(e)?"efi-shield":/\b(alt|alp|lab|labs|blood|panel|bloodwork|urinalysis|chemistry|cbc)\b/i.test(e)?"efi-flask-sm":"efi-calendar"}function X(e,t){return e.map(e=>{let r=L(e.dueAt),n=Z(e.title);if(r!==null&&r<t-$+1)return{item:e,title:e.title,when:R.overdueBy(B(r)),tone:"alert",pill:null,icon:n};let l=e.detail??(r===null?R.noDueDate:P(r));if(r===null)return{item:e,title:e.title,when:l,tone:"none",pill:null,icon:n};let a=r-t<=A*$;return{item:e,title:e.title,when:l,tone:a?"watch":"later",pill:a?R.dueSoon:R.later,icon:n}})}function Q(e){return e==null?null:/above|high/i.test(e)?"above":/below|low/i.test(e)?"below":/in_range|normal|in range/i.test(e)?"in":null}var ee=e=>Math.round(e*10)/10;function te(e,t){let r=`${W(q(e))} lb`,n=`${W(ee(e))} kg`;return t==="kg"?{main:n,other:r}:{main:r,other:n}}function re(e,t){if(e===null||e.withheld)return null;let r=e.weights.flatMap(e=>{let t=L(e.observedOn);return t===null||e.weightKg===null?[]:[{ms:t,kg:e.weightKg}]}).sort((e,t)=>e.ms-t.ms),n=r[r.length-1];if(n===void 0)return null;let l=r.map(e=>q(e.kg)),a=Math.min(...l),i=Math.max(...l),o=r[0]?.ms??n.ms,s=n.ms-o,c=r.map((e,r)=>({x:s>0?Math.round((3.55+93.45*(e.ms-o)/s)*100)/100:50,y:i>a?Math.round((75-50*((l[r]??a)-a)/(i-a))*10)/10:50,lb:l[r]??0,value:t==="kg"?ee(e.kg):l[r]??0,ms:e.ms})),u=c.length<=4?c:[c[0],c[c.length-1]].filter(e=>e!==void 0),d=te(n.kg,t);return{latest:d.main,sub:`${d.other} · ${B(n.ms)}`,single:c.length===1,points:c,ticks:u.map(e=>({x:e.x,label:N(e.ms)})),vetCount:c.length}}function ne(e){let t=/* @__PURE__ */new Map;if(e===null||e.withheld)return t;for(let r of e.markers)for(let e of r.points){let n=L(e.at);if(n===null)continue;let l=H(n),a=t.get(l)??{ms:n,flagged:[],total:0,inRange:0,clinics:/* @__PURE__ */new Set};a.total+=1;let i=Q(e.status);i==="in"&&(a.inRange+=1),(i==="above"||i==="below")&&a.flagged.push({marker:r,point:e,ms:n,flag:i}),e.sourceClinic&&a.clinics.add(e.sourceClinic),t.set(l,a)}return t}function le(e,t){let r=[];for(let[e,n]of t)n.flagged.forEach((t,l)=>{let a=t.point.value===null?t.point.qualitativeResult??"":W(t.point.value),i=t.point.unit??t.marker.unit,o=n.flagged.length===1&&n.inRange===n.total-1&&n.total>1;r.push({key:`lab-${e}-${t.marker.markerId}-${l}`,ms:n.ms,date:`${B(n.ms)} · ${R.bloodPanel}`,title:`${t.marker.name} ${a}${i?` ${i}`:""}, ${t.flag==="above"?R.aboveRange:R.belowRange}`,text:o?R.othersInRange:null,alert:true,markerId:t.marker.markerId,order:0})});let n=e.depth?.withheld===false?e.depth.encounters:[],l=e.timeline?.withheld===false?e.timeline.visits:[],a=/* @__PURE__ */new Set;n.forEach((e,t)=>{let n=L(e.date);if(n===null)return;let i=l.find(t=>e.docId!==null&&t.docId===e.docId||L(t.visitDate)!==null&&H(L(t.visitDate)??0)===H(n))??null;i!==null&&a.add(i.visitId);let o=i?.summary?.trim()||null,s=e.type?.trim()||null,c=o??s;c!==null&&r.push({key:`enc-${e.encounterId}-${t}`,ms:n,date:o!==null&&s!==null?`${B(n)} · ${s}`:B(n),title:c,text:null,alert:false,markerId:null,order:1})});for(let e of l){let t=L(e.visitDate),n=e.summary?.trim()||null;a.has(e.visitId)||t===null||n===null||r.push({key:`visit-${e.visitId}`,ms:t,date:B(t),title:n,text:null,alert:false,markerId:null,order:1})}r.sort((e,t)=>t.ms-e.ms||e.order-t.order);let i=[];for(let e of r){let t={key:e.key,ms:e.ms,date:e.date,title:e.title,text:e.text,alert:e.alert,markerId:e.markerId},r=String(new Date(t.ms).getUTCFullYear()),n=i[i.length-1];n!==void 0&&n.year===r?n.items.push(t):i.push({year:r,items:[t]})}return{years:i,count:r.length}}function ae(e,t){let r=e.depth?.withheld===false?e.depth.encounters:[],n=t=>t?.trim()||R.theirClinic(e.words),l=/* @__PURE__ */new Map;for(let e of r)l.set(n(e.clinicName),(l.get(n(e.clinicName))??0)+1);let a=/* @__PURE__ */new Map,i=l.size===1?[...l.keys()][0]:void 0;for(let r of t.values()){let t=r.clinics.size>0?[...r.clinics].map(n):[i??R.theirClinic(e.words)];for(let e of t)a.set(e,(a.get(e)??0)+1)}return[.../* @__PURE__ */new Set([...l.keys(),...a.keys()])].map(e=>({label:e,detail:[(l.get(e)??0)>0?R.visitsCount(l.get(e)??0):null,(a.get(e)??0)>0?R.panelsCount(a.get(e)??0):null].filter(e=>e!==null).join(" · ")}))}var ie={requested:15,awaiting_clinic:35,awaiting_upload:35,received:60,parsing:75,in_review:90};function oe(e){let t=e.filter(e=>!isTerminalStatus(e.status)).sort((e,t)=>(L(t.updatedAt)??0)-(L(e.updatedAt)??0))[0];if(t===void 0)return null;let r=(t.waitingExpectation?.trim()||t.statusLabel).trim();return r.length===0?null:{step:r,pct:ie[t.status]??15}}var se=e=>[...e].sort((e,t)=>(L(t.updatedAt)??0)-(L(e.updatedAt)??0)),ce=e=>/[.!?]$/.test(e)?e:`${e}.`;function ue(e,t){let r=se(t).filter(e=>!isTerminalStatus(e.status)),n=r.filter(e=>e.status==="awaiting_upload"),l=r.filter(e=>e.status!=="awaiting_upload"),a=[],i=/* @__PURE__ */new Map;for(let e of l){let t=e.clinicName?.trim()??"";e.source!=="clinic_request"||t===""||i.has(t)||i.set(t,e)}for(let[t,r]of i)a.push({key:`clinic-${t}`,text:R.onTheWayFrom(e,t),requestId:r.id});let o=l.find(e=>e.source==="owner_provided");o!==void 0&&a.push({key:"upload",text:R.readingUpload,requestId:o.id});let s=n[0],c=s?.statusLabel.trim()??"";return s!==void 0&&c!==""&&a.push({key:"awaiting-upload",text:ce(c),requestId:s.id}),a}function de(e){return se(e).find(e=>!isTerminalStatus(e.status)&&e.status!=="awaiting_upload"&&e.source==="clinic_request"&&(e.clinicName?.trim()??"")!=="")?.clinicName?.trim()??null}function fe(e){if(e===null||e.withheld)return null;let t=e.medications.filter(e=>(e.drugName?.trim()??"")!=="");return t.length===0?null:{current:t.filter(e=>(e.stoppedOn?.trim()??"")==="").map(e=>{let t=[e.dose,e.frequency,e.route].map(e=>e?.trim()??"").filter(e=>e!==""),r=e.sig?.trim()||(t.length>0?t.join(" · "):null);return{key:e.medicationId,name:(e.drugName??"").trim(),detail:r}})}}function pe(e){if(e.some(e=>!isTerminalStatus(e.status)))return null;let t=[...e].sort((e,t)=>(L(t.updatedAt)??0)-(L(e.updatedAt)??0))[0];if(t===void 0||t.status!=="failed")return null;let r=t.statusLabel.trim();return r.length>0?r:null}function he(e,t,r){return e!==null&&!e.withheld&&!e.isEmpty||t!==null&&!t.withheld&&t.markers.length>0?true:r!==null&&!r.withheld&&r.encounters.length>0}function me(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;let t=Math.floor(e*12+1e-9),r=Math.floor(t/12),n=t%12;return r<=0?`${n}M`:n>0?`${r}Y ${n}M`:`${r}Y`}function be(e){let{record:t,depth:r,markers:n,nowMs:l}=e,a=he(t,n,r),i=oe(e.requests),o=ne(n),{vitals:s,observedMs:c}=G(t),u=r?.withheld===false?r.encounters:[],d=c===null?null:J(u,c),f=c!==null&&d?.type?R.vitalsFrom(e.words,U(d.type),B(c)):null,p=e.weightUnit??"lb",h=re(e.timeline,p),m=h!==null?null:e.petWeightKg,b=[e.breed?.trim()||null,me(e.petAgeYears),h?.latest??(m!==null?te(m,p).main:null)].filter(e=>e!==null),g=e.timeline?.withheld===false?e.timeline.visits.length:0,w=le(e,o),y=u.map(e=>L(e.date)).filter(e=>e!==null),_=n?.withheld===false?n.markers:[],v=n?.featuredMarkerId??_.find(e=>Q(e.latest?.status)==="above"||Q(e.latest?.status)==="below")?.markerId??_[0]?.markerId??null;return{state:a?"full":i!==null?"onTheWay":"none",meta:b.length>0?b.join(" · "):null,vitals:s,vitalsFrom:f,due:t!==null&&!t.withheld?X(t.forwardLooking,l):[],labsCount:n?.withheld===false?n.summary?.totalMarkers??n.markers.length:0,featuredMarkerId:v,latestVisit:y.length>0?P(Math.max(...y)):null,weight:h,history:w.years,historyCount:w.count,sources:ae(e,o),pull:i,hasVisits:u.length>0||g>0,medications:fe(e.timeline),failedRequest:i===null?pe(e.requests):null,inFlight:ue(e.words,e.requests),requestedClinic:de(e.requests)}}function ge(e){let t=e.points.filter(e=>e.value!==null);return t[t.length-1]??e.points[e.points.length-1]??null}function we(e){return e===null||e.refLow===null||e.refHigh===null||!Number.isFinite(e.refLow)||!Number.isFinite(e.refHigh)||e.refHigh<=e.refLow?null:{low:e.refLow,high:e.refHigh}}function ye(e,t=ge(e)){let r=we(t),n=t?.unit??e.unit,l=t?.value??null;return{markerId:e.markerId,name:e.name,value:l===null?t?.qualitativeResult??"":W(l),unit:n,range:r===null?null:`${W(r.low)} to ${W(r.high)}${n?` ${n}`:""}`,at:r===null||l===null?null:Math.round(Math.min(100,Math.max(0,20+60*(l-r.low)/(r.high-r.low)))),flag:Q(t?.status??e.latest?.status??null)}}function _e(e){return e==="above"?R.high:e==="below"?R.belowRangePill:e==="in"?R.inRange:null}var ve=e=>{let t=e.replace(/\s+panel$/i,"").trim()||e;return t.length>1&&t[1]===t[1]?.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)};function xe(e,t){let r=e.markers.find(e=>e.markerId===t);if(r===void 0)return null;let n=ge(r),l=ye(r,n),a=L(n?.at??r.latest?.at??null),i=we(n),o=[a===null?null:B(a),i===null?R.noRange:R.rangeLine(W(i.low),W(i.high),l.unit)].filter(e=>e!==null).join(" · "),s=r.points.flatMap(e=>{let t=L(e.at);return e.value===null||t===null?[]:[{p:e,ms:t,v:e.value}]}),c=[];if(s.length>0){let e=s.map(e=>e.v),t=i?.low??Math.min(...e),r=i?.high??Math.max(...e);c=s.map((e,n)=>({x:s.length===1?50:Math.round((18+64*n/(s.length-1))*100)/100,y:r>t?Math.min(98,Math.max(2,Math.round((75-50*(e.v-t)/(r-t))*10)/10)):50,label:W(e.v),out:Q(e.p.status)==="above"||Q(e.p.status)==="below",tick:B(e.ms)}))}let u=s[0],d=s[s.length-1],f=null;if(u!==void 0&&d!==void 0&&s.length>=2&&d.v!==u.v){let e=Math.abs(d.v-u.v),t=u.v!==0?Math.round(e/Math.abs(u.v)*100):null,r=d.v>u.v?R.changeUp(W(e),l.unit):R.changeDown(W(e),l.unit);f=t===null?null:{lead:r,rest:R.changeSince(B(u.ms),t)}}let p=[],h=a===null?null:H(a),m=e.markers.filter(e=>e.markerId!==r.markerId),b=m.filter(e=>e.panel!==null&&e.panel===r.panel);if(b.length>0&&r.panel!==null){let e=b.map(e=>ye(e));p.push({title:R.otherValues(ve(r.panel)),allInRange:e.every(e=>e.flag==="in"),rows:e})}if(h!==null&&a!==null){let e=/* @__PURE__ */new Map;for(let t of m){if(t.panel===null||t.panel===r.panel)continue;let n=[...t.points].reverse().find(e=>{let t=L(e.at);return t!==null&&H(t)===h});n!==void 0&&e.set(t.panel,[...e.get(t.panel)??[],ye(t,n)])}for(let[t,r]of e)p.push({title:R.panelTitle(t,B(a)),allInRange:r.every(e=>e.flag==="in"),rows:r})}return{markerId:r.markerId,name:r.name,meta:a===null?null:R.panelOn(P(a)),pill:_e(l.flag),flagged:l.flag==="above"||l.flag==="below",latest:`${l.value}${l.unit?` ${l.unit}`:""}`,latestSub:o,hasRange:i!==null,chart:c,change:f,meaning:(r.meaning??"").split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e.length>0),groups:p}}var je=/* @__PURE__ */Object.freeze({vitalsFromLabel:e=>`Where ${e}’s vitals come from`,vitalsFrom:(e,t)=>`From ${e}’s exam, ${t}. `,examNotes:"Exam notes",onTheWayFrom:(e,t)=>`${e}’s records from ${t} are on the way.`,readingUpload:"We’re reading the document you uploaded.",uploadFormatHint:"Upload PDF records you already have, up to 25 MB each. You can pick several at once. We'll read them and add the results to your records.",uploadLimitHint:"PDFs up to 25 MB each. You can pick several at once.",results:e=>e===1?"result":"results",noScreenings:"No screenings yet",screeningsToReview:e=>`${e} to review`,screeningsClear:"All clear",noVisits:"No visits yet",oneReading:"One reading so far: we’ll plot a trend as more come in.",uploadedDocument:"Uploaded document"}),ke=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ze(e){let t=new Date(e);return`${ke[t.getUTCMonth()]??""} ${t.getUTCDate()}, ${t.getUTCFullYear()}`}function Oe(e){let t=je,r=e.filter(e=>(e.latest?.qualitativeResult??"").trim().length>0);if(r.length===0)return null;let n=r.filter(e=>Ce(e.latest?.status??null,e.latest?.qualitativeResult??"")),l=n[0]??r[0];return n.length>0?{label:t.screeningsToReview(n.length),flagged:true,markerId:l.markerId}:{label:t.screeningsClear,flagged:false,markerId:l.markerId}}function Ce(e,t){return e==="in_range"?false:e==="above"||e==="below"?true:/negative|not detected|clear|none/i.test(t)?false:/positive|detected|present|reactive/i.test(t)}function Fe(e){let t=e.replace(/_/g," ").trim();return t.length>0?t.charAt(0).toUpperCase()+t.slice(1):e}function Se(e,t){if(e===null||e.withheld)return[];let r=/* @__PURE__ */new Map;if(t!==null&&!t.withheld)for(let e of t.encounters){let t=e.clinicName?.trim();e.docId!==null&&t&&r.set(e.docId,t)}return Object.values(e.documents).sort((e,t)=>(L(t.receivedAt)??0)-(L(e.receivedAt)??0)).slice(0,4).reverse().map(e=>{let t=L(e.receivedAt);return{key:e.docId,name:r.get(e.docId)??je.uploadedDocument,meta:[e.documentClass?Fe(e.documentClass):null,t!==null?ze(t):null].filter(e=>e!==null).join(" · ")}})}var Ee=["January","February","March","April","May","June","July","August","September","October","November","December"];function Re(e){let t=new Date(e);return`${Ee[t.getUTCMonth()]??""} ${t.getUTCDate()}`}function Ie(e,t){if(t===null||e===null||e.withheld)return null;let r=new Date(t).toISOString().slice(0,10),n=e.encounters.find(e=>{let t=L(e.date);return t!==null&&new Date(t).toISOString().slice(0,10)===r}),l=n?.veterinarian?.trim(),a=L(n?.date);return l&&a!==null?{vet:l,date:Re(a)}:null}function Te(e,t){let r=je;return ue(E(e,null),t).map(t=>t.key==="upload"?{...t,text:r.readingUpload}:t.key.startsWith("clinic-")?{...t,text:r.onTheWayFrom(e,t.key.slice(7))}:t)}var $e=[{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}],Ae=/* @__PURE__ */Object.freeze($e.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Ae.map(e=>e.wireCode));var De=/* @__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"}),Me=/* @__PURE__ */Object.freeze(Ae.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:De[e.wireCode]}))),Le=new Map(Me.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Be=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(Me.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...Be]){let t=Le.get(e+r);if(t)return t}}var Pe=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return Pe[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var Ne=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return Ne.has(e)}var He=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||He.has(e)}var We=500,qe=8e3,Ue=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(We*2**r,qe);return Math.floor(t()*n)}var Ve="This feature isn't available on your account right now.",Ke="Something in that request was not right. Check the details and try again.",Ye=/* @__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:Ve,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:Ke,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:Ve,runtimeDisposed:Ke,unknown:"Something went wrong. Please try again."}),Ge="This session has ended. Please sign in again.",Je="linked_account_read_only";function Ze(e,t,r){return e==="conflict"&&r===Je?Ve:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?Ge:userFacingError(e)}function userFacingError(e){return Ye[e]}function Xe(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var Qe=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===Je,l={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:Ze(e,t?.wireCode,n?Je:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&Qe.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let a=t?.retryAfterSeconds;if(typeof a=="number"&&Number.isFinite(a)&&a>=0&&(l.retryAfterSeconds=Math.round(a)),r);return t?.wireMessage&&Xe(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Xe(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function ok(e,t){/* @__PURE__ */
|
|
4
|
+
return Object.freeze({features:/* @__PURE__ */Object.freeze({...t.data.features}),uploadContentTypes:/* @__PURE__ */Object.freeze([v,...n]),shareAudiences:mapShareAudiences(t.data.share_audiences)})}function acceptsPhotos(e){return e!==void 0&&e.some(j)}var C=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:r,resetKey:n}){return e.createElement(C,{fallback:r,resetKey:n,children:e.createElement(RenderHost,{render:t})})}var F="your pet";var S=e=>e.charAt(0).toUpperCase()+e.slice(1);function pronounForSex(e){let t=e?.trim().toLowerCase();return t==="female"?"her":t==="male"?"his":null}function E(e,t){let r=e.trim(),n=r.length>0?r:F,l=S(n);return t==="her"?{name:n,Name:l,poss:"her",Poss:"Her",subj:"she"}:t==="his"?{name:n,Name:l,poss:"his",Poss:"His",subj:"he"}:{name:n,Name:l,poss:`${n}'s`,Poss:`${l}'s`,subj:n}}var R=/* @__PURE__ */Object.freeze({vitalsFrom:(e,t,r)=>`Vitals from ${e.poss} ${t}, ${r}`,vitalsSource:e=>`Where ${e.name}'s vitals come from`,temperature:"Temperature",heartRate:"Heart rate",breathing:"Breathing",upcomingCare:"Upcoming care",overdueBy:e=>`Overdue · due by ${e}`,dueSoon:"Due soon",later:"Later",noDate:"No date",dueIn:(e,t)=>`Due ${e} · in ${t} ${t===1?"day":"days"}`,dueToday:e=>`Due ${e} · today`,overdueByDays:(e,t)=>`Overdue by ${t} ${t===1?"day":"days"} · due ${e}`,recordsHistory:"Records & history",labs:"Labs & bloodwork",results:"results",screenings:"Screenings",screeningsClear:"All clear",screeningsToReview:e=>`${e} to review`,noScreenings:"No screenings yet",visits:"Visits & records",timeline:"Timeline",events:e=>`${e} ${e===1?"event":"events"}`,weight:"Weight",vetVisits:e=>`${e} vet ${e===1?"visit":"visits"}`,history:"History",theirClinic:e=>`${e.Poss} clinic`,bloodPanel:"Blood panel",aboveRange:"above range",belowRange:"below range",othersInRange:"Other values in range.",addRecords:e=>`Add ${e.name}'s records`,moreThanOneClinic:"Records can come from more than one clinic over a lifetime.",visitsCount:e=>`${e} ${e===1?"visit":"visits"}`,panelsCount:e=>`${e} blood ${e===1?"panel":"panels"}`,requestFromClinic:"Request from a clinic",uploadDocument:"Upload a document",onFileNow:"On file now",firstRecord:e=>`Add ${e.name}'s first record`,firstLead:e=>`Records can come from more than one clinic over a lifetime. Start with the one ${e.subj} sees most, and this page fills in from there.`,requestFromTheirClinic:e=>`Request from ${e.poss} clinic`,requestDetail:"We send a secure request and read every page they send back.",uploadDetail:"A PDF, or a photo of a paper record.",findClinic:e=>`Find ${e.name}'s clinic`,chooseFile:"Choose a file",sayBeats:/* @__PURE__ */Object.freeze(["Hmmm","I wonder","what I may be","hiding"]),sayStill:"I wonder what I may be hiding",sample:"Sample",peekLead:e=>`A sneak peek at how ${e.name}'s records will read. Every number links back to the page it came from.`,sampleNote:e=>`Sample data until ${e.poss} records arrive.`,onTheWay:e=>`${e.Name}'s records are on the way`,clinicsTake:"Clinics usually take 2 to 5 days.",anotherClinic:"Another clinic",anotherClinicDetail:"Seen more than one vet? We ask each one.",noDueDate:"No due date on file",noLabs:e=>`No lab results on file for ${e.name} yet. They show up here when a record includes a blood or urine panel.`,noVisits:e=>`No visits in ${e.name}'s records yet. They show up here when a record includes one.`,oneReading:"One reading so far: we'll plot a trend as more come in.",takingNow:"Taking now",noCurrentMeds:"No current medications on file.",noVetTitle:e=>`When ${e.name} has a vet, start here.`,requestedFrom:e=>`Requested from ${e}. Clinics usually take 2 to 5 days.`,onTheWayFrom:(e,t)=>`${e.Name}'s records from ${t} are on the way.`,readingUpload:"We're reading the document you uploaded.",seeWhereItStands:"See where it stands",topRisk:e=>`${e.Poss} top risk`,seePlan:e=>`See ${e.poss} Health Plan`,panelOn:e=>`${e} blood panel`,latestReading:"Latest reading",rangeLine:(e,t,r)=>`range ${e} to ${t}${r?` ${r}`:""}`,noRange:"No range on the report",above:"Above",inRange:"In range",below:"Below",high:"High",belowRangePill:"Below range",changeUp:(e,t)=>`Up ${e}${t?` ${t}`:""}`,changeDown:(e,t)=>`Down ${e}${t?` ${t}`:""}`,changeSince:(e,t)=>` since ${e}, about ${t}%.`,whatIs:e=>`What ${e} is`,otherValues:e=>`Other ${e} values`,panelTitle:(e,t)=>`${e} · ${t}`,askAboutThis:"Ask about this"});function I(e){let t=e?.trim().toLowerCase()??"";return/^(dog|canine|k9|puppy)\b/.test(t)?"dog":/^(cat|feline|kitten)\b/.test(t)?"cat":"other"}var T=/* @__PURE__ */Object.freeze(["published","failed","revoked"]);function isTerminalStatus(e){return T.includes(e)}var $=864e5,A=30,D=2.20462,M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function L(e){if(e==null||e.length===0)return null;let t=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00Z`:e);return Number.isNaN(t)?null:t}function B(e){let t=new Date(e);return`${M[t.getUTCMonth()]??""} ${t.getUTCDate()}`}function P(e){return`${B(e)}, ${new Date(e).getUTCFullYear()}`}function N(e){let t=new Date(e);return`${t.getUTCMonth()+1}/${String(t.getUTCFullYear()%100).padStart(2,"0")}`}var H=e=>new Date(e).toISOString().slice(0,10);function W(e){return String(Math.round(e*100)/100)}var q=e=>Math.round(e*D*10)/10;function U(e){let t=e.trim();return t.length<2||t[1]===t[1]?.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)}function V(e){return/temp/i.test(e)?"temp":/heart|pulse/i.test(e)?"heart":/resp|breath/i.test(e)?"breath":null}var K=["temp","heart","breath"],Y={temp:R.temperature,heart:R.heartRate,breath:R.breathing};function G(e){if(e===null||e.withheld)return{vitals:[],observedMs:null};let t=/* @__PURE__ */new Map;for(let r of e.entities){if(r.category!=="vital"||r.value===null||r.value.trim().length===0)continue;let e=V(`${r.canonicalKey??""} ${r.key} ${r.label}`);if(e===null)continue;let n=L(r.observedAt)??0,l=t.get(e);(l===void 0||n>l.ms)&&t.set(e,{value:r.value.trim(),unit:r.unit,ms:n})}let r=K.flatMap(e=>{let r=t.get(e);return r===void 0?[]:[{kind:e,value:r.value,unit:r.unit,label:Y[e]}]}),n=[...t.values()].map(e=>e.ms).filter(e=>e>0);return{vitals:r,observedMs:n.length>0?Math.max(...n):null}}function J(e,t){let r=H(t);return e.find(e=>{let t=L(e.date);return t!==null&&H(t)===r})??null}function Z(e){return/vaccin|rabies|dhpp|booster|bordetella|lepto|lyme|parvo|distemper/i.test(e)?"efi-shield":/\b(alt|alp|lab|labs|blood|panel|bloodwork|urinalysis|chemistry|cbc)\b/i.test(e)?"efi-flask-sm":"efi-calendar"}function X(e,t){return e.map(e=>{let r=L(e.dueAt),n=Z(e.title);if(r!==null&&r<t-$+1)return{item:e,title:e.title,when:R.overdueBy(B(r)),tone:"alert",pill:null,icon:n};let l=e.detail??(r===null?R.noDueDate:P(r));if(r===null)return{item:e,title:e.title,when:l,tone:"none",pill:null,icon:n};let a=r-t<=A*$;return{item:e,title:e.title,when:l,tone:a?"watch":"later",pill:a?R.dueSoon:R.later,icon:n}})}function Q(e){return e==null?null:/above|high/i.test(e)?"above":/below|low/i.test(e)?"below":/in_range|normal|in range/i.test(e)?"in":null}var ee=e=>Math.round(e*10)/10;function te(e,t){let r=`${W(q(e))} lb`,n=`${W(ee(e))} kg`;return t==="kg"?{main:n,other:r}:{main:r,other:n}}function re(e,t){if(e===null||e.withheld)return null;let r=e.weights.flatMap(e=>{let t=L(e.observedOn);return t===null||e.weightKg===null?[]:[{ms:t,kg:e.weightKg}]}).sort((e,t)=>e.ms-t.ms),n=r[r.length-1];if(n===void 0)return null;let l=r.map(e=>q(e.kg)),a=Math.min(...l),i=Math.max(...l),o=r[0]?.ms??n.ms,s=n.ms-o,c=r.map((e,r)=>({x:s>0?Math.round((3.55+93.45*(e.ms-o)/s)*100)/100:50,y:i>a?Math.round((75-50*((l[r]??a)-a)/(i-a))*10)/10:50,lb:l[r]??0,value:t==="kg"?ee(e.kg):l[r]??0,ms:e.ms})),u=c.length<=4?c:[c[0],c[c.length-1]].filter(e=>e!==void 0),d=te(n.kg,t);return{latest:d.main,sub:`${d.other} · ${B(n.ms)}`,single:c.length===1,points:c,ticks:u.map(e=>({x:e.x,label:N(e.ms)})),vetCount:c.length}}function ne(e){let t=/* @__PURE__ */new Map;if(e===null||e.withheld)return t;for(let r of e.markers)for(let e of r.points){let n=L(e.at);if(n===null)continue;let l=H(n),a=t.get(l)??{ms:n,flagged:[],total:0,inRange:0,clinics:/* @__PURE__ */new Set};a.total+=1;let i=Q(e.status);i==="in"&&(a.inRange+=1),(i==="above"||i==="below")&&a.flagged.push({marker:r,point:e,ms:n,flag:i}),e.sourceClinic&&a.clinics.add(e.sourceClinic),t.set(l,a)}return t}function le(e,t){let r=[];for(let[e,n]of t)n.flagged.forEach((t,l)=>{let a=t.point.value===null?t.point.qualitativeResult??"":W(t.point.value),i=t.point.unit??t.marker.unit,o=n.flagged.length===1&&n.inRange===n.total-1&&n.total>1;r.push({key:`lab-${e}-${t.marker.markerId}-${l}`,ms:n.ms,date:`${B(n.ms)} · ${R.bloodPanel}`,title:`${t.marker.name} ${a}${i?` ${i}`:""}, ${t.flag==="above"?R.aboveRange:R.belowRange}`,text:o?R.othersInRange:null,alert:true,markerId:t.marker.markerId,order:0})});let n=e.depth?.withheld===false?e.depth.encounters:[],l=e.timeline?.withheld===false?e.timeline.visits:[],a=/* @__PURE__ */new Set;n.forEach((e,t)=>{let n=L(e.date);if(n===null)return;let i=l.find(t=>e.docId!==null&&t.docId===e.docId||L(t.visitDate)!==null&&H(L(t.visitDate)??0)===H(n))??null;i!==null&&a.add(i.visitId);let o=i?.summary?.trim()||null,s=e.type?.trim()||null,c=o??s;c!==null&&r.push({key:`enc-${e.encounterId}-${t}`,ms:n,date:o!==null&&s!==null?`${B(n)} · ${s}`:B(n),title:c,text:null,alert:false,markerId:null,order:1})});for(let e of l){let t=L(e.visitDate),n=e.summary?.trim()||null;a.has(e.visitId)||t===null||n===null||r.push({key:`visit-${e.visitId}`,ms:t,date:B(t),title:n,text:null,alert:false,markerId:null,order:1})}r.sort((e,t)=>t.ms-e.ms||e.order-t.order);let i=[];for(let e of r){let t={key:e.key,ms:e.ms,date:e.date,title:e.title,text:e.text,alert:e.alert,markerId:e.markerId},r=String(new Date(t.ms).getUTCFullYear()),n=i[i.length-1];n!==void 0&&n.year===r?n.items.push(t):i.push({year:r,items:[t]})}return{years:i,count:r.length}}function ae(e,t){let r=e.depth?.withheld===false?e.depth.encounters:[],n=t=>t?.trim()||R.theirClinic(e.words),l=/* @__PURE__ */new Map;for(let e of r)l.set(n(e.clinicName),(l.get(n(e.clinicName))??0)+1);let a=/* @__PURE__ */new Map,i=l.size===1?[...l.keys()][0]:void 0;for(let r of t.values()){let t=r.clinics.size>0?[...r.clinics].map(n):[i??R.theirClinic(e.words)];for(let e of t)a.set(e,(a.get(e)??0)+1)}return[.../* @__PURE__ */new Set([...l.keys(),...a.keys()])].map(e=>({label:e,detail:[(l.get(e)??0)>0?R.visitsCount(l.get(e)??0):null,(a.get(e)??0)>0?R.panelsCount(a.get(e)??0):null].filter(e=>e!==null).join(" · ")}))}var ie={requested:15,awaiting_clinic:35,awaiting_upload:35,received:60,parsing:75,in_review:90};function oe(e){let t=e.filter(e=>!isTerminalStatus(e.status)).sort((e,t)=>(L(t.updatedAt)??0)-(L(e.updatedAt)??0))[0];if(t===void 0)return null;let r=(t.waitingExpectation?.trim()||t.statusLabel).trim();return r.length===0?null:{step:r,pct:ie[t.status]??15}}var se=e=>[...e].sort((e,t)=>(L(t.updatedAt)??0)-(L(e.updatedAt)??0)),ce=e=>/[.!?]$/.test(e)?e:`${e}.`;function ue(e,t){let r=se(t).filter(e=>!isTerminalStatus(e.status)),n=r.filter(e=>e.status==="awaiting_upload"),l=r.filter(e=>e.status!=="awaiting_upload"),a=[],i=/* @__PURE__ */new Map;for(let e of l){let t=e.clinicName?.trim()??"";e.source!=="clinic_request"||t===""||i.has(t)||i.set(t,e)}for(let[t,r]of i)a.push({key:`clinic-${t}`,text:R.onTheWayFrom(e,t),requestId:r.id});let o=l.find(e=>e.source==="owner_provided");o!==void 0&&a.push({key:"upload",text:R.readingUpload,requestId:o.id});let s=n[0],c=s?.statusLabel.trim()??"";return s!==void 0&&c!==""&&a.push({key:"awaiting-upload",text:ce(c),requestId:s.id}),a}function de(e){return se(e).find(e=>!isTerminalStatus(e.status)&&e.status!=="awaiting_upload"&&e.source==="clinic_request"&&(e.clinicName?.trim()??"")!=="")?.clinicName?.trim()??null}function fe(e){if(e===null||e.withheld)return null;let t=e.medications.filter(e=>(e.drugName?.trim()??"")!=="");return t.length===0?null:{current:t.filter(e=>(e.stoppedOn?.trim()??"")==="").map(e=>{let t=[e.dose,e.frequency,e.route].map(e=>e?.trim()??"").filter(e=>e!==""),r=e.sig?.trim()||(t.length>0?t.join(" · "):null);return{key:e.medicationId,name:(e.drugName??"").trim(),detail:r}})}}function pe(e){if(e.some(e=>!isTerminalStatus(e.status)))return null;let t=[...e].sort((e,t)=>(L(t.updatedAt)??0)-(L(e.updatedAt)??0))[0];if(t===void 0||t.status!=="failed")return null;let r=t.statusLabel.trim();return r.length>0?r:null}function he(e,t,r){return e!==null&&!e.withheld&&!e.isEmpty||t!==null&&!t.withheld&&t.markers.length>0?true:r!==null&&!r.withheld&&r.encounters.length>0}function me(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;let t=Math.floor(e*12+1e-9),r=Math.floor(t/12),n=t%12;return r<=0?`${n}M`:n>0?`${r}Y ${n}M`:`${r}Y`}function be(e){let{record:t,depth:r,markers:n,nowMs:l}=e,a=he(t,n,r),i=oe(e.requests),o=ne(n),{vitals:s,observedMs:c}=G(t),u=r?.withheld===false?r.encounters:[],d=c===null?null:J(u,c),f=c!==null&&d?.type?R.vitalsFrom(e.words,U(d.type),B(c)):null,p=e.weightUnit??"lb",h=re(e.timeline,p),m=h!==null?null:e.petWeightKg,b=[e.breed?.trim()||null,me(e.petAgeYears),h?.latest??(m!==null?te(m,p).main:null)].filter(e=>e!==null),g=e.timeline?.withheld===false?e.timeline.visits.length:0,w=le(e,o),y=u.map(e=>L(e.date)).filter(e=>e!==null),_=n?.withheld===false?n.markers:[],v=n?.featuredMarkerId??_.find(e=>Q(e.latest?.status)==="above"||Q(e.latest?.status)==="below")?.markerId??_[0]?.markerId??null;return{state:a?"full":i!==null?"onTheWay":"none",meta:b.length>0?b.join(" · "):null,vitals:s,vitalsFrom:f,due:t!==null&&!t.withheld?X(t.forwardLooking,l):[],labsCount:n?.withheld===false?n.summary?.totalMarkers??n.markers.length:0,featuredMarkerId:v,latestVisit:y.length>0?P(Math.max(...y)):null,weight:h,history:w.years,historyCount:w.count,sources:ae(e,o),pull:i,hasVisits:u.length>0||g>0,medications:fe(e.timeline),failedRequest:i===null?pe(e.requests):null,inFlight:ue(e.words,e.requests),requestedClinic:de(e.requests)}}function ge(e){let t=e.points.filter(e=>e.value!==null);return t[t.length-1]??e.points[e.points.length-1]??null}function we(e){return e===null||e.refLow===null||e.refHigh===null||!Number.isFinite(e.refLow)||!Number.isFinite(e.refHigh)||e.refHigh<=e.refLow?null:{low:e.refLow,high:e.refHigh}}function ye(e,t=ge(e)){let r=we(t),n=t?.unit??e.unit,l=t?.value??null;return{markerId:e.markerId,name:e.name,value:l===null?t?.qualitativeResult??"":W(l),unit:n,range:r===null?null:`${W(r.low)} to ${W(r.high)}${n?` ${n}`:""}`,at:r===null||l===null?null:Math.round(Math.min(100,Math.max(0,20+60*(l-r.low)/(r.high-r.low)))),flag:Q(t?.status??e.latest?.status??null)}}function _e(e){return e==="above"?R.high:e==="below"?R.belowRangePill:e==="in"?R.inRange:null}var ve=e=>{let t=e.replace(/\s+panel$/i,"").trim()||e;return t.length>1&&t[1]===t[1]?.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)};function xe(e,t){let r=e.markers.find(e=>e.markerId===t);if(r===void 0)return null;let n=ge(r),l=ye(r,n),a=L(n?.at??r.latest?.at??null),i=we(n),o=[a===null?null:B(a),i===null?R.noRange:R.rangeLine(W(i.low),W(i.high),l.unit)].filter(e=>e!==null).join(" · "),s=r.points.flatMap(e=>{let t=L(e.at);return e.value===null||t===null?[]:[{p:e,ms:t,v:e.value}]}),c=[];if(s.length>0){let e=s.map(e=>e.v),t=i?.low??Math.min(...e),r=i?.high??Math.max(...e);c=s.map((e,n)=>({x:s.length===1?50:Math.round((18+64*n/(s.length-1))*100)/100,y:r>t?Math.min(98,Math.max(2,Math.round((75-50*(e.v-t)/(r-t))*10)/10)):50,label:W(e.v),out:Q(e.p.status)==="above"||Q(e.p.status)==="below",tick:B(e.ms)}))}let u=s[0],d=s[s.length-1],f=null;if(u!==void 0&&d!==void 0&&s.length>=2&&d.v!==u.v){let e=Math.abs(d.v-u.v),t=u.v!==0?Math.round(e/Math.abs(u.v)*100):null,r=d.v>u.v?R.changeUp(W(e),l.unit):R.changeDown(W(e),l.unit);f=t===null?null:{lead:r,rest:R.changeSince(B(u.ms),t)}}let p=[],h=a===null?null:H(a),m=e.markers.filter(e=>e.markerId!==r.markerId),b=m.filter(e=>e.panel!==null&&e.panel===r.panel);if(b.length>0&&r.panel!==null){let e=b.map(e=>ye(e));p.push({title:R.otherValues(ve(r.panel)),allInRange:e.every(e=>e.flag==="in"),rows:e})}if(h!==null&&a!==null){let e=/* @__PURE__ */new Map;for(let t of m){if(t.panel===null||t.panel===r.panel)continue;let n=[...t.points].reverse().find(e=>{let t=L(e.at);return t!==null&&H(t)===h});n!==void 0&&e.set(t.panel,[...e.get(t.panel)??[],ye(t,n)])}for(let[t,r]of e)p.push({title:R.panelTitle(t,B(a)),allInRange:r.every(e=>e.flag==="in"),rows:r})}return{markerId:r.markerId,name:r.name,meta:a===null?null:R.panelOn(P(a)),pill:_e(l.flag),flagged:l.flag==="above"||l.flag==="below",latest:`${l.value}${l.unit?` ${l.unit}`:""}`,latestSub:o,hasRange:i!==null,chart:c,change:f,meaning:(r.meaning??"").split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e.length>0),groups:p}}var je=/* @__PURE__ */Object.freeze({vitalsFromLabel:e=>`Where ${e}’s vitals come from`,vitalsFrom:(e,t)=>`From ${e}’s exam, ${t}. `,examNotes:"Exam notes",onTheWayFrom:(e,t)=>`${e}’s records from ${t} are on the way.`,readingUpload:"We’re reading the document you uploaded.",uploadFormatHint:"Upload PDF records you already have, up to 25 MB each. You can pick several at once. We'll read them and add the results to your records.",uploadLimitHint:"PDFs up to 25 MB each. You can pick several at once.",results:e=>e===1?"result":"results",noScreenings:"No screenings yet",screeningsToReview:e=>`${e} to review`,screeningsClear:"All clear",noVisits:"No visits yet",oneReading:"One reading so far: we’ll plot a trend as more come in.",uploadedDocument:"Uploaded document"}),ke=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ze(e){let t=new Date(e);return`${ke[t.getUTCMonth()]??""} ${t.getUTCDate()}, ${t.getUTCFullYear()}`}function Oe(e){let t=je,r=e.filter(e=>(e.latest?.qualitativeResult??"").trim().length>0);if(r.length===0)return null;let n=r.filter(e=>Ce(e.latest?.status??null,e.latest?.qualitativeResult??"")),l=n[0]??r[0];return n.length>0?{label:t.screeningsToReview(n.length),flagged:true,markerId:l.markerId}:{label:t.screeningsClear,flagged:false,markerId:l.markerId}}function Ce(e,t){return e==="in_range"?false:e==="above"||e==="below"?true:/negative|not detected|clear|none/i.test(t)?false:/positive|detected|present|reactive/i.test(t)}function Fe(e){let t=e.replace(/_/g," ").trim();return t.length>0?t.charAt(0).toUpperCase()+t.slice(1):e}function Se(e,t){if(e===null||e.withheld)return[];let r=/* @__PURE__ */new Map;if(t!==null&&!t.withheld)for(let e of t.encounters){let t=e.clinicName?.trim();e.docId!==null&&t&&r.set(e.docId,t)}return Object.values(e.documents).sort((e,t)=>(L(t.receivedAt)??0)-(L(e.receivedAt)??0)).slice(0,4).reverse().map(e=>{let t=L(e.receivedAt);return{key:e.docId,name:r.get(e.docId)??je.uploadedDocument,meta:[e.documentClass?Fe(e.documentClass):null,t!==null?ze(t):null].filter(e=>e!==null).join(" · ")}})}var Ee=["January","February","March","April","May","June","July","August","September","October","November","December"];function Re(e){let t=new Date(e);return`${Ee[t.getUTCMonth()]??""} ${t.getUTCDate()}`}function Ie(e,t){if(t===null||e===null||e.withheld)return null;let r=new Date(t).toISOString().slice(0,10),n=e.encounters.find(e=>{let t=L(e.date);return t!==null&&new Date(t).toISOString().slice(0,10)===r}),l=n?.veterinarian?.trim(),a=L(n?.date);return l&&a!==null?{vet:l,date:Re(a)}:null}function Te(e,t){let r=je;return ue(E(e,null),t).map(t=>t.key==="upload"?{...t,text:r.readingUpload}:t.key.startsWith("clinic-")?{...t,text:r.onTheWayFrom(e,t.key.slice(7))}:t)}var $e=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],Ae=/* @__PURE__ */Object.freeze($e.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Ae.map(e=>e.wireCode));var De=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),Me=/* @__PURE__ */Object.freeze(Ae.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:De[e.wireCode]}))),Le=new Map(Me.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Be=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(Me.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...Be]){let t=Le.get(e+r);if(t)return t}}var Pe=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return Pe[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var Ne=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return Ne.has(e)}var He=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||He.has(e)}var We=500,qe=8e3,Ue=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(We*2**r,qe);return Math.floor(t()*n)}var Ve="This feature isn't available on your account right now.",Ke="Something in that request was not right. Check the details and try again.",Ye=/* @__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:Ve,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:Ke,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:Ve,runtimeDisposed:Ke,unknown:"Something went wrong. Please try again."}),Ge="This session has ended. Please sign in again.",Je="linked_account_read_only";function Ze(e,t,r){return e==="conflict"&&r===Je?Ve:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?Ge:userFacingError(e)}function userFacingError(e){return Ye[e]}function Xe(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var Qe=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===Je,l={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:Ze(e,t?.wireCode,n?Je:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&Qe.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let a=t?.retryAfterSeconds;if(typeof a=="number"&&Number.isFinite(a)&&a>=0&&(l.retryAfterSeconds=Math.round(a)),r);return t?.wireMessage&&Xe(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Xe(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function ok(e,t){/* @__PURE__ */
|
|
5
5
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
6
6
|
return Object.freeze({ok:false,error:e})}var et=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function errorFrame(e){/* @__PURE__ */
|
|
7
|
-
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var tt="x-everfur-anon-token",rt="anonTokenInvalid";async function nt(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function lt(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...r?{wireMessage:r}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[tt]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...at(e.headers),...authHeaders(t)}}}function at(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let e=r.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===tt||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await nt(t),n=await t.transport.request(withAuthHeaders(e,it(t,r)));if(n.ok||st(n.error.raw)!==rt||t.anonIdentity===void 0||t.userRef!==null)return n;let l=await t.anonIdentity.token({forceRefresh:true});return l===null||l===r?n:t.transport.request(withAuthHeaders(e,it(t,l)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(lt(e))}let n=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let l;try{l=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(lt(e,{wireCode:st(n.error.raw),requestId:n.error.requestId}))}let a=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:l,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!a.ok&&a.error.httpStatus===401?(t.identity.reportRejected?.(),err(ot(a.error))):a}function it(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function ot(e){let t=e.raw,r=st(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...r?{wireCode:r}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function st(e){if(typeof e!="object"||e===null)return null;let t=e,r=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof r=="string"&&r.length>0?r:null}var ct="1.4.
|
|
7
|
+
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var tt="x-everfur-anon-token",rt="anonTokenInvalid";async function nt(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function lt(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...r?{wireMessage:r}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[tt]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...at(e.headers),...authHeaders(t)}}}function at(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let e=r.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===tt||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await nt(t),n=await t.transport.request(withAuthHeaders(e,it(t,r)));if(n.ok||st(n.error.raw)!==rt||t.anonIdentity===void 0||t.userRef!==null)return n;let l=await t.anonIdentity.token({forceRefresh:true});return l===null||l===r?n:t.transport.request(withAuthHeaders(e,it(t,l)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(lt(e))}let n=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let l;try{l=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(lt(e,{wireCode:st(n.error.raw),requestId:n.error.requestId}))}let a=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:l,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!a.ok&&a.error.httpStatus===401?(t.identity.reportRejected?.(),err(ot(a.error))):a}function it(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function ot(e){let t=e.raw,r=st(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...r?{wireCode:r}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function st(e){if(typeof e!="object"||e===null)return null;let t=e,r=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof r=="string"&&r.length>0?r:null}var ct="1.4.1";function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:ut(e)})}function ut(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var dt=3e4,ft=qe*2,pt="idempotency-key",ht=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),mt=/* @__PURE__ */Object.freeze({onEvent(){}}),bt=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function gt(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??mt,r=e.timers??bt,n=e.rng??Math.random,l=e.sleep??((e,t)=>Tt(e,r,t)),a=e.maxAttempts??Ue,i=e.unaryTimeoutMs??dt,o=e.newIdempotencyKey??yt(),s=e=>{try{t.onEvent(e)}catch{}};async function c(t,c,u){let d=u?.maxAttempts,f=Math.max(1,d??a),p=u?.idempotent??ht.has(c.method),h=u?.idempotencyKey===void 0?null:gt(u.idempotencyKey),m=p?h??o():null,b=wt(c,m),g=0;for(;;){let a=e=>/* @__PURE__ */Object.freeze({call:t,method:c.method,path:c.path,attempt:g,...m?{idempotencyKey:m}:{},...e});s(a({phase:"attempt"}));let o=Rt(i,r),u=It(o.signal,c.signal),p;try{p=await authedSend({...b,signal:u.signal},e.auth)}catch(e){p=err(networkError(e))}finally{u.dispose(),o.cancel()}if(p.ok)return s(a({phase:"settled",ok:true,reason:"ok"})),p;let h=p.error,w=vt(h,g,{maxAttempts:f,rng:n,now:r.now(),aborted:c.signal?.aborted===true,...d!==void 0?{perCallMaxAttempts:d}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),y={ok:false,code:h.code,reason:w.reason,...h.httpStatus!==void 0?{httpStatus:h.httpStatus}:{},...h.requestId!==void 0?{requestId:h.requestId}:{}};if(!w.retry)return s(a({phase:"settled",...y})),err(h);if(s(a({phase:"retry",...y,delayMs:w.delayMs})),await l(w.delayMs,c.signal),c.signal?.aborted===true)return s(a({phase:"settled",...y,reason:"aborted"})),err(h);g+=1}}async function u(t){return withAuthHeaders(t,await Et(e.auth))}async function*d(t,r,n){s(
|
|
8
8
|
/* @__PURE__ */Object.freeze({call:t,phase:"stream.open",method:r.method,path:r.path,attempt:0}));try{yield*e.auth.transport.stream(r,n)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
9
9
|
return Object.freeze({send:c,authorize:u,stream:d})}function wt(e,t){let r={};for(let[t,n]of Object.entries(e.headers??{}))t.toLowerCase()!==pt&&(r[t]=n);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}function yt(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var _t=10;function vt(e,t,r){if(r.aborted)return{retry:false,reason:"aborted"};let n=xt(e);if(n==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let l=n==="burst"?"burst-throttle":"retryable-code";if((()=>{if(r.policy===void 0)return false;try{return!r.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let a=()=>{if(r.policy===void 0)return null;let t;try{t=r.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(_t,Math.floor(t)))},i=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=i)return{retry:false,reason:"attempts-exhausted"};let o=jt(e,r.now);return o!==null?o>ft?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:l,delayMs:o}:{retry:true,reason:l,delayMs:backoffDelayMs(t,r.rng)}}function xt(e){let t=e.code==="unknown"?fromWire(Ft(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function jt(e,t){let r=zt(e.raw);if(r!==null){let e=r-t;return e>0?e:0}let n=kt(e.raw);return n===null?null:Math.round(n*1e3)}function kt(e){for(let t of Ot(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function zt(e){for(let t of Ot(e)){let e=t.resets_at,r=Ct(e);if(r!==null)return r}return null}function Ot(e){if(!St(e))return[];let t=[e];for(let r of["error","detail"]){let n=e[r];St(n)&&t.push(n)}return t}function Ct(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}function Ft(e){for(let t of Ot(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function St(e){return typeof e=="object"&&e!==null}async function Et(e){if(e.mode==="anonymous"){let t=await nt(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function Rt(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return{signal:r.signal,cancel:()=>t.clearTimeout(n)}}function It(e,t){let r=()=>{};if(!t)return{signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let l=()=>n.abort();return e.addEventListener("abort",l,{once:true}),t.addEventListener("abort",l,{once:true}),{signal:n.signal,dispose:()=>{e.removeEventListener("abort",l),t.removeEventListener("abort",l)}}}function Tt(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let l=t.setTimeout(()=>{r?.removeEventListener("abort",a),n()},e),a=()=>{t.clearTimeout(l),n()};r?.addEventListener("abort",a,{once:true})})}function $t(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function At(e){return e.code!=="conversationNotFound"?e:makeEverfurError("resourceNotFound",{retryable:false,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},...e.requestId===void 0?{}:{requestId:e.requestId},...e.reasonCode===void 0?{}:{reasonCode:e.reasonCode},...e.wireMessage===void 0?{}:{wireMessage:e.wireMessage},...e.raw===void 0?{}:{raw:e.raw}})}function Dt(e){return e.ok?e:err(At(e.error))}function Mt(e){return{send:async(...t)=>Dt(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,r,n)=>e.stream(t,r,n)}}var Lt=(e,t=4e3)=>typeof e=="string"&&e.trim().length>0&&e.length<=t?e.trim():null;function Bt(e){let t=Lt(e,2048);return t===null?null:/^https:\/\/[^\s]+$/i.test(t)?t:null}var Pt=6;function Nt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=400?e:null}function Ht(e,t,r){if(!Array.isArray(e))/* @__PURE__ */return Object.freeze([]);let n=[];for(let l of e){if(n.length>=r)break;if(l===null||typeof l!="object"||Array.isArray(l))continue;let e=t(l);e!==null&&n.push(e)}/* @__PURE__ */
|
|
10
10
|
return Object.freeze(n)}function Wt(e){let t=Lt(e.title,80),r=Lt(e.body,600);return t===null||r===null?null:/* @__PURE__ */Object.freeze({title:t,body:r})}function qt(e){if(e===null||typeof e!="object"||Array.isArray(e))return;let t=e,r=[];if(Array.isArray(t.gallery))for(let e of t.gallery){let t=Bt(e);t!==null&&r.length<Pt&&r.push(t)}let n=Ht(t.doses,e=>{let t=Lt(e.label,60),r=Lt(e.amount,60);return t===null||r===null?null:/* @__PURE__ */Object.freeze({label:t,amount:r,minLb:Nt(e.minLb??e.min_lb),maxLb:Nt(e.maxLb??e.max_lb)})},Pt),l=Ht(t.details,Wt,Pt),a=t.fit,i=a!==null&&typeof a=="object"&&!Array.isArray(a)?Wt(a):null,o=i!==null&&a.pet===true?/* @__PURE__ */Object.freeze({...i,pet:true}):i,s=/* @__PURE__ */Object.freeze({kicker:Lt(t.kicker,80),gallery:/* @__PURE__ */Object.freeze(r),doses:n,details:l,fine:Lt(t.fine,300),fit:o});return s.kicker===null&&r.length===0&&n.length===0&&l.length===0&&s.fine===null&&o===null?void 0:s}var Ut=128;var Vt=/* @__PURE__ */new Set(["shield","arrow","check","star","truck","refresh","card","alert","x","chat","repeat","calendar","flame","box","cart","minus","plus","chev","pulse","file","kit","dna","heart","bottle","harness","ramp"]),Kt=/* @__PURE__ */new Set(["y","c","g","r"]),Yt=/* @__PURE__ */new Set(["done","now","next"]),Gt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null,Jt=(e,t=1e3)=>typeof e=="string"&&e.trim().length>0&&e.length<=t?e.trim():null,Zt=e=>typeof e=="string"&&/^[A-Za-z0-9_-]{1,40}$/.test(e)?e:null,Xt=e=>typeof e=="string"&&Vt.has(e)?e:null;function Qt(e){let t=Jt(e,2048);return t===null||/\s/.test(t)?null:/^https:\/\/[^/]/i.test(t)||/^\/(?![/\\])/.test(t)?t:null}var er=e=>typeof e=="number"&&Number.isInteger(e)?String(e):Jt(e,Ut);function tr(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:null}function rr(e){/* @__PURE__ */
|