import{bK as q,bL as M,bM as R,G as U,H as B,bN as E,bO as _,d as D,o as g,a as x,p as m,q as W,m as P,s as a,W as I,bP as N,bQ as O,c as C,a0 as j,a1 as V,a4 as z,ar as G,e as A,B as f,bR as H,F as X,v as F,bS as $,bT as Q,bU as S,bV as Z,ac as k,f as T,bW as K,aQ as J,am as L,bX as Y}from"./B3fabVUf.js";var ee=0;function te(s){const i=new WeakMap,r=q();function c(n){if(s.mode!=="popLayout")return;const d=n.offsetParent,y=d instanceof HTMLElement&&d.offsetWidth||0,l={height:n.offsetHeight||0,width:n.offsetWidth||0,top:n.offsetTop,left:n.offsetLeft,right:0};l.right=y-l.width-l.left;const p=s.anchorX==="left"?`left: ${l.left}px`:`right: ${l.right}px`,h=`pop-${ee++}`;n.dataset.motionPopId=h;const e=document.createElement("style");r.value.nonce&&(e.nonce=r.value.nonce),i.set(n,e),document.head.appendChild(e),e.sheet&&e.sheet.insertRule(`
    [data-motion-pop-id="${h}"] {
      position: absolute !important;
      width: ${l.width}px !important;
      height: ${l.height}px !important;
      top: ${l.top}px !important;
      ${p} !important;
      }
      `)}function v(n){const d=i.get(n);d&&(i.delete(n),M.render(()=>{document.head.removeChild(d)}))}return{addPopStyle:c,removePopStyle:v}}var oe=0;function ae(s){const i=String(oe++),r=new Map,{addPopStyle:c,removePopStyle:v}=te(s);function n(e){const t=[],o=E.get(e);o&&e.getAttribute(_.motionAttribute)===i&&t.push(o);const u=Array.from(e.querySelectorAll(`[${_.motionAttribute}="${i}"]`));for(const w of u){const b=E.get(w);b&&t.push(b)}return t}function d(e,t){const o=r.get(e);o&&(o.remaining.delete(t),o.remaining.size===0&&l(o))}const y={initial:s.initial,custom:s.custom,presenceId:i,onMotionExitComplete:d};R(y),U(()=>{y.initial=void 0});function l(e){v(e.el),e.states.forEach(t=>{t.getSnapshot(t.options,!1)}),e.done(),r.delete(e.el),e.el?.isConnected?e.states[0]?.didUpdate():e.states.forEach(t=>{t.unmount()}),s.onExitComplete?.()}function p(e,t){n(e).forEach(o=>{o.setActive("exit",!1),o.getSnapshot(o.options,!0)}),t()}function h(e,t){y.custom=s.custom;const o=e,u=n(o);if(u.length===0){t(),s.onExitComplete?.();return}const w={remaining:new Set(u),states:u,done:t,el:o};r.set(o,w),c(o),u.forEach(b=>{b.presenceContainer=o,b.setActive("exit",!0),b.getSnapshot(b.options,!1)}),u[0]?.didUpdate()}return B(()=>{r.forEach(e=>{e.states.forEach(t=>{t.unmount()})}),r.clear()}),{enter:p,exit:h}}var ne=D({name:"AnimatePresence",inheritAttrs:!0,__name:"AnimatePresence",props:{mode:{default:"sync"},initial:{type:Boolean,default:!0},as:{},custom:{},onExitComplete:{},anchorX:{default:"left"}},setup(s){const i=s,{enter:r,exit:c}=ae(i),v=C(()=>i.mode!=="wait"?{tag:i.as}:{mode:i.mode==="wait"?"out-in":void 0});return(n,d)=>(g(),x(I(n.mode==="wait"?N:O),P(v.value,{appear:"",css:!1,onLeave:a(c),onEnter:a(r)}),{default:m(()=>[W(n.$slots,"default")]),_:3},16,["onLeave","onEnter"]))}}),se=ne;const ie={slots:{base:"rounded-md w-full",overlay:"fixed inset-0 bg-default/75 backdrop-blur-sm will-change-opacity",content:"fixed inset-0 flex items-center justify-center cursor-zoom-out focus:outline-none",zoomedImage:"w-full h-auto max-w-[95vw] max-h-[95vh] object-contain rounded-md"},variants:{zoom:{true:"will-change-transform"},open:{true:""}},compoundVariants:[{zoom:!0,open:!1,class:"cursor-zoom-in"}]},le=["onClick"],ue=Object.assign({inheritAttrs:!1},{__name:"ProseImg",props:{src:{type:String,required:!0},alt:{type:String,required:!0},width:{type:[String,Number],required:!1},height:{type:[String,Number],required:!1},class:{type:null,required:!1},zoom:{type:Boolean,required:!1,default:!0},ui:{type:Object,required:!1}},setup(s){const i=s,r=j(),c=V("prose.img",i),[v,n]=z(),[d,y]=z(),l=F(!1),p=C(()=>L({extend:L(ie),...r.ui?.prose?.img||{}})({zoom:i.zoom,open:l.value})),h=C(()=>K(i.src,J().app.baseURL)),e=C(()=>`${h.value}::${Y()}`);return i.zoom&&G(window,"scroll",()=>{l.value=!1}),(t,o)=>(g(),A(X,null,[f(a(v),null,{default:m(()=>[(g(),x(I(a($)),P({src:h.value,alt:s.alt,width:s.width,height:s.height},t.$attrs,{class:p.value.base({class:[a(c)?.base,i.class]})}),null,16,["src","alt","width","height","class"]))]),_:1}),f(a(d),null,{default:m(()=>[(g(),x(I(a($)),P({src:h.value,alt:s.alt},t.$attrs,{class:p.value.zoomedImage({class:[a(c)?.zoomedImage]})}),null,16,["src","alt","class"]))]),_:1}),s.zoom?(g(),x(a(H),{key:0,open:l.value,"onUpdate:open":o[0]||(o[0]=u=>l.value=u),modal:!1},{default:m(({close:u})=>[f(a(Q),{"as-child":""},{default:m(()=>[f(a(S),{"layout-id":e.value,"as-child":"",transition:{type:"spring",bounce:.15,duration:.5,ease:"easeInOut"}},{default:m(()=>[f(a(n))]),_:1},8,["layout-id"])]),_:1}),f(a(Z),null,{default:m(()=>[f(a(se),null,{default:m(()=>[l.value?(g(),x(a(S),{key:0,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},class:k(p.value.overlay({class:[a(c)?.overlay]}))},null,8,["class"])):T("",!0),l.value?(g(),A("div",{key:1,class:k(p.value.content({class:[a(c)?.content]})),onClick:u},[f(a(S),{"as-child":"","layout-id":e.value,transition:{type:"spring",bounce:.15,duration:.5,ease:"easeInOut"}},{default:m(()=>[f(a(y))]),_:1},8,["layout-id"])],10,le)):T("",!0)]),_:2},1024)]),_:2},1024)]),_:1},8,["open"])):(g(),x(a(n),{key:1}))],64))}});export{ue as default};
