@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
5 lines (4 loc) • 1.45 kB
JavaScript
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
v3.2.1 */
import{A,B as D,C as y,g as P,u as k,v as w,w as V,y as m,z as p}from"./BJZTU5BQ.js";var b=(s,f,c)=>{let h=new Map;for(let e=f;e<=c;e++)h.set(s[e],e);return h},I=w(class extends V{constructor(s){if(super(s),s.type!==k.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,f,c){let h;c===void 0?c=f:f!==void 0&&(h=f);let e=[],n=[],l=0;for(let a of s)e[l]=h?h(a,l):l,n[l]=c(a,l),l++;return{values:n,keys:e}}render(s,f,c){return this.dt(s,f,c).values}update(s,[f,c,h]){let e=D(s),{values:n,keys:l}=this.dt(f,c,h);if(!Array.isArray(e))return this.ut=l,n;let a=this.ut??=[],u=[],v,x,t=0,o=e.length-1,r=0,i=n.length-1;for(;t<=o&&r<=i;)if(e[t]===null)t++;else if(e[o]===null)o--;else if(a[t]===l[r])u[r]=p(e[t],n[r]),t++,r++;else if(a[o]===l[i])u[i]=p(e[o],n[i]),o--,i--;else if(a[t]===l[i])u[i]=p(e[t],n[i]),m(s,u[i+1],e[t]),t++,i--;else if(a[o]===l[r])u[r]=p(e[o],n[r]),m(s,e[t],e[o]),o--,r++;else if(v===void 0&&(v=b(l,r,i),x=b(a,t,o)),v.has(a[t]))if(v.has(a[o])){let d=x.get(l[r]),g=d!==void 0?e[d]:null;if(g===null){let C=m(s,e[t]);p(C,n[r]),u[r]=C}else u[r]=p(g,n[r]),m(s,e[t],g),e[d]=null;r++}else y(e[o]),o--;else y(e[t]),t++;for(;r<=i;){let d=m(s,u[i+1]);p(d,n[r]),u[r++]=d}for(;t<=o;){let d=e[t++];d!==null&&y(d)}return this.ut=l,A(s,u),P}});export{I as a};