import{j as e}from"./jsx-runtime.D_zvdyIk.js";import{M as h,C as v}from"./MacToolbar.C6blOHbs.js";import{u as b,a as j,b as y,c as N,F as w,d as F}from"./floating-ui.react.BIavrRt9.js";import{u as E}from"./useTranslation.Dg7DwAC5.js";import{u as T}from"./useZoomPan.CJ5fkGQH.js";import{I as C}from"./iconify.pctX9hd_.js";import{c as l}from"./utils.BZbvJs_N.js";import{u as L}from"./index.RTTH55m1.js";import{a as M,c}from"./modal.CmyA2O2l.js";import{r as m}from"./index.BIRwh3HZ.js";import{A as P}from"./index.BbbUxuaI.js";import{m as d}from"./proxy.D9st1TsE.js";import"./floating-ui.react-dom.Pr5t-z7H.js";import"./index.Ky-LTxRX.js";import"./_commonjsHelpers.CqkleIqs.js";import"./index.CHUzDkS6.js";import"./utils.D6Ui05B2.js";import"./site-config.CgQ_bxrG.js";import"./site.Deo0TYgJ.js";import"./index.3whys8t3.js";import"./index.BHh4vvK5.js";function W(){const t=L(M),r=t!==null,{containerRef:o,state:s,reset:i,zoomLevel:p}=T(r),{refs:u,context:n}=b({open:r,onOpenChange:a=>{a||c()}}),f=j(n,{outsidePressEvent:"mousedown"}),x=y(n,{role:"dialog"}),{getFloatingProps:g}=N([f,x]);return m.useEffect(()=>{const a=()=>c();return document.addEventListener("astro:before-preparation",a),()=>document.removeEventListener("astro:before-preparation",a)},[]),m.useEffect(()=>{r&&i()},[r,i]),t?e.jsx(w,{children:e.jsx(P,{children:r&&e.jsxs(d.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(F,{context:n,children:e.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center px-4",children:e.jsxs(d.div,{ref:u.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},...g(),children:[e.jsx(k,{data:t,zoomLevel:p,onReset:i}),e.jsx("div",{ref:o,className:l("flex flex-1 cursor-grab items-center justify-center overflow-hidden active:cursor-grabbing",t.diagramType==="infographic"&&"infographic-container"),children:e.jsx("div",{className:l("flex origin-center items-center justify-center transition-transform duration-100",t.diagramType==="mermaid"?"mermaid-svg-container":"infographic-svg-container"),style:{transform:`translate(${s.translateX}px, ${s.translateY}px) scale(${s.scale})`,width:"100%",height:"100%"},dangerouslySetInnerHTML:{__html:t.svg}})})]})})})]})})}):null}function k({data:t,zoomLevel:r,onReset:o}){const{t:s}=E();return e.jsx(h,{language:t.diagramType,className:"tablet:items-stretch tablet:px-2",onClose:c,children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"mr-2 tablet:ml-auto text-muted-foreground text-sm",children:r}),e.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:s("diagram.resetZoom"),children:[e.jsx(C,{icon:"ri:refresh-line",className:"size-4"}),e.jsx("span",{className:"text-sm",children:s("diagram.resetZoom")})]}),e.jsx(v,{text:t.source,showLabel:!0})]})})}export{W as default};
