import{j as e}from"./jsx-runtime.D_zvdyIk.js";import{M as f,C as x}from"./MacToolbar.C6blOHbs.js";import{u as v,a as g,b as h,c as j,F as w,d as y}from"./floating-ui.react.BIavrRt9.js";import{c as b}from"./utils.BZbvJs_N.js";import{u as E}from"./index.RTTH55m1.js";import{$ as F,c as d,o as N}from"./modal.CmyA2O2l.js";import{r as p}from"./index.BIRwh3HZ.js";import{A as C}from"./index.BbbUxuaI.js";import{m as u}from"./proxy.D9st1TsE.js";import"./useTranslation.Dg7DwAC5.js";import"./utils.D6Ui05B2.js";import"./site-config.CgQ_bxrG.js";import"./site.Deo0TYgJ.js";import"./index.3whys8t3.js";import"./iconify.pctX9hd_.js";import"./floating-ui.react-dom.Pr5t-z7H.js";import"./index.Ky-LTxRX.js";import"./_commonjsHelpers.CqkleIqs.js";import"./index.CHUzDkS6.js";import"./index.BHh4vvK5.js";function L(o){if(!o)return{};const r={},l=o.split(";").filter(t=>t.trim());for(const t of l){const n=t.indexOf(":");if(n===-1)continue;const a=t.slice(0,n).trim(),i=t.slice(n+1).trim();if(!a||!i)continue;const c=a.replace(/-([a-z])/g,(s,m)=>m.toUpperCase());r[c]=i}return r}function Q(){const o=E(F),r=o!==null,{refs:l,context:t}=v({open:r,onOpenChange:s=>{s||d()}}),n=g(t,{outsidePressEvent:"mousedown"}),a=h(t,{role:"dialog"}),{getFloatingProps:i}=j([n,a]);if(p.useEffect(()=>{const s=m=>{N("codeFullscreen",m.detail)};return window.addEventListener("open-code-fullscreen",s),()=>window.removeEventListener("open-code-fullscreen",s)},[]),p.useEffect(()=>{const s=()=>d();return document.addEventListener("astro:before-preparation",s),()=>document.removeEventListener("astro:before-preparation",s)},[]),!o)return null;const c=L(o.preStyle);return e.jsx(w,{children:e.jsx(C,{children:r&&e.jsxs(u.div,{className:"fixed inset-0 z-40",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm"}),e.jsx(y,{context:t,children:e.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center px-4",children:e.jsxs(u.div,{ref:l.setFloating,className:"relative flex h-[80vh] w-[90vw] max-w-6xl flex-col overflow-hidden overscroll-none rounded-xl bg-background shadow-2xl md:max-w-[90vw]",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2},...i(),children:[e.jsx(f,{language:o.language,onClose:d,children:e.jsx(x,{text:o.code,showLabel:!0})}),e.jsx("div",{className:"scroll-feather-mask flex-1 overflow-auto",children:e.jsx("pre",{className:b(o.preClassName,"p-4"),style:c,children:e.jsx("code",{className:o.codeClassName,dangerouslySetInnerHTML:{__html:o.codeHTML}})})})]})})})]})})})}export{Q as default};
