Anvil/assets/each-57bb632b.js

2 lines
903 B
JavaScript
Raw Normal View History

2024-03-14 18:43:30 +01:00
import{t as z,a as B}from"./index-b180c43f.js";import{r as C}from"./utils-09ff0c0e.js";function G(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function D(n,d){z(n,1,1,()=>{d.delete(n.key)})}function H(n,d){n.f(),D(n,d)}function I(n,d,x,S,A,g,o,j,p,k,a,q){let i=n.length,c=g.length,f=i;const u={};for(;f--;)u[n[f].key]=f;const h=[],w=new Map,m=new Map,_=[];for(f=c;f--;){const e=q(A,g,f),s=x(e);let t=o.get(s);t?S&&_.push(()=>t.p(e,d)):(t=k(s,e),t.c()),w.set(s,h[f]=t),s in u&&m.set(s,Math.abs(f-u[s]))}const M=new Set,v=new Set;function y(e){B(e,1),e.m(j,a),o.set(e.key,e),a=e.first,c--}for(;i&&c;){const e=h[c-1],s=n[i-1],t=e.key,l=s.key;e===s?(a=e.first,i--,c--):w.has(l)?!o.has(t)||M.has(t)?y(e):v.has(l)?i--:m.get(t)>m.get(l)?(v.add(t),y(e)):(M.add(l),i--):(p(s,o),i--)}for(;i--;){const e=n[i];w.has(e.key)||p(e,o)}for(;c;)y(h[c-1]);return C(_),h}export{G as e,H as f,D as o,I as u};