import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{ht as r,t as i}from"./dist-DtfJeYQK.js";import{t as a}from"./jsx-runtime-C2wGStra.js";import{B as o,H as s,St as c,U as l,V as u,W as d,_ as f,g as p,m,z as h}from"./iframe-D-oZzXNK.js";import{n as g,t as _}from"./dist-Cc1j9Pjk.js";import{n as v,t as y}from"./Icon-0Ag8a3l4.js";import{n as b,t as x}from"./Text-DO3xXyuu.js";import{n as S,t as C}from"./Heading-BfSBs5r6.js";import{n as w,t as T}from"./Button-DqcfuOFN.js";import{n as E,t as D}from"./TokyoUIClose-BsMsQk2w.js";import{i as O,o as k,r as A}from"./lib-8ue2PVWI.js";import{n as j,t as M}from"./shared-strings-BFfhcoGp.js";var N,P,F,I,L,R,z,B,V=t((()=>{N=`content__KHgp9`,P=`appear__G8agi`,F=`disappear__OWVSJ`,I=`header__CaLti`,L=`close__3s-VD`,R=`footer__X5qXF`,z=`arrow__0pg-s`,B={content:N,appear:P,disappear:F,header:I,close:L,footer:R,arrow:z}})),H,U,W,G,K,q=t((()=>{H=e(n(),1),f(),E(),V(),m(),v(),b(),w(),S(),i(),_(),A(),j(),U=a(),W=e=>{e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView({behavior:`auto`,block:`nearest`,inline:`nearest`})},G=(0,H.forwardRef)(function({open:e,onOpenChange:t,disabled:n,title:i,text:a,children:f,side:m,dataset:_,actionLabel:v=(0,U.jsx)(O,{id:`preply-ds.onboardingTooltip.actionLabel`,defaultMessage:`Got it`,description:`Default onboarding tooltip action label. Used to acknowledge and close the tooltip.`}),actionOnClick:b,actionHref:S,counter:w,autoScroll:E=!0,...A},j){let{formatMessage:N}=k(),P=p(),F=(0,H.useId)(),I=(0,H.useId)(),L=(0,H.useId)(),R=(0,H.useRef)(null);return(0,H.useEffect)(()=>{e&&R.current&&E&&W(R.current)},[E,e]),n?f:(0,U.jsxs)(d,{open:e,onOpenChange:t,children:[(0,U.jsx)(c,{ref:j,...A,children:(0,U.jsx)(h,{ref:R,id:L,asChild:!0,children:f})}),(0,U.jsx)(l,{container:P,children:(0,U.jsxs)(s,{onInteractOutside:e=>{e.preventDefault()},side:m,className:B.content,"aria-labelledby":F,"aria-describedby":`${L} ${I}`,...r(_,{preplyDsComponent:g.OnboardingTooltip}),children:[(0,U.jsxs)(`div`,{className:B.header,children:[(0,U.jsx)(u,{className:B.close,"aria-label":N(M.close),"data-testid":`close`,children:(0,U.jsx)(y,{accent:`inverted`,svg:D})}),(0,U.jsx)(C,{tag:`h1`,variant:`small`,accent:`inverted`,id:F,"aria-describedby":L,children:i})]}),(0,U.jsx)(x,{variant:`default-regular`,accent:`inverted`,className:B.text,children:a}),(0,U.jsxs)(`div`,{className:B.footer,children:[w,(0,U.jsx)(T,{variant:`inverted`,size:`small`,onClick:b,href:S,dataset:{testid:`action`},wrap:!0,children:v})]}),(0,U.jsx)(o,{"aria-hidden":!0,className:B.arrow,width:18,height:11})]})})]})}),K=(0,H.forwardRef)(function(e,t){let[n,r]=(0,H.useState)(!0),i=t=>{t||e.onClose?.(),r(t)},a=()=>{e.actionOnClick?.(),r(!1),e.onClose?.()};return(0,U.jsx)(G,{...e,open:n,onOpenChange:i,actionOnClick:a,ref:t})});try{G.displayName=`InternalOnboardingTooltip`,G.__docgenInfo={description:``,displayName:`InternalOnboardingTooltip`,props:{title:{defaultValue:null,description:``,name:`title`,required:!0,type:{name:`enum`,value:[{value:`undefined`},{value:`null`},{value:`string`},{value:`number`},{value:`false`},{value:`true`},{value:`ReactElement<any, string | JSXElementConstructor<any>>`},{value:`Iterable<ReactNode>`},{value:`ReactPortal`}]}},text:{defaultValue:null,description:``,name:`text`,required:!0,type:{name:`enum`,value:[{value:`undefined`},{value:`null`},{value:`string`},{value:`number`},{value:`false`},{value:`true`},{value:`ReactElement<any, string | JSXElementConstructor<any>>`},{value:`Iterable<ReactNode>`},{value:`ReactPortal`}]}},disabled:{defaultValue:null,description:`Disables tooltip completely`,name:`disabled`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},onClose:{defaultValue:null,description:`Called when the tooltip is closed`,name:`onClose`,required:!1,type:{name:`enum`,value:[{value:`() => void`}]}},actionLabel:{defaultValue:{value:`(
            <FormattedMessage
                id="preply-ds.onboardingTooltip.actionLabel"
                defaultMessage="Got it"
                description="Default onboarding tooltip action label. Used to acknowledge and close the tooltip."
            />
        )`},description:`Label of the action button`,name:`actionLabel`,required:!1,type:{name:`enum`,value:[{value:`null`},{value:`string`},{value:`number`},{value:`false`},{value:`true`},{value:`ReactElement<any, string | JSXElementConstructor<any>>`},{value:`Iterable<ReactNode>`},{value:`ReactPortal`}]}},actionOnClick:{defaultValue:null,description:`By default, the action button closes the tooltip.

Provide \`actionOnClick\` to also perform other action.`,name:`actionOnClick`,required:!1,type:{name:`enum`,value:[{value:`() => void`}]}},actionHref:{defaultValue:null,description:`By default, the action button closes the tooltip.

Provide \`actionHref\` to also navigate to other page when the button is clicked.`,name:`actionHref`,required:!1,type:{name:`enum`,value:[{value:`string`}]}},side:{defaultValue:null,description:`Preferred side of the tooltip to appear from. Use if default side might block important content.`,name:`side`,required:!1,type:{name:`enum`,value:[{value:`"top"`},{value:`"right"`},{value:`"bottom"`},{value:`"left"`}]}},autoScroll:{defaultValue:{value:`true`},description:`If true, the tooltip will automatically scroll into view when it is opened.`,name:`autoScroll`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},dataset:{defaultValue:null,description:``,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}},counter:{defaultValue:null,description:``,name:`counter`,required:!1,type:{name:`enum`,value:[{value:`null`},{value:`string`},{value:`number`},{value:`false`},{value:`true`},{value:`ReactElement<any, string | JSXElementConstructor<any>>`},{value:`Iterable<ReactNode>`},{value:`ReactPortal`}]}},open:{defaultValue:null,description:``,name:`open`,required:!0,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},onOpenChange:{defaultValue:null,description:``,name:`onOpenChange`,required:!0,type:{name:`(open: boolean) => void`}}}}}catch{}try{K.displayName=`OnboardingTooltip`,K.__docgenInfo={description:`Informational pop-up that highlights specific UI element, e.g. to introduce new feature.

The direct child of the component should be html element, DS component,
or a component that forwards ref to the underlying DOM node.`,displayName:`OnboardingTooltip`,props:{title:{defaultValue:null,description:``,name:`title`,required:!0,type:{name:`enum`,value:[{value:`undefined`},{value:`null`},{value:`string`},{value:`number`},{value:`false`},{value:`true`},{value:`ReactElement<any, string | JSXElementConstructor<any>>`},{value:`Iterable<ReactNode>`},{value:`ReactPortal`}]}},text:{defaultValue:null,description:``,name:`text`,required:!0,type:{name:`enum`,value:[{value:`undefined`},{value:`null`},{value:`string`},{value:`number`},{value:`false`},{value:`true`},{value:`ReactElement<any, string | JSXElementConstructor<any>>`},{value:`Iterable<ReactNode>`},{value:`ReactPortal`}]}},disabled:{defaultValue:null,description:`Disables tooltip completely`,name:`disabled`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},onClose:{defaultValue:null,description:`Called when the tooltip is closed`,name:`onClose`,required:!1,type:{name:`enum`,value:[{value:`() => void`}]}},actionLabel:{defaultValue:{value:`(
            <FormattedMessage
                id="preply-ds.onboardingTooltip.actionLabel"
                defaultMessage="Got it"
                description="Default onboarding tooltip action label. Used to acknowledge and close the tooltip."
            />
        )`},description:`Label of the action button`,name:`actionLabel`,required:!1,type:{name:`enum`,value:[{value:`null`},{value:`string`},{value:`number`},{value:`false`},{value:`true`},{value:`ReactElement<any, string | JSXElementConstructor<any>>`},{value:`Iterable<ReactNode>`},{value:`ReactPortal`}]}},actionOnClick:{defaultValue:null,description:`By default, the action button closes the tooltip.

Provide \`actionOnClick\` to also perform other action.`,name:`actionOnClick`,required:!1,type:{name:`enum`,value:[{value:`() => void`}]}},actionHref:{defaultValue:null,description:`By default, the action button closes the tooltip.

Provide \`actionHref\` to also navigate to other page when the button is clicked.`,name:`actionHref`,required:!1,type:{name:`enum`,value:[{value:`string`}]}},side:{defaultValue:null,description:`Preferred side of the tooltip to appear from. Use if default side might block important content.`,name:`side`,required:!1,type:{name:`enum`,value:[{value:`"top"`},{value:`"right"`},{value:`"bottom"`},{value:`"left"`}]}},autoScroll:{defaultValue:{value:`true`},description:`If true, the tooltip will automatically scroll into view when it is opened.`,name:`autoScroll`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},dataset:{defaultValue:null,description:``,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}}));export{K as n,q as r,G as t};