import{slicedToArray as e,defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import o,{forwardRef as i,useRef as r,useState as s,useEffect as n,useMemo as a,Fragment as l}from"react";import m from"classnames";import d from"../../hooks/useMergeRef.js";import p from"../Tooltip/Tooltip.js";import c from"../IconButton/IconButton.js";import u from"./TipseenTitle.js";import{TipseenCloseButtonTheme as f,TipseenColor as h,TIPSEEN_CLOSE_BUTTON_ARIA_LABEL as v}from"./TipseenConstants.js";import{withStaticProps as T}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import{ComponentDefaultTestId as g}from"../../tests/constants.js";import{getTestId as y}from"../../tests/testIds.js";import C from"../Text/Text.js";import j from"./Tipseen.module.scss.js";import{TooltipPositions as w}from"../Tooltip/TooltipConstants.js";import{AnimationType as E,HideShowEvent as N}from"../../../components/dialog/dist/Dialog/DialogConstants.js";import x from"../../../icons/dist/react/CloseSmall.js";var W=o.createContext("primary"),B=T(i((function(i,f){var h=i.className,T=i.id,w=i.position,E=void 0===w?"bottom":w,N=i.animationType,B=void 0===N?"expand":N,S=i.hideDelay,k=void 0===S?0:S,A=i.showDelay,D=void 0===A?100:A,b=i.title,P=i.titleClassName,H=i.hideCloseButton,I=i.closeButtonTheme,R=void 0===I?"light":I,O=i.onClose,L=i.closeAriaLabel,M=i.children,_=void 0===M?null:M,z=i.content,q=i.containerSelector,F=i.hideTrigger,G=void 0===F?[]:F,J=i.showTrigger,K=void 0===J?[]:J,Q=i.width,U=i.moveBy,V=i.hideWhenReferenceHidden,X=void 0!==V&&V,Y=i.referenceWrapperClassName,Z=i.tip,$=void 0===Z||Z,ee=i.tooltipArrowClassName,te=i.modifiers,oe=void 0===te?[]:te,ie=i.floating,re=void 0!==ie&&ie,se=i.color,ne=i["data-testid"],ae=null!=se?se:"inverted",le=Array.isArray(K)&&Array.isArray(G)&&0===K.length&&D>0,me=r(null),de=d(f,me),pe=s(!le),ce=e(pe,2),ue=ce[0],fe=ce[1],he=L||v;n((function(){var e;return D&&(e=setTimeout((function(){fe(!0)}),D)),function(){clearTimeout(e)}}),[D,fe]);var ve=a((function(){return"inverted"===ae?"onInverted":"onPrimary"}),[ae]),Te=a((function(){return"light"===R?"inverted"===ae?"on-inverted-background":"on-primary-color":R}),[ae,R]),ge=f||T?"div":l,ye="div"===ge?{ref:de,id:T,"data-testid":ne||y(g.TIPSEEN,T)}:{},Ce=o.createElement("div",null,o.createElement("div",{className:m(j.tipseenHeader)},H?null:o.createElement(c,{hideTooltip:!0,className:m(j.tipseenCloseButton,t({},j.dark,"dark"===R||"fixed-dark"===R)),onClick:O,size:"xs",kind:"tertiary",color:Te,ariaLabel:he,icon:x}),o.createElement(u,{text:b,className:m(j.tipseenTitle,P)})),o.createElement(C,{color:ve,type:"text2",element:"div",ellipsis:!1,className:m(j.tipseenContent)},o.createElement(W.Provider,{value:ae},z)));return o.createElement(ge,Object.assign({},ye),o.createElement(p,{className:m(j.tipseenWrapper,h,t(t({},j.tipseenWrapperWithoutCustomWidth,!Q),j.floating,re)),maxWidth:Q,arrowClassName:ee,style:Q?{width:Q}:void 0,shouldShowOnMount:!le,position:E,animationType:B,hideDelay:k,showDelay:0,hideTrigger:G,showTrigger:K,showOnDialogEnter:!1,content:Ce,theme:"inverted"===ae?"dark":"primary",containerSelector:q,disableDialogSlide:!1,moveBy:U,hideWhenReferenceHidden:X,referenceWrapperClassName:Y,tip:$&&!re,modifiers:oe,open:le?ue:void 0,forceRenderWithoutChildren:re},_))})),{closeButtonThemes:f,animationTypes:E,hideShowTriggers:N,colors:h,positions:w});export{W as TipseenContext,B as default};
//# sourceMappingURL=Tipseen.js.map
