import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{i as n,t as r}from"./emotion-styled.browser.esm.C7ab1lZK.js";import{g as i}from"./getColors.DtAxY2Hd.js";import{n as a}from"./UriUtil.Baw2_TkK.js";import{i as o}from"./Tooltip.DJg7muty.js";import{n as s,t as c}from"./styled-components.BQZommyC.js";import{t as l}from"./BaseButtonTooltip.9ZCtkLEj.js";import{i as u,t as d}from"./DynamicButtonLabel.BZWdvyzO.js";import{t as f}from"./iconPosition.C4GDw890.js";var p=e(t(),1);function m(e,t){switch(e){case s.XSMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.sm}`,fontSize:t.fontSizes.sm};case s.SMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.md}`};case s.LARGE:return{padding:`${t.spacing.md} ${t.spacing.md}`};default:return{padding:`${t.spacing.xs} ${t.spacing.md}`}}}var h=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`},...m(t,n)})),g=r(h,{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`}})),_=r(h,{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`}})),v=r(h,{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`}})),y=(0,p.forwardRef)(function({kind:e,size:t,disabled:r,children:i,autoFocus:a,href:o,rel:l,target:u,onClick:d},f){let p=g;return e===c.SECONDARY?p=_:e===c.TERTIARY&&(p=v),n(p,{ref:f,kind:e,size:t||s.MEDIUM,containerWidth:!0,disabled:r||!1,autoFocus:a||!1,href:o,target:u,rel:l,onClick:d,tabIndex:r?-1:0,"data-testid":`stBaseLinkButton-${e}`,children:i})});y.displayName=`BaseLinkButton`;var b=(0,p.memo)(y);function x(e){let{element:t,widgetMgr:r,fragmentId:i}=e,m=t.shortcut||void 0,h=a(t.url),g=h?`#`:t.url,_=c.SECONDARY;t.type===`primary`?_=c.PRIMARY:t.type===`tertiary`&&(_=c.TERTIARY);let v=(0,p.useRef)(null),y=(0,p.useCallback)(()=>{t.disabled||h||v.current?.click()},[t.disabled,h]),x=(0,p.useCallback)(e=>{if(t.disabled||h){e.preventDefault();return}!t.ignoreRerun&&t.id&&r.setTriggerValue(t,{fromUi:!0},i)},[t,i,h,r]);return u({shortcut:m,disabled:t.disabled,onActivate:y}),n(o,{className:`stLinkButton`,"data-testid":`stLinkButton`,children:n(l,{help:t.help,containerWidth:!0,children:n(b,{ref:v,kind:_,size:s.SMALL,disabled:t.disabled,onClick:x,href:g,target:h?`_self`:`_blank`,rel:`noreferrer`,"aria-disabled":t.disabled,children:n(d,{icon:t.icon,iconPosition:f(t.iconPosition),label:t.label,shortcut:m})})})})}var S=(0,p.memo)(x);export{S as default};