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