@everfur/sdk 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/{bookingCopy.d-BuDv16WP.d.ts → bookingCopy.d-BL2-URcv.d.ts} +3 -2
  2. package/dist/{bookingCopy.d-rnBSqOSN.d.cts → bookingCopy.d-Dfew1pjY.d.cts} +3 -2
  3. package/dist/{chunk-6IHY7HS7.js → chunk-IO4CGYHT.js} +1 -1
  4. package/dist/{chunk-4KFFE42Z.js → chunk-NBAOR5TJ.js} +20 -20
  5. package/dist/{chunk-HHCGXQJR.js → chunk-RD6ZGYEJ.js} +9 -9
  6. package/dist/{chunk-BMYNDBUR.js → chunk-ZYHPCQVM.js} +1 -1
  7. package/dist/client/index.cjs +1 -1
  8. package/dist/client/index.d.cts +2 -2
  9. package/dist/client/index.d.ts +2 -2
  10. package/dist/client/index.js +1 -1
  11. package/dist/core/index.cjs +1 -1
  12. package/dist/core/index.js +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/{models.d-BULqCO2R.d.ts → models.d-NAWqF1wC.d.ts} +4 -1
  16. package/dist/{models.d-BKmOfoqV.d.cts → models.d-wJ_Ze4p5.d.cts} +4 -1
  17. package/dist/records/index.cjs +1 -1
  18. package/dist/records/index.js +1 -1
  19. package/dist/server/events/index.cjs +1 -1
  20. package/dist/server/events/index.js +1 -1
  21. package/dist/server/index.cjs +1 -1
  22. package/dist/server/index.js +1 -1
  23. package/dist/tabs/index.cjs +3 -3
  24. package/dist/tabs/index.d.cts +1 -1
  25. package/dist/tabs/index.d.ts +1 -1
  26. package/dist/tabs/index.js +3 -3
  27. package/dist/televet/booking/index.cjs +1 -2
  28. package/dist/televet/booking/index.d.cts +2 -2
  29. package/dist/televet/booking/index.d.ts +2 -2
  30. package/dist/televet/booking/index.js +1 -2
  31. package/dist/web/health-plan/index.cjs +1 -1
  32. package/dist/web/health-plan/index.js +1 -1
  33. package/dist/web/index.cjs +2 -2
  34. package/dist/web/index.js +2 -2
  35. package/dist/web/records-sheet/index.cjs +1 -1
  36. package/dist/web/records-sheet/index.js +1 -1
  37. package/dist/web/shop/index.cjs +1 -1
  38. package/dist/web/shop/index.js +1 -1
  39. package/dist/web/televet/booking/index.cjs +7 -8
  40. package/dist/web/televet/booking/index.d.cts +2 -2
  41. package/dist/web/televet/booking/index.d.ts +2 -2
  42. package/dist/web/televet/booking/index.js +7 -8
  43. package/dist/web/televet/call/index.cjs +1 -1
  44. package/dist/web/televet/call/index.js +1 -1
  45. package/dist/web/ui/index.cjs +1 -1
  46. package/dist/web/ui/index.js +32 -32
  47. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  "use client";
