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.

9 lines
562 KiB

4 years ago
  1. /* Riot v4.8.6, @license MIT */
  2. (function(e,t){typeof exports==="object"&&typeof module!=="undefined"?module.exports=t():typeof define==="function"&&define.amd?define(t):(e=e||self,e.riot=t())})(this,(function(){"use strict";const e=new Map,t=Symbol("riot-component"),r=new Set,n="is",i="value",a="mount",s="update",o="unmount",l="shouldUpdate",u="onBeforeMount",c="onMounted",f="onBeforeUpdate",h="onUpdated",p="onBeforeUnmount",d="onUnmounted",m="props",v="state",g="slots",y="root",x=Symbol.for("pure"),E=Symbol("parent"),b=Symbol("attributes"),S=Symbol("template");var D=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:e,DOM_COMPONENT_INSTANCE_PROPERTY:t,PLUGINS_SET:r,IS_DIRECTIVE:n,VALUE_ATTRIBUTE:i,MOUNT_METHOD_KEY:a,UPDATE_METHOD_KEY:s,UNMOUNT_METHOD_KEY:o,SHOULD_UPDATE_KEY:l,ON_BEFORE_MOUNT_KEY:u,ON_MOUNTED_KEY:c,ON_BEFORE_UPDATE_KEY:f,ON_UPDATED_KEY:h,ON_BEFORE_UNMOUNT_KEY:p,ON_UNMOUNTED_KEY:d,PROPS_KEY:m,STATE_KEY:v,SLOTS_KEY:g,ROOT_KEY:y,IS_PURE_SYMBOL:x,PARENT_KEY_SYMBOL:E,ATTRIBUTES_KEY_SYMBOL:b,TEMPLATE_KEY_SYMBOL:S});function C(e,t){return typeof e===t}function A(e){return C(e,"function")}function w(){return this}function T(e,t){t.forEach(t=>{e[t]=e[t].bind(e)});return e}function k(e){return A(e)?e.prototype&&e.prototype.constructor?new e:e():e}function _(e){return e.replace(/-(\w)/g,(e,t)=>t.toUpperCase())}function P(e,t){if(e.firstChild){t.appendChild(e.firstChild);P(e,t)}}function F(e){I(e.childNodes)}function I(e){Array.from(e).forEach(M)}function M(e){const{parentNode:t}=e;if(e.remove)e.remove();else if(t)t.removeChild(e)}const N=0;const L=1;const B=2;const O=3;const R=4;var j={EACH:N,IF:L,SIMPLE:B,TAG:O,SLOT:R};const U=0;const V=1;const G=2;const z=3;var X={ATTRIBUTE:U,EVENT:V,TEXT:G,VALUE:z};function J(e){const t=e.dom.cloneNode(true);return{avoidDOMInjection:true,fragment:t,children:Array.from(t.childNodes)}}const{indexOf:q}=[];const W=(e,t,r,n,i,a)=>{const s="selectedIndex"in t;let o=s;while(n<i){const i=e(r[n],1);t.insertBefore(i,a);if(s&&o&&i.selected){o=!o;let{selectedIndex:e}=t;t.selectedIndex=e<0?n:q.call(t.querySelectorAll("option"),i)}n++}};const H=(e,t)=>e==t;const K=e=>e;const $=(e,t,r,n,i,a,s)=>{const o=a-i;if(o<1)return-1;while(r-t>=o){let o=t;let l=i;while(o<r&&l<a&&s(e[o],n[l])){o++;l++}if(l===a)return t;t=o+1}return-1};const Y=(e,t,r,n,i,a)=>{while(n<i&&a(r[n],e[t-1])){n++;t--}return t===0};const Q=(e,t,r,n,i)=>r<n?e(t[r],0):0<r?e(t[r-1],-0).nextSibling:i;const Z=(e,t,r,n)=>{while(r<n)ue(e(t[r++],-1))};const ee=-1;const te=1;const re=0;const ne=50;const ie=(e,t,r,n,i,a,s,o)=>{let l=0;let u=n<o?n:o;const c=Array(u++);const f=Array(u);f[0]=-1;for(let e=1;e<u;e++)f[e]=s;const h=i.slice(a,s);for(let n=t;n<r;n++){const t=h.indexOf(e[n]);if(-1<t){const e=t+a;l=oe(f,u,e);if(-1<l){f[l]=e;c[l]={newi:n,oldi:e,prev:c[l-1]}}}}l=--u;--s;while(f[l]>s)--l;u=o+n-l;const p=Array(u);let d=c[l];--r;while(d){const{newi:e,oldi:t}=d;while(r>e){p[--u]=te;--r}while(s>t){p[--u]=ee;--s}p[--u]=re;--r;--s;d=d.prev}while(r>=t){p[--u]=te;--r}while(s>=a){p[--u]=ee;--s}return p};const ae=(e,t,r,n,i,a,s)=>{const o=r+a;const l=[];let u,c,f,h,p,d,m;e:for(u=0;u<=o;u++){if(u>ne)return null;m=u-1;p=u?l[u-1]:[0,0];d=l[u]=[];for(c=-u;c<=u;c+=2){if(c===-u||c!==u&&p[m+c-1]<p[m+c+1]){h=p[m+c+1]}else{h=p[m+c-1]+1}f=h-c;while(h<a&&f<r&&s(n[i+h],e[t+f])){h++;f++}if(h===a&&f===r){break e}d[u+c]=h}}const v=Array(u/2+o/2);let g=v.length-1;for(u=l.length-1;u>=0;u--){while(h>0&&f>0&&s(n[i+h-1],e[t+f-1])){v[g--]=re;h--;f--}if(!u)break;m=u-1;p=u?l[u-1]:[0,0];c=h-f;if(c===-u||c!==u&&p[m+c-1]<p[m+c+1]){f--;v[g--]=te}else{h--;v[g--]=ee}}return v};const se=(e,t,r,n,i,a,s,o,l)=>{const u=[];const c=e.length;let f=s;let h=0;while(h<c){switch(e[h++]){case re:i++;f++;break;case te:u.push(n[i]);W(t,r,n,i++,i,f<o?t(a[f],0):l);break;case ee:f++;break}}h=0;while(h<c){switch(e[h++]){case re:s++;break;case ee:if(-1<u.indexOf(a[s]))s++;else Z(t,a,s++,s);break}}};const oe=(e,t,r)=>{let n=1;let i=t;while(n<i){const t=(n+i)/2>>>0;if(r<e[t])i=t;else n=t+1}return n};const le=(e,t,r,n,i,a,s,o,l,u,c,f,h)=>{se(ae(r,n,a,s,o,u,f)||ie(r,n,i,a,s,o,l,u),e,t,r,n,s,o,c,h)};const ue=e=>(e.remo
  3. /*! (c) 2018 Andrea Giammarchi (ISC) */const fe=(e,t,r,n)=>{if(!n)n={};const i=n.compare||H;const a=n.node||K;const s=n.before==null?null:a(n.before,0);const o=t.length;let l=o;let u=0;let c=r.length;let f=0;while(u<l&&f<c&&i(t[u],r[f])){u++;f++}while(u<l&&f<c&&i(t[l-1],r[c-1])){l--;c--}const h=u===l;const p=f===c;if(h&&p)return r;if(h&&f<c){W(a,e,r,f,c,Q(a,t,u,o,s));return r}if(p&&u<l){Z(a,t,u,l);return r}const d=l-u;const m=c-f;let v=-1;if(d<m){v=$(r,f,c,t,u,l,i);if(-1<v){W(a,e,r,f,v,a(t[u],0));W(a,e,r,v+d,c,Q(a,t,l,o,s));return r}}else if(m<d){v=$(t,u,l,r,f,c,i);if(-1<v){Z(a,t,u,v);Z(a,t,v+m,l);return r}}if(d<2||m<2){W(a,e,r,f,c,a(t[u],0));Z(a,t,u,l);return r}if(d===m&&Y(r,c,t,u,l,i)){W(a,e,r,f,c,Q(a,t,l,o,s));return r}le(a,e,r,f,c,m,t,u,l,d,o,i,s);return r};function he(e,t){return typeof e===t}function pe(e){const t=e.ownerSVGElement;return!!t||t===null}function de(e){return!ye(e.content)}function me(e){return he(e,"function")}function ve(e){return he(e,"boolean")}function ge(e){return!ye(e)&&he(e,"object")}function ye(e){return e===null||e===undefined}const xe=Symbol("unmount");const Ee=Object.seal({nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:r,nodes:n,childrenMap:i}=this;const a=e===xe?null:this.evaluate(e);const s=a?Array.from(a):[];const o=r.parentNode;const{newChildrenMap:l,batches:u,futureNodes:c}=Ce(s,e,t,this);fe(o,n,c,{before:r,node:be(Array.from(i.values()),t)});u.forEach(e=>e());this.childrenMap=l;this.nodes=c;return this},unmount(e,t){this.update(xe,t);return this}});function be(e,t){return(r,n)=>{if(n<0){const r=e.pop();if(r){const{template:e,context:n}=r;e.unmount(n,t,null)}}return r}}function Se(e,t){return e?Boolean(e(t))===false:false}function De(e,t){let{itemName:r,indexName:n,index:i,item:a}=t;e[r]=a;if(n)e[n]=i;return e}function Ce(e,t,r,n){const{condition:i,template:a,childrenMap:s,itemName:o,getKey:l,indexName:u,root:c,isTemplateTag:f}=n;const h=new Map;const p=[];const d=[];e.forEach((e,n)=>{const m=De(Object.create(t),{itemName:o,indexName:u,index:n,item:e});const v=l?l(m):n;const g=s.get(v);if(Se(i,m)){return}const y=g?g.template:a.clone();const x=g?y.el:c.cloneNode();const E=!g;const b=f&&E?J(y):{};if(E){p.push(()=>y.mount(x,m,r,b))}else{p.push(()=>y.update(m,r))}if(f){const e=b.children||y.children;d.push(...e);e.forEach(e=>h.set(e,null))}else{d.push(x)}s.delete(v);h.set(v,{template:y,context:m,index:n})});return{newChildrenMap:h,batches:p,futureNodes:d}}function Ae(e,t){let{evaluate:r,condition:n,itemName:i,indexName:a,getKey:s,template:o}=t;const l=document.createTextNode("");const u=e.parentNode;const c=e.cloneNode();u.insertBefore(l,e);M(e);return Object.assign({},Ee,{childrenMap:new Map,node:e,root:c,condition:n,evaluate:r,isTemplateTag:de(c),template:o.createDOM(e),getKey:s,indexName:a,itemName:i,placeholder:l})}const we=Object.seal({mount(e,t){return this.update(e,t)},update(e,t){const r=!!this.evaluate(e);const n=!this.value&&r;const i=this.value&&!r;const a=()=>{const r=this.node.cloneNode();this.placeholder.parentNode.insertBefore(r,this.placeholder);this.template=this.template.clone();this.template.mount(r,e,t)};switch(true){case n:a();break;case i:this.unmount(e);break;default:if(r)this.template.update(e,t)}this.value=r;return this},unmount(e,t){this.template.unmount(e,t,true);return this}});function Te(e,t){let{evaluate:r,template:n}=t;const i=e.parentNode;const a=document.createTextNode("");i.insertBefore(a,e);M(e);return Object.assign({},we,{node:e,evaluate:r,placeholder:a,template:n.createDOM(e)})}function ke(e){const t=new Map;const r=r=>t.has(r)?t.get(r):t.set(r,e.call(this,r))&&t.get(r);r.cache=t;return r}function _e(e){return e.reduce((e,t)=>{const{value:r,type:n}=t;switch(true){case!t.name&&n===U:return Object.assign({},e,{},r);case n===z:e.value=t.value;break;default:e[_(t.name)]=t.value}return e},{})}const Pe="removeAttribute";const Fe="setAttribute";const Ie=typeof Element==="undefined"?{}:Element.prototype;const Me=ke(e=>Ie.hasOwnProperty(e));function Ne(e,t){Object.entries(t).forEach(t=>{let[r,n]=t;return Be(e,{name:r},n)})}function
  4. /*!
  5. * The buffer module from node.js, for the browser.
  6. *
  7. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  8. * @license MIT
  9. */var ce=50;pe.TYPED_ARRAY_SUPPORT=vr.TYPED_ARRAY_SUPPORT!==undefined?vr.TYPED_ARRAY_SUPPORT:true;function fe(){return pe.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function he(e,t){if(fe()<t){throw new RangeError("Invalid typed array length")}if(pe.TYPED_ARRAY_SUPPORT){e=new Uint8Array(t);e.__proto__=pe.prototype}else{if(e===null){e=new pe(t)}e.length=t}return e}function pe(e,t,r){if(!pe.TYPED_ARRAY_SUPPORT&&!(this instanceof pe)){return new pe(e,t,r)}if(typeof e==="number"){if(typeof t==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return ge(this,e)}return de(this,e,t,r)}pe.poolSize=8192;pe._augment=function(e){e.__proto__=pe.prototype;return e};function de(e,t,r,n){if(typeof t==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof ArrayBuffer!=="undefined"&&t instanceof ArrayBuffer){return Ee(e,t,r,n)}if(typeof t==="string"){return ye(e,t,r)}return be(e,t)}pe.from=function(e,t,r){return de(null,e,t,r)};if(pe.TYPED_ARRAY_SUPPORT){pe.prototype.__proto__=Uint8Array.prototype;pe.__proto__=Uint8Array}function me(e){if(typeof e!=="number"){throw new TypeError('"size" argument must be a number')}else if(e<0){throw new RangeError('"size" argument must not be negative')}}function ve(e,t,r,n){me(t);if(t<=0){return he(e,t)}if(r!==undefined){return typeof n==="string"?he(e,t).fill(r,n):he(e,t).fill(r)}return he(e,t)}pe.alloc=function(e,t,r){return ve(null,e,t,r)};function ge(e,t){me(t);e=he(e,t<0?0:Se(t)|0);if(!pe.TYPED_ARRAY_SUPPORT){for(var r=0;r<t;++r){e[r]=0}}return e}pe.allocUnsafe=function(e){return ge(null,e)};pe.allocUnsafeSlow=function(e){return ge(null,e)};function ye(e,t,r){if(typeof r!=="string"||r===""){r="utf8"}if(!pe.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}var n=Ce(t,r)|0;e=he(e,n);var i=e.write(t,r);if(i!==n){e=e.slice(0,i)}return e}function xe(e,t){var r=t.length<0?0:Se(t.length)|0;e=he(e,r);for(var n=0;n<r;n+=1){e[n]=t[n]&255}return e}function Ee(e,t,r,n){t.byteLength;if(r<0||t.byteLength<r){throw new RangeError("'offset' is out of bounds")}if(t.byteLength<r+(n||0)){throw new RangeError("'length' is out of bounds")}if(r===undefined&&n===undefined){t=new Uint8Array(t)}else if(n===undefined){t=new Uint8Array(t,r)}else{t=new Uint8Array(t,r,n)}if(pe.TYPED_ARRAY_SUPPORT){e=t;e.__proto__=pe.prototype}else{e=xe(e,t)}return e}function be(e,t){if(De(t)){var r=Se(t.length)|0;e=he(e,r);if(e.length===0){return e}t.copy(e,0,0,r);return e}if(t){if(typeof ArrayBuffer!=="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t){if(typeof t.length!=="number"||at(t.length)){return he(e,0)}return xe(e,t)}if(t.type==="Buffer"&&ue(t.data)){return xe(e,t.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Se(e){if(e>=fe()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+fe().toString(16)+" bytes")}return e|0}pe.isBuffer=st;function De(e){return!!(e!=null&&e._isBuffer)}pe.compare=function e(t,r){if(!De(t)||!De(r)){throw new TypeError("Arguments must be Buffers")}if(t===r)return 0;var n=t.length;var i=r.length;for(var a=0,s=Math.min(n,i);a<s;++a){if(t[a]!==r[a]){n=t[a];i=r[a];break}}if(n<i)return-1;if(i<n)return 1;return 0};pe.isEncoding=function e(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};pe.concat=function e(t,r){if(!ue(t)){throw new TypeError('"list" argument must be an Array of Buffers')}if(t.length===0){return pe.alloc(0)}var n;if(r===undefined){r=0;for(n=0;n<t.length;++n){r+=t[n].length}}var i=pe.allocUnsafe(r);var a=0;for(n=0;n<t.length;++n){var s=t[n];if(!De(s)){throw new TypeError('"list" argument must be an Array of Buffers')}s.copy(i,a);a+=s.length}return i};function Ce(e,t){if(De(e)){return e.length}if(typeof ArrayBuffer!=="undefined"&&typeof ArrayBuffer.isView==="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)){return e.byteL