@everfur/sdk 0.5.9 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/dist/{Chat-WmdRwC3b.d.cts → Chat-BoAvCWhI.d.cts} +3 -3
- package/dist/{Chat-C9dVhnyt.d.ts → Chat-CHqcgMyw.d.ts} +3 -3
- package/dist/{DepthViews-CBoI9EYy.d.ts → DepthViews-7Y8Ur058.d.ts} +1 -1
- package/dist/{DepthViews-NPFtO5Kz.d.cts → DepthViews-B0g83e_N.d.cts} +1 -1
- package/dist/{DepthViews-DoODlUnQ.d.cts → DepthViews-CT5mQld9.d.cts} +1 -1
- package/dist/{DepthViews-CmxhM8iP.d.ts → DepthViews-Dg2bIon_.d.ts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/animations/index.js +1 -1
- package/dist/{attachments-OaW36D0H.d.cts → attachments-C3HJNYQ7.d.cts} +2 -2
- package/dist/{attachments-CuFT1o5q.d.ts → attachments-CThFsH4b.d.ts} +5 -5
- package/dist/{attachments-R2oajKPT.d.ts → attachments-CfxsVg7W.d.ts} +2 -2
- package/dist/{attachments-c4mJcIWU.d.cts → attachments-rkox0ewd.d.cts} +5 -5
- package/dist/{bookingCopy-DGQPrisa.d.cts → bookingCopy-Do3zMeXb.d.cts} +2 -2
- package/dist/{bookingCopy-EtPJ4nME.d.ts → bookingCopy-Y3OGdoMT.d.ts} +2 -2
- package/dist/{branding-Ry0em51L.d.ts → branding-ChXm8gxI.d.cts} +135 -3
- package/dist/{branding-DiaCIJZL.d.cts → branding-DYWma2il.d.ts} +135 -3
- package/dist/{casesRepository-Cu8h8gQK.d.ts → casesRepository-BbgXYPxa.d.ts} +1 -1
- package/dist/{casesRepository-DB5c8AAo.d.cts → casesRepository-Jj6t60AY.d.cts} +1 -1
- package/dist/chat/index.cjs +1 -1
- package/dist/chat/index.d.cts +9 -9
- package/dist/chat/index.d.ts +9 -9
- package/dist/chat/index.js +1 -1
- package/dist/client/index.cjs +6 -6
- package/dist/client/index.d.cts +10 -10
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.js +6 -6
- package/dist/{config-DQFMkaTU.d.cts → config-BZX97FmW.d.cts} +1 -1
- package/dist/{config-DlR_I-0S.d.ts → config-Dfbj5mlx.d.ts} +1 -1
- package/dist/consent/index.cjs +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/consent/index.js +1 -1
- package/dist/{context-CLuquPRB.d.ts → context-Cbe0zYym.d.ts} +7 -7
- package/dist/{context-DZEieVJ5.d.cts → context-DJXnZ1Mx.d.cts} +7 -7
- package/dist/{copy-ptTCT5-J.d.ts → copy-DHekqSKE.d.ts} +2 -2
- package/dist/{copy-B2DOzSSy.d.cts → copy-dKK5KoAQ.d.cts} +2 -2
- package/dist/core/index.cjs +9 -9
- package/dist/core/index.d.cts +15 -15
- package/dist/core/index.d.ts +15 -15
- package/dist/core/index.js +9 -9
- package/dist/{depth-CtyC7HOF.d.ts → depth-CrpRjWGB.d.ts} +2 -2
- package/dist/{depth-DuOyvthD.d.cts → depth-NmWSbvfi.d.cts} +2 -2
- package/dist/{entitlementRepository-DlGwxZ1k.d.cts → entitlementRepository-iL-9vS1i.d.cts} +3 -3
- package/dist/{entitlementRepository-CAtyh8Xt.d.ts → entitlementRepository-tVNazi8R.d.ts} +3 -3
- package/dist/{identity-D_NR9ucT.d.ts → identity-B8rp0L9G.d.ts} +1 -1
- package/dist/{identity-BC9AF3y4.d.cts → identity-D7PO5s9m.d.cts} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +6 -6
- package/dist/notifications/index.d.cts +2 -2
- package/dist/notifications/index.d.ts +2 -2
- package/dist/{pets-DuuNvKTK.d.ts → pets-BQbXmICf.d.ts} +1 -1
- package/dist/{pets-D7UjvR1A.d.cts → pets-BWx9BKea.d.cts} +1 -1
- package/dist/{petsRepository-C28NKFwy.d.ts → petsRepository-0oBVydl6.d.ts} +1 -1
- package/dist/{petsRepository-llMvpMkp.d.cts → petsRepository-SqIvEMiT.d.cts} +1 -1
- package/dist/photo/index.cjs +1 -1
- package/dist/photo/index.js +1 -1
- package/dist/{ports-Dbw2h_M1.d.cts → ports-ChnzSy4E.d.cts} +4 -4
- package/dist/{ports-s45HNNyc.d.ts → ports-iXPWd7Vt.d.ts} +4 -4
- package/dist/records/depth/index.cjs +1 -1
- package/dist/records/depth/index.d.cts +7 -7
- package/dist/records/depth/index.d.ts +7 -7
- package/dist/records/depth/index.js +1 -1
- package/dist/records/index.cjs +2 -2
- package/dist/records/index.d.cts +9 -9
- package/dist/records/index.d.ts +9 -9
- package/dist/records/index.js +2 -2
- package/dist/{requestFunnel-CqwOiZNJ.d.ts → requestFunnel-CQzz2DIW.d.ts} +2 -2
- package/dist/{requestFunnel-D_o7se38.d.cts → requestFunnel-DAwb7haa.d.cts} +2 -2
- package/dist/{runtimeTypes-DS0RLoKN.d.ts → runtimeTypes-BNOxfmfg.d.ts} +5 -5
- package/dist/{runtimeTypes-BNBENMkz.d.cts → runtimeTypes-DB9-kigO.d.cts} +5 -5
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/televet/booking/index.cjs +1 -1
- package/dist/televet/booking/index.d.cts +6 -6
- package/dist/televet/booking/index.d.ts +6 -6
- package/dist/televet/booking/index.js +1 -1
- package/dist/televet/call/index.cjs +1 -1
- package/dist/televet/call/index.js +1 -1
- package/dist/televet/index.cjs +1 -1
- package/dist/televet/index.js +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/rn/index.cjs +1 -1
- package/dist/testing/rn/index.d.cts +9 -9
- package/dist/testing/rn/index.d.ts +9 -9
- package/dist/testing/rn/index.js +1 -1
- package/dist/testing/web/index.d.cts +9 -9
- package/dist/testing/web/index.d.ts +9 -9
- package/dist/{timelineRows-B6nCq30k.d.cts → timelineRows-BuNhzDbH.d.cts} +1 -1
- package/dist/{timelineRows-DacfDpDU.d.ts → timelineRows-Dll2IGFg.d.ts} +1 -1
- package/dist/{tokens-DOTIxrws.d.cts → tokens-ARWZtMOU.d.cts} +6 -1
- package/dist/{tokens-DOTIxrws.d.ts → tokens-ARWZtMOU.d.ts} +6 -1
- package/dist/{typeStyle-DROhJNkh.d.ts → typeStyle-8iEqQmP_.d.ts} +2 -2
- package/dist/{typeStyle-achxqQ-h.d.cts → typeStyle-YCS8dt19.d.cts} +2 -2
- package/dist/{useRecordsDepth-BLK8W646.d.cts → useRecordsDepth-CNEHZJtj.d.cts} +1 -1
- package/dist/{useRecordsDepth-C7guUoLc.d.ts → useRecordsDepth-CuNdne6E.d.ts} +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.js +1 -1
- package/dist/{view-BF9oW2GJ.d.cts → view-BhqWlYrZ.d.cts} +2 -2
- package/dist/{view-B6JsD22K.d.ts → view-DFy8EDwf.d.ts} +2 -2
- package/dist/web/consent/index.cjs +1 -1
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/consent/index.js +1 -1
- package/dist/web/index.cjs +7 -7
- package/dist/web/index.d.cts +19 -19
- package/dist/web/index.d.ts +19 -19
- package/dist/web/index.js +7 -7
- package/dist/web/notifications/index.d.cts +3 -3
- package/dist/web/notifications/index.d.ts +3 -3
- package/dist/web/records/depth/index.cjs +1 -1
- package/dist/web/records/depth/index.d.cts +7 -7
- package/dist/web/records/depth/index.d.ts +7 -7
- package/dist/web/records/depth/index.js +1 -1
- package/dist/web/records/index.cjs +3 -3
- package/dist/web/records/index.d.cts +9 -9
- package/dist/web/records/index.d.ts +9 -9
- package/dist/web/records/index.js +3 -3
- package/dist/web/televet/booking/index.cjs +2 -2
- package/dist/web/televet/booking/index.d.cts +7 -7
- package/dist/web/televet/booking/index.d.ts +7 -7
- package/dist/web/televet/booking/index.js +2 -2
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/televet/index.cjs +3 -3
- package/dist/web/televet/index.js +3 -3
- package/package.json +1 -1
package/dist/chat/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var react=require('react'),reactNative=require('react-native'),reactNativeSafeAreaContext=require('react-native-safe-area-context'),jsxRuntime=require('react/jsx-runtime');var kd=Object.defineProperty;var i=(e,t)=>kd(e,"name",{value:t,configurable:true});var Dr=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(Dr.map(e=>e.wireCode));var xd=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),Ro=Object.freeze(Dr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:xd[e.wireCode]}))),_d=new Map(Ro.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Id=Object.freeze(["http_envelope",...[...new Set(Ro.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function Ut(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...Id]){let o=_d.get(n+r);if(o)return o}}i(Ut,"contractErrorFor");function Ad(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(Ad,"contractDocUrl");function So(e){return null}i(So,"publishedDocUrl");var Od=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function To(e){return Od[e]}i(To,"categoryFor");function Po(e){let t=Ut(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":case "TELEVETRATELIMITED":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}i(Po,"fromWire");var Fd=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Vr(e){return Fd.has(e)}i(Vr,"isAutoRetryable");var Md=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function wo(e){return Vr(e)||Md.has(e)}i(wo,"isRetryableCode");var Ld=500,Nr=8e3,ko=4;function xo(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Ld*2**r,Nr);return Math.floor(t()*n)}i(xo,"backoffDelayMs");var Dd=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function Hr(e){return Dd[e]}i(Hr,"userFacingError");function _o(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(_o,"defineHidden");var Vd=/^[a-z][a-z0-9_]{0,63}$/;function q(e,t){let r=Ut(t?.wireCode,t?.wireEnvelope),n={code:e,category:To(e),retryable:t?.retryable??wo(e),displayMessage:Hr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&Vd.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&_o(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&_o(n,"raw",t.raw),Object.freeze(n)}i(q,"makeEverfurError");function de(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(de,"ok");function V(e){return Object.freeze({ok:false,error:e})}i(V,"err");var zt=class zt extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,zt.prototype);}};i(zt,"EverfurConfigError");var ht=zt;var f=Object.freeze({placeholder:"Ask me anything!",send:"Send",stop:"Stop",retry:"Try again",followUps:"Helpful follow-ups",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",typing:"Assistant is typing",loading:"Loading",empty:"No messages yet",transcript:"Conversation",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting\u2026",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openMenu:"Open menu",openMenuUnread:"Open menu, unread chats",yourPets:"Your Pets",yourPet:"Your pet",switchActivePet:"Switch active pet, {name}",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active \xB7 ",close:"Close",addAnotherPet:"Add another pet",addPet:"Add a pet",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function j(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>{let o=t[n];return o===void 0?r:String(o)})}i(j,"fillCopy");var Ur=Object.freeze([Object.freeze({key:"inaccurate",label:f.feedbackReasonInaccurate,feedbackType:"wrong"}),Object.freeze({key:"outdated",label:f.feedbackReasonOutdated,feedbackType:"outdated"}),Object.freeze({key:"unsafe",label:f.feedbackReasonUnsafe,feedbackType:"dangerous"}),Object.freeze({key:"unclear",label:f.feedbackReasonUnclear,feedbackType:"unclear"}),Object.freeze({key:"other",label:f.feedbackReasonOther,feedbackType:"not_helpful"})]),Io=Object.freeze([Object.freeze({sentiment:"up",label:f.feedbackHelpful}),Object.freeze({sentiment:"neutral",label:f.feedbackNeutral}),Object.freeze({sentiment:"down",label:f.feedbackNotHelpful})]);function Nd(e){switch(e){case "up":return "helpful";case "neutral":return "neutral";case "down":return "not_helpful"}}i(Nd,"sentimentToFeedbackType");function Ao(e,t){if(e==="down"&&t!==null){let r=Ur.find(n=>n.key===t);if(r!==void 0)return r.feedbackType}return Nd(e)}i(Ao,"feedbackTypeFor");var Oo=Symbol.for("@everfur/sdk#EverfurContext@v1"),Fo=globalThis,Mo=Fo[Oo]??(Fo[Oo]=react.createContext(null));Mo.displayName??="EverfurContext";function ie(){let e=react.useContext(Mo);if(e===null)throw new ht("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(ie,"useEverfurContext");var Wd=Object.freeze({status:"idle",messages:Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:Object.freeze([]),unreadCount:null});function Bt(e){let{runtime:t,userRef:r,activePet:n,scopeEpoch:o}=ie(),s=e?.petRef??n??null,a=e?.conversationId??null,d=react.useMemo(()=>({runtime:t,userRef:r,petRef:s,conversationId:a,scopeEpoch:o}),[t,r,s,a,o]),[l,u]=react.useState(null),c=l?.scope===d?l.controller:t.registry.peekChat({userRef:r,petRef:s,conversationId:a}),p=react.useRef(null);react.useEffect(()=>{let w=t.registry.acquireChat({userRef:r,petRef:s,conversationId:a});return p.current=w,u({scope:d,controller:w}),()=>{p.current=null,u(h=>h?.controller===w?null:h),t.registry.releaseChat(w);}},[t,r,s,a,o,d]);let y=react.useCallback(w=>c?c.subscribe(w):Gd,[c]),b=react.useCallback(()=>c?c.getSnapshot():Wd,[c]),g=react.useSyncExternalStore(y,b,b),P=react.useCallback((w,h)=>c&&p.current===c&&!c.getSnapshot().isBootstrapping?Br(c,c.send(w,h?.imageS3Keys===void 0?{}:{imageS3Keys:h.imageS3Keys}),()=>p.current===c):Promise.resolve(jr()),[c]),E=react.useCallback(w=>c&&p.current===c&&!c.getSnapshot().isBootstrapping?Br(c,c.askEverfur(w),()=>p.current===c):Promise.resolve(jr()),[c]),S=react.useCallback(()=>c&&p.current===c?Br(c,c.retryLast(),()=>p.current===c):Promise.resolve(jr()),[c]),A=react.useCallback(()=>{c&&p.current===c&&c.stop();},[c]),T=react.useCallback(()=>{c&&p.current===c&&c.newConversation();},[c]),[_,m]=react.useState({controller:null,byMessage:{}}),R=_.controller===c?_.byMessage:qd,O=react.useCallback(async(w,h,x,D)=>{if(!c||p.current!==c)return V(q("accessDenied"));let U=String(w),z=_.controller===c?_.byMessage[U]:void 0;if(z===h&&x==null)return m(le=>{let be={...le.controller===c?le.byMessage:{}};return delete be[U],{controller:c,byMessage:be}}),de(Object.freeze({feedbackId:""}));m(le=>({controller:c,byMessage:{...le.controller===c?le.byMessage:{},[U]:h}}));let Z=await c.submitFeedback(w,Ao(h,x??null),D??null);return p.current!==c?V(q("accessDenied")):(Z.ok||m(le=>{let be={...le.controller===c?le.byMessage:{}};return z===void 0?delete be[U]:be[U]=z,{controller:c,byMessage:be}}),Z)},[c,_]),F=react.useMemo(()=>{let w=i(async h=>{if(!c||p.current!==c)return V(q("accessDenied"));let x=await h(c);return p.current===c?x:V(q("accessDenied"))},"run");return {listConversations:i(h=>w(x=>x.listConversations({...s?{petRef:s}:{},...h})),"listConversations"),getMessages:i((h,x)=>w(D=>D.getMessages(h,x)),"getMessages"),resumeConversation:i(h=>w(x=>x.resumeConversation(h)),"resumeConversation"),loadOlderMessages:i(()=>w(h=>h.loadOlderMessages()),"loadOlderMessages"),markRead:i(()=>w(h=>h.markRead()),"markRead"),refreshActiveThread:i(()=>w(h=>h.refreshActiveThread()),"refreshActiveThread"),answerCheckin:i((h,x)=>w(D=>D.answerCheckin(h,x)),"answerCheckin"),openCheckin:i(h=>w(x=>x.openCheckin(h)),"openCheckin")}},[c,s]);return react.useMemo(()=>({status:g.status,messages:g.messages,conversationId:g.conversationId,petRef:s,error:g.error,isStreaming:g.isStreaming,isBootstrapping:g.isBootstrapping,historyCursor:g.historyCursor??null,isLoadingHistory:g.isLoadingHistory??false,stopped:g.stopped??false,reconnecting:g.reconnecting??false,...F,suggestedPrompts:g.suggestedPrompts,unreadCount:g.unreadCount,hasUnreadThreads:g.hasUnreadThreads??false,newConversation:T,sentimentByMessage:R,feedback:O,send:P,askEverfur:E,retryLast:S,stop:A}),[g,s,P,E,S,A,F,T,R,O])}i(Bt,"useEverfurChat");var Gd=i(()=>{},"NOOP_UNSUBSCRIBE"),qd=Object.freeze({});async function Br(e,t,r){for await(let o of t);if(!r())return V(q("accessDenied"));let n=e.getSnapshot();return n.status==="error"&&n.error!==null?V(n.error):de(Yd(n.messages))}i(Br,"driveToResult");function Yd(e){for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r&&r.role==="assistant"&&r.responseId!==void 0)return r.responseId}return null}i(Yd,"lastAssistantResponseId");function jr(){return V(q("internalError",{retryable:true}))}i(jr,"notReadyError");function Wr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))Wr(e[t]);}return e}i(Wr,"deepFreeze");var Kd=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Vo={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},No={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Do={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},$d={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Xd={regular:"400",medium:"500",bold:"700"},Qd={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Zd=0,jt="System",Wt="monospace",Jd=["content","heading","control","compact","badge"];function eu(e){let t={};for(let r of Jd)t[r]=e;return t}i(eu,"authoredTierSizes");function Ho(){return {family:jt,mono:Wt,fontUrl:null,families:{regular:jt,medium:jt,bold:jt,mono:Wt,monoMedium:Wt,monoBold:Wt},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Do,tierSizes:eu(Do),lineHeight:$d,weight:Xd,letterSpacing:Qd,scale:1,maxScale:Zd,scaleCaps:Kd}}i(Ho,"baseType");var Uo={},He=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function Gt(e){return `cubic-bezier(${e.join(", ")})`}i(Gt,"cssCubicBezier");var zo={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:Gt(He.standard),emphasized:Gt(He.emphasized),exit:Gt(He.exit)},reducedMotion:false},tu={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#111111",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},Bo=Wr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:tu,space:Vo,radius:No,type:Ho(),motion:zo,slots:Uo}),ru={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#111111",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};Wr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ru,space:Vo,radius:No,type:Ho(),motion:zo,slots:Uo});var jo=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Wo=globalThis,Gr=Wo[jo]??(Wo[jo]=react.createContext(Bo));Gr.displayName??="EverfurThemeContext";function I(){return react.useContext(Gr)}i(I,"useEverfurTheme");function lu(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(lu,"tierMultiplier");function v({tier:e="content",...t}){let{type:r}=I(),n=lu(r,e);return react.createElement(reactNative.Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}i(v,"Text");var tt=react.forwardRef(i(function(t,r){return react.createElement(reactNative.TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));function qt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(qt,"assertNever");function qo(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}i(qo,"errorFrame");function cu(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}i(cu,"authHeaders");function gt(e,t){return {...e,headers:{...pu(e.headers),...cu(t)}}}i(gt,"withAuthHeaders");function pu(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();o==="authorization"||o==="x-everfur-partner-key"||(t[r]=n);}return t}i(pu,"stripAuthHeaders");async function Yo(e,t){if(t.mode==="anonymous")return t.transport.request(gt(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return V(qr())}let n=await t.transport.request(gt(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let o;try{o=await t.identity.currentToken({forceRefresh:!0});}catch{return V(qr())}let s=await t.transport.request(gt(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?V(qr(s.error.httpStatus)):s}i(Yo,"authedSend");function qr(e){return q("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(qr,"authRejectedError");function Ko(e){return q("internalError",{retryable:true,wireMessage:fu(e)})}i(Ko,"networkError");function fu(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i(fu,"describeCause");var yu=3e4,mu=Nr*2,hu="idempotency-key",gu=new Set(["POST","PUT","PATCH","DELETE"]),bu=Object.freeze({onEvent(){}}),vu=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Cu(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}i(Cu,"seededIdempotencyKey");function Ue(e){let t=e.observer??bu,r=e.timers??vu,n=e.rng??Math.random,o=e.sleep??((y,b)=>Mu(y,r,b)),s=e.maxAttempts??ko,a=e.unaryTimeoutMs??yu,d=e.newIdempotencyKey??Ru(),l=i(y=>{try{t.onEvent(y);}catch{}},"emit");async function u(y,b,g){let P=g?.maxAttempts,E=Math.max(1,P??s),S=g?.idempotent??gu.has(b.method),A=g?.idempotencyKey===void 0?null:Cu(g.idempotencyKey),T=S?A??d():null,_=Eu(b,T),m=0;for(;;){let R=i(U=>Object.freeze({call:y,method:b.method,path:b.path,attempt:m,...T?{idempotencyKey:T}:{},...U}),"stamp");l(R({phase:"attempt"}));let O=Ou(a,r),F=Fu(O.signal,b.signal),w;try{w=await Yo({..._,signal:F.signal},e.auth);}catch(U){w=V(Ko(U));}finally{F.dispose(),O.cancel();}if(w.ok)return l(R({phase:"settled",ok:true,reason:"ok"})),w;let h=w.error,x=Tu(h,m,{maxAttempts:E,rng:n,now:r.now(),aborted:b.signal?.aborted===true,...P!==void 0?{perCallMaxAttempts:P}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),D={ok:false,code:h.code,reason:x.reason,...h.httpStatus!==void 0?{httpStatus:h.httpStatus}:{},...h.requestId!==void 0?{requestId:h.requestId}:{}};if(!x.retry)return l(R({phase:"settled",...D})),V(h);if(l(R({phase:"retry",...D,delayMs:x.delayMs})),await o(x.delayMs,b.signal),b.signal?.aborted===true)return l(R({phase:"settled",...D,reason:"aborted"})),V(h);m+=1;}}i(u,"send");async function c(y){return gt(y,await Au(e.auth))}i(c,"authorize");async function*p(y,b,g){l(Object.freeze({call:y,phase:"stream.open",method:b.method,path:b.path,attempt:0}));try{yield*e.auth.transport.stream(b,g);}catch{yield qo({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(p,"stream"),Object.freeze({send:u,authorize:c,stream:p})}i(Ue,"createRequestFunnel");function Eu(e,t){let r={};for(let[n,o]of Object.entries(e.headers??{}))n.toLowerCase()!==hu&&(r[n]=o);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(Eu,"assembleHeaders");function Ru(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(Ru,"defaultIdempotencyKeyFactory");var Su=10;function Tu(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=Pu(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!Vr(e.code))return {retry:false,reason:"terminal-code"};let o=n==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let a=i(()=>{if(r.policy===void 0)return null;let u;try{u=r.policy.maxAttempts(e.code);}catch{return null}return typeof u!="number"||!Number.isFinite(u)?null:Math.max(1,Math.min(Su,Math.floor(u)))},"policyCeiling"),d=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=d)return {retry:false,reason:"attempts-exhausted"};let l=wu(e,r.now);return l!==null?l>mu?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:o,delayMs:l}:{retry:true,reason:o,delayMs:xo(t,r.rng)}}i(Tu,"decideRetry");function Pu(e){let t=e.code==="unknown"?Po(Iu(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(Pu,"throttleKind");function wu(e,t){let r=xu(e.raw);if(r!==null){let o=r-t;return o>0?o:0}let n=ku(e.raw);return n===null?null:Math.round(n*1e3)}i(wu,"retryOverrideMs");function ku(e){for(let t of Yr(e)){let r=t.retry_after_seconds;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r}return null}i(ku,"findRetryAfterSeconds");function xu(e){for(let t of Yr(e)){let r=t.resets_at,n=_u(r);if(n!==null)return n}return null}i(xu,"findResetsAt");function Yr(e){if(!$o(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];$o(n)&&t.push(n);}return t}i(Yr,"candidateScopes");function _u(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}i(_u,"parseInstantMs");function Iu(e){for(let t of Yr(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(Iu,"rawWireCode");function $o(e){return typeof e=="object"&&e!==null}i($o,"isRecord");async function Au(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}i(Au,"resolveDeviceAuth");function Ou(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(n),"cancel")}}i(Ou,"boundedSignal");function Fu(e,t){let r=i(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let o=i(()=>n.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),{signal:n.signal,dispose:i(()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o);},"dispose")}}i(Fu,"mergeSignals");function Mu(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let o=t.setTimeout(()=>{r?.removeEventListener("abort",s),n();},e),s=i(()=>{t.clearTimeout(o),n();},"onAbort");r?.addEventListener("abort",s,{once:true});})}i(Mu,"delayAbortable");function Yt(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(Yt,"hasLoneSurrogate");function Kt(e){return [...e].length}i(Kt,"serverLength");var Xo=Object.freeze(["better","same","worse"]),Qo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var Zo=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Jo(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let o={handle:void 0},s=i(()=>{r.clearTimeout(o.handle),t.removeEventListener("abort",s),n();},"done");o.handle=r.setTimeout(s,e),t.addEventListener("abort",s,{once:true});})}i(Jo,"delayAbortable");var Lu="checkin",Du=/^\d{4}-\d{2}-\d{2}$/,Vu="watching";function ei(e){return e.status!=null&&e.status!==Vu}i(ei,"isCheckinSettled");function ti(e){if(typeof e!="string")return null;let t=e.split(":");if(t.length!==3)return null;let[r,n,o]=t;return r!==Lu||n===void 0||o===void 0||!Qo.test(n)||!Du.test(o)?null:{caseId:n,dueDay:o}}i(ti,"parseCheckinOrigin");var $t=4e3;var Xt=4e3;var Uu=Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function ri(e){return e!==Uu}i(ri,"isUploadTransportAvailable");var zu=Object.freeze(["image/jpeg","image/jpg","image/png","image/heic","image/heif","image/webp"]);var Qt=10*1024*1024,Zt=5,bt=120,Bu="/widget/v1/uploads/initiate";function ju(e){return typeof e=="string"&&zu.includes(e.trim().toLowerCase())}i(ju,"isAttachmentMime");function Kr(e){if(!e)return "attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return "attachment";if(t.length<=bt)return t;let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return t.slice(0,bt);let n=t.slice(r);return n.length>=bt?t.slice(0,bt):`${t.slice(0,r).slice(0,bt-n.length)}${n}`}i(Kr,"sanitizeFilename");function $r(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}i($r,"formatBytes");var vt=i(e=>Object.freeze({ok:true,value:e}),"ok"),ve=i(e=>Object.freeze({ok:false,error:e}),"err");function J(e,t,r,n){return Object.freeze({code:e,retryable:t,filename:r,...n??{}})}i(J,"failure");function Wu(e){if(typeof e.sizeBytes=="number"&&Number.isFinite(e.sizeBytes)&&e.sizeBytes>=0)return e.sizeBytes;let t=e.blob;return t!==void 0&&typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}i(Wu,"attachmentSize");function Gu(e){let t=Kr(e.name),r=typeof e.mimeType=="string"?e.mimeType.trim().toLowerCase():"";if(!ju(r))return ve(J("unsupported_type",false,t));let n=Wu(e);return n===null?ve(J("unknown",false,t)):n>Qt?ve(J("too_large",false,t,{sizeBytes:n})):vt(Object.freeze({file:e,filename:t,contentType:r,sizeBytes:n}))}i(Gu,"validateAttachment");function qu(e){if(typeof e!="object"||e===null)return null;let t=e,r=i(u=>typeof u=="string"&&u.length>0?u:null,"str"),n=i(u=>typeof u=="number"&&Number.isFinite(u)?u:null,"num"),o=r(t.upload_id),s=r(t.upload_url),a=r(t.s3_key);if(o===null||s===null||a===null)return null;let d={},l=t.upload_fields;if(typeof l=="object"&&l!==null)for(let[u,c]of Object.entries(l))typeof c=="string"&&(d[u]=c);return Object.freeze({upload_id:o,upload_url:s,upload_fields:Object.freeze(d),expires_in_seconds:n(t.expires_in_seconds)??0,max_content_length:n(t.max_content_length)??Qt,s3_key:a,purpose:r(t.purpose)})}i(qu,"parsePolicy");function Yu(e,t){let r=e.httpStatus;switch(e.code){case "quotaExceeded":return J("quota_exceeded",false,t,{cause:e});case "rateLimited":return J("rate_limited",true,t,{cause:e});case "idempotencyConflict":case "idempotencyInFlight":return J("idempotency_conflict",true,t,{cause:e});case "validationFailed":return J("unsupported_type",false,t,{cause:e});case "serviceUnavailable":case "streamTimeout":return J("network",true,t,{cause:e});default:return r===429?J("rate_limited",true,t,{cause:e}):r===503?J("network",true,t,{cause:e}):r===void 0?J("network",true,t,{cause:e}):J("server",e.retryable,t,{httpStatus:r,cause:e})}}i(Yu,"initiateFailure");async function Ku(e,t,r){let n=await e.send("chat.attachments.initiate",{method:"POST",path:Bu,body:{filename:t.filename,content_type:t.contentType,file_size:t.sizeBytes},...r?.signal?{signal:r.signal}:{}});if(!n.ok)return ve(Yu(n.error,t.filename));let o=qu(n.value);return o===null?ve(J("server",false,t.filename)):vt(o)}i(Ku,"initiateAttachmentUpload");async function $u(e,t,r,n){let o=i(()=>n?.signal?.aborted===true,"cancelled");if(o())return ve(J("cancelled",true,r.filename));try{return await e.postMultipart(t,r.file,{...n?.signal?{signal:n.signal}:{},...n?.onProgress?{onProgress:n.onProgress}:{}}),vt(void 0)}catch{return o()?ve(J("cancelled",true,r.filename)):ve(J("server",true,r.filename))}}i($u,"uploadAttachmentBytes");var Xu=2,Qu=3,Zu=Object.freeze([1e3,2e3,4e3]),ni=0;function Ju(){return ni+=1,`attachment-${ni}`}i(Ju,"defaultNewId");function oi(e){let t=Math.max(1,e.concurrency??Xu),r=Math.max(1,e.maxAttempts??Qu),n=e.backoffMs??Zu,o=Math.max(1,e.maxPerMessage??Zt),s=e.timers??Zo,a=e.newId??Ju,d=ri(e.transport),l=new Map,u=[],c=[],p=new Set,y=new Set,b=Object.freeze({attachments:Object.freeze([])}),g=false,P=i(()=>{b=Object.freeze({attachments:Object.freeze(u.flatMap(m=>{let R=l.get(m);return R===void 0?[]:[R.state]}))});for(let m of y)m();},"publish"),E=i((m,R)=>{m.state=Object.freeze({...m.state,...R}),P();},"patch"),S=i(()=>{for(;!g&&p.size<t&&c.length>0;){let m=c.shift(),R=l.get(m);R!==void 0&&(p.add(m),A(R).finally(()=>{p.delete(m),S();}));}},"pump"),A=i(async m=>{let{attachment:R}=m;for(;m.attempts<r;){if(g||m.controller.signal.aborted)return;m.attempts+=1;let O=m.controller.signal;E(m,{status:"uploading",error:null,progress:0});let F=await Ku(e.funnel,R,{signal:O});if(g||O.aborted)return;let w;if(!F.ok)w=ve(F.error);else {let U=await $u(e.transport,F.value,R,{signal:O,onProgress:i(z=>{!O.aborted&&m.state.status==="uploading"&&E(m,{progress:ec(z)});},"onProgress")});if(g||O.aborted)return;w=U.ok?vt(F.value.s3_key):ve(U.error);}if(w.ok){E(m,{status:"uploaded",s3Key:w.value,error:null,progress:1});return}let h=w.error,x=h.retryable&&m.attempts<r;if(E(m,{status:x?"uploading":"failed",error:h,progress:0}),!x)return;let D=n[Math.min(m.attempts-1,n.length-1)]??0;await Jo(D,O,s);}},"run"),T=i(m=>{c.push(m.state.id),S();},"enqueue"),_={available:d,subscribe(m){return y.add(m),()=>{y.delete(m);}},getSnapshot:i(()=>b,"getSnapshot"),get uploading(){return b.attachments.some(m=>m.status==="uploading")},get s3Keys(){return b.attachments.flatMap(m=>m.status==="uploaded"&&m.s3Key!==null?[m.s3Key]:[])},add(m){let R=Gu(m);if(!R.ok)return R;if(g||u.length>=o)return ve(J("too_many",false,R.value.filename));let O=a(),F={attachment:R.value,controller:new AbortController,attempts:0,state:Object.freeze({id:O,filename:R.value.filename,previewUri:m.uri,contentType:R.value.contentType,sizeBytes:R.value.sizeBytes,status:"uploading",s3Key:null,error:null,progress:0})};return l.set(O,F),u.push(O),P(),T(F),vt(F.state)},retry(m){let R=l.get(m);R===void 0||g||R.state.status!=="failed"||(R.controller=new AbortController,R.attempts=0,E(R,{status:"uploading",error:null,progress:0,s3Key:null}),T(R));},remove(m){let R=l.get(m);if(R===void 0)return;R.controller.abort(),l.delete(m);let O=u.indexOf(m);O>=0&&u.splice(O,1);let F=c.indexOf(m);F>=0&&c.splice(F,1),P();},clear(){for(let m of [...u])_.remove(m);},dispose(){g=true;for(let m of l.values())m.controller.abort();l.clear(),u.length=0,c.length=0,y.clear(),b=Object.freeze({attachments:Object.freeze([])});}};return _}i(oi,"createAttachmentQueue");function ec(e){return Number.isNaN(e)||e<0?0:e>1?1:e}i(ec,"clamp");function ai(e){switch(e.code){case "too_large":return j(f.attachmentTooLarge,{max:$r(Qt),filename:e.filename,size:$r(e.sizeBytes??0)});case "too_many":return j(f.attachmentTooMany,{max:Zt});case "unsupported_type":return j(f.attachmentUnsupported,{filename:e.filename});case "network":return f.attachmentNetwork;case "server":return j(f.attachmentServer,{status:e.httpStatus?` (${e.httpStatus})`:""});case "cancelled":return f.attachmentCancelled;case "rate_limited":return f.attachmentRateLimited;case "quota_exceeded":return f.attachmentQuota;case "idempotency_conflict":return f.attachmentConflict;case "unknown":return f.attachmentUnknown}}i(ai,"attachmentErrorMessage");function li(e,t){return j(e>=t?f.attachmentsFull:f.addAttachment,{used:e,total:t})}i(li,"attachControlLabel");var oc=Object.freeze({attachments:Object.freeze([])});function Xr(e={}){let{runtime:t,userRef:r,scopeEpoch:n}=ie(),o=e.maxPerMessage??Zt,s=react.useCallback(()=>{let{services:m}=t.registry;return oi({funnel:Ue({auth:m.authFor(r),...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}}),transport:e.transport??m.uploadTransport,maxPerMessage:o})},[t,r,n,o,e.transport]),a=react.useMemo(()=>e.queue??s(),[e.queue,s]),d=react.useRef(new WeakSet),[l,u]=react.useState(null),c=l!==null&&l.of===a?l.queue:a;react.useEffect(()=>{if(c!==e.queue){if(d.current.has(c)){u({of:a,queue:s()});return}return ()=>{c.dispose(),d.current.add(c);}}},[c,a,s,e.queue]);let p=react.useSyncExternalStore(c.subscribe,c.getSnapshot,()=>oc),[y,b]=react.useState(null),g=react.useCallback(m=>{let O=(Array.isArray(m)?m:[m]).map(w=>c.add(w)),F=O.find(w=>!w.ok);return F!==void 0&&!F.ok&&b(F.error),O},[c,b]),P=react.useCallback(m=>c.retry(m),[c]),E=react.useCallback(m=>c.remove(m),[c]),S=react.useCallback(()=>c.clear(),[c]),A=react.useCallback(()=>b(null),[b]),T=p.attachments.some(m=>m.status==="uploading"),_=p.attachments.some(m=>m.status==="failed");return react.useMemo(()=>({available:c.available,attachments:p.attachments,maxPerMessage:o,uploading:T,failed:_,blocked:T||_,s3Keys:p.attachments.flatMap(m=>m.status==="uploaded"&&m.s3Key!==null?[m.s3Key]:[]),rejected:y,add:g,retry:P,remove:E,clear:S,dismissRejected:A}),[c.available,p,o,T,_,y,g,P,E,S,A])}i(Xr,"useChatAttachments");var di=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Jt(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(di,t)?di[t]:null}i(Jt,"canonicalPetSpecies");var ui=50,ic=128,Qr=120,ci=120,sc=2e3,pi=120,ac=80,mi=new Set(["male","female","unknown"]),hi=new Set(["day","month","year"]),gi=new Set(["low","medium","high","athletic"]),bi=new Set(["indoor","outdoor","both"]),vi=new Set(["mild","moderate","severe"]),lc=/^(\d{4})-(\d{2})-(\d{2})$/,Ci=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],Ei=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...Ci,...Ei].map(([e])=>e));function dc(e){let t=lc.exec(e);if(t===null)return false;let[r,n,o]=[Number(t[1]),Number(t[2]),Number(t[3])],s=new Date(Date.UTC(r,n-1,o));return s.getUTCFullYear()===r&&s.getUTCMonth()===n-1&&s.getUTCDate()===o}i(dc,"isRealDate");var Et=i(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),uc=i((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),tr=i((e,t)=>typeof t=="string"&&dc(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),Ee=i((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(Yt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let o=t.trimmed?n.trim():n;if(t.required&&o.length===0)return `${r} is required and must not be blank`;let s=Kt(o);return s<=e?null:`${r} is ${s} characters; the server accepts at most ${e}`},"text"),cc={sex:Et(mi),spayedNeutered:uc,birthDate:tr,birthDatePrecision:Et(hi),activityLevel:Et(gi),indoorOutdoor:Et(bi),foodBrand:Ee(pi),foodType:Ee(pi),microchipId:Ee(ac)},Zr=["ref","ref",false,Ee(ic,{required:true,trimmed:true})],Jr=["notes","notes",false,Ee(sc,{trimmed:true})],fi=[Zr,["name","name",true,Ee(Qr,{required:true,trimmed:true})],["dose","dose",false,Ee(ci,{trimmed:true})],["frequency","frequency",false,Ee(ci,{trimmed:true})],["startDate","start_date",false,tr],["endDate","end_date",false,tr],Jr],pc={allergies:[Zr,["allergen","allergen",true,Ee(Qr,{required:true,trimmed:true})],["severity","severity",false,Et(vi)],Jr],medications:fi,supplements:fi,conditions:[Zr,["conditionName","condition_name",true,Ee(Qr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,tr],Jr]};function fc(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let o=r,s={};for(let[l,u,c,p]of pc[e]){let y=o[l];if(y==null){if(c)return {error:`${n}.${l} is required`};y===null&&(s[u]=null);continue}let b=p(`${n}.${l}`,y);if(b!==null)return {error:b};s[u]=y;}let a=s.start_date,d=s.end_date;return typeof a=="string"&&typeof d=="string"&&d<a?{error:`${n}.endDate must not be before startDate`}:{item:s}}i(fc,"itemToWire");function yc(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>ui)return {error:`${e} has ${t.length} items; the server accepts at most ${ui}`};let r=[],n=new Set;for(let o=0;o<t.length;o+=1){let s=fc(e,o,t[o]);if("error"in s)return s;let a=s.item.ref;if(typeof a=="string"){let d=a.trim();if(n.has(d))return {error:`${e}: ref ${JSON.stringify(d)} is used twice; a ref names one item`};n.add(d);}r.push(s.item);}return {items:r}}i(yc,"listToWire");function Ri(e,t){let r=e,n={};for(let[a,d]of Ci){let l=r[a];if(l!==void 0){if(l!==null){let u=cc[a](a,l);if(u!==null)return {error:u}}n[d]=l;}}let o=r.birthDate!==void 0,s=r.birthDatePrecision!==void 0;if(o!==s||o&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[a,d]of Ei){let l=r[a];if(l===void 0)continue;let u=yc(a,l);if("error"in u)return u;n[d]=u.items;}return Object.keys(n).length>0&&t!==void 0&&Jt(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}i(Ri,"petHealthToWire");var $=i(e=>typeof e=="string"?e:null,"str"),Ct=i((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),mc=i(e=>typeof e=="boolean"?e:null,"bool");function er(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}i(er,"itemsFromWire");function yi(e){let t=$(e.name);return t===null||t.length===0?null:Object.freeze({ref:$(e.ref),name:t,dose:$(e.dose),frequency:$(e.frequency),startDate:$(e.start_date),endDate:$(e.end_date),notes:$(e.notes)})}i(yi,"medicationFromWire");function Si(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Ct(mi,e.sex),spayedNeutered:mc(e.spayed_neutered),birthDate:$(e.birth_date),birthDatePrecision:Ct(hi,e.birth_date_precision),activityLevel:Ct(gi,e.activity_level),indoorOutdoor:Ct(bi,e.indoor_outdoor),foodBrand:$(e.food_brand),foodType:$(e.food_type),microchipId:$(e.microchip_id),allergies:er(e.allergies,r=>{let n=$(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),allergen:n,severity:Ct(vi,r.severity),notes:$(r.notes)})}),medications:er(e.medications,yi),supplements:er(e.supplements,yi),conditions:er(e.conditions,r=>{let n=$(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),conditionName:n,diagnosedDate:$(r.diagnosed_date),notes:$(r.notes)})})})}i(Si,"petHealthFromWire");var wi=100,ki=50,xi=100,_i=50,Ii=500,hc=128,gc=6e4;function Se(e){return q("validationFailed",{retryable:false,wireMessage:e})}i(Se,"invalid");function ze(e,t,r){if(typeof t!="string")return Se(`${e} must be a string`);let n=Kt(t);return n<=r?null:Se(`${e} is ${n} characters; the server accepts at most ${r}`)}i(ze,"checkString");function rr(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Se(`${e} must be a finite number between 0 and ${r}`)}i(rr,"outOfRange");function Ti(e,t){if(typeof e!="string")return Se("pet_ref must be a string");if(e.trim().length===0)return Se("pet_ref must not be blank");if(Yt(e))return Se("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return Se("profile must be an object");let r=[ze("pet_ref",e,hc)];return t?.name!==void 0&&r.push(ze("name",t.name,wi)),t?.species!==void 0&&r.push(ze("species",t.species,ki)),t?.breed!==void 0&&r.push(ze("breed",t.breed,xi)),t?.ageYears!==void 0&&r.push(rr("age_years",t.ageYears,_i)),t?.weightKg!==void 0&&r.push(rr("weight_kg",t.weightKg,Ii)),r.find(n=>n!==null)??null}i(Ti,"validate");function Ai(e,t){let r=Ri(e,t);return "error"in r?{error:Se(r.error)}:r}i(Ai,"healthToWire");function bc(e){if(typeof e!="object"||e===null)return {error:Se("patch must be an object")};let t=e,r=[["name","name",s=>ze("name",s,wi)],["species","species",s=>ze("species",s,ki)],["breed","breed",s=>ze("breed",s,xi)],["ageYears","age_years",s=>rr("age_years",s,_i)],["weightKg","weight_kg",s=>rr("weight_kg",s,Ii)]],n={};for(let[s,a,d]of r){let l=t[s];if(l!==void 0){if(l!==null){let u=d(l);if(u!==null)return {error:u}}n[a]=l;}}let o=Ai(t,t.species);return "error"in o?o:(Object.assign(n,o.body),Object.keys(n).length===0?{error:Se("patch must change at least one field")}:{body:n})}i(bc,"patchToWire");function vc(e){if(e==null)return {body:{}};let t=Ai(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}i(vc,"toWire");var Re=i(e=>typeof e=="string"?e:null,"str"),nr=i(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function Pi(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:Re(r.pet_ref)??t,name:Re(r.name),species:Re(r.species),breed:Re(r.breed),ageYears:nr(r.age_years),weightKg:nr(r.weight_kg)})}i(Pi,"fromWire");function Oi(e){if(typeof e!="object"||e===null)return null;let t=e,r=Re(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:Re(t.pet_id),petRef:r,name:Re(t.name),species:Re(t.species),breed:Re(t.breed),ageYears:nr(t.age_years),weightKg:nr(t.weight_kg),updatedAt:Re(t.updated_at)})}i(Oi,"widgetPetFromWire");function Cc(e){let t=Oi(e);return t===null?null:Object.freeze({...t,...Si(e)})}i(Cc,"widgetPetProfileFromWire");function Ec(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=Oi(r);return n===null?[]:[n]}))}i(Ec,"petListFromWire");function or(e){return Rc(Ue({auth:e}),Ue({auth:e,unaryTimeoutMs:gc}))}i(or,"createPetsRepository");function Rc(e,t=e){let r=i((o,s)=>s?{...o,signal:s}:o,"withSignal"),n=i(o=>Ti(o,void 0)??`/widget/v1/pets/${encodeURIComponent(o)}`,"petPath");return {async list(o){let s=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},o?.signal));return s.ok?de(Ec(s.value)):V(s.error)},async registerPet(o,s,a){let d=Ti(o,s);if(d!==null)return V(d);let l=vc(s);if("error"in l)return V(l.error);let c={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(o)}`,body:l.body},p=await e.send("pets.registerPet",a?.signal?{...c,signal:a.signal}:c);return p.ok?de(Pi(p.value,o)):V(p.error)},async updatePet(o,s,a){let d=n(o);if(typeof d!="string")return V(d);let l=bc(s);if("error"in l)return V(l.error);let u=await e.send("pets.updatePet",r({method:"PATCH",path:d,body:l.body},a?.signal));return u.ok?de(Pi(u.value,o)):V(u.error)},async getPetProfile(o,s){let a=n(o);if(typeof a!="string")return V(a);let d=await e.send("pets.getPetProfile",r({method:"GET",path:`${a}/profile`},s?.signal));if(!d.ok)return V(d.error);let l=Cc(d.value);return l===null?V(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):de(l)},async deletePet(o,s){let a=n(o);if(typeof a!="string")return V(a);let d=await e.send("pets.deletePet",r({method:"DELETE",path:a},s?.signal));return d.ok?de(void 0):V(d.error)},async eraseUserData(o){let s=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},o?.signal),{maxAttempts:1});return s.ok?de(void 0):V(s.error)}}}i(Rc,"createPetsRepositoryOver");var Pc="pet_not_registered";function Li(e){return e!=null&&e.reasonCode===Pc}i(Li,"isPetNotRegistered");var wc=Object.freeze({status:"idle",error:null,registered:null,retry:i(()=>{},"retry")});function Di(e,t,r){let{runtime:n,userRef:o,scopeEpoch:s}=ie(),a=react.useCallback(()=>or(n.registry.services.authFor(o)),[n,o,s]),d=react.useMemo(()=>t===void 0?null:tn(t),[t]),[l,u]=react.useState({key:null,status:"idle",error:null,registered:null}),c=react.useRef(0),p=react.useRef(r);p.current=r;let y=e===null||d===null?null:`${String(o)}|${s}|${e}|${d}`,b=react.useCallback(()=>{if(e===null||t===void 0||y===null)return;let P=++c.current;u({key:y,status:"registering",error:null,registered:null}),a().registerPet(e,t).then(E=>{P===c.current&&(E.ok?(u({key:y,status:"registered",error:null,registered:E.value}),p.current?.()):u({key:y,status:"failed",error:E.error,registered:null}));});},[a,e,y]);react.useEffect(()=>{if(y===null){c.current+=1;return}return b(),()=>{c.current+=1;}},[y,b]);let g=react.useCallback(()=>{l.status==="failed"&&b();},[l.status,b]);return react.useMemo(()=>y===null?wc:l.key!==y?{status:"registering",error:null,registered:null,retry:g}:{status:l.status,error:l.error,registered:l.registered,retry:g},[y,l,g])}i(Di,"useChatPetRegistration");function tn(e){return e===null||typeof e!="object"?JSON.stringify(e)??"undefined":Array.isArray(e)?`[${e.map(tn).join(",")}]`:`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r<n?-1:r>n?1:0).map(([r,n])=>`${JSON.stringify(r)}:${tn(n)}`).join(",")}}`}i(tn,"stableKey");var rn=Object.freeze({});function Ni(e){let[t,r]=react.useState(rn),n=react.useRef(null),o=react.useRef([]);o.current=e.map(a=>a.id),react.useEffect(()=>{if(e.length===0){n.current=null,r(l=>l===rn?l:rn);return}let a=n.current;if(a===null)return;let d=e.find(l=>l.role==="user"&&!a.known.has(l.id));d!==void 0&&(n.current=null,r(l=>({...l,[d.id]:a.images})));},[e]);let s=react.useCallback(a=>{n.current=a.length===0?null:{images:a,known:new Set(o.current)};},[]);return react.useMemo(()=>({byMessage:t,stage:s}),[t,s])}i(Ni,"useSentImages");var Oc=500;function nn(e){if(!e)return null;let t=e.replace(/[\u0000-\u001F\u007F-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g," ").replace(/\s+/g," ").trim();return t?t.slice(0,Oc):null}i(nn,"sanitizeSeedPrompt");function Ui(e,t,r){let n=nn(r),o=react.useRef(e);o.current=e;let s=react.useRef(null);react.useEffect(()=>{if(n===null||t||s.current===n)return;let a=o.current;a!==void 0&&(s.current=n,Promise.resolve(a(n)).catch(()=>{}));},[n,t]);}i(Ui,"useInitialAsk");function Fc(e,t,r){if(e==="announced")return false;let n=r.lastRefresh;return n===null||n.conversationId!==t?false:r.now-n.at<15e3}i(Fc,"isCoalesced");function zi(e,t){let r=t.activeConversationId;return r===null||r.length===0?{action:"skip",reason:"no_thread"}:t.isTurnInFlight?{action:"defer",reason:"turn_in_flight"}:t.isOffline?{action:"defer",reason:"offline"}:Fc(e,r,t)?{action:"skip",reason:"coalesced"}:{action:"refresh",conversationId:r}}i(zi,"decideChatRefresh");function on(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}i(on,"reportHostFailure");function Mc(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}i(Mc,"isThenable");function W(e,...t){if(typeof e=="function")try{let r=e(...t);return Mc(r)&&Promise.resolve(r).then(void 0,on),r}catch(r){on(r);return}}i(W,"callHost");var Bi=new WeakMap;function ji(e){if(typeof e!="function")return;let t=Bi.get(e);if(t!==void 0)return t;let r=i((...n)=>{W(e,...n);},"guarded");return Bi.set(e,r),r}i(ji,"guardHost");function nt(e,...t){let r;try{r=e(...t);}catch(n){return on(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}i(nt,"callHostAsync");function Gi(e,t){let r=react.useRef(t);r.current=t;let n=react.useRef(null),o=react.useRef(null),s=e?.isOffline===void 0?false:W(()=>e.isOffline?.()===!0)===true,a=react.useRef(()=>{});a.current=d=>{let{conversationId:l,isTurnInFlight:u,refresh:c}=r.current,p=zi(d,{activeConversationId:l,isTurnInFlight:u,isOffline:s,lastRefresh:n.current,now:Date.now()});if(p.action!=="skip"){if(p.action==="defer"){o.current!=="announced"&&(o.current=d);return}o.current=null,n.current={conversationId:p.conversationId,at:Date.now()},c!==void 0&&Promise.resolve(c()).catch(()=>{});}},react.useEffect(()=>{if(t.isTurnInFlight||s)return;let d=o.current;d!==null&&a.current(d);},[t.isTurnInFlight,s]),react.useEffect(()=>{if(e===void 0)return;let d=[],l=i((u,c)=>{if(u===void 0)return;let p=W(()=>u(()=>{a.current(c);}));typeof p=="function"&&d.push(p);},"subscribe");return l(e.onForeground?.bind(e),"foreground"),l(e.onOnline?.bind(e),"foreground"),l(e.onAnnounced?.bind(e),"announced"),()=>{for(let u of d)W(u);}},[e]);}i(Gi,"useChatLifecycle");function Dc(e){if(e===void 0)return null;let t=e.conversationId??"",r=e.petRef??"";return t===""&&r===""?null:`${String(t)}|${String(r)}`}i(Dc,"targetKey");function Yi(e,t){let r=Dc(t),n=react.useRef({openCheckin:e,target:t});n.current={openCheckin:e,target:t};let o=react.useRef(null);react.useEffect(()=>{if(r===null||o.current===r)return;o.current=r;let{openCheckin:s,target:a}=n.current;s===void 0||a===void 0||Promise.resolve(s(a)).catch(()=>{});},[r]);}i(Yi,"useCheckinTarget");function Xi(e,t,r){let[n,o]=react.useState({send:e,conversationId:t,text:r??"",seeded:r??null}),s=n.send===e&&(n.conversationId===null||n.conversationId===t);react.useEffect(()=>{o(d=>{let l=d.send===e&&(d.conversationId===null||d.conversationId===t),u=l?d.text:"",c=l?d.seeded:null,p=r!=null&&r!==c&&u.length===0;return {send:e,conversationId:t,text:p?r:u,seeded:p?r:c}});},[e,t,r]);let a=react.useCallback(d=>o(l=>({send:e,conversationId:t,text:d,seeded:l.seeded})),[e,t]);return [s?n.text:"",a]}i(Xi,"useChatDraft");function Qi(e,t,r,n){let o=react.useRef({draft:r,setDraft:n});o.current={draft:r,setDraft:n};let s=react.useRef(null),[a,d]=react.useState(null);react.useEffect(()=>{if(e===void 0)return;let l=`${t??""}`;if(s.current===l)return;s.current=l;let u=true;return (async()=>{let c=await nt(()=>e.read(t));if(!u)return;let p=c.ok&&typeof c.value=="string"?c.value:"";p.length>0&&o.current.draft.length===0&&o.current.setDraft(p),d(l);})(),()=>{u=false;}},[e,t]),react.useEffect(()=>{e===void 0||a!==`${t??""}`||W(()=>e.write(t,r));},[e,t,r,a]);}i(Qi,"usePersistedDraft");var Y=Object.freeze({heading:"Chat History",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No matching chats",noMatchBody:"Try a different title or start a new conversation.",loading:"Loading your chats\u2026",loadFailed:"Couldn\u2019t load your chats",loadingMore:"Loading more\u2026",untitled:"New conversation",newConversation:"New conversation",newChat:"New chat",search:"Search",retry:"Try again",retryA11y:"Retry loading chats",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages\u2026",openConversation:"Open conversation",unreadPrefix:"Unread. "});function sr(e){let t=e?.replace(/\s+/g," ").trim();return t||Y.untitled}i(sr,"conversationTitle");function Ji(e){return `${e.unreadCount!==null&&e.unreadCount>0?Y.unreadPrefix:""}${Y.openConversation} ${sr(e.title)}`}i(Ji,"openConversationLabel");function Zi(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').toLowerCase().trim().replace(/\s+/g," ")}i(Zi,"normalizeForSearch");function Bc(e,t){let r=Zi(t);if(r.length===0)return e;let n=[[],[],[]];for(let o of e){let s=Zi(sr(o.title)),a=s.indexOf(r);if(a<0)continue;let d=a===0?0:s.charAt(a-1)===" "?1:2;n[d]?.push(o);}return n.flat()}i(Bc,"filterConversations");function ln(e){return {scope:e,rows:[],cursor:null,loading:false,loadingMore:false,error:null}}i(ln,"fresh");function es(e){let[t,r]=react.useState(false),[n,o]=react.useState(""),s=e.listConversations,a=react.useRef(0),[d,l]=react.useState(()=>ln(s)),u=d.scope===s?d:ln(s);react.useEffect(()=>(a.current+=1,r(false),o(""),l(ln(s)),()=>{a.current+=1;}),[s]);let c=react.useCallback(async T=>{let _=++a.current,m=T!==void 0;l(O=>({...O,scope:s,loading:!m,loadingMore:m,error:null}));let R=await e.listConversations(T?{cursor:T}:void 0);if(_===a.current){if(!R.ok){l(O=>({...O,loading:false,loadingMore:false,error:R.error.displayMessage}));return}l(O=>{let F=T&&O.scope===s?O.rows:[],w=new Set(F.map(h=>h.id));return {scope:s,loading:false,loadingMore:false,error:null,rows:[...F,...R.value.conversations.filter(h=>!w.has(h.id))],cursor:R.value.nextCursor===T?null:R.value.nextCursor}});}},[e.listConversations,s]),p=i(()=>{r(true),o(""),c();},"show"),y=i(()=>{a.current+=1,r(false);},"close"),b=i(async T=>{let _=++a.current;l(R=>({...R,loading:true,error:null}));let m=await e.resumeConversation(T);_===a.current&&(l(R=>({...R,loading:false,error:m.ok?null:m.error.displayMessage})),m.ok&&r(false));},"resume"),g=i(async()=>{let T=a.current,_=await e.loadOlderMessages();T===a.current&&!_.ok&&l(m=>({...m,error:_.error.displayMessage}));},"earlier"),P=i(()=>{e.newConversation(),a.current+=1,r(false);},"newConversation"),E=i(()=>{u.cursor===null||u.loading||u.loadingMore||n.trim().length>0||c(u.cursor);},"loadMore"),S=react.useMemo(()=>Bc(u.rows,n),[u.rows,n]),A=n.trim().length>0;return {...u,open:t,show:p,close:y,load:c,resume:b,earlier:g,newConversation:P,loadMore:E,query:n,setQuery:o,searching:A,filtered:S,emptyKind:u.rows.length===0?"empty":"noMatch"}}i(es,"useHistoryPanel");var ar="#111111",lr="#FFFFFF",Gc=Object.freeze({emergency:Object.freeze({level:"emergency",label:"Vet care now",borderColor:"#FCA5A5",backgroundColor:"#FEF2F2",textColor:"#991B1B",reasonColor:ar,pillColor:lr,showsVetAction:true}),schedule_soon:Object.freeze({level:"schedule_soon",label:"Vet care suggested soon",borderColor:"#FCD34D",backgroundColor:"#FFFBEB",textColor:"#92400E",reasonColor:ar,pillColor:lr,showsVetAction:true}),home_care:Object.freeze({level:"home_care",label:"Monitor at home",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:ar,pillColor:lr,showsVetAction:false}),general:Object.freeze({level:"general",label:"Good to know",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:ar,pillColor:lr,showsVetAction:false})});function qc(e){return `${e.messageId}:${e.level}:${e.reason??""}`}i(qc,"urgencySignature");function Yc(e){return j(f.urgencyGeneralReason,{petName:e?.trim()||f.emptyTitlePetFallback})}i(Yc,"generalUrgencyReason");function ns(e,t){for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(n?.role!=="assistant"||n.responseId===void 0)continue;let o=n.urgencyLevel;return o?{messageId:n.id,level:o,reason:Kc(n.urgencyReason)}:n.urgencyProvided===true?{messageId:n.id,level:"general",reason:Yc(t)}:null}return null}i(ns,"latestUrgencySource");function Kc(e){return typeof e=="string"&&e.trim().length>0?e:null}i(Kc,"shownReason");function os(e){let t=e===null?null:qc(e),[r,n]=react.useState(null),[o,s]=react.useState(false);react.useEffect(()=>s(false),[t]);let d=e!==null&&(o||!(r!==null&&r===t)),l=e===null?null:Gc[e.level],u=e!==null&&!d&&e.level!=="general",c=react.useCallback(()=>{t!==null&&n(t),s(false);},[t]),p=react.useCallback(()=>s(true),[]);return react.useMemo(()=>({source:e,tier:l,signature:t,showBanner:d,showCompactIcon:u,showVetAction:d&&l!==null&&l.showsVetAction,dismissLabel:l===null?null:j(f.dismissBanner,{label:l.label}),dismiss:c,expand:p}),[e,l,t,d,u,c,p])}i(os,"useUrgencySurface");function is(e){return e.isBootstrapping?"loading":e.status==="error"&&e.error&&e.messages.length===0?"error":e.messages.length===0?"empty":"populated"}i(is,"selectView");function $c(e){return e.code==="accessDenied"||e.code==="conversationNotFound"}i($c,"needsNewConversation");function ss(e){if(e.messages.length===0)return null;let t=e.status==="error"?e.error:null;if(t!==null){let r=$c(t);return {tone:"error",title:r?f.turnUnreachableTitle:f.turnFailedTitle,body:t.displayMessage,actionLabel:r?f.turnStartNewChat:f.turnRetry,action:r?"startNew":"retry"}}return e.stopped===true?{tone:"neutral",title:f.turnStoppedTitle,body:f.turnStoppedBody,actionLabel:f.turnRetry,action:"retry"}:null}i(ss,"turnNotice");function as(e,t){let r=e[e.length-1];return t&&(r===void 0||r.role==="user")}i(as,"awaitingAssistant");var Xc=3,Qc=Object.freeze([]);function ls(e){let t=e.messages[e.messages.length-1];if(e.isStreaming||e.status==="error"||t===void 0||t.role!=="assistant")return Qc;let r=new Set,n=[];for(let o of e.suggestedPrompts){let s=o.trim(),a=s.replace(/\s+/g," ").toLowerCase();if(!(a.length===0||r.has(a))&&(r.add(a),n.push(s),n.length===Xc))break}return Object.freeze(n)}i(ls,"visibleFollowUps");function ds(e){return e.sender?.displayName??f.senderVet}i(ds,"vetSenderLabel");function us(e,t){let r={};return e!==void 0&&(r.petRef=e),t!==void 0&&(r.conversationId=t),r}i(us,"buildChatOpts");var Zc=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function C(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Zc[t]]}}i(C,"face");var un=class un extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(un,"HostRenderBoundary");var dn=un;function ep({render:e}){return e()}i(ep,"RenderHost");function Be({render:e,fallback:t,resetKey:r}){return react.createElement(dn,{fallback:t,resetKey:r,children:react.createElement(ep,{render:e})})}i(Be,"HostRender");var tp=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function rp(e){return tp[e]}i(rp,"requires");function ps(e,t,r){let n=rp(e),o=new Map;for(let d of t)o.set(d.resource,d);if(r?.isPending===true&&n.some(d=>!o.has(d)))return cn({name:e,enabled:false,isPending:true,limits:{}});let s=np(n,o);return n.filter(d=>o.get(d)?.granted!==true).length===0?cn({name:e,enabled:true,isPending:false,limits:s}):cn({name:e,enabled:false,isPending:false,limits:s,disabled:op(n,o)})}i(ps,"decideCapability");function np(e,t){let r={};for(let n of e){let o=t.get(n)?.limits;if(o)for(let[s,a]of Object.entries(o)){let d=r[s];r[s]=d===void 0?a:Math.min(d,a);}}return r}i(np,"mergeLimits");function op(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:Hr("accessDenied"),level:"user_entitlement",recoverable:false})}i(op,"disabledFor");function cn(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}i(cn,"freezeDecision");function Rt(e){let{runtime:t}=ie(),r=t.entitlements,n=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>ps(e,n.decisions,{isPending:n.isPending}),[e,n])}i(Rt,"useCapability");var ap=48;function lp(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(lp,"selectView");function hs(e){let{capability:t,children:r,renderDisabled:n,renderPending:o,style:s}=e,a=Rt(t),d=react.useMemo(()=>lp(a),[a]);switch(d){case "enabled":return r;case "pending":return o?jsxRuntime.jsx(Be,{render:o,fallback:jsxRuntime.jsx(ys,{capability:t,style:s})}):jsxRuntime.jsx(ys,{capability:t,style:s});case "disabled":return n?jsxRuntime.jsx(Be,{render:()=>n(a),fallback:jsxRuntime.jsx(ms,{decision:a,style:s}),resetKey:a}):jsxRuntime.jsx(ms,{decision:a,style:s});default:return qt(d)}}i(hs,"CapabilityGate");function ys({capability:e,style:t}){let r=I(),n=react.useMemo(()=>gs(r),[r]);return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:n.skeletonBar})})}i(ys,"PendingSkeleton");function ms({decision:e,style:t}){let r=I(),n=react.useMemo(()=>gs(r),[r]),o=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?jsxRuntime.jsx(v,{style:n.offstateText,children:o}):null})}i(ms,"OffState");function gs(e){let{color:t,space:r,radius:n,type:o}=e;return reactNative.StyleSheet.create({offstate:{minHeight:ap,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...C(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}i(gs,"makeStyles");var St=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function Cs(e){let t=I(),r=react.useMemo(()=>cp(t),[t]);return jsxRuntime.jsxs(reactNative.View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${St.title}. ${St.body}`,children:[jsxRuntime.jsx(v,{style:r.title,children:St.title}),jsxRuntime.jsx(v,{style:r.body,children:St.body})]})}i(Cs,"ClinicalDisclaimer");function cp(e){let{color:t,space:r,type:n}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...C(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...C(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}i(cp,"makeStyles");var ee={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function X(e){return {width:e,height:e,alignItems:"center",justifyContent:"center"}}i(X,"box");function ne(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}i(ne,"stroke");function Es({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o={width:e*.82,height:n,borderRadius:n,backgroundColor:t};return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{gap:e*.22}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:o}),jsxRuntime.jsx(reactNative.View,{style:o}),jsxRuntime.jsx(reactNative.View,{style:o})]})}i(Es,"MenuGlyph");function Rs({size:e,color:t,strokeWidth:r,rotate:n}){let o=ne(e,r),s=e*.78;return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{transform:[{rotate:n}]}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:s,height:o,borderRadius:o,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:o,height:s,borderRadius:o,backgroundColor:t}})]})}i(Rs,"Cross");function Ss(e){return jsxRuntime.jsx(Rs,{...e,rotate:"0deg"})}i(Ss,"PlusGlyph");function je(e){return jsxRuntime.jsx(Rs,{...e,rotate:"45deg"})}i(je,"CloseGlyph");function Le({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsx(reactNative.View,{style:X(e),...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.36,height:e*.66,marginTop:-e*.14,borderBottomWidth:n,borderRightWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})})}i(Le,"CheckGlyph");var yp={down:{rotate:"45deg",marginTop:-0.4,marginLeft:0},up:{rotate:"225deg",marginTop:.4,marginLeft:0},right:{rotate:"-45deg",marginTop:0,marginLeft:-0.4}};function dr({size:e,color:t,strokeWidth:r,direction:n}){let o=ne(e,r),s=e*.46,a=yp[n];return jsxRuntime.jsx(reactNative.View,{style:X(e),...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:s,height:s,borderRightWidth:o,borderBottomWidth:o,borderColor:t,marginTop:s*a.marginTop,marginLeft:s*a.marginLeft,transform:[{rotate:a.rotate}]}})})}i(dr,"ChevronGlyph");function Ts({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o={width:e*.42,height:e*.7,borderWidth:n,borderColor:t,borderRadius:n};return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{flexDirection:"row",gap:1}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:[o,{borderTopLeftRadius:e*.2}]}),jsxRuntime.jsx(reactNative.View,{style:[o,{borderTopRightRadius:e*.2}]})]})}i(Ts,"BookGlyph");function Ps({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.5;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:e*.78,height:n,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.16,right:e*.16,width:o,height:o,borderTopWidth:n,borderRightWidth:n,borderColor:t}})]})}i(Ps,"ArrowUpRightGlyph");function ws({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.6,s={position:"absolute",width:o,height:o,borderWidth:n,borderColor:t,borderRadius:e*.14};return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:[s,{top:0,left:0}]}),jsxRuntime.jsx(reactNative.View,{style:[s,{bottom:0,right:0}]})]})}i(ws,"CopyGlyph");function ur({size:e,color:t,strokeWidth:r,active:n,rotate:o}){let s=ne(e,r),a=n?t:"transparent";return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{transform:[{rotate:o}]}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.08,left:e*.12,width:e*.62,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.12,borderTopLeftRadius:e*.04}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.04,left:e*.4,width:e*.3,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.15,transform:[{rotate:"-20deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.08,left:0,width:e*.2,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.05}})]})}i(ur,"ThumbGlyph");function ks({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{borderRadius:e/2,borderWidth:n,borderColor:t}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{width:n,height:n,borderRadius:n,backgroundColor:t,marginBottom:e*.1}}),jsxRuntime.jsx(reactNative.View,{style:{width:n,height:e*.34,borderRadius:n,backgroundColor:t}})]})}i(ks,"InfoGlyph");function xs({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.34;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.06,width:o,height:o,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.1,width:n,height:e*.56,borderRadius:n,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:0,width:e*.84,height:e*.3,borderBottomWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderBottomLeftRadius:n,borderBottomRightRadius:n}})]})}i(xs,"UploadGlyph");function _s({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{borderWidth:n,borderColor:t,borderRadius:e*.14,overflow:"hidden"}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.16,left:e*.18,width:e*.16,height:e*.16,borderRadius:e,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:-e*.3,right:-e*.1,width:e*.7,height:e*.7,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(_s,"PhotoGlyph");function Is({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.08,width:e*.34,height:e*.2,borderTopWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderTopLeftRadius:n,borderTopRightRadius:n}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.22,width:e*.92,height:e*.66,borderWidth:n,borderColor:t,borderRadius:e*.16,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.3,height:e*.3,borderRadius:e,borderWidth:n,borderColor:t}})})]})}i(Is,"CameraGlyph");function As({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.66;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:0,left:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.02,right:e*.02,width:n,height:e*.4,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}})]})}i(As,"SearchGlyph");function Os({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:e*.3,height:e*.82,borderWidth:n,borderColor:t,borderRadius:n,transform:[{rotate:"45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:0,left:0,width:e*.4,height:n,borderRadius:n,backgroundColor:t}})]})}i(Os,"EditGlyph");function Fs({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.62;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.View,{style:{width:n*1.4,height:n*1.4,borderRadius:n,backgroundColor:t}})}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.04,width:o*.5,height:o*.5,borderRightWidth:n,borderBottomWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(Fs,"MapPinGlyph");function Ms({size:e,color:t,testID:r}){let n=e*.36;return jsxRuntime.jsx(reactNative.View,{style:X(e),testID:r,...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:0,height:0,marginLeft:e*.12,borderLeftWidth:e*.78,borderTopWidth:n,borderBottomWidth:n,borderLeftColor:t,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"-45deg"}]}})})}i(Ms,"SendGlyph");function Ls({size:e,color:t,testID:r}){return jsxRuntime.jsx(reactNative.View,{style:X(e),testID:r,...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.5,height:e*.5,backgroundColor:t}})})}i(Ls,"StopGlyph");function cr({size:e,strokeWidth:t,color:r,children:n}){return jsxRuntime.jsx(reactNative.View,{style:[X(e),{borderRadius:e/2,borderWidth:t??reactNative.StyleSheet.hairlineWidth,borderColor:r}],children:n})}i(cr,"Ring");var Tt=Object.freeze({standard:He.standard,emphasized:He.emphasized,exit:He.exit,outQuad:Object.freeze([.25,.46,.45,.94])});var Ds=Object.freeze({layoutMs:220,messageInMs:200,bannerInMs:220,bannerOutMs:160,iconInMs:180,iconOutMs:120,followUpInMs:180,followUpStaggerMs:70,citationsInMs:220,citationsRisePx:6,drawerMs:220,pressScale:.97,pressMs:140,revealTickMs:24,revealDivisor:12,dotsCycleMs:520,dotsMinOpacity:.44,dotsLiftPx:3.5,dotsStagger:Object.freeze([0,.18,.36]),copiedMs:1500,uploadFlashMs:600,reduced:false}),mp=Object.freeze({...Ds,layoutMs:0,messageInMs:0,bannerInMs:0,bannerOutMs:0,iconInMs:0,iconOutMs:0,followUpInMs:0,followUpStaggerMs:0,citationsInMs:0,citationsRisePx:0,drawerMs:0,pressScale:1,pressMs:0,revealTickMs:0,dotsCycleMs:0,dotsMinOpacity:1,dotsLiftPx:0,reduced:true});function Vs(e){return e.motion.reducedMotion?mp:Ds}i(Vs,"chatMotion");function pr(e,t){return Math.max(0,t)*e.followUpStaggerMs}i(pr,"followUpDelayMs");function Ns(e,t,r){if(e.reduced||t>=r)return r;let n=Math.max(1,Math.ceil((r-t)/e.revealDivisor));return Math.min(r,t+n)}i(Ns,"nextRevealLength");function G(){let e=I();return Vs(e)}i(G,"useChatMotion");var Ep=8;function Us(e,t,r){return ((1-3*r+3*t)*e+(3*r-6*t))*e*e+3*t*e}i(Us,"bezierComponent");function Rp(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}i(Rp,"bezierSlope");function fr(e){let[t,r,n,o]=e;return s=>{if(s<=0)return 0;if(s>=1)return 1;let a=s;for(let d=0;d<Ep;d+=1){let l=Rp(a,t,n);if(l===0)break;a-=(Us(a,t,n)-s)/l;}return Us(Math.min(1,Math.max(0,a)),r,o)}}i(fr,"bezierEasing");var yn=fr(Tt.standard),Sp=fr(Tt.outQuad);function bn(e){let t=react.useRef(null);return t.current===null&&(t.current=new reactNative.Animated.Value(e)),t.current}i(bn,"useAnimatedValue");function We(e,t={}){let r=t.risePx??0,n=t.delayMs??0,o=bn(e>0?0:1);return react.useEffect(()=>{if(e<=0)return;let s=reactNative.Animated.timing(o,{toValue:1,duration:e,easing:Sp,useNativeDriver:true}),a=n>0?reactNative.Animated.sequence([reactNative.Animated.delay(n),s]):s;return a.start(),()=>a.stop()},[o,e,n]),react.useMemo(()=>({opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[r,0]})}]}),[o,r])}i(We,"useFadeIn");function vn({visible:e,inMs:t,outMs:r,style:n,children:o}){let[s,a]=react.useState(e),d=bn(e&&t<=0?1:0);return react.useEffect(()=>{if(e){a(true);let u=reactNative.Animated.timing(d,{toValue:1,duration:Math.max(0,t),easing:yn,useNativeDriver:true});return u.start(),()=>u.stop()}if(!s)return;if(r<=0){a(false);return}let l=reactNative.Animated.timing(d,{toValue:0,duration:r,easing:yn,useNativeDriver:true});return l.start(({finished:u})=>{u&&a(false);}),()=>l.stop()},[e,s,t,r,d]),!s&&!e?null:jsxRuntime.jsx(reactNative.Animated.View,{style:[n,{opacity:d}],children:o})}i(vn,"FadePresence");var Tp=12;function N({style:e,containerStyle:t,children:r,onPressIn:n,onPressOut:o,hitSlop:s,...a}){let d=G(),l=bn(1),u=react.useCallback(c=>{d.pressMs<=0||d.pressScale===1||reactNative.Animated.timing(l,{toValue:c,duration:d.pressMs,easing:yn,useNativeDriver:true}).start();},[l,d.pressMs,d.pressScale]);return jsxRuntime.jsx(reactNative.Pressable,{...a,hitSlop:s??Tp,style:t,onPressIn:c=>{u(d.pressScale),n?.(c);},onPressOut:c=>{u(1),o?.(c);},children:jsxRuntime.jsx(reactNative.Animated.View,{style:[e,{transform:[{scale:l}]}],children:r})})}i(N,"PressScale");function js(e,t,r){let n=t&&r.revealTickMs>0,[o,s]=react.useState(0),a=react.useRef(e);return a.current=e,react.useEffect(()=>{if(!n)return;let d=setInterval(()=>{s(l=>Ns(r,l,a.current.length));},r.revealTickMs);return ()=>clearInterval(d)},[n,r]),n?e.slice(0,Math.min(o,e.length)):e}i(js,"useRevealedText");var zs=false;function Pp(e){e.layoutMs<=0||(zs||(zs=true,reactNative.Platform.OS==="android"&&typeof reactNative.UIManager.setLayoutAnimationEnabledExperimental=="function"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true)),reactNative.LayoutAnimation.configureNext({duration:e.layoutMs,create:{type:"easeInEaseOut",property:"opacity"},update:{type:"easeInEaseOut"},delete:{type:"easeInEaseOut",property:"opacity"}}));}i(Pp,"animateLayout");function Pt(e,t){let r=react.useRef(e);r.current!==e&&(r.current=e,Pp(t));}i(Pt,"useAnimateLayoutOn");var Cn=36,Op=22,Fp=12,Mp=12,Lp=16,Dp="#000",Vp="rgba(0,0,0,0.45)";function Ws({uri:e,label:t,onClose:r}){let n=I(),o=reactNativeSafeAreaContext.useSafeAreaInsets();return e===null?null:jsxRuntime.jsxs(reactNative.Modal,{visible:true,animationType:n.motion.reducedMotion?"none":"fade",transparent:false,statusBarTranslucent:true,onRequestClose:r,children:[jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:f.closePreview,style:yr.backdrop,onPress:r,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:yr.image,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,accessibilityIgnoresInvertColors:true})}),jsxRuntime.jsx(reactNative.View,{pointerEvents:"box-none",style:[yr.closeWrap,{top:o.top+Mp}],children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.closePreview,hitSlop:Fp,style:yr.closeButton,onPress:r,children:jsxRuntime.jsx(je,{size:Op,color:n.color.surface,strokeWidth:2})})})]})}i(Ws,"AttachmentImageLightbox");var yr=reactNative.StyleSheet.create({backdrop:{flex:1,backgroundColor:Dp,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"},closeWrap:{position:"absolute",right:Lp},closeButton:{width:Cn,height:Cn,borderRadius:Cn/2,backgroundColor:Vp,alignItems:"center",justifyContent:"center"}});var mr=12,Bp=80,En=44,Gs=22,jp=.14,Wp=18,Gp=8,qs=Object.freeze({photo:f.attachmentPhoto,camera:f.attachmentCamera});function Ys({sources:e,full:t,onPick:r,onClose:n}){let o=I(),s=react.useMemo(()=>qp(o),[o]);return jsxRuntime.jsxs(reactNative.View,{style:s.anchor,pointerEvents:"box-none",children:[jsxRuntime.jsx(reactNative.Pressable,{style:s.dismissLayer,accessibilityRole:"button",accessibilityLabel:f.closeAttachmentPicker,onPress:n}),jsxRuntime.jsxs(reactNative.View,{style:s.bubble,children:[jsxRuntime.jsx(reactNative.View,{style:s.tilesRow,children:e.map(a=>jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:qs[a],accessibilityState:{disabled:t},disabled:t,containerStyle:s.tile,style:s.tileInner,onPress:()=>r(a),children:[jsxRuntime.jsx(reactNative.View,{style:s.tileIconWrap,children:a==="photo"?jsxRuntime.jsx(_s,{size:Gs,color:o.color.brandInk,strokeWidth:1.5}):jsxRuntime.jsx(Is,{size:Gs,color:o.color.brandInk,strokeWidth:1.5})}),jsxRuntime.jsx(v,{tier:"control",style:s.tileLabel,children:qs[a]})]},a))}),jsxRuntime.jsx(reactNative.View,{style:s.tail}),jsxRuntime.jsx(reactNative.View,{style:s.tailFill})]})]})}i(Ys,"AttachmentPickerPopover");function qp(e){let t=e.color,r=e.radius;return reactNative.StyleSheet.create({anchor:{position:"absolute",left:0,right:0,bottom:"100%",paddingHorizontal:8,paddingBottom:10,alignItems:"flex-start"},dismissLayer:{position:"absolute",left:-1e3,right:-1e3,top:-2e3,bottom:0},bubble:{backgroundColor:t.surfaceCream,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:6,paddingVertical:8,shadowColor:t.shadow,shadowOpacity:jp,shadowRadius:Wp,shadowOffset:{width:0,height:Gp},elevation:8},tilesRow:{flexDirection:"row",alignItems:"stretch"},tile:{minWidth:Bp,borderRadius:r.md},tileInner:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:10,paddingVertical:8,gap:6},tileIconWrap:{width:En,height:En,borderRadius:En/2,backgroundColor:t.brandSoft,alignItems:"center",justifyContent:"center"},tileLabel:{...C(e,"medium"),fontSize:12,lineHeight:14,color:t.text.primary},tail:{position:"absolute",left:24,bottom:-mr/2,width:mr,height:mr,backgroundColor:t.surfaceCream,borderRightWidth:1,borderBottomWidth:1,borderColor:t.brandBorderStrong,transform:[{rotate:"45deg"}]},tailFill:{position:"absolute",left:22,bottom:0,width:mr+4,height:2,backgroundColor:t.surfaceCream}})}i(qp,"makeStyles");function Yp(e){if(typeof e=="number")return Ks(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return Sn(t.slice(1));if(t.toLowerCase().startsWith("0x"))return Sn(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return Kp(t);if(/^[0-9a-fA-F]+$/.test(t)){let r=Sn(t);if(r!==null)return r}return /^\d+$/.test(t)?Ks(Number.parseInt(t,10)):null}i(Yp,"toRgba");function Sn(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return {r:Tn(t[0]),g:Tn(t[1]),b:Tn(t[2]),a:1};if(t.length===6)return {r:Ge(t,0),g:Ge(t,2),b:Ge(t,4),a:1};if(t.length===8){let r=Ge(t,0);return {r:Ge(t,2),g:Ge(t,4),b:Ge(t,6),a:r/255}}return null}i(Sn,"fromHex");function Kp(e){let t=e.indexOf("("),r=e.indexOf(")");if(t<0||r<0||r<t)return null;let n=e.slice(t+1,r).split(",").map(l=>l.trim());if(n.length<3)return null;let o=Pn(Number(n[0])),s=Pn(Number(n[1])),a=Pn(Number(n[2]));if(o===null||s===null||a===null)return null;let d=1;if(n.length>=4){let l=Number(n[3]);if(!Number.isFinite(l))return null;d=Math.min(1,Math.max(0,l));}return {r:o,g:s,b:a,a:d}}i(Kp,"fromRgbFunc");function Ks(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,r=t>>>24&255;return {r:t>>>16&255,g:t>>>8&255,b:t&255,a:r===0?1:r/255}}i(Ks,"argbIntToRgba");function Ge(e,t){return Number.parseInt(e.slice(t,t+2),16)}i(Ge,"byte");function Tn(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}i(Tn,"dup");function Pn(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}i(Pn,"clampByte");function $s(e,t){let r=Yp(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return `rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}i($s,"withAlpha");var me=Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});var Qs=56,Zs=12,Qp=14,Zp=10,Jp=.45,ef="rgba(7,193,104,0.55)",tf="rgba(185,28,28,0.55)",rf=200,nf=300,sa=20,wn=22,of=12,sf="rgba(0,0,0,0.78)",Js=220,ea=100,ta="rgba(255,255,255,0.15)";function aa({attachments:e,rejected:t,uploadFailed:r=false,onRetry:n,onRemove:o,onPreview:s}){let a=I(),d=react.useMemo(()=>da(a),[a]);return e.length===0&&t===null?null:jsxRuntime.jsxs(reactNative.View,{style:d.strip,children:[e.length>0?jsxRuntime.jsx(reactNative.View,{style:d.cards,children:e.map(l=>jsxRuntime.jsx(af,{row:l,styles:d,onRetry:n,onRemove:o,onPreview:s},l.id))}):null,r?jsxRuntime.jsx(v,{style:d.rejected,accessibilityRole:"alert",children:f.attachmentsFailedBlocked}):null,t!==null?jsxRuntime.jsx(v,{style:d.rejected,accessibilityRole:"alert",children:ai(t)}):null]})}i(aa,"AttachmentStrip");function af({row:e,styles:t,onRetry:r,onRemove:n,onPreview:o}){let s=I(),a=e.status==="uploading",d=e.status==="failed",l=e.status==="uploaded",u=react.useRef(e.status),[c,p]=react.useState(false);return react.useEffect(()=>{let y=u.current;u.current=e.status,e.status==="uploaded"&&y==="uploading"&&p(true);},[e.status]),jsxRuntime.jsxs(reactNative.View,{style:t.card,children:[jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:l?"button":"image",accessibilityLabel:l?j(f.previewAttachment,{filename:e.filename}):e.filename,accessibilityState:{busy:a,disabled:!l},disabled:!l,style:t.thumbHit,onPress:()=>o(e),children:jsxRuntime.jsxs(reactNative.View,{style:t.thumb,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:e.previewUri},style:t.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),a?jsxRuntime.jsx(reactNative.View,{style:t.uploadingOverlay,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:s.color.surface})}):null,c?jsxRuntime.jsx(lf,{styles:t,onDone:()=>p(false)}):null]})}),d?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:j(f.retryUpload,{filename:e.filename}),style:t.failedOverlay,onPress:()=>r(e.id),children:jsxRuntime.jsx(reactNative.View,{style:t.failedInner,children:jsxRuntime.jsx(je,{size:sa,color:s.color.surface,strokeWidth:2})})}):null,jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:j(f.removeAttachment,{filename:e.filename}),hitSlop:6,containerStyle:t.removeSlot,style:t.removeButton,onPress:()=>n(e.id),children:jsxRuntime.jsx(je,{size:of,color:s.color.surface,strokeWidth:1.5})})]})}i(af,"PreviewCard");function lf({styles:e,onDone:t}){let r=I(),n=G(),o=react.useRef(null);o.current===null&&(o.current=new reactNative.Animated.Value(0));let s=o.current;return react.useEffect(()=>{let a=reactNative.Animated.sequence([reactNative.Animated.timing(s,{toValue:1,duration:rf,useNativeDriver:true}),reactNative.Animated.delay(n.uploadFlashMs),reactNative.Animated.timing(s,{toValue:0,duration:nf,useNativeDriver:true})]);return a.start(({finished:d})=>{d&&t();}),()=>a.stop()},[s,n.uploadFlashMs,t]),jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[e.successOverlay,{opacity:s}],children:jsxRuntime.jsx(Le,{size:sa,color:r.color.surface,strokeWidth:2})})}i(lf,"SuccessFlash");function la({images:e,onPreview:t}){let r=I(),n=react.useMemo(()=>da(r),[r]);if(e.length===0)return null;let o=e.length===1;return jsxRuntime.jsx(reactNative.View,{style:o?n.sentSingle:n.sentGrid,children:e.map((s,a)=>jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:j(f.attachedImage,{filename:s.filename}),onPress:()=>t(s),children:jsxRuntime.jsx(reactNative.Image,{source:{uri:s.uri},style:o?n.singleImage:n.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${s.uri}-${a}`))})}i(la,"SentImages");function da(e){let t=e.color,r=e.type;return reactNative.StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:Qs,height:Qs,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:Zs,overflow:"hidden",backgroundColor:t.composerFill,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...me,alignItems:"center",justifyContent:"center",backgroundColor:$s(e.color.brandInk,Jp)??e.color.brandSofter},successOverlay:{...me,alignItems:"center",justifyContent:"center",backgroundColor:ef},failedOverlay:{...me,borderRadius:Zs,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:tf},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:wn,height:wn,borderRadius:wn/2,backgroundColor:sf,borderWidth:1.5,borderColor:t.surface,alignItems:"center",justifyContent:"center"},rejected:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:Js,height:Js,borderRadius:Qp,backgroundColor:ta},gridImage:{width:ea,height:ea,borderRadius:Zp,backgroundColor:ta}})}i(da,"makeStyles");var df="file",_n="multipart upload failed";function ua(e){let t;try{t=new FormData;for(let[r,n]of Object.entries(e.fields))t.append(r,n);t.append(df,e.file);}catch{return Promise.reject(new Error(_n))}return e.fetch!==void 0?pf(e.fetch,e.url,t,e.signal):cf(e.url,t,e.signal)}i(ua,"postRnMultipart");function uf(e){return e>=200&&e<300}i(uf,"stored");function cf(e,t,r){return new Promise((n,o)=>{let s=globalThis.XMLHttpRequest;if(typeof s!="function"||r?.aborted===true){o(new Error(_n));return}let a=null,d=i(()=>{a!==null&&r?.removeEventListener("abort",a);},"release"),l=i(()=>{d(),o(new Error(_n));},"fail");try{let u=new s;u.open("POST",e),u.withCredentials=!1,u.onload=()=>{d(),n(uf(u.status));},u.onerror=l,u.ontimeout=l,u.onabort=l,r!==void 0&&(a=i(()=>{try{u.abort();}finally{l();}},"onAbort"),r.addEventListener("abort",a,{once:!0})),u.send(t);}catch{l();}})}i(cf,"postWithXhr");function pf(e,t,r,n){return Promise.resolve().then(()=>e(t,{method:"POST",body:r,credentials:"omit",...n?{signal:n}:{}})).then(o=>o.ok)}i(pf,"postWithFetch");var ff="chat attachment upload: the file handle has no uri",yf="chat attachment upload failed";function mf(e){return {uri:e.uri,name:Kr(e.name),type:e.mimeType}}i(mf,"filePartOf");function In(e={}){return Object.freeze({postMultipart(t,r,n){if(typeof r.uri!="string"||r.uri.length===0)return Promise.reject(new Error(ff));let{signal:o,onProgress:s}=n,a=i(()=>Promise.reject(new Error(yf)),"failed");return o?.aborted===true?a():ua({url:t.upload_url,fields:t.upload_fields,file:mf(r),signal:o,fetch:e.fetch}).then(d=>{if(!d)return a();s?.(1);},a)}})}i(In,"createRnChatAttachmentTransport");function On(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=ie(),o=react.useMemo(()=>or(e.registry.services.authFor(t)),[e,t,n]),[s,a]=react.useState({repository:o,pets:[],loading:true,error:null}),d=s.repository===o?s:{pets:[],loading:true,error:null},l=react.useRef(0),u=react.useCallback(async()=>{let p=++l.current;a(b=>({...b,repository:o,loading:true,error:null,pets:b.repository===o?b.pets:[]}));let y=await o.list();p===l.current&&a(y.ok?{repository:o,pets:y.value,loading:false,error:null}:b=>({repository:o,pets:b.repository===o?b.pets:[],loading:false,error:y.error}));},[o]);react.useEffect(()=>(u(),()=>{l.current+=1;}),[u]);let c=react.useMemo(()=>r===null?null:d.pets.find(p=>p.petRef===r)??null,[r,d.pets]);return react.useMemo(()=>({pets:d.pets,activePet:c,loading:d.loading,error:d.error,refresh:u}),[d.pets,d.loading,d.error,c,u])}i(On,"useEverfurPets");function ca(e,t){if(t!==null){let r=e.find(n=>n.petRef===t);if(r!==void 0)return r}return e[0]??null}i(ca,"headerPetOf");function re(e,t){if(e===void 0)return {};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}i(re,"slotBox");function Fn(e){return e===void 0||e.backgroundColor!==void 0?e:e.borderRadius===void 0?void 0:{borderRadius:e.borderRadius}}i(Fn,"ownGroundSlot");function ce(e){return e?.textColor===void 0?{}:{color:e.textColor}}i(ce,"slotText");var pa=Object.freeze({visitButton:"Talk to a vet"});var fa=Symbol.for("@everfur/sdk/televet");function xe(){let e=globalThis,t=e[fa];if(t!==void 0)return t;let r={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[fa]=r,r}i(xe,"televetGlobal");function hr(e){let t=xe();t.snapshot=Object.freeze({...t.snapshot,...e});for(let r of [...t.listeners])try{r();}catch{}}i(hr,"publish");function ya(e){let t=xe().presenter;if(t===null)return "absent";try{return t(e)===!1?"declined":"presented"}catch(r){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",r),"threw"}}i(ya,"callTelevetPresenter");function ma(e){let t=xe();return t.listeners.add(e),()=>{t.listeners.delete(e);}}i(ma,"subscribeTelevetExperience");function Mn(){return xe().snapshot}i(Mn,"televetExperienceSnapshot");function Cf(){return xe().hosts.length>0}i(Cf,"hasTelevetHost");function ha(e){if(!Cf())return false;let t=Object.freeze({...e});return hr({request:t,serial:xe().snapshot.serial+1}),true}i(ha,"presentTelevetExperience");function Ln(){xe().snapshot.request!==null&&hr({request:null});}i(Ln,"dismissTelevetExperience");function ga(){let e=xe(),t=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,t],hr({activeHost:e.hosts[0]??null}),t}i(ga,"claimTelevetHost");function ba(e){let t=xe();t.hosts=t.hosts.filter(n=>n!==e);let r=t.hosts[0]??null;hr(r===null?{activeHost:r,request:null}:{activeHost:r});}i(ba,"releaseTelevetHost");var va=false;function gr(e,t){return t!==void 0?(W(t,e),"onStartInApp"):ya(e)==="presented"?"presenter":ha(e)?"experience":(va||(va=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}i(gr,"openVetVisitInApp");function Ra(e){let t=null;return ()=>{if(t!==null)return t;let r=e();return t=r,r.then(void 0,()=>{t===r&&(t=null);}),r}}i(Ra,"memoizeTelevetLoader");function Sa(e){let[t,r]=react.useState(null);react.useEffect(()=>{let u=ga();return r(u),()=>{ba(u);}},[]);let n=react.useSyncExternalStore(ma,Mn,Mn),s=t!==null&&n.activeHost===t?n.request:null,[a,d]=react.useState(null),l=s!==null&&a===null;return react.useEffect(()=>{if(!l)return;let u=true;return e().then(c=>{u&&d(()=>c);},c=>{u&&(console.warn("[everfur] The in-app vet visit could not load its screens.",c),Ln());}),()=>{u=false;}},[l,e]),s===null||a===null?null:{module:a,request:s,serial:n.serial,dismiss:Ln}}i(Sa,"useTelevetExperienceHost");var Rf=Ra(()=>import('@everfur/sdk/televet/booking'));function kt(){let e=Sa(Rf);if(e===null)return null;let{EverfurTelevetModal:t}=e.module;return jsxRuntime.jsx(t,{request:e.request,onClose:e.dismiss},e.serial)}i(kt,"EverfurTelevetHost");var Dn=Object.freeze(["visit","join","summary","messages"]);function Vn(e){return typeof e=="string"&&Dn.includes(e)}i(Vn,"isVetVisitIntent");var Tf="/widget/v1/televet/handoffs",Pf="/widget/v1/televet/availability",wf="/widget/v1/televet/chat-entry",kf=/^[a-z0-9][a-z0-9_-]{0,39}$/,xf=/^[A-Za-z0-9_-]{22}$/;var Ta=32,Pa=128,wa=64;function Hn(e){let t=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}i(Hn,"vetVisitErrorReasonOf");function ka(e){return V(q("validationFailed",{retryable:false,wireMessage:e}))}i(ka,"invalid");function Nn(e){return V(q("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}i(Nn,"unusable");function _f(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!kf.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let o=t?.entry;if(o!=null){if(o!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=o;}let s=t?.visitRef,a=t?.intent,d=s!=null;if(d){let l=typeof s=="string"?s.trim():"";if(l.length<1||[...l].length>wa)return {ok:false,message:`visitRef must be 1..${wa} characters`};r.visit_ref=l;}if(a!=null){if(!d)return {ok:false,message:"intent needs the visitRef it opens"};if(!Vn(a))return {ok:false,message:`intent must be one of ${Dn.join(", ")}`};r.intent=a;}return {ok:true,body:r}}i(_f,"handoffBody");function If(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!Vn(r)?null:Object.freeze({visitRef:t,intent:r})}i(If,"parseVisitEcho");function _a(e){let t=e.funnel??Ue({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=i(o=>(xa(r,"televet.visit.handoff_failed",{reason:Hn(o)}),V(o)),"failed");return {async createHandoff(o,s){let a;if(o!=null){let E=typeof o=="string"?[...o].length:0;if(E<1||E>Pa)return n(q("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Pa} characters`}));a=o;}let d=_f(a,s);if(!d.ok){let E=ka(d.message);return E.ok?E:n(E.error)}let l=d.body,u=await t.send("televet.visit.handoff",{method:"POST",path:Tf,body:l},{idempotent:false,maxAttempts:1});if(!u.ok)return n(u.error);let c=Af(u.value),p=l.return_to!==void 0,y=p?u.value?.flow_id:void 0;if(p&&(typeof y!="string"||!xf.test(y))){let E=Nn("the handoff response carried no usable return flow id");return E.ok?E:n(E.error)}let b=l.visit_ref!==void 0,g=b?If(u.value?.visit):null;if(b&&g===null){let E=Nn("the handoff response did not confirm the visit it opens");return E.ok?E:n(E.error)}let P=c===null?null:Object.freeze({...c,...p?{flowId:y}:{},...g!==null?{visit:g}:{}});return P===null?n(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(xa(r,"televet.visit.handoff_created",{pet_scoped:l.pet_ref!==void 0}),de(P))},async checkAvailability(o){if(typeof o!="string"||o.length>Ta)return ka(`state must be at most ${Ta} characters`);let s=await t.send("televet.visit.availability",{method:"POST",path:Pf,body:{state:o}},{idempotent:false,maxAttempts:1});if(!s.ok)return V(s.error);let a=s.value?.available;return typeof a!="boolean"?Nn("the availability response carried no usable answer"):de(Object.freeze({available:a}))},async chatEntryOpen(){try{let o=await t.send("televet.visit.chat_entry",{method:"GET",path:wf},{maxAttempts:1});return o.ok&&o.value?.open===!0}catch{return false}}}}i(_a,"createVetVisitController");function Af(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Lf(t)?null:Object.freeze({url:t,expiresAt:r})}i(Af,"parseHandoff");var Of=new Set(["localhost","127.0.0.1","[::1]"]),Ff=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Mf=/[\s\u0000-\u001f\u007f]/;function Lf(e){if(Mf.test(e))return false;let t=Ff.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let o=n.replace(/:\d+$/,"").toLowerCase(),s=r==="https",a=r==="http"&&Of.has(o);if(!s&&!a)return false;let d=e.indexOf("#");if(d<0)return false;let l=e.slice(d);return l.startsWith("#h=")&&l.length>3}i(Lf,"isOpenableVisitUrl");function xa(e,t,r){if(e)try{e.track(t,r);}catch{}}i(xa,"safeTrack");var Un=Object.freeze({status:"idle",error:null,errorReason:null});function Vf(e,t,r){let{usState:n,chat:o,scope:s}=r,a=t&&(n!==null||o),d=`${n??""}|${o?"chat":""}`,[l,u]=react.useState(null);if(react.useEffect(()=>{if(!a)return;let p=true,y=e.current;return u(null),i(async()=>{try{if(o&&!(y.chatEntryOpen&&await y.chatEntryOpen()))return !1;if(n===null)return !0;if(!y.checkAvailability)return !1;let g=await y.checkAvailability(n);return g.ok&&g.value.available}catch{return false}},"ask")().then(g=>{p&&u({key:d,open:g});}),()=>{p=false;}},[a,d,n,o,s,e]),!a)return null;let c=l!==null&&l.key===d;return {open:c&&l.open,pending:!c}}i(Vf,"usePreflight");var Nf=Object.freeze({status:"opening",error:null,errorReason:null});function Oa(e,t={}){let{runtime:r,userRef:n,scopeEpoch:o}=ie(),s=Rt("televet"),a=s.enabled&&n!==null,d=t.usState??null,l=t.entry==="chat",u=t.petRef??null,c=t.prefer==="redirect",p=react.useMemo(()=>{if(t.controller)return t.controller;let{services:x}=r.registry;return _a({auth:x.authFor(n),telemetry:x.telemetry,...x.errorPolicy?{errorPolicy:x.errorPolicy}:{}})},[r,n,o,t.controller]),y=react.useRef(p);y.current=p;let b=react.useMemo(()=>({runtime:r,userRef:n,scopeEpoch:o}),[r,n,o]),g=Vf(y,a,{usState:d,chat:l,scope:b}),P=a&&(g===null||g.open)&&(!l||u!==null),E=t.returnTo??null,[S,A]=react.useState(Un),T=react.useRef(null),_=react.useRef({runtime:r,userRef:n,scopeEpoch:o});_.current={runtime:r,userRef:n,scopeEpoch:o};let m=react.useRef(p);m.current=p;let R=react.useRef(P);R.current=P;let O=react.useCallback((x,D)=>{if(T.current)return T.current;let U=i((oe,Fe)=>(A({status:oe==="cancelled"?"idle":"error",error:Fe,errorReason:oe==="cancelled"?null:oe}),Object.freeze({opened:false,reason:oe,error:Fe})),"fail");if(!R.current)return Promise.resolve(U("unavailable",null));let z=e.prepare();if(!z.ok)return Promise.resolve(U(z.reason,null));let Z=_.current,le=m.current;A(Nf);let Ne=(async()=>{let oe,Fe={...E!==null?{returnTo:E}:{},...l?{entry:"chat"}:{},...D!==null?{visitRef:D.visitRef}:{},...D!==null&&D.intent!==null&&D.intent!==void 0?{intent:D.intent}:{}},Dt=Object.keys(Fe).length===0?void 0:Fe,Vt=x===void 0?u:x;try{oe=await(Dt===void 0?le.createHandoff(Vt):le.createHandoff(Vt,Dt));}catch{return e.abandon(z.value),U("unknown",null)}let Je=_.current;if(Je.runtime!==Z.runtime||Je.userRef!==Z.userRef||Je.scopeEpoch!==Z.scopeEpoch)return e.abandon(z.value),U("cancelled",null);if(!oe.ok)return e.abandon(z.value),U(Hn(oe.error),oe.error);let ft=await e.finish(z.value,oe.value);return ft!==null?U(ft,null):(A(Un),Object.freeze(oe.value.flowId===void 0?{opened:true}:{opened:true,flowId:oe.value.flowId}))})().finally(()=>{T.current===Ne&&(T.current=null);});return T.current=Ne,Ne},[e,u,E,l]),F=react.useCallback((x,D)=>{if(!R.current)return A({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}));let U=x===void 0?u:x,z={...U!==null?{petRef:U}:{},...d!==null?{usState:d}:{},...D!==null?{visitRef:D.visitRef,intent:D.intent}:{}};return gr(z)===null?(A({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}))):(A(Un),Promise.resolve(Object.freeze({opened:true})))},[u,d]),w=react.useCallback(x=>c?O(x,null):F(x,null),[c,O,F]),h=react.useCallback((x,D)=>c?O(void 0,{visitRef:x,intent:D??null}):F(void 0,{visitRef:x,intent:D??null}),[c,O,F]);return {available:P,isPending:s.isPending||(g?.pending??false),status:S.status,error:S.error,errorReason:S.errorReason,open:w,openVisit:h}}i(Oa,"useVetVisitWith");var zf=i(e=>reactNative.Linking.openURL(e),"defaultOpenUrl");function vr(e={}){let{openUrl:t,...r}=e,n=react.useMemo(()=>{let o=t??zf;return {prepare:i(()=>({ok:true,value:null}),"prepare"),async finish(s,a){try{return await o(a.url),null}catch{return "openFailed"}},abandon:i(()=>{},"abandon")}},[t]);return Oa(n,r)}i(vr,"useVetVisit");var Fa=44,qf=.6;function st(e){let{petRef:t,label:r,openUrl:n,onOpened:o,onError:s,style:a,labelStyle:d,controller:l,returnTo:u,usState:c,entry:p,visitRef:y,intent:b,onStartInApp:g,prefer:P}=e,E=P==="redirect",S=vr({...u!==void 0?{returnTo:u}:{},...c!==void 0?{usState:c}:{},...p!==void 0?{entry:p}:{},...t!==void 0?{petRef:t}:{},...n!==void 0?{openUrl:n}:{},...l!==void 0?{controller:l}:{},prefer:E?"redirect":"in-app"}),A=I(),T=react.useMemo(()=>Yf(A),[A]),_=react.useRef(false);if(!S.available)return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[null,jsxRuntime.jsx(kt,{})]});let m=S.status==="opening",R=r??pa.visitButton;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{onPress:i(()=>{if(!(m||_.current)){if(!E){let F={...t!==void 0?{petRef:t}:{},...c!==void 0?{usState:c}:{},...y!=null?{visitRef:y,intent:b??null}:{}};gr(F,g)===null&&W(s,"unavailable",null);return}_.current=true,(y==null?S.open():S.openVisit(y,b??null)).then(F=>{F.opened?W(o,F.flowId??null):F.reason!=="cancelled"&&W(s,F.reason,F.error);}).finally(()=>{_.current=false;});}},"onPress"),accessibilityRole:"button",accessibilityLabel:R,accessibilityState:{busy:m,disabled:m},style:[T.button,m?T.busy:null,a],children:jsxRuntime.jsx(v,{style:[T.label,d],children:R})}),jsxRuntime.jsx(kt,{})]})}i(st,"VetVisitButton");function Yf(e){let{color:t,space:r,radius:n,type:o,slots:s}=e;return reactNative.StyleSheet.create({button:{minHeight:Fa,minWidth:Fa,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.primary,...re(s.vetVisitButton)},busy:{opacity:qf},label:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug,...ce(s.vetVisitButton)}})}i(Yf,"makeStyles");function zn(e){return Jt(e)==="cat"?"cat":"dog"}i(zn,"speciesOf");function Bn(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.floor(e)}i(Bn,"petAgeYears");function Va(e){let t=Bn(e.ageYears),r=zn(e.species)==="cat"?"Cat":"Dog";if(t==null)return r;let n=t===1?"1 yr":`${t} yrs`;return `${r} \xB7 ${n}`}i(Va,"formatPetMeta");var Da=Object.freeze([Object.freeze({background:"#ffbdbd",foreground:"#6d1d14"}),Object.freeze({background:"#a0c4f6",foreground:"#0b3a73"}),Object.freeze({background:"#fbc558",foreground:"#10462e"}),Object.freeze({background:"#bde7c5",foreground:"#0e3b22"}),Object.freeze({background:"#dcc7f4",foreground:"#3a1d6a"}),Object.freeze({background:"#ffd8a8",foreground:"#5a2a04"})]);function Kf(e){let t=0;for(let r=0;r<e.length;r+=1)t=t*31+e.charCodeAt(r)>>>0;return Da[t%Da.length]}i(Kf,"pickInitialsPalette");function jn(e){let t=(e??"").trim();return (Array.from(t)[0]??"?").toUpperCase()}i(jn,"getInitial");function Na(e){return {...Kf(e.petRef),initial:jn(e.name)}}i(Na,"petInitials");function Zf(e){return Math.max(12,Math.round(e*.42))}i(Zf,"letterSize");function _t({pet:e,size:t,ringStroke:r}){let n=I(),o=react.useMemo(()=>Jf(n),[n]),s=t-r*2,a=e===null?null:Na(e),d=Zf(s);return jsxRuntime.jsx(cr,{size:t,strokeWidth:r,color:n.color.success,children:jsxRuntime.jsx(reactNative.View,{style:[o.disc,{width:s,height:s,borderRadius:s/2},a===null?o.discEmpty:{backgroundColor:a.background}],children:jsxRuntime.jsx(v,{tier:"badge",style:[o.letter,{fontSize:d,lineHeight:Math.round(d*1.2),color:a===null?n.color.text.muted:a.foreground}],children:a===null?jn(null):a.initial})})})}i(_t,"PetDisc");function Jf(e){return reactNative.StyleSheet.create({disc:{alignItems:"center",justifyContent:"center",overflow:"hidden"},discEmpty:{backgroundColor:e.color.brandSoft},letter:{...C(e,"bold"),textAlign:"center",includeFontPadding:false}})}i(Jf,"makeStyles");var Gn=48,za=2,iy=320,sy="80%",ay="rgba(17,17,17,0.45)",ly=18,Ha=22,dy=12,Ua=.4,uy=44;function qn(e){return e?.name?.trim()||f.yourPet}i(qn,"petDisplayName");function Ba({visible:e,pets:t,activePetRef:r,onSelect:n,onAddPet:o=null,onClose:s}){let a=I(),d=react.useMemo(()=>cy(a),[a]);return e?jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:a.motion.reducedMotion?"none":"fade",onRequestClose:s,children:jsxRuntime.jsxs(reactNative.View,{style:d.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:me,onPress:s,accessibilityRole:"button",accessibilityLabel:f.close,children:jsxRuntime.jsx(reactNative.View,{style:d.backdrop})}),jsxRuntime.jsxs(reactNative.View,{style:d.panel,accessibilityViewIsModal:true,children:[jsxRuntime.jsx(v,{tier:"heading",style:d.title,accessibilityRole:"header",children:f.yourPets}),jsxRuntime.jsx(reactNative.ScrollView,{style:d.list,contentContainerStyle:d.listContent,showsVerticalScrollIndicator:true,children:t.map(l=>{let u=l.petRef===r,c=qn(l),p=Va(l);return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(u?f.petCurrentlyActive:f.switchToPet,{name:c}),accessibilityState:{selected:u},style:[d.row,u?d.rowActive:null],onPress:()=>n(l.petRef),children:[jsxRuntime.jsx(_t,{pet:l,size:Gn,ringStroke:za}),jsxRuntime.jsxs(reactNative.View,{style:d.copy,children:[jsxRuntime.jsx(v,{style:d.name,numberOfLines:1,children:c}),jsxRuntime.jsx(v,{tier:"compact",style:d.meta,numberOfLines:1,children:u?`${f.activePrefix}${p}`:p})]}),u?jsxRuntime.jsx(Le,{size:ly,color:a.color.brandInk}):null]},l.petRef)})}),o!==null?jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:f.addAnotherPet,style:d.addRow,onPress:o,children:[jsxRuntime.jsx(reactNative.View,{style:d.addDisc,children:jsxRuntime.jsx(v,{tier:"control",style:d.addPlus,children:"+"})}),jsxRuntime.jsx(v,{style:d.addLabel,children:f.addAnotherPet})]}):null,jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.close,containerStyle:d.closeSlot,style:d.closeButton,onPress:s,children:jsxRuntime.jsx(v,{tier:"control",style:d.closeText,children:f.close})})]})]})}):null}i(Ba,"PetSwitcherSheet");function cy(e){let t=e.color,r=e.radius;return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:ay},panel:{backgroundColor:t.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:Ha,borderTopRightRadius:Ha,gap:14,maxHeight:sy},title:{...C(e,"bold"),fontSize:18,lineHeight:22,color:t.brandInk},list:{maxHeight:iy,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:uy,paddingHorizontal:8},addDisc:{width:Gn,height:Gn,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:za,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream},addPlus:{...C(e,"bold"),fontSize:20,lineHeight:22,color:t.brandInk},addLabel:{...C(e,"bold"),fontSize:15,lineHeight:20,color:t.text.primary},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowActive:{borderColor:t.brandInk,backgroundColor:t.brandSoft},copy:{flex:1,gap:2},name:{...C(e,"bold"),fontSize:15,lineHeight:18,color:t.text.primary},meta:{...C(e,"monoBold"),fontSize:11,lineHeight:13,color:t.text.muted,textTransform:"uppercase",letterSpacing:Ua},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:dy,backgroundColor:t.brandSoft},closeText:{...C(e,"bold"),color:t.brandInk,fontSize:13,lineHeight:16,letterSpacing:Ua}})}i(cy,"makeStyles");var yy=44,Er=36,my=22,Yn=9,hy=1.5,Wa=6,Ye=35,Rr=1.75,Kn=12.4,gy=.5,by=8,vy=28,Cy=160;function Xn(e,t){return ca(e,t)}i(Xn,"headerPet");function qa({pets:e,petRef:t,historyUnread:r,onOpenHistory:n,onPetChange:o,onAddPet:s,vet:a}){let d=I(),l=react.useMemo(()=>Ry(d),[d]),[u,c]=react.useState(false),p=Xn(e.pets,t),y=e.pets.length>=2,b=t??p?.petRef??null,g=qn(p),P=i(S=>{c(false),e.setActivePet(S),W(o,S);},"select"),E=s===void 0?null:()=>{c(false),W(s);};return jsxRuntime.jsxs(reactNative.View,{style:l.row,children:[jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:r?f.openMenuUnread:f.openMenu,containerStyle:l.iconSlot,style:l.iconButton,onPress:n,children:[jsxRuntime.jsx(Es,{size:my,color:d.color.text.primary,strokeWidth:2}),r?jsxRuntime.jsx(reactNative.View,{style:l.unreadDot,pointerEvents:"none"}):null]}),jsxRuntime.jsx(reactNative.View,{style:l.center,pointerEvents:"box-none",children:jsxRuntime.jsx(Ey,{logoUrl:d.meta.logoUrl,name:d.meta.displayName,styles:l})}),b===null?null:jsxRuntime.jsx(st,{entry:"chat",petRef:b,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:l.vetEntry,labelStyle:l.vetEntryLabel}),jsxRuntime.jsx(reactNative.View,{style:l.right,children:y?jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(f.switchActivePet,{name:g}),containerStyle:l.avatarSlot,style:l.avatarWrap,onPress:()=>c(true),children:[jsxRuntime.jsx(_t,{pet:p,size:Ye,ringStroke:Rr}),jsxRuntime.jsx(reactNative.View,{style:l.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsxRuntime.jsx(Ss,{size:by,color:d.color.brandInk,strokeWidth:2})})]}):e.loading&&p===null?jsxRuntime.jsx(reactNative.View,{style:l.avatarWrap,accessible:true,accessibilityLabel:f.yourPet,children:jsxRuntime.jsx(cr,{size:Ye,strokeWidth:Rr,color:d.color.success,children:jsxRuntime.jsx(reactNative.View,{style:l.placeholderDisc})})}):jsxRuntime.jsx(reactNative.View,{style:l.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:p===null?f.yourPet:g,children:jsxRuntime.jsx(_t,{pet:p,size:Ye,ringStroke:Rr})})}),jsxRuntime.jsx(Ba,{visible:u,pets:e.pets,activePetRef:p?.petRef??null,onSelect:P,onAddPet:E,onClose:()=>c(false)})]})}i(qa,"ChatHeader");function Ey({logoUrl:e,name:t,styles:r}){let[n,o]=react.useState(null);return e===null||n===e?null:jsxRuntime.jsx(reactNative.View,{style:r.logoBar,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:r.logo,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:()=>o(e)})})}i(Ey,"BrandLogo");function Ry(e){let t=e.color,r=Ye-Rr*2;return reactNative.StyleSheet.create({vetEntry:{minHeight:yy,justifyContent:"center",paddingHorizontal:12,borderRadius:e.radius.pill,backgroundColor:t.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},vetEntryLabel:{...C(e,"bold"),color:t.brandInk,fontSize:e.type.size.caption},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:10,backgroundColor:t.surface},iconSlot:{borderRadius:Er/2},iconButton:{width:Er,height:Er,borderRadius:Er/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:Wa,right:Wa,width:Yn,height:Yn,borderRadius:Yn,backgroundColor:t.danger,borderWidth:hy,borderColor:t.surface},center:{...me,alignItems:"center",justifyContent:"center"},logoBar:{alignItems:"center",paddingHorizontal:e.space.lg},logo:{height:vy,width:Cy},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:Ye/2},avatarWrap:{width:Ye,height:Ye,position:"relative"},placeholderDisc:{width:r,height:r,borderRadius:r/2,backgroundColor:t.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:Kn,height:Kn,borderRadius:Kn/2,borderWidth:gy,borderColor:t.success,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"}})}i(Ry,"makeStyles");var $a=44,ky="rgba(17,17,17,0.55)",Xa=26,xy=36,Qa=4,Qn=20,Zn=38,_y=18,Iy=12;function Za({visible:e,onSubmit:t,onSkip:r}){let n=I(),o=react.useMemo(()=>Ay(n),[n]),[s,a]=react.useState(null),[d,l]=react.useState(""),[u,c]=react.useState(false),[p,y]=react.useState(false),b=i(()=>{a(null),l(""),c(false),y(false);},"reset"),g=i(()=>{u||(b(),r());},"skip"),P=i(async()=>{if(u)return;c(true),y(false);let S=d.trim();await t(s,S.length>0?S:null)?b():(c(false),y(true));},"submit");if(!e)return null;let E=[...d].length>$t;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:n.motion.reducedMotion?"none":"slide",onRequestClose:g,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:o.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:o.scrim,onPress:g,accessibilityRole:"button",accessibilityLabel:f.feedbackSkipA11y}),jsxRuntime.jsxs(reactNative.View,{style:o.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[jsxRuntime.jsx(reactNative.View,{style:o.handle}),jsxRuntime.jsxs(reactNative.View,{style:o.header,children:[jsxRuntime.jsx(reactNative.View,{style:o.iconBadge,children:jsxRuntime.jsx(ur,{size:_y,color:n.color.brandInk,active:false,rotate:"180deg"})}),jsxRuntime.jsxs(reactNative.View,{style:o.headerText,children:[jsxRuntime.jsx(v,{tier:"heading",style:o.title,accessibilityRole:"header",children:f.feedbackTitle}),jsxRuntime.jsx(v,{style:o.subtitle,children:f.feedbackSubtitle})]})]}),jsxRuntime.jsx(reactNative.View,{style:o.options,children:Ur.map(S=>{let A=s===S.key;return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:S.label,accessibilityState:{selected:A},style:[o.option,A?o.optionSelected:null],onPress:()=>a(T=>T===S.key?null:S.key),children:[jsxRuntime.jsx(v,{style:[o.optionLabel,A?o.optionLabelSelected:null],children:S.label}),jsxRuntime.jsx(reactNative.View,{style:[o.radio,A?o.radioSelected:null],children:A?jsxRuntime.jsx(Le,{size:Iy,color:n.color.surface,strokeWidth:2}):null})]},S.key)})}),jsxRuntime.jsxs(reactNative.View,{style:o.inputWrap,children:[jsxRuntime.jsx(tt,{style:o.input,placeholder:f.feedbackNotesPlaceholder,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:f.feedbackNotesPlaceholder,value:d,onChangeText:l,multiline:true,editable:!u}),d.length>0?jsxRuntime.jsx(v,{tier:"compact",style:[o.counter,E?o.counterOver:null],children:`${[...d].length}/${$t}`}):null]}),p?jsxRuntime.jsx(v,{style:o.failed,accessibilityRole:"alert",children:f.feedbackFailed}):null,jsxRuntime.jsxs(reactNative.View,{style:o.actions,children:[jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.feedbackSubmit,accessibilityState:{busy:u,disabled:u||E},disabled:u||E,style:[o.submit,u||E?o.submitDisabled:null],onPress:()=>{P();},children:jsxRuntime.jsx(v,{tier:"control",style:o.submitLabel,children:f.feedbackSubmit})}),jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:f.feedbackSkipA11y,hitSlop:8,onPress:g,style:o.skip,children:jsxRuntime.jsx(v,{tier:"control",style:o.skipLabel,children:f.feedbackSkip})})]})]})]})})}i(Za,"FeedbackReasons");function Ay(e){let t=e.color,r=e.type,n=e.radius,o=e.slots;return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{...me,backgroundColor:ky},sheet:{backgroundColor:t.surface,borderTopLeftRadius:Xa,borderTopRightRadius:Xa,paddingHorizontal:22,paddingTop:12,paddingBottom:34,gap:14},handle:{alignSelf:"center",width:xy,height:Qa,borderRadius:Qa/2,backgroundColor:t.brandBorder,marginBottom:2},header:{flexDirection:"row",alignItems:"center",gap:12},iconBadge:{width:Zn,height:Zn,borderRadius:Zn/2,alignItems:"center",justifyContent:"center",backgroundColor:t.brandSoft},headerText:{flex:1,gap:2},title:{...C(e,"bold"),fontSize:20,lineHeight:28,color:t.text.primary,letterSpacing:r.letterSpacing.tight},subtitle:{...C(e,"regular"),fontSize:r.size.body,lineHeight:r.size.body*r.lineHeight.relaxed,color:t.text.muted},options:{gap:8},option:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:14,paddingVertical:13,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,backgroundColor:t.surface},optionSelected:{borderColor:t.brandInk,backgroundColor:t.brandSoft},optionLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.primary},optionLabelSelected:{color:t.brandInk},radio:{width:Qn,height:Qn,borderRadius:Qn/2,borderWidth:2,borderColor:t.brandBorderStrong,alignItems:"center",justifyContent:"center"},radioSelected:{borderColor:t.brandInk,backgroundColor:t.brandInk},inputWrap:{gap:4},input:{minHeight:72,maxHeight:132,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:14,paddingTop:12,paddingBottom:12,...C(e,"regular"),fontSize:r.size.body,color:t.text.primary,textAlignVertical:"top"},counter:{...C(e,"mono"),alignSelf:"flex-end",fontSize:r.size.caption,letterSpacing:.3,color:t.text.placeholder},counterOver:{color:t.danger},failed:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},actions:{gap:10,alignItems:"center"},submit:{alignSelf:"stretch",minHeight:$a,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.xl,borderRadius:n.pill,backgroundColor:t.brand,...re(o.primaryButton)},submitDisabled:{opacity:.6},submitLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.onPrimary,...ce(o.primaryButton)},skip:{minHeight:$a,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},skipLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.muted}})}i(Ay,"makeStyles");var qy=.88,Yy=420,Ky=58,$y="rgba(17,17,17,0.28)",Xy=.08,Qy=.1,Zy=.08,Jy=.18,em=.78,tm=.7,Jn=36,rm=10,nm=14,om=12,im=16,sm=14,eo=8,am=1.5,lm=.5,dm=fr(Tt.standard);function um(e){return Math.min(Math.round(e*qy),Yy)}i(um,"drawerPanelWidth");function Ja({chat:e,history:t}){let[r,n]=react.useState(t.open),o=react.useCallback(()=>n(false),[]);return t.open&&!r&&n(true),r?jsxRuntime.jsx(cm,{chat:e,history:t,onHidden:o}):null}i(Ja,"HistoryDrawer");function cm({chat:e,history:t,onHidden:r}){let n=I(),o=react.useMemo(()=>fm(n),[n]),s=G(),a=reactNativeSafeAreaContext.useSafeAreaInsets(),{width:d}=reactNative.useWindowDimensions(),l=um(d),u=t.open,c=react.useRef(null);c.current===null&&(c.current=new reactNative.Animated.Value(s.drawerMs<=0&&u?1:0));let p=c.current;react.useEffect(()=>{if(!u&&s.drawerMs<=0){r();return}let S=reactNative.Animated.timing(p,{toValue:u?1:0,duration:s.drawerMs,easing:dm,useNativeDriver:true});return S.start(({finished:A})=>{A&&!u&&r();}),()=>S.stop()},[u,p,s.drawerMs,r]);let y=p.interpolate({inputRange:[0,1],outputRange:[-l,0]}),b=t.filtered,g=t.rows.length===0,P=g&&t.loading?jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,accessibilityLabel:Y.loading,accessibilityState:{busy:true},children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{color:n.color.onPrimary}),jsxRuntime.jsx(v,{style:o.emptyBody,children:Y.loading})]}):g&&t.error!==null?jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,children:[jsxRuntime.jsx(v,{style:o.emptyTitle,accessibilityRole:"alert",children:Y.loadFailed}),jsxRuntime.jsx(v,{style:o.emptyBody,children:t.error}),jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.retryA11y,containerStyle:o.retrySlot,style:o.retryButton,onPress:()=>{t.load();},children:jsxRuntime.jsx(v,{tier:"control",style:o.retryText,children:Y.retry})})]}):jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,children:[jsxRuntime.jsx(v,{style:o.emptyTitle,children:t.emptyKind==="empty"?Y.empty:Y.noMatch}),jsxRuntime.jsx(v,{style:o.emptyBody,children:t.emptyKind==="empty"?Y.emptyBody:Y.noMatchBody})]}),E=!t.searching&&t.loadingMore?jsxRuntime.jsx(reactNative.View,{style:o.loadMoreFooter,children:jsxRuntime.jsx(v,{style:o.loadMoreLabel,children:Y.loadingMore})}):null;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:"none",onRequestClose:t.close,children:jsxRuntime.jsxs(reactNative.View,{style:o.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:me,onPress:t.close,accessibilityRole:"button",accessibilityLabel:Y.closeA11y,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[o.backdrop,{opacity:p}]})}),jsxRuntime.jsx(reactNative.Animated.View,{style:[o.panel,{width:l,paddingTop:Math.max(Ky,a.top+n.space.md),transform:[{translateX:y}]}],accessibilityViewIsModal:true,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:o.keyboardAvoider,behavior:reactNative.Platform.OS==="ios"?"padding":"height",children:[jsxRuntime.jsxs(reactNative.View,{style:o.searchRow,children:[jsxRuntime.jsxs(reactNative.View,{style:o.searchPill,children:[jsxRuntime.jsx(As,{size:sm,color:n.color.text.muted,strokeWidth:1.5}),jsxRuntime.jsx(tt,{value:t.query,onChangeText:S=>t.setQuery(S.replace(/^\s+/,"")),style:o.searchInput,placeholder:Y.search,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:Y.search,autoCorrect:false,autoCapitalize:"none",returnKeyType:"search"})]}),jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.newConversation,style:o.newButton,onPress:t.newConversation,children:jsxRuntime.jsx(Os,{size:im,color:n.color.text.primary,strokeWidth:1.5})})]}),jsxRuntime.jsx(v,{tier:"heading",style:o.heading,accessibilityRole:"header",children:Y.heading}),t.error!==null&&!g?jsxRuntime.jsx(reactNative.View,{style:o.errorCard,children:jsxRuntime.jsx(v,{style:o.errorText,accessibilityRole:"alert",children:t.error})}):null,jsxRuntime.jsx(reactNative.FlatList,{data:b,keyExtractor:S=>S.id,renderItem:({item:S})=>jsxRuntime.jsx(pm,{row:S,active:S.id===e.conversationId,disabled:t.loading,styles:o,onPress:()=>{t.resume(S.id);}}),contentContainerStyle:b.length===0?o.listEmpty:o.list,keyboardShouldPersistTaps:"handled",ListEmptyComponent:P,ListFooterComponent:E,onEndReached:t.loadMore,onEndReachedThreshold:lm})]})})]})})}i(cm,"DrawerModal");function pm({row:e,active:t,disabled:r,styles:n,onPress:o}){let s=e.unreadCount!==null&&e.unreadCount>0;return jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Ji(e),accessibilityState:{selected:t,disabled:r},disabled:r,style:[n.item,t?n.itemActive:null],onPress:o,children:jsxRuntime.jsxs(reactNative.View,{style:n.itemRow,children:[jsxRuntime.jsx(v,{style:[n.itemTitle,s?n.itemTitleUnread:null],numberOfLines:1,children:sr(e.title)}),s?jsxRuntime.jsx(reactNative.View,{style:n.unreadDot}):null]})})}i(pm,"Row");function Pr(e,t){if(!/^#[0-9a-f]{6}$/i.test(e))return "transparent";let r=Math.round(Math.min(1,Math.max(0,t))*255);return `${e}${r.toString(16).padStart(2,"0").toUpperCase()}`}i(Pr,"inkWash");function fm(e){let t=e.color,r=e.slots,n=t.onPrimary;return reactNative.StyleSheet.create({root:{flex:1},backdrop:{flex:1,backgroundColor:$y},panel:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:t.brand,paddingHorizontal:16,borderRightWidth:.5,borderRightColor:t.brandBorder,gap:12},keyboardAvoider:{flex:1,gap:12},searchRow:{flexDirection:"row",alignItems:"center",gap:10},searchPill:{flex:1,flexDirection:"row",alignItems:"center",gap:8,borderRadius:e.radius.pill,backgroundColor:t.surface,paddingHorizontal:14,paddingVertical:10,borderWidth:1,borderColor:Pr(n,Qy)},searchInput:{...C(e,"regular"),flex:1,fontSize:13,lineHeight:16,color:t.text.primary,padding:0},newButton:{width:Jn,height:Jn,borderRadius:Jn/2,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},heading:{...C(e,"bold"),fontSize:14,lineHeight:17,color:n,marginTop:4},list:{gap:10,paddingBottom:28},listEmpty:{flexGrow:1},item:{paddingVertical:12,paddingHorizontal:4,borderRadius:rm},itemActive:{backgroundColor:Pr(n,Xy)},itemRow:{flexDirection:"row",alignItems:"center",gap:8},itemTitle:{...C(e,"regular"),flex:1,fontSize:14,lineHeight:18,color:n},itemTitleUnread:C(e,"bold"),unreadDot:{width:eo,height:eo,borderRadius:eo/2,backgroundColor:t.danger,borderWidth:am,borderColor:n},errorCard:{borderRadius:om,borderWidth:.5,borderColor:t.danger,backgroundColor:t.surface,padding:12},errorText:{...C(e,"regular"),fontSize:11,lineHeight:16,color:t.danger},emptyCard:{borderRadius:nm,padding:14,gap:6,backgroundColor:Pr(n,Zy),borderWidth:.5,borderColor:Pr(n,Jy)},emptyTitle:{...C(e,"bold"),fontSize:12,lineHeight:15,color:n},emptyBody:{...C(e,"regular"),fontSize:11,lineHeight:17,color:n,opacity:em},retrySlot:{marginTop:8,alignSelf:"flex-start"},retryButton:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:7,borderWidth:1,borderColor:n,...re(r.primaryButton)},retryText:{...C(e,"bold"),fontSize:12,lineHeight:15,color:n,...ce(r.primaryButton)},loadMoreFooter:{paddingVertical:14,alignItems:"center"},loadMoreLabel:{...C(e,"regular"),fontSize:11,lineHeight:14,color:n,opacity:tm}})}i(fm,"makeStyles");var vm=Object.freeze({}),Cm=100,Em=20;function Rm(e,t,r,n){return ![e,t,r,n].every(Number.isFinite)||e+r>n+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}i(Rm,"readWindowTops");function el(e,t){let r=typeof e=="number"&&Number.isFinite(e),n=react.useRef(null),[o,s]=react.useState(null),a=react.useRef(null),d=react.useRef(null),l=react.useRef(true),u=react.useCallback(()=>{d.current!==null&&clearTimeout(d.current),d.current=null;},[]);react.useEffect(()=>(l.current=true,()=>{l.current=false,u();}),[u]);let c=react.useCallback(i(function y(b){n.current?.measureInWindow((g,P)=>{let E=a.current;if(!l.current||E===null)return;let S=Rm(P,E.y,E.height,reactNative.Dimensions.get("window").height);if(S!==null){s(A=>A!==null&&A.chatTop===S.chatTop&&A.parentTop===S.parentTop?A:S);return}b>=Em||(d.current=setTimeout(()=>{d.current=null,y(b+1);},Cm));});},"measureAt"),[]),p=react.useCallback(y=>{let{y:b,height:g}=y.nativeEvent.layout;a.current={y:b,height:g},u(),c(0);},[c,u]);return react.useMemo(()=>{if(!t)return {avoidingProps:r?{keyboardVerticalOffset:e}:vm,probeRef:null,topInWindow:null};let y=o?.parentTop??0;return {avoidingProps:r?{keyboardVerticalOffset:e,onLayout:p}:y>0?{keyboardVerticalOffset:y,onLayout:p}:{onLayout:p},probeRef:n,topInWindow:o?.chatTop??null}},[t,r,e,o,p])}i(el,"useChatKeyboardOffset");function tl({probeRef:e}){return e===null?null:jsxRuntime.jsx(reactNative.View,{ref:e,collapsable:false,pointerEvents:"none",style:Sm})}i(tl,"KeyboardOffsetProbe");var Sm=Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function rl(e,t){let r={entry:"chat",petRef:e};return t?.returnTo!==void 0&&(r.returnTo=t.returnTo),t?.usState!==void 0&&(r.usState=t.usState),t?.prefer!==void 0&&(r.prefer=t.prefer),r}i(rl,"chatVetVisitOptions");var xm=16,_m=.75,ro=12,nl=15,Im=18,kr=22,Am=14,Om=8,Fm=20,Mm=10,Lm=13;function il({surface:e,petRef:t,renderVetAction:r,onFindVet:n,vet:o}){let s=I(),a=react.useMemo(()=>Dm(s),[s]),d=G(),l=e.tier,u=e.source;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vn,{visible:e.showBanner&&l!==null,inMs:d.bannerInMs,outMs:d.bannerOutMs,style:a.pinned,children:l!==null&&u!==null?jsxRuntime.jsxs(reactNative.View,{accessibilityRole:"alert",style:[a.card,{borderColor:l.borderColor,backgroundColor:l.backgroundColor}],children:[jsxRuntime.jsx(v,{tier:"compact",style:[a.label,{color:l.textColor}],children:l.label}),u.reason!==null?jsxRuntime.jsx(v,{style:[a.reason,{color:l.reasonColor}],children:u.reason}):null,e.showVetAction?r!==void 0?jsxRuntime.jsx(Be,{render:()=>r(l.level),fallback:jsxRuntime.jsx(ol,{tier:l,petRef:t,onFindVet:n,vet:o,styles:a}),resetKey:l.level}):jsxRuntime.jsx(ol,{tier:l,petRef:t,onFindVet:n,vet:o,styles:a}):null,e.dismissLabel!==null?jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.dismissLabel,hitSlop:Om,containerStyle:a.closeSlot,style:a.closeButton,onPress:e.dismiss,children:jsxRuntime.jsx(je,{size:Am,color:l.textColor,strokeWidth:1.5})}):null]}):null}),jsxRuntime.jsx(vn,{visible:e.showCompactIcon,inMs:d.iconInMs,outMs:d.iconOutMs,style:a.indicatorRow,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.showLatestVetAlert,hitSlop:Mm,onPress:e.expand,children:jsxRuntime.jsx(ks,{size:Fm,color:s.color.text.muted,strokeWidth:2})})})]})}i(il,"UrgencyBanner");function ol({tier:e,petRef:t,onFindVet:r,vet:n,styles:o}){let s=I(),a=vr(rl(t,n)),d=a.status==="opening",l=a.available?()=>{a.open();}:r!==void 0?()=>{W(r,e.level);}:null;if(l===null)return null;let u=Fn(s.slots.vetVisitButton)?.textColor??e.textColor;return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:f.findVetA11y,accessibilityState:{busy:d},containerStyle:o.findVetSlot,style:[o.findVetButton,{borderColor:e.borderColor,backgroundColor:e.pillColor},o.findVetSlotBox,d?o.findVetBusy:null],onPress:l,children:[jsxRuntime.jsx(Fs,{size:Lm,color:u,strokeWidth:1.5}),jsxRuntime.jsx(v,{tier:"control",style:[o.findVetLabel,{color:u}],children:f.findVet})]})}i(ol,"VetAction");function Dm(e){let t=Fn(e.slots.vetVisitButton);return reactNative.StyleSheet.create({pinned:{marginTop:0,marginBottom:4,paddingHorizontal:e.space.lg},card:{borderRadius:xm,borderWidth:_m,paddingHorizontal:14,paddingVertical:8,gap:2},label:{...C(e,"monoBold"),fontSize:ro,lineHeight:nl},reason:{...C(e,"regular"),fontSize:ro,lineHeight:Im,paddingRight:kr},findVetSlot:{alignSelf:"flex-start",marginTop:6},findVetButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:e.radius.pill,borderWidth:1},findVetSlotBox:{...re(t,1)},findVetBusy:{opacity:.6},findVetLabel:{...C(e,"monoBold"),fontSize:ro,lineHeight:nl},closeSlot:{position:"absolute",top:6,right:6},closeButton:{width:kr,height:kr,borderRadius:kr/2,alignItems:"center",justifyContent:"center"},indicatorRow:{alignItems:"flex-end",paddingHorizontal:16,paddingTop:2,paddingBottom:4}})}i(Dm,"makeStyles");function sl(){let e=On(),{handle:t}=ie(),r=react.useCallback(n=>t.setActivePet(n),[t]);return react.useMemo(()=>({...e,setActivePet:r}),[e,r])}i(sl,"useChatPets");var pl=300,fl=3e3,ll=120,lt=44,zm=120,Bm="86%",oo=15,io=22,Ot=.5,jm=.04,Wm=8,Gm=2,qm=1,Ym=.6,Km=22,$m=48,dl=1.25,Xm=14,Qm=18,Zm=6,Jm=14,eh=.04,th=12,rh=2,nh=2,ul=36,oh=20,at=36,dt=(lt-at)/2,yl=24,ml=22,ih=.4,xr=30,hl=20,sh=.4,ah=480,lh=8,cl=14,dh=10,uh=14,ch=12,ph=13,fh=18,yh="12%";function fe(){let e=I(),t=react.useMemo(()=>mh(e),[e]);return {theme:e,styles:t}}i(fe,"useChatTheme");function mh(e){let t=e.color,r=e.space,n=e.radius,o=e.type,s=e.slots;return reactNative.StyleSheet.create({container:{flex:1,minHeight:ll,backgroundColor:t.chatGround},body:{flex:1},centered:{minHeight:ll,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},emptyContent:{flexGrow:1,alignItems:"center",justifyContent:"flex-start",paddingTop:yh,paddingHorizontal:r.lg,paddingBottom:r.lg,minHeight:ah,gap:18},errorText:{...C(e,"regular"),fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,color:t.danger,textAlign:"center",marginBottom:r.md},retryButton:{minHeight:lt,minWidth:lt,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand,...re(s.primaryButton)},retryLabel:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,...ce(s.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.sm,backgroundColor:t.surfaceCream},setupNoticeText:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption,flexShrink:1},turnNotice:{gap:r.xs,padding:r.md,borderRadius:n.lg,backgroundColor:t.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,alignItems:"flex-start"},turnNoticeError:{borderColor:t.danger},turnNoticeTitle:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.body},turnNoticeTitleError:{color:t.danger},turnNoticeBody:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal},turnNoticeAction:{minHeight:lt,justifyContent:"center"},turnNoticeActionLabel:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.body},setupNoticeAction:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.caption},reconnectingCaption:{...C(e,"medium"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},list:{flex:1},listContent:{padding:r.lg,gap:r.md},rowBlock:{gap:r.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:r.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:Bm},bubbleUser:{padding:oo,backgroundColor:t.bubbleUser,borderRadius:n.xl,borderBottomRightRadius:n.sm,borderWidth:Ot,borderColor:t.accentEdge,shadowColor:t.brand,shadowOpacity:jm,shadowRadius:Wm,shadowOffset:{width:0,height:Gm},elevation:qm,...re(s.userBubble,Ot)},bubbleAssistant:s.assistantBubble?.backgroundColor===void 0?{...re(s.assistantBubble,Ot)}:{padding:oo,borderRadius:n.xl,...re(s.assistantBubble,Ot)},bubbleVet:{padding:oo,backgroundColor:t.bubbleVet,borderRadius:n.xl,borderBottomLeftRadius:n.sm,...re(s.vetBubble,Ot)},bubblePending:{opacity:Ym},bubbleTextUser:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:io,...ce(s.userBubble)},bubbleTextAssistant:{...C(e,"medium"),color:t.text.primary,fontSize:o.size.body,lineHeight:io,...ce(s.assistantBubble)},bubbleTextVet:{...C(e,"medium"),color:t.onBubbleVet,fontSize:o.size.body,lineHeight:io,...ce(s.vetBubble)},vetSender:{...C(e,"bold"),color:t.onBubbleVet,fontSize:o.size.caption,lineHeight:Math.round(o.size.caption*o.lineHeight.normal),marginBottom:r.xs,...ce(s.vetBubble)},bubbleBold:C(e,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:C(e,"mono"),followUps:{alignSelf:"stretch",marginTop:r.sm,gap:lh},followUpSlot:{alignSelf:"stretch",borderRadius:cl},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:ch,paddingVertical:dh,paddingHorizontal:uh,borderRadius:cl,backgroundColor:t.brandSoft},followUpText:{...C(e,"medium"),flex:1,color:t.text.primary,fontSize:ph,lineHeight:fh},composerOuter:{position:"relative"},composer:{marginHorizontal:r.md,marginTop:r.xs,marginBottom:r.sm,minHeight:$m,justifyContent:"center",paddingLeft:Xm,paddingRight:Qm,paddingVertical:Zm,backgroundColor:t.composerFill,borderWidth:dl,borderColor:t.composerBorder,borderRadius:Km,shadowColor:t.shadow,shadowOpacity:eh,shadowRadius:th,shadowOffset:{width:0,height:rh},elevation:nh,...re(s.composerInput,dl)},composerRow:{flexDirection:"row",alignItems:"center",gap:Jm,minHeight:ul},attachControl:{width:xr,height:xr,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:sh},input:{flex:1,minHeight:ul,maxHeight:zm,paddingHorizontal:0,paddingVertical:0,...C(e,"regular"),fontSize:o.size.body,lineHeight:oh,color:t.text.primary,...ce(s.composerInput)},sendControl:{minHeight:at,minWidth:at,alignItems:"center",justifyContent:"center"},sendDisc:{width:at,height:at,borderRadius:at/2,alignItems:"center",justifyContent:"center",...re(s.sendButton)},sendControlDisabled:{opacity:ih},poweredBy:{...C(e,"regular"),color:t.text.muted,fontSize:o.size.micro,textAlign:"center",paddingBottom:r.xs}})}i(mh,"makeStyles");var hh=Object.freeze({kind:"live"}),gh=Object.freeze({kind:"folded"});function so(e){if(e.role!=="assistant"||e.checkin===void 0)return null;let t=e.checkin.caseId,r=ti(e.proactiveOriginRef);return {caseId:t,dueDay:r!==null&&r.caseId===t?r.dueDay:""}}i(so,"askOf");function bl(e){let t=new Map,r=new Map;for(let o of e){let s=so(o);if(s===null)continue;let a=r.get(s.caseId);(a===void 0||s.dueDay>=a.dueDay)&&r.set(s.caseId,{messageId:o.id,dueDay:s.dueDay});}if(r.size===0)return t;let n=null;for(let o of e){let s=so(o);if(s===null){n=null;continue}if(r.get(s.caseId)?.messageId===o.id){t.set(o.id,hh),n=null;continue}if(n!==null&&n.caseId===s.caseId){n.days.push(s.dueDay),t.set(o.id,gh);continue}let a=[s.dueDay];n={id:o.id,caseId:s.caseId,days:a},t.set(o.id,{kind:"past",runDueDays:a});}return t}i(bl,"placeCheckins");var gl=864e5,bh=365;function _r(e,t){if(typeof e!="string"||typeof t!="string")return null;let r=Date.parse(e),n=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(n))return null;let o=Math.floor(n/gl)-Math.floor(r/gl);return o<1||o>bh?null:o}i(_r,"checkinDayNumber");function vl(e){return so(e)?.dueDay||null}i(vl,"checkinDueDay");var he=Object.freeze({eyebrow:"Checking in",logged:"Logged",findVet:"Find a vet now",day:"Day {day}",daySeparator:" \xB7 ",answers:Object.freeze({better:"Better",same:"Same",worse:"Worse"})}),Cl=Object.freeze(Xo.map(e=>Object.freeze({answer:e,label:he.answers[e]})));function El(e,t){let[r,n]=react.useState(null),[o,s]=react.useState(null),[a,d]=react.useState(null),l=react.useCallback(c=>{t!==null&&(n(c),s(null),t(e.caseId,c).then(p=>{n(null),p.ok?d(c):s(p.error);}));},[t,e.caseId]),u=a??e.answer;return {answer:u,answerable:!ei(e),escalated:u==="worse",pending:r,error:o,choose:l}}i(El,"useCheckinCard");var Tl=44,Eh=.6;function wl({message:e,checkin:t,onAnswer:r,petRef:n,onFindVet:o,vet:s,onLayout:a}){let d=I(),l=react.useMemo(()=>Rh(d),[d]),u=El(t,r),c=u.answer!==null||u.pending!==null,p=r!==null&&u.answerable,y=_r(t.openedAt,vl(e));return jsxRuntime.jsxs(reactNative.View,{style:l.card,accessibilityLabel:he.eyebrow,onLayout:a,children:[jsxRuntime.jsxs(reactNative.View,{style:l.head,children:[jsxRuntime.jsx(v,{tier:"compact",style:l.eyebrow,children:he.eyebrow}),y!==null?jsxRuntime.jsx(v,{tier:"compact",style:l.headDay,children:j(he.day,{day:y})}):null]}),jsxRuntime.jsx(v,{style:l.question,accessibilityRole:"text",children:e.text}),p?jsxRuntime.jsx(reactNative.View,{style:[l.row,u.pending?l.rowPending:null],children:Cl.map(({answer:b,label:g})=>{let P=(u.pending??u.answer)===b;return jsxRuntime.jsx(reactNative.Pressable,{onPress:()=>u.choose(b),disabled:c,accessibilityRole:"button",accessibilityLabel:g,accessibilityState:{selected:P,disabled:c,busy:u.pending===b},style:[l.pill,P?l.pillSelected:null],children:jsxRuntime.jsx(v,{tier:"control",style:[l.pillLabel,P?l.pillLabelSelected:null],children:g})},b)})}):null,u.answer!==null?jsxRuntime.jsx(v,{style:l.logged,children:he.logged}):null,u.escalated?o!==void 0?jsxRuntime.jsx(reactNative.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:he.findVet,style:l.findVet,children:jsxRuntime.jsx(v,{tier:"control",style:l.findVetLabel,children:he.findVet})}):n?jsxRuntime.jsx(st,{entry:"chat",petRef:n,label:he.findVet,...s?.returnTo!==void 0?{returnTo:s.returnTo}:{},...s?.usState!==void 0?{usState:s.usState}:{},...s?.prefer!==void 0?{prefer:s.prefer}:{},style:l.findVet,labelStyle:l.findVetLabel}):null:null,t.resolutionText?jsxRuntime.jsx(v,{style:l.resolution,children:t.resolutionText}):null,u.error?jsxRuntime.jsx(v,{style:l.error,accessibilityRole:"alert",children:u.error.displayMessage}):null]})}i(wl,"CheckinCard");function Rh(e){let t=e.color,r=e.space,n=e.radius,o=e.type;return reactNative.StyleSheet.create({card:{maxWidth:"92%",padding:r.md,gap:r.sm,borderRadius:n.lg,backgroundColor:t.brandSoft,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},head:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},eyebrow:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},headDay:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},question:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},row:{flexDirection:"row",gap:r.sm,marginTop:r.xs},rowPending:{opacity:Eh},pill:{flex:1,minHeight:Tl,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,borderRadius:n.pill,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},pillSelected:{backgroundColor:t.brand,borderColor:t.brand},pillLabel:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body},pillLabelSelected:{color:t.onPrimary},logged:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption},resolution:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},error:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption},findVet:{alignSelf:"stretch",minHeight:Tl,alignItems:"center",justifyContent:"center",borderRadius:n.pill,borderWidth:1.5,borderColor:t.brandBorder,backgroundColor:t.surface},findVetLabel:{...C(e,"bold"),color:t.brandInk,fontSize:o.size.body}})}i(Rh,"makeStyles");var Ph=1.5,wh=3;function xl({text:e,runDueDays:t,openedAt:r,onLayout:n}){let o=I(),s=react.useMemo(()=>kh(o),[o]),a=t.map(l=>_r(r,l)).filter(l=>l!==null),d=t.length>1;return d&&a.length===0?null:jsxRuntime.jsxs(reactNative.View,{style:s.row,onLayout:n,children:[jsxRuntime.jsx(reactNative.View,{style:s.rule,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"}),jsxRuntime.jsxs(reactNative.View,{style:s.body,children:[a.length>0?jsxRuntime.jsx(v,{tier:"compact",style:s.days,children:a.map(l=>j(he.day,{day:l})).join(he.daySeparator)}):null,d?null:jsxRuntime.jsx(v,{style:s.question,accessibilityRole:"text",children:e})]})]})}i(xl,"CheckinPastAsk");function kh(e){let t=e.color,r=e.space,n=e.type;return reactNative.StyleSheet.create({row:{flexDirection:"row",paddingVertical:r.xs},rule:{width:Ph,borderRadius:1,backgroundColor:t.borderHairlineGreen,marginRight:r.md},body:{flex:1,gap:wh},days:{...C(e,"monoMedium"),fontSize:n.size.nano,letterSpacing:n.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},question:{...C(e,"regular"),fontSize:n.size.bodyTight,lineHeight:n.size.bodyTight*n.lineHeight.normal,color:t.text.muted}})}i(kh,"makeStyles");var xh=Object.freeze({TIER_1:"#07C168",TIER_2:"#27A9FF",TIER_3:"#FBC558"}),_l="#C8BEB4";function _h(e){return e?xh[e.toUpperCase()]??_l:_l}i(_h,"tierColor");function Ih(e){if(!e)return null;let t=/^tier[_\s-]?(\d+)$/i.exec(e.trim());return t?`Tier ${t[1]}`:e}i(Ih,"tierLabel");function we(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0?null:t}i(we,"text");function Ah(e){let t=we(e);return t!==null&&/^https:\/\/\S+$/i.test(t)?t:null}i(Ah,"httpsUrl");function Oh(e,t){let r=we(e.source_name)??we(e.sourceName),n=we(e.section),o=we(e.authority_tier)??we(e.authorityTier),s=Ih(o),a=r??we(e.title)??`Source ${t+1}`,d=we(e.monograph_chunk_id)??we(e.chunkId),l=[n,s].filter(u=>u!==null).join(" \xB7 ");return Object.freeze({title:a,sourceName:r,section:n,authorityTier:o,tierLabel:s,meta:l.length===0?null:l,url:Ah(e.url),excerpt:we(e.excerpt),tierColor:_h(o),key:`${a}-${d??"none"}-${t}`})}i(Oh,"toCitationCard");function Il(e){return e===void 0||e.length===0?Fh:Object.freeze(e.map((t,r)=>Oh(t,r)))}i(Il,"toCitationCards");var Fh=Object.freeze([]);function po(e){return e===1?`1 ${f.sourceSingular}`:`${e} ${f.sourcePlural}`}i(po,"sourcesLabel");function Al(e,t){return `${t?f.hideSources:f.showSources} ${po(e)}`}i(Al,"sourcesToggleLabel");function Ol(e){return [e.url!==null?`${f.openSource}: ${e.title}`:e.title,e.meta,e.excerpt].filter(t=>t!==null&&t.length>0).join(". ")}i(Ol,"citationA11yLabel");var Nh=244,Ml=8,Ll=13,Hh=14,Uh=.3,zh=-0.24,Bh=22,jh=10,Wh=15;function Dl({citations:e,onOpenUrl:t}){let r=I(),n=react.useMemo(()=>Yh(r),[r]),o=react.useMemo(()=>Il(e),[e]),[s,a]=react.useState(false);if(o.length===0)return null;let d=o.length;return jsxRuntime.jsxs(reactNative.View,{style:n.block,children:[jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:Al(d,s),accessibilityState:{expanded:s},containerStyle:n.toggleSlot,style:n.togglePill,onPress:()=>a(l=>!l),children:[jsxRuntime.jsx(Ts,{size:Ll,color:r.color.brandInk,strokeWidth:1.5}),jsxRuntime.jsx(v,{tier:"compact",style:n.toggleLabel,children:po(d)}),jsxRuntime.jsx(dr,{size:Ll,color:r.color.brandInk,strokeWidth:1.5,direction:s?"up":"down"})]}),s?jsxRuntime.jsx(Gh,{cards:o,styles:n,open:t}):null]})}i(Dl,"CitationCards");function Gh({cards:e,styles:t,open:r}){let n=G(),o=We(n.citationsInMs,{risePx:n.citationsRisePx});return jsxRuntime.jsx(reactNative.Animated.View,{style:o,children:jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,nestedScrollEnabled:true,showsHorizontalScrollIndicator:false,contentContainerStyle:t.row,children:e.map(s=>jsxRuntime.jsx(qh,{card:s,styles:t,open:r},s.key))})})}i(Gh,"Deck");function qh({card:e,styles:t,open:r}){let n=I(),o=e.url!==null&&r!==void 0,s=Ol(o?e:{...e,url:null}),a=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:t.cardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[t.tierDot,{backgroundColor:e.tierColor}]}),jsxRuntime.jsx(v,{style:[t.cardTitle,o?t.cardTitleLink:null],numberOfLines:2,children:e.title}),o?jsxRuntime.jsx(Ps,{size:Hh,color:n.color.linkInk,strokeWidth:1.5}):null]}),e.meta!==null?jsxRuntime.jsx(v,{tier:"compact",style:t.cardMeta,numberOfLines:1,children:e.meta}):null,e.excerpt!==null?jsxRuntime.jsx(v,{style:t.cardExcerpt,numberOfLines:3,children:e.excerpt}):null]});if(e.url!==null&&r!==void 0){let d=e.url;return jsxRuntime.jsx(N,{accessibilityRole:"link",accessibilityLabel:s,style:t.card,onPress:()=>r(d),children:a})}return jsxRuntime.jsx(reactNative.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:s,style:t.card,children:a})}i(qh,"Card");function Yh(e){let t=e.color,r=e.space,n=e.radius,o=e.type.size;return reactNative.StyleSheet.create({block:{gap:r.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:n.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:r.xs+2,paddingHorizontal:r.md,paddingVertical:r.xs+2,borderRadius:n.pill,backgroundColor:t.brandSoft},toggleLabel:{...C(e,"monoBold"),fontSize:o.micro,lineHeight:o.micro,letterSpacing:Uh,color:t.brandInk,textTransform:"uppercase"},row:{gap:r.sm,paddingRight:r.xl,paddingTop:r.xs},card:{width:Nh,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.md,gap:r.xs+2},cardHeader:{flexDirection:"row",alignItems:"center",gap:r.sm},tierDot:{width:Ml,height:Ml,borderRadius:n.pill},cardTitle:{...C(e,"bold"),flex:1,fontSize:o.bodyTight,lineHeight:Bh,color:t.text.primary,letterSpacing:zh},cardTitleLink:{color:t.linkInk},cardMeta:{...C(e,"monoMedium"),fontSize:o.nano,lineHeight:jh,letterSpacing:e.type.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},cardExcerpt:{...C(e,"regular"),fontSize:o.tiny,lineHeight:Wh,color:t.text.muted}})}i(Yh,"makeStyles");function Vl(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}i(Vl,"formatMessageTime");var Ft=15,Jh=15,eg=6,tg=Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function Bl({message:e,onCopy:t,sentiment:r=null,onSentiment:n,thanks:o=false}){let s=I(),a=react.useMemo(()=>rg(s),[s]),d=G(),l=e.role==="user",u=react.useMemo(()=>Vl(e.createdAt),[e.createdAt]),c=t!==void 0&&e.role!=="vet"&&e.text.length>0,p=e.role==="assistant"&&n!==void 0&&e.responseId!==void 0,[y,b]=react.useState(false),g=react.useRef(null);react.useEffect(()=>()=>{g.current&&clearTimeout(g.current);},[]);let P=i(()=>{t!==void 0&&(nt(t,e.text),b(true),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{b(false),g.current=null;},d.copiedMs));},"copy");return u===null&&!c&&!p?null:jsxRuntime.jsxs(reactNative.View,{style:a.wrap,children:[jsxRuntime.jsxs(reactNative.View,{style:[a.row,l?a.rowUser:a.rowAssistant],children:[u!==null?jsxRuntime.jsx(v,{tier:"compact",style:a.timestamp,children:u}):null,c?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:y?f.copied:l?f.copyUserMessage:f.copyAssistantMessage,hitSlop:Jh,onPress:P,style:a.iconHit,children:y?jsxRuntime.jsx(Le,{size:Ft,color:s.color.success,strokeWidth:2}):jsxRuntime.jsx(ws,{size:Ft,color:s.color.text.timestamp,strokeWidth:1.5})}):null,p?Io.map(({sentiment:E,label:S})=>jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:S,accessibilityState:{selected:r===E},hitSlop:eg,onPress:()=>n?.(E),style:a.iconHit,children:jsxRuntime.jsx(ur,{size:Ft,color:s.color.sentiment[E],active:r===E,rotate:tg[E],strokeWidth:1.5})},E)):null]}),o?jsxRuntime.jsx(v,{style:a.thanks,accessibilityLiveRegion:"polite",children:f.feedbackThanks}):null]})}i(Bl,"MessageFooter");function rg(e){let t=e.type;return reactNative.StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...C(e,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:e.color.text.timestamp,textAlign:"center"},iconHit:{width:Ft,height:Ft,alignItems:"center",justifyContent:"center"},thanks:{...C(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.text.secondary}})}i(rg,"makeStyles");var jl="#10462E",Wl="#000000",ng="#83E0B4",og=Object.freeze([Object.freeze({id:"breed-health-miss",intent:"send",label:"What {breed} health issue do owners miss most?",fallbackLabel:"What {species} health issue do owners miss most?",background:"#A0C4F6",borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:ng,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:jl,brandEdge:true,borderWidth:1}),Object.freeze({id:"vet-prep",intent:"vet_report",label:"Help me prep for {petName}\u2019s vet visit.",background:"#FFBDBD",borderColor:"#6D1D14",borderWidth:1.25})]),ig=/\s*-\s*(?:small|medium|large|giant|toy)\s*$/i;function sg(e){return e==null?e:e.replace(ig,"").trim()}i(sg,"formatBreedForPrompt");var ag=new Set(["","?","-","--",".","n/a","na","none","null","nil","unknown","unspecified","unsure","not sure","not specified","not applicable","no idea","dunno","idk","tbd","other","i dont know","i don't know","dont know","don't know","do not know","i do not know","not known","no clue"]);function lg(e){let t=String(e??"").replace(/\s+/gu," ").trim().toLowerCase().replace(/\u2019/g,"'");return ag.has(t)}i(lg,"isUninformativeBreed");function dg(e){return e==="cat"?"Domestic Short Hair Mix":"Mixed Breed"}i(dg,"unspecifiedBreedLabel");function ug(e,t){return lg(e)?dg(t):String(e).replace(/\s+/gu," ").trim()}i(ug,"resolveBreedLabel");function Gl(e){let t=e?.name?.trim()||f.emptyTitlePetFallback;return j(f.emptyTitle,{petName:t})}i(Gl,"emptyStateTitle");function ql(e,t=jl){let r=zn(e?.species),n=r==="cat"?"my cat":"my dog",o=e?.name?.trim()||null,s=o||n,a=ug(sg(e?.breed),r)||null,d=Bn(e?.ageYears),l=d===null?null:String(d);return Object.freeze(og.map(u=>{let c=u.label.includes("{breed}"),p=u.label.includes("{ageYears}"),b=u.fallbackLabel!==void 0&&(c&&!a||p&&!l)&&u.fallbackLabel?u.fallbackLabel:u.label,g=j(b,{petName:s,breed:a??n,species:r,ageYears:l??""}),P=!o&&b.startsWith("{petName}")?g.charAt(0).toUpperCase()+g.slice(1):g;return Object.freeze({id:u.id,intent:u.intent,label:P,background:u.background,borderColor:u.brandEdge===true?t:u.borderColor,borderWidth:u.borderWidth})}))}i(ql,"resolveQuickPrompts");var pg=36,$l=4,fg=340;function Xl({pet:e,petRef:t,onSend:r,onVetPrep:n,vet:o}){let s=I(),a=react.useMemo(()=>mg(s),[s]),d=react.useMemo(()=>ql(e,s.color.brandInk),[e,s.color.brandInk]),l=Gl(e);return jsxRuntime.jsxs(reactNative.View,{style:a.block,children:[jsxRuntime.jsx(v,{tier:"heading",style:a.title,accessibilityRole:"header",children:l}),jsxRuntime.jsx(reactNative.View,{style:a.list,children:d.map((u,c)=>jsxRuntime.jsx(yg,{prompt:u,index:c,petRef:t,onSend:r,onVetPrep:n,vet:o,pet:e,styles:a},u.id))})]})}i(Xl,"QuickPrompts");function yg({prompt:e,index:t,pet:r,petRef:n,onSend:o,onVetPrep:s,vet:a,styles:d}){let l=G(),u=We(l.followUpInMs,{delayMs:pr(l,t)}),c={backgroundColor:e.background,borderColor:e.borderColor,borderWidth:e.borderWidth};return e.intent==="vet_report"?s!==void 0?jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:$l,style:[d.chip,c],onPress:()=>{W(s,r);},children:jsxRuntime.jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})}):n===null?null:jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(st,{entry:"chat",petRef:n,label:e.label,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:[d.chip,c],labelStyle:d.chipLabel})}):jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:$l,style:[d.chip,c],onPress:()=>o(e.label),children:jsxRuntime.jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})})}i(yg,"Chip");function mg(e){let t=e.color;return reactNative.StyleSheet.create({block:{gap:18,alignItems:"center",width:"100%"},title:{...C(e,"bold"),fontSize:28,lineHeight:34,color:t.text.primary,letterSpacing:-0.8,textAlign:"center",maxWidth:fg},list:{width:"100%",gap:12,alignItems:"center"},chip:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:9,minHeight:pg,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipLabel:{...C(e,"bold"),fontSize:12,lineHeight:14,color:Wl,textAlign:"center"}})}i(mg,"makeStyles");var yo=/\*\*([^*]+?)\*\*|\*([^*]+?)\*|`([^`]+?)`/g;function Ql(e){return e.includes("*")||e.includes("`")}i(Ql,"hasInlineMarkup");function Zl(e){let t=[],r=0;yo.lastIndex=0;for(let n=yo.exec(e);n!==null;n=yo.exec(e)){n.index>r&&t.push({kind:"text",text:e.slice(r,n.index)});let o=n[1],s=n[2],a=n[3];o!==void 0?t.push({kind:"bold",text:o}):s!==void 0?t.push({kind:"italic",text:s}):a!==void 0&&t.push({kind:"code",text:a}),r=n.index+n[0].length;}return r<e.length&&t.push({kind:"text",text:e.slice(r)}),t}i(Zl,"tokenizeInlineMarkdown");function Jl(e,t){return Ql(e)?Zl(e).map((r,n)=>{switch(r.kind){case "bold":return jsxRuntime.jsx(v,{style:t.bold,children:r.text},n);case "italic":return t.italic?jsxRuntime.jsx(v,{style:t.italic,children:r.text},n):r.text;case "code":return t.code?jsxRuntime.jsx(v,{style:t.code,children:r.text},n):r.text;default:return r.text}}):e}i(Jl,"renderInlineMarkdown");var rd=6,id=520,Eg=Math.round(id*.18),nd=.44,Rg=.5,od=[0,.5,1],Sg=[0,1,2];function sd(){let e=I(),t=react.useMemo(()=>Pg(e),[e]),r=!e.motion.reducedMotion;return jsxRuntime.jsx(reactNative.View,{style:t.card,accessible:true,accessibilityRole:"text",accessibilityLabel:f.typing,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:Sg.map(n=>r?jsxRuntime.jsx(Tg,{index:n,style:t.dot},n):jsxRuntime.jsx(reactNative.View,{style:[t.dot,t.dotStatic]},n))})}i(sd,"TypingIndicator");function Tg({index:e,style:t}){let r=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{let s=reactNative.Animated.sequence([reactNative.Animated.delay(e*Eg),reactNative.Animated.loop(reactNative.Animated.timing(r,{toValue:1,duration:id,useNativeDriver:true}))]);return s.start(),()=>s.stop()},[r,e]);let n=r.interpolate({inputRange:od,outputRange:[nd,1,nd]}),o=r.interpolate({inputRange:od,outputRange:[0,-3.5,0]});return jsxRuntime.jsx(reactNative.Animated.View,{style:[t,{opacity:n,transform:[{translateY:o}]}]})}i(Tg,"AnimatedDot");function Pg(e){let t=e.color,r=e.space,n=e.radius;return reactNative.StyleSheet.create({card:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingHorizontal:r.md,paddingVertical:r.sm,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},dot:{width:rd,height:rd,borderRadius:n.pill,backgroundColor:t.brand},dotStatic:{opacity:Rg}})}i(Pg,"makeStyles");function ad(e,t,r){let n=e-r,o=t!=null?Math.min(n,t):n;return Math.max(0,o)}i(ad,"resolveTurnScrollTarget");function ld(e){let t=e.length-1,r=e[t];if(r===void 0||r.role!=="assistant")return null;let n=e[t-1];return {assistantIndex:t,userIndex:n!==void 0&&n.role==="user"?t-1:null}}i(ld,"latestTurn");function dd(e,t,r){let n=Math.max(0,r),o=e===null?n:Math.min(Math.max(0,e),n);return o>t+1?o:null}i(dd,"nextFollowOffset");function ud(e,t){let r=react.useRef(null),n=react.useRef(true),o=react.useRef(t),s=react.useRef(0),a=react.useRef(0),d=react.useRef(0),l=react.useRef(new Map),u=ld(e),c=u===null?null:e[u.assistantIndex]?.id??null,p=u===null||u.userIndex===null?null:e[u.userIndex]?.id??null,y=react.useCallback(()=>{let T=r.current;if(T===null||!n.current||a.current===0)return;let _=null;if(c!==null){let R=l.current.get(c);if(R===void 0)return;let O=p===null?null:l.current.get(p)??null;_=ad(R,O,96);}let m=dd(_,s.current,d.current-a.current);m!==null&&(s.current=m,T.scrollTo({y:m,animated:false}));},[c,p]);react.useEffect(()=>{t&&!o.current&&(n.current=true),o.current=t,y();},[e,t,y]);let b=react.useCallback(T=>{a.current=T.nativeEvent.layout.height,y();},[y]),g=react.useCallback((T,_)=>{d.current=_,a.current>0&&(s.current=Math.min(s.current,Math.max(0,_-a.current))),y();},[y]),P=react.useCallback(T=>{s.current=T.nativeEvent.contentOffset.y;},[]),E=react.useCallback(()=>{n.current=false;},[]),S=react.useCallback(T=>{let{contentOffset:_,contentSize:m,layoutMeasurement:R}=T.nativeEvent;s.current=_.y,n.current=m.height-_.y-R.height<=24;},[]),A=react.useCallback(T=>_=>{l.current.set(T,_.nativeEvent.layout.y),(T===c||T===p)&&y();},[c,p,y]);return {ref:r,onLayout:b,onContentSizeChange:g,onScroll:P,onScrollBeginDrag:E,onScrollEnd:S,rowLayout:A}}i(ud,"useThreadFollow");function md(e,t,r){switch(e){case "loading":return r.renderPending?jsxRuntime.jsx(Be,{render:r.renderPending,fallback:jsxRuntime.jsx(pd,{})}):jsxRuntime.jsx(pd,{});case "empty":return jsxRuntime.jsx(Fg,{pet:r.shownPet,petRef:t.petRef,onSelectPrompt:r.onSelectPrompt,onVetPrep:r.onVetPrep,vet:r.vet});case "error":return jsxRuntime.jsx(Dg,{error:t.error,onRetry:t.retryLast,onAddPet:r.onAddPet});case "populated":return jsxRuntime.jsx(Vg,{messages:t.messages,prompts:ls(t),onSelectPrompt:r.onSelectPrompt,isStreaming:t.isStreaming,onAnswerCheckin:t.petRef?t.answerCheckin:null,onCopy:r.onCopy,sentimentByMessage:t.sentimentByMessage,onSentiment:r.onSentiment,thanksFor:r.thanksFor,imagesByMessage:r.imagesByMessage,onPreview:r.onPreview,notice:r.notice,reconnecting:t.reconnecting===true,onRetry:t.retryLast,onStartNew:t.newConversation,petRef:t.petRef,onFindVet:r.onCheckinFindVet,vet:r.vet,onOpenUrl:r.onOpenUrl});default:return qt(e)}}i(md,"renderView");function pd(){let{theme:e,styles:t}=fe(),[r,n]=react.useState(false);return react.useEffect(()=>{let o=setTimeout(()=>n(true),pl);return ()=>clearTimeout(o)},[]),jsxRuntime.jsx(reactNative.View,{style:t.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:f.loading,children:r?jsxRuntime.jsx(reactNative.ActivityIndicator,{color:e.color.brandInk}):null})}i(pd,"LoadingState");function Fg({pet:e,petRef:t,onSelectPrompt:r,onVetPrep:n,vet:o}){let{styles:s}=fe();return jsxRuntime.jsx(reactNative.ScrollView,{contentContainerStyle:s.emptyContent,keyboardShouldPersistTaps:"handled",nestedScrollEnabled:true,accessibilityLabel:f.empty,children:jsxRuntime.jsx(Xl,{pet:e,petRef:t,onSend:r,onVetPrep:n,vet:o})})}i(Fg,"EmptyState");function Mg({prompts:e,onSelectPrompt:t}){let{styles:r}=fe();return e.length===0?null:jsxRuntime.jsx(reactNative.View,{style:r.followUps,children:e.map((n,o)=>jsxRuntime.jsx(Lg,{prompt:n,index:o,onSelectPrompt:t},n))})}i(Mg,"FollowUps");function Lg({prompt:e,index:t,onSelectPrompt:r}){let{theme:n,styles:o}=fe(),s=G(),a=We(s.followUpInMs,{delayMs:pr(s,t)});return jsxRuntime.jsx(reactNative.Animated.View,{style:a,children:jsxRuntime.jsxs(N,{onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:e,containerStyle:o.followUpSlot,style:o.followUpRow,children:[jsxRuntime.jsx(v,{style:o.followUpText,children:e}),jsxRuntime.jsx(dr,{size:zg,color:n.color.brandInk,direction:"right"})]})})}i(Lg,"FollowUpRow");function Dg({error:e,onRetry:t,onAddPet:r}){let{styles:n}=fe(),o=Li(e)?ji(r):void 0;return jsxRuntime.jsxs(reactNative.View,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{style:n.errorText,children:e.displayMessage}),o!==void 0?jsxRuntime.jsx(reactNative.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:f.addPet,style:n.retryButton,children:jsxRuntime.jsx(v,{tier:"control",style:n.retryLabel,children:f.addPet})}):null,e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:f.retry,style:n.retryButton,children:jsxRuntime.jsx(v,{tier:"control",style:n.retryLabel,children:f.retry})}):null]})}i(Dg,"ErrorState");function Vg({messages:e,prompts:t,onSelectPrompt:r,isStreaming:n,onAnswerCheckin:o,onCopy:s,sentimentByMessage:a,onSentiment:d,thanksFor:l,imagesByMessage:u,onPreview:c,notice:p,reconnecting:y,onRetry:b,onStartNew:g,petRef:P,onFindVet:E,vet:S,onOpenUrl:A}){let{styles:T}=fe(),_=G();Pt(e.length,_);let m=react.useMemo(()=>bl(e),[e]),R=as(e,n),O=e[e.length-1],F=react.useMemo(()=>e.filter(h=>!(h.checkin&&m.get(h.id)?.kind==="folded")),[e,m]),w=ud(F,n);return jsxRuntime.jsxs(reactNative.ScrollView,{ref:w.ref,style:T.list,contentContainerStyle:T.listContent,accessibilityLabel:f.transcript,keyboardShouldPersistTaps:"handled",nestedScrollEnabled:true,onLayout:w.onLayout,onContentSizeChange:w.onContentSizeChange,onScroll:w.onScroll,scrollEventThrottle:Ug,onScrollBeginDrag:w.onScrollBeginDrag,onScrollEndDrag:w.onScrollEnd,onMomentumScrollEnd:w.onScrollEnd,children:[e.map(h=>{let x=h.checkin?m.get(h.id):void 0;return x?.kind==="folded"?null:x?.kind==="past"?jsxRuntime.jsx(xl,{text:h.text,runDueDays:x.runDueDays,openedAt:h.checkin?.openedAt,onLayout:w.rowLayout(h.id)},h.id):h.checkin&&x!==void 0?jsxRuntime.jsx(wl,{message:h,checkin:h.checkin,onAnswer:o,petRef:P,onFindVet:E,vet:S,onLayout:w.rowLayout(h.id)},h.id):jsxRuntime.jsx(Bg,{onLayout:w.rowLayout(h.id),message:h,revealing:n&&h===O&&h.role==="assistant",onCopy:s,sentiment:h.responseId===void 0?null:a[String(h.responseId)]??null,onSentiment:d,thanks:l!==null&&h.responseId!==void 0&&String(h.responseId)===l,images:u[h.id]??Hg,onPreview:c,onOpenUrl:A},h.id)}),y?jsxRuntime.jsx(v,{tier:"compact",style:T.reconnectingCaption,accessibilityRole:"text",children:f.reconnecting}):null,R?jsxRuntime.jsx(sd,{}):null,p!==null?jsxRuntime.jsx(Ng,{notice:p,onRetry:b,onStartNew:g}):null,jsxRuntime.jsx(Mg,{prompts:t,onSelectPrompt:r})]})}i(Vg,"PopulatedState");function Ng({notice:e,onRetry:t,onStartNew:r}){let{styles:n}=fe(),o=e.tone==="error";return jsxRuntime.jsxs(reactNative.View,{style:[n.turnNotice,o?n.turnNoticeError:null],accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{tier:"control",style:[n.turnNoticeTitle,o?n.turnNoticeTitleError:null],children:e.title}),jsxRuntime.jsx(v,{tier:"compact",style:n.turnNoticeBody,children:e.body}),jsxRuntime.jsx(reactNative.Pressable,{onPress:e.action==="startNew"?r:t,accessibilityRole:"button",accessibilityLabel:e.actionLabel,hitSlop:dt,style:n.turnNoticeAction,children:jsxRuntime.jsx(v,{tier:"control",style:n.turnNoticeActionLabel,children:e.actionLabel})})]})}i(Ng,"TurnNoticeCard");var Hg=Object.freeze([]),Ug=16,zg=14;function Bg({message:e,revealing:t,onCopy:r,sentiment:n,onSentiment:o,thanks:s,images:a,onPreview:d,onOpenUrl:l,onLayout:u}){let{styles:c}=fe(),p=G(),y=We(p.messageInMs),b=js(e.text,t,p),g=e.role==="user",P=e.role==="vet",E=g?f.senderUser:P?ds(e):f.senderAssistant,S=react.useCallback(T=>o(e,T),[o,e]),A=e.pending!==true;return jsxRuntime.jsxs(reactNative.Animated.View,{style:[c.rowBlock,g?c.rowBlockUser:c.rowBlockAssistant,y],onLayout:u,children:[jsxRuntime.jsx(reactNative.View,{style:[c.row,g?c.rowUser:c.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${E}: ${e.text}`,accessibilityState:e.pending===true?{busy:true}:void 0,children:jsxRuntime.jsxs(reactNative.View,{style:[c.bubble,g?c.bubbleUser:P?c.bubbleVet:c.bubbleAssistant,e.pending?c.bubblePending:null],children:[g&&a.length>0?jsxRuntime.jsx(la,{images:a,onPreview:T=>d({uri:T.uri,label:T.filename})}):null,P?jsxRuntime.jsx(v,{style:c.vetSender,children:E}):null,jsxRuntime.jsx(v,{style:g?c.bubbleTextUser:P?c.bubbleTextVet:c.bubbleTextAssistant,children:e.role==="assistant"?Jl(b,{bold:c.bubbleBold,italic:c.bubbleItalic,code:c.bubbleCode}):e.text})]})}),e.role==="assistant"&&!t?jsxRuntime.jsx(Dl,{citations:e.citations,onOpenUrl:l}):null,A?jsxRuntime.jsx(Bl,{message:e,onCopy:r,sentiment:n,onSentiment:e.responseId===void 0?void 0:S,thanks:s}):null]})}i(Bg,"MessageRow");var Yg=Object.freeze(["photo"]),Kg=1;function $g(e){let{style:t,renderPending:r}=e;return jsxRuntime.jsx(hs,{capability:"chat",style:t,...r?{renderPending:r}:{},children:jsxRuntime.jsx(Xg,{...e})})}i($g,"EverfurChat");function Xg({petRef:e,conversationId:t,style:r,renderPending:n,onCopy:o,onPetChange:s,onVetPrep:a,onFindVet:d,renderVetAction:l,attachments:u,pet:c,onAddPet:p,checkinTarget:y,initialAsk:b,composerSeed:g,lifecycle:P,draftStore:E,vetReturnTo:S,vetUsState:A,vetPrefer:T,onOpenUrl:_,keyboardVerticalOffset:m}){let{theme:R,styles:O}=fe(),F=G(),w=react.useMemo(()=>us(e,t),[e,t]),h=Bt(w),x=is(h),D=sl(),U=es(h),z=reactNativeSafeAreaContext.useSafeAreaInsets(),Z=ss(h),le=react.useMemo(()=>d===void 0?void 0:()=>{W(d,"emergency");},[d]),be=react.useMemo(()=>S===void 0&&A===void 0&&T===void 0?void 0:{returnTo:S,usState:A,prefer:T},[S,A,T]),Ne=Xn(D.pets,h.petRef),oe=react.useMemo(()=>ns(h.messages,Ne?.name??null),[h.messages,Ne?.name]),Fe=os(oe);Pt(Fe.showBanner,F),Yi(h.openCheckin,y),Ui(h.askEverfur,h.isBootstrapping,b);let Dt=react.useMemo(()=>nn(g),[g]);Gi(P,{conversationId:h.conversationId===null?null:String(h.conversationId),isTurnInFlight:h.isStreaming,refresh:h.refreshActiveThread});let Vt=(h.hasUnreadThreads??false)||U.rows.some(ye=>ye.unreadCount!==null&&ye.unreadCount>0)||(h.unreadCount??0)>0,Je=Ni(h.messages),[ft,Mr]=react.useState(null),bd=react.useCallback(()=>Mr(null),[]),[yt,Lr]=react.useState(null),[vd,go]=react.useState(null),et=react.useRef(null);react.useEffect(()=>()=>{et.current&&clearTimeout(et.current);},[]);let bo=react.useCallback(ye=>{go(String(ye)),et.current&&clearTimeout(et.current),et.current=setTimeout(()=>{go(null),et.current=null;},fl);},[]),Cd=react.useCallback((ye,Ht)=>{let mt=ye.responseId;if(mt===void 0)return;let wd=h.sentimentByMessage[String(mt)];h.feedback(mt,Ht),Ht==="down"&&wd!=="down"&&Lr(mt);},[h]),Ed=react.useCallback(async(ye,Ht)=>yt===null||!(await h.feedback(yt,"down",ye??"other",Ht)).ok?false:(Lr(null),bo(yt),true),[h,yt,bo]),Rd=react.useCallback(()=>Lr(null),[]),Sd=react.useCallback(ye=>{h.send(ye);},[h.send]),Td=react.useMemo(()=>_===void 0?void 0:ye=>{W(_,ye,"citation");},[_]),vo=reactNative.Platform.OS==="ios"?"padding":void 0,Nt=el(m,vo!==void 0),Pd=Nt.topInWindow===null?z.top:Math.max(0,z.top-Nt.topInWindow),Co={send:h.send,stop:h.stop,isStreaming:h.isStreaming,conversationId:h.conversationId,seed:Dt,draftStore:E,onStage:Je.stage,onPreview:Mr};return jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:[O.container,{paddingTop:Pd},r],behavior:vo,...Nt.avoidingProps,children:[jsxRuntime.jsx(tl,{probeRef:Nt.probeRef}),jsxRuntime.jsx(qa,{pets:D,petRef:h.petRef,historyUnread:Vt,onOpenHistory:U.show,onPetChange:s,onAddPet:p,vet:be}),c!==void 0?jsxRuntime.jsx(Qg,{petRef:e??null,pet:c,onRegistered:D.refresh}):null,jsxRuntime.jsx(il,{surface:Fe,petRef:h.petRef,renderVetAction:l,onFindVet:d,vet:be}),jsxRuntime.jsx(reactNative.View,{style:O.body,children:md(x,h,{notice:Z,vet:be,onCheckinFindVet:le,onSelectPrompt:Sd,renderPending:n,shownPet:Ne,onVetPrep:a,onCopy:o,onSentiment:Cd,thanksFor:vd,imagesByMessage:Je.byMessage,onPreview:Mr,onAddPet:p,onOpenUrl:Td})}),u!==void 0?jsxRuntime.jsx(Zg,{...Co,attachments:u}):jsxRuntime.jsx(gd,{...Co,attachments:null}),jsxRuntime.jsx(Cs,{}),R.meta.hidePoweredBy?null:jsxRuntime.jsx(v,{tier:"compact",style:O.poweredBy,accessibilityRole:"text",accessibilityLabel:f.poweredBy,children:f.poweredBy}),jsxRuntime.jsx(Ja,{chat:h,history:U}),jsxRuntime.jsx(Za,{visible:yt!==null,onSubmit:Ed,onSkip:Rd}),jsxRuntime.jsx(Ws,{uri:ft?.uri??null,label:ft?.label??"",onClose:bd}),jsxRuntime.jsx(kt,{})]})}i(Xg,"ChatBody");function Qg({petRef:e,pet:t,onRegistered:r}){let{styles:n}=fe(),o=Di(e,t,r);return o.status!=="failed"||o.error===null?null:jsxRuntime.jsxs(reactNative.View,{style:n.setupNotice,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{tier:"compact",style:n.setupNoticeText,children:o.error.displayMessage}),jsxRuntime.jsx(reactNative.Pressable,{onPress:o.retry,accessibilityRole:"button",accessibilityLabel:f.retry,hitSlop:dt,children:jsxRuntime.jsx(v,{tier:"control",style:n.setupNoticeAction,children:f.retry})})]})}i(Qg,"PetSetupNotice");function Zg({attachments:e,...t}){let r=react.useMemo(()=>In(),[]),n=Xr({maxPerMessage:e.maxPerMessage??Kg,transport:r}),o=react.useMemo(()=>({state:n,sources:e.sources??Yg,pick:e.pick}),[n,e.sources,e.pick]);return jsxRuntime.jsx(gd,{...t,attachments:o})}i(Zg,"ComposerWithAttachments");function gd({send:e,stop:t,isStreaming:r,conversationId:n,attachments:o,seed:s,draftStore:a,onStage:d,onPreview:l}){let{theme:u,styles:c}=fe(),p=G(),[y,b]=Xi(e,n,s);Qi(a,n===null?null:String(n),y,b);let[g,P]=react.useState(false),[E,S]=react.useState(false);react.useEffect(()=>{S(false);},[n]);let A=u.meta.placeholder??f.placeholder,T=o?.state.uploading??false,_=o?.state.failed??false,m=T||_,R=o?.state.attachments??Jg;Pt(R.length,p);let O=react.useCallback(()=>{if(y.trim().length===0||m||[...y].length>Xt)return;let z=o?.state.s3Keys??eb;o!==null&&z.length>0?(d(o.state.attachments.filter(Z=>Z.status==="uploaded").map(Z=>({uri:Z.previewUri,filename:Z.filename}))),e(y,{imageS3Keys:z}),o.state.clear()):e(y),b(""),S(false);},[y,e,m,o,d]),F=react.useCallback(()=>{t();},[t]),w=react.useCallback(z=>{P(false),o!==null&&(S(false),o.state.dismissRejected(),nt(o.pick,z).then(Z=>{if(!Z.ok){S(true);return}Z.value!==null&&o.state.add(Z.value);}));},[o]),x=react.useMemo(()=>[...y].length>Xt,[y])||m,D=o!==null&&R.length>=o.state.maxPerMessage,U=u.slots.sendButton?.textColor??u.color.brandInk;return jsxRuntime.jsxs(reactNative.View,{style:c.composerOuter,children:[o!==null&&g?jsxRuntime.jsx(Ys,{sources:o.sources,full:D,onPick:w,onClose:()=>P(false)}):null,jsxRuntime.jsxs(reactNative.View,{style:c.composer,children:[o!==null?jsxRuntime.jsx(aa,{attachments:R,rejected:E?tb:o.state.rejected,uploadFailed:_,onRetry:o.state.retry,onRemove:o.state.remove,onPreview:z=>l({uri:z.previewUri,label:z.filename})}):null,jsxRuntime.jsxs(reactNative.View,{style:c.composerRow,children:[o!==null?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:li(R.length,o.state.maxPerMessage),accessibilityState:{disabled:D,expanded:g},disabled:D,hitSlop:(lt-xr)/2,style:[c.attachControl,D?c.attachControlDisabled:null],onPress:()=>P(z=>!z),children:jsxRuntime.jsx(xs,{size:hl,color:D?u.color.text.muted:u.color.brandInk,strokeWidth:1.75})}):null,jsxRuntime.jsx(tt,{style:c.input,value:y,onChangeText:b,placeholder:A,placeholderTextColor:u.slots.composerInput?.textColor??u.color.text.placeholder,onSubmitEditing:O,returnKeyType:"send",blurOnSubmit:false,multiline:true,editable:true}),r?jsxRuntime.jsx(reactNative.Pressable,{onPress:F,accessibilityRole:"button",accessibilityLabel:f.stop,hitSlop:dt,style:c.sendControl,children:jsxRuntime.jsx(reactNative.View,{style:c.sendDisc,testID:"everfur-stop-disc",children:jsxRuntime.jsx(Ls,{size:ml,color:U,testID:"everfur-stop-glyph"})})}):jsxRuntime.jsx(reactNative.Pressable,{onPress:O,disabled:x,accessibilityRole:"button",accessibilityLabel:f.send,accessibilityState:{disabled:x,busy:T},hitSlop:dt,style:[c.sendControl,x?c.sendControlDisabled:null],children:jsxRuntime.jsx(reactNative.View,{style:c.sendDisc,testID:"everfur-send-disc",children:jsxRuntime.jsx(Ms,{size:yl,color:U,testID:"everfur-send-glyph"})})})]})]})]})}i(gd,"Composer");var Jg=Object.freeze([]),eb=Object.freeze([]),tb=Object.freeze({code:"unknown",retryable:true,filename:""});exports.EverfurChat=$g;exports.createRnChatAttachmentTransport=In;exports.useChatAttachments=Xr;exports.useEverfurChat=Bt;exports.useEverfurPets=On;
|
|
1
|
+
'use strict';var react=require('react'),reactNative=require('react-native'),reactNativeSafeAreaContext=require('react-native-safe-area-context'),jsxRuntime=require('react/jsx-runtime');var Ad=Object.defineProperty;var i=(e,t)=>Ad(e,"name",{value:t,configurable:true});var Vr=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(Vr.map(e=>e.wireCode));var Od=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),Ro=Object.freeze(Vr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Od[e.wireCode]}))),Fd=new Map(Ro.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Md=Object.freeze(["http_envelope",...[...new Set(Ro.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function zt(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...Md]){let o=Fd.get(n+r);if(o)return o}}i(zt,"contractErrorFor");function Ld(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(Ld,"contractDocUrl");function So(e){return null}i(So,"publishedDocUrl");var Dd=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function To(e){return Dd[e]}i(To,"categoryFor");function Po(e){let t=zt(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":case "TELEVETRATELIMITED":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}i(Po,"fromWire");var Vd=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Nr(e){return Vd.has(e)}i(Nr,"isAutoRetryable");var Nd=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function wo(e){return Nr(e)||Nd.has(e)}i(wo,"isRetryableCode");var Hd=500,Hr=8e3,ko=4;function xo(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Hd*2**r,Hr);return Math.floor(t()*n)}i(xo,"backoffDelayMs");var Ud=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function Ur(e){return Ud[e]}i(Ur,"userFacingError");function _o(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(_o,"defineHidden");var zd=/^[a-z][a-z0-9_]{0,63}$/;function q(e,t){let r=zt(t?.wireCode,t?.wireEnvelope),n={code:e,category:To(e),retryable:t?.retryable??wo(e),displayMessage:Ur(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&zd.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&_o(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&_o(n,"raw",t.raw),Object.freeze(n)}i(q,"makeEverfurError");function de(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(de,"ok");function V(e){return Object.freeze({ok:false,error:e})}i(V,"err");var Bt=class Bt extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Bt.prototype);}};i(Bt,"EverfurConfigError");var ht=Bt;var f=Object.freeze({placeholder:"Ask me anything!",send:"Send",stop:"Stop",retry:"Try again",followUps:"Helpful follow-ups",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",typing:"Assistant is typing",loading:"Loading",empty:"No messages yet",transcript:"Conversation",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting\u2026",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openMenu:"Open menu",openMenuUnread:"Open menu, unread chats",yourPets:"Your Pets",yourPet:"Your pet",switchActivePet:"Switch active pet, {name}",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active \xB7 ",close:"Close",addAnotherPet:"Add another pet",addPet:"Add a pet",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function j(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>{let o=t[n];return o===void 0?r:String(o)})}i(j,"fillCopy");var zr=Object.freeze([Object.freeze({key:"inaccurate",label:f.feedbackReasonInaccurate,feedbackType:"wrong"}),Object.freeze({key:"outdated",label:f.feedbackReasonOutdated,feedbackType:"outdated"}),Object.freeze({key:"unsafe",label:f.feedbackReasonUnsafe,feedbackType:"dangerous"}),Object.freeze({key:"unclear",label:f.feedbackReasonUnclear,feedbackType:"unclear"}),Object.freeze({key:"other",label:f.feedbackReasonOther,feedbackType:"not_helpful"})]),Io=Object.freeze([Object.freeze({sentiment:"up",label:f.feedbackHelpful}),Object.freeze({sentiment:"neutral",label:f.feedbackNeutral}),Object.freeze({sentiment:"down",label:f.feedbackNotHelpful})]);function Bd(e){switch(e){case "up":return "helpful";case "neutral":return "neutral";case "down":return "not_helpful"}}i(Bd,"sentimentToFeedbackType");function Ao(e,t){if(e==="down"&&t!==null){let r=zr.find(n=>n.key===t);if(r!==void 0)return r.feedbackType}return Bd(e)}i(Ao,"feedbackTypeFor");var Oo=Symbol.for("@everfur/sdk#EverfurContext@v1"),Fo=globalThis,Mo=Fo[Oo]??(Fo[Oo]=react.createContext(null));Mo.displayName??="EverfurContext";function ie(){let e=react.useContext(Mo);if(e===null)throw new ht("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(ie,"useEverfurContext");var Kd=Object.freeze({status:"idle",messages:Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:Object.freeze([]),unreadCount:null});function jt(e){let{runtime:t,userRef:r,activePet:n,scopeEpoch:o}=ie(),s=e?.petRef??n??null,a=e?.conversationId??null,d=react.useMemo(()=>({runtime:t,userRef:r,petRef:s,conversationId:a,scopeEpoch:o}),[t,r,s,a,o]),[l,u]=react.useState(null),c=l?.scope===d?l.controller:t.registry.peekChat({userRef:r,petRef:s,conversationId:a}),p=react.useRef(null);react.useEffect(()=>{let w=t.registry.acquireChat({userRef:r,petRef:s,conversationId:a});return p.current=w,u({scope:d,controller:w}),()=>{p.current=null,u(g=>g?.controller===w?null:g),t.registry.releaseChat(w);}},[t,r,s,a,o,d]);let y=react.useCallback(w=>c?c.subscribe(w):$d,[c]),b=react.useCallback(()=>c?c.getSnapshot():Kd,[c]),h=react.useSyncExternalStore(y,b,b),P=react.useCallback((w,g)=>c&&p.current===c&&!c.getSnapshot().isBootstrapping?jr(c,c.send(w,g?.imageS3Keys===void 0?{}:{imageS3Keys:g.imageS3Keys}),()=>p.current===c):Promise.resolve(Wr()),[c]),E=react.useCallback(w=>c&&p.current===c&&!c.getSnapshot().isBootstrapping?jr(c,c.askEverfur(w),()=>p.current===c):Promise.resolve(Wr()),[c]),S=react.useCallback(()=>c&&p.current===c?jr(c,c.retryLast(),()=>p.current===c):Promise.resolve(Wr()),[c]),A=react.useCallback(()=>{c&&p.current===c&&c.stop();},[c]),T=react.useCallback(()=>{c&&p.current===c&&c.newConversation();},[c]),[_,m]=react.useState({controller:null,byMessage:{}}),R=_.controller===c?_.byMessage:Xd,O=react.useCallback(async(w,g,x,D)=>{if(!c||p.current!==c)return V(q("accessDenied"));let U=String(w),z=_.controller===c?_.byMessage[U]:void 0;if(z===g&&x==null)return m(le=>{let be={...le.controller===c?le.byMessage:{}};return delete be[U],{controller:c,byMessage:be}}),de(Object.freeze({feedbackId:""}));m(le=>({controller:c,byMessage:{...le.controller===c?le.byMessage:{},[U]:g}}));let Z=await c.submitFeedback(w,Ao(g,x??null),D??null);return p.current!==c?V(q("accessDenied")):(Z.ok||m(le=>{let be={...le.controller===c?le.byMessage:{}};return z===void 0?delete be[U]:be[U]=z,{controller:c,byMessage:be}}),Z)},[c,_]),F=react.useMemo(()=>{let w=i(async g=>{if(!c||p.current!==c)return V(q("accessDenied"));let x=await g(c);return p.current===c?x:V(q("accessDenied"))},"run");return {listConversations:i(g=>w(x=>x.listConversations({...s?{petRef:s}:{},...g})),"listConversations"),getMessages:i((g,x)=>w(D=>D.getMessages(g,x)),"getMessages"),resumeConversation:i(g=>w(x=>x.resumeConversation(g)),"resumeConversation"),loadOlderMessages:i(()=>w(g=>g.loadOlderMessages()),"loadOlderMessages"),markRead:i(()=>w(g=>g.markRead()),"markRead"),refreshActiveThread:i(()=>w(g=>g.refreshActiveThread()),"refreshActiveThread"),answerCheckin:i((g,x)=>w(D=>D.answerCheckin(g,x)),"answerCheckin"),openCheckin:i(g=>w(x=>x.openCheckin(g)),"openCheckin")}},[c,s]);return react.useMemo(()=>({status:h.status,messages:h.messages,conversationId:h.conversationId,petRef:s,error:h.error,isStreaming:h.isStreaming,isBootstrapping:h.isBootstrapping,historyCursor:h.historyCursor??null,isLoadingHistory:h.isLoadingHistory??false,stopped:h.stopped??false,reconnecting:h.reconnecting??false,...F,suggestedPrompts:h.suggestedPrompts,unreadCount:h.unreadCount,hasUnreadThreads:h.hasUnreadThreads??false,newConversation:T,sentimentByMessage:R,feedback:O,send:P,askEverfur:E,retryLast:S,stop:A}),[h,s,P,E,S,A,F,T,R,O])}i(jt,"useEverfurChat");var $d=i(()=>{},"NOOP_UNSUBSCRIBE"),Xd=Object.freeze({});async function jr(e,t,r){for await(let o of t);if(!r())return V(q("accessDenied"));let n=e.getSnapshot();return n.status==="error"&&n.error!==null?V(n.error):de(Qd(n.messages))}i(jr,"driveToResult");function Qd(e){for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r&&r.role==="assistant"&&r.responseId!==void 0)return r.responseId}return null}i(Qd,"lastAssistantResponseId");function Wr(){return V(q("internalError",{retryable:true}))}i(Wr,"notReadyError");function Gr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))Gr(e[t]);}return e}i(Gr,"deepFreeze");var Zd=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Vo={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},No={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Do={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Jd={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},eu={regular:"400",medium:"500",bold:"700"},tu={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},ru=0,Wt="System",Gt="monospace",nu=["content","heading","control","compact","badge"];function ou(e){let t={};for(let r of nu)t[r]=e;return t}i(ou,"authoredTierSizes");function Ho(){return {family:Wt,mono:Gt,fontUrl:null,families:{regular:Wt,medium:Wt,bold:Wt,mono:Gt,monoMedium:Gt,monoBold:Gt},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Do,tierSizes:ou(Do),lineHeight:Jd,weight:eu,letterSpacing:tu,scale:1,maxScale:ru,scaleCaps:Zd}}i(Ho,"baseType");var Uo={},He=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function qt(e){return `cubic-bezier(${e.join(", ")})`}i(qt,"cssCubicBezier");var zo={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:qt(He.standard),emphasized:qt(He.emphasized),exit:qt(He.exit)},reducedMotion:false},iu={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",onDanger:"#FFFFFF",errorRed:"#CC1600",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#111111",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},tt=Gr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:iu,space:Vo,radius:No,type:Ho(),motion:zo,slots:Uo}),su={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#111111",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"},Bo=Gr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:su,space:Vo,radius:No,type:Ho(),motion:zo,slots:Uo});var jo=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Wo=globalThis,qr=Wo[jo]??(Wo[jo]=react.createContext(tt));qr.displayName??="EverfurThemeContext";function I(){return react.useContext(qr)}i(I,"useEverfurTheme");function pu(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(pu,"tierMultiplier");function v({tier:e="content",...t}){let{type:r}=I(),n=pu(r,e);return react.createElement(reactNative.Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}i(v,"Text");var rt=react.forwardRef(i(function(t,r){return react.createElement(reactNative.TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));function Yt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(Yt,"assertNever");function qo(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}i(qo,"errorFrame");function mu(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}i(mu,"authHeaders");function bt(e,t){return {...e,headers:{...gu(e.headers),...mu(t)}}}i(bt,"withAuthHeaders");function gu(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();o==="authorization"||o==="x-everfur-partner-key"||(t[r]=n);}return t}i(gu,"stripAuthHeaders");async function Yo(e,t){if(t.mode==="anonymous")return t.transport.request(bt(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return V(Yr())}let n=await t.transport.request(bt(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let o;try{o=await t.identity.currentToken({forceRefresh:!0});}catch{return V(Yr())}let s=await t.transport.request(bt(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?V(Yr(s.error.httpStatus)):s}i(Yo,"authedSend");function Yr(e){return q("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(Yr,"authRejectedError");function Ko(e){return q("internalError",{retryable:true,wireMessage:hu(e)})}i(Ko,"networkError");function hu(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i(hu,"describeCause");var bu=3e4,vu=Hr*2,Cu="idempotency-key",Eu=new Set(["POST","PUT","PATCH","DELETE"]),Ru=Object.freeze({onEvent(){}}),Su=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Tu(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}i(Tu,"seededIdempotencyKey");function Ue(e){let t=e.observer??Ru,r=e.timers??Su,n=e.rng??Math.random,o=e.sleep??((y,b)=>Nu(y,r,b)),s=e.maxAttempts??ko,a=e.unaryTimeoutMs??bu,d=e.newIdempotencyKey??wu(),l=i(y=>{try{t.onEvent(y);}catch{}},"emit");async function u(y,b,h){let P=h?.maxAttempts,E=Math.max(1,P??s),S=h?.idempotent??Eu.has(b.method),A=h?.idempotencyKey===void 0?null:Tu(h.idempotencyKey),T=S?A??d():null,_=Pu(b,T),m=0;for(;;){let R=i(U=>Object.freeze({call:y,method:b.method,path:b.path,attempt:m,...T?{idempotencyKey:T}:{},...U}),"stamp");l(R({phase:"attempt"}));let O=Du(a,r),F=Vu(O.signal,b.signal),w;try{w=await Yo({..._,signal:F.signal},e.auth);}catch(U){w=V(Ko(U));}finally{F.dispose(),O.cancel();}if(w.ok)return l(R({phase:"settled",ok:true,reason:"ok"})),w;let g=w.error,x=xu(g,m,{maxAttempts:E,rng:n,now:r.now(),aborted:b.signal?.aborted===true,...P!==void 0?{perCallMaxAttempts:P}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),D={ok:false,code:g.code,reason:x.reason,...g.httpStatus!==void 0?{httpStatus:g.httpStatus}:{},...g.requestId!==void 0?{requestId:g.requestId}:{}};if(!x.retry)return l(R({phase:"settled",...D})),V(g);if(l(R({phase:"retry",...D,delayMs:x.delayMs})),await o(x.delayMs,b.signal),b.signal?.aborted===true)return l(R({phase:"settled",...D,reason:"aborted"})),V(g);m+=1;}}i(u,"send");async function c(y){return bt(y,await Lu(e.auth))}i(c,"authorize");async function*p(y,b,h){l(Object.freeze({call:y,phase:"stream.open",method:b.method,path:b.path,attempt:0}));try{yield*e.auth.transport.stream(b,h);}catch{yield qo({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(p,"stream"),Object.freeze({send:u,authorize:c,stream:p})}i(Ue,"createRequestFunnel");function Pu(e,t){let r={};for(let[n,o]of Object.entries(e.headers??{}))n.toLowerCase()!==Cu&&(r[n]=o);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(Pu,"assembleHeaders");function wu(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(wu,"defaultIdempotencyKeyFactory");var ku=10;function xu(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=_u(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!Nr(e.code))return {retry:false,reason:"terminal-code"};let o=n==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let a=i(()=>{if(r.policy===void 0)return null;let u;try{u=r.policy.maxAttempts(e.code);}catch{return null}return typeof u!="number"||!Number.isFinite(u)?null:Math.max(1,Math.min(ku,Math.floor(u)))},"policyCeiling"),d=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=d)return {retry:false,reason:"attempts-exhausted"};let l=Iu(e,r.now);return l!==null?l>vu?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:o,delayMs:l}:{retry:true,reason:o,delayMs:xo(t,r.rng)}}i(xu,"decideRetry");function _u(e){let t=e.code==="unknown"?Po(Mu(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(_u,"throttleKind");function Iu(e,t){let r=Ou(e.raw);if(r!==null){let o=r-t;return o>0?o:0}let n=Au(e.raw);return n===null?null:Math.round(n*1e3)}i(Iu,"retryOverrideMs");function Au(e){for(let t of Kr(e)){let r=t.retry_after_seconds;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r}return null}i(Au,"findRetryAfterSeconds");function Ou(e){for(let t of Kr(e)){let r=t.resets_at,n=Fu(r);if(n!==null)return n}return null}i(Ou,"findResetsAt");function Kr(e){if(!$o(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];$o(n)&&t.push(n);}return t}i(Kr,"candidateScopes");function Fu(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}i(Fu,"parseInstantMs");function Mu(e){for(let t of Kr(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(Mu,"rawWireCode");function $o(e){return typeof e=="object"&&e!==null}i($o,"isRecord");async function Lu(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}i(Lu,"resolveDeviceAuth");function Du(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(n),"cancel")}}i(Du,"boundedSignal");function Vu(e,t){let r=i(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let o=i(()=>n.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),{signal:n.signal,dispose:i(()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o);},"dispose")}}i(Vu,"mergeSignals");function Nu(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let o=t.setTimeout(()=>{r?.removeEventListener("abort",s),n();},e),s=i(()=>{t.clearTimeout(o),n();},"onAbort");r?.addEventListener("abort",s,{once:true});})}i(Nu,"delayAbortable");function Kt(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(Kt,"hasLoneSurrogate");function $t(e){return [...e].length}i($t,"serverLength");var Xo=Object.freeze(["better","same","worse"]),Qo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var Zo=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Jo(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let o={handle:void 0},s=i(()=>{r.clearTimeout(o.handle),t.removeEventListener("abort",s),n();},"done");o.handle=r.setTimeout(s,e),t.addEventListener("abort",s,{once:true});})}i(Jo,"delayAbortable");var Hu="checkin",Uu=/^\d{4}-\d{2}-\d{2}$/,zu="watching";function ei(e){return e.status!=null&&e.status!==zu}i(ei,"isCheckinSettled");function ti(e){if(typeof e!="string")return null;let t=e.split(":");if(t.length!==3)return null;let[r,n,o]=t;return r!==Hu||n===void 0||o===void 0||!Qo.test(n)||!Uu.test(o)?null:{caseId:n,dueDay:o}}i(ti,"parseCheckinOrigin");var Xt=4e3;var Qt=4e3;var Wu=Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function ri(e){return e!==Wu}i(ri,"isUploadTransportAvailable");var Gu=Object.freeze(["image/jpeg","image/jpg","image/png","image/heic","image/heif","image/webp"]);var Zt=10*1024*1024,Jt=5,vt=120,qu="/widget/v1/uploads/initiate";function Yu(e){return typeof e=="string"&&Gu.includes(e.trim().toLowerCase())}i(Yu,"isAttachmentMime");function $r(e){if(!e)return "attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return "attachment";if(t.length<=vt)return t;let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return t.slice(0,vt);let n=t.slice(r);return n.length>=vt?t.slice(0,vt):`${t.slice(0,r).slice(0,vt-n.length)}${n}`}i($r,"sanitizeFilename");function Xr(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}i(Xr,"formatBytes");var Ct=i(e=>Object.freeze({ok:true,value:e}),"ok"),ve=i(e=>Object.freeze({ok:false,error:e}),"err");function J(e,t,r,n){return Object.freeze({code:e,retryable:t,filename:r,...n??{}})}i(J,"failure");function Ku(e){if(typeof e.sizeBytes=="number"&&Number.isFinite(e.sizeBytes)&&e.sizeBytes>=0)return e.sizeBytes;let t=e.blob;return t!==void 0&&typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}i(Ku,"attachmentSize");function $u(e){let t=$r(e.name),r=typeof e.mimeType=="string"?e.mimeType.trim().toLowerCase():"";if(!Yu(r))return ve(J("unsupported_type",false,t));let n=Ku(e);return n===null?ve(J("unknown",false,t)):n>Zt?ve(J("too_large",false,t,{sizeBytes:n})):Ct(Object.freeze({file:e,filename:t,contentType:r,sizeBytes:n}))}i($u,"validateAttachment");function Xu(e){if(typeof e!="object"||e===null)return null;let t=e,r=i(u=>typeof u=="string"&&u.length>0?u:null,"str"),n=i(u=>typeof u=="number"&&Number.isFinite(u)?u:null,"num"),o=r(t.upload_id),s=r(t.upload_url),a=r(t.s3_key);if(o===null||s===null||a===null)return null;let d={},l=t.upload_fields;if(typeof l=="object"&&l!==null)for(let[u,c]of Object.entries(l))typeof c=="string"&&(d[u]=c);return Object.freeze({upload_id:o,upload_url:s,upload_fields:Object.freeze(d),expires_in_seconds:n(t.expires_in_seconds)??0,max_content_length:n(t.max_content_length)??Zt,s3_key:a,purpose:r(t.purpose)})}i(Xu,"parsePolicy");function Qu(e,t){let r=e.httpStatus;switch(e.code){case "quotaExceeded":return J("quota_exceeded",false,t,{cause:e});case "rateLimited":return J("rate_limited",true,t,{cause:e});case "idempotencyConflict":case "idempotencyInFlight":return J("idempotency_conflict",true,t,{cause:e});case "validationFailed":return J("unsupported_type",false,t,{cause:e});case "serviceUnavailable":case "streamTimeout":return J("network",true,t,{cause:e});default:return r===429?J("rate_limited",true,t,{cause:e}):r===503?J("network",true,t,{cause:e}):r===void 0?J("network",true,t,{cause:e}):J("server",e.retryable,t,{httpStatus:r,cause:e})}}i(Qu,"initiateFailure");async function Zu(e,t,r){let n=await e.send("chat.attachments.initiate",{method:"POST",path:qu,body:{filename:t.filename,content_type:t.contentType,file_size:t.sizeBytes},...r?.signal?{signal:r.signal}:{}});if(!n.ok)return ve(Qu(n.error,t.filename));let o=Xu(n.value);return o===null?ve(J("server",false,t.filename)):Ct(o)}i(Zu,"initiateAttachmentUpload");async function Ju(e,t,r,n){let o=i(()=>n?.signal?.aborted===true,"cancelled");if(o())return ve(J("cancelled",true,r.filename));try{return await e.postMultipart(t,r.file,{...n?.signal?{signal:n.signal}:{},...n?.onProgress?{onProgress:n.onProgress}:{}}),Ct(void 0)}catch{return o()?ve(J("cancelled",true,r.filename)):ve(J("server",true,r.filename))}}i(Ju,"uploadAttachmentBytes");var ec=2,tc=3,rc=Object.freeze([1e3,2e3,4e3]),ni=0;function nc(){return ni+=1,`attachment-${ni}`}i(nc,"defaultNewId");function oi(e){let t=Math.max(1,e.concurrency??ec),r=Math.max(1,e.maxAttempts??tc),n=e.backoffMs??rc,o=Math.max(1,e.maxPerMessage??Jt),s=e.timers??Zo,a=e.newId??nc,d=ri(e.transport),l=new Map,u=[],c=[],p=new Set,y=new Set,b=Object.freeze({attachments:Object.freeze([])}),h=false,P=i(()=>{b=Object.freeze({attachments:Object.freeze(u.flatMap(m=>{let R=l.get(m);return R===void 0?[]:[R.state]}))});for(let m of y)m();},"publish"),E=i((m,R)=>{m.state=Object.freeze({...m.state,...R}),P();},"patch"),S=i(()=>{for(;!h&&p.size<t&&c.length>0;){let m=c.shift(),R=l.get(m);R!==void 0&&(p.add(m),A(R).finally(()=>{p.delete(m),S();}));}},"pump"),A=i(async m=>{let{attachment:R}=m;for(;m.attempts<r;){if(h||m.controller.signal.aborted)return;m.attempts+=1;let O=m.controller.signal;E(m,{status:"uploading",error:null,progress:0});let F=await Zu(e.funnel,R,{signal:O});if(h||O.aborted)return;let w;if(!F.ok)w=ve(F.error);else {let U=await Ju(e.transport,F.value,R,{signal:O,onProgress:i(z=>{!O.aborted&&m.state.status==="uploading"&&E(m,{progress:oc(z)});},"onProgress")});if(h||O.aborted)return;w=U.ok?Ct(F.value.s3_key):ve(U.error);}if(w.ok){E(m,{status:"uploaded",s3Key:w.value,error:null,progress:1});return}let g=w.error,x=g.retryable&&m.attempts<r;if(E(m,{status:x?"uploading":"failed",error:g,progress:0}),!x)return;let D=n[Math.min(m.attempts-1,n.length-1)]??0;await Jo(D,O,s);}},"run"),T=i(m=>{c.push(m.state.id),S();},"enqueue"),_={available:d,subscribe(m){return y.add(m),()=>{y.delete(m);}},getSnapshot:i(()=>b,"getSnapshot"),get uploading(){return b.attachments.some(m=>m.status==="uploading")},get s3Keys(){return b.attachments.flatMap(m=>m.status==="uploaded"&&m.s3Key!==null?[m.s3Key]:[])},add(m){let R=$u(m);if(!R.ok)return R;if(h||u.length>=o)return ve(J("too_many",false,R.value.filename));let O=a(),F={attachment:R.value,controller:new AbortController,attempts:0,state:Object.freeze({id:O,filename:R.value.filename,previewUri:m.uri,contentType:R.value.contentType,sizeBytes:R.value.sizeBytes,status:"uploading",s3Key:null,error:null,progress:0})};return l.set(O,F),u.push(O),P(),T(F),Ct(F.state)},retry(m){let R=l.get(m);R===void 0||h||R.state.status!=="failed"||(R.controller=new AbortController,R.attempts=0,E(R,{status:"uploading",error:null,progress:0,s3Key:null}),T(R));},remove(m){let R=l.get(m);if(R===void 0)return;R.controller.abort(),l.delete(m);let O=u.indexOf(m);O>=0&&u.splice(O,1);let F=c.indexOf(m);F>=0&&c.splice(F,1),P();},clear(){for(let m of [...u])_.remove(m);},dispose(){h=true;for(let m of l.values())m.controller.abort();l.clear(),u.length=0,c.length=0,y.clear(),b=Object.freeze({attachments:Object.freeze([])});}};return _}i(oi,"createAttachmentQueue");function oc(e){return Number.isNaN(e)||e<0?0:e>1?1:e}i(oc,"clamp");function ai(e){switch(e.code){case "too_large":return j(f.attachmentTooLarge,{max:Xr(Zt),filename:e.filename,size:Xr(e.sizeBytes??0)});case "too_many":return j(f.attachmentTooMany,{max:Jt});case "unsupported_type":return j(f.attachmentUnsupported,{filename:e.filename});case "network":return f.attachmentNetwork;case "server":return j(f.attachmentServer,{status:e.httpStatus?` (${e.httpStatus})`:""});case "cancelled":return f.attachmentCancelled;case "rate_limited":return f.attachmentRateLimited;case "quota_exceeded":return f.attachmentQuota;case "idempotency_conflict":return f.attachmentConflict;case "unknown":return f.attachmentUnknown}}i(ai,"attachmentErrorMessage");function li(e,t){return j(e>=t?f.attachmentsFull:f.addAttachment,{used:e,total:t})}i(li,"attachControlLabel");var lc=Object.freeze({attachments:Object.freeze([])});function Qr(e={}){let{runtime:t,userRef:r,scopeEpoch:n}=ie(),o=e.maxPerMessage??Jt,s=react.useCallback(()=>{let{services:m}=t.registry;return oi({funnel:Ue({auth:m.authFor(r),...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}}),transport:e.transport??m.uploadTransport,maxPerMessage:o})},[t,r,n,o,e.transport]),a=react.useMemo(()=>e.queue??s(),[e.queue,s]),d=react.useRef(new WeakSet),[l,u]=react.useState(null),c=l!==null&&l.of===a?l.queue:a;react.useEffect(()=>{if(c!==e.queue){if(d.current.has(c)){u({of:a,queue:s()});return}return ()=>{c.dispose(),d.current.add(c);}}},[c,a,s,e.queue]);let p=react.useSyncExternalStore(c.subscribe,c.getSnapshot,()=>lc),[y,b]=react.useState(null),h=react.useCallback(m=>{let O=(Array.isArray(m)?m:[m]).map(w=>c.add(w)),F=O.find(w=>!w.ok);return F!==void 0&&!F.ok&&b(F.error),O},[c,b]),P=react.useCallback(m=>c.retry(m),[c]),E=react.useCallback(m=>c.remove(m),[c]),S=react.useCallback(()=>c.clear(),[c]),A=react.useCallback(()=>b(null),[b]),T=p.attachments.some(m=>m.status==="uploading"),_=p.attachments.some(m=>m.status==="failed");return react.useMemo(()=>({available:c.available,attachments:p.attachments,maxPerMessage:o,uploading:T,failed:_,blocked:T||_,s3Keys:p.attachments.flatMap(m=>m.status==="uploaded"&&m.s3Key!==null?[m.s3Key]:[]),rejected:y,add:h,retry:P,remove:E,clear:S,dismissRejected:A}),[c.available,p,o,T,_,y,h,P,E,S,A])}i(Qr,"useChatAttachments");var di=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function er(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(di,t)?di[t]:null}i(er,"canonicalPetSpecies");var ui=50,dc=128,Zr=120,ci=120,uc=2e3,pi=120,cc=80,mi=new Set(["male","female","unknown"]),gi=new Set(["day","month","year"]),hi=new Set(["low","medium","high","athletic"]),bi=new Set(["indoor","outdoor","both"]),vi=new Set(["mild","moderate","severe"]),pc=/^(\d{4})-(\d{2})-(\d{2})$/,Ci=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],Ei=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...Ci,...Ei].map(([e])=>e));function fc(e){let t=pc.exec(e);if(t===null)return false;let[r,n,o]=[Number(t[1]),Number(t[2]),Number(t[3])],s=new Date(Date.UTC(r,n-1,o));return s.getUTCFullYear()===r&&s.getUTCMonth()===n-1&&s.getUTCDate()===o}i(fc,"isRealDate");var Rt=i(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),yc=i((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),rr=i((e,t)=>typeof t=="string"&&fc(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),Ee=i((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(Kt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let o=t.trimmed?n.trim():n;if(t.required&&o.length===0)return `${r} is required and must not be blank`;let s=$t(o);return s<=e?null:`${r} is ${s} characters; the server accepts at most ${e}`},"text"),mc={sex:Rt(mi),spayedNeutered:yc,birthDate:rr,birthDatePrecision:Rt(gi),activityLevel:Rt(hi),indoorOutdoor:Rt(bi),foodBrand:Ee(pi),foodType:Ee(pi),microchipId:Ee(cc)},Jr=["ref","ref",false,Ee(dc,{required:true,trimmed:true})],en=["notes","notes",false,Ee(uc,{trimmed:true})],fi=[Jr,["name","name",true,Ee(Zr,{required:true,trimmed:true})],["dose","dose",false,Ee(ci,{trimmed:true})],["frequency","frequency",false,Ee(ci,{trimmed:true})],["startDate","start_date",false,rr],["endDate","end_date",false,rr],en],gc={allergies:[Jr,["allergen","allergen",true,Ee(Zr,{required:true,trimmed:true})],["severity","severity",false,Rt(vi)],en],medications:fi,supplements:fi,conditions:[Jr,["conditionName","condition_name",true,Ee(Zr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,rr],en]};function hc(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let o=r,s={};for(let[l,u,c,p]of gc[e]){let y=o[l];if(y==null){if(c)return {error:`${n}.${l} is required`};y===null&&(s[u]=null);continue}let b=p(`${n}.${l}`,y);if(b!==null)return {error:b};s[u]=y;}let a=s.start_date,d=s.end_date;return typeof a=="string"&&typeof d=="string"&&d<a?{error:`${n}.endDate must not be before startDate`}:{item:s}}i(hc,"itemToWire");function bc(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>ui)return {error:`${e} has ${t.length} items; the server accepts at most ${ui}`};let r=[],n=new Set;for(let o=0;o<t.length;o+=1){let s=hc(e,o,t[o]);if("error"in s)return s;let a=s.item.ref;if(typeof a=="string"){let d=a.trim();if(n.has(d))return {error:`${e}: ref ${JSON.stringify(d)} is used twice; a ref names one item`};n.add(d);}r.push(s.item);}return {items:r}}i(bc,"listToWire");function Ri(e,t){let r=e,n={};for(let[a,d]of Ci){let l=r[a];if(l!==void 0){if(l!==null){let u=mc[a](a,l);if(u!==null)return {error:u}}n[d]=l;}}let o=r.birthDate!==void 0,s=r.birthDatePrecision!==void 0;if(o!==s||o&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[a,d]of Ei){let l=r[a];if(l===void 0)continue;let u=bc(a,l);if("error"in u)return u;n[d]=u.items;}return Object.keys(n).length>0&&t!==void 0&&er(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}i(Ri,"petHealthToWire");var $=i(e=>typeof e=="string"?e:null,"str"),Et=i((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),vc=i(e=>typeof e=="boolean"?e:null,"bool");function tr(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}i(tr,"itemsFromWire");function yi(e){let t=$(e.name);return t===null||t.length===0?null:Object.freeze({ref:$(e.ref),name:t,dose:$(e.dose),frequency:$(e.frequency),startDate:$(e.start_date),endDate:$(e.end_date),notes:$(e.notes)})}i(yi,"medicationFromWire");function Si(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Et(mi,e.sex),spayedNeutered:vc(e.spayed_neutered),birthDate:$(e.birth_date),birthDatePrecision:Et(gi,e.birth_date_precision),activityLevel:Et(hi,e.activity_level),indoorOutdoor:Et(bi,e.indoor_outdoor),foodBrand:$(e.food_brand),foodType:$(e.food_type),microchipId:$(e.microchip_id),allergies:tr(e.allergies,r=>{let n=$(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),allergen:n,severity:Et(vi,r.severity),notes:$(r.notes)})}),medications:tr(e.medications,yi),supplements:tr(e.supplements,yi),conditions:tr(e.conditions,r=>{let n=$(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),conditionName:n,diagnosedDate:$(r.diagnosed_date),notes:$(r.notes)})})})}i(Si,"petHealthFromWire");var wi=100,ki=50,xi=100,_i=50,Ii=500,Cc=128,Ec=6e4;function Se(e){return q("validationFailed",{retryable:false,wireMessage:e})}i(Se,"invalid");function ze(e,t,r){if(typeof t!="string")return Se(`${e} must be a string`);let n=$t(t);return n<=r?null:Se(`${e} is ${n} characters; the server accepts at most ${r}`)}i(ze,"checkString");function nr(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Se(`${e} must be a finite number between 0 and ${r}`)}i(nr,"outOfRange");function Ti(e,t){if(typeof e!="string")return Se("pet_ref must be a string");if(e.trim().length===0)return Se("pet_ref must not be blank");if(Kt(e))return Se("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return Se("profile must be an object");let r=[ze("pet_ref",e,Cc)];return t?.name!==void 0&&r.push(ze("name",t.name,wi)),t?.species!==void 0&&r.push(ze("species",t.species,ki)),t?.breed!==void 0&&r.push(ze("breed",t.breed,xi)),t?.ageYears!==void 0&&r.push(nr("age_years",t.ageYears,_i)),t?.weightKg!==void 0&&r.push(nr("weight_kg",t.weightKg,Ii)),r.find(n=>n!==null)??null}i(Ti,"validate");function Ai(e,t){let r=Ri(e,t);return "error"in r?{error:Se(r.error)}:r}i(Ai,"healthToWire");function Rc(e){if(typeof e!="object"||e===null)return {error:Se("patch must be an object")};let t=e,r=[["name","name",s=>ze("name",s,wi)],["species","species",s=>ze("species",s,ki)],["breed","breed",s=>ze("breed",s,xi)],["ageYears","age_years",s=>nr("age_years",s,_i)],["weightKg","weight_kg",s=>nr("weight_kg",s,Ii)]],n={};for(let[s,a,d]of r){let l=t[s];if(l!==void 0){if(l!==null){let u=d(l);if(u!==null)return {error:u}}n[a]=l;}}let o=Ai(t,t.species);return "error"in o?o:(Object.assign(n,o.body),Object.keys(n).length===0?{error:Se("patch must change at least one field")}:{body:n})}i(Rc,"patchToWire");function Sc(e){if(e==null)return {body:{}};let t=Ai(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}i(Sc,"toWire");var Re=i(e=>typeof e=="string"?e:null,"str"),or=i(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function Pi(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:Re(r.pet_ref)??t,name:Re(r.name),species:Re(r.species),breed:Re(r.breed),ageYears:or(r.age_years),weightKg:or(r.weight_kg)})}i(Pi,"fromWire");function Oi(e){if(typeof e!="object"||e===null)return null;let t=e,r=Re(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:Re(t.pet_id),petRef:r,name:Re(t.name),species:Re(t.species),breed:Re(t.breed),ageYears:or(t.age_years),weightKg:or(t.weight_kg),updatedAt:Re(t.updated_at)})}i(Oi,"widgetPetFromWire");function Tc(e){let t=Oi(e);return t===null?null:Object.freeze({...t,...Si(e)})}i(Tc,"widgetPetProfileFromWire");function Pc(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=Oi(r);return n===null?[]:[n]}))}i(Pc,"petListFromWire");function ir(e){return wc(Ue({auth:e}),Ue({auth:e,unaryTimeoutMs:Ec}))}i(ir,"createPetsRepository");function wc(e,t=e){let r=i((o,s)=>s?{...o,signal:s}:o,"withSignal"),n=i(o=>Ti(o,void 0)??`/widget/v1/pets/${encodeURIComponent(o)}`,"petPath");return {async list(o){let s=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},o?.signal));return s.ok?de(Pc(s.value)):V(s.error)},async registerPet(o,s,a){let d=Ti(o,s);if(d!==null)return V(d);let l=Sc(s);if("error"in l)return V(l.error);let c={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(o)}`,body:l.body},p=await e.send("pets.registerPet",a?.signal?{...c,signal:a.signal}:c);return p.ok?de(Pi(p.value,o)):V(p.error)},async updatePet(o,s,a){let d=n(o);if(typeof d!="string")return V(d);let l=Rc(s);if("error"in l)return V(l.error);let u=await e.send("pets.updatePet",r({method:"PATCH",path:d,body:l.body},a?.signal));return u.ok?de(Pi(u.value,o)):V(u.error)},async getPetProfile(o,s){let a=n(o);if(typeof a!="string")return V(a);let d=await e.send("pets.getPetProfile",r({method:"GET",path:`${a}/profile`},s?.signal));if(!d.ok)return V(d.error);let l=Tc(d.value);return l===null?V(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):de(l)},async deletePet(o,s){let a=n(o);if(typeof a!="string")return V(a);let d=await e.send("pets.deletePet",r({method:"DELETE",path:a},s?.signal));return d.ok?de(void 0):V(d.error)},async eraseUserData(o){let s=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},o?.signal),{maxAttempts:1});return s.ok?de(void 0):V(s.error)}}}i(wc,"createPetsRepositoryOver");var _c="pet_not_registered";function Li(e){return e!=null&&e.reasonCode===_c}i(Li,"isPetNotRegistered");var Ic=Object.freeze({status:"idle",error:null,registered:null,retry:i(()=>{},"retry")});function Di(e,t,r){let{runtime:n,userRef:o,scopeEpoch:s}=ie(),a=react.useCallback(()=>ir(n.registry.services.authFor(o)),[n,o,s]),d=react.useMemo(()=>t===void 0?null:rn(t),[t]),[l,u]=react.useState({key:null,status:"idle",error:null,registered:null}),c=react.useRef(0),p=react.useRef(r);p.current=r;let y=e===null||d===null?null:`${String(o)}|${s}|${e}|${d}`,b=react.useCallback(()=>{if(e===null||t===void 0||y===null)return;let P=++c.current;u({key:y,status:"registering",error:null,registered:null}),a().registerPet(e,t).then(E=>{P===c.current&&(E.ok?(u({key:y,status:"registered",error:null,registered:E.value}),p.current?.()):u({key:y,status:"failed",error:E.error,registered:null}));});},[a,e,y]);react.useEffect(()=>{if(y===null){c.current+=1;return}return b(),()=>{c.current+=1;}},[y,b]);let h=react.useCallback(()=>{l.status==="failed"&&b();},[l.status,b]);return react.useMemo(()=>y===null?Ic:l.key!==y?{status:"registering",error:null,registered:null,retry:h}:{status:l.status,error:l.error,registered:l.registered,retry:h},[y,l,h])}i(Di,"useChatPetRegistration");function rn(e){return e===null||typeof e!="object"?JSON.stringify(e)??"undefined":Array.isArray(e)?`[${e.map(rn).join(",")}]`:`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r<n?-1:r>n?1:0).map(([r,n])=>`${JSON.stringify(r)}:${rn(n)}`).join(",")}}`}i(rn,"stableKey");var nn=Object.freeze({});function Ni(e){let[t,r]=react.useState(nn),n=react.useRef(null),o=react.useRef([]);o.current=e.map(a=>a.id),react.useEffect(()=>{if(e.length===0){n.current=null,r(l=>l===nn?l:nn);return}let a=n.current;if(a===null)return;let d=e.find(l=>l.role==="user"&&!a.known.has(l.id));d!==void 0&&(n.current=null,r(l=>({...l,[d.id]:a.images})));},[e]);let s=react.useCallback(a=>{n.current=a.length===0?null:{images:a,known:new Set(o.current)};},[]);return react.useMemo(()=>({byMessage:t,stage:s}),[t,s])}i(Ni,"useSentImages");var Dc=500;function on(e){if(!e)return null;let t=e.replace(/[\u0000-\u001F\u007F-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g," ").replace(/\s+/g," ").trim();return t?t.slice(0,Dc):null}i(on,"sanitizeSeedPrompt");function Ui(e,t,r){let n=on(r),o=react.useRef(e);o.current=e;let s=react.useRef(null);react.useEffect(()=>{if(n===null||t||s.current===n)return;let a=o.current;a!==void 0&&(s.current=n,Promise.resolve(a(n)).catch(()=>{}));},[n,t]);}i(Ui,"useInitialAsk");function Vc(e,t,r){if(e==="announced")return false;let n=r.lastRefresh;return n===null||n.conversationId!==t?false:r.now-n.at<15e3}i(Vc,"isCoalesced");function zi(e,t){let r=t.activeConversationId;return r===null||r.length===0?{action:"skip",reason:"no_thread"}:t.isTurnInFlight?{action:"defer",reason:"turn_in_flight"}:t.isOffline?{action:"defer",reason:"offline"}:Vc(e,r,t)?{action:"skip",reason:"coalesced"}:{action:"refresh",conversationId:r}}i(zi,"decideChatRefresh");function sn(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}i(sn,"reportHostFailure");function Nc(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}i(Nc,"isThenable");function W(e,...t){if(typeof e=="function")try{let r=e(...t);return Nc(r)&&Promise.resolve(r).then(void 0,sn),r}catch(r){sn(r);return}}i(W,"callHost");var Bi=new WeakMap;function ji(e){if(typeof e!="function")return;let t=Bi.get(e);if(t!==void 0)return t;let r=i((...n)=>{W(e,...n);},"guarded");return Bi.set(e,r),r}i(ji,"guardHost");function ot(e,...t){let r;try{r=e(...t);}catch(n){return sn(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}i(ot,"callHostAsync");function Gi(e,t){let r=react.useRef(t);r.current=t;let n=react.useRef(null),o=react.useRef(null),s=e?.isOffline===void 0?false:W(()=>e.isOffline?.()===!0)===true,a=react.useRef(()=>{});a.current=d=>{let{conversationId:l,isTurnInFlight:u,refresh:c}=r.current,p=zi(d,{activeConversationId:l,isTurnInFlight:u,isOffline:s,lastRefresh:n.current,now:Date.now()});if(p.action!=="skip"){if(p.action==="defer"){o.current!=="announced"&&(o.current=d);return}o.current=null,n.current={conversationId:p.conversationId,at:Date.now()},c!==void 0&&Promise.resolve(c()).catch(()=>{});}},react.useEffect(()=>{if(t.isTurnInFlight||s)return;let d=o.current;d!==null&&a.current(d);},[t.isTurnInFlight,s]),react.useEffect(()=>{if(e===void 0)return;let d=[],l=i((u,c)=>{if(u===void 0)return;let p=W(()=>u(()=>{a.current(c);}));typeof p=="function"&&d.push(p);},"subscribe");return l(e.onForeground?.bind(e),"foreground"),l(e.onOnline?.bind(e),"foreground"),l(e.onAnnounced?.bind(e),"announced"),()=>{for(let u of d)W(u);}},[e]);}i(Gi,"useChatLifecycle");function Uc(e){if(e===void 0)return null;let t=e.conversationId??"",r=e.petRef??"";return t===""&&r===""?null:`${String(t)}|${String(r)}`}i(Uc,"targetKey");function Yi(e,t){let r=Uc(t),n=react.useRef({openCheckin:e,target:t});n.current={openCheckin:e,target:t};let o=react.useRef(null);react.useEffect(()=>{if(r===null||o.current===r)return;o.current=r;let{openCheckin:s,target:a}=n.current;s===void 0||a===void 0||Promise.resolve(s(a)).catch(()=>{});},[r]);}i(Yi,"useCheckinTarget");function Xi(e,t,r){let[n,o]=react.useState({send:e,conversationId:t,text:r??"",seeded:r??null}),s=n.send===e&&(n.conversationId===null||n.conversationId===t);react.useEffect(()=>{o(d=>{let l=d.send===e&&(d.conversationId===null||d.conversationId===t),u=l?d.text:"",c=l?d.seeded:null,p=r!=null&&r!==c&&u.length===0;return {send:e,conversationId:t,text:p?r:u,seeded:p?r:c}});},[e,t,r]);let a=react.useCallback(d=>o(l=>({send:e,conversationId:t,text:d,seeded:l.seeded})),[e,t]);return [s?n.text:"",a]}i(Xi,"useChatDraft");function Qi(e,t,r,n){let o=react.useRef({draft:r,setDraft:n});o.current={draft:r,setDraft:n};let s=react.useRef(null),[a,d]=react.useState(null);react.useEffect(()=>{if(e===void 0)return;let l=`${t??""}`;if(s.current===l)return;s.current=l;let u=true;return (async()=>{let c=await ot(()=>e.read(t));if(!u)return;let p=c.ok&&typeof c.value=="string"?c.value:"";p.length>0&&o.current.draft.length===0&&o.current.setDraft(p),d(l);})(),()=>{u=false;}},[e,t]),react.useEffect(()=>{e===void 0||a!==`${t??""}`||W(()=>e.write(t,r));},[e,t,r,a]);}i(Qi,"usePersistedDraft");var Y=Object.freeze({heading:"Chat History",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No matching chats",noMatchBody:"Try a different title or start a new conversation.",loading:"Loading your chats\u2026",loadFailed:"Couldn\u2019t load your chats",loadingMore:"Loading more\u2026",untitled:"New conversation",newConversation:"New conversation",newChat:"New chat",search:"Search",retry:"Try again",retryA11y:"Retry loading chats",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages\u2026",openConversation:"Open conversation",unreadPrefix:"Unread. "});function ar(e){let t=e?.replace(/\s+/g," ").trim();return t||Y.untitled}i(ar,"conversationTitle");function Ji(e){return `${e.unreadCount!==null&&e.unreadCount>0?Y.unreadPrefix:""}${Y.openConversation} ${ar(e.title)}`}i(Ji,"openConversationLabel");function Zi(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').toLowerCase().trim().replace(/\s+/g," ")}i(Zi,"normalizeForSearch");function qc(e,t){let r=Zi(t);if(r.length===0)return e;let n=[[],[],[]];for(let o of e){let s=Zi(ar(o.title)),a=s.indexOf(r);if(a<0)continue;let d=a===0?0:s.charAt(a-1)===" "?1:2;n[d]?.push(o);}return n.flat()}i(qc,"filterConversations");function dn(e){return {scope:e,rows:[],cursor:null,loading:false,loadingMore:false,error:null}}i(dn,"fresh");function es(e){let[t,r]=react.useState(false),[n,o]=react.useState(""),s=e.listConversations,a=react.useRef(0),[d,l]=react.useState(()=>dn(s)),u=d.scope===s?d:dn(s);react.useEffect(()=>(a.current+=1,r(false),o(""),l(dn(s)),()=>{a.current+=1;}),[s]);let c=react.useCallback(async T=>{let _=++a.current,m=T!==void 0;l(O=>({...O,scope:s,loading:!m,loadingMore:m,error:null}));let R=await e.listConversations(T?{cursor:T}:void 0);if(_===a.current){if(!R.ok){l(O=>({...O,loading:false,loadingMore:false,error:R.error.displayMessage}));return}l(O=>{let F=T&&O.scope===s?O.rows:[],w=new Set(F.map(g=>g.id));return {scope:s,loading:false,loadingMore:false,error:null,rows:[...F,...R.value.conversations.filter(g=>!w.has(g.id))],cursor:R.value.nextCursor===T?null:R.value.nextCursor}});}},[e.listConversations,s]),p=i(()=>{r(true),o(""),c();},"show"),y=i(()=>{a.current+=1,r(false);},"close"),b=i(async T=>{let _=++a.current;l(R=>({...R,loading:true,error:null}));let m=await e.resumeConversation(T);_===a.current&&(l(R=>({...R,loading:false,error:m.ok?null:m.error.displayMessage})),m.ok&&r(false));},"resume"),h=i(async()=>{let T=a.current,_=await e.loadOlderMessages();T===a.current&&!_.ok&&l(m=>({...m,error:_.error.displayMessage}));},"earlier"),P=i(()=>{e.newConversation(),a.current+=1,r(false);},"newConversation"),E=i(()=>{u.cursor===null||u.loading||u.loadingMore||n.trim().length>0||c(u.cursor);},"loadMore"),S=react.useMemo(()=>qc(u.rows,n),[u.rows,n]),A=n.trim().length>0;return {...u,open:t,show:p,close:y,load:c,resume:b,earlier:h,newConversation:P,loadMore:E,query:n,setQuery:o,searching:A,filtered:S,emptyKind:u.rows.length===0?"empty":"noMatch"}}i(es,"useHistoryPanel");var lr="#111111",dr="#FFFFFF",$c=Object.freeze({emergency:Object.freeze({level:"emergency",label:"Vet care now",borderColor:"#FCA5A5",backgroundColor:"#FEF2F2",textColor:"#991B1B",reasonColor:lr,pillColor:dr,showsVetAction:true}),schedule_soon:Object.freeze({level:"schedule_soon",label:"Vet care suggested soon",borderColor:"#FCD34D",backgroundColor:"#FFFBEB",textColor:"#92400E",reasonColor:lr,pillColor:dr,showsVetAction:true}),home_care:Object.freeze({level:"home_care",label:"Monitor at home",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:lr,pillColor:dr,showsVetAction:false}),general:Object.freeze({level:"general",label:"Good to know",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:lr,pillColor:dr,showsVetAction:false})});function Xc(e){return `${e.messageId}:${e.level}:${e.reason??""}`}i(Xc,"urgencySignature");function Qc(e){return j(f.urgencyGeneralReason,{petName:e?.trim()||f.emptyTitlePetFallback})}i(Qc,"generalUrgencyReason");function ns(e,t){for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(n?.role!=="assistant"||n.responseId===void 0)continue;let o=n.urgencyLevel;return o?{messageId:n.id,level:o,reason:Zc(n.urgencyReason)}:n.urgencyProvided===true?{messageId:n.id,level:"general",reason:Qc(t)}:null}return null}i(ns,"latestUrgencySource");function Zc(e){return typeof e=="string"&&e.trim().length>0?e:null}i(Zc,"shownReason");function os(e){let t=e===null?null:Xc(e),[r,n]=react.useState(null),[o,s]=react.useState(false);react.useEffect(()=>s(false),[t]);let d=e!==null&&(o||!(r!==null&&r===t)),l=e===null?null:$c[e.level],u=e!==null&&!d&&e.level!=="general",c=react.useCallback(()=>{t!==null&&n(t),s(false);},[t]),p=react.useCallback(()=>s(true),[]);return react.useMemo(()=>({source:e,tier:l,signature:t,showBanner:d,showCompactIcon:u,showVetAction:d&&l!==null&&l.showsVetAction,dismissLabel:l===null?null:j(f.dismissBanner,{label:l.label}),dismiss:c,expand:p}),[e,l,t,d,u,c,p])}i(os,"useUrgencySurface");function is(e){return e.isBootstrapping?"loading":e.status==="error"&&e.error&&e.messages.length===0?"error":e.messages.length===0?"empty":"populated"}i(is,"selectView");function Jc(e){return e.code==="accessDenied"||e.code==="conversationNotFound"}i(Jc,"needsNewConversation");function ss(e){if(e.messages.length===0)return null;let t=e.status==="error"?e.error:null;if(t!==null){let r=Jc(t);return {tone:"error",title:r?f.turnUnreachableTitle:f.turnFailedTitle,body:t.displayMessage,actionLabel:r?f.turnStartNewChat:f.turnRetry,action:r?"startNew":"retry"}}return e.stopped===true?{tone:"neutral",title:f.turnStoppedTitle,body:f.turnStoppedBody,actionLabel:f.turnRetry,action:"retry"}:null}i(ss,"turnNotice");function as(e,t){let r=e[e.length-1];return t&&(r===void 0||r.role==="user")}i(as,"awaitingAssistant");var ep=3,tp=Object.freeze([]);function ls(e){let t=e.messages[e.messages.length-1];if(e.isStreaming||e.status==="error"||t===void 0||t.role!=="assistant")return tp;let r=new Set,n=[];for(let o of e.suggestedPrompts){let s=o.trim(),a=s.replace(/\s+/g," ").toLowerCase();if(!(a.length===0||r.has(a))&&(r.add(a),n.push(s),n.length===ep))break}return Object.freeze(n)}i(ls,"visibleFollowUps");function ds(e){return e.sender?.displayName??f.senderVet}i(ds,"vetSenderLabel");function us(e,t){let r={};return e!==void 0&&(r.petRef=e),t!==void 0&&(r.conversationId=t),r}i(us,"buildChatOpts");var rp=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function C(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[rp[t]]}}i(C,"face");var cn=class cn extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(cn,"HostRenderBoundary");var un=cn;function op({render:e}){return e()}i(op,"RenderHost");function Be({render:e,fallback:t,resetKey:r}){return react.createElement(un,{fallback:t,resetKey:r,children:react.createElement(op,{render:e})})}i(Be,"HostRender");var ip=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function sp(e){return ip[e]}i(sp,"requires");function ps(e,t,r){let n=sp(e),o=new Map;for(let d of t)o.set(d.resource,d);if(r?.isPending===true&&n.some(d=>!o.has(d)))return pn({name:e,enabled:false,isPending:true,limits:{}});let s=ap(n,o);return n.filter(d=>o.get(d)?.granted!==true).length===0?pn({name:e,enabled:true,isPending:false,limits:s}):pn({name:e,enabled:false,isPending:false,limits:s,disabled:lp(n,o)})}i(ps,"decideCapability");function ap(e,t){let r={};for(let n of e){let o=t.get(n)?.limits;if(o)for(let[s,a]of Object.entries(o)){let d=r[s];r[s]=d===void 0?a:Math.min(d,a);}}return r}i(ap,"mergeLimits");function lp(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:Ur("accessDenied"),level:"user_entitlement",recoverable:false})}i(lp,"disabledFor");function pn(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}i(pn,"freezeDecision");function St(e){let{runtime:t}=ie(),r=t.entitlements,n=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>ps(e,n.decisions,{isPending:n.isPending}),[e,n])}i(St,"useCapability");var cp=48;function pp(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(pp,"selectView");function gs(e){let{capability:t,children:r,renderDisabled:n,renderPending:o,style:s}=e,a=St(t),d=react.useMemo(()=>pp(a),[a]);switch(d){case "enabled":return r;case "pending":return o?jsxRuntime.jsx(Be,{render:o,fallback:jsxRuntime.jsx(ys,{capability:t,style:s})}):jsxRuntime.jsx(ys,{capability:t,style:s});case "disabled":return n?jsxRuntime.jsx(Be,{render:()=>n(a),fallback:jsxRuntime.jsx(ms,{decision:a,style:s}),resetKey:a}):jsxRuntime.jsx(ms,{decision:a,style:s});default:return Yt(d)}}i(gs,"CapabilityGate");function ys({capability:e,style:t}){let r=I(),n=react.useMemo(()=>hs(r),[r]);return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:n.skeletonBar})})}i(ys,"PendingSkeleton");function ms({decision:e,style:t}){let r=I(),n=react.useMemo(()=>hs(r),[r]),o=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?jsxRuntime.jsx(v,{style:n.offstateText,children:o}):null})}i(ms,"OffState");function hs(e){let{color:t,space:r,radius:n,type:o}=e;return reactNative.StyleSheet.create({offstate:{minHeight:cp,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...C(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}i(hs,"makeStyles");var Tt=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function Cs(e){let t=I(),r=react.useMemo(()=>mp(t),[t]);return jsxRuntime.jsxs(reactNative.View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${Tt.title}. ${Tt.body}`,children:[jsxRuntime.jsx(v,{style:r.title,children:Tt.title}),jsxRuntime.jsx(v,{style:r.body,children:Tt.body})]})}i(Cs,"ClinicalDisclaimer");function mp(e){let{color:t,space:r,type:n}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...C(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...C(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}i(mp,"makeStyles");var ee={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function X(e){return {width:e,height:e,alignItems:"center",justifyContent:"center"}}i(X,"box");function ne(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}i(ne,"stroke");function Es({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o={width:e*.82,height:n,borderRadius:n,backgroundColor:t};return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{gap:e*.22}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:o}),jsxRuntime.jsx(reactNative.View,{style:o}),jsxRuntime.jsx(reactNative.View,{style:o})]})}i(Es,"MenuGlyph");function Rs({size:e,color:t,strokeWidth:r,rotate:n}){let o=ne(e,r),s=e*.78;return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{transform:[{rotate:n}]}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:s,height:o,borderRadius:o,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:o,height:s,borderRadius:o,backgroundColor:t}})]})}i(Rs,"Cross");function Ss(e){return jsxRuntime.jsx(Rs,{...e,rotate:"0deg"})}i(Ss,"PlusGlyph");function je(e){return jsxRuntime.jsx(Rs,{...e,rotate:"45deg"})}i(je,"CloseGlyph");function Le({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsx(reactNative.View,{style:X(e),...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.36,height:e*.66,marginTop:-e*.14,borderBottomWidth:n,borderRightWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})})}i(Le,"CheckGlyph");var bp={down:{rotate:"45deg",marginTop:-0.4,marginLeft:0},up:{rotate:"225deg",marginTop:.4,marginLeft:0},right:{rotate:"-45deg",marginTop:0,marginLeft:-0.4}};function ur({size:e,color:t,strokeWidth:r,direction:n}){let o=ne(e,r),s=e*.46,a=bp[n];return jsxRuntime.jsx(reactNative.View,{style:X(e),...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:s,height:s,borderRightWidth:o,borderBottomWidth:o,borderColor:t,marginTop:s*a.marginTop,marginLeft:s*a.marginLeft,transform:[{rotate:a.rotate}]}})})}i(ur,"ChevronGlyph");function Ts({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o={width:e*.42,height:e*.7,borderWidth:n,borderColor:t,borderRadius:n};return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{flexDirection:"row",gap:1}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:[o,{borderTopLeftRadius:e*.2}]}),jsxRuntime.jsx(reactNative.View,{style:[o,{borderTopRightRadius:e*.2}]})]})}i(Ts,"BookGlyph");function Ps({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.5;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:e*.78,height:n,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.16,right:e*.16,width:o,height:o,borderTopWidth:n,borderRightWidth:n,borderColor:t}})]})}i(Ps,"ArrowUpRightGlyph");function ws({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.6,s={position:"absolute",width:o,height:o,borderWidth:n,borderColor:t,borderRadius:e*.14};return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:[s,{top:0,left:0}]}),jsxRuntime.jsx(reactNative.View,{style:[s,{bottom:0,right:0}]})]})}i(ws,"CopyGlyph");function cr({size:e,color:t,strokeWidth:r,active:n,rotate:o}){let s=ne(e,r),a=n?t:"transparent";return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{transform:[{rotate:o}]}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.08,left:e*.12,width:e*.62,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.12,borderTopLeftRadius:e*.04}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.04,left:e*.4,width:e*.3,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.15,transform:[{rotate:"-20deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.08,left:0,width:e*.2,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.05}})]})}i(cr,"ThumbGlyph");function ks({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{borderRadius:e/2,borderWidth:n,borderColor:t}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{width:n,height:n,borderRadius:n,backgroundColor:t,marginBottom:e*.1}}),jsxRuntime.jsx(reactNative.View,{style:{width:n,height:e*.34,borderRadius:n,backgroundColor:t}})]})}i(ks,"InfoGlyph");function xs({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.34;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.06,width:o,height:o,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.1,width:n,height:e*.56,borderRadius:n,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:0,width:e*.84,height:e*.3,borderBottomWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderBottomLeftRadius:n,borderBottomRightRadius:n}})]})}i(xs,"UploadGlyph");function _s({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{borderWidth:n,borderColor:t,borderRadius:e*.14,overflow:"hidden"}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.16,left:e*.18,width:e*.16,height:e*.16,borderRadius:e,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:-e*.3,right:-e*.1,width:e*.7,height:e*.7,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(_s,"PhotoGlyph");function Is({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.08,width:e*.34,height:e*.2,borderTopWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderTopLeftRadius:n,borderTopRightRadius:n}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.22,width:e*.92,height:e*.66,borderWidth:n,borderColor:t,borderRadius:e*.16,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.3,height:e*.3,borderRadius:e,borderWidth:n,borderColor:t}})})]})}i(Is,"CameraGlyph");function As({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.66;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:0,left:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.02,right:e*.02,width:n,height:e*.4,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}})]})}i(As,"SearchGlyph");function Os({size:e,color:t,strokeWidth:r}){let n=ne(e,r);return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:e*.3,height:e*.82,borderWidth:n,borderColor:t,borderRadius:n,transform:[{rotate:"45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:0,left:0,width:e*.4,height:n,borderRadius:n,backgroundColor:t}})]})}i(Os,"EditGlyph");function Fs({size:e,color:t,strokeWidth:r}){let n=ne(e,r),o=e*.62;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.View,{style:{width:n*1.4,height:n*1.4,borderRadius:n,backgroundColor:t}})}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.04,width:o*.5,height:o*.5,borderRightWidth:n,borderBottomWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(Fs,"MapPinGlyph");function Ms({size:e,color:t,testID:r}){let n=e*.36;return jsxRuntime.jsx(reactNative.View,{style:X(e),testID:r,...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:0,height:0,marginLeft:e*.12,borderLeftWidth:e*.78,borderTopWidth:n,borderBottomWidth:n,borderLeftColor:t,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"-45deg"}]}})})}i(Ms,"SendGlyph");function Ls({size:e,color:t,testID:r}){return jsxRuntime.jsx(reactNative.View,{style:X(e),testID:r,...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.5,height:e*.5,backgroundColor:t}})})}i(Ls,"StopGlyph");function pr({size:e,strokeWidth:t,color:r,children:n}){return jsxRuntime.jsx(reactNative.View,{style:[X(e),{borderRadius:e/2,borderWidth:t??reactNative.StyleSheet.hairlineWidth,borderColor:r}],children:n})}i(pr,"Ring");var Pt=Object.freeze({standard:He.standard,emphasized:He.emphasized,exit:He.exit,outQuad:Object.freeze([.25,.46,.45,.94])});var Ds=Object.freeze({layoutMs:220,messageInMs:200,bannerInMs:220,bannerOutMs:160,iconInMs:180,iconOutMs:120,followUpInMs:180,followUpStaggerMs:70,citationsInMs:220,citationsRisePx:6,drawerMs:220,pressScale:.97,pressMs:140,revealTickMs:24,revealDivisor:12,dotsCycleMs:520,dotsMinOpacity:.44,dotsLiftPx:3.5,dotsStagger:Object.freeze([0,.18,.36]),copiedMs:1500,uploadFlashMs:600,reduced:false}),vp=Object.freeze({...Ds,layoutMs:0,messageInMs:0,bannerInMs:0,bannerOutMs:0,iconInMs:0,iconOutMs:0,followUpInMs:0,followUpStaggerMs:0,citationsInMs:0,citationsRisePx:0,drawerMs:0,pressScale:1,pressMs:0,revealTickMs:0,dotsCycleMs:0,dotsMinOpacity:1,dotsLiftPx:0,reduced:true});function Vs(e){return e.motion.reducedMotion?vp:Ds}i(Vs,"chatMotion");function fr(e,t){return Math.max(0,t)*e.followUpStaggerMs}i(fr,"followUpDelayMs");function Ns(e,t,r){if(e.reduced||t>=r)return r;let n=Math.max(1,Math.ceil((r-t)/e.revealDivisor));return Math.min(r,t+n)}i(Ns,"nextRevealLength");function G(){let e=I();return Vs(e)}i(G,"useChatMotion");var Pp=8;function Us(e,t,r){return ((1-3*r+3*t)*e+(3*r-6*t))*e*e+3*t*e}i(Us,"bezierComponent");function wp(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}i(wp,"bezierSlope");function yr(e){let[t,r,n,o]=e;return s=>{if(s<=0)return 0;if(s>=1)return 1;let a=s;for(let d=0;d<Pp;d+=1){let l=wp(a,t,n);if(l===0)break;a-=(Us(a,t,n)-s)/l;}return Us(Math.min(1,Math.max(0,a)),r,o)}}i(yr,"bezierEasing");var mn=yr(Pt.standard),kp=yr(Pt.outQuad);function vn(e){let t=react.useRef(null);return t.current===null&&(t.current=new reactNative.Animated.Value(e)),t.current}i(vn,"useAnimatedValue");function We(e,t={}){let r=t.risePx??0,n=t.delayMs??0,o=vn(e>0?0:1);return react.useEffect(()=>{if(e<=0)return;let s=reactNative.Animated.timing(o,{toValue:1,duration:e,easing:kp,useNativeDriver:true}),a=n>0?reactNative.Animated.sequence([reactNative.Animated.delay(n),s]):s;return a.start(),()=>a.stop()},[o,e,n]),react.useMemo(()=>({opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[r,0]})}]}),[o,r])}i(We,"useFadeIn");function Cn({visible:e,inMs:t,outMs:r,style:n,children:o}){let[s,a]=react.useState(e),d=vn(e&&t<=0?1:0);return react.useEffect(()=>{if(e){a(true);let u=reactNative.Animated.timing(d,{toValue:1,duration:Math.max(0,t),easing:mn,useNativeDriver:true});return u.start(),()=>u.stop()}if(!s)return;if(r<=0){a(false);return}let l=reactNative.Animated.timing(d,{toValue:0,duration:r,easing:mn,useNativeDriver:true});return l.start(({finished:u})=>{u&&a(false);}),()=>l.stop()},[e,s,t,r,d]),!s&&!e?null:jsxRuntime.jsx(reactNative.Animated.View,{style:[n,{opacity:d}],children:o})}i(Cn,"FadePresence");var xp=12;function N({style:e,containerStyle:t,children:r,onPressIn:n,onPressOut:o,hitSlop:s,...a}){let d=G(),l=vn(1),u=react.useCallback(c=>{d.pressMs<=0||d.pressScale===1||reactNative.Animated.timing(l,{toValue:c,duration:d.pressMs,easing:mn,useNativeDriver:true}).start();},[l,d.pressMs,d.pressScale]);return jsxRuntime.jsx(reactNative.Pressable,{...a,hitSlop:s??xp,style:t,onPressIn:c=>{u(d.pressScale),n?.(c);},onPressOut:c=>{u(1),o?.(c);},children:jsxRuntime.jsx(reactNative.Animated.View,{style:[e,{transform:[{scale:l}]}],children:r})})}i(N,"PressScale");function js(e,t,r){let n=t&&r.revealTickMs>0,[o,s]=react.useState(0),a=react.useRef(e);return a.current=e,react.useEffect(()=>{if(!n)return;let d=setInterval(()=>{s(l=>Ns(r,l,a.current.length));},r.revealTickMs);return ()=>clearInterval(d)},[n,r]),n?e.slice(0,Math.min(o,e.length)):e}i(js,"useRevealedText");var zs=false;function _p(e){e.layoutMs<=0||(zs||(zs=true,reactNative.Platform.OS==="android"&&typeof reactNative.UIManager.setLayoutAnimationEnabledExperimental=="function"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true)),reactNative.LayoutAnimation.configureNext({duration:e.layoutMs,create:{type:"easeInEaseOut",property:"opacity"},update:{type:"easeInEaseOut"},delete:{type:"easeInEaseOut",property:"opacity"}}));}i(_p,"animateLayout");function wt(e,t){let r=react.useRef(e);r.current!==e&&(r.current=e,_p(t));}i(wt,"useAnimateLayoutOn");var En=36,Dp=22,Vp=12,Np=12,Hp=16,Up="#000",zp="rgba(0,0,0,0.45)";function Ws({uri:e,label:t,onClose:r}){let n=I(),o=reactNativeSafeAreaContext.useSafeAreaInsets();return e===null?null:jsxRuntime.jsxs(reactNative.Modal,{visible:true,animationType:n.motion.reducedMotion?"none":"fade",transparent:false,statusBarTranslucent:true,onRequestClose:r,children:[jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:f.closePreview,style:mr.backdrop,onPress:r,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:mr.image,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,accessibilityIgnoresInvertColors:true})}),jsxRuntime.jsx(reactNative.View,{pointerEvents:"box-none",style:[mr.closeWrap,{top:o.top+Np}],children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.closePreview,hitSlop:Vp,style:mr.closeButton,onPress:r,children:jsxRuntime.jsx(je,{size:Dp,color:n.color.surface,strokeWidth:2})})})]})}i(Ws,"AttachmentImageLightbox");var mr=reactNative.StyleSheet.create({backdrop:{flex:1,backgroundColor:Up,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"},closeWrap:{position:"absolute",right:Hp},closeButton:{width:En,height:En,borderRadius:En/2,backgroundColor:zp,alignItems:"center",justifyContent:"center"}});var gr=12,qp=80,Rn=44,Gs=22,Yp=.14,Kp=18,$p=8,qs=Object.freeze({photo:f.attachmentPhoto,camera:f.attachmentCamera});function Ys({sources:e,full:t,onPick:r,onClose:n}){let o=I(),s=react.useMemo(()=>Xp(o),[o]);return jsxRuntime.jsxs(reactNative.View,{style:s.anchor,pointerEvents:"box-none",children:[jsxRuntime.jsx(reactNative.Pressable,{style:s.dismissLayer,accessibilityRole:"button",accessibilityLabel:f.closeAttachmentPicker,onPress:n}),jsxRuntime.jsxs(reactNative.View,{style:s.bubble,children:[jsxRuntime.jsx(reactNative.View,{style:s.tilesRow,children:e.map(a=>jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:qs[a],accessibilityState:{disabled:t},disabled:t,containerStyle:s.tile,style:s.tileInner,onPress:()=>r(a),children:[jsxRuntime.jsx(reactNative.View,{style:s.tileIconWrap,children:a==="photo"?jsxRuntime.jsx(_s,{size:Gs,color:o.color.brandInk,strokeWidth:1.5}):jsxRuntime.jsx(Is,{size:Gs,color:o.color.brandInk,strokeWidth:1.5})}),jsxRuntime.jsx(v,{tier:"control",style:s.tileLabel,children:qs[a]})]},a))}),jsxRuntime.jsx(reactNative.View,{style:s.tail}),jsxRuntime.jsx(reactNative.View,{style:s.tailFill})]})]})}i(Ys,"AttachmentPickerPopover");function Xp(e){let t=e.color,r=e.radius;return reactNative.StyleSheet.create({anchor:{position:"absolute",left:0,right:0,bottom:"100%",paddingHorizontal:8,paddingBottom:10,alignItems:"flex-start"},dismissLayer:{position:"absolute",left:-1e3,right:-1e3,top:-2e3,bottom:0},bubble:{backgroundColor:t.surfaceCream,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:6,paddingVertical:8,shadowColor:t.shadow,shadowOpacity:Yp,shadowRadius:Kp,shadowOffset:{width:0,height:$p},elevation:8},tilesRow:{flexDirection:"row",alignItems:"stretch"},tile:{minWidth:qp,borderRadius:r.md},tileInner:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:10,paddingVertical:8,gap:6},tileIconWrap:{width:Rn,height:Rn,borderRadius:Rn/2,backgroundColor:t.brandSoft,alignItems:"center",justifyContent:"center"},tileLabel:{...C(e,"medium"),fontSize:12,lineHeight:14,color:t.text.primary},tail:{position:"absolute",left:24,bottom:-gr/2,width:gr,height:gr,backgroundColor:t.surfaceCream,borderRightWidth:1,borderBottomWidth:1,borderColor:t.brandBorderStrong,transform:[{rotate:"45deg"}]},tailFill:{position:"absolute",left:22,bottom:0,width:gr+4,height:2,backgroundColor:t.surfaceCream}})}i(Xp,"makeStyles");function Qp(e){if(typeof e=="number")return Ks(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return Tn(t.slice(1));if(t.toLowerCase().startsWith("0x"))return Tn(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return Zp(t);if(/^[0-9a-fA-F]+$/.test(t)){let r=Tn(t);if(r!==null)return r}return /^\d+$/.test(t)?Ks(Number.parseInt(t,10)):null}i(Qp,"toRgba");function Tn(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return {r:Pn(t[0]),g:Pn(t[1]),b:Pn(t[2]),a:1};if(t.length===6)return {r:Ge(t,0),g:Ge(t,2),b:Ge(t,4),a:1};if(t.length===8){let r=Ge(t,0);return {r:Ge(t,2),g:Ge(t,4),b:Ge(t,6),a:r/255}}return null}i(Tn,"fromHex");function Zp(e){let t=e.indexOf("("),r=e.indexOf(")");if(t<0||r<0||r<t)return null;let n=e.slice(t+1,r).split(",").map(l=>l.trim());if(n.length<3)return null;let o=wn(Number(n[0])),s=wn(Number(n[1])),a=wn(Number(n[2]));if(o===null||s===null||a===null)return null;let d=1;if(n.length>=4){let l=Number(n[3]);if(!Number.isFinite(l))return null;d=Math.min(1,Math.max(0,l));}return {r:o,g:s,b:a,a:d}}i(Zp,"fromRgbFunc");function Ks(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,r=t>>>24&255;return {r:t>>>16&255,g:t>>>8&255,b:t&255,a:r===0?1:r/255}}i(Ks,"argbIntToRgba");function Ge(e,t){return Number.parseInt(e.slice(t,t+2),16)}i(Ge,"byte");function Pn(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}i(Pn,"dup");function wn(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}i(wn,"clampByte");function $s(e,t){let r=Qp(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return `rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}i($s,"withAlpha");var me=Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});var Qs=56,Zs=12,tf=14,rf=10,nf=.45,of="rgba(7,193,104,0.55)",sf="rgba(185,28,28,0.55)",af=200,lf=300,sa=20,kn=22,df=12,uf="rgba(0,0,0,0.78)",Js=220,ea=100,ta="rgba(255,255,255,0.15)";function aa({attachments:e,rejected:t,uploadFailed:r=false,onRetry:n,onRemove:o,onPreview:s}){let a=I(),d=react.useMemo(()=>da(a),[a]);return e.length===0&&t===null?null:jsxRuntime.jsxs(reactNative.View,{style:d.strip,children:[e.length>0?jsxRuntime.jsx(reactNative.View,{style:d.cards,children:e.map(l=>jsxRuntime.jsx(cf,{row:l,styles:d,onRetry:n,onRemove:o,onPreview:s},l.id))}):null,r?jsxRuntime.jsx(v,{style:d.rejected,accessibilityRole:"alert",children:f.attachmentsFailedBlocked}):null,t!==null?jsxRuntime.jsx(v,{style:d.rejected,accessibilityRole:"alert",children:ai(t)}):null]})}i(aa,"AttachmentStrip");function cf({row:e,styles:t,onRetry:r,onRemove:n,onPreview:o}){let s=I(),a=e.status==="uploading",d=e.status==="failed",l=e.status==="uploaded",u=react.useRef(e.status),[c,p]=react.useState(false);return react.useEffect(()=>{let y=u.current;u.current=e.status,e.status==="uploaded"&&y==="uploading"&&p(true);},[e.status]),jsxRuntime.jsxs(reactNative.View,{style:t.card,children:[jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:l?"button":"image",accessibilityLabel:l?j(f.previewAttachment,{filename:e.filename}):e.filename,accessibilityState:{busy:a,disabled:!l},disabled:!l,style:t.thumbHit,onPress:()=>o(e),children:jsxRuntime.jsxs(reactNative.View,{style:t.thumb,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:e.previewUri},style:t.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),a?jsxRuntime.jsx(reactNative.View,{style:t.uploadingOverlay,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:s.color.surface})}):null,c?jsxRuntime.jsx(pf,{styles:t,onDone:()=>p(false)}):null]})}),d?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:j(f.retryUpload,{filename:e.filename}),style:t.failedOverlay,onPress:()=>r(e.id),children:jsxRuntime.jsx(reactNative.View,{style:t.failedInner,children:jsxRuntime.jsx(je,{size:sa,color:s.color.surface,strokeWidth:2})})}):null,jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:j(f.removeAttachment,{filename:e.filename}),hitSlop:6,containerStyle:t.removeSlot,style:t.removeButton,onPress:()=>n(e.id),children:jsxRuntime.jsx(je,{size:df,color:s.color.surface,strokeWidth:1.5})})]})}i(cf,"PreviewCard");function pf({styles:e,onDone:t}){let r=I(),n=G(),o=react.useRef(null);o.current===null&&(o.current=new reactNative.Animated.Value(0));let s=o.current;return react.useEffect(()=>{let a=reactNative.Animated.sequence([reactNative.Animated.timing(s,{toValue:1,duration:af,useNativeDriver:true}),reactNative.Animated.delay(n.uploadFlashMs),reactNative.Animated.timing(s,{toValue:0,duration:lf,useNativeDriver:true})]);return a.start(({finished:d})=>{d&&t();}),()=>a.stop()},[s,n.uploadFlashMs,t]),jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[e.successOverlay,{opacity:s}],children:jsxRuntime.jsx(Le,{size:sa,color:r.color.surface,strokeWidth:2})})}i(pf,"SuccessFlash");function la({images:e,onPreview:t}){let r=I(),n=react.useMemo(()=>da(r),[r]);if(e.length===0)return null;let o=e.length===1;return jsxRuntime.jsx(reactNative.View,{style:o?n.sentSingle:n.sentGrid,children:e.map((s,a)=>jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:j(f.attachedImage,{filename:s.filename}),onPress:()=>t(s),children:jsxRuntime.jsx(reactNative.Image,{source:{uri:s.uri},style:o?n.singleImage:n.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${s.uri}-${a}`))})}i(la,"SentImages");function da(e){let t=e.color,r=e.type;return reactNative.StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:Qs,height:Qs,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:Zs,overflow:"hidden",backgroundColor:t.composerFill,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...me,alignItems:"center",justifyContent:"center",backgroundColor:$s(e.color.brandInk,nf)??e.color.brandSofter},successOverlay:{...me,alignItems:"center",justifyContent:"center",backgroundColor:of},failedOverlay:{...me,borderRadius:Zs,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:sf},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:kn,height:kn,borderRadius:kn/2,backgroundColor:uf,borderWidth:1.5,borderColor:t.surface,alignItems:"center",justifyContent:"center"},rejected:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:Js,height:Js,borderRadius:tf,backgroundColor:ta},gridImage:{width:ea,height:ea,borderRadius:rf,backgroundColor:ta}})}i(da,"makeStyles");var ff="file",In="multipart upload failed";function ua(e){let t;try{t=new FormData;for(let[r,n]of Object.entries(e.fields))t.append(r,n);t.append(ff,e.file);}catch{return Promise.reject(new Error(In))}return e.fetch!==void 0?gf(e.fetch,e.url,t,e.signal):mf(e.url,t,e.signal)}i(ua,"postRnMultipart");function yf(e){return e>=200&&e<300}i(yf,"stored");function mf(e,t,r){return new Promise((n,o)=>{let s=globalThis.XMLHttpRequest;if(typeof s!="function"||r?.aborted===true){o(new Error(In));return}let a=null,d=i(()=>{a!==null&&r?.removeEventListener("abort",a);},"release"),l=i(()=>{d(),o(new Error(In));},"fail");try{let u=new s;u.open("POST",e),u.withCredentials=!1,u.onload=()=>{d(),n(yf(u.status));},u.onerror=l,u.ontimeout=l,u.onabort=l,r!==void 0&&(a=i(()=>{try{u.abort();}finally{l();}},"onAbort"),r.addEventListener("abort",a,{once:!0})),u.send(t);}catch{l();}})}i(mf,"postWithXhr");function gf(e,t,r,n){return Promise.resolve().then(()=>e(t,{method:"POST",body:r,credentials:"omit",...n?{signal:n}:{}})).then(o=>o.ok)}i(gf,"postWithFetch");var hf="chat attachment upload: the file handle has no uri",bf="chat attachment upload failed";function vf(e){return {uri:e.uri,name:$r(e.name),type:e.mimeType}}i(vf,"filePartOf");function An(e={}){return Object.freeze({postMultipart(t,r,n){if(typeof r.uri!="string"||r.uri.length===0)return Promise.reject(new Error(hf));let{signal:o,onProgress:s}=n,a=i(()=>Promise.reject(new Error(bf)),"failed");return o?.aborted===true?a():ua({url:t.upload_url,fields:t.upload_fields,file:vf(r),signal:o,fetch:e.fetch}).then(d=>{if(!d)return a();s?.(1);},a)}})}i(An,"createRnChatAttachmentTransport");function Fn(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=ie(),o=react.useMemo(()=>ir(e.registry.services.authFor(t)),[e,t,n]),[s,a]=react.useState({repository:o,pets:[],loading:true,error:null}),d=s.repository===o?s:{pets:[],loading:true,error:null},l=react.useRef(0),u=react.useCallback(async()=>{let p=++l.current;a(b=>({...b,repository:o,loading:true,error:null,pets:b.repository===o?b.pets:[]}));let y=await o.list();p===l.current&&a(y.ok?{repository:o,pets:y.value,loading:false,error:null}:b=>({repository:o,pets:b.repository===o?b.pets:[],loading:false,error:y.error}));},[o]);react.useEffect(()=>(u(),()=>{l.current+=1;}),[u]);let c=react.useMemo(()=>r===null?null:d.pets.find(p=>p.petRef===r)??null,[r,d.pets]);return react.useMemo(()=>({pets:d.pets,activePet:c,loading:d.loading,error:d.error,refresh:u}),[d.pets,d.loading,d.error,c,u])}i(Fn,"useEverfurPets");function ca(e,t){if(t!==null){let r=e.find(n=>n.petRef===t);if(r!==void 0)return r}return e[0]??null}i(ca,"headerPetOf");function re(e,t){if(e===void 0)return {};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}i(re,"slotBox");function Mn(e){return e===void 0||e.backgroundColor!==void 0?e:e.borderRadius===void 0?void 0:{borderRadius:e.borderRadius}}i(Mn,"ownGroundSlot");function ce(e){return e?.textColor===void 0?{}:{color:e.textColor}}i(ce,"slotText");var pa=Object.freeze({visitButton:"Talk to a vet"});var fa=Symbol.for("@everfur/sdk/televet");function xe(){let e=globalThis,t=e[fa];if(t!==void 0)return t;let r={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[fa]=r,r}i(xe,"televetGlobal");function hr(e){let t=xe();t.snapshot=Object.freeze({...t.snapshot,...e});for(let r of [...t.listeners])try{r();}catch{}}i(hr,"publish");function ya(e){let t=xe().presenter;if(t===null)return "absent";try{return t(e)===!1?"declined":"presented"}catch(r){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",r),"threw"}}i(ya,"callTelevetPresenter");function ma(e){let t=xe();return t.listeners.add(e),()=>{t.listeners.delete(e);}}i(ma,"subscribeTelevetExperience");function Ln(){return xe().snapshot}i(Ln,"televetExperienceSnapshot");function Tf(){return xe().hosts.length>0}i(Tf,"hasTelevetHost");function ga(e){if(!Tf())return false;let t=Object.freeze({...e});return hr({request:t,serial:xe().snapshot.serial+1}),true}i(ga,"presentTelevetExperience");function Dn(){xe().snapshot.request!==null&&hr({request:null});}i(Dn,"dismissTelevetExperience");function ha(){let e=xe(),t=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,t],hr({activeHost:e.hosts[0]??null}),t}i(ha,"claimTelevetHost");function ba(e){let t=xe();t.hosts=t.hosts.filter(n=>n!==e);let r=t.hosts[0]??null;hr(r===null?{activeHost:r,request:null}:{activeHost:r});}i(ba,"releaseTelevetHost");var va=false;function br(e,t){return t!==void 0?(W(t,e),"onStartInApp"):ya(e)==="presented"?"presenter":ga(e)?"experience":(va||(va=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}i(br,"openVetVisitInApp");function Ra(e){let t=null;return ()=>{if(t!==null)return t;let r=e();return t=r,r.then(void 0,()=>{t===r&&(t=null);}),r}}i(Ra,"memoizeTelevetLoader");function Sa(e){let[t,r]=react.useState(null);react.useEffect(()=>{let u=ha();return r(u),()=>{ba(u);}},[]);let n=react.useSyncExternalStore(ma,Ln,Ln),s=t!==null&&n.activeHost===t?n.request:null,[a,d]=react.useState(null),l=s!==null&&a===null;return react.useEffect(()=>{if(!l)return;let u=true;return e().then(c=>{u&&d(()=>c);},c=>{u&&(console.warn("[everfur] The in-app vet visit could not load its screens.",c),Dn());}),()=>{u=false;}},[l,e]),s===null||a===null?null:{module:a,request:s,serial:n.serial,dismiss:Dn}}i(Sa,"useTelevetExperienceHost");var wf=Ra(()=>import('@everfur/sdk/televet/booking'));function xt(){let e=Sa(wf);if(e===null)return null;let{EverfurTelevetModal:t}=e.module;return jsxRuntime.jsx(t,{request:e.request,onClose:e.dismiss},e.serial)}i(xt,"EverfurTelevetHost");var Vn=Object.freeze(["visit","join","summary","messages"]);function Nn(e){return typeof e=="string"&&Vn.includes(e)}i(Nn,"isVetVisitIntent");var xf="/widget/v1/televet/handoffs",_f="/widget/v1/televet/availability",If="/widget/v1/televet/chat-entry",Af=/^[a-z0-9][a-z0-9_-]{0,39}$/,Of=/^[A-Za-z0-9_-]{22}$/;var Ta=32,Pa=128,wa=64;function Un(e){let t=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}i(Un,"vetVisitErrorReasonOf");function ka(e){return V(q("validationFailed",{retryable:false,wireMessage:e}))}i(ka,"invalid");function Hn(e){return V(q("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}i(Hn,"unusable");function Ff(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!Af.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let o=t?.entry;if(o!=null){if(o!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=o;}let s=t?.visitRef,a=t?.intent,d=s!=null;if(d){let l=typeof s=="string"?s.trim():"";if(l.length<1||[...l].length>wa)return {ok:false,message:`visitRef must be 1..${wa} characters`};r.visit_ref=l;}if(a!=null){if(!d)return {ok:false,message:"intent needs the visitRef it opens"};if(!Nn(a))return {ok:false,message:`intent must be one of ${Vn.join(", ")}`};r.intent=a;}return {ok:true,body:r}}i(Ff,"handoffBody");function Mf(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!Nn(r)?null:Object.freeze({visitRef:t,intent:r})}i(Mf,"parseVisitEcho");function _a(e){let t=e.funnel??Ue({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=i(o=>(xa(r,"televet.visit.handoff_failed",{reason:Un(o)}),V(o)),"failed");return {async createHandoff(o,s){let a;if(o!=null){let E=typeof o=="string"?[...o].length:0;if(E<1||E>Pa)return n(q("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Pa} characters`}));a=o;}let d=Ff(a,s);if(!d.ok){let E=ka(d.message);return E.ok?E:n(E.error)}let l=d.body,u=await t.send("televet.visit.handoff",{method:"POST",path:xf,body:l},{idempotent:false,maxAttempts:1});if(!u.ok)return n(u.error);let c=Lf(u.value),p=l.return_to!==void 0,y=p?u.value?.flow_id:void 0;if(p&&(typeof y!="string"||!Of.test(y))){let E=Hn("the handoff response carried no usable return flow id");return E.ok?E:n(E.error)}let b=l.visit_ref!==void 0,h=b?Mf(u.value?.visit):null;if(b&&h===null){let E=Hn("the handoff response did not confirm the visit it opens");return E.ok?E:n(E.error)}let P=c===null?null:Object.freeze({...c,...p?{flowId:y}:{},...h!==null?{visit:h}:{}});return P===null?n(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(xa(r,"televet.visit.handoff_created",{pet_scoped:l.pet_ref!==void 0}),de(P))},async checkAvailability(o){if(typeof o!="string"||o.length>Ta)return ka(`state must be at most ${Ta} characters`);let s=await t.send("televet.visit.availability",{method:"POST",path:_f,body:{state:o}},{idempotent:false,maxAttempts:1});if(!s.ok)return V(s.error);let a=s.value?.available;return typeof a!="boolean"?Hn("the availability response carried no usable answer"):de(Object.freeze({available:a}))},async chatEntryOpen(){try{let o=await t.send("televet.visit.chat_entry",{method:"GET",path:If},{maxAttempts:1});return o.ok&&o.value?.open===!0}catch{return false}}}}i(_a,"createVetVisitController");function Lf(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Hf(t)?null:Object.freeze({url:t,expiresAt:r})}i(Lf,"parseHandoff");var Df=new Set(["localhost","127.0.0.1","[::1]"]),Vf=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Nf=/[\s\u0000-\u001f\u007f]/;function Hf(e){if(Nf.test(e))return false;let t=Vf.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let o=n.replace(/:\d+$/,"").toLowerCase(),s=r==="https",a=r==="http"&&Df.has(o);if(!s&&!a)return false;let d=e.indexOf("#");if(d<0)return false;let l=e.slice(d);return l.startsWith("#h=")&&l.length>3}i(Hf,"isOpenableVisitUrl");function xa(e,t,r){if(e)try{e.track(t,r);}catch{}}i(xa,"safeTrack");var zn=Object.freeze({status:"idle",error:null,errorReason:null});function zf(e,t,r){let{usState:n,chat:o,scope:s}=r,a=t&&(n!==null||o),d=`${n??""}|${o?"chat":""}`,[l,u]=react.useState(null);if(react.useEffect(()=>{if(!a)return;let p=true,y=e.current;return u(null),i(async()=>{try{if(o&&!(y.chatEntryOpen&&await y.chatEntryOpen()))return !1;if(n===null)return !0;if(!y.checkAvailability)return !1;let h=await y.checkAvailability(n);return h.ok&&h.value.available}catch{return false}},"ask")().then(h=>{p&&u({key:d,open:h});}),()=>{p=false;}},[a,d,n,o,s,e]),!a)return null;let c=l!==null&&l.key===d;return {open:c&&l.open,pending:!c}}i(zf,"usePreflight");var Bf=Object.freeze({status:"opening",error:null,errorReason:null});function Oa(e,t={}){let{runtime:r,userRef:n,scopeEpoch:o}=ie(),s=St("televet"),a=s.enabled&&n!==null,d=t.usState??null,l=t.entry==="chat",u=t.petRef??null,c=t.prefer==="redirect",p=react.useMemo(()=>{if(t.controller)return t.controller;let{services:x}=r.registry;return _a({auth:x.authFor(n),telemetry:x.telemetry,...x.errorPolicy?{errorPolicy:x.errorPolicy}:{}})},[r,n,o,t.controller]),y=react.useRef(p);y.current=p;let b=react.useMemo(()=>({runtime:r,userRef:n,scopeEpoch:o}),[r,n,o]),h=zf(y,a,{usState:d,chat:l,scope:b}),P=a&&(h===null||h.open)&&(!l||u!==null),E=t.returnTo??null,[S,A]=react.useState(zn),T=react.useRef(null),_=react.useRef({runtime:r,userRef:n,scopeEpoch:o});_.current={runtime:r,userRef:n,scopeEpoch:o};let m=react.useRef(p);m.current=p;let R=react.useRef(P);R.current=P;let O=react.useCallback((x,D)=>{if(T.current)return T.current;let U=i((oe,Fe)=>(A({status:oe==="cancelled"?"idle":"error",error:Fe,errorReason:oe==="cancelled"?null:oe}),Object.freeze({opened:false,reason:oe,error:Fe})),"fail");if(!R.current)return Promise.resolve(U("unavailable",null));let z=e.prepare();if(!z.ok)return Promise.resolve(U(z.reason,null));let Z=_.current,le=m.current;A(Bf);let Ne=(async()=>{let oe,Fe={...E!==null?{returnTo:E}:{},...l?{entry:"chat"}:{},...D!==null?{visitRef:D.visitRef}:{},...D!==null&&D.intent!==null&&D.intent!==void 0?{intent:D.intent}:{}},Vt=Object.keys(Fe).length===0?void 0:Fe,Nt=x===void 0?u:x;try{oe=await(Vt===void 0?le.createHandoff(Nt):le.createHandoff(Nt,Vt));}catch{return e.abandon(z.value),U("unknown",null)}let Je=_.current;if(Je.runtime!==Z.runtime||Je.userRef!==Z.userRef||Je.scopeEpoch!==Z.scopeEpoch)return e.abandon(z.value),U("cancelled",null);if(!oe.ok)return e.abandon(z.value),U(Un(oe.error),oe.error);let yt=await e.finish(z.value,oe.value);return yt!==null?U(yt,null):(A(zn),Object.freeze(oe.value.flowId===void 0?{opened:true}:{opened:true,flowId:oe.value.flowId}))})().finally(()=>{T.current===Ne&&(T.current=null);});return T.current=Ne,Ne},[e,u,E,l]),F=react.useCallback((x,D)=>{if(!R.current)return A({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}));let U=x===void 0?u:x,z={...U!==null?{petRef:U}:{},...d!==null?{usState:d}:{},...D!==null?{visitRef:D.visitRef,intent:D.intent}:{}};return br(z)===null?(A({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}))):(A(zn),Promise.resolve(Object.freeze({opened:true})))},[u,d]),w=react.useCallback(x=>c?O(x,null):F(x,null),[c,O,F]),g=react.useCallback((x,D)=>c?O(void 0,{visitRef:x,intent:D??null}):F(void 0,{visitRef:x,intent:D??null}),[c,O,F]);return {available:P,isPending:s.isPending||(h?.pending??false),status:S.status,error:S.error,errorReason:S.errorReason,open:w,openVisit:g}}i(Oa,"useVetVisitWith");var Gf=i(e=>reactNative.Linking.openURL(e),"defaultOpenUrl");function Cr(e={}){let{openUrl:t,...r}=e,n=react.useMemo(()=>{let o=t??Gf;return {prepare:i(()=>({ok:true,value:null}),"prepare"),async finish(s,a){try{return await o(a.url),null}catch{return "openFailed"}},abandon:i(()=>{},"abandon")}},[t]);return Oa(n,r)}i(Cr,"useVetVisit");var Fa=44,Xf=.6;function at(e){let{petRef:t,label:r,openUrl:n,onOpened:o,onError:s,style:a,labelStyle:d,controller:l,returnTo:u,usState:c,entry:p,visitRef:y,intent:b,onStartInApp:h,prefer:P}=e,E=P==="redirect",S=Cr({...u!==void 0?{returnTo:u}:{},...c!==void 0?{usState:c}:{},...p!==void 0?{entry:p}:{},...t!==void 0?{petRef:t}:{},...n!==void 0?{openUrl:n}:{},...l!==void 0?{controller:l}:{},prefer:E?"redirect":"in-app"}),A=I(),T=react.useMemo(()=>Qf(A),[A]),_=react.useRef(false);if(!S.available)return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[null,jsxRuntime.jsx(xt,{})]});let m=S.status==="opening",R=r??pa.visitButton;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{onPress:i(()=>{if(!(m||_.current)){if(!E){let F={...t!==void 0?{petRef:t}:{},...c!==void 0?{usState:c}:{},...y!=null?{visitRef:y,intent:b??null}:{}};br(F,h)===null&&W(s,"unavailable",null);return}_.current=true,(y==null?S.open():S.openVisit(y,b??null)).then(F=>{F.opened?W(o,F.flowId??null):F.reason!=="cancelled"&&W(s,F.reason,F.error);}).finally(()=>{_.current=false;});}},"onPress"),accessibilityRole:"button",accessibilityLabel:R,accessibilityState:{busy:m,disabled:m},style:[T.button,m?T.busy:null,a],children:jsxRuntime.jsx(v,{style:[T.label,d],children:R})}),jsxRuntime.jsx(xt,{})]})}i(at,"VetVisitButton");function Qf(e){let{color:t,space:r,radius:n,type:o,slots:s}=e;return reactNative.StyleSheet.create({button:{minHeight:Fa,minWidth:Fa,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.primary,...re(s.vetVisitButton)},busy:{opacity:Xf},label:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug,...ce(s.vetVisitButton)}})}i(Qf,"makeStyles");function Bn(e){return er(e)==="cat"?"cat":"dog"}i(Bn,"speciesOf");function jn(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.floor(e)}i(jn,"petAgeYears");function Va(e){let t=jn(e.ageYears),r=Bn(e.species)==="cat"?"Cat":"Dog";if(t==null)return r;let n=t===1?"1 yr":`${t} yrs`;return `${r} \xB7 ${n}`}i(Va,"formatPetMeta");var Da=Object.freeze([Object.freeze({background:"#ffbdbd",foreground:"#6d1d14"}),Object.freeze({background:"#a0c4f6",foreground:"#0b3a73"}),Object.freeze({background:"#fbc558",foreground:"#10462e"}),Object.freeze({background:"#bde7c5",foreground:"#0e3b22"}),Object.freeze({background:"#dcc7f4",foreground:"#3a1d6a"}),Object.freeze({background:"#ffd8a8",foreground:"#5a2a04"})]);function Zf(e){let t=0;for(let r=0;r<e.length;r+=1)t=t*31+e.charCodeAt(r)>>>0;return Da[t%Da.length]}i(Zf,"pickInitialsPalette");function Wn(e){let t=(e??"").trim();return (Array.from(t)[0]??"?").toUpperCase()}i(Wn,"getInitial");function Na(e){return {...Zf(e.petRef),initial:Wn(e.name)}}i(Na,"petInitials");function ry(e){return Math.max(12,Math.round(e*.42))}i(ry,"letterSize");function It({pet:e,size:t,ringStroke:r}){let n=I(),o=react.useMemo(()=>ny(n),[n]),s=t-r*2,a=e===null?null:Na(e),d=ry(s);return jsxRuntime.jsx(pr,{size:t,strokeWidth:r,color:n.color.success,children:jsxRuntime.jsx(reactNative.View,{style:[o.disc,{width:s,height:s,borderRadius:s/2},a===null?o.discEmpty:{backgroundColor:a.background}],children:jsxRuntime.jsx(v,{tier:"badge",style:[o.letter,{fontSize:d,lineHeight:Math.round(d*1.2),color:a===null?n.color.text.muted:a.foreground}],children:a===null?Wn(null):a.initial})})})}i(It,"PetDisc");function ny(e){return reactNative.StyleSheet.create({disc:{alignItems:"center",justifyContent:"center",overflow:"hidden"},discEmpty:{backgroundColor:e.color.brandSoft},letter:{...C(e,"bold"),textAlign:"center",includeFontPadding:false}})}i(ny,"makeStyles");var qn=48,za=2,dy=320,uy="80%",cy="rgba(17,17,17,0.45)",py=18,Ha=22,fy=12,Ua=.4,yy=44;function Yn(e){return e?.name?.trim()||f.yourPet}i(Yn,"petDisplayName");function Ba({visible:e,pets:t,activePetRef:r,onSelect:n,onAddPet:o=null,onClose:s}){let a=I(),d=react.useMemo(()=>my(a),[a]);return e?jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:a.motion.reducedMotion?"none":"fade",onRequestClose:s,children:jsxRuntime.jsxs(reactNative.View,{style:d.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:me,onPress:s,accessibilityRole:"button",accessibilityLabel:f.close,children:jsxRuntime.jsx(reactNative.View,{style:d.backdrop})}),jsxRuntime.jsxs(reactNative.View,{style:d.panel,accessibilityViewIsModal:true,children:[jsxRuntime.jsx(v,{tier:"heading",style:d.title,accessibilityRole:"header",children:f.yourPets}),jsxRuntime.jsx(reactNative.ScrollView,{style:d.list,contentContainerStyle:d.listContent,showsVerticalScrollIndicator:true,children:t.map(l=>{let u=l.petRef===r,c=Yn(l),p=Va(l);return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(u?f.petCurrentlyActive:f.switchToPet,{name:c}),accessibilityState:{selected:u},style:[d.row,u?d.rowActive:null],onPress:()=>n(l.petRef),children:[jsxRuntime.jsx(It,{pet:l,size:qn,ringStroke:za}),jsxRuntime.jsxs(reactNative.View,{style:d.copy,children:[jsxRuntime.jsx(v,{style:d.name,numberOfLines:1,children:c}),jsxRuntime.jsx(v,{tier:"compact",style:d.meta,numberOfLines:1,children:u?`${f.activePrefix}${p}`:p})]}),u?jsxRuntime.jsx(Le,{size:py,color:a.color.brandInk}):null]},l.petRef)})}),o!==null?jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:f.addAnotherPet,style:d.addRow,onPress:o,children:[jsxRuntime.jsx(reactNative.View,{style:d.addDisc,children:jsxRuntime.jsx(v,{tier:"control",style:d.addPlus,children:"+"})}),jsxRuntime.jsx(v,{style:d.addLabel,children:f.addAnotherPet})]}):null,jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.close,containerStyle:d.closeSlot,style:d.closeButton,onPress:s,children:jsxRuntime.jsx(v,{tier:"control",style:d.closeText,children:f.close})})]})]})}):null}i(Ba,"PetSwitcherSheet");function my(e){let t=e.color,r=e.radius;return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:cy},panel:{backgroundColor:t.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:Ha,borderTopRightRadius:Ha,gap:14,maxHeight:uy},title:{...C(e,"bold"),fontSize:18,lineHeight:22,color:t.brandInk},list:{maxHeight:dy,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:yy,paddingHorizontal:8},addDisc:{width:qn,height:qn,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:za,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream},addPlus:{...C(e,"bold"),fontSize:20,lineHeight:22,color:t.brandInk},addLabel:{...C(e,"bold"),fontSize:15,lineHeight:20,color:t.text.primary},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowActive:{borderColor:t.brandInk,backgroundColor:t.brandSoft},copy:{flex:1,gap:2},name:{...C(e,"bold"),fontSize:15,lineHeight:18,color:t.text.primary},meta:{...C(e,"monoBold"),fontSize:11,lineHeight:13,color:t.text.muted,textTransform:"uppercase",letterSpacing:Ua},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:fy,backgroundColor:t.brandSoft},closeText:{...C(e,"bold"),color:t.brandInk,fontSize:13,lineHeight:16,letterSpacing:Ua}})}i(my,"makeStyles");var by=44,Rr=36,vy=22,Kn=9,Cy=1.5,Wa=6,Ye=35,Sr=1.75,$n=12.4,Ey=.5,Ry=8,Sy=28,Ty=160;function Qn(e,t){return ca(e,t)}i(Qn,"headerPet");function qa({pets:e,petRef:t,historyUnread:r,onOpenHistory:n,onPetChange:o,onAddPet:s,vet:a}){let d=I(),l=react.useMemo(()=>wy(d),[d]),[u,c]=react.useState(false),p=Qn(e.pets,t),y=e.pets.length>=2,b=t??p?.petRef??null,h=Yn(p),P=i(S=>{c(false),e.setActivePet(S),W(o,S);},"select"),E=s===void 0?null:()=>{c(false),W(s);};return jsxRuntime.jsxs(reactNative.View,{style:l.row,children:[jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:r?f.openMenuUnread:f.openMenu,containerStyle:l.iconSlot,style:l.iconButton,onPress:n,children:[jsxRuntime.jsx(Es,{size:vy,color:d.color.text.primary,strokeWidth:2}),r?jsxRuntime.jsx(reactNative.View,{style:l.unreadDot,pointerEvents:"none"}):null]}),jsxRuntime.jsx(reactNative.View,{style:l.center,pointerEvents:"box-none",children:jsxRuntime.jsx(Py,{logoUrl:d.meta.logoUrl,name:d.meta.displayName,styles:l})}),b===null?null:jsxRuntime.jsx(at,{entry:"chat",petRef:b,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:l.vetEntry,labelStyle:l.vetEntryLabel}),jsxRuntime.jsx(reactNative.View,{style:l.right,children:y?jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(f.switchActivePet,{name:h}),containerStyle:l.avatarSlot,style:l.avatarWrap,onPress:()=>c(true),children:[jsxRuntime.jsx(It,{pet:p,size:Ye,ringStroke:Sr}),jsxRuntime.jsx(reactNative.View,{style:l.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsxRuntime.jsx(Ss,{size:Ry,color:d.color.brandInk,strokeWidth:2})})]}):e.loading&&p===null?jsxRuntime.jsx(reactNative.View,{style:l.avatarWrap,accessible:true,accessibilityLabel:f.yourPet,children:jsxRuntime.jsx(pr,{size:Ye,strokeWidth:Sr,color:d.color.success,children:jsxRuntime.jsx(reactNative.View,{style:l.placeholderDisc})})}):jsxRuntime.jsx(reactNative.View,{style:l.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:p===null?f.yourPet:h,children:jsxRuntime.jsx(It,{pet:p,size:Ye,ringStroke:Sr})})}),jsxRuntime.jsx(Ba,{visible:u,pets:e.pets,activePetRef:p?.petRef??null,onSelect:P,onAddPet:E,onClose:()=>c(false)})]})}i(qa,"ChatHeader");function Py({logoUrl:e,name:t,styles:r}){let[n,o]=react.useState(null);return e===null||n===e?null:jsxRuntime.jsx(reactNative.View,{style:r.logoBar,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:r.logo,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:()=>o(e)})})}i(Py,"BrandLogo");function wy(e){let t=e.color,r=Ye-Sr*2;return reactNative.StyleSheet.create({vetEntry:{minHeight:by,justifyContent:"center",paddingHorizontal:12,borderRadius:e.radius.pill,backgroundColor:t.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},vetEntryLabel:{...C(e,"bold"),color:t.brandInk,fontSize:e.type.size.caption},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:10,backgroundColor:t.surface},iconSlot:{borderRadius:Rr/2},iconButton:{width:Rr,height:Rr,borderRadius:Rr/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:Wa,right:Wa,width:Kn,height:Kn,borderRadius:Kn,backgroundColor:t.danger,borderWidth:Cy,borderColor:t.surface},center:{...me,alignItems:"center",justifyContent:"center"},logoBar:{alignItems:"center",paddingHorizontal:e.space.lg},logo:{height:Sy,width:Ty},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:Ye/2},avatarWrap:{width:Ye,height:Ye,position:"relative"},placeholderDisc:{width:r,height:r,borderRadius:r/2,backgroundColor:t.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:$n,height:$n,borderRadius:$n/2,borderWidth:Ey,borderColor:t.success,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"}})}i(wy,"makeStyles");var $a=44,Ay="rgba(17,17,17,0.55)",Xa=26,Oy=36,Qa=4,Zn=20,Jn=38,Fy=18,My=12;function Za({visible:e,onSubmit:t,onSkip:r}){let n=I(),o=react.useMemo(()=>Ly(n),[n]),[s,a]=react.useState(null),[d,l]=react.useState(""),[u,c]=react.useState(false),[p,y]=react.useState(false),b=i(()=>{a(null),l(""),c(false),y(false);},"reset"),h=i(()=>{u||(b(),r());},"skip"),P=i(async()=>{if(u)return;c(true),y(false);let S=d.trim();await t(s,S.length>0?S:null)?b():(c(false),y(true));},"submit");if(!e)return null;let E=[...d].length>Xt;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:n.motion.reducedMotion?"none":"slide",onRequestClose:h,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:o.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:o.scrim,onPress:h,accessibilityRole:"button",accessibilityLabel:f.feedbackSkipA11y}),jsxRuntime.jsxs(reactNative.View,{style:o.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[jsxRuntime.jsx(reactNative.View,{style:o.handle}),jsxRuntime.jsxs(reactNative.View,{style:o.header,children:[jsxRuntime.jsx(reactNative.View,{style:o.iconBadge,children:jsxRuntime.jsx(cr,{size:Fy,color:n.color.brandInk,active:false,rotate:"180deg"})}),jsxRuntime.jsxs(reactNative.View,{style:o.headerText,children:[jsxRuntime.jsx(v,{tier:"heading",style:o.title,accessibilityRole:"header",children:f.feedbackTitle}),jsxRuntime.jsx(v,{style:o.subtitle,children:f.feedbackSubtitle})]})]}),jsxRuntime.jsx(reactNative.View,{style:o.options,children:zr.map(S=>{let A=s===S.key;return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:S.label,accessibilityState:{selected:A},style:[o.option,A?o.optionSelected:null],onPress:()=>a(T=>T===S.key?null:S.key),children:[jsxRuntime.jsx(v,{style:[o.optionLabel,A?o.optionLabelSelected:null],children:S.label}),jsxRuntime.jsx(reactNative.View,{style:[o.radio,A?o.radioSelected:null],children:A?jsxRuntime.jsx(Le,{size:My,color:n.color.surface,strokeWidth:2}):null})]},S.key)})}),jsxRuntime.jsxs(reactNative.View,{style:o.inputWrap,children:[jsxRuntime.jsx(rt,{style:o.input,placeholder:f.feedbackNotesPlaceholder,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:f.feedbackNotesPlaceholder,value:d,onChangeText:l,multiline:true,editable:!u}),d.length>0?jsxRuntime.jsx(v,{tier:"compact",style:[o.counter,E?o.counterOver:null],children:`${[...d].length}/${Xt}`}):null]}),p?jsxRuntime.jsx(v,{style:o.failed,accessibilityRole:"alert",children:f.feedbackFailed}):null,jsxRuntime.jsxs(reactNative.View,{style:o.actions,children:[jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.feedbackSubmit,accessibilityState:{busy:u,disabled:u||E},disabled:u||E,style:[o.submit,u||E?o.submitDisabled:null],onPress:()=>{P();},children:jsxRuntime.jsx(v,{tier:"control",style:o.submitLabel,children:f.feedbackSubmit})}),jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:f.feedbackSkipA11y,hitSlop:8,onPress:h,style:o.skip,children:jsxRuntime.jsx(v,{tier:"control",style:o.skipLabel,children:f.feedbackSkip})})]})]})]})})}i(Za,"FeedbackReasons");function Ly(e){let t=e.color,r=e.type,n=e.radius,o=e.slots;return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{...me,backgroundColor:Ay},sheet:{backgroundColor:t.surface,borderTopLeftRadius:Xa,borderTopRightRadius:Xa,paddingHorizontal:22,paddingTop:12,paddingBottom:34,gap:14},handle:{alignSelf:"center",width:Oy,height:Qa,borderRadius:Qa/2,backgroundColor:t.brandBorder,marginBottom:2},header:{flexDirection:"row",alignItems:"center",gap:12},iconBadge:{width:Jn,height:Jn,borderRadius:Jn/2,alignItems:"center",justifyContent:"center",backgroundColor:t.brandSoft},headerText:{flex:1,gap:2},title:{...C(e,"bold"),fontSize:20,lineHeight:28,color:t.text.primary,letterSpacing:r.letterSpacing.tight},subtitle:{...C(e,"regular"),fontSize:r.size.body,lineHeight:r.size.body*r.lineHeight.relaxed,color:t.text.muted},options:{gap:8},option:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:14,paddingVertical:13,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,backgroundColor:t.surface},optionSelected:{borderColor:t.brandInk,backgroundColor:t.brandSoft},optionLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.primary},optionLabelSelected:{color:t.brandInk},radio:{width:Zn,height:Zn,borderRadius:Zn/2,borderWidth:2,borderColor:t.brandBorderStrong,alignItems:"center",justifyContent:"center"},radioSelected:{borderColor:t.brandInk,backgroundColor:t.brandInk},inputWrap:{gap:4},input:{minHeight:72,maxHeight:132,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:14,paddingTop:12,paddingBottom:12,...C(e,"regular"),fontSize:r.size.body,color:t.text.primary,textAlignVertical:"top"},counter:{...C(e,"mono"),alignSelf:"flex-end",fontSize:r.size.caption,letterSpacing:.3,color:t.text.placeholder},counterOver:{color:t.danger},failed:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},actions:{gap:10,alignItems:"center"},submit:{alignSelf:"stretch",minHeight:$a,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.xl,borderRadius:n.pill,backgroundColor:t.brand,...re(o.primaryButton)},submitDisabled:{opacity:.6},submitLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.onPrimary,...ce(o.primaryButton)},skip:{minHeight:$a,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},skipLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.muted}})}i(Ly,"makeStyles");function Ja(e){return [e.surface,e.surfaceCream,e.surfaceSubtle,e.background,e.chatGround,e.composerFill]}i(Ja,"textGrounds");function Dy(e,t){let r=new Set(Ja(t));return Ja(e).every(n=>r.has(n))}i(Dy,"onCompiledGrounds");function el(e){let t=(e.brightness==="dark"?Bo:tt).color;return e.color.brand===t.brand&&!Dy(e.color,t)}i(el,"everfurBrandOnPartnerGround");var Qy=.88,Zy=420,Jy=58,em="rgba(17,17,17,0.28)",tm=.08,rm=.1,nm=.08,om=.18,im=.78,sm=.7,eo=36,am=10,lm=14,dm=12,um=16,cm=14,to=8,pm=1.5,fm=.5,ym=yr(Pt.standard);function mm(e){return Math.min(Math.round(e*Qy),Zy)}i(mm,"drawerPanelWidth");function tl({chat:e,history:t}){let[r,n]=react.useState(t.open),o=react.useCallback(()=>n(false),[]);return t.open&&!r&&n(true),r?jsxRuntime.jsx(gm,{chat:e,history:t,onHidden:o}):null}i(tl,"HistoryDrawer");function gm({chat:e,history:t,onHidden:r}){let n=I(),o=react.useMemo(()=>bm(n),[n]),s=G(),a=reactNativeSafeAreaContext.useSafeAreaInsets(),{width:d}=reactNative.useWindowDimensions(),l=mm(d),u=t.open,c=react.useRef(null);c.current===null&&(c.current=new reactNative.Animated.Value(s.drawerMs<=0&&u?1:0));let p=c.current;react.useEffect(()=>{if(!u&&s.drawerMs<=0){r();return}let S=reactNative.Animated.timing(p,{toValue:u?1:0,duration:s.drawerMs,easing:ym,useNativeDriver:true});return S.start(({finished:A})=>{A&&!u&&r();}),()=>S.stop()},[u,p,s.drawerMs,r]);let y=p.interpolate({inputRange:[0,1],outputRange:[-l,0]}),b=t.filtered,h=t.rows.length===0,P=h&&t.loading?jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,accessibilityLabel:Y.loading,accessibilityState:{busy:true},children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{color:o.emptyTitle.color}),jsxRuntime.jsx(v,{style:o.emptyBody,children:Y.loading})]}):h&&t.error!==null?jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,children:[jsxRuntime.jsx(v,{style:o.emptyTitle,accessibilityRole:"alert",children:Y.loadFailed}),jsxRuntime.jsx(v,{style:o.emptyBody,children:t.error}),jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.retryA11y,containerStyle:o.retrySlot,style:o.retryButton,onPress:()=>{t.load();},children:jsxRuntime.jsx(v,{tier:"control",style:o.retryText,children:Y.retry})})]}):jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,children:[jsxRuntime.jsx(v,{style:o.emptyTitle,children:t.emptyKind==="empty"?Y.empty:Y.noMatch}),jsxRuntime.jsx(v,{style:o.emptyBody,children:t.emptyKind==="empty"?Y.emptyBody:Y.noMatchBody})]}),E=!t.searching&&t.loadingMore?jsxRuntime.jsx(reactNative.View,{style:o.loadMoreFooter,children:jsxRuntime.jsx(v,{style:o.loadMoreLabel,children:Y.loadingMore})}):null;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:"none",onRequestClose:t.close,children:jsxRuntime.jsxs(reactNative.View,{style:o.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:me,onPress:t.close,accessibilityRole:"button",accessibilityLabel:Y.closeA11y,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[o.backdrop,{opacity:p}]})}),jsxRuntime.jsx(reactNative.Animated.View,{style:[o.panel,{width:l,paddingTop:Math.max(Jy,a.top+n.space.md),transform:[{translateX:y}]}],accessibilityViewIsModal:true,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:o.keyboardAvoider,behavior:reactNative.Platform.OS==="ios"?"padding":"height",children:[jsxRuntime.jsxs(reactNative.View,{style:o.searchRow,children:[jsxRuntime.jsxs(reactNative.View,{style:o.searchPill,children:[jsxRuntime.jsx(As,{size:cm,color:n.color.text.muted,strokeWidth:1.5}),jsxRuntime.jsx(rt,{value:t.query,onChangeText:S=>t.setQuery(S.replace(/^\s+/,"")),style:o.searchInput,placeholder:Y.search,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:Y.search,autoCorrect:false,autoCapitalize:"none",returnKeyType:"search"})]}),jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.newConversation,style:o.newButton,onPress:t.newConversation,children:jsxRuntime.jsx(Os,{size:um,color:n.color.text.primary,strokeWidth:1.5})})]}),jsxRuntime.jsx(v,{tier:"heading",style:o.heading,accessibilityRole:"header",children:Y.heading}),t.error!==null&&!h?jsxRuntime.jsx(reactNative.View,{style:o.errorCard,children:jsxRuntime.jsx(v,{style:o.errorText,accessibilityRole:"alert",children:t.error})}):null,jsxRuntime.jsx(reactNative.FlatList,{data:b,keyExtractor:S=>S.id,renderItem:({item:S})=>jsxRuntime.jsx(hm,{row:S,active:S.id===e.conversationId,disabled:t.loading,styles:o,onPress:()=>{t.resume(S.id);}}),contentContainerStyle:b.length===0?o.listEmpty:o.list,keyboardShouldPersistTaps:"handled",ListEmptyComponent:P,ListFooterComponent:E,onEndReached:t.loadMore,onEndReachedThreshold:fm})]})})]})})}i(gm,"DrawerModal");function hm({row:e,active:t,disabled:r,styles:n,onPress:o}){let s=e.unreadCount!==null&&e.unreadCount>0;return jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Ji(e),accessibilityState:{selected:t,disabled:r},disabled:r,style:[n.item,t?n.itemActive:null],onPress:o,children:jsxRuntime.jsxs(reactNative.View,{style:n.itemRow,children:[jsxRuntime.jsx(v,{style:[n.itemTitle,s?n.itemTitleUnread:null],numberOfLines:1,children:ar(e.title)}),s?jsxRuntime.jsx(reactNative.View,{style:n.unreadDot}):null]})})}i(hm,"Row");function wr(e,t){if(!/^#[0-9a-f]{6}$/i.test(e))return "transparent";let r=Math.round(Math.min(1,Math.max(0,t))*255);return `${e}${r.toString(16).padStart(2,"0").toUpperCase()}`}i(wr,"inkWash");function bm(e){let t=e.color,r=e.slots,n=!el(e),o=n?t.onPrimary:t.text.primary;return reactNative.StyleSheet.create({root:{flex:1},backdrop:{flex:1,backgroundColor:em},panel:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:n?t.brand:t.surface,paddingHorizontal:16,borderRightWidth:.5,borderRightColor:t.brandBorder,gap:12},keyboardAvoider:{flex:1,gap:12},searchRow:{flexDirection:"row",alignItems:"center",gap:10},searchPill:{flex:1,flexDirection:"row",alignItems:"center",gap:8,borderRadius:e.radius.pill,backgroundColor:t.surface,paddingHorizontal:14,paddingVertical:10,borderWidth:1,borderColor:wr(o,rm)},searchInput:{...C(e,"regular"),flex:1,fontSize:13,lineHeight:16,color:t.text.primary,padding:0},newButton:{width:eo,height:eo,borderRadius:eo/2,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},heading:{...C(e,"bold"),fontSize:14,lineHeight:17,color:o,marginTop:4},list:{gap:10,paddingBottom:28},listEmpty:{flexGrow:1},item:{paddingVertical:12,paddingHorizontal:4,borderRadius:am},itemActive:{backgroundColor:wr(o,tm)},itemRow:{flexDirection:"row",alignItems:"center",gap:8},itemTitle:{...C(e,"regular"),flex:1,fontSize:14,lineHeight:18,color:o},itemTitleUnread:C(e,"bold"),unreadDot:{width:to,height:to,borderRadius:to/2,backgroundColor:t.danger,borderWidth:pm,borderColor:o},errorCard:{borderRadius:dm,borderWidth:.5,borderColor:t.danger,backgroundColor:t.surface,padding:12},errorText:{...C(e,"regular"),fontSize:11,lineHeight:16,color:t.danger},emptyCard:{borderRadius:lm,padding:14,gap:6,backgroundColor:wr(o,nm),borderWidth:.5,borderColor:wr(o,om)},emptyTitle:{...C(e,"bold"),fontSize:12,lineHeight:15,color:o},emptyBody:{...C(e,"regular"),fontSize:11,lineHeight:17,color:o,opacity:im},retrySlot:{marginTop:8,alignSelf:"flex-start"},retryButton:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:7,borderWidth:1,borderColor:o,...re(r.primaryButton)},retryText:{...C(e,"bold"),fontSize:12,lineHeight:15,color:o,...ce(r.primaryButton)},loadMoreFooter:{paddingVertical:14,alignItems:"center"},loadMoreLabel:{...C(e,"regular"),fontSize:11,lineHeight:14,color:o,opacity:sm}})}i(bm,"makeStyles");var Tm=Object.freeze({}),Pm=100,wm=20;function km(e,t,r,n){return ![e,t,r,n].every(Number.isFinite)||e+r>n+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}i(km,"readWindowTops");function rl(e,t){let r=typeof e=="number"&&Number.isFinite(e),n=react.useRef(null),[o,s]=react.useState(null),a=react.useRef(null),d=react.useRef(null),l=react.useRef(true),u=react.useCallback(()=>{d.current!==null&&clearTimeout(d.current),d.current=null;},[]);react.useEffect(()=>(l.current=true,()=>{l.current=false,u();}),[u]);let c=react.useCallback(i(function y(b){n.current?.measureInWindow((h,P)=>{let E=a.current;if(!l.current||E===null)return;let S=km(P,E.y,E.height,reactNative.Dimensions.get("window").height);if(S!==null){s(A=>A!==null&&A.chatTop===S.chatTop&&A.parentTop===S.parentTop?A:S);return}b>=wm||(d.current=setTimeout(()=>{d.current=null,y(b+1);},Pm));});},"measureAt"),[]),p=react.useCallback(y=>{let{y:b,height:h}=y.nativeEvent.layout;a.current={y:b,height:h},u(),c(0);},[c,u]);return react.useMemo(()=>{if(!t)return {avoidingProps:r?{keyboardVerticalOffset:e}:Tm,probeRef:null,topInWindow:null};let y=o?.parentTop??0;return {avoidingProps:r?{keyboardVerticalOffset:e,onLayout:p}:y>0?{keyboardVerticalOffset:y,onLayout:p}:{onLayout:p},probeRef:n,topInWindow:o?.chatTop??null}},[t,r,e,o,p])}i(rl,"useChatKeyboardOffset");function nl({probeRef:e}){return e===null?null:jsxRuntime.jsx(reactNative.View,{ref:e,collapsable:false,pointerEvents:"none",style:xm})}i(nl,"KeyboardOffsetProbe");var xm=Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function ol(e,t){let r={entry:"chat",petRef:e};return t?.returnTo!==void 0&&(r.returnTo=t.returnTo),t?.usState!==void 0&&(r.usState=t.usState),t?.prefer!==void 0&&(r.prefer=t.prefer),r}i(ol,"chatVetVisitOptions");var Fm=16,Mm=.75,no=12,il=15,Lm=18,xr=22,Dm=14,Vm=8,Nm=20,Hm=10,Um=13;function al({surface:e,petRef:t,renderVetAction:r,onFindVet:n,vet:o}){let s=I(),a=react.useMemo(()=>zm(s),[s]),d=G(),l=e.tier,u=e.source;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Cn,{visible:e.showBanner&&l!==null,inMs:d.bannerInMs,outMs:d.bannerOutMs,style:a.pinned,children:l!==null&&u!==null?jsxRuntime.jsxs(reactNative.View,{accessibilityRole:"alert",style:[a.card,{borderColor:l.borderColor,backgroundColor:l.backgroundColor}],children:[jsxRuntime.jsx(v,{tier:"compact",style:[a.label,{color:l.textColor}],children:l.label}),u.reason!==null?jsxRuntime.jsx(v,{style:[a.reason,{color:l.reasonColor}],children:u.reason}):null,e.showVetAction?r!==void 0?jsxRuntime.jsx(Be,{render:()=>r(l.level),fallback:jsxRuntime.jsx(sl,{tier:l,petRef:t,onFindVet:n,vet:o,styles:a}),resetKey:l.level}):jsxRuntime.jsx(sl,{tier:l,petRef:t,onFindVet:n,vet:o,styles:a}):null,e.dismissLabel!==null?jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.dismissLabel,hitSlop:Vm,containerStyle:a.closeSlot,style:a.closeButton,onPress:e.dismiss,children:jsxRuntime.jsx(je,{size:Dm,color:l.textColor,strokeWidth:1.5})}):null]}):null}),jsxRuntime.jsx(Cn,{visible:e.showCompactIcon,inMs:d.iconInMs,outMs:d.iconOutMs,style:a.indicatorRow,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.showLatestVetAlert,hitSlop:Hm,onPress:e.expand,children:jsxRuntime.jsx(ks,{size:Nm,color:s.color.text.muted,strokeWidth:2})})})]})}i(al,"UrgencyBanner");function sl({tier:e,petRef:t,onFindVet:r,vet:n,styles:o}){let s=I(),a=Cr(ol(t,n)),d=a.status==="opening",l=a.available?()=>{a.open();}:r!==void 0?()=>{W(r,e.level);}:null;if(l===null)return null;let u=Mn(s.slots.vetVisitButton)?.textColor??e.textColor;return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:f.findVetA11y,accessibilityState:{busy:d},containerStyle:o.findVetSlot,style:[o.findVetButton,{borderColor:e.borderColor,backgroundColor:e.pillColor},o.findVetSlotBox,d?o.findVetBusy:null],onPress:l,children:[jsxRuntime.jsx(Fs,{size:Um,color:u,strokeWidth:1.5}),jsxRuntime.jsx(v,{tier:"control",style:[o.findVetLabel,{color:u}],children:f.findVet})]})}i(sl,"VetAction");function zm(e){let t=Mn(e.slots.vetVisitButton);return reactNative.StyleSheet.create({pinned:{marginTop:0,marginBottom:4,paddingHorizontal:e.space.lg},card:{borderRadius:Fm,borderWidth:Mm,paddingHorizontal:14,paddingVertical:8,gap:2},label:{...C(e,"monoBold"),fontSize:no,lineHeight:il},reason:{...C(e,"regular"),fontSize:no,lineHeight:Lm,paddingRight:xr},findVetSlot:{alignSelf:"flex-start",marginTop:6},findVetButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:e.radius.pill,borderWidth:1},findVetSlotBox:{...re(t,1)},findVetBusy:{opacity:.6},findVetLabel:{...C(e,"monoBold"),fontSize:no,lineHeight:il},closeSlot:{position:"absolute",top:6,right:6},closeButton:{width:xr,height:xr,borderRadius:xr/2,alignItems:"center",justifyContent:"center"},indicatorRow:{alignItems:"flex-end",paddingHorizontal:16,paddingTop:2,paddingBottom:4}})}i(zm,"makeStyles");function ll(){let e=Fn(),{handle:t}=ie(),r=react.useCallback(n=>t.setActivePet(n),[t]);return react.useMemo(()=>({...e,setActivePet:r}),[e,r])}i(ll,"useChatPets");var gl=300,hl=3e3,ul=120,dt=44,qm=120,Ym="86%",io=15,cl=22,Ft=.5,Km=.04,$m=8,Xm=2,Qm=1,Zm=.6,Jm=22,eg=48,pl=1.25,tg=14,rg=18,ng=6,og=14,ig=.04,sg=12,ag=2,lg=2,fl=36,yl=20,lt=36,ut=(dt-lt)/2,bl=24,vl=22,dg=.4,_r=30,Cl=20,ug=.4,cg=480,pg=8,ml=14,fg=10,yg=14,mg=12,gg=13,hg=18,bg="12%";function fe(){let e=I(),t=react.useMemo(()=>vg(e),[e]);return {theme:e,styles:t}}i(fe,"useChatTheme");function vg(e){let t=e.color,r=e.space,n=e.radius,o=e.type,s=o.size.body/tt.type.size.body,a=s===1?cl:Math.round(cl*s),d=s===1?yl:Math.round(yl*s),l=e.slots;return reactNative.StyleSheet.create({container:{flex:1,minHeight:ul,backgroundColor:t.chatGround},body:{flex:1},centered:{minHeight:ul,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},emptyContent:{flexGrow:1,alignItems:"center",justifyContent:"flex-start",paddingTop:bg,paddingHorizontal:r.lg,paddingBottom:r.lg,minHeight:cg,gap:18},errorText:{...C(e,"regular"),fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,color:t.danger,textAlign:"center",marginBottom:r.md},retryButton:{minHeight:dt,minWidth:dt,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand,...re(l.primaryButton)},retryLabel:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,...ce(l.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.sm,backgroundColor:t.surfaceCream},setupNoticeText:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption,flexShrink:1},turnNotice:{gap:r.xs,padding:r.md,borderRadius:n.lg,backgroundColor:t.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,alignItems:"flex-start"},turnNoticeError:{borderColor:t.danger},turnNoticeTitle:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.body},turnNoticeTitleError:{color:t.danger},turnNoticeBody:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal},turnNoticeAction:{minHeight:dt,justifyContent:"center"},turnNoticeActionLabel:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.body},setupNoticeAction:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.caption},reconnectingCaption:{...C(e,"medium"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},list:{flex:1},listContent:{padding:r.lg,gap:r.md},rowBlock:{gap:r.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:r.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:Ym},bubbleUser:{padding:io,backgroundColor:t.bubbleUser,borderRadius:n.xl,borderBottomRightRadius:n.sm,borderWidth:Ft,borderColor:t.accentEdge,shadowColor:t.brand,shadowOpacity:Km,shadowRadius:$m,shadowOffset:{width:0,height:Xm},elevation:Qm,...re(l.userBubble,Ft)},bubbleAssistant:l.assistantBubble?.backgroundColor===void 0?{...re(l.assistantBubble,Ft)}:{padding:io,borderRadius:n.xl,...re(l.assistantBubble,Ft)},bubbleVet:{padding:io,backgroundColor:t.bubbleVet,borderRadius:n.xl,borderBottomLeftRadius:n.sm,...re(l.vetBubble,Ft)},bubblePending:{opacity:Zm},bubbleTextUser:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:a,...ce(l.userBubble)},bubbleTextAssistant:{...C(e,"medium"),color:t.text.primary,fontSize:o.size.body,lineHeight:a,...ce(l.assistantBubble)},bubbleTextVet:{...C(e,"medium"),color:t.onBubbleVet,fontSize:o.size.body,lineHeight:a,...ce(l.vetBubble)},vetSender:{...C(e,"bold"),color:t.onBubbleVet,fontSize:o.size.caption,lineHeight:Math.round(o.size.caption*o.lineHeight.normal),marginBottom:r.xs,...ce(l.vetBubble)},bubbleBold:C(e,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:C(e,"mono"),followUps:{alignSelf:"stretch",marginTop:r.sm,gap:pg},followUpSlot:{alignSelf:"stretch",borderRadius:ml},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:mg,paddingVertical:fg,paddingHorizontal:yg,borderRadius:ml,backgroundColor:t.brandSoft},followUpText:{...C(e,"medium"),flex:1,color:t.text.primary,fontSize:gg,lineHeight:hg},composerOuter:{position:"relative"},composer:{marginHorizontal:r.md,marginTop:r.xs,marginBottom:r.sm,minHeight:eg,justifyContent:"center",paddingLeft:tg,paddingRight:rg,paddingVertical:ng,backgroundColor:t.composerFill,borderWidth:pl,borderColor:t.composerBorder,borderRadius:Jm,shadowColor:t.shadow,shadowOpacity:ig,shadowRadius:sg,shadowOffset:{width:0,height:ag},elevation:lg,...re(l.composerInput,pl)},composerRow:{flexDirection:"row",alignItems:"center",gap:og,minHeight:fl},attachControl:{width:_r,height:_r,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:ug},input:{flex:1,minHeight:fl,maxHeight:qm,paddingHorizontal:0,paddingVertical:0,...C(e,"regular"),fontSize:o.size.body,lineHeight:d,color:t.text.primary,...ce(l.composerInput)},sendControl:{minHeight:lt,minWidth:lt,alignItems:"center",justifyContent:"center"},sendDisc:{width:lt,height:lt,borderRadius:lt/2,alignItems:"center",justifyContent:"center",...re(l.sendButton)},sendControlDisabled:{opacity:dg},poweredBy:{...C(e,"regular"),color:t.text.muted,fontSize:o.size.micro,textAlign:"center",paddingBottom:r.xs}})}i(vg,"makeStyles");var Cg=Object.freeze({kind:"live"}),Eg=Object.freeze({kind:"folded"});function so(e){if(e.role!=="assistant"||e.checkin===void 0)return null;let t=e.checkin.caseId,r=ti(e.proactiveOriginRef);return {caseId:t,dueDay:r!==null&&r.caseId===t?r.dueDay:""}}i(so,"askOf");function Rl(e){let t=new Map,r=new Map;for(let o of e){let s=so(o);if(s===null)continue;let a=r.get(s.caseId);(a===void 0||s.dueDay>=a.dueDay)&&r.set(s.caseId,{messageId:o.id,dueDay:s.dueDay});}if(r.size===0)return t;let n=null;for(let o of e){let s=so(o);if(s===null){n=null;continue}if(r.get(s.caseId)?.messageId===o.id){t.set(o.id,Cg),n=null;continue}if(n!==null&&n.caseId===s.caseId){n.days.push(s.dueDay),t.set(o.id,Eg);continue}let a=[s.dueDay];n={id:o.id,caseId:s.caseId,days:a},t.set(o.id,{kind:"past",runDueDays:a});}return t}i(Rl,"placeCheckins");var El=864e5,Rg=365;function Ir(e,t){if(typeof e!="string"||typeof t!="string")return null;let r=Date.parse(e),n=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(n))return null;let o=Math.floor(n/El)-Math.floor(r/El);return o<1||o>Rg?null:o}i(Ir,"checkinDayNumber");function Sl(e){return so(e)?.dueDay||null}i(Sl,"checkinDueDay");var ge=Object.freeze({eyebrow:"Checking in",logged:"Logged",findVet:"Find a vet now",day:"Day {day}",daySeparator:" \xB7 ",answers:Object.freeze({better:"Better",same:"Same",worse:"Worse"})}),Tl=Object.freeze(Xo.map(e=>Object.freeze({answer:e,label:ge.answers[e]})));function Pl(e,t){let[r,n]=react.useState(null),[o,s]=react.useState(null),[a,d]=react.useState(null),l=react.useCallback(c=>{t!==null&&(n(c),s(null),t(e.caseId,c).then(p=>{n(null),p.ok?d(c):s(p.error);}));},[t,e.caseId]),u=a??e.answer;return {answer:u,answerable:!ei(e),escalated:u==="worse",pending:r,error:o,choose:l}}i(Pl,"useCheckinCard");var xl=44,Pg=.6;function Il({message:e,checkin:t,onAnswer:r,petRef:n,onFindVet:o,vet:s,onLayout:a}){let d=I(),l=react.useMemo(()=>wg(d),[d]),u=Pl(t,r),c=u.answer!==null||u.pending!==null,p=r!==null&&u.answerable,y=Ir(t.openedAt,Sl(e));return jsxRuntime.jsxs(reactNative.View,{style:l.card,accessibilityLabel:ge.eyebrow,onLayout:a,children:[jsxRuntime.jsxs(reactNative.View,{style:l.head,children:[jsxRuntime.jsx(v,{tier:"compact",style:l.eyebrow,children:ge.eyebrow}),y!==null?jsxRuntime.jsx(v,{tier:"compact",style:l.headDay,children:j(ge.day,{day:y})}):null]}),jsxRuntime.jsx(v,{style:l.question,accessibilityRole:"text",children:e.text}),p?jsxRuntime.jsx(reactNative.View,{style:[l.row,u.pending?l.rowPending:null],children:Tl.map(({answer:b,label:h})=>{let P=(u.pending??u.answer)===b;return jsxRuntime.jsx(reactNative.Pressable,{onPress:()=>u.choose(b),disabled:c,accessibilityRole:"button",accessibilityLabel:h,accessibilityState:{selected:P,disabled:c,busy:u.pending===b},style:[l.pill,P?l.pillSelected:null],children:jsxRuntime.jsx(v,{tier:"control",style:[l.pillLabel,P?l.pillLabelSelected:null],children:h})},b)})}):null,u.answer!==null?jsxRuntime.jsx(v,{style:l.logged,children:ge.logged}):null,u.escalated?o!==void 0?jsxRuntime.jsx(reactNative.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:ge.findVet,style:l.findVet,children:jsxRuntime.jsx(v,{tier:"control",style:l.findVetLabel,children:ge.findVet})}):n?jsxRuntime.jsx(at,{entry:"chat",petRef:n,label:ge.findVet,...s?.returnTo!==void 0?{returnTo:s.returnTo}:{},...s?.usState!==void 0?{usState:s.usState}:{},...s?.prefer!==void 0?{prefer:s.prefer}:{},style:l.findVet,labelStyle:l.findVetLabel}):null:null,t.resolutionText?jsxRuntime.jsx(v,{style:l.resolution,children:t.resolutionText}):null,u.error?jsxRuntime.jsx(v,{style:l.error,accessibilityRole:"alert",children:u.error.displayMessage}):null]})}i(Il,"CheckinCard");function wg(e){let t=e.color,r=e.space,n=e.radius,o=e.type;return reactNative.StyleSheet.create({card:{maxWidth:"92%",padding:r.md,gap:r.sm,borderRadius:n.lg,backgroundColor:t.brandSoft,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},head:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},eyebrow:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},headDay:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},question:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},row:{flexDirection:"row",gap:r.sm,marginTop:r.xs},rowPending:{opacity:Pg},pill:{flex:1,minHeight:xl,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,borderRadius:n.pill,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},pillSelected:{backgroundColor:t.brand,borderColor:t.brandInk},pillLabel:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body},pillLabelSelected:{color:t.onPrimary},logged:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption},resolution:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},error:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption},findVet:{alignSelf:"stretch",minHeight:xl,alignItems:"center",justifyContent:"center",borderRadius:n.pill,borderWidth:1.5,borderColor:t.brandBorder,backgroundColor:t.surface},findVetLabel:{...C(e,"bold"),color:t.brandInk,fontSize:o.size.body}})}i(wg,"makeStyles");var _g=1.5,Ig=3;function Ol({text:e,runDueDays:t,openedAt:r,onLayout:n}){let o=I(),s=react.useMemo(()=>Ag(o),[o]),a=t.map(l=>Ir(r,l)).filter(l=>l!==null),d=t.length>1;return d&&a.length===0?null:jsxRuntime.jsxs(reactNative.View,{style:s.row,onLayout:n,children:[jsxRuntime.jsx(reactNative.View,{style:s.rule,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"}),jsxRuntime.jsxs(reactNative.View,{style:s.body,children:[a.length>0?jsxRuntime.jsx(v,{tier:"compact",style:s.days,children:a.map(l=>j(ge.day,{day:l})).join(ge.daySeparator)}):null,d?null:jsxRuntime.jsx(v,{style:s.question,accessibilityRole:"text",children:e})]})]})}i(Ol,"CheckinPastAsk");function Ag(e){let t=e.color,r=e.space,n=e.type;return reactNative.StyleSheet.create({row:{flexDirection:"row",paddingVertical:r.xs},rule:{width:_g,borderRadius:1,backgroundColor:t.borderHairlineGreen,marginRight:r.md},body:{flex:1,gap:Ig},days:{...C(e,"monoMedium"),fontSize:n.size.nano,letterSpacing:n.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},question:{...C(e,"regular"),fontSize:n.size.bodyTight,lineHeight:n.size.bodyTight*n.lineHeight.normal,color:t.text.muted}})}i(Ag,"makeStyles");var Og=Object.freeze({TIER_1:"#07C168",TIER_2:"#27A9FF",TIER_3:"#FBC558"}),Fl="#C8BEB4";function Fg(e){return e?Og[e.toUpperCase()]??Fl:Fl}i(Fg,"tierColor");function Mg(e){if(!e)return null;let t=/^tier[_\s-]?(\d+)$/i.exec(e.trim());return t?`Tier ${t[1]}`:e}i(Mg,"tierLabel");function we(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0?null:t}i(we,"text");function Lg(e){let t=we(e);return t!==null&&/^https:\/\/\S+$/i.test(t)?t:null}i(Lg,"httpsUrl");function Dg(e,t){let r=we(e.source_name)??we(e.sourceName),n=we(e.section),o=we(e.authority_tier)??we(e.authorityTier),s=Mg(o),a=r??we(e.title)??`Source ${t+1}`,d=we(e.monograph_chunk_id)??we(e.chunkId),l=[n,s].filter(u=>u!==null).join(" \xB7 ");return Object.freeze({title:a,sourceName:r,section:n,authorityTier:o,tierLabel:s,meta:l.length===0?null:l,url:Lg(e.url),excerpt:we(e.excerpt),tierColor:Fg(o),key:`${a}-${d??"none"}-${t}`})}i(Dg,"toCitationCard");function Ml(e){return e===void 0||e.length===0?Vg:Object.freeze(e.map((t,r)=>Dg(t,r)))}i(Ml,"toCitationCards");var Vg=Object.freeze([]);function po(e){return e===1?`1 ${f.sourceSingular}`:`${e} ${f.sourcePlural}`}i(po,"sourcesLabel");function Ll(e,t){return `${t?f.hideSources:f.showSources} ${po(e)}`}i(Ll,"sourcesToggleLabel");function Dl(e){return [e.url!==null?`${f.openSource}: ${e.title}`:e.title,e.meta,e.excerpt].filter(t=>t!==null&&t.length>0).join(". ")}i(Dl,"citationA11yLabel");var Bg=244,Nl=8,Hl=13,jg=14,Wg=.3,Gg=-0.24,qg=22,Yg=10,Kg=15;function Ul({citations:e,onOpenUrl:t}){let r=I(),n=react.useMemo(()=>Qg(r),[r]),o=react.useMemo(()=>Ml(e),[e]),[s,a]=react.useState(false);if(o.length===0)return null;let d=o.length;return jsxRuntime.jsxs(reactNative.View,{style:n.block,children:[jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:Ll(d,s),accessibilityState:{expanded:s},containerStyle:n.toggleSlot,style:n.togglePill,onPress:()=>a(l=>!l),children:[jsxRuntime.jsx(Ts,{size:Hl,color:r.color.brandInk,strokeWidth:1.5}),jsxRuntime.jsx(v,{tier:"compact",style:n.toggleLabel,children:po(d)}),jsxRuntime.jsx(ur,{size:Hl,color:r.color.brandInk,strokeWidth:1.5,direction:s?"up":"down"})]}),s?jsxRuntime.jsx($g,{cards:o,styles:n,open:t}):null]})}i(Ul,"CitationCards");function $g({cards:e,styles:t,open:r}){let n=G(),o=We(n.citationsInMs,{risePx:n.citationsRisePx});return jsxRuntime.jsx(reactNative.Animated.View,{style:o,children:jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,nestedScrollEnabled:true,showsHorizontalScrollIndicator:false,contentContainerStyle:t.row,children:e.map(s=>jsxRuntime.jsx(Xg,{card:s,styles:t,open:r},s.key))})})}i($g,"Deck");function Xg({card:e,styles:t,open:r}){let n=I(),o=e.url!==null&&r!==void 0,s=Dl(o?e:{...e,url:null}),a=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:t.cardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[t.tierDot,{backgroundColor:e.tierColor}]}),jsxRuntime.jsx(v,{style:[t.cardTitle,o?t.cardTitleLink:null],numberOfLines:2,children:e.title}),o?jsxRuntime.jsx(Ps,{size:jg,color:n.color.linkInk,strokeWidth:1.5}):null]}),e.meta!==null?jsxRuntime.jsx(v,{tier:"compact",style:t.cardMeta,numberOfLines:1,children:e.meta}):null,e.excerpt!==null?jsxRuntime.jsx(v,{style:t.cardExcerpt,numberOfLines:3,children:e.excerpt}):null]});if(e.url!==null&&r!==void 0){let d=e.url;return jsxRuntime.jsx(N,{accessibilityRole:"link",accessibilityLabel:s,style:t.card,onPress:()=>r(d),children:a})}return jsxRuntime.jsx(reactNative.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:s,style:t.card,children:a})}i(Xg,"Card");function Qg(e){let t=e.color,r=e.space,n=e.radius,o=e.type.size;return reactNative.StyleSheet.create({block:{gap:r.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:n.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:r.xs+2,paddingHorizontal:r.md,paddingVertical:r.xs+2,borderRadius:n.pill,backgroundColor:t.brandSoft},toggleLabel:{...C(e,"monoBold"),fontSize:o.micro,lineHeight:o.micro,letterSpacing:Wg,color:t.brandInk,textTransform:"uppercase"},row:{gap:r.sm,paddingRight:r.xl,paddingTop:r.xs},card:{width:Bg,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.md,gap:r.xs+2},cardHeader:{flexDirection:"row",alignItems:"center",gap:r.sm},tierDot:{width:Nl,height:Nl,borderRadius:n.pill},cardTitle:{...C(e,"bold"),flex:1,fontSize:o.bodyTight,lineHeight:qg,color:t.text.primary,letterSpacing:Gg},cardTitleLink:{color:t.linkInk},cardMeta:{...C(e,"monoMedium"),fontSize:o.nano,lineHeight:Yg,letterSpacing:e.type.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},cardExcerpt:{...C(e,"regular"),fontSize:o.tiny,lineHeight:Kg,color:t.text.muted}})}i(Qg,"makeStyles");function zl(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}i(zl,"formatMessageTime");var Mt=15,nh=15,oh=6,ih=Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function ql({message:e,onCopy:t,sentiment:r=null,onSentiment:n,thanks:o=false}){let s=I(),a=react.useMemo(()=>sh(s),[s]),d=G(),l=e.role==="user",u=react.useMemo(()=>zl(e.createdAt),[e.createdAt]),c=t!==void 0&&e.role!=="vet"&&e.text.length>0,p=e.role==="assistant"&&n!==void 0&&e.responseId!==void 0,[y,b]=react.useState(false),h=react.useRef(null);react.useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]);let P=i(()=>{t!==void 0&&(ot(t,e.text),b(true),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{b(false),h.current=null;},d.copiedMs));},"copy");return u===null&&!c&&!p?null:jsxRuntime.jsxs(reactNative.View,{style:a.wrap,children:[jsxRuntime.jsxs(reactNative.View,{style:[a.row,l?a.rowUser:a.rowAssistant],children:[u!==null?jsxRuntime.jsx(v,{tier:"compact",style:a.timestamp,children:u}):null,c?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:y?f.copied:l?f.copyUserMessage:f.copyAssistantMessage,hitSlop:nh,onPress:P,style:a.iconHit,children:y?jsxRuntime.jsx(Le,{size:Mt,color:s.color.success,strokeWidth:2}):jsxRuntime.jsx(ws,{size:Mt,color:s.color.text.timestamp,strokeWidth:1.5})}):null,p?Io.map(({sentiment:E,label:S})=>jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:S,accessibilityState:{selected:r===E},hitSlop:oh,onPress:()=>n?.(E),style:a.iconHit,children:jsxRuntime.jsx(cr,{size:Mt,color:s.color.sentiment[E],active:r===E,rotate:ih[E],strokeWidth:1.5})},E)):null]}),o?jsxRuntime.jsx(v,{style:a.thanks,accessibilityLiveRegion:"polite",children:f.feedbackThanks}):null]})}i(ql,"MessageFooter");function sh(e){let t=e.type;return reactNative.StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...C(e,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:e.color.text.timestamp,textAlign:"center"},iconHit:{width:Mt,height:Mt,alignItems:"center",justifyContent:"center"},thanks:{...C(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.text.secondary}})}i(sh,"makeStyles");var Yl="#10462E",Kl="#000000",ah="#83E0B4",lh=Object.freeze([Object.freeze({id:"breed-health-miss",intent:"send",label:"What {breed} health issue do owners miss most?",fallbackLabel:"What {species} health issue do owners miss most?",background:"#A0C4F6",borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:ah,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:Yl,brandEdge:true,borderWidth:1}),Object.freeze({id:"vet-prep",intent:"vet_report",label:"Help me prep for {petName}\u2019s vet visit.",background:"#FFBDBD",borderColor:"#6D1D14",borderWidth:1.25})]),dh=/\s*-\s*(?:small|medium|large|giant|toy)\s*$/i;function uh(e){return e==null?e:e.replace(dh,"").trim()}i(uh,"formatBreedForPrompt");var ch=new Set(["","?","-","--",".","n/a","na","none","null","nil","unknown","unspecified","unsure","not sure","not specified","not applicable","no idea","dunno","idk","tbd","other","i dont know","i don't know","dont know","don't know","do not know","i do not know","not known","no clue"]);function ph(e){let t=String(e??"").replace(/\s+/gu," ").trim().toLowerCase().replace(/\u2019/g,"'");return ch.has(t)}i(ph,"isUninformativeBreed");function fh(e){return e==="cat"?"Domestic Short Hair Mix":"Mixed Breed"}i(fh,"unspecifiedBreedLabel");function yh(e,t){return ph(e)?fh(t):String(e).replace(/\s+/gu," ").trim()}i(yh,"resolveBreedLabel");function $l(e){let t=e?.name?.trim()||f.emptyTitlePetFallback;return j(f.emptyTitle,{petName:t})}i($l,"emptyStateTitle");function Xl(e,t=Yl){let r=Bn(e?.species),n=r==="cat"?"my cat":"my dog",o=e?.name?.trim()||null,s=o||n,a=yh(uh(e?.breed),r)||null,d=jn(e?.ageYears),l=d===null?null:String(d);return Object.freeze(lh.map(u=>{let c=u.label.includes("{breed}"),p=u.label.includes("{ageYears}"),b=u.fallbackLabel!==void 0&&(c&&!a||p&&!l)&&u.fallbackLabel?u.fallbackLabel:u.label,h=j(b,{petName:s,breed:a??n,species:r,ageYears:l??""}),P=!o&&b.startsWith("{petName}")?h.charAt(0).toUpperCase()+h.slice(1):h;return Object.freeze({id:u.id,intent:u.intent,label:P,background:u.background,borderColor:u.brandEdge===true?t:u.borderColor,borderWidth:u.borderWidth})}))}i(Xl,"resolveQuickPrompts");var gh=36,Jl=4,hh=340;function ed({pet:e,petRef:t,onSend:r,onVetPrep:n,vet:o}){let s=I(),a=react.useMemo(()=>vh(s),[s]),d=react.useMemo(()=>Xl(e,s.color.brandInk),[e,s.color.brandInk]),l=$l(e);return jsxRuntime.jsxs(reactNative.View,{style:a.block,children:[jsxRuntime.jsx(v,{tier:"heading",style:a.title,accessibilityRole:"header",children:l}),jsxRuntime.jsx(reactNative.View,{style:a.list,children:d.map((u,c)=>jsxRuntime.jsx(bh,{prompt:u,index:c,petRef:t,onSend:r,onVetPrep:n,vet:o,pet:e,styles:a},u.id))})]})}i(ed,"QuickPrompts");function bh({prompt:e,index:t,pet:r,petRef:n,onSend:o,onVetPrep:s,vet:a,styles:d}){let l=G(),u=We(l.followUpInMs,{delayMs:fr(l,t)}),c={backgroundColor:e.background,borderColor:e.borderColor,borderWidth:e.borderWidth};return e.intent==="vet_report"?s!==void 0?jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Jl,style:[d.chip,c],onPress:()=>{W(s,r);},children:jsxRuntime.jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})}):n===null?null:jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(at,{entry:"chat",petRef:n,label:e.label,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:[d.chip,c],labelStyle:d.chipLabel})}):jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Jl,style:[d.chip,c],onPress:()=>o(e.label),children:jsxRuntime.jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})})}i(bh,"Chip");function vh(e){let t=e.color;return reactNative.StyleSheet.create({block:{gap:18,alignItems:"center",width:"100%"},title:{...C(e,"bold"),fontSize:28,lineHeight:34,color:t.text.primary,letterSpacing:-0.8,textAlign:"center",maxWidth:hh},list:{width:"100%",gap:12,alignItems:"center"},chip:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:9,minHeight:gh,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipLabel:{...C(e,"bold"),fontSize:12,lineHeight:14,color:Kl,textAlign:"center"}})}i(vh,"makeStyles");var yo=/\*\*([^*]+?)\*\*|\*([^*]+?)\*|`([^`]+?)`/g;function td(e){return e.includes("*")||e.includes("`")}i(td,"hasInlineMarkup");function rd(e){let t=[],r=0;yo.lastIndex=0;for(let n=yo.exec(e);n!==null;n=yo.exec(e)){n.index>r&&t.push({kind:"text",text:e.slice(r,n.index)});let o=n[1],s=n[2],a=n[3];o!==void 0?t.push({kind:"bold",text:o}):s!==void 0?t.push({kind:"italic",text:s}):a!==void 0&&t.push({kind:"code",text:a}),r=n.index+n[0].length;}return r<e.length&&t.push({kind:"text",text:e.slice(r)}),t}i(rd,"tokenizeInlineMarkdown");function nd(e,t){return td(e)?rd(e).map((r,n)=>{switch(r.kind){case "bold":return jsxRuntime.jsx(v,{style:t.bold,children:r.text},n);case "italic":return t.italic?jsxRuntime.jsx(v,{style:t.italic,children:r.text},n):r.text;case "code":return t.code?jsxRuntime.jsx(v,{style:t.code,children:r.text},n):r.text;default:return r.text}}):e}i(nd,"renderInlineMarkdown");var sd=6,dd=520,Ph=Math.round(dd*.18),ad=.44,wh=.5,ld=[0,.5,1],kh=[0,1,2];function ud(){let e=I(),t=react.useMemo(()=>_h(e),[e]),r=!e.motion.reducedMotion;return jsxRuntime.jsx(reactNative.View,{style:t.card,accessible:true,accessibilityRole:"text",accessibilityLabel:f.typing,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:kh.map(n=>r?jsxRuntime.jsx(xh,{index:n,style:t.dot},n):jsxRuntime.jsx(reactNative.View,{style:[t.dot,t.dotStatic]},n))})}i(ud,"TypingIndicator");function xh({index:e,style:t}){let r=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{let s=reactNative.Animated.sequence([reactNative.Animated.delay(e*Ph),reactNative.Animated.loop(reactNative.Animated.timing(r,{toValue:1,duration:dd,useNativeDriver:true}))]);return s.start(),()=>s.stop()},[r,e]);let n=r.interpolate({inputRange:ld,outputRange:[ad,1,ad]}),o=r.interpolate({inputRange:ld,outputRange:[0,-3.5,0]});return jsxRuntime.jsx(reactNative.Animated.View,{style:[t,{opacity:n,transform:[{translateY:o}]}]})}i(xh,"AnimatedDot");function _h(e){let t=e.color,r=e.space,n=e.radius;return reactNative.StyleSheet.create({card:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingHorizontal:r.md,paddingVertical:r.sm,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},dot:{width:sd,height:sd,borderRadius:n.pill,backgroundColor:t.brand},dotStatic:{opacity:wh}})}i(_h,"makeStyles");function cd(e,t,r){let n=e-r,o=t!=null?Math.min(n,t):n;return Math.max(0,o)}i(cd,"resolveTurnScrollTarget");function pd(e){let t=e.length-1,r=e[t];if(r===void 0||r.role!=="assistant")return null;let n=e[t-1];return {assistantIndex:t,userIndex:n!==void 0&&n.role==="user"?t-1:null}}i(pd,"latestTurn");function fd(e,t,r){let n=Math.max(0,r),o=e===null?n:Math.min(Math.max(0,e),n);return o>t+1?o:null}i(fd,"nextFollowOffset");function yd(e,t){let r=react.useRef(null),n=react.useRef(true),o=react.useRef(t),s=react.useRef(0),a=react.useRef(0),d=react.useRef(0),l=react.useRef(new Map),u=pd(e),c=u===null?null:e[u.assistantIndex]?.id??null,p=u===null||u.userIndex===null?null:e[u.userIndex]?.id??null,y=react.useCallback(()=>{let T=r.current;if(T===null||!n.current||a.current===0)return;let _=null;if(c!==null){let R=l.current.get(c);if(R===void 0)return;let O=p===null?null:l.current.get(p)??null;_=cd(R,O,96);}let m=fd(_,s.current,d.current-a.current);m!==null&&(s.current=m,T.scrollTo({y:m,animated:false}));},[c,p]);react.useEffect(()=>{t&&!o.current&&(n.current=true),o.current=t,y();},[e,t,y]);let b=react.useCallback(T=>{a.current=T.nativeEvent.layout.height,y();},[y]),h=react.useCallback((T,_)=>{d.current=_,a.current>0&&(s.current=Math.min(s.current,Math.max(0,_-a.current))),y();},[y]),P=react.useCallback(T=>{s.current=T.nativeEvent.contentOffset.y;},[]),E=react.useCallback(()=>{n.current=false;},[]),S=react.useCallback(T=>{let{contentOffset:_,contentSize:m,layoutMeasurement:R}=T.nativeEvent;s.current=_.y,n.current=m.height-_.y-R.height<=24;},[]),A=react.useCallback(T=>_=>{l.current.set(T,_.nativeEvent.layout.y),(T===c||T===p)&&y();},[c,p,y]);return {ref:r,onLayout:b,onContentSizeChange:h,onScroll:P,onScrollBeginDrag:E,onScrollEnd:S,rowLayout:A}}i(yd,"useThreadFollow");function vd(e,t,r){switch(e){case "loading":return r.renderPending?jsxRuntime.jsx(Be,{render:r.renderPending,fallback:jsxRuntime.jsx(gd,{})}):jsxRuntime.jsx(gd,{});case "empty":return jsxRuntime.jsx(Vh,{pet:r.shownPet,petRef:t.petRef,onSelectPrompt:r.onSelectPrompt,onVetPrep:r.onVetPrep,vet:r.vet});case "error":return jsxRuntime.jsx(Uh,{error:t.error,onRetry:t.retryLast,onAddPet:r.onAddPet});case "populated":return jsxRuntime.jsx(zh,{messages:t.messages,prompts:ls(t),onSelectPrompt:r.onSelectPrompt,isStreaming:t.isStreaming,onAnswerCheckin:t.petRef?t.answerCheckin:null,onCopy:r.onCopy,sentimentByMessage:t.sentimentByMessage,onSentiment:r.onSentiment,thanksFor:r.thanksFor,imagesByMessage:r.imagesByMessage,onPreview:r.onPreview,notice:r.notice,reconnecting:t.reconnecting===true,onRetry:t.retryLast,onStartNew:t.newConversation,petRef:t.petRef,onFindVet:r.onCheckinFindVet,vet:r.vet,onOpenUrl:r.onOpenUrl});default:return Yt(e)}}i(vd,"renderView");function gd(){let{theme:e,styles:t}=fe(),[r,n]=react.useState(false);return react.useEffect(()=>{let o=setTimeout(()=>n(true),gl);return ()=>clearTimeout(o)},[]),jsxRuntime.jsx(reactNative.View,{style:t.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:f.loading,children:r?jsxRuntime.jsx(reactNative.ActivityIndicator,{color:e.color.brandInk}):null})}i(gd,"LoadingState");function Vh({pet:e,petRef:t,onSelectPrompt:r,onVetPrep:n,vet:o}){let{styles:s}=fe();return jsxRuntime.jsx(reactNative.ScrollView,{contentContainerStyle:s.emptyContent,keyboardShouldPersistTaps:"handled",nestedScrollEnabled:true,accessibilityLabel:f.empty,children:jsxRuntime.jsx(ed,{pet:e,petRef:t,onSend:r,onVetPrep:n,vet:o})})}i(Vh,"EmptyState");function Nh({prompts:e,onSelectPrompt:t}){let{styles:r}=fe();return e.length===0?null:jsxRuntime.jsx(reactNative.View,{style:r.followUps,children:e.map((n,o)=>jsxRuntime.jsx(Hh,{prompt:n,index:o,onSelectPrompt:t},n))})}i(Nh,"FollowUps");function Hh({prompt:e,index:t,onSelectPrompt:r}){let{theme:n,styles:o}=fe(),s=G(),a=We(s.followUpInMs,{delayMs:fr(s,t)});return jsxRuntime.jsx(reactNative.Animated.View,{style:a,children:jsxRuntime.jsxs(N,{onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:e,containerStyle:o.followUpSlot,style:o.followUpRow,children:[jsxRuntime.jsx(v,{style:o.followUpText,children:e}),jsxRuntime.jsx(ur,{size:Gh,color:n.color.brandInk,direction:"right"})]})})}i(Hh,"FollowUpRow");function Uh({error:e,onRetry:t,onAddPet:r}){let{styles:n}=fe(),o=Li(e)?ji(r):void 0;return jsxRuntime.jsxs(reactNative.View,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{style:n.errorText,children:e.displayMessage}),o!==void 0?jsxRuntime.jsx(reactNative.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:f.addPet,style:n.retryButton,children:jsxRuntime.jsx(v,{tier:"control",style:n.retryLabel,children:f.addPet})}):null,e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:f.retry,style:n.retryButton,children:jsxRuntime.jsx(v,{tier:"control",style:n.retryLabel,children:f.retry})}):null]})}i(Uh,"ErrorState");function zh({messages:e,prompts:t,onSelectPrompt:r,isStreaming:n,onAnswerCheckin:o,onCopy:s,sentimentByMessage:a,onSentiment:d,thanksFor:l,imagesByMessage:u,onPreview:c,notice:p,reconnecting:y,onRetry:b,onStartNew:h,petRef:P,onFindVet:E,vet:S,onOpenUrl:A}){let{styles:T}=fe(),_=G();wt(e.length,_);let m=react.useMemo(()=>Rl(e),[e]),R=as(e,n),O=e[e.length-1],F=react.useMemo(()=>e.filter(g=>!(g.checkin&&m.get(g.id)?.kind==="folded")),[e,m]),w=yd(F,n);return jsxRuntime.jsxs(reactNative.ScrollView,{ref:w.ref,style:T.list,contentContainerStyle:T.listContent,accessibilityLabel:f.transcript,keyboardShouldPersistTaps:"handled",nestedScrollEnabled:true,onLayout:w.onLayout,onContentSizeChange:w.onContentSizeChange,onScroll:w.onScroll,scrollEventThrottle:Wh,onScrollBeginDrag:w.onScrollBeginDrag,onScrollEndDrag:w.onScrollEnd,onMomentumScrollEnd:w.onScrollEnd,children:[e.map(g=>{let x=g.checkin?m.get(g.id):void 0;return x?.kind==="folded"?null:x?.kind==="past"?jsxRuntime.jsx(Ol,{text:g.text,runDueDays:x.runDueDays,openedAt:g.checkin?.openedAt,onLayout:w.rowLayout(g.id)},g.id):g.checkin&&x!==void 0?jsxRuntime.jsx(Il,{message:g,checkin:g.checkin,onAnswer:o,petRef:P,onFindVet:E,vet:S,onLayout:w.rowLayout(g.id)},g.id):jsxRuntime.jsx(qh,{onLayout:w.rowLayout(g.id),message:g,revealing:n&&g===O&&g.role==="assistant",onCopy:s,sentiment:g.responseId===void 0?null:a[String(g.responseId)]??null,onSentiment:d,thanks:l!==null&&g.responseId!==void 0&&String(g.responseId)===l,images:u[g.id]??jh,onPreview:c,onOpenUrl:A},g.id)}),y?jsxRuntime.jsx(v,{tier:"compact",style:T.reconnectingCaption,accessibilityRole:"text",children:f.reconnecting}):null,R?jsxRuntime.jsx(ud,{}):null,p!==null?jsxRuntime.jsx(Bh,{notice:p,onRetry:b,onStartNew:h}):null,jsxRuntime.jsx(Nh,{prompts:t,onSelectPrompt:r})]})}i(zh,"PopulatedState");function Bh({notice:e,onRetry:t,onStartNew:r}){let{styles:n}=fe(),o=e.tone==="error";return jsxRuntime.jsxs(reactNative.View,{style:[n.turnNotice,o?n.turnNoticeError:null],accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{tier:"control",style:[n.turnNoticeTitle,o?n.turnNoticeTitleError:null],children:e.title}),jsxRuntime.jsx(v,{tier:"compact",style:n.turnNoticeBody,children:e.body}),jsxRuntime.jsx(reactNative.Pressable,{onPress:e.action==="startNew"?r:t,accessibilityRole:"button",accessibilityLabel:e.actionLabel,hitSlop:ut,style:n.turnNoticeAction,children:jsxRuntime.jsx(v,{tier:"control",style:n.turnNoticeActionLabel,children:e.actionLabel})})]})}i(Bh,"TurnNoticeCard");var jh=Object.freeze([]),Wh=16,Gh=14;function qh({message:e,revealing:t,onCopy:r,sentiment:n,onSentiment:o,thanks:s,images:a,onPreview:d,onOpenUrl:l,onLayout:u}){let{styles:c}=fe(),p=G(),y=We(p.messageInMs),b=js(e.text,t,p),h=e.role==="user",P=e.role==="vet",E=h?f.senderUser:P?ds(e):f.senderAssistant,S=react.useCallback(T=>o(e,T),[o,e]),A=e.pending!==true;return jsxRuntime.jsxs(reactNative.Animated.View,{style:[c.rowBlock,h?c.rowBlockUser:c.rowBlockAssistant,y],onLayout:u,children:[jsxRuntime.jsx(reactNative.View,{style:[c.row,h?c.rowUser:c.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${E}: ${e.text}`,accessibilityState:e.pending===true?{busy:true}:void 0,children:jsxRuntime.jsxs(reactNative.View,{style:[c.bubble,h?c.bubbleUser:P?c.bubbleVet:c.bubbleAssistant,e.pending?c.bubblePending:null],children:[h&&a.length>0?jsxRuntime.jsx(la,{images:a,onPreview:T=>d({uri:T.uri,label:T.filename})}):null,P?jsxRuntime.jsx(v,{style:c.vetSender,children:E}):null,jsxRuntime.jsx(v,{style:h?c.bubbleTextUser:P?c.bubbleTextVet:c.bubbleTextAssistant,children:e.role==="assistant"?nd(b,{bold:c.bubbleBold,italic:c.bubbleItalic,code:c.bubbleCode}):e.text})]})}),e.role==="assistant"&&!t?jsxRuntime.jsx(Ul,{citations:e.citations,onOpenUrl:l}):null,A?jsxRuntime.jsx(ql,{message:e,onCopy:r,sentiment:n,onSentiment:e.responseId===void 0?void 0:S,thanks:s}):null]})}i(qh,"MessageRow");var Qh=Object.freeze(["photo"]),Zh=1;function Jh(e){let{style:t,renderPending:r}=e;return jsxRuntime.jsx(gs,{capability:"chat",style:t,...r?{renderPending:r}:{},children:jsxRuntime.jsx(eb,{...e})})}i(Jh,"EverfurChat");function eb({petRef:e,conversationId:t,style:r,renderPending:n,onCopy:o,onPetChange:s,onVetPrep:a,onFindVet:d,renderVetAction:l,attachments:u,pet:c,onAddPet:p,checkinTarget:y,initialAsk:b,composerSeed:h,lifecycle:P,draftStore:E,vetReturnTo:S,vetUsState:A,vetPrefer:T,onOpenUrl:_,keyboardVerticalOffset:m}){let{theme:R,styles:O}=fe(),F=G(),w=react.useMemo(()=>us(e,t),[e,t]),g=jt(w),x=is(g),D=ll(),U=es(g),z=reactNativeSafeAreaContext.useSafeAreaInsets(),Z=ss(g),le=react.useMemo(()=>d===void 0?void 0:()=>{W(d,"emergency");},[d]),be=react.useMemo(()=>S===void 0&&A===void 0&&T===void 0?void 0:{returnTo:S,usState:A,prefer:T},[S,A,T]),Ne=Qn(D.pets,g.petRef),oe=react.useMemo(()=>ns(g.messages,Ne?.name??null),[g.messages,Ne?.name]),Fe=os(oe);wt(Fe.showBanner,F),Yi(g.openCheckin,y),Ui(g.askEverfur,g.isBootstrapping,b);let Vt=react.useMemo(()=>on(h),[h]);Gi(P,{conversationId:g.conversationId===null?null:String(g.conversationId),isTurnInFlight:g.isStreaming,refresh:g.refreshActiveThread});let Nt=(g.hasUnreadThreads??false)||U.rows.some(ye=>ye.unreadCount!==null&&ye.unreadCount>0)||(g.unreadCount??0)>0,Je=Ni(g.messages),[yt,Lr]=react.useState(null),Rd=react.useCallback(()=>Lr(null),[]),[mt,Dr]=react.useState(null),[Sd,ho]=react.useState(null),et=react.useRef(null);react.useEffect(()=>()=>{et.current&&clearTimeout(et.current);},[]);let bo=react.useCallback(ye=>{ho(String(ye)),et.current&&clearTimeout(et.current),et.current=setTimeout(()=>{ho(null),et.current=null;},hl);},[]),Td=react.useCallback((ye,Ut)=>{let gt=ye.responseId;if(gt===void 0)return;let Id=g.sentimentByMessage[String(gt)];g.feedback(gt,Ut),Ut==="down"&&Id!=="down"&&Dr(gt);},[g]),Pd=react.useCallback(async(ye,Ut)=>mt===null||!(await g.feedback(mt,"down",ye??"other",Ut)).ok?false:(Dr(null),bo(mt),true),[g,mt,bo]),wd=react.useCallback(()=>Dr(null),[]),kd=react.useCallback(ye=>{g.send(ye);},[g.send]),xd=react.useMemo(()=>_===void 0?void 0:ye=>{W(_,ye,"citation");},[_]),vo=reactNative.Platform.OS==="ios"?"padding":void 0,Ht=rl(m,vo!==void 0),_d=Ht.topInWindow===null?z.top:Math.max(0,z.top-Ht.topInWindow),Co={send:g.send,stop:g.stop,isStreaming:g.isStreaming,conversationId:g.conversationId,seed:Vt,draftStore:E,onStage:Je.stage,onPreview:Lr};return jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:[O.container,{paddingTop:_d},r],behavior:vo,...Ht.avoidingProps,children:[jsxRuntime.jsx(nl,{probeRef:Ht.probeRef}),jsxRuntime.jsx(qa,{pets:D,petRef:g.petRef,historyUnread:Nt,onOpenHistory:U.show,onPetChange:s,onAddPet:p,vet:be}),c!==void 0?jsxRuntime.jsx(tb,{petRef:e??null,pet:c,onRegistered:D.refresh}):null,jsxRuntime.jsx(al,{surface:Fe,petRef:g.petRef,renderVetAction:l,onFindVet:d,vet:be}),jsxRuntime.jsx(reactNative.View,{style:O.body,children:vd(x,g,{notice:Z,vet:be,onCheckinFindVet:le,onSelectPrompt:kd,renderPending:n,shownPet:Ne,onVetPrep:a,onCopy:o,onSentiment:Td,thanksFor:Sd,imagesByMessage:Je.byMessage,onPreview:Lr,onAddPet:p,onOpenUrl:xd})}),u!==void 0?jsxRuntime.jsx(rb,{...Co,attachments:u}):jsxRuntime.jsx(Ed,{...Co,attachments:null}),jsxRuntime.jsx(Cs,{}),R.meta.hidePoweredBy?null:jsxRuntime.jsx(v,{tier:"compact",style:O.poweredBy,accessibilityRole:"text",accessibilityLabel:f.poweredBy,children:f.poweredBy}),jsxRuntime.jsx(tl,{chat:g,history:U}),jsxRuntime.jsx(Za,{visible:mt!==null,onSubmit:Pd,onSkip:wd}),jsxRuntime.jsx(Ws,{uri:yt?.uri??null,label:yt?.label??"",onClose:Rd}),jsxRuntime.jsx(xt,{})]})}i(eb,"ChatBody");function tb({petRef:e,pet:t,onRegistered:r}){let{styles:n}=fe(),o=Di(e,t,r);return o.status!=="failed"||o.error===null?null:jsxRuntime.jsxs(reactNative.View,{style:n.setupNotice,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{tier:"compact",style:n.setupNoticeText,children:o.error.displayMessage}),jsxRuntime.jsx(reactNative.Pressable,{onPress:o.retry,accessibilityRole:"button",accessibilityLabel:f.retry,hitSlop:ut,children:jsxRuntime.jsx(v,{tier:"control",style:n.setupNoticeAction,children:f.retry})})]})}i(tb,"PetSetupNotice");function rb({attachments:e,...t}){let r=react.useMemo(()=>An(),[]),n=Qr({maxPerMessage:e.maxPerMessage??Zh,transport:r}),o=react.useMemo(()=>({state:n,sources:e.sources??Qh,pick:e.pick}),[n,e.sources,e.pick]);return jsxRuntime.jsx(Ed,{...t,attachments:o})}i(rb,"ComposerWithAttachments");function Ed({send:e,stop:t,isStreaming:r,conversationId:n,attachments:o,seed:s,draftStore:a,onStage:d,onPreview:l}){let{theme:u,styles:c}=fe(),p=G(),[y,b]=Xi(e,n,s);Qi(a,n===null?null:String(n),y,b);let[h,P]=react.useState(false),[E,S]=react.useState(false);react.useEffect(()=>{S(false);},[n]);let A=u.meta.placeholder??f.placeholder,T=o?.state.uploading??false,_=o?.state.failed??false,m=T||_,R=o?.state.attachments??nb;wt(R.length,p);let O=react.useCallback(()=>{if(y.trim().length===0||m||[...y].length>Qt)return;let z=o?.state.s3Keys??ob;o!==null&&z.length>0?(d(o.state.attachments.filter(Z=>Z.status==="uploaded").map(Z=>({uri:Z.previewUri,filename:Z.filename}))),e(y,{imageS3Keys:z}),o.state.clear()):e(y),b(""),S(false);},[y,e,m,o,d]),F=react.useCallback(()=>{t();},[t]),w=react.useCallback(z=>{P(false),o!==null&&(S(false),o.state.dismissRejected(),ot(o.pick,z).then(Z=>{if(!Z.ok){S(true);return}Z.value!==null&&o.state.add(Z.value);}));},[o]),x=react.useMemo(()=>[...y].length>Qt,[y])||m,D=o!==null&&R.length>=o.state.maxPerMessage,U=u.slots.sendButton?.textColor??u.color.brandInk;return jsxRuntime.jsxs(reactNative.View,{style:c.composerOuter,children:[o!==null&&h?jsxRuntime.jsx(Ys,{sources:o.sources,full:D,onPick:w,onClose:()=>P(false)}):null,jsxRuntime.jsxs(reactNative.View,{style:c.composer,children:[o!==null?jsxRuntime.jsx(aa,{attachments:R,rejected:E?ib:o.state.rejected,uploadFailed:_,onRetry:o.state.retry,onRemove:o.state.remove,onPreview:z=>l({uri:z.previewUri,label:z.filename})}):null,jsxRuntime.jsxs(reactNative.View,{style:c.composerRow,children:[o!==null?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:li(R.length,o.state.maxPerMessage),accessibilityState:{disabled:D,expanded:h},disabled:D,hitSlop:(dt-_r)/2,style:[c.attachControl,D?c.attachControlDisabled:null],onPress:()=>P(z=>!z),children:jsxRuntime.jsx(xs,{size:Cl,color:D?u.color.text.muted:u.color.brandInk,strokeWidth:1.75})}):null,jsxRuntime.jsx(rt,{style:c.input,value:y,onChangeText:b,placeholder:A,placeholderTextColor:u.slots.composerInput?.textColor??u.color.text.placeholder,onSubmitEditing:O,returnKeyType:"send",blurOnSubmit:false,multiline:true,editable:true}),r?jsxRuntime.jsx(reactNative.Pressable,{onPress:F,accessibilityRole:"button",accessibilityLabel:f.stop,hitSlop:ut,style:c.sendControl,children:jsxRuntime.jsx(reactNative.View,{style:c.sendDisc,testID:"everfur-stop-disc",children:jsxRuntime.jsx(Ls,{size:vl,color:U,testID:"everfur-stop-glyph"})})}):jsxRuntime.jsx(reactNative.Pressable,{onPress:O,disabled:x,accessibilityRole:"button",accessibilityLabel:f.send,accessibilityState:{disabled:x,busy:T},hitSlop:ut,style:[c.sendControl,x?c.sendControlDisabled:null],children:jsxRuntime.jsx(reactNative.View,{style:c.sendDisc,testID:"everfur-send-disc",children:jsxRuntime.jsx(Ms,{size:bl,color:U,testID:"everfur-send-glyph"})})})]})]})]})}i(Ed,"Composer");var nb=Object.freeze([]),ob=Object.freeze([]),ib=Object.freeze({code:"unknown",retryable:true,filename:""});exports.EverfurChat=Jh;exports.createRnChatAttachmentTransport=An;exports.useChatAttachments=Qr;exports.useEverfurChat=jt;exports.useEverfurPets=Fn;
|