3
- import{PlanNeedCard as e,TipCard as t,buttonCss as r,planNeedCardCss as n,tipCardCss as i,Button as l}from"../../chunk-4KFFE42Z.js";import{PLAN_CLASS_PREFIX as o,planTokens as a,PLAN_PRESS as s,PLAN_ICONS as u,PLAN_RULES as d,err,ok,PLAN_CONTEXT as c,EverfurConfigError as p,parseUrl as h,PLAN_BEFORE_CLASS as f}from"../../chunk-6IHY7HS7.js";import{useEverfurTheme,EVERFUR_LIGHT as m,EVERFUR_DARK as b,toRgba as y,relativeLuminance as g,faceCss,readableOn,withAlpha as v,renderRuntimePart as k,useDsStyles as w,summaryListCss as _,ThemeProvider as x,useEfdsPart as C,cx as P,dataOf as S,SummaryList as I,headingFaceCss,resolveTheme,usePressFeedback as O,webPressOf as T,v3Palette as R,everfurWebTheme as E}from"../../chunk-BMYNDBUR.js";import{createContext,lazy as $,useMemo as N,useEffect as D,useRef as F,useId as L,useState as A,useContext as M,useCallback as z,useLayoutEffect as j,createElement as H,useSyncExternalStore as B,Fragment as q,isValidElement as U,cloneElement as K,forwardRef as W,Component as V,useImperativeHandle as G,Suspense as Y}from"react";import{jsx as Q,jsxs as Z,Fragment as J}from"react/jsx-runtime";import{createPortal as X}from"react-dom";var ee={ink:"#10462E",go:"#07C168",alert:"#C03410",tintSage:"#E6ECE8"},te=/* @__PURE__ */Symbol.for("@everfur-health/ui-core#ThemeContext@v1");function re(){let e=globalThis,t=e[te];return t===void 0&&(t=createContext(null),t.displayName="EverfurThemeContext",e[te]=t),t}var ne=(e,t)=>e.toUpperCase()===t.toUpperCase();function ie(e){let t=y(e);return t!==null&&g(t)<.18}var le=/* @__PURE__ */new WeakMap;function oe(e,t){if(t===null)return e;let r=le.get(e);r===void 0&&(r=/* @__PURE__ */new WeakMap,le.set(e,r));let n=r.get(t);return n===void 0&&(n=ae(e,t),r.set(t,n)),n}function ae(e,t){let r=t.colors,n=!ne(r.ink,ee.ink),i=!ne(r.go,ee.go),l=e===m&&ie(r.bg),o=l?b:e,a=o.color,s=e=>l||a[e]===m.color[e],u={};n&&s("primary")&&(Object.assign(u,{primary:r.ink,onPrimary:r.onInk,brand:r.ink,brandInk:r.ink}),s("linkInk")&&(u.linkInk=r.ink),!i&&s("accent")&&Object.assign(u,{accent:r.ink,onAccent:r.onInk})),i&&s("accent")&&Object.assign(u,{accent:r.go,onAccent:r.onGo}),!ne(r.alert,ee.alert)&&s("danger")&&(u.danger=r.alert),!ne(r.tintSage,ee.tintSage)&&s("brandSoft")&&(u.brandSoft=r.tintSage,s("brandSofter")&&(u.brandSofter=r.tintSage)),l&&Object.assign(u,{background:r.bg,surface:r.surface,text:{...a.text,primary:r.text,muted:r.muted},borderRingCream:r.line});let d=t.motion?.reduced===true&&!o.motion.reducedMotion;return!l&&!d&&Object.keys(u).length===0?e:{...o,color:{...a,...u},...d?{motion:{...o.motion,reducedMotion:true}}:{}}}function se(){let e=useEverfurTheme(),t=M(re());return N(()=>oe(e,t),[e,t])}var ue=/* @__PURE__ */Object.freeze({loading:"Loading",retry:"Try again",signedOut:"Sign in required",addToCart:"Add to cart",added:"Added",remove:"Remove",checkout:"Checkout",subtotal:"Subtotal",sample:"Sample",cartEmpty:"Your cart is empty.",choosePet:"Choose a pet",emptyTitle:"",emptyBody:"",emptyAsk:""}),de=/* @__PURE__ */Object.freeze({emptyTitle:true,emptyBody:true,emptyAsk:true}),ce=/* @__PURE__ */Object.freeze({dna:"",records:"Records",inside:"Inside",profile:""}),pe=/* @__PURE__ */Object.freeze({planTitle:e=>`${e}'s care plan`,cartLabel:e=>`${e} cart`}),he=/* @__PURE__ */Object.freeze([...Object.keys(ue).filter(e=>de[e]===true&&ue[e]==="").map(e=>`HEALTH_PLAN_COPY.${e}`),...["profile"].filter(e=>ce[e]==="").map(e=>`HEALTH_PLAN_REASON_LABELS.${e}`)]);var fe=/* @__PURE__ */Object.freeze({imageVariant:"wide",reasonVariant:"pills",cartBarVisibility:"whenItems",cartBarPlacement:"sticky",addButtonSize:"full",addedVariant:"link",categoryVariant:"text",showCategory:false,cardShadow:false,cardBorder:true});function me(e,t){return{setInPlan:t,addAll:async()=>{let r=(e?.items??[]).filter(e=>!e.inPlan);return(await Promise.all(r.map(e=>t(e.productId,true)))).every(Boolean)}}}function showHealthPlanCartBar(e,t){return(e??fe.cartBarVisibility)==="always"||t>0}var be=/* @__PURE__ */Object.freeze(["showCategory","cardShadow","cardBorder","addButtonSize","addButtonFontSize","addedVariant","categoryVariant","cardPadding","itemTitleSize","itemTitleWeight","priceSize","priceWeight","reasonTextSize","reasonLabelWidth","reasonGap"]);function ye(e){let t={};for(let r of be)e[r]!==void 0&&(t[r]=e[r]);return t}function ge(e){let t=typeof e=="number"&&Number.isFinite(e)&&e>0?e:e==="compact"?32:44;return{height:t,hit:Math.max(44,t)}}function ve(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:null}function ke(e,t){let r=ve(e);return r===null?0:r-t}function isHealthPlanSessionRequired(e){return e!==null&&(e.reasonCode==="session_required"||e.code==="sessionRequired")}var we=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanCartDock@v1"),_e=globalThis,xe=_e[we]??(_e[we]=createContext(null));function HealthPlanCartScope({children:e}){let[t,r]=A(null),n=N(()=>({dock:t,publish:r}),[t]);return H(xe.Provider,{value:n},e)}function useHealthPlanCartDock(){return M(xe)?.dock??null}function Ce(e,t,r,petRef,n,i){let l=M(xe)?.publish,o=F(i);D(()=>{o.current=i},[i]);let a=N(()=>me(n,(e,t)=>o.current(e,t)),[n]);D(()=>{if(!(l===void 0||!e))return l(/* @__PURE__ */Object.freeze({cart:t,busy:r,petRef:petRef,plan:n,...a})),()=>l(null)},[l,e,t,r,petRef,n,a])}function healthPlanPetWords(e,t){let r=e?.trim()??"",n=r===""?"your pet":r,i=r===""?"Your pet":r;return t==="female"?{name:n,Name:i,poss:"her",Poss:"Her",obj:"her"}:t==="male"?{name:n,Name:i,poss:"his",Poss:"His",obj:"him"}:{name:n,Name:i,poss:`${n}'s`,Poss:`${i}'s`,obj:n}}var Pe=e=>e===null?"":`${e.productName} renews every ${e.intervalDays} days at ${e.box??""} until you cancel; skip or cancel anytime in the app.`,Se=/* @__PURE__ */Object.freeze({onceFine:"",cartFine:Pe,startedWhat:()=>""});function healthPlanFocusCopyFor(e){let t=healthPlanPetWords(e.name,e.sex),r=e=>e.petName?.trim()||t.name,NameOf=e=>e.petName?.trim()||t.Name,n=/* @__PURE__ */Object.freeze({jumpKicker:(e,r)=>r?`In ${t.poss} plan, every ${e.intervalDays} days`:e.offer?`${e.discountPercent}% off ${t.poss} first box`:e.intervalDays>0?`Ships every ${e.intervalDays} days`:n.onceLine(e),optionsLabel:"How to buy",subscribe:"Subscribe",bestValue:"Best value",subscribeLine:e=>e.offer?`First box, then ${e.box??""}`:`${e.box??""} every ${e.intervalDays} days`,priceLine:e=>e.offer?`${e.discountPercent}% off the first box. Ships every ${e.intervalDays} days.`:e.intervalDays>0?`Ships every ${e.intervalDays} days.`:n.onceOffer(e),once:"One box",onceLine:e=>e.onceDiscountPercent>0?`${e.onceDiscountPercent}% off, ships once`:"Ships once",buyOnce:e=>`Buy one box, ${e.once??e.box??""}`,subscribed:"Subscribed",subscribedLine:(e,t)=>t===null?`Every ${e.intervalDays} days`:`Every ${e.intervalDays} days · next box ${t}`,manage:"Manage",checkoutKicker:"Checkout",checkoutTitle:e=>`Checkout: ${e.productName}`,checkoutOffer:e=>`${e.discountPercent}% off your first box.`,shipsEvery:"Ships every",days:e=>`${e} days`,buyOnceOption:"Buy once",checkoutGo:(e,t,r)=>`${t?"Subscribe":"Buy now"} · ${r} today`,renews:e=>`Renews every ${e.intervalDays} days at ${e.box??""} until you cancel; skip or cancel anytime in the app.`,onceFine:"One box, ships tomorrow.",onceOffer:e=>e.onceDiscountPercent>0?`${e.onceDiscountPercent}% off, ships once.`:"Ships once.",checkoutNote:"",close:"Close",startedTitle:e=>`${NameOf(e)}'s plan has started.`,orderedTitle:()=>"Order placed.",startedWhat:e=>`${e.productName} ships tomorrow.`,startedNote:"",startedSteps:"What happens next",tomorrow:"Tomorrow",firstBoxShips:`${t.Poss} first box ships.`,trackingComesByText:"Tracking comes by text.",checkin:e=>e===null?"A 2-week check-in by text.":`A 2-week check-in by text: ${e}`,refill:`A text 3 days before ${t.poss} next box. Reply SKIP to skip it.`,nextBoxShips:e=>`${t.Poss} next box ships, ${e.box??""}.`,startedDone:`Back to ${t.poss} plan`,manageKicker:"Your subscription",manageTitle:e=>`Manage ${e.productName}`,skip:"Skip the next box",cancel:"Cancel subscription",skipped:(e,r)=>r===null?"Skipped.":`Skipped. ${t.Poss} next box ships ${r}.`,cancelled:e=>`${e.productName} is cancelled. Restart it from ${t.poss} plan anytime.`,orders:"Orders",startedHeader:"Subscribed",placedHeader:"Order placed",cartCheckoutTitle:"Checkout",orderNote:"",cartLabel:e=>e>0?`Cart, ${e} item${e>1?"s":""}`:"Cart, empty",addToCart:e=>`Add to cart · ${e}`,viewCart:"View cart",addedToCart:(e,t)=>`${e.productName} is in your cart${t?", as a subscription":""}.`,removedFromCart:e=>`${e} is out of your cart.`,cartTitle:"Cart",cartEmptyTitle:"Your cart is empty",cartEmptyBody:e=>`${NameOf(e)}'s plan pick lands here when you add it.`,seeOrders:`See ${t.poss} orders`,quantityLabel:e=>`How many: ${e}`,fewer:"One fewer",more:"One more",remove:"Remove",cartSubLine:e=>e.offer?`First box ${e.discountPercent}% off, then ${e.box??""} every ${e.intervalDays} days`:`Every ${e.intervalDays} days`,cartOnceLine:(e,r)=>r?`An extra box. ${t.Poss} plan keeps shipping.`:e.onceDiscountPercent>0?`One box, ${e.onceDiscountPercent}% off`:"One box",cartModeLabel:e=>`How to buy ${e}`,cartModeSubscribe:e=>e.offer?`Subscribe, ${e.discountPercent}% off the first box`:"Subscribe",cartModeOnce:e=>e.onceDiscountPercent>0?`One box, ${e.onceDiscountPercent}% off`:"One box",subtotal:"Subtotal",shipping:"Shipping",shippingValue:"",shippingTag:"",total:"Total",dueToday:"Due today",thenRenews:e=>`Then ${e.productName}`,renewsEvery:e=>`${e.box??""} every ${e.intervalDays} days`,checkoutCart:e=>`Checkout · ${e}`,cartOneAtATime:"",cartSubscriptionApart:"",cartItemSubscription:e=>`Subscription, every ${e.intervalDays} days`,cartItemQuantity:e=>`Qty ${e}`,placeOrder:(e,t)=>`${t?"Place order and subscribe":"Place order"} · ${e}`,cartFine:e=>`${e===null?"":`${Pe(e)} `}Ships tomorrow.`,placedSteps:"What's coming",placedShips:"It ships.",placedArrives:"It arrives at home.",viewOrder:"View order",herSubscription:`${t.Poss} subscription`,nextBox:e=>`Next box ${e}`,everyDays:e=>`Every ${e} days`,ordersHeading:e=>e?"Orders":`${t.Poss} orders`,ordersFine:"",ordersEmptyTitle:"No orders yet",ordersEmptyBody:e=>`The boxes from ${r(e)}'s plan show up here.`,moreOrders:"",orderSteps:["Ordered","Shipped","Out for delivery","Delivered"],subscriptionBox:"Subscription box",orderTitle:e=>e===null?"Order":`Order ${e}`,arrivesBy:e=>`Arrives by ${e}`,deliveredOn:e=>`Delivered ${e}`,expected:e=>`Expected ${e}`,tracking:"Tracking",trackingByText:"The tracking number comes by text when it ships.",trackOn:e=>`Track on ${e}`,trackLink:"",inThisOrder:"In this order",orderItemLine:(e,t)=>`Qty ${e}${t?" · subscription box":""}`,paidWith:"Paid with",buyAgain:"Buy again",orderHelp:"Get help with this order",addWeightTitle:`Add ${t.poss} weight to size ${t.poss} dose`,addWeightBody:`From a home scale or ${t.poss} last vet visit.`,connectRecordsTitle:`Connect ${t.poss} vet records`,connectRecordsBody:`${t.Poss} weight, visits and labs make ${t.poss} plan sharper.`,weightKicker:`${t.Poss} weight`,weightTitle:e=>`Add ${r(e)}'s weight`,weightBody:`From a home scale or ${t.poss} last vet visit. ${t.Poss} plan uses it to size ${t.poss} dose.`,weightField:`${t.Poss} weight`,weightUnit:"lb",weightUnitKg:"kg",weightErrorKg:"Enter your pet’s weight",weightError:`Enter ${t.poss} weight in pounds, like 14.1.`,weightSave:`Save ${t.poss} weight`,weightSaved:e=>`Saved: ${e} lb. ${t.Poss} dose is sized for ${t.obj}.`,weightSavedKg:e=>`Saved: ${e} kg. ${t.Poss} dose is sized for ${t.obj}.`,checkoutFailed:"That didn't go through. Please try again.",builtWith:e=>`Built with ${e}`,fromVet:e=>`From ${e}`,waitVetTips:e=>`Free tips from ${e}, built around that risk`,signalsFit:e=>`${e} of ${e} signals fit ${t.Name}`,signalsValue:e=>`${e}/${e}`,noPick:`No supplement for this one. ${t.Poss} vet comes first.`,callYourVet:"Call your vet today",callAVet:"Call a vet today",saveForCheckup:`Save for ${t.poss} next checkup`,savedForCheckup:`Saved for ${t.poss} next checkup`,blanksLabel:`${t.Poss} three blanks`,blanksAsked:e=>`Asked ${e}`,blanksAskedNoClinic:"",blanksWaitPill:"2 to 5 days",blanksFilledKicker:`From ${t.poss} vet records`,blanksFilled:(e,t)=>`${e} of ${t} filled`,blanksWeight:`Keep ${t.obj} at `,blanksWeightSource:`From ${t.poss} vet visits`,blanksDose:(e,t)=>`${e} of ${t}`,blanksDoseSource:`Sized to ${t.poss} weight`,blanksShots:`${t.Poss} next shots are due `,blanksShotsSource:`From ${t.poss} clinic`,blankEmpty:"blank",recordsLanded:`${t.Poss} records are in. ${t.Poss} plan now uses ${t.poss} weight and ${t.poss} visits.`,todayLabel:`${t.Poss} Health Plan`,poweredBy:"powered by",poweredByName:"Everfur",seeMore:"See more",seeLess:"See less",reportActions:"Actions to take",openReport:`Open it in ${t.poss} report`,askReport:"Ask about it",fullOpen:`See ${t.poss} full plan`,fullOpenLine:`${t.Poss} vet, reviews and ${t.poss} checkup`,fullClose:`Show ${t.poss} brief plan`,fullCloseLine:`${t.Poss} risk, tips, pick and signs`,hopeNoted:e=>`Noted. When ${t.poss} results land, we'll start with ${e}.`,productLink:e=>`${e}, see the product`,productPhotos:e=>`${e} photos, swipe for more`,shopAll:"Shop all",madeFor:`Made for ${t.name}`,ratingLine:e=>`· ${e} reviews`,productOffer:e=>`${e.discountPercent}% off ${t.poss} first box`,productEvery:e=>`Every ${e.intervalDays} days`,productOnce:e=>e.onceDiscountPercent>0?`One box, ${e.onceDiscountPercent}% off`:"One box",productExtraBox:"An extra box",productOnPlan:e=>`On ${t.poss} plan, every ${e.intervalDays} days. This adds one extra box.`,quantity:"Quantity",description:"Description",readMore:"Read more",readLess:"Read less",whatsInside:"What's inside",howMuch:"How much",reviewsTitle:"Reviews",reviewCount:e=>`${e} reviews`,reviewsSwipe:"Reviews, swipe for more",readAllReviews:e=>`Read all ${e} reviews`,starsLabel:e=>`${e} out of 5 stars`,buyNow:"Buy now"});return n}var Ie=healthPlanFocusCopyFor({sex:"female"});function formatHealthPlanDay(e,t){if(e===null||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let r=/* @__PURE__ */new Date(`${e}T00:00:00Z`);if(Number.isNaN(r.getTime()))return null;try{return new Intl.DateTimeFormat(t??"en-US",{month:"short",day:"numeric",timeZone:"UTC"}).format(r)}catch{return e}}function Oe(e){return e!=null&&(e.wait!==void 0||e.pick.hidden===true)}function Te(e){return{...e,pick:{...e.pick,none:true,hidden:true}}}var Re=/* @__PURE__ */Object.freeze({productId:"",partnerSku:null,title:"",description:null,category:null,price:null,currency:null,imageUrl:null,url:null,reasons:[],inPlan:false,sample:false});var Ee=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});var $e=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),Ne=globalThis,De=Ne[$e]??(Ne[$e]=createContext(null));De.displayName??="EverfurContext";function Fe(){let e=M(De);if(e===null)throw new p("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}var Le=/* @__PURE__ */Object.freeze({opened:"health_plan.opened",productClicked:"health_plan.product_clicked",checkoutStarted:"health_plan.checkout_started"});function Ae(){return M(De)?.runtime.registry.services.telemetry??Ee}var Me=createContext(null);function HealthPlanPetScope({petRef:petRef,children:e}){return H(Me.Provider,{value:petRef},e)}function ze(e){let t=M(Me),r=M(De);return t??e??r?.activePet??null}function je(e,petRef,t){let r=Ae(),n=F(null);D(()=>{if(!e||petRef===null||n.current===petRef)return;n.current=petRef;let i=t?.items??[];r.track(Le.opened,{petRef:petRef,itemsCount:i.length,inPlanCount:i.filter(e=>e.inPlan).length})},[e,petRef,t,r])}function He(e,petRef,t,r){e.track(Le.productClicked,{petRef:petRef,productId:t,inPlan:r})}function Be(e,petRef,t){e.track(Le.checkoutStarted,{petRef:petRef,itemsCount:t.count,subtotal:t.subtotal,currency:t.currency})}var qe=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],Ue=/* @__PURE__ */Object.freeze(qe.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Ue.map(e=>e.wireCode));var Ke=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),We=/* @__PURE__ */Object.freeze(Ue.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Ke[e.wireCode]}))),Ve=new Map(We.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Ge=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(We.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...Ge]){let t=Ve.get(e+r);if(t)return t}}var Ye=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return Ye[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var Qe=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return Qe.has(e)}var Ze=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||Ze.has(e)}var Je=500,Xe=8e3,et=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Je*2**r,Xe);return Math.floor(t()*n)}var tt="This feature isn't available on your account right now.",rt="Something in that request was not right. Check the details and try again.",nt=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:tt,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:rt,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:tt,runtimeDisposed:rt,unknown:"Something went wrong. Please try again."}),it="This session has ended. Please sign in again.",lt="linked_account_read_only";function ot(e,t,r){return e==="conflict"&&r===lt?tt:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?it:userFacingError(e)}function userFacingError(e){return nt[e]}function at(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var st=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===lt,i={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:ot(e,t?.wireCode,n?lt:null)};t?.httpStatus!==void 0&&(i.httpStatus=t.httpStatus),t?.requestId&&(i.requestId=t.requestId),typeof t?.reasonCode=="string"&&st.test(t.reasonCode)&&(i.reasonCode=t.reasonCode);let l=t?.retryAfterSeconds;if(typeof l=="number"&&Number.isFinite(l)&&l>=0&&(i.retryAfterSeconds=Math.round(l)),r);return t?.wireMessage&&at(i,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&at(i,"raw",t.raw),/* @__PURE__ */Object.freeze(i)}function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
3
+ import{PlanNeedCard as e,TipCard as t,buttonCss as r,planNeedCardCss as n,tipCardCss as i,Button as l}from"../../chunk-NBAOR5TJ.js";import{PLAN_CLASS_PREFIX as o,planTokens as a,PLAN_PRESS as s,PLAN_ICONS as u,PLAN_RULES as d,err,ok,PLAN_CONTEXT as c,EverfurConfigError as p,parseUrl as h,PLAN_BEFORE_CLASS as f}from"../../chunk-IO4CGYHT.js";import{useEverfurTheme,EVERFUR_LIGHT as m,EVERFUR_DARK as b,toRgba as y,relativeLuminance as g,faceCss,readableOn,withAlpha as v,renderRuntimePart as k,useDsStyles as w,summaryListCss as _,ThemeProvider as x,useEfdsPart as C,cx as P,dataOf as S,SummaryList as I,headingFaceCss,resolveTheme,usePressFeedback as O,webPressOf as T,v3Palette as R,everfurWebTheme as E}from"../../chunk-ZYHPCQVM.js";import{createContext,lazy as $,useMemo as N,useEffect as D,useRef as F,useId as L,useState as A,useContext as M,useCallback as z,useLayoutEffect as j,createElement as H,useSyncExternalStore as B,Fragment as q,isValidElement as U,cloneElement as K,forwardRef as W,Component as V,useImperativeHandle as G,Suspense as Y}from"react";import{jsx as Q,jsxs as Z,Fragment as J}from"react/jsx-runtime";import{createPortal as X}from"react-dom";var ee={ink:"#10462E",go:"#07C168",alert:"#C03410",tintSage:"#E6ECE8"},te=/* @__PURE__ */Symbol.for("@everfur-health/ui-core#ThemeContext@v1");function re(){let e=globalThis,t=e[te];return t===void 0&&(t=createContext(null),t.displayName="EverfurThemeContext",e[te]=t),t}var ne=(e,t)=>e.toUpperCase()===t.toUpperCase();function ie(e){let t=y(e);return t!==null&&g(t)<.18}var le=/* @__PURE__ */new WeakMap;function oe(e,t){if(t===null)return e;let r=le.get(e);r===void 0&&(r=/* @__PURE__ */new WeakMap,le.set(e,r));let n=r.get(t);return n===void 0&&(n=ae(e,t),r.set(t,n)),n}function ae(e,t){let r=t.colors,n=!ne(r.ink,ee.ink),i=!ne(r.go,ee.go),l=e===m&&ie(r.bg),o=l?b:e,a=o.color,s=e=>l||a[e]===m.color[e],u={};n&&s("primary")&&(Object.assign(u,{primary:r.ink,onPrimary:r.onInk,brand:r.ink,brandInk:r.ink}),s("linkInk")&&(u.linkInk=r.ink),!i&&s("accent")&&Object.assign(u,{accent:r.ink,onAccent:r.onInk})),i&&s("accent")&&Object.assign(u,{accent:r.go,onAccent:r.onGo}),!ne(r.alert,ee.alert)&&s("danger")&&(u.danger=r.alert),!ne(r.tintSage,ee.tintSage)&&s("brandSoft")&&(u.brandSoft=r.tintSage,s("brandSofter")&&(u.brandSofter=r.tintSage)),l&&Object.assign(u,{background:r.bg,surface:r.surface,text:{...a.text,primary:r.text,muted:r.muted},borderRingCream:r.line});let d=t.motion?.reduced===true&&!o.motion.reducedMotion;return!l&&!d&&Object.keys(u).length===0?e:{...o,color:{...a,...u},...d?{motion:{...o.motion,reducedMotion:true}}:{}}}function se(){let e=useEverfurTheme(),t=M(re());return N(()=>oe(e,t),[e,t])}var ue=/* @__PURE__ */Object.freeze({loading:"Loading",retry:"Try again",signedOut:"Sign in required",addToCart:"Add to cart",added:"Added",remove:"Remove",checkout:"Checkout",subtotal:"Subtotal",sample:"Sample",cartEmpty:"Your cart is empty.",choosePet:"Choose a pet",emptyTitle:"",emptyBody:"",emptyAsk:""}),de=/* @__PURE__ */Object.freeze({emptyTitle:true,emptyBody:true,emptyAsk:true}),ce=/* @__PURE__ */Object.freeze({dna:"",records:"Records",inside:"Inside",profile:""}),pe=/* @__PURE__ */Object.freeze({planTitle:e=>`${e}'s care plan`,cartLabel:e=>`${e} cart`}),he=/* @__PURE__ */Object.freeze([...Object.keys(ue).filter(e=>de[e]===true&&ue[e]==="").map(e=>`HEALTH_PLAN_COPY.${e}`),...["profile"].filter(e=>ce[e]==="").map(e=>`HEALTH_PLAN_REASON_LABELS.${e}`)]);var fe=/* @__PURE__ */Object.freeze({imageVariant:"wide",reasonVariant:"pills",cartBarVisibility:"whenItems",cartBarPlacement:"sticky",addButtonSize:"full",addedVariant:"link",categoryVariant:"text",showCategory:false,cardShadow:false,cardBorder:true});function me(e,t){return{setInPlan:t,addAll:async()=>{let r=(e?.items??[]).filter(e=>!e.inPlan);return(await Promise.all(r.map(e=>t(e.productId,true)))).every(Boolean)}}}function showHealthPlanCartBar(e,t){return(e??fe.cartBarVisibility)==="always"||t>0}var be=/* @__PURE__ */Object.freeze(["showCategory","cardShadow","cardBorder","addButtonSize","addButtonFontSize","addedVariant","categoryVariant","cardPadding","itemTitleSize","itemTitleWeight","priceSize","priceWeight","reasonTextSize","reasonLabelWidth","reasonGap"]);function ye(e){let t={};for(let r of be)e[r]!==void 0&&(t[r]=e[r]);return t}function ge(e){let t=typeof e=="number"&&Number.isFinite(e)&&e>0?e:e==="compact"?32:44;return{height:t,hit:Math.max(44,t)}}function ve(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:null}function ke(e,t){let r=ve(e);return r===null?0:r-t}function isHealthPlanSessionRequired(e){return e!==null&&(e.reasonCode==="session_required"||e.code==="sessionRequired")}var we=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanCartDock@v1"),_e=globalThis,xe=_e[we]??(_e[we]=createContext(null));function HealthPlanCartScope({children:e}){let[t,r]=A(null),n=N(()=>({dock:t,publish:r}),[t]);return H(xe.Provider,{value:n},e)}function useHealthPlanCartDock(){return M(xe)?.dock??null}function Ce(e,t,r,petRef,n,i){let l=M(xe)?.publish,o=F(i);D(()=>{o.current=i},[i]);let a=N(()=>me(n,(e,t)=>o.current(e,t)),[n]);D(()=>{if(!(l===void 0||!e))return l(/* @__PURE__ */Object.freeze({cart:t,busy:r,petRef:petRef,plan:n,...a})),()=>l(null)},[l,e,t,r,petRef,n,a])}function healthPlanPetWords(e,t){let r=e?.trim()??"",n=r===""?"your pet":r,i=r===""?"Your pet":r;return t==="female"?{name:n,Name:i,poss:"her",Poss:"Her",obj:"her"}:t==="male"?{name:n,Name:i,poss:"his",Poss:"His",obj:"him"}:{name:n,Name:i,poss:`${n}'s`,Poss:`${i}'s`,obj:n}}var Pe=e=>e===null?"":`${e.productName} renews every ${e.intervalDays} days at ${e.box??""} until you cancel; skip or cancel anytime in the app.`,Se=/* @__PURE__ */Object.freeze({onceFine:"",cartFine:Pe,startedWhat:()=>""});function healthPlanFocusCopyFor(e){let t=healthPlanPetWords(e.name,e.sex),r=e=>e.petName?.trim()||t.name,NameOf=e=>e.petName?.trim()||t.Name,n=/* @__PURE__ */Object.freeze({jumpKicker:(e,r)=>r?`In ${t.poss} plan, every ${e.intervalDays} days`:e.offer?`${e.discountPercent}% off ${t.poss} first box`:e.intervalDays>0?`Ships every ${e.intervalDays} days`:n.onceLine(e),optionsLabel:"How to buy",subscribe:"Subscribe",bestValue:"Best value",subscribeLine:e=>e.offer?`First box, then ${e.box??""}`:`${e.box??""} every ${e.intervalDays} days`,priceLine:e=>e.offer?`${e.discountPercent}% off the first box. Ships every ${e.intervalDays} days.`:e.intervalDays>0?`Ships every ${e.intervalDays} days.`:n.onceOffer(e),once:"One box",onceLine:e=>e.onceDiscountPercent>0?`${e.onceDiscountPercent}% off, ships once`:"Ships once",buyOnce:e=>`Buy one box, ${e.once??e.box??""}`,subscribed:"Subscribed",subscribedLine:(e,t)=>t===null?`Every ${e.intervalDays} days`:`Every ${e.intervalDays} days · next box ${t}`,manage:"Manage",checkoutKicker:"Checkout",checkoutTitle:e=>`Checkout: ${e.productName}`,checkoutOffer:e=>`${e.discountPercent}% off your first box.`,shipsEvery:"Ships every",days:e=>`${e} days`,buyOnceOption:"Buy once",checkoutGo:(e,t,r)=>`${t?"Subscribe":"Buy now"} · ${r} today`,renews:e=>`Renews every ${e.intervalDays} days at ${e.box??""} until you cancel; skip or cancel anytime in the app.`,onceFine:"One box, ships tomorrow.",onceOffer:e=>e.onceDiscountPercent>0?`${e.onceDiscountPercent}% off, ships once.`:"Ships once.",checkoutNote:"",close:"Close",startedTitle:e=>`${NameOf(e)}'s plan has started.`,orderedTitle:()=>"Order placed.",startedWhat:e=>`${e.productName} ships tomorrow.`,startedNote:"",startedSteps:"What happens next",tomorrow:"Tomorrow",firstBoxShips:`${t.Poss} first box ships.`,trackingComesByText:"Tracking comes by text.",checkin:e=>e===null?"A 2-week check-in by text.":`A 2-week check-in by text: ${e}`,refill:`A text 3 days before ${t.poss} next box. Reply SKIP to skip it.`,nextBoxShips:e=>`${t.Poss} next box ships, ${e.box??""}.`,startedDone:`Back to ${t.poss} plan`,manageKicker:"Your subscription",manageTitle:e=>`Manage ${e.productName}`,skip:"Skip the next box",cancel:"Cancel subscription",skipped:(e,r)=>r===null?"Skipped.":`Skipped. ${t.Poss} next box ships ${r}.`,cancelled:e=>`${e.productName} is cancelled. Restart it from ${t.poss} plan anytime.`,orders:"Orders",startedHeader:"Subscribed",placedHeader:"Order placed",cartCheckoutTitle:"Checkout",orderNote:"",cartLabel:e=>e>0?`Cart, ${e} item${e>1?"s":""}`:"Cart, empty",addToCart:e=>`Add to cart · ${e}`,viewCart:"View cart",addedToCart:(e,t)=>`${e.productName} is in your cart${t?", as a subscription":""}.`,removedFromCart:e=>`${e} is out of your cart.`,cartTitle:"Cart",cartEmptyTitle:"Your cart is empty",cartEmptyBody:e=>`${NameOf(e)}'s plan pick lands here when you add it.`,seeOrders:`See ${t.poss} orders`,quantityLabel:e=>`How many: ${e}`,fewer:"One fewer",more:"One more",remove:"Remove",cartSubLine:e=>e.offer?`First box ${e.discountPercent}% off, then ${e.box??""} every ${e.intervalDays} days`:`Every ${e.intervalDays} days`,cartOnceLine:(e,r)=>r?`An extra box. ${t.Poss} plan keeps shipping.`:e.onceDiscountPercent>0?`One box, ${e.onceDiscountPercent}% off`:"One box",cartModeLabel:e=>`How to buy ${e}`,cartModeSubscribe:e=>e.offer?`Subscribe, ${e.discountPercent}% off the first box`:"Subscribe",cartModeOnce:e=>e.onceDiscountPercent>0?`One box, ${e.onceDiscountPercent}% off`:"One box",subtotal:"Subtotal",shipping:"Shipping",shippingValue:"",shippingTag:"",total:"Total",dueToday:"Due today",thenRenews:e=>`Then ${e.productName}`,renewsEvery:e=>`${e.box??""} every ${e.intervalDays} days`,checkoutCart:e=>`Checkout · ${e}`,cartOneAtATime:"",cartSubscriptionApart:"",cartItemSubscription:e=>`Subscription, every ${e.intervalDays} days`,cartItemQuantity:e=>`Qty ${e}`,placeOrder:(e,t)=>`${t?"Place order and subscribe":"Place order"} · ${e}`,cartFine:e=>`${e===null?"":`${Pe(e)} `}Ships tomorrow.`,placedSteps:"What's coming",placedShips:"It ships.",placedArrives:"It arrives at home.",viewOrder:"View order",herSubscription:`${t.Poss} subscription`,nextBox:e=>`Next box ${e}`,everyDays:e=>`Every ${e} days`,ordersHeading:e=>e?"Orders":`${t.Poss} orders`,ordersFine:"",ordersEmptyTitle:"No orders yet",ordersEmptyBody:e=>`The boxes from ${r(e)}'s plan show up here.`,moreOrders:"",orderSteps:["Ordered","Shipped","Out for delivery","Delivered"],subscriptionBox:"Subscription box",orderTitle:e=>e===null?"Order":`Order ${e}`,arrivesBy:e=>`Arrives by ${e}`,deliveredOn:e=>`Delivered ${e}`,expected:e=>`Expected ${e}`,tracking:"Tracking",trackingByText:"The tracking number comes by text when it ships.",trackOn:e=>`Track on ${e}`,trackLink:"",inThisOrder:"In this order",orderItemLine:(e,t)=>`Qty ${e}${t?" · subscription box":""}`,paidWith:"Paid with",buyAgain:"Buy again",orderHelp:"Get help with this order",addWeightTitle:`Add ${t.poss} weight to size ${t.poss} dose`,addWeightBody:`From a home scale or ${t.poss} last vet visit.`,connectRecordsTitle:`Connect ${t.poss} vet records`,connectRecordsBody:`${t.Poss} weight, visits and labs make ${t.poss} plan sharper.`,weightKicker:`${t.Poss} weight`,weightTitle:e=>`Add ${r(e)}'s weight`,weightBody:`From a home scale or ${t.poss} last vet visit. ${t.Poss} plan uses it to size ${t.poss} dose.`,weightField:`${t.Poss} weight`,weightUnit:"lb",weightUnitKg:"kg",weightErrorKg:"Enter your pet’s weight",weightError:`Enter ${t.poss} weight in pounds, like 14.1.`,weightSave:`Save ${t.poss} weight`,weightSaved:e=>`Saved: ${e} lb. ${t.Poss} dose is sized for ${t.obj}.`,weightSavedKg:e=>`Saved: ${e} kg. ${t.Poss} dose is sized for ${t.obj}.`,checkoutFailed:"That didn't go through. Please try again.",builtWith:e=>`Built with ${e}`,fromVet:e=>`From ${e}`,waitVetTips:e=>`Free tips from ${e}, built around that risk`,signalsFit:e=>`${e} of ${e} signals fit ${t.Name}`,signalsValue:e=>`${e}/${e}`,noPick:`No supplement for this one. ${t.Poss} vet comes first.`,callYourVet:"Call your vet today",callAVet:"Call a vet today",saveForCheckup:`Save for ${t.poss} next checkup`,savedForCheckup:`Saved for ${t.poss} next checkup`,blanksLabel:`${t.Poss} three blanks`,blanksAsked:e=>`Asked ${e}`,blanksAskedNoClinic:"",blanksWaitPill:"2 to 5 days",blanksFilledKicker:`From ${t.poss} vet records`,blanksFilled:(e,t)=>`${e} of ${t} filled`,blanksWeight:`Keep ${t.obj} at `,blanksWeightSource:`From ${t.poss} vet visits`,blanksDose:(e,t)=>`${e} of ${t}`,blanksDoseSource:`Sized to ${t.poss} weight`,blanksShots:`${t.Poss} next shots are due `,blanksShotsSource:`From ${t.poss} clinic`,blankEmpty:"blank",recordsLanded:`${t.Poss} records are in. ${t.Poss} plan now uses ${t.poss} weight and ${t.poss} visits.`,todayLabel:`${t.Poss} Health Plan`,poweredBy:"powered by",poweredByName:"Everfur",seeMore:"See more",seeLess:"See less",reportActions:"Actions to take",openReport:`Open it in ${t.poss} report`,askReport:"Ask about it",fullOpen:`See ${t.poss} full plan`,fullOpenLine:`${t.Poss} vet, reviews and ${t.poss} checkup`,fullClose:`Show ${t.poss} brief plan`,fullCloseLine:`${t.Poss} risk, tips, pick and signs`,hopeNoted:e=>`Noted. When ${t.poss} results land, we'll start with ${e}.`,productLink:e=>`${e}, see the product`,productPhotos:e=>`${e} photos, swipe for more`,shopAll:"Shop all",madeFor:`Made for ${t.name}`,ratingLine:e=>`· ${e} reviews`,productOffer:e=>`${e.discountPercent}% off ${t.poss} first box`,productEvery:e=>`Every ${e.intervalDays} days`,productOnce:e=>e.onceDiscountPercent>0?`One box, ${e.onceDiscountPercent}% off`:"One box",productExtraBox:"An extra box",productOnPlan:e=>`On ${t.poss} plan, every ${e.intervalDays} days. This adds one extra box.`,quantity:"Quantity",description:"Description",readMore:"Read more",readLess:"Read less",whatsInside:"What's inside",howMuch:"How much",reviewsTitle:"Reviews",reviewCount:e=>`${e} reviews`,reviewsSwipe:"Reviews, swipe for more",readAllReviews:e=>`Read all ${e} reviews`,starsLabel:e=>`${e} out of 5 stars`,buyNow:"Buy now"});return n}var Ie=healthPlanFocusCopyFor({sex:"female"});function formatHealthPlanDay(e,t){if(e===null||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let r=/* @__PURE__ */new Date(`${e}T00:00:00Z`);if(Number.isNaN(r.getTime()))return null;try{return new Intl.DateTimeFormat(t??"en-US",{month:"short",day:"numeric",timeZone:"UTC"}).format(r)}catch{return e}}function Oe(e){return e!=null&&(e.wait!==void 0||e.pick.hidden===true)}function Te(e){return{...e,pick:{...e.pick,none:true,hidden:true}}}var Re=/* @__PURE__ */Object.freeze({productId:"",partnerSku:null,title:"",description:null,category:null,price:null,currency:null,imageUrl:null,url:null,reasons:[],inPlan:false,sample:false});var Ee=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});var $e=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),Ne=globalThis,De=Ne[$e]??(Ne[$e]=createContext(null));De.displayName??="EverfurContext";function Fe(){let e=M(De);if(e===null)throw new p("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}var Le=/* @__PURE__ */Object.freeze({opened:"health_plan.opened",productClicked:"health_plan.product_clicked",checkoutStarted:"health_plan.checkout_started"});function Ae(){return M(De)?.runtime.registry.services.telemetry??Ee}var Me=createContext(null);function HealthPlanPetScope({petRef:petRef,children:e}){return H(Me.Provider,{value:petRef},e)}function ze(e){let t=M(Me),r=M(De);return t??e??r?.activePet??null}function je(e,petRef,t){let r=Ae(),n=F(null);D(()=>{if(!e||petRef===null||n.current===petRef)return;n.current=petRef;let i=t?.items??[];r.track(Le.opened,{petRef:petRef,itemsCount:i.length,inPlanCount:i.filter(e=>e.inPlan).length})},[e,petRef,t,r])}function He(e,petRef,t,r){e.track(Le.productClicked,{petRef:petRef,productId:t,inPlan:r})}function Be(e,petRef,t){e.track(Le.checkoutStarted,{petRef:petRef,itemsCount:t.count,subtotal:t.subtotal,currency:t.currency})}var qe=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],Ue=/* @__PURE__ */Object.freeze(qe.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Ue.map(e=>e.wireCode));var Ke=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),We=/* @__PURE__ */Object.freeze(Ue.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Ke[e.wireCode]}))),Ve=new Map(We.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Ge=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(We.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...Ge]){let t=Ve.get(e+r);if(t)return t}}var Ye=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return Ye[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var Qe=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return Qe.has(e)}var Ze=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||Ze.has(e)}var Je=500,Xe=8e3,et=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Je*2**r,Xe);return Math.floor(t()*n)}var tt="This feature isn't available on your account right now.",rt="Something in that request was not right. Check the details and try again.",nt=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:tt,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:rt,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:tt,runtimeDisposed:rt,unknown:"Something went wrong. Please try again."}),it="This session has ended. Please sign in again.",lt="linked_account_read_only";function ot(e,t,r){return e==="conflict"&&r===lt?tt:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?it:userFacingError(e)}function userFacingError(e){return nt[e]}function at(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var st=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===lt,i={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:ot(e,t?.wireCode,n?lt:null)};t?.httpStatus!==void 0&&(i.httpStatus=t.httpStatus),t?.requestId&&(i.requestId=t.requestId),typeof t?.reasonCode=="string"&&st.test(t.reasonCode)&&(i.reasonCode=t.reasonCode);let l=t?.retryAfterSeconds;if(typeof l=="number"&&Number.isFinite(l)&&l>=0&&(i.retryAfterSeconds=Math.round(l)),r);return t?.wireMessage&&at(i,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&at(i,"raw",t.raw),/* @__PURE__ */Object.freeze(i)}function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
4
4
  return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var ut="x-everfur-anon-token",dt="anonTokenInvalid";async function ct(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function pt(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...r?{wireMessage:r}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[ut]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...ht(e.headers),...authHeaders(t)}}}function ht(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let e=r.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===ut||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await ct(t),n=await t.transport.request(withAuthHeaders(e,ft(t,r)));if(n.ok||bt(n.error.raw)!==dt||t.anonIdentity===void 0||t.userRef!==null)return n;let i=await t.anonIdentity.token({forceRefresh:true});return i===null||i===r?n:t.transport.request(withAuthHeaders(e,ft(t,i)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(pt(e))}let n=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(pt(e,{wireCode:bt(n.error.raw),requestId:n.error.requestId}))}let l=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!l.ok&&l.error.httpStatus===401?(t.identity.reportRejected?.(),err(mt(l.error))):l}function ft(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function mt(e){let t=e.raw,r=bt(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...r?{wireCode:r}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function bt(e){if(typeof e!="object"||e===null)return null;let t=e,r=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof r=="string"&&r.length>0?r:null}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:yt(e)})}function yt(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var gt=3e4,vt=Xe*2,kt="idempotency-key",wt=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),_t=/* @__PURE__ */Object.freeze({onEvent(){}}),xt=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function Ct(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??_t,r=e.timers??xt,n=e.rng??Math.random,i=e.sleep??((e,t)=>jt(e,r,t)),l=e.maxAttempts??et,o=e.unaryTimeoutMs??gt,a=e.newIdempotencyKey??St(),s=e=>{try{t.onEvent(e)}catch{}};async function u(t,u,d){let c=d?.maxAttempts,p=Math.max(1,c??l),h=d?.idempotent??wt.has(u.method),f=d?.idempotencyKey===void 0?null:Ct(d.idempotencyKey),m=h?f??a():null,b=Pt(u,m),y=0;for(;;){let l=e=>/* @__PURE__ */Object.freeze({call:t,method:u.method,path:u.path,attempt:y,...m?{idempotencyKey:m}:{},...e});s(l({phase:"attempt"}));let a=Mt(o,r),d=zt(a.signal,u.signal),h;try{h=await authedSend({...b,signal:d.signal},e.auth)}catch(e){h=err(networkError(e))}finally{d.dispose(),a.cancel()}if(h.ok)return s(l({phase:"settled",ok:true,reason:"ok"})),h;let f=h.error,g=Ot(f,y,{maxAttempts:p,rng:n,now:r.now(),aborted:u.signal?.aborted===true,...c!==void 0?{perCallMaxAttempts:c}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),v={ok:false,code:f.code,reason:g.reason,...f.httpStatus!==void 0?{httpStatus:f.httpStatus}:{},...f.requestId!==void 0?{requestId:f.requestId}:{}};if(!g.retry)return s(l({phase:"settled",...v})),err(f);if(s(l({phase:"retry",...v,delayMs:g.delayMs})),await i(g.delayMs,u.signal),u.signal?.aborted===true)return s(l({phase:"settled",...v,reason:"aborted"})),err(f);y+=1}}async function d(t){return withAuthHeaders(t,await At(e.auth))}async function*c(t,r,n){s(
5
5
  /* @__PURE__ */Object.freeze({call:t,phase:"stream.open",method:r.method,path:r.path,attempt:0}));try{yield*e.auth.transport.stream(r,n)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
6
6
  return Object.freeze({send:u,authorize:d,stream:c})}function Pt(e,t){let r={};for(let[t,n]of Object.entries(e.headers??{}))t.toLowerCase()!==kt&&(r[t]=n);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}function St(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var It=10;function Ot(e,t,r){if(r.aborted)return{retry:false,reason:"aborted"};let n=Tt(e);if(n==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if((()=>{if(r.policy===void 0)return false;try{return!r.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let l=()=>{if(r.policy===void 0)return null;let t;try{t=r.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(It,Math.floor(t)))},o=r.perCallMaxAttempts??l()??r.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let a=Rt(e,r.now);return a!==null?a>vt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:a}:{retry:true,reason:i,delayMs:backoffDelayMs(t,r.rng)}}function Tt(e){let t=e.code==="unknown"?fromWire(Ft(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function Rt(e,t){let r=$t(e.raw);if(r!==null){let e=r-t;return e>0?e:0}let n=Et(e.raw);return n===null?null:Math.round(n*1e3)}function Et(e){for(let t of Nt(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function $t(e){for(let t of Nt(e)){let e=t.resets_at,r=Dt(e);if(r!==null)return r}return null}function Nt(e){if(!Lt(e))return[];let t=[e];for(let r of["error","detail"]){let n=e[r];Lt(n)&&t.push(n)}return t}function Dt(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}function Ft(e){for(let t of Nt(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function Lt(e){return typeof e=="object"&&e!==null}async function At(e){if(e.mode==="anonymous"){let t=await ct(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function Mt(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return{signal:r.signal,cancel:()=>t.clearTimeout(n)}}function zt(e,t){let r=()=>{};if(!t)return{signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let i=()=>n.abort();return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i)}}}function jt(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",l),n()},e),l=()=>{t.clearTimeout(i),n()};r?.addEventListener("abort",l,{once:true})})}function Ht(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function Bt(e){return e.code!=="conversationNotFound"?e:makeEverfurError("resourceNotFound",{retryable:false,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},...e.requestId===void 0?{}:{requestId:e.requestId},...e.reasonCode===void 0?{}:{reasonCode:e.reasonCode},...e.wireMessage===void 0?{}:{wireMessage:e.wireMessage},...e.raw===void 0?{}:{raw:e.raw}})}function qt(e){return e.ok?e:err(Bt(e.error))}function Ut(e){return{send:async(...t)=>qt(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,r,n)=>e.stream(t,r,n)}}var Kt=/* @__PURE__ */Object.freeze(["dna","records","inside","profile"]),Wt=128;function Vt(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function Gt(e){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${e} was called after unmount`})}function Yt(e){return makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:`${e}: the response carried no plan`})}var Qt=(e,t=4e3)=>typeof e=="string"&&e.trim().length>0&&e.length<=t?e.trim():null;function Zt(e){let t=Qt(e,2048);return t===null?null:/^https:\/\/[^\s]+$/i.test(t)?t:null}function Jt(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+(\.\d+)?$/.test(e.trim())?Number(e):Number.NaN;return Number.isFinite(t)&&t>=0?t:null}function Xt(e){return typeof e=="string"&&/^[A-Za-z]{3}$/.test(e)?e.toUpperCase():null}function er(e){if(!Array.isArray(e))/* @__PURE__ */return Object.freeze([]);let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let e=r,n=Qt(e.text,1e3);if(n===null)continue;let i=typeof e.kind=="string"&&Kt.includes(e.kind)?e.kind:"profile";t.push(/* @__PURE__ */Object.freeze({kind:i,text:n}))}/* @__PURE__ */
@@ -11,7 +11,7 @@ return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryab
11
11
  return Object.freeze({kind:"analysisStarted",requestId:e,lastEventId:t,serverRequestId:r,terminal:false})}function analysisCompleteFrame(e,t=null){/* @__PURE__ */
12
12
  return Object.freeze({kind:"analysisComplete",terminal:false,resultId:e.resultId,analysisType:e.analysisType,modelVersion:e.modelVersion,confidence:e.confidence,detections:/* @__PURE__ */Object.freeze([...e.detections]),interpretation:e.interpretation,lastEventId:e.lastEventId,serverRequestId:t})}function unknownFrame(e,t,r=null){/* @__PURE__ */
13
13
  return Object.freeze({kind:"unknown",raw:{...e},lastEventId:t,serverRequestId:r,terminal:false})}var S="/widget/v1/anon-identity",j="x-everfur-anon-token",_="anonTokenInvalid";function R(e,t){if(typeof e!="string"||t===null)return null;let r=Date.parse(e)-Date.parse(t);return Number.isFinite(r)&&r>0?r:null}function createAnonIdentityProvider(e,t,r,n=Date.now){let l=null,i=null,o=null,a=null,s=e=>Math.max(0,n()-e),u=(e,t)=>e!==null&&n()>=e&&n()-e<t,c=()=>l!==null&&(l.ttlMs===null||s(l.mintedAtMs)<l.ttlMs-2592e5),d=()=>l!==null&&(l.ttlMs===null||s(l.mintedAtMs)<l.ttlMs)?l.token:null,f=()=>i||(i=(async()=>{try{let i=null,a={method:"POST",path:S,headers:{"x-everfur-partner-key":t,"x-everfur-session-id":r},onResponseHeaders:e=>{i=e("date")}},s=await e.request(a),u=s.ok?s.value:null,c=typeof u?.anon_token=="string"&&u.anon_token.length>0?u.anon_token:null;return c===null?(o=n(),d()):(l={token:c,mintedAtMs:n(),ttlMs:R(u?.expires_at,i)},o=null,c)}catch{return o=n(),d()}finally{i=null}})(),i);return{token(e){return e?.forceRefresh?i||(u(a,3e4)?Promise.resolve(l?.token??null):(a=n(),l=null,f())):c()||u(o,3e5)?Promise.resolve(d()):f()}}}async function E(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}var I="This feature isn't available on your account right now.",z="Something in that request was not right. Check the details and try again.",T=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:I,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:z,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:I,runtimeDisposed:z,unknown:"Something went wrong. Please try again."}),O="This session has ended. Please sign in again.",P="linked_account_read_only";function F(e,t,r){return e==="conflict"&&r===P?I:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?O:userFacingError(e)}function userFacingError(e){return T[e]}function M(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var A=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===P,l={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:F(e,t?.wireCode,n?P:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&A.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(l.retryAfterSeconds=Math.round(i)),r);return t?.wireMessage&&M(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&M(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function $(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...r?{wireMessage:r}:{},...e!=null?{raw:e}:{}})}function createIdentityProvider(e,t,r,n){let l=null,i=false,o=null,a=false,u=()=>o||(o=(async()=>{try{let e=await t(),n=typeof e=="string"?e:e?.token;if(typeof n!="string"||n.length===0)throw new s("invalid-argument","TokenProvider returned an empty token");return l=n,i=!1,r?.(typeof e=="string"?null:D(e.expiresAt)),n}finally{o=null}})(),o);return{userRef:e,async currentToken(e){if(a)throw new s("not-initialized","This identity was cleared (sign-out); mint a new one.");return e?.forceRefresh&&(l=null),l!==null?l:u()},hasToken(){return!a&&l!==null},clear(){a=true,l=null},reportRejected(){a||i||(i=true,n?.())}}}function D(e){if(e===void 0)return null;let t=typeof e=="number"?e<1e11?e*1e3:e:new Date(e).getTime();return Number.isFinite(t)?t:null}function newSessionId(){let e=new Uint8Array(16),t=globalThis.crypto;if(typeof t?.getRandomValues=="function")t.getRandomValues(e);else for(let t=0;t<e.length;t+=1)e[t]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=[];for(let t=0;t<e.length;t+=1)r.push(e[t].toString(16).padStart(2,"0"));return r.slice(0,4).join("")+"-"+r.slice(4,6).join("")+"-"+r.slice(6,8).join("")+"-"+r.slice(8,10).join("")+"-"+r.slice(10,16).join("")}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[j]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...B(e.headers),...authHeaders(t)}}}function B(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let e=r.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===j||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await E(t),n=await t.transport.request(withAuthHeaders(e,N(t,r)));if(n.ok||U(n.error.raw)!==_||t.anonIdentity===void 0||t.userRef!==null)return n;let l=await t.anonIdentity.token({forceRefresh:true});return l===null||l===r?n:t.transport.request(withAuthHeaders(e,N(t,l)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err($(e))}let n=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let l;try{l=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err($(e,{wireCode:U(n.error.raw),requestId:n.error.requestId}))}let i=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:l,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!i.ok&&i.error.httpStatus===401?(t.identity.reportRejected?.(),err(L(i.error))):i}function N(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function L(e){let t=e.raw,r=U(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...r?{wireCode:r}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function U(e){if(typeof e!="object"||e===null)return null;let t=e,r=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof r=="string"&&r.length>0?r:null}var H="DAILY_QUOTA_EXCEEDED",W=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function q(e,t){if(!W.has(e.toUpperCase().replace(/[^A-Z0-9]/g,"")))return e;let r=t,n=r?.daily_limit??r?.error?.daily_limit;return typeof n=="number"&&Number.isFinite(n)?H:e}var V="free_cap_reached";function K(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function G(e){if(typeof e!="object"||e===null)return null;let t=e,r=t.detail,n=typeof r=="object"&&r!==null?r:t;if(n.error!==V&&n.code!==V)return null;let l=K(n.limit),i=K(n.used);if(l===null||i===null)return null;let o=n.resets_at,a=n.emergency_guidance;/* @__PURE__ */
14
- return Object.freeze({limit:l,used:i,resetsAt:typeof o=="string"&&o.length>0?o:null,...typeof a=="string"&&a.trim().length>0?{emergencyGuidance:a}:{}})}function Y(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t.freeCap;return typeof r=="object"&&r!==null?r:G(t)}function Q(){let e=[];return{decode(t,r){let n=r?.stream===true,l=e.length>0?e.slice():[];if(t!==void 0)for(let e=0;e<t.length;e+=1)l.push(t[e]);e=[];let i="",o=0;for(;o<l.length;){let t=l[o];if(t<128){i+=String.fromCharCode(t),o+=1;continue}let r,a=128,s=191,u;if(t>=194&&t<=223)r=1,u=t&31;else if(t>=224&&t<=239)r=2,u=t&15,t===224&&(a=160),t===237&&(s=159);else if(t>=240&&t<=244)r=3,u=t&7,t===240&&(a=144),t===244&&(s=143);else{i+="�",o+=1;continue}let c=1,d=true;for(;c<=r&&!(o+c>=l.length);){let e=l[o+c],t=c===1?a:128,r=c===1?s:191;if(e<t||e>r){d=false;break}u=u<<6|e&63,c+=1}if(!d){i+="�",o+=c;continue}if(c<=r){n?e=l.slice(o):i+="�";break}i+=String.fromCodePoint(u),o+=r+1}return i}}}function Z(){let e=globalThis.TextDecoder;return typeof e=="function"?new e("utf-8"):Q()}var X=`\n\n`,J=1048576,ee=/* @__PURE__ */t.z.record(/* @__PURE__ */t.z.string(),/* @__PURE__ */t.z.unknown()),te=["emergency","schedule_soon","home_care"];async function*parseSse(e,t=null){let r=null,n=()=>(r!==null||(r=typeof t=="function"?t():t),r),l=Z(),i="",o=0,a=false;for await(let t of e){for(i+=l.decode(t,{stream:true});;){let e=i.indexOf(X,o);if(e===-1)break;let t=i.slice(0,e);i=i.slice(e+X.length),o=0;let r=re(t,n());if(r!==null&&(r.kind==="delta"&&(a=true),yield r,r.terminal))return}if(o=i.length>0?i.length-1:0,i.length>J){yield errorFrame({code:a?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:n()});return}}if(i+=l.decode(),i.trim().length>0){let e=re(i,n());if(e!==null&&(e.kind==="delta"&&(a=true),yield e,e.terminal))return}yield errorFrame({code:a?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:n()})}function re(e,t){let r=null,n=[];for(let t of e.split(`\n`)){let e=t.replace(/\s+$/,"");e.length===0||e.startsWith(":")||(e.startsWith("id:")?r=e.slice(3).trim():e.startsWith("data:")&&n.push(e.slice(5).replace(/^ /,"")))}if(n.length===0)return null;let l;try{l=JSON.parse(n.join(`\n`))}catch{return null}if(typeof l!="object"||l===null||Array.isArray(l))return null;let i=ee.safeParse(l);return i.success?ne(i.data,r,t):null}function ne(e,t,r){let n=e.type,l=e.event;if(n==="error"||"error"in e)return errorFrame({code:le(e.code)??"unknown",retryable:e.retryable===true,wireMessage:le(e.error),synthesized:false,lastEventId:t,serverRequestId:r,freeCap:G(e)});if(n==="done"||e.done===true)return doneFrame({conversationId:le(e.conversation_id)??"",messageId:le(e.message_id),title:le(e.title),followUpQuestions:se(e.follow_up_questions),citations:ce(e.citations),citationStatus:le(e.citation_status),urgencyLevel:oe(e.urgency_level),urgencyReason:le(e.urgency_reason),urgencyProvided:ae(e),resultId:le(e.result_id),lastEventId:t},r);if(n==="accepted"||e.status==="reasoning")return acceptedFrame(le(e.stream_id),t,r);if(n==="heartbeat"||e.heartbeat===true)return heartbeatFrame(t,r);if(n==="text.delta"||"delta"in e||"token"in e){let n=le(e.delta)??le(e.token)??"";return deltaFrame(n,t,r)}return l==="analysis_started"?analysisStartedFrame(le(e.request_id),t,r):l==="analysis_complete"?analysisCompleteFrame({resultId:le(e.result_id),analysisType:le(e.analysis_type),modelVersion:le(e.model_version),confidence:ie(e.confidence),detections:ce(e.detections),interpretation:le(e.interpretation),lastEventId:t},r):unknownFrame(e,t,r)}function le(e){return typeof e=="string"?e:null}function ie(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function oe(e){return typeof e=="string"&&te.includes(e)?e:null}function ae(e){if(!Object.prototype.hasOwnProperty.call(e,"urgency_level"))return false;let t=e.urgency_level;return t===null||oe(t)!==null}function se(e){return Array.isArray(e)?e.map(e=>typeof e=="string"?e:String(e)):[]}function ue(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ce(e){return Array.isArray(e)?e.filter(ue):[]}var de=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;function fe(e,t){let r=globalThis.URL;if(typeof r=="function"){let n;try{n=t===void 0?new r(e):new r(e,t)}catch{return null}try{if(n.protocol)return n}catch{}}return me(e)}var pe=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,he=/[\s\u0000-\u001f\u007f\\]/,ge={"http:":"80","https:":"443"};function me(e,t){let r=e.trim();let n=he.test(r)?null:pe.exec(r);if(n===null)return null;let[,l="",i="",o="",a="",s="",u="",c="",d=""]=n,f=`${l.toLowerCase()}:`,p=Number(s);if(p>65535)return null;let h=s===""||String(p)===ge[f]?"":String(p),g=ge[f]!==void 0,m=a.toLowerCase()+(h&&`:${h}`),b=u||(g?"/":""),y=i||o?`${i}${o&&`:${o}`}@`:"";return{href:`${f}//${y}${m}${b}${c}${d}`,protocol:f,username:i,password:o,hostname:a.toLowerCase(),port:h,origin:g?`${f}//${m}`:"null",pathname:b,search:c==="?"?"":c,hash:d==="#"?"":d}}function be(e,t,r){return{...e,surface:t,requestId:r||null}}var ye=64,ve=/^[A-Za-z0-9._+() -]+$/;function xe(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0||t.length>ye?null:ve.test(t)?t:null}var ke="1.5.0";var we="react-native",Ce="2026-09-19",Se="EVERFUR_API_BASE_URL";function je(e,t){/* @__PURE__ */
14
+ return Object.freeze({limit:l,used:i,resetsAt:typeof o=="string"&&o.length>0?o:null,...typeof a=="string"&&a.trim().length>0?{emergencyGuidance:a}:{}})}function Y(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t.freeCap;return typeof r=="object"&&r!==null?r:G(t)}function Q(){let e=[];return{decode(t,r){let n=r?.stream===true,l=e.length>0?e.slice():[];if(t!==void 0)for(let e=0;e<t.length;e+=1)l.push(t[e]);e=[];let i="",o=0;for(;o<l.length;){let t=l[o];if(t<128){i+=String.fromCharCode(t),o+=1;continue}let r,a=128,s=191,u;if(t>=194&&t<=223)r=1,u=t&31;else if(t>=224&&t<=239)r=2,u=t&15,t===224&&(a=160),t===237&&(s=159);else if(t>=240&&t<=244)r=3,u=t&7,t===240&&(a=144),t===244&&(s=143);else{i+="�",o+=1;continue}let c=1,d=true;for(;c<=r&&!(o+c>=l.length);){let e=l[o+c],t=c===1?a:128,r=c===1?s:191;if(e<t||e>r){d=false;break}u=u<<6|e&63,c+=1}if(!d){i+="�",o+=c;continue}if(c<=r){n?e=l.slice(o):i+="�";break}i+=String.fromCodePoint(u),o+=r+1}return i}}}function Z(){let e=globalThis.TextDecoder;return typeof e=="function"?new e("utf-8"):Q()}var X=`\n\n`,J=1048576,ee=/* @__PURE__ */t.z.record(/* @__PURE__ */t.z.string(),/* @__PURE__ */t.z.unknown()),te=["emergency","schedule_soon","home_care"];async function*parseSse(e,t=null){let r=null,n=()=>(r!==null||(r=typeof t=="function"?t():t),r),l=Z(),i="",o=0,a=false;for await(let t of e){for(i+=l.decode(t,{stream:true});;){let e=i.indexOf(X,o);if(e===-1)break;let t=i.slice(0,e);i=i.slice(e+X.length),o=0;let r=re(t,n());if(r!==null&&(r.kind==="delta"&&(a=true),yield r,r.terminal))return}if(o=i.length>0?i.length-1:0,i.length>J){yield errorFrame({code:a?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:n()});return}}if(i+=l.decode(),i.trim().length>0){let e=re(i,n());if(e!==null&&(e.kind==="delta"&&(a=true),yield e,e.terminal))return}yield errorFrame({code:a?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:n()})}function re(e,t){let r=null,n=[];for(let t of e.split(`\n`)){let e=t.replace(/\s+$/,"");e.length===0||e.startsWith(":")||(e.startsWith("id:")?r=e.slice(3).trim():e.startsWith("data:")&&n.push(e.slice(5).replace(/^ /,"")))}if(n.length===0)return null;let l;try{l=JSON.parse(n.join(`\n`))}catch{return null}if(typeof l!="object"||l===null||Array.isArray(l))return null;let i=ee.safeParse(l);return i.success?ne(i.data,r,t):null}function ne(e,t,r){let n=e.type,l=e.event;if(n==="error"||"error"in e)return errorFrame({code:le(e.code)??"unknown",retryable:e.retryable===true,wireMessage:le(e.error),synthesized:false,lastEventId:t,serverRequestId:r,freeCap:G(e)});if(n==="done"||e.done===true)return doneFrame({conversationId:le(e.conversation_id)??"",messageId:le(e.message_id),title:le(e.title),followUpQuestions:se(e.follow_up_questions),citations:ce(e.citations),citationStatus:le(e.citation_status),urgencyLevel:oe(e.urgency_level),urgencyReason:le(e.urgency_reason),urgencyProvided:ae(e),resultId:le(e.result_id),lastEventId:t},r);if(n==="accepted"||e.status==="reasoning")return acceptedFrame(le(e.stream_id),t,r);if(n==="heartbeat"||e.heartbeat===true)return heartbeatFrame(t,r);if(n==="text.delta"||"delta"in e||"token"in e){let n=le(e.delta)??le(e.token)??"";return deltaFrame(n,t,r)}return l==="analysis_started"?analysisStartedFrame(le(e.request_id),t,r):l==="analysis_complete"?analysisCompleteFrame({resultId:le(e.result_id),analysisType:le(e.analysis_type),modelVersion:le(e.model_version),confidence:ie(e.confidence),detections:ce(e.detections),interpretation:le(e.interpretation),lastEventId:t},r):unknownFrame(e,t,r)}function le(e){return typeof e=="string"?e:null}function ie(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function oe(e){return typeof e=="string"&&te.includes(e)?e:null}function ae(e){if(!Object.prototype.hasOwnProperty.call(e,"urgency_level"))return false;let t=e.urgency_level;return t===null||oe(t)!==null}function se(e){return Array.isArray(e)?e.map(e=>typeof e=="string"?e:String(e)):[]}function ue(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ce(e){return Array.isArray(e)?e.filter(ue):[]}var de=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;function fe(e,t){let r=globalThis.URL;if(typeof r=="function"){let n;try{n=t===void 0?new r(e):new r(e,t)}catch{return null}try{if(n.protocol)return n}catch{}}return me(e)}var pe=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,he=/[\s\u0000-\u001f\u007f\\]/,ge={"http:":"80","https:":"443"};function me(e,t){let r=e.trim();let n=he.test(r)?null:pe.exec(r);if(n===null)return null;let[,l="",i="",o="",a="",s="",u="",c="",d=""]=n,f=`${l.toLowerCase()}:`,p=Number(s);if(p>65535)return null;let h=s===""||String(p)===ge[f]?"":String(p),g=ge[f]!==void 0,m=a.toLowerCase()+(h&&`:${h}`),b=u||(g?"/":""),y=i||o?`${i}${o&&`:${o}`}@`:"";return{href:`${f}//${y}${m}${b}${c}${d}`,protocol:f,username:i,password:o,hostname:a.toLowerCase(),port:h,origin:g?`${f}//${m}`:"null",pathname:b,search:c==="?"?"":c,hash:d==="#"?"":d}}function be(e,t,r){return{...e,surface:t,requestId:r||null}}var ye=64,ve=/^[A-Za-z0-9._+() -]+$/;function xe(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0||t.length>ye?null:ve.test(t)?t:null}var ke="1.5.1";var we="react-native",Ce="2026-09-19",Se="EVERFUR_API_BASE_URL";function je(e,t){/* @__PURE__ */
15
15
  return Object.freeze({ok:false,failure:/* @__PURE__ */Object.freeze({reason:e,message:t})})}function checkPublishableKey(e){let t=typeof e=="string"?e.trim():"";return t.length===0?{reason:"missing-publishable-key",message:"publishableKey is required"}:/^sk[_-]/i.test(t)?{reason:"secret-key-as-publishable-key",message:"publishableKey looks like a SECRET key (sk_...). A device must never hold a partner secret key: use the pk_ publishable key here, and keep the secret key on your server."}:null}function tryResolveClientConfig(e,t){let r=checkPublishableKey(e?.publishableKey);if(r!==null)/* @__PURE__ */
16
16
  return Object.freeze({ok:false,failure:r});let n=e.publishableKey.trim(),l=tryResolveApiBaseUrl(e.apiBaseUrl);if(!l.ok)return l;let i=e.contractVersion?.trim()||Ce,o=xe(e.appVersion);/* @__PURE__ */
17
17
  return Object.freeze({ok:true,config:/* @__PURE__ */Object.freeze({publishableKey:n,apiBaseUrl:l.value,contractVersion:i,sdkVersion:ke,platform:t?.platform??we,debug:e.debug===true,...o!==null?{appVersion:o}:{}})})}function tryResolveApiBaseUrl(e){let t=e?.trim(),r=t&&t.length>0?t:Oe(Se);return r?ze(r):je("missing-api-base-url",`apiBaseUrl is required: pass config.apiBaseUrl or set ${Se}. The SDK never ships a hardcoded host.`)}function buildBaseHeaders(e){let t={"X-Everfur-SDK-Version":e.sdkVersion,"X-Everfur-SDK-Platform":e.platform,"X-Everfur-Contract":e.contractVersion};return e.appVersion!=null&&e.platform==="react-native"&&(t["X-Everfur-App-Version"]=e.appVersion),t}function _e(e){return e.slice(e.lastIndexOf("@")+1).replace(/:\d+$/,"").toLowerCase()}function Re(e){return e.length===0||e.includes("@")?false:e.startsWith("[")&&e.endsWith("]")?true:!e.includes(":")}function Ee(e,t){let r=e.indexOf("://");return r<0||e.slice(r+3).includes("@")?false:Re(t)}function Ie(e,t){return`${e}://${t}`}function ze(e){let t=e.trim(),r=de.exec(t);if(r===null||r[2]===void 0||r[2].length===0)return je("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let n=(r[1]??"").toLowerCase(),l=_e(r[2]);if(l.length===0)return je("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let i=Ee(t,l)?`: ${Ie(n,l)}`:"";if(n!=="https"){if(!(n==="http"&&Te(l)))return n==="http"?je("insecure-api-base-url",`apiBaseUrl must use https (cleartext http is only allowed for localhost)${i}`):je("unsupported-api-base-url-scheme",`apiBaseUrl must be http(s)${i}`)}let o=t.endsWith("/")?t.slice(0,-1):t;/* @__PURE__ */
@@ -46,7 +46,7 @@ return Object.freeze([/* @__PURE__ */Object.freeze({resource:"chat.message.creat
46
46
  return Object.freeze({track(t,r){try{e.track(t,r)}catch{}},trackExpectedFailure(r,n){try{e.trackExpectedFailure(r,t===void 0?n:Yu(r,n,t))}catch{}}})}function Yu(e,t,r){let n=e.indexOf("."),l=typeof t?.surface=="string"?t.surface:n>0?e.slice(0,n):"sdk",i=typeof t?.requestId=="string"?t.requestId:null;return{...be(r,l,i),...t}}function Qu(e,t,r){if(e===void 0)return;let n=e.onExpectedFailure;return{shouldRetry:(t,r)=>e.shouldRetry(t,r),maxAttempts:t=>e.maxAttempts(t),...typeof n=="function"?{onExpectedFailure:(l,i)=>n.call(e,l,i??be(t,r,l.requestId))}:{}}}var Zu=/* @__PURE__ */Object.freeze({"react-native":"If the value is set in your environment, note that babel-preset-expo inlines only EXPO_PUBLIC_* variables into a release bundle.",web:`If the value is set in your environment, note that a browser bundle does not expose ${Se} to the SDK at run time (bundlers inline only the variables your own code names), so pass apiBaseUrl in config.`});function Xu(e,t,r=we){try{t.trackExpectedFailure("sdk.config.invalid",{reason:e.reason})}catch{}globalThis.console?.error?.(`[everfur] SDK disabled: ${e.message}\n[everfur] Every Everfur capability will render its off-state until this is fixed. `+Zu[r])}function Ju(e){/* @__PURE__ */
47
47
  return Object.freeze({request(){return Promise.resolve(err(Vu(e)))},stream(t,r){let n=errorFrame({code:"sdk_not_configured",retryable:false,wireMessage:`Everfur SDK is not configured: ${e.message}`,synthesized:true,lastEventId:null});return{async*[Symbol.asyncIterator](){r.aborted||(yield n)}}}})}var ec=/* @__PURE__ */new WeakSet;function tc(){let e=/* @__PURE__ */new Map,t={async getItem(t){return e.get(t)??null},async setItem(t,r){e.set(t,r)},async removeItem(t){e.delete(t)},async keys(t){return[...e.keys()].filter(e=>e.startsWith(t))}};return ec.add(t),t}var rc=/* @__PURE__ */Object.freeze({clearMemoryCache(){},clearDiskCache(){}});function createEverfurRuntime(e,t){return new lc(e,t)}var nc=6e4,lc=class{constructor(e,t){this.sessionId=newSessionId();this.anonIdentity=null;this.entries=/* @__PURE__ */new Map;this.destroyers=/* @__PURE__ */new Map;this.epoch=0;this.disposed=false;this.verdictSettled=false;this.brandingCache=null;this.verdictLanded=false;this.refreshTimer=null;this.bootstraps=/* @__PURE__ */new WeakMap;this.prepared=null;this.beforeLogoutHooks=/* @__PURE__ */new Set;this.pendingBeforeLogout=null;this.leavingSessionId=null;let r=e.config;if(r.secureStore!==void 0&&r.secureStore.isAvailable===true)throw new s("invalid-argument","config.secureStore is not yet consumable: SDK token persistence is unimplemented. Omit secureStore to keep memory-only tokens (SPEC-10 §5.3).");this.errorContext=/* @__PURE__ */Object.freeze({sdkVersion:ke,platform:t?.platform??we,partnerKey:checkPublishableKey(r?.publishableKey)===null?r.publishableKey.trim():null,appVersion:xe(r?.appVersion)}),this.telemetry=r.telemetry?Gu(r.telemetry,this.errorContext):u,this.onEvent=typeof r.onEvent=="function"?r.onEvent:void 0;let n=typeof r?.publishableKey=="string"?r.publishableKey.trim():"",l=checkPublishableKey(r?.publishableKey),i=r.transport!==void 0,o,a=typeof r.apiBaseUrl=="string"&&r.apiBaseUrl.trim().length>0?r.apiBaseUrl.trim():null;if(l!==null)o=Ju(l);else if(r.transport!==void 0)o=r.transport;else{let e=Ku(r,t?.platform);e.ok?(a=e.config.apiBaseUrl,o=createHttpTransport({config:e.config,...t?.eventSourceFactory?{eventSourceFactory:t.eventSourceFactory}:{}})):(l=e.failure,o=Ju(e.failure))}if(this.configFailure=l,this.publishableKey=l===null?n:"",this.mintScope=`${this.publishableKey}|${a??""}`,Fl(this,this.mintScope),this.transport=o,l!==null&&(Xu(l,this.telemetry,t?.platform),this.emit({type:"error",code:Vu(l).code,requestId:null,context:be(this.errorContext,"runtime",null)})),this.errorPolicy=Qu(r.errorPolicy,this.errorContext,"runtime"),this.camera=r.camera??C,this.upload=r.upload??Lt,this.uploadTransport=r.uploadTransport??on,this.imageCache=r.imageCache??rc,this.kv=r.storage??tc(),this.currentUser=e.user??null,this.identity=this.buildIdentity(e.user??null),this.activePet=e.activePet,this.store=l===null?Mu():Mu(()=>deniedDecisionsFor("sdk_config",userFacingError("accessDenied"))),this.services={authFor:e=>this.buildAuth(e),telemetry:this.telemetry,errorPolicy:this.errorPolicy,camera:this.camera,upload:this.upload,uploadTransport:this.uploadTransport,imageCache:this.imageCache,kv:this.kv,apiBaseUrl:a},this.registry={services:this.services,acquireChat:e=>this.acquireInternal("chat",ic(e),()=>this.buildChatController(e),oc),releaseChat:e=>this.releaseInternal(e),peekChat:e=>this.entries.get(`${this.epoch}|chat|${ic(e)}`)?.controller??null,acquire:(e,t,r,n)=>this.acquireInternal(e,t,r,n),release:e=>this.releaseInternal(e)},this.entitlements=this.store,this.unread=Su({read:e=>this.disposed||this.currentUser===null||this.configFailure!==null?null:ju(this.buildAuth(this.currentUser.userRef),e,this.errorPolicy),emit:e=>this.emit(e)}),l===null){this.brandingCache=Hu(this.kv,this.mintScope);let e=this.epoch;this.brandingCache.restore(t=>{let r=this.store.getSnapshot();this.disposed||this.verdictLanded||this.epoch!==e||r.branding||this.store.set({...r,branding:t})})}this.sdkConfigHost=l===null?qu({kv:this.kv,scope:this.mintScope,funnel:()=>createRequestFunnel({auth:this.buildAuth(this.currentUser?.userRef??null)})}):void 0;let c=l===null&&(t?.startEntitlementPolling??!i);this.poller=l===null?this.buildPoller(t?.pollScheduler):null,c&&this.poller?.start()}get isDisposed(){return this.disposed}get scopeEpoch(){return this.epoch}buildIdentity(e){if(e===null)return null;let t=Ul(`${this.mintScope}|${e.userRef}`,e.getToken),r=createIdentityProvider(e.userRef,t,e=>this.armTokenRefresh(r,e),()=>{r===this.identity&&this.emit({type:"session_expired",userRef:e.userRef})});return r}armTokenRefresh(e,t){if(this.clearTokenRefresh(),t===null||this.disposed||e!==this.identity)return;let r=t-Date.now();if(r<=0)return;let n=Math.max(r-nc,r/2);this.refreshTimer=setTimeout(()=>{this.refreshTimer=null,!(this.disposed||e!==this.identity)&&e.currentToken({forceRefresh:true}).catch(()=>{})},n),this.refreshTimer.unref?.()}emit(e){let t=this.onEvent;if(t===void 0)return;let r=()=>{this.disposed||zl(t,e)};typeof queueMicrotask=="function"?queueMicrotask(r):Promise.resolve().then(r)}clearTokenRefresh(){this.refreshTimer!==null&&clearTimeout(this.refreshTimer),this.refreshTimer=null}buildPoller(e){return createEntitlementPoller({authFor:()=>this.buildAuth(this.currentUser?.userRef??null),update:(e,t,r,n)=>{this.verdictLanded=true;let l=this.store.getSnapshot().branding??null,i=l!==null&&t!=null&&Nu(l)===Nu(t)?l:t;this.updateEntitlements({decisions:e,isPending:false,branding:i,...r===false?{livemode:r}:{},...n!==void 0?{smsProfilePublic:n}:{}}),this.brandingCache?.persist(i??null)},onFetch:()=>{this.verdictSettled||this.store.setPending(true)},onSettled:()=>{this.verdictSettled=true,this.store.setPending(false)},telemetry:this.telemetry,...e?{scheduler:e}:{}})}acquireInternal(e,t,r,n,l=false){let i=`${this.epoch}|${e}|${t}`,o=this.entries.get(i);if(o)return l||(o.warm?o.warm=false:o.refCount+=1),o.controller;let a=r();return this.entries.set(i,{controller:a,refCount:1,warm:l}),this.destroyers.set(a,n),a}releaseInternal(e){for(let[t,r]of this.entries)if(r.controller===e){r.refCount-=1,r.refCount<=0&&(this.runDestroyer(e),this.entries.delete(t));return}}runDestroyer(e){let t=this.destroyers.get(e);this.destroyers.delete(e),t&&t(e)}buildChatController(e){let t=createChatController({auth:this.buildAuth(e.userRef),telemetry:this.telemetry,...this.errorPolicy?{errorPolicy:Qu(this.errorPolicy,this.errorContext,"chat")}:{},initialConversationId:e.conversationId,petRef:e.petRef,onConversationStarted:e=>this.emit({type:"conversation_started",conversationId:e}),unread:this.unread});return this.runBootstrap(t,e),t}runBootstrap(e,t){let r={};t.petRef!==null&&(r.petRef=t.petRef),t.conversationId!==null&&(r.resumeConversationId=t.conversationId);let n=bootstrapChat(r,{controller:e});return n.then(t=>e.adoptPrompts(t.suggestedPrompts)).catch(()=>{}),this.bootstraps.set(e,n),n}buildAuth(e){return this.identity!==null&&this.currentUser!==null?{mode:"personalized",transport:this.transport,identity:this.identity,userRef:this.currentUser.userRef,sessionId:this.sessionId}:{mode:"anonymous",transport:this.transport,publishableKey:this.publishableKey,userRef:this.currentUser===null?null:e,sessionId:this.sessionId,anonIdentity:this.anonIdentity??=createAnonIdentityProvider(this.transport,this.publishableKey,this.sessionId)}}setUser(e){if(this.disposed)return;let t=e?.userRef??null,r=this.currentUser?.userRef??null;if(t===r){this.currentUser=e,e&&this.identity===null&&(this.identity=this.buildIdentity(e));return}this.pendingBeforeLogout=this.beforeLogoutSettlement(),this.identity?.clear(),this.clearTokenRefresh(),this.currentUser=e,this.identity=this.buildIdentity(e),this.rescopeAll()}async logout(){if(this.disposed)return;let e=this.currentUser===null;this.leavingSessionId=this.sessionId,this.sessionId=newSessionId(),this.anonIdentity=null,this.setUser(null),this.leavingSessionId=null,e&&this.rescopeAll();let t=this.pendingBeforeLogout;this.pendingBeforeLogout=null,t!==null&&await t,await Pu(this.kv,this.telemetry)}onBeforeLogout(e){return this.disposed?()=>{}:(this.beforeLogoutHooks.add(e),()=>{this.beforeLogoutHooks.delete(e)})}beforeLogoutSettlement(){let e=this.currentUser,t=this.identity;return Tu({leaving:e,identity:t,hooks:this.beforeLogoutHooks,telemetry:this.telemetry,graceAuth:()=>Ou({leaving:e,identity:t,transport:this.transport,sessionId:this.leavingSessionId??this.sessionId})})}async registerPet(e,t){return this.withPets("registerPet",(r,n)=>Al(Ml(this,n,e,t),()=>t===void 0?r.registerPet(e):r.registerPet(e,t)))}updatePet(e,t){return this.withPets("updatePet",r=>r.updatePet(e,t))}deletePet(e){return this.withPets("deletePet",t=>t.deletePet(e))}eraseUserData(){return this.withPets("eraseUserData",e=>e.eraseUserData())}async withPets(e,t){if(this.disposed)return err(ac(e));let r=this.buildAuth(this.currentUser?.userRef??null),n=await t(createPetsRepository(r),r);return n.ok&&!this.disposed&&Nl(this),n}prepare(e){let t=e?.petRef??null,r=`${this.epoch}|${this.currentUser?.userRef??""}|${t??""}`,n=this.prepared;if(n!==null&&n.key===r&&(n.result===null||n.result.status==="ready"))return n.promise;let l={key:r,result:null,promise:this.runPrepare(t).then(e=>(l.result=e,e))};return this.prepared=l,l.promise}async runPrepare(e){let t=Date.now(),r=this.configFailure,n=this.disposed?ac("prepare"):r===null?null:Vu(r),l=this.identity,[i,o,a]=await Promise.all([n?err(n):l===null?ok(void 0):l.currentToken().then(()=>ok(void 0),e=>(l.reportRejected?.(),err($(e)))),n?err(n):this.primeEntitlements(),e===null?void 0:n?err(n):this.primeChat(e)]),s=i.ok?o.ok&&(a?.ok??true)?"ready":"partial":"failed",u=Date.now()-t;try{this.telemetry.track("sdk.prepare.timing",{durationMs:u,status:s})}catch{}if(s==="ready")this.emit({type:"ready"});else if(s==="failed"&&!i.ok&&r===null&&!this.disposed){let e=i.error.requestId??null;this.emit({type:"error",code:i.error.code,requestId:e,context:be(this.errorContext,"runtime",e)})}/* @__PURE__ */
48
48
  return Object.freeze({status:s,durationMs:u,session:i,entitlements:o,...a?{chat:a}:{}})}async primeEntitlements(){let e=await(this.poller?.prime());return e?e.kind==="failed"?err(e.error):ok(void 0):err(makeEverfurError("internalError",{retryable:true}))}async primeChat(e){let t={userRef:this.currentUser?.userRef??null,petRef:e,conversationId:null},r=this.acquireInternal("chat",ic(t),()=>this.buildChatController(t),oc,true),n=await this.bootstraps.get(r);return n?.cause&&r.getSnapshot().conversationId===null&&(n=await this.runBootstrap(r,t)),n?.cause?err(n.cause):ok(void 0)}setActivePet(e){if(this.disposed)return;let t=e??null;t!==this.activePet&&(this.activePet=t,this.rescopeAll({keepBranding:true}))}updateEntitlements(e){this.disposed||this.configFailure===null&&this.store.set(e)}open(e){this.telemetry.track("sdk.open",{capability:e})}dispose(){this.disposed||(this.disposed=true,this.epoch+=1,this.poller?.stop(),this.sdkConfigHost!==void 0&&(this.sdkConfigHost.disposed=true,this.sdkConfigHost.store?.dispose(),this.sdkConfigHost.store=null,this.sdkConfigHost.branding.set(null)),this.identity?.clear(),this.clearTokenRefresh(),this.disposeAllControllers())}rescopeAll(e){this.epoch+=1,this.disposeAllControllers(),this.unread.reset(),this.store.reset(e),this.verdictSettled=false,this.poller?.refresh()}disposeAllControllers(){for(let e of this.entries.values())this.runDestroyer(e.controller);this.entries.clear(),this.destroyers.clear()}};function ic(e){return`${e.userRef??""}|${e.petRef??""}|${e.conversationId??""}`}function oc(e){e.dispose()}function ac(e){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${e} was called after unmount`})}function sc(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function uc(e){return e.code!=="conversationNotFound"?e:makeEverfurError("resourceNotFound",{retryable:false,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},...e.requestId===void 0?{}:{requestId:e.requestId},...e.reasonCode===void 0?{}:{reasonCode:e.reasonCode},...e.wireMessage===void 0?{}:{wireMessage:e.wireMessage},...e.raw===void 0?{}:{raw:e.raw}})}function cc(e){return e.ok?e:err(uc(e.error))}function dc(e){return{send:async(...t)=>cc(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,r,n)=>e.stream(t,r,n)}}var fc=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),pc=globalThis,hc=pc[fc]??(pc[fc]=e.createContext(null));hc.displayName??="EverfurContext";function gc(){let t=e.useContext(hc);if(t===null)throw new s("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}function useEverfur(){return gc().handle}var mc=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),bc=globalThis,yc=bc[mc]??(bc[mc]=e.createContext(no));yc.displayName??="EverfurThemeContext";function useEverfurTheme(){return e.useContext(yc)}var vc=()=>()=>{},xc=()=>null;function kc(t,r){return e.useSyncExternalStore(r?.subscribe??vc,r?.get??xc,r?.get??xc)??t}function EverfurThemeProviderCore(t){let{runtime:r}=gc(),n=r.entitlements,l=e.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),i=t.seams.useColorScheme(),o=t.seams.useReducedMotion(),a=t.seams.useTextScale(),s=t.seams.useHighContrast(),u=t.seams.scaleTypeSizes,c=t.seams.typeProfile,d=t.seams.platformMonoFamily?.(),f=t.seams.isFontRegistered,p=t.clientTheme?wc(t.clientTheme):"",h=e.useMemo(()=>t.clientTheme?parseClientBranding(t.clientTheme):null,[p]),g=kc(l.branding??null,r.sdkConfigHost?.branding),m=e.useMemo(()=>resolveTheme({branding:g,clientOverride:h,colorScheme:i,reducedMotion:o,textScale:a,scaleTypeSizes:u,highContrast:s,...c===void 0?{}:{typeProfile:c},...d===void 0?{}:{platformMonoFamily:d},...f===void 0?{}:{isFontRegistered:f}}),[g,h,i,o,a,u,c,s,d,f]);t.seams.useResolvedTheme?.(m);let b=t.seams.isDevelopment;return e.useEffect(()=>{b===void 0||!Cc(b)||Eo(themeAdjustments({branding:g,clientOverride:h,colorScheme:i}))},[b,g,h,i]),e.createElement(yc.Provider,{value:m},t.children)}function wc(e){try{return JSON.stringify(e)}catch{return Object.keys(e).join("&")}}function Cc(e){try{return e()===!0}catch{return false}}function EverfurProviderCore(t){let{config:r,user:n,activePet:l,theme:i,warmUp:o,children:a,seams:s}=t,u=`${r?.publishableKey??""}|${r?.apiBaseUrl??""}|${r?.contractVersion??""}`,c=e.useRef(null),d=e.useRef(null),f=e.useRef(r?.onEvent);f.current=r?.onEvent;let p=e.useRef(e=>{f.current?.(e)}),[h,g]=e.useReducer(e=>e+1,0),m=e.useRef(null),b=e.useRef(void 0),y=n?.userRef??null;b.current!==y&&(b.current!==void 0&&(m.current=null),b.current=y);let v=m.current!==null?m.current.user:n??null,x=e.useRef(null),k=e.useRef(void 0),w=l??null;k.current!==w&&(k.current!==void 0&&(x.current=null),k.current=w);let C=x.current!==null?x.current.pet:l??null;(c.current===null||c.current.key!==u||c.current.runtime.isDisposed)&&(c.current!==null&&!c.current.runtime.isDisposed&&(d.current=c.current.runtime),c.current={key:u,runtime:createEverfurRuntime({config:Sc(s.withDefaults?s.withDefaults(r):r,p.current),user:v,activePet:C,theme:i??null},{platform:s.platform,...s.eventSourceFactory?{eventSourceFactory:s.eventSourceFactory}:{}})});let S=c.current.runtime,j=e.useRef(null);e.useEffect(()=>{let e=c.current?.runtime;e===void 0||!e.isDisposed||j.current!==e&&(j.current=e,g())}),e.useEffect(()=>{let e=d.current;e!==null&&(d.current=null,e.dispose())});let _=v?.userRef??null;e.useLayoutEffect(()=>{S.setUser(v)},[S,_]),e.useLayoutEffect(()=>{S.setActivePet(C)},[S,C]);let R=e.useRef(null);e.useEffect(()=>(R.current===S&&(R.current=null),()=>{R.current=S,jc(()=>{R.current===S&&(R.current=null,S.dispose())})}),[S]),e.useEffect(()=>{o==="onMount"&&S.prepare(C===null?{}:{petRef:C})},[S,o,_,C]);let E=e.useMemo(()=>({setUser:e=>{m.current={user:e},S.setUser(e),g()},setActivePet:e=>{x.current={pet:e},S.setActivePet(e),g()},open:e=>S.open(e),prepare:e=>S.prepare(e),registerPet:(e,t)=>S.registerPet(e,t),updatePet:(e,t)=>S.updatePet(e,t),deletePet:e=>S.deletePet(e),eraseUserData:()=>S.eraseUserData(),logout:()=>{m.current={user:null};let e=S.logout();return g(),e}}),[S,g]),I=e.useMemo(()=>({runtime:S,handle:E,userRef:_,activePet:C,scopeEpoch:S.scopeEpoch,publishableKey:_c(r)}),[S,E,_,C,h,u]),z=e.createElement(EverfurThemeProviderCore,{clientTheme:i??null,seams:s.theme,children:a});return e.createElement(hc.Provider,{value:I},s.wrap?s.wrap(z):z)}function Sc(e,t){return typeof e!="object"||e===null?e:{...e,onEvent:t}}function jc(e){if(typeof queueMicrotask=="function"){queueMicrotask(e);return}Promise.resolve().then(e)}function _c(e){return typeof e?.publishableKey=="string"?e.publishableKey.trim():""}var Rc="everfur:";function Ec(){try{if(typeof window>"u")return null;let e=window.localStorage;return e&&typeof e.getItem=="function"?e:null}catch{return null}}function createLocalStorageKv(){return{async getItem(e){try{return Ec()?.getItem(Rc+e)??null}catch{return null}},async setItem(e,t){try{Ec()?.setItem(Rc+e,t)}catch{}},async removeItem(e){try{Ec()?.removeItem(Rc+e)}catch{}},async keys(e){try{let t=Ec();if(t===null)return[];let r=[],n=Rc+e;for(let e=0;e<t.length;e+=1){let l=t.key(e);l!==null&&l.startsWith(n)&&r.push(l.slice(Rc.length))}/* @__PURE__ */
49
- return Object.freeze(r)}catch{return[]}}}}var Ic="https://sdk.everfur.com",zc=/* @__PURE__ */Object.freeze({k1:"X4wc1hwVONs4I9Vmclo9ExrfPZlH8-tgY7NmzxuA5lI"}),Tc=/* @__PURE__ */Object.freeze(["health-plan","health-plan-today","shop","shop-orders-v2","ui","televet-booking","televet-call"]),Oc=/* @__PURE__ */Object.freeze({"@everfur/sdk/web/health-plan":"health-plan","@everfur/sdk/web/health-plan/today":"health-plan-today","@everfur/sdk/web/shop":"shop","@everfur/sdk/web/shop/orders-v2":"shop-orders-v2","@everfur/sdk/web/ui":"ui","@everfur/sdk/web/televet/booking":"televet-booking","@everfur/sdk/web/televet/call":"televet-call"}),Pc=1794913535e3,Fc=3e3,Mc=8e3,Ac=256*1024,$c=4*1024*1024,Dc="web_runtime.fallback";var Bc=/* @__PURE__ */Symbol.for(`@everfur/sdk#WebRuntimeBridge@v${1}`);function Nc(){let e=globalThis,t=e[Bc];if(t!==void 0)return t;let r={major:1,host:null,defined:/* @__PURE__ */new Map,waiters:/* @__PURE__ */new Map,importSubpath:null};return e[Bc]=r,r}function Lc(e){if(typeof e!="string")return null;let t=/^(\d+)\./.exec(e);return t===null?null:Number(t[1])}function Uc(e){let t=Lc(e.React?.version);if(t===null||typeof e.React.createElement!="function")return null;let r=Nc();return r.host===null?(r.host={...e,reactMajor:t},{reactMajor:t}):r.host.React.createElement===e.React.createElement&&r.host.reactMajor===t?{reactMajor:t}:null}function Hc(){return Nc().host}var Wc=(e,t)=>`${e}@${t}`;function qc(e,t){return Nc().defined.get(Wc(e,t))??null}function Vc(e,t,r){let n=Nc(),l=n.ran??=/* @__PURE__ */new Map,i=Wc(e,t),o=l.get(i);return o===void 0?n.defined.has(i)?false:(l.set(i,r),true):o===r}function Kc(e,t,r){let n=qc(e,t);if(n!==null)return Promise.resolve(n);let l=Nc(),i=Wc(e,t);return new Promise(e=>{let t=l.waiters.get(i)??/* @__PURE__ */new Set;l.waiters.set(i,t);let n=r=>{clearTimeout(a),t.delete(o),e(r)},o=e=>n(e),a=setTimeout(()=>n(null),r);t.add(o)})}function Gc(e){Nc().importSubpath=e}function Yc(e,t){let r=Object.keys(t).sort().map(e=>`${e}=${t[e]}`).join(",");return`v${1}|${e}|${r}`}var Qc=Yc(ke,zc);var Zc=/* @__PURE__ */Symbol.for(`@everfur/sdk#WebRuntimeBundledOnly@v${1}`),Xc=globalThis,Jc=()=>Xc[Zc]===true,ed=()=>{Xc[Zc]=true};var td=/^\d{1,4}\.\d{1,5}\.\d{1,6}(?:-[0-9A-Za-z.-]{1,64})?$/,rd=/^[a-z0-9][a-z0-9.-]{0,80}\.js$/,nd=/^sha384-[A-Za-z0-9+/]{64}$/,ld=/^[0-9a-f]{32}$/,id=/^[A-Za-z0-9_-]+$/,od=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ad(e){if(typeof e!="string"||e.length===0||!id.test(e))return null;let t=e.replace(/-/g,"+").replace(/_/g,"/");try{let e=atob(t+"=".repeat((4-t.length%4)%4)),r=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)r[t]=e.charCodeAt(t);return r}catch{return null}}var sd=/^\d{4}(-\d\d){2}T\d\d(:\d\d){2}(\.\d{1,3})?Z$/,ud=14*864e5;function cd(e){if(typeof e!="string"||!sd.test(e))return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function dd(e){if(!od(e)||!Array.isArray(e.react)||!od(e.parts))return null;let t=e.react.filter(e=>Number.isInteger(e)&&e>0);if(t.length===0||t.length!==e.react.length)return null;let r={};for(let[t,n]of Object.entries(e.parts))if(Tc.includes(t)){if(!od(n)||typeof n.path!="string"||typeof n.integrity!="string"||!rd.test(n.path)||!nd.test(n.integrity))return null;r[t]={path:n.path,integrity:n.integrity}}return{react:t,parts:r}}function fd(e){if(!od(e)||e.schema!==1||!Number.isInteger(e.major))return null;let t=cd(e.issuedAt),r=cd(e.expiresAt);if(t===null||r===null||typeof e.stable!="string"||!td.test(e.stable)||r<=t||r-t>ud||!od(e.versions))return null;let n={};for(let[t,r]of Object.entries(e.versions)){let e=dd(r);if(!td.test(t)||e===null)return null;n[t]=e}let l=null;if(e.canary!==void 0&&e.canary!==null){let t=e.canary;if(!od(t)||typeof t.version!="string"||!td.test(t.version)||typeof t.percent!="number"||!Number.isFinite(t.percent)||t.percent<0||t.percent>100)return null;l={version:t.version,percent:t.percent}}let i={};if(e.pins!==void 0){if(!od(e.pins))return null;for(let[t,r]of Object.entries(e.pins)){if(!ld.test(t)||typeof r!="string"||!td.test(r))return null;i[t]=r}}let o=[];if(e.revoked!==void 0){if(!Array.isArray(e.revoked)||!e.revoked.every(e=>typeof e=="string"&&td.test(e)))return null;o=e.revoked}return{schema:1,major:e.major,issuedAt:t,expiresAt:r,stable:e.stable,canary:l,pins:i,revoked:o,versions:n}}async function pd(e,t,r,n,l=Pc){if(!od(e)||e.v!==1||typeof e.keyId!="string")return{ok:false,reason:"manifest-shape"};let i=ad(e.payload),o=ad(e.signature);if(i===null||o===null||o.length!==64)return{ok:false,reason:"manifest-shape"};let a=Object.prototype.hasOwnProperty.call(t,e.keyId)?ad(t[e.keyId]):null;if(a===null||a.length!==32)return{ok:false,reason:"signature-key"};let s;try{let e=await r.subtle.importKey("raw",a,{name:"Ed25519"},!1,["verify"]);s=await r.subtle.verify({name:"Ed25519"},e,o,i)}catch{return{ok:false,reason:"signature-unsupported"}}if(!s)return{ok:false,reason:"signature-invalid"};let u;try{u=JSON.parse((new TextDecoder).decode(i))}catch{return{ok:false,reason:"manifest-shape"}}let c=fd(u);return c===null?{ok:false,reason:"manifest-shape"}:c.major!==1?{ok:false,reason:"manifest-major"}:n>=c.expiresAt?{ok:false,reason:"manifest-expired"}:c.issuedAt<l?{ok:false,reason:"manifest-stale"}:{ok:true,manifest:c}}function hd(e,t){let[r="",n]=e.split(/-(.*)/s,2),[l="",i]=t.split(/-(.*)/s,2),o=r.split(".").map(Number),a=l.split(".").map(Number);for(let e=0;e<3;e+=1){let t=(o[e]??0)-(a[e]??0);if(t!==0)return t<0?-1:1}if(n===i)return 0;if(n===void 0)return 1;if(i===void 0)return-1;let s=n.split("."),u=i.split(".");for(let e=0;;e+=1){let t=s[e],r=u[e];if(t===r)continue;if(t===void 0||r===void 0)return t===void 0?-1:1;let n=/^\d+$/.test(t),l=/^\d+$/.test(r);return n!==l?n?-1:1:(n?Number(t)<Number(r):t<r)?-1:1}}function gd(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t>>>0}function md(e,t){return gd(`${e??"-"}:${t}`)%100}async function bd(e,t){try{let r=await t.subtle.digest("SHA-256",(new TextEncoder).encode(e));return Array.from(new Uint8Array(r),e=>e.toString(16).padStart(2,"0")).join("").slice(0,32)}catch{return null}}function yd(e,t){let r=t.tenantKey===null?void 0:e.pins[t.tenantKey],n,l;if(r!==void 0?(n=r,l="pin"):e.canary!==null&&md(t.tenantKey,t.sessionBucket)<e.canary.percent?(n=e.canary.version,l="canary"):(n=e.stable,l="stable"),e.revoked.includes(n))return{use:"bundled",reason:"revoked"};if(l!=="pin"&&hd(n,t.bundledVersion)<0&&!e.revoked.includes(t.bundledVersion))return{use:"bundled",reason:"bundled-newer"};let i=e.versions[n];return i===void 0?{use:"bundled",reason:"version-missing"}:{use:"remote",version:n,entry:i,reason:l}}var vd=/^manifest-(fetch|timeout)$/,xd="everfur:web-runtime:unreachable",kd=10*6e4;function wd(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}async function Cd(e,t,r,n,l="default"){let i=typeof AbortController=="function"?new AbortController:null,o=null,a=()=>{},s=new Promise(e=>{a=e}),u=setTimeout(()=>{a("timeout"),i?.abort(),o?.()},r),c=e=>Promise.race([e,s]);try{let r=await c(e(t,{mode:"cors",credentials:"omit",referrerPolicy:"no-referrer",redirect:"error",cache:l,...i?{signal:i.signal}:{}}));if(r==="timeout")return{ok:!1,why:"timeout"};if(!r.ok)return{ok:!1,why:"http"};let a=Number(r.headers.get("content-length")??Number.NaN),s=r.body?.getReader()??null;if(o=()=>{s!==null&&s.cancel().catch(()=>{})},Number.isFinite(a)&&a>n)return o(),{ok:!1,why:"too-large"};if(s===null){let e=await c(r.arrayBuffer());return e==="timeout"?{ok:!1,why:"timeout"}:e.byteLength>n?{ok:!1,why:"too-large"}:{ok:!0,bytes:new Uint8Array(e)}}let u=[],d=0;for(;;){let e=await c(s.read());if(e==="timeout")return{ok:!1,why:"timeout"};if(e.done)break;if(d+=e.value.byteLength,d>n)return o(),{ok:!1,why:"too-large"};u.push(e.value)}let f=new Uint8Array(d),p=0;for(let e of u)f.set(e,p),p+=e.byteLength;return{ok:!0,bytes:f}}catch{return{ok:false,why:i?.signal.aborted?"timeout":"error"}}finally{clearTimeout(u)}}function Sd(e){let t=e.hasDom&&Object.keys(e.keys).length>0&&e.fetch!==null&&e.crypto!==null,r=e.manifestTimeoutMs??Fc,n=e.partTimeoutMs??Mc,l=e.manifestMaxBytes??Ac,i=e.partMaxBytes??$c,o=`${e.origin}/web-runtime`,a=null,s=/* @__PURE__ */new Map,u=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,f=null,p=null;async function h(){let t=await Cd(e.fetch,`${o}/${1}/manifest.json`,r,l,"no-store");if(!t.ok){let r=t.why==="timeout"?"manifest-timeout":t.why==="too-large"?"manifest-too-large":"manifest-fetch";if(t.why==="error"||t.why==="timeout")try{e.unreachable?.()?.setItem(xd,`${e.now()+kd}|${r}`)}catch{}return{ok:false,reason:r}}let n;try{n=JSON.parse((new TextDecoder).decode(t.bytes))}catch{return{ok:false,reason:"manifest-shape"}}return pd(n,e.keys,e.crypto,e.now(),e.minIssuedAt??Pc)}function g(t){let r=t??"",n=s.get(r);if(n)return n;let l=(async()=>{a??=h();let r=await a;if(!r.ok)return{ok:false,reason:r.reason};let n=t===null?null:await bd(t,e.crypto),l=yd(r.manifest,{tenantKey:n,sessionBucket:e.sessionBucket(),bundledVersion:e.bundledVersion});return l.use==="remote"?{ok:true,choice:l}:{ok:false,reason:l.reason}})();return s.set(r,l),l}async function m(t,r){if(await Promise.resolve(),Jc())return{ok:false,reason:"disabled",version:null};let l=Hc();if(l===null)return{ok:false,reason:"react-unregistered",version:null};let a=await g(r);if(!a.ok)return{ok:false,reason:a.reason,version:null};let{version:s,entry:u}=a.choice;if(!u.react.includes(l.reactMajor))return{ok:false,reason:"react-mismatch",version:s};let c=u.parts[t];if(c===void 0)return{ok:false,reason:"part-missing",version:s};if(!Vc(t,s,c.integrity))return{ok:false,reason:"part-integrity",version:s};let d=qc(t,s);if(d!==null)return{ok:true,namespace:d,version:s};let f=`${o}/${s}/${c.path}`;if(Jc())return{ok:false,reason:"disabled",version:s};let h=await Cd(e.fetch,f,n,i);if(!h.ok)return{ok:false,reason:h.why==="timeout"?"part-timeout":h.why==="too-large"?"part-too-large":"part-fetch",version:s};let m=h.bytes,b;try{b=`sha384-${wd(new Uint8Array(await e.crypto.subtle.digest("SHA-384",m)))}`}catch{return{ok:false,reason:"part-integrity",version:s}}if(b!==c.integrity)return{ok:false,reason:"part-integrity",version:s};if(Jc())return{ok:false,reason:"disabled",version:s};let y=e.createBlobUrl?.(m)??null,v="error";if(y!==null&&(v=await e.runScript(y,c.integrity,"blob",p),e.revokeBlobUrl(y)),v==="error"&&(v=await e.runScript(f,c.integrity,"cdn",p)),v==="error")return{ok:false,reason:"part-load",version:s};let x=await Kc(t,s,50);return x===null?{ok:false,reason:"part-load",version:s}:{ok:true,namespace:x,version:s}}let b=t?null:e.hasDom?"disabled":"server";try{let[t,r]=(e.unreachable?.()?.getItem(xd)??"").split("|");Number(t)>e.now()&&vd.test(String(r))&&(b??=r)}catch{}function y(e,t){if(b!==null)return Promise.resolve({ok:false,reason:b,version:null});f??=t;let r=`${t??""}|${e}`,n=u.get(r);if(n)return n;let l=m(e,t).then(e=>e,()=>({ok:false,reason:"part-load",version:null}));return l.then(e=>c.set(r,e)),u.set(r,l),l}return t&&Gc(e=>{let t=Object.prototype.hasOwnProperty.call(Oc,e)?Oc[e]:void 0,r=()=>{let t=d.get(e);return t?t():Promise.reject(new TypeError(`${e} is not available to the Everfur web runtime`))};return t===void 0?r():y(t,f).then(e=>e.ok?e.namespace:r())}),{enabled:t,peek:(e,t)=>b!==null?{ok:false,reason:b,version:null}:c.get(`${t??""}|${e}`)??null,load:y,registerHostSubpaths:e=>{for(let[t,r]of Object.entries(e))d.has(t)||d.set(t,r)},setCspNonce:e=>{p=e===null||e===""?null:e}}}var jd="everfur:web-runtime:bucket",_d=null;function Rd(){try{let e=globalThis.sessionStorage?.getItem(jd);if(e)return e}catch{}_d??=Math.floor(Math.random()*4294967296).toString(16);try{globalThis.sessionStorage?.setItem(jd,_d)}catch{}return _d}function Ed(e){return(t,r,n,l)=>new Promise(i=>{let o;try{o=e.createElement("script"),o.type="module",n==="cdn"&&(o.integrity=r,o.crossOrigin="anonymous"),l!==null&&(o.nonce=l),o.addEventListener("load",()=>{o.remove(),i("load")}),o.addEventListener("error",()=>{o.remove(),i("error")}),o.src=t,(e.head??e.documentElement).appendChild(o)}catch{i("error")}})}function Id(){let e=typeof document>"u"?null:document,t=globalThis.crypto;return{origin:Ic,keys:zc,bundledVersion:ke,fetch:typeof fetch=="function"?fetch.bind(globalThis):null,crypto:t?.subtle?t:null,hasDom:e!==null&&typeof window<"u",runScript:e===null?()=>Promise.resolve("error"):Ed(e),createBlobUrl:typeof Blob=="function"&&typeof URL.createObjectURL=="function"?e=>{try{return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch{return null}}:null,revokeBlobUrl:e=>{try{URL.revokeObjectURL(e)}catch{}},now:()=>Date.now(),sessionBucket:Rd,unreachable:()=>globalThis.sessionStorage}}var zd=/* @__PURE__ */Symbol.for(`@everfur/sdk#WebRuntimeLoader@${Qc}`);function Td(){let e=globalThis;return e[zd]??=Sd(Id())}var Od=/* @__PURE__ */new Set(["disabled","server","bundled-newer"]),Pd=/* @__PURE__ */new Set;function Fd(e,t,r,n){if(Od.has(r))return;let l=`${t}|${r}`;if(!Pd.has(l)){Pd.add(l);try{e?.trackExpectedFailure(Dc,{part:t,reason:r,version:n,bundled:ke})}catch{}}}var Md=/* @__PURE__ */new Set,Ad=class extends e.Component{constructor(){super(...arguments);this.state={failed:false}}static getDerivedStateFromError(){return{failed:true}}componentDidCatch(){this.props.onError()}render(){return this.state.failed?this.props.fallback():this.props.children}},$d=/* @__PURE__ */new Map;function Dd(t,r,n){let l=`${r??""}|${t.part}|${t.name}`,i=$d.get(l);return i===void 0&&(i=e.lazy(async()=>{let e=await Td().load(t.part,r),l=e.ok?e.namespace[t.name]:void 0;return e.ok&&typeof l!="function"&&(typeof l!="object"||l===null)?(Fd(n.current,t.part,"part-missing",e.version),{default:t.bundled}):(e.ok||Fd(n.current,t.part,e.reason,e.version),{default:e.ok?l:t.bundled})}),$d.set(l,i)),i}var Bd=()=>()=>{},Nd=()=>false,Ld=()=>true;function RuntimeSurface({spec:t,props:r}){let n=e.useContext(hc),l=Jc(),a=n?.publishableKey?n.publishableKey:null,s=e.useRef(null);s.current=n?.runtime.registry?.services?.telemetry??null;let u=e.useSyncExternalStore(Bd,Nd,Ld),c=e.useRef(null),[,d]=e.useState(0),f=l?null:Td();if(t.hostSubpaths!==void 0&&f?.enabled&&f.registerHostSubpaths(t.hostSubpaths),u)c.current=t.wait==="bundled"&&f!==null?"hydrate":"bundled";else if(c.current===null)if(!f?.enabled||Md.has(t.part))c.current="bundled";else if(Uc({React:i,ReactDOM:o})===null)Fd(s.current,t.part,"react-mismatch",null),c.current="bundled";else{let e=f.peek(t.part,a);c.current=e===null?"suspense":e.ok?"direct":"bundled"}let p=c.current,h=u||p!=="hydrate"?null:f?.peek(t.part,a)??null,g=!u&&p==="hydrate"&&h===null&&f?.enabled===true&&!Md.has(t.part);e.useEffect(()=>{if(!g||f===null)return;if(Uc({React:i,ReactDOM:o})===null){Fd(s.current,t.part,"react-mismatch",null);return}let e=true;return f.load(t.part,a).then(r=>{r.ok||Fd(s.current,t.part,r.reason,r.version),e&&d(e=>e+1)}),()=>{e=false}},[g,f,t.part,a]);let m=()=>e.createElement(t.bundled,r),b=r=>e.createElement(Ad,{fallback:m,onError:()=>{Md.add(t.part),Fd(s.current,t.part,"render",null)},children:r});if(u||p==="bundled")return m();if(p==="hydrate"||p==="direct"){let n=h??f?.peek(t.part,a),l=n?.ok?n.namespace[t.name]:void 0;return l===void 0||Md.has(t.part)?m():b(e.createElement(l,r))}let y=Dd(t,a,s),v=t.wait==="bundled"?m():e.createElement("div",{"data-everfur-runtime":"loading","aria-busy":true});return b(e.createElement(e.Suspense,{fallback:v},e.createElement(y,r)))}var Ud=/* @__PURE__ */Symbol.for(`@everfur/sdk#WebRuntimeRenderer@${Qc}`),Hd=globalThis;function Wd(e,t=false){e===null?delete Hd[Ud]:(t||Hd[Ud]===void 0)&&(Hd[Ud]=e)}var qd=RuntimeSurface,Vd=(t,r)=>e.createElement(qd,{spec:t,props:r});function Kd(e){if(Wd(Vd),e!==void 0&&e!==""){let t=Td();t.enabled&&t.setCspNonce(e)}}var Gd=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Gd[t]]}}function Yd(e,t){let{scale:r,scaleCaps:n}=e.type,l=n[t];return l>0?Math.min(r,l):r}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type;if(r===null&&n===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:n??e.type.weight[Gd[t]]};let l=face(e,t);return l.fontWeight===void 0||n===null?l:{fontFamily:l.fontFamily,fontWeight:n}}function Qd(){try{return process.env.NODE_ENV!=="production"}catch{return false}}var Zd=/* @__PURE__ */new Map,Xd=/* @__PURE__ */new Set,Jd=typeof document>"u"?e.useEffect:e.useLayoutEffect;function ef(e){return e.cssSrc!==void 0?`css\n${e.cssSrc}`:`file\n${e.family}\n${e.src??""}\n${e.weight??"400"}\n${e.style??"normal"}`}function tf(e,t){if(!t)return;let r=e.cssSrc??e.src??"",n=`[everfur] A font in appearance.fonts did not load: "${e.family}" from ${r}. The text renders in the fallback font. If your page sets a Content-Security-Policy, allow this host in font-src`+(e.cssSrc!==void 0?" and style-src (and the font files the stylesheet names in font-src).":".");if(!Xd.has(n)){Xd.add(n);try{globalThis.console?.warn?.(n)}catch{}}}function rf(e){let t=document.getElementsByTagName("link");for(let r=0;r<t.length;r+=1){let n=t[r];if(n.rel==="stylesheet"&&n.getAttribute("href")===e)return n}return null}function nf(e){return rf(e)!==null?Promise.resolve(true):new Promise(t=>{let r=document.createElement("link");r.rel="stylesheet",r.href=e,r.setAttribute("data-everfur-font",""),r.addEventListener("load",()=>t(true)),r.addEventListener("error",()=>t(false)),document.head.appendChild(r)})}function lf(e){let t=document.fonts;return new FontFace(e.family,`url("${e.src}")`,{display:"swap",weight:e.weight??"400",style:e.style??"normal"}).load().then(e=>(t.add(e),true)).catch(()=>false)}function of(e,t=false){let r=ef(e),n=Zd.get(r);if(n===void 0){n=Promise.resolve(false);try{if(typeof document<"u"){let t=e.cssSrc===void 0?null:La(e.cssSrc),r=e.src===void 0?null:La(e.src);t!==null?n=nf(t):r!==null&&(n=lf({...e,src:r}))}}catch{n=Promise.resolve(false)}let l=n.then(r=>(r||tf(e,t),r));Zd.set(r,l),n=l}return n}function af(e,t){let r=e.type.fontSources;Jd(()=>{if(r.length===0)return;let e=false;try{e=t()}catch{}for(let t of r)of(t,e)},[r,t])}var sf=/* @__PURE__ */new RegExp(`^${Sa}\\/fonts\\/[\\w./-]+\\.woff2$`);function uf(e){return sf.test(e)&&!e.includes("..")}var cf=/* @__PURE__ */new Map;function df(e,t,r="400"){let n=e.trim(),l=`${n}\n${t}\n${r}`,i=cf.get(l);if(i===void 0){if(i=Promise.resolve(false),t!==null&&n!==""&&n!=="System"&&uf(t))try{let e=document.fonts;i=new FontFace(n,`url("${t}") format("woff2")`,{display:"swap",weight:r}).load().then(t=>(e.add(t),!0)).catch(()=>!1)}catch{}cf.set(l,i)}return i}var ff=["regular","medium","bold","mono","monoMedium","monoBold"];function pf(t){let{families:r,fontUrls:n,weight:l,namedFaces:i}=t.type;e.useEffect(()=>{for(let e of ff){let t=n[e];t!=null&&df(r[e],t,i[e]?l.regular:l[Gd[e]])}},[r,n,l,i]),af(t,Qd)}function hf(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function gf(e){return t=>{let r=hf(e);return r===null||typeof r.addEventListener!="function"?()=>{}:(r.addEventListener("change",t),()=>r.removeEventListener?.("change",t))}}var mf="(prefers-color-scheme: dark)",bf="(prefers-color-scheme: light)",yf="(prefers-reduced-motion: reduce)",vf="(prefers-contrast: more)",xf=gf(mf),kf=gf(yf),wf=gf(vf);function Cf(){let e=hf(mf);return e===null?null:e.matches?"dark":hf(bf)?.matches?"light":null}function Sf(){return hf(yf)?.matches===true}function jf(){return hf(vf)?.matches===true}var _f=16,Rf=false;var Ef=null;function If(e){return Number.parseFloat(window.getComputedStyle(e).fontSize)}function zf(){let e=document.body??document.documentElement,t=document.createElement("span");t.setAttribute("aria-hidden","true"),t.style.setProperty("position","absolute","important"),t.style.setProperty("visibility","hidden","important"),t.style.setProperty("font-size","medium","important"),e.appendChild(t);try{return If(t)}finally{t.remove()}}function Tf(){if(typeof document>"u"||typeof window>"u"||typeof window.getComputedStyle!="function")return 1;try{let e=Rf?If(document.documentElement):zf();return Number.isFinite(e)&&e>0?e/_f:1}catch{return 1}}function Of(){return Ef===null&&(Ef=Tf()),Ef}function Pf(e){if(typeof window>"u"||typeof window.addEventListener!="function")return()=>{};let t=()=>{Ef=null,e()};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}function Ff(){return e.useSyncExternalStore(xf,Cf,()=>null)}function Mf(){return e.useSyncExternalStore(kf,Sf,()=>false)}function Af(){return e.useSyncExternalStore(wf,jf,()=>false)}function $f(){return e.useSyncExternalStore(Pf,Of,()=>1)}var Df=/* @__PURE__ */Object.freeze({useColorScheme:Ff,useReducedMotion:Mf,useTextScale:$f,useHighContrast:Af,scaleTypeSizes:true,useResolvedTheme:pf,isDevelopment:Qd});function Bf(e){return e.storage===void 0?{...e,storage:createLocalStorageKv()}:e}var Nf=/* @__PURE__ */Object.freeze({platform:"web",withDefaults:Bf,theme:Df});function EverfurProvider(t){let{cspNonce:r,webRuntime:n,...l}=t;return n!==void 0&&n!=="updates"&&ed(),Jc()||Kd(r),e.createElement(EverfurProviderCore,{...l,seams:Nf})}function useCapability(t){let{runtime:r}=gc(),n=r.entitlements,l=e.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot);return e.useMemo(()=>decideCapability(t,l.decisions,{isPending:l.isPending}),[t,l])}function Lf(t){let{runtime:r}=gc(),n=r.entitlements,l=e.useCallback(e=>n===void 0?()=>{}:n.subscribe(e),[n]),i=e.useCallback(()=>{if(n===void 0)return false;let e=n.getSnapshot();return decideCapability(t,e.decisions,{isPending:e.isPending}).enabled},[n,t]);return e.useSyncExternalStore(l,i,i)}var Uf=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:r,resetKey:n}){return e.createElement(Uf,{fallback:r,resetKey:n,children:e.createElement(RenderHost,{render:t})})}function Hf(e,t,r){return Math.round(r*Yd(e,t)*10)/10}var Wf='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',qf="System";function Vf(e){let t=e.trim();return t.length===0||t===qf?Wf:`${Gf(t)}, ${Wf}`}function Kf(e){let t=e.trim();return t.length===0||t==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Gf(t)}, ui-monospace, Menlo, Consolas, monospace`}function Gf(e){return`"${e.replace(/[\\"]/g,"\\$&")}"`}function faceCss(e,t){let r=e.type,n=r.families[t];return{fontFamily:t==="mono"||t==="monoMedium"||t==="monoBold"?Kf(n):Vf(n),fontWeight:r.namedFaces[t]?r.weight.regular:r.weight[Gd[t]]}}function headingFaceCss(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type,l=faceCss(e,t);return r===null&&n===null?l:r!==null?{fontFamily:Vf(r),fontWeight:n??e.type.weight[Gd[t]]}:e.type.namedFaces[t]||n===null?l:{fontFamily:l.fontFamily,fontWeight:n}}var Yf=/* @__PURE__ */Object.freeze({textAlign:"start"});var Qf=48;function Zf(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(t){let{capability:r,children:l,renderDisabled:i,renderPending:o,style:a,className:s}=t,u=useCapability(r),c=e.useMemo(()=>Zf(u),[u]);switch(c){case"enabled":return l;case"pending":return o?/* @__PURE__ */n.jsx(HostRender,{render:o,fallback:/* @__PURE__ */n.jsx(PendingSkeleton,{capability:r,style:a,className:s})}):/* @__PURE__ */n.jsx(PendingSkeleton,{capability:r,style:a,className:s});case"disabled":return i?/* @__PURE__ */n.jsx(HostRender,{render:()=>i(u),fallback:/* @__PURE__ */n.jsx(OffState,{decision:u,style:a,className:s}),resetKey:u}):/* @__PURE__ */n.jsx(OffState,{decision:u,style:a,className:s});default:return assertNever(c)}}function PendingSkeleton({capability:t,style:r,className:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Xf(i),[i]);/* @__PURE__ */
49
+ return Object.freeze(r)}catch{return[]}}}}var Ic="https://sdk.everfur.com",zc=/* @__PURE__ */Object.freeze({k1:"X4wc1hwVONs4I9Vmclo9ExrfPZlH8-tgY7NmzxuA5lI"}),Tc=/* @__PURE__ */Object.freeze(["health-plan","health-plan-today","shop","shop-orders-v2","ui","televet-booking","televet-call"]),Oc=/* @__PURE__ */Object.freeze({"@everfur/sdk/web/health-plan":"health-plan","@everfur/sdk/web/health-plan/today":"health-plan-today","@everfur/sdk/web/shop":"shop","@everfur/sdk/web/shop/orders-v2":"shop-orders-v2","@everfur/sdk/web/ui":"ui","@everfur/sdk/web/televet/booking":"televet-booking","@everfur/sdk/web/televet/call":"televet-call"}),Pc=1794927661e3,Fc=3e3,Mc=8e3,Ac=256*1024,$c=4*1024*1024,Dc="web_runtime.fallback";var Bc=/* @__PURE__ */Symbol.for(`@everfur/sdk#WebRuntimeBridge@v${1}`);function Nc(){let e=globalThis,t=e[Bc];if(t!==void 0)return t;let r={major:1,host:null,defined:/* @__PURE__ */new Map,waiters:/* @__PURE__ */new Map,importSubpath:null};return e[Bc]=r,r}function Lc(e){if(typeof e!="string")return null;let t=/^(\d+)\./.exec(e);return t===null?null:Number(t[1])}function Uc(e){let t=Lc(e.React?.version);if(t===null||typeof e.React.createElement!="function")return null;let r=Nc();return r.host===null?(r.host={...e,reactMajor:t},{reactMajor:t}):r.host.React.createElement===e.React.createElement&&r.host.reactMajor===t?{reactMajor:t}:null}function Hc(){return Nc().host}var Wc=(e,t)=>`${e}@${t}`;function qc(e,t){return Nc().defined.get(Wc(e,t))??null}function Vc(e,t,r){let n=Nc(),l=n.ran??=/* @__PURE__ */new Map,i=Wc(e,t),o=l.get(i);return o===void 0?n.defined.has(i)?false:(l.set(i,r),true):o===r}function Kc(e,t,r){let n=qc(e,t);if(n!==null)return Promise.resolve(n);let l=Nc(),i=Wc(e,t);return new Promise(e=>{let t=l.waiters.get(i)??/* @__PURE__ */new Set;l.waiters.set(i,t);let n=r=>{clearTimeout(a),t.delete(o),e(r)},o=e=>n(e),a=setTimeout(()=>n(null),r);t.add(o)})}function Gc(e){Nc().importSubpath=e}function Yc(e,t){let r=Object.keys(t).sort().map(e=>`${e}=${t[e]}`).join(",");return`v${1}|${e}|${r}`}var Qc=Yc(ke,zc);var Zc=/* @__PURE__ */Symbol.for(`@everfur/sdk#WebRuntimeBundledOnly@v${1}`),Xc=globalThis,Jc=()=>Xc[Zc]===true,ed=()=>{Xc[Zc]=true};var td=/^\d{1,4}\.\d{1,5}\.\d{1,6}(?:-[0-9A-Za-z.-]{1,64})?$/,rd=/^[a-z0-9][a-z0-9.-]{0,80}\.js$/,nd=/^sha384-[A-Za-z0-9+/]{64}$/,ld=/^[0-9a-f]{32}$/,id=/^[A-Za-z0-9_-]+$/,od=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ad(e){if(typeof e!="string"||e.length===0||!id.test(e))return null;let t=e.replace(/-/g,"+").replace(/_/g,"/");try{let e=atob(t+"=".repeat((4-t.length%4)%4)),r=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)r[t]=e.charCodeAt(t);return r}catch{return null}}var sd=/^\d{4}(-\d\d){2}T\d\d(:\d\d){2}(\.\d{1,3})?Z$/,ud=14*864e5;function cd(e){if(typeof e!="string"||!sd.test(e))return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function dd(e){if(!od(e)||!Array.isArray(e.react)||!od(e.parts))return null;let t=e.react.filter(e=>Number.isInteger(e)&&e>0);if(t.length===0||t.length!==e.react.length)return null;let r={};for(let[t,n]of Object.entries(e.parts))if(Tc.includes(t)){if(!od(n)||typeof n.path!="string"||typeof n.integrity!="string"||!rd.test(n.path)||!nd.test(n.integrity))return null;r[t]={path:n.path,integrity:n.integrity}}return{react:t,parts:r}}function fd(e){if(!od(e)||e.schema!==1||!Number.isInteger(e.major))return null;let t=cd(e.issuedAt),r=cd(e.expiresAt);if(t===null||r===null||typeof e.stable!="string"||!td.test(e.stable)||r<=t||r-t>ud||!od(e.versions))return null;let n={};for(let[t,r]of Object.entries(e.versions)){let e=dd(r);if(!td.test(t)||e===null)return null;n[t]=e}let l=null;if(e.canary!==void 0&&e.canary!==null){let t=e.canary;if(!od(t)||typeof t.version!="string"||!td.test(t.version)||typeof t.percent!="number"||!Number.isFinite(t.percent)||t.percent<0||t.percent>100)return null;l={version:t.version,percent:t.percent}}let i={};if(e.pins!==void 0){if(!od(e.pins))return null;for(let[t,r]of Object.entries(e.pins)){if(!ld.test(t)||typeof r!="string"||!td.test(r))return null;i[t]=r}}let o=[];if(e.revoked!==void 0){if(!Array.isArray(e.revoked)||!e.revoked.every(e=>typeof e=="string"&&td.test(e)))return null;o=e.revoked}return{schema:1,major:e.major,issuedAt:t,expiresAt:r,stable:e.stable,canary:l,pins:i,revoked:o,versions:n}}async function pd(e,t,r,n,l=Pc){if(!od(e)||e.v!==1||typeof e.keyId!="string")return{ok:false,reason:"manifest-shape"};let i=ad(e.payload),o=ad(e.signature);if(i===null||o===null||o.length!==64)return{ok:false,reason:"manifest-shape"};let a=Object.prototype.hasOwnProperty.call(t,e.keyId)?ad(t[e.keyId]):null;if(a===null||a.length!==32)return{ok:false,reason:"signature-key"};let s;try{let e=await r.subtle.importKey("raw",a,{name:"Ed25519"},!1,["verify"]);s=await r.subtle.verify({name:"Ed25519"},e,o,i)}catch{return{ok:false,reason:"signature-unsupported"}}if(!s)return{ok:false,reason:"signature-invalid"};let u;try{u=JSON.parse((new TextDecoder).decode(i))}catch{return{ok:false,reason:"manifest-shape"}}let c=fd(u);return c===null?{ok:false,reason:"manifest-shape"}:c.major!==1?{ok:false,reason:"manifest-major"}:n>=c.expiresAt?{ok:false,reason:"manifest-expired"}:c.issuedAt<l?{ok:false,reason:"manifest-stale"}:{ok:true,manifest:c}}function hd(e,t){let[r="",n]=e.split(/-(.*)/s,2),[l="",i]=t.split(/-(.*)/s,2),o=r.split(".").map(Number),a=l.split(".").map(Number);for(let e=0;e<3;e+=1){let t=(o[e]??0)-(a[e]??0);if(t!==0)return t<0?-1:1}if(n===i)return 0;if(n===void 0)return 1;if(i===void 0)return-1;let s=n.split("."),u=i.split(".");for(let e=0;;e+=1){let t=s[e],r=u[e];if(t===r)continue;if(t===void 0||r===void 0)return t===void 0?-1:1;let n=/^\d+$/.test(t),l=/^\d+$/.test(r);return n!==l?n?-1:1:(n?Number(t)<Number(r):t<r)?-1:1}}function gd(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t>>>0}function md(e,t){return gd(`${e??"-"}:${t}`)%100}async function bd(e,t){try{let r=await t.subtle.digest("SHA-256",(new TextEncoder).encode(e));return Array.from(new Uint8Array(r),e=>e.toString(16).padStart(2,"0")).join("").slice(0,32)}catch{return null}}function yd(e,t){let r=t.tenantKey===null?void 0:e.pins[t.tenantKey],n,l;if(r!==void 0?(n=r,l="pin"):e.canary!==null&&md(t.tenantKey,t.sessionBucket)<e.canary.percent?(n=e.canary.version,l="canary"):(n=e.stable,l="stable"),e.revoked.includes(n))return{use:"bundled",reason:"revoked"};if(l!=="pin"&&hd(n,t.bundledVersion)<0&&!e.revoked.includes(t.bundledVersion))return{use:"bundled",reason:"bundled-newer"};let i=e.versions[n];return i===void 0?{use:"bundled",reason:"version-missing"}:{use:"remote",version:n,entry:i,reason:l}}var vd=/^manifest-(fetch|timeout)$/,xd="everfur:web-runtime:unreachable",kd=10*6e4;function wd(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}async function Cd(e,t,r,n,l="default"){let i=typeof AbortController=="function"?new AbortController:null,o=null,a=()=>{},s=new Promise(e=>{a=e}),u=setTimeout(()=>{a("timeout"),i?.abort(),o?.()},r),c=e=>Promise.race([e,s]);try{let r=await c(e(t,{mode:"cors",credentials:"omit",referrerPolicy:"no-referrer",redirect:"error",cache:l,...i?{signal:i.signal}:{}}));if(r==="timeout")return{ok:!1,why:"timeout"};if(!r.ok)return{ok:!1,why:"http"};let a=Number(r.headers.get("content-length")??Number.NaN),s=r.body?.getReader()??null;if(o=()=>{s!==null&&s.cancel().catch(()=>{})},Number.isFinite(a)&&a>n)return o(),{ok:!1,why:"too-large"};if(s===null){let e=await c(r.arrayBuffer());return e==="timeout"?{ok:!1,why:"timeout"}:e.byteLength>n?{ok:!1,why:"too-large"}:{ok:!0,bytes:new Uint8Array(e)}}let u=[],d=0;for(;;){let e=await c(s.read());if(e==="timeout")return{ok:!1,why:"timeout"};if(e.done)break;if(d+=e.value.byteLength,d>n)return o(),{ok:!1,why:"too-large"};u.push(e.value)}let f=new Uint8Array(d),p=0;for(let e of u)f.set(e,p),p+=e.byteLength;return{ok:!0,bytes:f}}catch{return{ok:false,why:i?.signal.aborted?"timeout":"error"}}finally{clearTimeout(u)}}function Sd(e){let t=e.hasDom&&Object.keys(e.keys).length>0&&e.fetch!==null&&e.crypto!==null,r=e.manifestTimeoutMs??Fc,n=e.partTimeoutMs??Mc,l=e.manifestMaxBytes??Ac,i=e.partMaxBytes??$c,o=`${e.origin}/web-runtime`,a=null,s=/* @__PURE__ */new Map,u=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,f=null,p=null;async function h(){let t=await Cd(e.fetch,`${o}/${1}/manifest.json`,r,l,"no-store");if(!t.ok){let r=t.why==="timeout"?"manifest-timeout":t.why==="too-large"?"manifest-too-large":"manifest-fetch";if(t.why==="error"||t.why==="timeout")try{e.unreachable?.()?.setItem(xd,`${e.now()+kd}|${r}`)}catch{}return{ok:false,reason:r}}let n;try{n=JSON.parse((new TextDecoder).decode(t.bytes))}catch{return{ok:false,reason:"manifest-shape"}}return pd(n,e.keys,e.crypto,e.now(),e.minIssuedAt??Pc)}function g(t){let r=t??"",n=s.get(r);if(n)return n;let l=(async()=>{a??=h();let r=await a;if(!r.ok)return{ok:false,reason:r.reason};let n=t===null?null:await bd(t,e.crypto),l=yd(r.manifest,{tenantKey:n,sessionBucket:e.sessionBucket(),bundledVersion:e.bundledVersion});return l.use==="remote"?{ok:true,choice:l}:{ok:false,reason:l.reason}})();return s.set(r,l),l}async function m(t,r){if(await Promise.resolve(),Jc())return{ok:false,reason:"disabled",version:null};let l=Hc();if(l===null)return{ok:false,reason:"react-unregistered",version:null};let a=await g(r);if(!a.ok)return{ok:false,reason:a.reason,version:null};let{version:s,entry:u}=a.choice;if(!u.react.includes(l.reactMajor))return{ok:false,reason:"react-mismatch",version:s};let c=u.parts[t];if(c===void 0)return{ok:false,reason:"part-missing",version:s};if(!Vc(t,s,c.integrity))return{ok:false,reason:"part-integrity",version:s};let d=qc(t,s);if(d!==null)return{ok:true,namespace:d,version:s};let f=`${o}/${s}/${c.path}`;if(Jc())return{ok:false,reason:"disabled",version:s};let h=await Cd(e.fetch,f,n,i);if(!h.ok)return{ok:false,reason:h.why==="timeout"?"part-timeout":h.why==="too-large"?"part-too-large":"part-fetch",version:s};let m=h.bytes,b;try{b=`sha384-${wd(new Uint8Array(await e.crypto.subtle.digest("SHA-384",m)))}`}catch{return{ok:false,reason:"part-integrity",version:s}}if(b!==c.integrity)return{ok:false,reason:"part-integrity",version:s};if(Jc())return{ok:false,reason:"disabled",version:s};let y=e.createBlobUrl?.(m)??null,v="error";if(y!==null&&(v=await e.runScript(y,c.integrity,"blob",p),e.revokeBlobUrl(y)),v==="error"&&(v=await e.runScript(f,c.integrity,"cdn",p)),v==="error")return{ok:false,reason:"part-load",version:s};let x=await Kc(t,s,50);return x===null?{ok:false,reason:"part-load",version:s}:{ok:true,namespace:x,version:s}}let b=t?null:e.hasDom?"disabled":"server";try{let[t,r]=(e.unreachable?.()?.getItem(xd)??"").split("|");Number(t)>e.now()&&vd.test(String(r))&&(b??=r)}catch{}function y(e,t){if(b!==null)return Promise.resolve({ok:false,reason:b,version:null});f??=t;let r=`${t??""}|${e}`,n=u.get(r);if(n)return n;let l=m(e,t).then(e=>e,()=>({ok:false,reason:"part-load",version:null}));return l.then(e=>c.set(r,e)),u.set(r,l),l}return t&&Gc(e=>{let t=Object.prototype.hasOwnProperty.call(Oc,e)?Oc[e]:void 0,r=()=>{let t=d.get(e);return t?t():Promise.reject(new TypeError(`${e} is not available to the Everfur web runtime`))};return t===void 0?r():y(t,f).then(e=>e.ok?e.namespace:r())}),{enabled:t,peek:(e,t)=>b!==null?{ok:false,reason:b,version:null}:c.get(`${t??""}|${e}`)??null,load:y,registerHostSubpaths:e=>{for(let[t,r]of Object.entries(e))d.has(t)||d.set(t,r)},setCspNonce:e=>{p=e===null||e===""?null:e}}}var jd="everfur:web-runtime:bucket",_d=null;function Rd(){try{let e=globalThis.sessionStorage?.getItem(jd);if(e)return e}catch{}_d??=Math.floor(Math.random()*4294967296).toString(16);try{globalThis.sessionStorage?.setItem(jd,_d)}catch{}return _d}function Ed(e){return(t,r,n,l)=>new Promise(i=>{let o;try{o=e.createElement("script"),o.type="module",n==="cdn"&&(o.integrity=r,o.crossOrigin="anonymous"),l!==null&&(o.nonce=l),o.addEventListener("load",()=>{o.remove(),i("load")}),o.addEventListener("error",()=>{o.remove(),i("error")}),o.src=t,(e.head??e.documentElement).appendChild(o)}catch{i("error")}})}function Id(){let e=typeof document>"u"?null:document,t=globalThis.crypto;return{origin:Ic,keys:zc,bundledVersion:ke,fetch:typeof fetch=="function"?fetch.bind(globalThis):null,crypto:t?.subtle?t:null,hasDom:e!==null&&typeof window<"u",runScript:e===null?()=>Promise.resolve("error"):Ed(e),createBlobUrl:typeof Blob=="function"&&typeof URL.createObjectURL=="function"?e=>{try{return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch{return null}}:null,revokeBlobUrl:e=>{try{URL.revokeObjectURL(e)}catch{}},now:()=>Date.now(),sessionBucket:Rd,unreachable:()=>globalThis.sessionStorage}}var zd=/* @__PURE__ */Symbol.for(`@everfur/sdk#WebRuntimeLoader@${Qc}`);function Td(){let e=globalThis;return e[zd]??=Sd(Id())}var Od=/* @__PURE__ */new Set(["disabled","server","bundled-newer"]),Pd=/* @__PURE__ */new Set;function Fd(e,t,r,n){if(Od.has(r))return;let l=`${t}|${r}`;if(!Pd.has(l)){Pd.add(l);try{e?.trackExpectedFailure(Dc,{part:t,reason:r,version:n,bundled:ke})}catch{}}}var Md=/* @__PURE__ */new Set,Ad=class extends e.Component{constructor(){super(...arguments);this.state={failed:false}}static getDerivedStateFromError(){return{failed:true}}componentDidCatch(){this.props.onError()}render(){return this.state.failed?this.props.fallback():this.props.children}},$d=/* @__PURE__ */new Map;function Dd(t,r,n){let l=`${r??""}|${t.part}|${t.name}`,i=$d.get(l);return i===void 0&&(i=e.lazy(async()=>{let e=await Td().load(t.part,r),l=e.ok?e.namespace[t.name]:void 0;return e.ok&&typeof l!="function"&&(typeof l!="object"||l===null)?(Fd(n.current,t.part,"part-missing",e.version),{default:t.bundled}):(e.ok||Fd(n.current,t.part,e.reason,e.version),{default:e.ok?l:t.bundled})}),$d.set(l,i)),i}var Bd=()=>()=>{},Nd=()=>false,Ld=()=>true;function RuntimeSurface({spec:t,props:r}){let n=e.useContext(hc),l=Jc(),a=n?.publishableKey?n.publishableKey:null,s=e.useRef(null);s.current=n?.runtime.registry?.services?.telemetry??null;let u=e.useSyncExternalStore(Bd,Nd,Ld),c=e.useRef(null),[,d]=e.useState(0),f=l?null:Td();if(t.hostSubpaths!==void 0&&f?.enabled&&f.registerHostSubpaths(t.hostSubpaths),u)c.current=t.wait==="bundled"&&f!==null?"hydrate":"bundled";else if(c.current===null)if(!f?.enabled||Md.has(t.part))c.current="bundled";else if(Uc({React:i,ReactDOM:o})===null)Fd(s.current,t.part,"react-mismatch",null),c.current="bundled";else{let e=f.peek(t.part,a);c.current=e===null?"suspense":e.ok?"direct":"bundled"}let p=c.current,h=u||p!=="hydrate"?null:f?.peek(t.part,a)??null,g=!u&&p==="hydrate"&&h===null&&f?.enabled===true&&!Md.has(t.part);e.useEffect(()=>{if(!g||f===null)return;if(Uc({React:i,ReactDOM:o})===null){Fd(s.current,t.part,"react-mismatch",null);return}let e=true;return f.load(t.part,a).then(r=>{r.ok||Fd(s.current,t.part,r.reason,r.version),e&&d(e=>e+1)}),()=>{e=false}},[g,f,t.part,a]);let m=()=>e.createElement(t.bundled,r),b=r=>e.createElement(Ad,{fallback:m,onError:()=>{Md.add(t.part),Fd(s.current,t.part,"render",null)},children:r});if(u||p==="bundled")return m();if(p==="hydrate"||p==="direct"){let n=h??f?.peek(t.part,a),l=n?.ok?n.namespace[t.name]:void 0;return l===void 0||Md.has(t.part)?m():b(e.createElement(l,r))}let y=Dd(t,a,s),v=t.wait==="bundled"?m():e.createElement("div",{"data-everfur-runtime":"loading","aria-busy":true});return b(e.createElement(e.Suspense,{fallback:v},e.createElement(y,r)))}var Ud=/* @__PURE__ */Symbol.for(`@everfur/sdk#WebRuntimeRenderer@${Qc}`),Hd=globalThis;function Wd(e,t=false){e===null?delete Hd[Ud]:(t||Hd[Ud]===void 0)&&(Hd[Ud]=e)}var qd=RuntimeSurface,Vd=(t,r)=>e.createElement(qd,{spec:t,props:r});function Kd(e){if(Wd(Vd),e!==void 0&&e!==""){let t=Td();t.enabled&&t.setCspNonce(e)}}var Gd=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Gd[t]]}}function Yd(e,t){let{scale:r,scaleCaps:n}=e.type,l=n[t];return l>0?Math.min(r,l):r}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type;if(r===null&&n===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:n??e.type.weight[Gd[t]]};let l=face(e,t);return l.fontWeight===void 0||n===null?l:{fontFamily:l.fontFamily,fontWeight:n}}function Qd(){try{return process.env.NODE_ENV!=="production"}catch{return false}}var Zd=/* @__PURE__ */new Map,Xd=/* @__PURE__ */new Set,Jd=typeof document>"u"?e.useEffect:e.useLayoutEffect;function ef(e){return e.cssSrc!==void 0?`css\n${e.cssSrc}`:`file\n${e.family}\n${e.src??""}\n${e.weight??"400"}\n${e.style??"normal"}`}function tf(e,t){if(!t)return;let r=e.cssSrc??e.src??"",n=`[everfur] A font in appearance.fonts did not load: "${e.family}" from ${r}. The text renders in the fallback font. If your page sets a Content-Security-Policy, allow this host in font-src`+(e.cssSrc!==void 0?" and style-src (and the font files the stylesheet names in font-src).":".");if(!Xd.has(n)){Xd.add(n);try{globalThis.console?.warn?.(n)}catch{}}}function rf(e){let t=document.getElementsByTagName("link");for(let r=0;r<t.length;r+=1){let n=t[r];if(n.rel==="stylesheet"&&n.getAttribute("href")===e)return n}return null}function nf(e){return rf(e)!==null?Promise.resolve(true):new Promise(t=>{let r=document.createElement("link");r.rel="stylesheet",r.href=e,r.setAttribute("data-everfur-font",""),r.addEventListener("load",()=>t(true)),r.addEventListener("error",()=>t(false)),document.head.appendChild(r)})}function lf(e){let t=document.fonts;return new FontFace(e.family,`url("${e.src}")`,{display:"swap",weight:e.weight??"400",style:e.style??"normal"}).load().then(e=>(t.add(e),true)).catch(()=>false)}function of(e,t=false){let r=ef(e),n=Zd.get(r);if(n===void 0){n=Promise.resolve(false);try{if(typeof document<"u"){let t=e.cssSrc===void 0?null:La(e.cssSrc),r=e.src===void 0?null:La(e.src);t!==null?n=nf(t):r!==null&&(n=lf({...e,src:r}))}}catch{n=Promise.resolve(false)}let l=n.then(r=>(r||tf(e,t),r));Zd.set(r,l),n=l}return n}function af(e,t){let r=e.type.fontSources;Jd(()=>{if(r.length===0)return;let e=false;try{e=t()}catch{}for(let t of r)of(t,e)},[r,t])}var sf=/* @__PURE__ */new RegExp(`^${Sa}\\/fonts\\/[\\w./-]+\\.woff2$`);function uf(e){return sf.test(e)&&!e.includes("..")}var cf=/* @__PURE__ */new Map;function df(e,t,r="400"){let n=e.trim(),l=`${n}\n${t}\n${r}`,i=cf.get(l);if(i===void 0){if(i=Promise.resolve(false),t!==null&&n!==""&&n!=="System"&&uf(t))try{let e=document.fonts;i=new FontFace(n,`url("${t}") format("woff2")`,{display:"swap",weight:r}).load().then(t=>(e.add(t),!0)).catch(()=>!1)}catch{}cf.set(l,i)}return i}var ff=["regular","medium","bold","mono","monoMedium","monoBold"];function pf(t){let{families:r,fontUrls:n,weight:l,namedFaces:i}=t.type;e.useEffect(()=>{for(let e of ff){let t=n[e];t!=null&&df(r[e],t,i[e]?l.regular:l[Gd[e]])}},[r,n,l,i]),af(t,Qd)}function hf(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function gf(e){return t=>{let r=hf(e);return r===null||typeof r.addEventListener!="function"?()=>{}:(r.addEventListener("change",t),()=>r.removeEventListener?.("change",t))}}var mf="(prefers-color-scheme: dark)",bf="(prefers-color-scheme: light)",yf="(prefers-reduced-motion: reduce)",vf="(prefers-contrast: more)",xf=gf(mf),kf=gf(yf),wf=gf(vf);function Cf(){let e=hf(mf);return e===null?null:e.matches?"dark":hf(bf)?.matches?"light":null}function Sf(){return hf(yf)?.matches===true}function jf(){return hf(vf)?.matches===true}var _f=16,Rf=false;var Ef=null;function If(e){return Number.parseFloat(window.getComputedStyle(e).fontSize)}function zf(){let e=document.body??document.documentElement,t=document.createElement("span");t.setAttribute("aria-hidden","true"),t.style.setProperty("position","absolute","important"),t.style.setProperty("visibility","hidden","important"),t.style.setProperty("font-size","medium","important"),e.appendChild(t);try{return If(t)}finally{t.remove()}}function Tf(){if(typeof document>"u"||typeof window>"u"||typeof window.getComputedStyle!="function")return 1;try{let e=Rf?If(document.documentElement):zf();return Number.isFinite(e)&&e>0?e/_f:1}catch{return 1}}function Of(){return Ef===null&&(Ef=Tf()),Ef}function Pf(e){if(typeof window>"u"||typeof window.addEventListener!="function")return()=>{};let t=()=>{Ef=null,e()};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}function Ff(){return e.useSyncExternalStore(xf,Cf,()=>null)}function Mf(){return e.useSyncExternalStore(kf,Sf,()=>false)}function Af(){return e.useSyncExternalStore(wf,jf,()=>false)}function $f(){return e.useSyncExternalStore(Pf,Of,()=>1)}var Df=/* @__PURE__ */Object.freeze({useColorScheme:Ff,useReducedMotion:Mf,useTextScale:$f,useHighContrast:Af,scaleTypeSizes:true,useResolvedTheme:pf,isDevelopment:Qd});function Bf(e){return e.storage===void 0?{...e,storage:createLocalStorageKv()}:e}var Nf=/* @__PURE__ */Object.freeze({platform:"web",withDefaults:Bf,theme:Df});function EverfurProvider(t){let{cspNonce:r,webRuntime:n,...l}=t;return n!==void 0&&n!=="updates"&&ed(),Jc()||Kd(r),e.createElement(EverfurProviderCore,{...l,seams:Nf})}function useCapability(t){let{runtime:r}=gc(),n=r.entitlements,l=e.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot);return e.useMemo(()=>decideCapability(t,l.decisions,{isPending:l.isPending}),[t,l])}function Lf(t){let{runtime:r}=gc(),n=r.entitlements,l=e.useCallback(e=>n===void 0?()=>{}:n.subscribe(e),[n]),i=e.useCallback(()=>{if(n===void 0)return false;let e=n.getSnapshot();return decideCapability(t,e.decisions,{isPending:e.isPending}).enabled},[n,t]);return e.useSyncExternalStore(l,i,i)}var Uf=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:r,resetKey:n}){return e.createElement(Uf,{fallback:r,resetKey:n,children:e.createElement(RenderHost,{render:t})})}function Hf(e,t,r){return Math.round(r*Yd(e,t)*10)/10}var Wf='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',qf="System";function Vf(e){let t=e.trim();return t.length===0||t===qf?Wf:`${Gf(t)}, ${Wf}`}function Kf(e){let t=e.trim();return t.length===0||t==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${Gf(t)}, ui-monospace, Menlo, Consolas, monospace`}function Gf(e){return`"${e.replace(/[\\"]/g,"\\$&")}"`}function faceCss(e,t){let r=e.type,n=r.families[t];return{fontFamily:t==="mono"||t==="monoMedium"||t==="monoBold"?Kf(n):Vf(n),fontWeight:r.namedFaces[t]?r.weight.regular:r.weight[Gd[t]]}}function headingFaceCss(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type,l=faceCss(e,t);return r===null&&n===null?l:r!==null?{fontFamily:Vf(r),fontWeight:n??e.type.weight[Gd[t]]}:e.type.namedFaces[t]||n===null?l:{fontFamily:l.fontFamily,fontWeight:n}}var Yf=/* @__PURE__ */Object.freeze({textAlign:"start"});var Qf=48;function Zf(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(t){let{capability:r,children:l,renderDisabled:i,renderPending:o,style:a,className:s}=t,u=useCapability(r),c=e.useMemo(()=>Zf(u),[u]);switch(c){case"enabled":return l;case"pending":return o?/* @__PURE__ */n.jsx(HostRender,{render:o,fallback:/* @__PURE__ */n.jsx(PendingSkeleton,{capability:r,style:a,className:s})}):/* @__PURE__ */n.jsx(PendingSkeleton,{capability:r,style:a,className:s});case"disabled":return i?/* @__PURE__ */n.jsx(HostRender,{render:()=>i(u),fallback:/* @__PURE__ */n.jsx(OffState,{decision:u,style:a,className:s}),resetKey:u}):/* @__PURE__ */n.jsx(OffState,{decision:u,style:a,className:s});default:return assertNever(c)}}function PendingSkeleton({capability:t,style:r,className:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Xf(i),[i]);/* @__PURE__ */
50
50
  return n.jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${t}`,className:l,style:{...o.offstate,...r},children:/* @__PURE__ */n.jsx("div",{style:o.skeletonBar})})}function OffState({decision:t,style:r,className:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Xf(i),[i]),a=t.disabled?.reason??"";/* @__PURE__ */
51
51
  return n.jsx("div",{className:l,style:{...o.offstate,...r},children:a.length>0?/* @__PURE__ */n.jsx("p",{style:o.offstateText,children:a}):null})}function Xf(e){let{color:t,space:r,radius:n,type:l}=e;return{offstate:{...Yf,boxSizing:"border-box",minHeight:Qf,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${r.md}px ${r.lg}px`,backgroundColor:t.surfaceCream,borderRadius:n.md,border:`1px solid ${t.brandBorder}`},offstateText:{margin:0,...faceCss(e,"regular"),fontSize:l.size.body,lineHeight:`${Math.round(l.size.body*l.lineHeight.normal)}px`,color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}}}var Jf="Go to the nearest emergency vet now.";var ep=/* @__PURE__ */Object.freeze({placeholder:"Ask anything about {petName}…",placeholderFollowUpWeb:"Ask a follow-up…",placeholderUrgentWeb:"Tell us what’s happening…",composerLabel:"Message",attachPhotoOrFileNative:"Add a photo or file",suggestions:"Suggestions",reading:"Reading {petName}’s records…",answered:"Everfur answered.",assistantName:"Everfur",followUpsHeadingNative:"Follow-up questions",turnFailedTitleWeb:"Everfur couldn’t answer that just now.",send:"Send",stop:"Stop",retry:"Try again",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",loading:"Loading",empty:"No messages yet",transcript:"Chat with Everfur",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting…",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",sourcesHeading:"Sources",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",nearestEmergencyVet:"Nearest emergency vet",goToNearestEmergencyVet:Jf,poisonControlWeb:"ASPCA Poison Control",poisonControlNative:"ASPCA Animal Poison Control, (888) 426-4435",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openHistoryNative:"Chats and vet messages",openHistoryWeb:"Chats",showChatsWeb:"Show chats",hideChatsWeb:"Hide chats",newReplySuffix:", a new reply",yourPets:"Your pets",yourPet:"Your pet",switchActivePet:"{name}. Switch pet",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active · ",close:"Close",addAnotherPet:"Add a pet",addPet:"Add a pet",capReached:"You've used your {cap} free messages this month.",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function tp(e,t){return e.replace(/\{(\w+)\}/g,(e,r)=>{let n=t[r];return n===void 0?e:String(n)})}function rp(e){return e?.trim()||ep.emptyTitlePetFallback}function np(e,t){return tp(e,{petName:rp(t)})}var lp="tel:+18884264435";var ip=/* @__PURE__ */Object.freeze([
52
52
  /* @__PURE__ */Object.freeze({key:"inaccurate",label:ep.feedbackReasonInaccurate,feedbackType:"wrong"}),