mirror of
https://github.com/afoim/fuwari.git
synced 2026-01-31 09:03:18 +08:00
2 lines
1.1 KiB
JavaScript
2 lines
1.1 KiB
JavaScript
import{R as u,S as v,T as y,o as _,x as m,q as $,U as h,V as g,W as b,X as x,Y as k}from"./render.D4aKwFGu.js";function f(e){return(a,...l)=>{var n=e(...l),t;if(_)t=m,$();else{var i=n.render().trim(),o=u(i);t=h(o),a.before(t)}const s=n.setup?.(t);v(t,t),typeof s=="function"&&y(s)}}const p=new WeakMap;var w=e=>async(a,l,n,{client:t})=>{if(!e.hasAttribute("ssr"))return;let i,o,s={};for(const[r,c]of Object.entries(n))o??={},r==="default"?(o.default=!0,i=f(()=>({render:()=>`<astro-slot>${c}</astro-slot>`}))):o[r]=f(()=>({render:()=>`<astro-slot name="${r}">${c}</astro-slot>`})),r==="default"?s.children=f(()=>({render:()=>`<astro-slot>${c}</astro-slot>`})):s[r]=f(()=>({render:()=>`<astro-slot name="${r}">${c}</astro-slot>`}));const d={...l,children:i,$$slots:o,...s};if(p.has(e))p.get(e).setProps(d);else{const r=S(a,e,d,t!=="only");p.set(e,r),e.addEventListener("astro:unmount",()=>r.destroy(),{once:!0})}};function S(e,a,l,n){let t=g(l);const i=n?b:x;n||(a.innerHTML="");const o=i(e,{target:a,props:t});return{setProps(s){Object.assign(t,s);for(const d in t)d in s||delete t[d]},destroy(){k(o)}}}export{w as default};
|