import{o as e}from"./chunk.DuxOD-Sk.js";import{r as t}from"./emotion-is-prop-valid.esm.DV_OErv-.js";import{c as n,t as r}from"./emotion-styled.browser.esm.BPUx6WuE.js";import{X as i}from"./getColors.DUygtxH4.js";import{Rt as a,_t as o,ft as s,ht as c,vt as l,zt as u}from"./src.sR_9Xh2m.js";import{t as d}from"./iconPosition.CAyE8Pjc.js";var f=e(t(),1);function p(e,t){switch(e){case u.XSMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.sm}`,fontSize:t.fontSizes.sm};case u.SMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.md}`};case u.LARGE:return{padding:`${t.spacing.md} ${t.spacing.md}`};default:return{padding:`${t.spacing.xs} ${t.spacing.md}`}}}var m=r(`a`,{target:`evo6qzw0`})(({containerWidth:e,size:t,theme:n})=>({display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontWeight:n.fontWeights.normal,padding:`${n.spacing.xs} ${n.spacing.md}`,borderRadius:n.radii.button,minHeight:n.sizes.minElementHeight,margin:0,lineHeight:n.lineHeights.base,color:n.colors.primary,textDecoration:`none`,width:e?`100%`:`auto`,userSelect:`none`,"&:visited":{color:n.colors.primary},"&:focus":{outline:`none`},"&:focus-visible":{boxShadow:n.shadows.focusRing},"&:hover":{textDecoration:`none`},"&:active":{textDecoration:`none`},...p(t,n)})),h=r(m,{target:`evo6qzw1`})(({theme:e})=>({backgroundColor:e.colors.primary,color:e.colors.white,border:`${e.sizes.borderWidth} solid ${e.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:i(e.colors.primary,.15),borderColor:i(e.colors.primary,.15)},"&:active":{backgroundColor:e.colors.primary,borderColor:i(e.colors.primary,.15)},"&:visited:not(:active)":{color:e.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:`not-allowed`}})),g=r(m,{target:`evo6qzw2`})(({theme:e})=>({backgroundColor:e.colors.lightenedBg05,color:e.colors.bodyText,border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,"&:visited":{color:e.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:e.colors.darkenedBgMix15},"&:active":{backgroundColor:e.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:`not-allowed`}})),_=r(m,{target:`evo6qzw3`})(({theme:e})=>({padding:e.spacing.none,backgroundColor:e.colors.transparent,color:e.colors.bodyText,border:`none`,"&:visited":{color:e.colors.bodyText},"&:hover, &:focus-visible":{color:e.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:`inherit !important`}},"&:active":{color:i(e.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:`not-allowed`}})),v=(0,f.forwardRef)(function({kind:e,size:t,disabled:r,children:i,autoFocus:o,href:s,rel:c,target:l,onClick:d},f){let p=h;return e===a.SECONDARY?p=g:e===a.TERTIARY&&(p=_),n(p,{ref:f,kind:e,size:t||u.MEDIUM,containerWidth:!0,disabled:r||!1,autoFocus:o||!1,href:s,target:l,rel:c,onClick:d,tabIndex:r?-1:0,"data-testid":`stBaseLinkButton-${e}`,children:i})});v.displayName=`BaseLinkButton`;var y=(0,f.memo)(v);function b(e){let{element:t,widgetMgr:r,fragmentId:i}=e,p=t.shortcut||void 0,m=a.SECONDARY;t.type===`primary`?m=a.PRIMARY:t.type===`tertiary`&&(m=a.TERTIARY);let h=(0,f.useRef)(null),g=(0,f.useCallback)(()=>{t.disabled||h.current?.click()},[t.disabled]),_=(0,f.useCallback)(e=>{if(t.disabled){e.preventDefault();return}!t.ignoreRerun&&t.id&&r.setTriggerValue(t,{fromUi:!0},i)},[t,i,r]);return c({shortcut:p,disabled:t.disabled,onActivate:g}),n(l,{className:`stLinkButton`,"data-testid":`stLinkButton`,children:n(o,{help:t.help,containerWidth:!0,children:n(y,{ref:h,kind:m,size:u.SMALL,disabled:t.disabled,onClick:_,href:t.url,target:`_blank`,rel:`noreferrer`,"aria-disabled":t.disabled,children:n(s,{icon:t.icon,iconPosition:d(t.iconPosition),label:t.label,shortcut:p})})})})}var x=(0,f.memo)(b);export{x as default};