import{J as s,K as e,L as t,O as r}from"./main-79b6d9fd.js";import{b as l,d as n,u as o,m as i,c as a}from"./c.cfd954ff.js";const f=(s,e,t)=>{const r=new Map;for(let l=e;l<=t;l++)r.set(s[l],l);return r},u=s(class extends e{constructor(s){if(super(s),s.type!==t.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let r;void 0===t?t=e:void 0!==e&&(r=e);const l=[],n=[];let o=0;for(const e of s)l[o]=r?r(e,o):o,n[o]=t(e,o),o++;return{values:n,keys:l}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,u]){var c;const d=l(s),{values:h,keys:p}=this.dt(e,t,u);if(!Array.isArray(d))return this.at=p,h;const v=null!==(c=this.at)&&void 0!==c?c:this.at=[],y=[];let m,x,b=0,g=d.length-1,j=0,k=h.length-1;for(;b<=g&&j<=k;)if(null===d[b])b++;else if(null===d[g])g--;else if(v[b]===p[j])y[j]=n(d[b],h[j]),b++,j++;else if(v[g]===p[k])y[k]=n(d[g],h[k]),g--,k--;else if(v[b]===p[k])y[k]=n(d[b],h[k]),o(s,y[k+1],d[b]),b++,k--;else if(v[g]===p[j])y[j]=n(d[g],h[j]),o(s,d[b],d[g]),g--,j++;else if(void 0===m&&(m=f(p,j,k),x=f(v,b,g)),m.has(v[b]))if(m.has(v[g])){const e=x.get(p[j]),t=void 0!==e?d[e]:null;if(null===t){const e=o(s,d[b]);n(e,h[j]),y[j]=e}else y[j]=n(t,h[j]),o(s,d[b],t),d[e]=null;j++}else i(d[g]),g--;else i(d[b]),b++;for(;j<=k;){const e=o(s,y[k+1]);n(e,h[j]),y[j++]=e}for(;b<=g;){const s=d[b++];null!==s&&i(s)}return this.at=p,a(s,y),r}});export{u as c};
