DAD_eSlp.js 1.7 KB

1
  1. import{h as m,i as c,j as b,k as u,l as _,m as k,o,q as v,u as g,v as y,w,x as A,E as x,y as E,z as F,A as M,B as p}from"./DP2RCIpD.js";class B{anchor;#t=new Map;#s=new Map;#e=new Map;#a=new Set;#i=!0;constructor(t,s=!0){this.anchor=t,this.#i=s}#r=t=>{if(this.#t.has(t)){var s=this.#t.get(t),e=this.#s.get(s);if(e)m(e),this.#a.delete(s);else{var r=this.#e.get(s);r&&(this.#s.set(s,r.effect),this.#e.delete(s),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),e=r.effect)}for(const[i,f]of this.#t){if(this.#t.delete(i),i===t)break;const a=this.#e.get(f);a&&(c(a.effect),this.#e.delete(f))}for(const[i,f]of this.#s){if(i===s||this.#a.has(i))continue;const a=()=>{if(Array.from(this.#t.values()).includes(i)){var h=document.createDocumentFragment();g(f,h),h.append(u()),this.#e.set(i,{effect:f,fragment:h})}else c(f);this.#a.delete(i),this.#s.delete(i)};this.#i||!e?(this.#a.add(i),b(f,a,!1)):a()}}};#f=t=>{this.#t.delete(t);const s=Array.from(this.#t.values());for(const[e,r]of this.#e)s.includes(e)||(c(r.effect),this.#e.delete(e))};ensure(t,s){var e=k,r=y();if(s&&!this.#s.has(t)&&!this.#e.has(t))if(r){var i=document.createDocumentFragment(),f=u();i.append(f),this.#e.set(t,{effect:_(()=>s(f)),fragment:i})}else this.#s.set(t,_(()=>s(this.anchor)));if(this.#t.set(e,t),r){for(const[a,n]of this.#s)a===t?e.unskip_effect(n):e.skip_effect(n);for(const[a,n]of this.#e)a===t?e.unskip_effect(n.effect):e.skip_effect(n.effect);e.oncommit(this.#r),e.ondiscard(this.#f)}else o&&(this.anchor=v),this.#r(e)}}function C(d,t,s=!1){var e;o&&(e=v,A());var r=new B(d),i=s?x:0;function f(a,n){if(o){var h=E(e);if(a!==parseInt(h.substring(1))){var l=F();M(l),r.anchor=l,p(!1),r.ensure(a,n),p(!0);return}}r.ensure(a,n)}w(()=>{var a=!1;t((n,h=0)=>{a=!0,f(h,n)}),a||f(-1,null)},i)}export{B,C as i};