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