"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShareLink=exports.StyledShareLink=exports.Link=void 0;const jsx_runtime_1=require("react/jsx-runtime"),styled_components_1=__importDefault(require("styled-components")),jotai_1=require("jotai"),react_router_dom_1=require("react-router-dom"),theme_1=require("@redocly/theme"),store_1=require("../../jotai/store");function Link(e){var t;const{routingBasePath:i,unstable_hooks:r,onDeepLinkClick:n}=(0,jotai_1.useAtomValue)(store_1.globalOptionsAtom),o=e.security?null===(t=null==r?void 0:r.replaceSecurityLink)||void 0===t?void 0:t.call(r,{securityRequirementId:e.to}):e.to,a=n&&{onClick:e=>{e.preventDefault(),n(i+o)}};return o?(0,jsx_runtime_1.jsx)(react_router_dom_1.Link,Object.assign({"aria-label":e["aria-label"]||`link to ${o}`,id:decodeURIComponent(e.id||""),className:e.className||"",to:(null==o?void 0:o.startsWith("#"))?o:i+o},a,{children:e.children})):e.children?(0,jsx_runtime_1.jsxs)("span",{"aria-label":e["aria-label"]||`link to ${o}`,className:e.className,children:[" ",e.children," "]}):null}function ShareLink(e){return(0,jsx_runtime_1.jsx)(exports.StyledShareLink,Object.assign({},e,{children:(0,jsx_runtime_1.jsx)(theme_1.LinkIcon,{size:"13px",color:"--heading-anchor-color"})}))}exports.Link=Link,exports.StyledShareLink=(0,styled_components_1.default)(Link)`
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-100%, -50%);
  padding-right: var(--heading-anchor-offset-right);
  z-index: 1;

  ${theme_1.LinkIcon} {
    opacity: 0;
    transition: visibility 0.3s linear, opacity 0.3s linear;
  }

  :hover ${theme_1.LinkIcon}, :focus ${theme_1.LinkIcon} {
    visibility: visible;
    opacity: 1;
  }
`,exports.ShareLink=ShareLink;
//# sourceMappingURL=linkify.js.map