import{o as t}from"./rolldown-runtime-iuO8RvI4.js";import{Tu as e}from"./shared-0-C4kdVF7Y.js";import{Mi as o}from"./vendor-frame-CwiylG4Y.js";import{gp as r}from"./shared-1-3-6x7RKF.js";import{ro as i}from"./shared-6-Cf_fMhRZ.js";import{xc as s}from"./shared-3-D-Ux4aGn.js";import{ln as a}from"./shared-11-EQw1fy-I.js";var n=t(o()),c=(0,n.memo)(({content:t,enabled:o,onDismiss:c,onAction:d})=>{const l=t,m=i(t=>t.setChatTooltip),p=i(t=>t.clearChatTooltip),{setStoredModel:u}=s(),f=e(),{onCreditsRequiredClick:h}=a({enabled:"credits_required_modal"===l.ctaAction?.type}),x=(0,n.useCallback)(()=>{if(!l.ctaAction)return;const{type:t,value:e}=l.ctaAction;"model"===t?u(e):"credits_required_modal"===t?h(e,{offerModelSwitch:!0,currentModelId:e}):"href"===t&&(e.startsWith("http://")||e.startsWith("https://")?r({href:e,desktopBehavior:"open-in-browser"}):f.push(e)),d({actionType:t,actionValue:e}),p(!0)},[l.ctaAction,u,h,f,d,p]);return(0,n.useEffect)(()=>{if(o)return m(l.type,l.nuxText,{title:l.nuxTitle,badgeText:l.nuxBadgeText,cta:l.ctaAction?{text:l.ctaAction.text,onClick:x}:void 0,onDismiss:c}),()=>{p(!0)};p(!0)},[o,l,m,p,x,c]),null});export{c as ChatTooltipV1};