You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
17 KiB

5 years ago
  1. /* Riot v4.5.0, @license MIT */
  2. var e,t;e=this,t=function(e){"use strict";const t=new Map,n=Symbol("riot-component"),r=new Set,o="is",s="value",i=Symbol("attributes"),u=Symbol("template");var a=Object.freeze({COMPONENTS_IMPLEMENTATION_MAP:t,DOM_COMPONENT_INSTANCE_PROPERTY:n,PLUGINS_SET:r,IS_DIRECTIVE:o,VALUE_ATTRIBUTE:s,ATTRIBUTES_KEY_SYMBOL:i,TEMPLATE_KEY_SYMBOL:u});function l(e){Array.from(e).forEach(e=>e.parentNode&&e.parentNode.removeChild(e))}const c=2;var h={EACH:0,IF:1,SIMPLE:c,TAG:3,SLOT:4};const{indexOf:d}=[],p=(e,t,n,r,o,s)=>{const i="selectedIndex"in t;let u=i;for(;r<o;){const o=e(n[r],1);if(t.insertBefore(o,s),i&&u&&o.selected){u=!u;let{selectedIndex:e}=t;t.selectedIndex=e<0?r:d.call(t.querySelectorAll("option"),o)}r++}},m=(e,t)=>e==t,f=e=>e,b=(e,t,n,r,o,s,i)=>{const u=s-o;if(u<1)return-1;for(;n-t>=u;){let u=t,a=o;for(;u<n&&a<s&&i(e[u],r[a]);)u++,a++;if(a===s)return t;t=u+1}return-1},g=(e,t,n,r,o)=>n<r?e(t[n],0):0<n?e(t[n-1],-0).nextSibling:o,v=(e,t,n,r,o)=>{if(o-r<2)t.removeChild(e(n[r],-1));else{const s=t.ownerDocument.createRange();s.setStartBefore(e(n[r],-1)),s.setEndAfter(e(n[o-1],-1)),s.deleteContents()}},O=(e,t,n)=>{let r=1,o=t;for(;r<o;){const t=(r+o)/2>>>0;n<e[t]?o=t:r=t+1}return r},N=(e,t,n,r,o,s,i,u,a,l,c,h,d)=>{((e,t,n,r,o,s,i,u,a)=>{const l=new Map,c=e.length;let h=i,d=0;for(;d<c;)switch(e[d++]){case 0:o++,h++;break;case 1:l.set(r[o],1),p(t,n,r,o++,o,h<u?t(s[h],0):a);break;case-1:h++}for(d=0;d<c;)switch(e[d++]){case 0:i++;break;case-1:l.has(s[i])?i++:v(t,n,s,i++,i)}})(((e,t,n,r,o,s,i)=>{const u=n+s,a=[];let l,c,h,d,p,m,f;e:for(l=0;l<=u;l++){if(l>50)return null;for(f=l-1,p=l?a[l-1]:[0,0],m=a[l]=[],c=-l;c<=l;c+=2){for(h=(d=c===-l||c!==l&&p[f+c-1]<p[f+c+1]?p[f+c+1]:p[f+c-1]+1)-c;d<s&&h<n&&i(r[o+d],e[t+h]);)d++,h++;if(d===s&&h===n)break e;m[l+c]=d}}const b=Array(l/2+u/2);let g=b.length-1;for(l=a.length-1;l>=0;l--){for(;d>0&&h>0&&i(r[o+d-1],e[t+h-1]);)b[g--]=0,d--,h--;if(!l)break;f=l-1,p=l?a[l-1]:[0,0],(c=d-h)==-l||c!==l&&p[f+c-1]<p[f+c+1]?(h--,b[g--]=1):(d--,b[g--]=-1)}return b})(n,r,s,i,u,l,h)||((e,t,n,r,o,s,i,u)=>{let a=0,l=r<u?r:u;const c=Array(l++),h=Array(l);h[0]=-1;for(let e=1;e<l;e++)h[e]=i;const d=new Map;for(let e=s;e<i;e++)d.set(o[e],e);for(let r=t;r<n;r++){const t=d.get(e[r]);null!=t&&-1<(a=O(h,l,t))&&(h[a]=t,c[a]={newi:r,oldi:t,prev:c[a-1]})}for(a=--l,--i;h[a]>i;)--a;l=u+r-a;const p=Array(l);let m=c[a];for(--n;m;){const{newi:e,oldi:t}=m;for(;n>e;)p[--l]=1,--n;for(;i>t;)p[--l]=-1,--i;p[--l]=0,--n,--i,m=m.prev}for(;n>=t;)p[--l]=1,--n;for(;i>=s;)p[--l]=-1,--i;return p})(n,r,o,s,i,u,a,l),e,t,n,r,i,u,c,d)};function T(e){return null==e}function y(e){return!T(e.content)}const E=Object.seal({childrenMap:null,node:null,root:null,condition:null,evaluate:null,template:null,isTemplateTag:!1,nodes:[],getKey:null,indexName:null,itemName:null,afterPlaceholder:null,placeholder:null,mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n}=this,r=this.evaluate(e),o=r?Array.from(r):[],s=n.parentNode,{newChildrenMap:i,batches:u,futureNodes:a}=function(e,t,n,r){const{condition:o,template:s,childrenMap:i,itemName:u,getKey:a,indexName:l,root:c,isTemplateTag:h}=r,d=new Map,p=[],m=[];return e.forEach((e,r)=>{const f=function(e,t){let{itemName:n,indexName:r,index:o,item:s}=t;return e[n]=s,r&&(e[r]=o),e}(Object.create(t),{itemName:u,indexName:l,index:r,item:e}),b=a?a(f):r,g=i.get(b);if(function(e,t){return!!e&&!1===Boolean(e(t))}(o,f))return;const v=g?g.template:s.clone(),O=g?v.el:c.cloneNode(),N=!g,T=h&&N?function(e){const t=e.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:t,children:Array.from(t.childNodes)}}(v):{};N?p.push(()=>v.mount(O,f,n,T)):v.update(f,n),h?m.push(...T.children||v.children):m.push(O),i.delete(b),d.set(b,{template:v,context:f,index:r})}),{newChildrenMap:d,batches:p,futureNodes:m}}(o,e,t,this);return a.length?((e,t,n,r)=>{r||(r={});const o=r.compare||m,s=r.node||f,i=null==r.before?null:s(r.before,0),u=t.length;let a=u,l=0,c=n.length,h=0;for(;l<a&&h<c&&o(t[l],n[h]);)l++,h++;for(;l<a&&h<c&&o(t[a-1],n[c-1]);)a--,c--;const d=l===a,O=h===c;if(d&&O)return n;if(d&&h<c)return p(s,e,n,h,c,g(s,t,l,u,i)),n;if(O&&l<a