/* Riot v4.0.0-alpha.5, @license MIT */(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.riot={}))})(this,function(a){"use strict";function b(a,b){return typeof a===b}function c(a){return b(a,"function")}function d(a){return b(a,"string")}function e(a,b){return d(a)?Array.from((b||document).querySelectorAll(a)):g(a)}function f(a,b){return d(a)?(b||document).querySelector(a):a}function g(a){return Array.isArray(a)?a:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(a))&&"number"==typeof a.length?Array.from(a):[a]}function h(a,b){return a.getAttribute(b)}function i(a,b,c){d(c)&&a.setAttribute(b,c)}function j(a){return Array.from(a.attributes).reduce((a,b)=>(a[b.name]=b.value,a),{})}function k(a){return h(a,ha)||a.tagName.toLowerCase()}function l(a){throw new Error(a)}function m(a){return c(a)?a.constructor.name?new a:a():a}function n(a,b){return Object.entries(b).forEach(([b,c])=>{a[b]||(a[b]=c)}),a}function o(){return this}function p(a,b){return b.forEach(b=>{a[b]=a[b].bind(a)}),a}function q(a,b,c,d={}){return Object.defineProperty(a,b,{value:c,enumerable:!1,writable:!1,configurable:!0,...d}),a}function r(a,b,c){return Object.entries(b).forEach(([b,d])=>{q(a,b,d,c)}),a}function s(a,b){return a.reduce((a,c)=>{const d=c.evaluate(b);return c.name?a[c.name]=d:Object.assign(a,d),a},{})}function t(a){const b=a.childNodes;b.forEach(b=>a.removeChild(b))}function u(a,b){return!!a&&!1===!!a(b)}function v({itemName:a,indexName:b,index:c,item:d,scope:e}){const f={[a]:d,...e};return b?{[b]:c,...f}:f}function w(a,b,c){const{condition:d,template:e,childrenMap:f,itemName:g,getKey:h,indexName:j,root:k}=c,l=new Set,m=new Map,n=[],o=[];return a.forEach((a,c)=>{const i=c-l.size,p=v({itemName:g,indexName:j,index:i,item:a,scope:b}),q=h?h(p):i,r=f.get(q);if(u(d,p))return void l.add(r);const s=r?r.tag:e.clone(),t=r?s.el:k.cloneNode();r?n.push(()=>s.update(p)):n.push(()=>s.mount(t,p)),o.push(t),m.set(q,{tag:s,context:p,index:i})}),{newChildrenMap:m,batches:n,futureNodes:o}}function x(a,b){const c=b.parentNode;c.insertBefore(a,b),c.removeChild(b)}function y(a,b){Object.entries(b).forEach(([b,c])=>A(a,{name:b},c))}function z(a,b){Object.keys(b).forEach(b=>a.removeAttribute(b))}function A(a,{name:b},c,d){return b?void("boolean"==typeof c&&(a[b]=c),a[B(c)](b,C(b,c))):void(c?y(a,c):d&&z(a,d))}function B(a){return a&&"object"!=typeof a?Na:Ma}function C(a,b){return!0===b?a:b}function D(a){return null==a?"":a}function E(a,b){return Oa[a.type](a.node,a,b,a.value)}function F(a,b){return{...Pa,...b,node:a}}function G(a,b,c){return b.reduce((b,d)=>({...b,[d]:b=>a.map(a=>a[d](b))&&c}),{})}function H(a,b=[],c=[]){return a?a({slots:b,attributes:c}):S(J(b),[...I(b),{expressions:c.map(a=>({type:Ha,...a}))}])}function I(a){return a.reduce((a,{bindings:b})=>a.concat(b),[])}function J(a){return a.reduce((a,b)=>a+b.html,"")}function K(a,b){const{selector:c,type:d,redundantAttribute:e,expressions:f}=b,g=c?a.querySelector(c):a;return e&&g.removeAttribute(e),(Ra[d]||Ra[ka])(g,{...b,expressions:f||[]})}function L(a){const b=a.ownerSVGElement;return!!b||null===b}function M(a){const b=document.createElement("template");return b.innerHTML=a,b.content}function N(a,b){const c=b.ownerDocument.importNode(new window.DOMParser().parseFromString(``,"application/xml").documentElement,!0);return c}function O(a,b){return L(a)?N(b,a):M(b)}function P(a,b){a.firstChild&&(b.appendChild(a.firstChild),P(a,b))}function Q(a,b){Sa.test(a.tagName)?P(b,a):a.appendChild(b)}function R(a,b){return b&&("string"==typeof b?O(a,b):b)}function S(a,b=[]){return{...Ta,html:a,bindingsData:b}}function T(a){a.firstChild&&(a.parentNode.insertBefore(a.firstChild,a),T(a)),a.parentNode&&a.parentNode.removeChild(a)}function U(a,b,{name:c,slots:d}){const e=d.find(({id:a})=>a===c);return{...Ua,node:b,name:c,template:e&&S(e.html,e.bindings).createDOM(a)}}function V(a,b){const c=e("slot",a),d=c.map(c=>{const d=h(c,"name")||"default";return U(a,c,{name:d,slots:b})});return{mount(a){return d.forEach(b=>b.mount(a)),this},update(a){return d.forEach(b=>b.update(a)),this},unmount(a){return d.forEach(b=>b.unmount(a)),this}}}function W(a,...b){return(...c)=>(c=[...b,...c],c.length{const f=Y({css:a,template:b,tag:c,name:d})(e);return{mount(a,b,c){return f.mount(a,c,b)},update(a,b){return f.update(b,a)},unmount(){return f.unmount()}}}}function Y({css:a,template:b,tag:c,name:d}){const e=m(c)||{},f=_(e.components);return a&&d&&Ya.add(d,a),W(ca)(r(n(e,{...$a,state:{}}),{slots:null,root:null,...Za,css:a,template:b?b(S,La,ma,a=>f[a]||ea.get(a)):_a}))}function Z(a,b=[],c,d){return b.length?c?s(b,c):d:j(a)}function $(a){return S(null,[{expressions:(a||[]).map(a=>({type:La.ATTRIBUTE,...a}))}])}function _(a={}){return Object.entries(m(a)).reduce((a,[b,c])=>(a[b]=X({name:b,...c}),a),{})}function aa(a){return[...ga].reduce((a,b)=>b(a)||a,a)}function ba(a,b){return{...a,...m(b)}}function ca(a,{slots:b,attributes:d}){const e=$(d);return p(aa(r(Object.create(a),{mount(a,c={},f){return this.props=Z(a,d,f,{}),this.state=ba(this.state,c),r(this,{root:a,attributes:e.createDOM(a).clone(),template:this.template.createDOM(a).clone()}),a[fa]=this,this.onBeforeMount(),this.attributes.mount(a,f),this.template.mount(a,this),q(this,"slots",V(a,b||[])),this.slots.mount(f),this.onMounted(),this},update(a={},b){const c=Z(this.root,d,b,this.props);if(!1!==this.shouldUpdate(c,this.props))return this.onBeforeUpdate(),this.props=c,this.state=ba(this.state,a),b&&(this.attributes.update(b),this.slots.update(b)),this.template.update(this),this.onUpdated(),this},unmount(a){return this.onBeforeUnmount(),this.attributes.unmount(),this.slots.unmount(),this.template.unmount(this,!0===a),this.onUnmounted(),this}})),Object.keys(a).filter(b=>c(a[b])))}function da(a,b,c){const d=c||k(a);ea.has(d)||l(`The component named "${d}" was never registered`);const e=ea.get(d)({});return e.mount(a,{},b)}const ea=new Map,fa=Symbol("riot-component"),ga=new Set,ha="is";var ia=Object.freeze({COMPONENTS_IMPLEMENTATION_MAP:ea,DOM_COMPONENT_INSTANCE_PROPERTY:fa,PLUGINS_SET:ga,IS_DIRECTIVE:"is"});const ja=1,ka=2,la=3;var ma={EACH:0,IF:ja,SIMPLE:ka,TAG:la},na={};/*! (c) Andrea Giammarchi - ISC */try{na.Map=Map}catch(a){na.Map=function(){function a(a){return b=c.indexOf(a),-1{if(2>e-d)b.insertBefore(a(c[d],1),f);else{const g=b.ownerDocument.createDocumentFragment();for(;dc==a,ra=a=>a,sa=(a,b,c,d,e,f,g)=>{const h=f-e;if(1>h)return-1;for(;c-b>=h;){let h=b,i=e;for(;h{for(;dc{if(2>e-d)b.removeChild(a(c[d],-1));else{const f=b.ownerDocument.createRange();f.setStartBefore(a(c[d],-1)),f.setEndAfter(a(c[e-1],-1)),f.deleteContents()}},wa=-1,xa=1,ya=0,za=(a,b,c,d,e,f,g,h)=>{let j=0,l=dg;)--j;l=h+d-j;const p=Array(l);let q=m[j];for(--c;q;){const{newi:a,oldi:b}=q;for(;c>a;)p[--l]=xa,--c;for(;g>b;)p[--l]=wa,--g;p[--l]=ya,--c,--g,q=q.prev}for(;c>=b;)p[--l]=xa,--c;for(;g>=f;)p[--l]=wa,--g;return p},Aa=(a,b,e,f,g,h,i)=>{const j=e+h,l=[];let m,n,o,p,q,s,t;outer:for(m=0;m<=j;m++){if(m>50)return null;for(t=m-1,q=m?l[m-1]:[0,0],s=l[m]=[],n=-m;n<=m;n+=2){for(p=n===-m||n!==m&&q[t+n-1]{const k=new oa,l=a.length;let m=g,n=0;for(;n{let d=1,e=b;for(;d>>0;c{Ba(Aa(c,d,f,g,h,j,l)||za(c,d,e,f,g,h,i,j),a,b,c,d,g,h,k,m)},Ea=(a,b,c,d)=>{d||(d={});const e=d.compare||qa,f=d.node||ra,g=null==d.before?null:f(d.before,0),h=b.length;let j=h,k=0,l=c.length,m=0;for(;kp||2>q?(pa(f,a,c,m,l,f(b[k],0)),va(f,a,b,k,j),c):p===q&&ta(c,l,b,k,j,e)?(pa(f,a,c,m,l,ua(f,b,j,h,g)),c):(Da(f,a,c,m,l,q,b,k,j,p,h,e,g),c)},Fa=Object.seal({childrenMap:null,node:null,root:null,condition:null,evaluate:null,template:null,tags:[],getKey:null,indexName:null,itemName:null,afterPlaceholder:null,placeholder:null,mount(a){return this.update(a)},update(a){const{placeholder:b}=this,c=this.evaluate(a),d=c?Array.from(c):[],e=b.parentNode,{newChildrenMap:f,batches:g,futureNodes:h}=w(d,a,this),i=this.tags[this.tags.length-1];return Ea(e,this.tags,h,{before:i?i.nextSibling:b.nextSibling}),g.forEach(a=>a()),this.childrenMap=f,this.tags=h,this},unmount(){return Array.from(this.childrenMap.values()).forEach(({tag:a,context:b})=>{a.unmount(b,!0)}),this.childrenMap=new Map,this.tags=[],this}}),Ga=Object.seal({node:null,evaluate:null,placeholder:null,template:"",mount(a){return x(this.placeholder,this.node),this.update(a)},update(a){const b=!!this.evaluate(a),c=!this.value&&b,d=this.value&&!b;switch(!0){case c:x(this.node,this.placeholder),this.template&&(this.template=this.template.clone(),this.template.mount(this.node,a));break;case d:x(this.placeholder,this.node),this.unmount(a);break;default:b&&this.template.update(a);}return this.value=b,this},unmount(a){const{template:b}=this;return b&&b.unmount(a),this}}),Ha=0,Ia=1,Ja=2,Ka=3;var La={ATTRIBUTE:Ha,EVENT:Ia,TEXT:Ja,VALUE:Ka};const Ma="removeAttribute",Na="setAttribute";var Oa={[Ha]:A,[Ia]:function(a,{name:b},c){a[b]=c},[Ja]:function(a,{childNodeIndex:b},c){const d=a.childNodes[b],e=D(c);if(d.nodeType===Node.COMMENT_NODE){const b=document.createTextNode(e);a.replaceChild(b,d)}else d.data=D(e)},[Ka]:function(a,b,c){a.value=c}};const Pa=Object.seal({node:null,value:null,mount(a){return this.value=this.evaluate(a),E(this,this.value),this},update(a){const b=this.evaluate(a);return this.value!==b&&(E(this,b),this.value=b),this},unmount(){return this}}),Qa=Object.seal({node:null,evaluate:null,name:null,slots:null,tag:null,attributes:null,getComponent:null,mount(a){return this.update(a)},update(a){const b=this.evaluate(a);return b===this.name?this.tag.update(a):(this.tag&&this.tag.unmount(a),this.name=b,this.tag=H(this.getComponent(b),this.slots,this.attributes),this.tag.mount(this.node,a)),this},unmount(a){return this.tag&&this.tag.unmount(a),this}});var Ra={[ja]:function(a,{evaluate:b,template:c}){return{...Ga,node:a,evaluate:b,placeholder:document.createTextNode(""),template:c.createDOM(a)}},[ka]:function(a,{expressions:b}){return{...G(b.map(b=>F(a,b)),["mount","update","unmount"])}},[0]:function(a,{evaluate:b,condition:c,itemName:d,indexName:e,getKey:f,template:g}){const h=document.createTextNode(""),i=a.parentNode,j=a.cloneNode(),k=Array.from(i.childNodes).indexOf(a);return i.insertBefore(h,a),i.removeChild(a),{...Fa,childrenMap:new Map,node:a,root:j,offset:k,condition:c,evaluate:b,template:g.createDOM(a),getKey:f,indexName:e,itemName:d,placeholder:h}},[la]:function(a,{evaluate:b,getComponent:c,slots:d,attributes:e}){return{...Qa,node:a,evaluate:b,slots:d,attributes:e,getComponent:c}}};const Sa=/svg/i,Ta=Object.freeze({bindings:null,bindingsData:null,html:null,dom:null,el:null,createDOM(a){return this.dom=this.dom||R(a,this.html),this},mount(a,c){if(!a)throw new Error("Please provide DOM node to mount properly your template");return this.el&&this.unmount(c),this.el=a,this.createDOM(a),this.dom&&Q(a,this.dom.cloneNode(!0)),this.bindings=this.bindingsData.map(a=>K(this.el,a)),this.bindings.forEach(a=>a.mount(c)),this},update(a){return this.bindings.forEach(c=>c.update(a)),this},unmount(a,b){return this.el&&(this.bindings.forEach(c=>c.unmount(a)),t(this.el),b&&this.el.parentNode.removeChild(this.el),this.el=null),this},clone(){return{...this,el:null}}}),Ua=Object.seal({node:null,name:null,template:null,mount(a){return this.template?(this.template.mount(this.node,a),T(this.node)):this.node.parentNode.removeChild(this.node),this},update(a){return this.template?(this.template.update(a),this):this},unmount(a){return this.template?(this.template.unmount(a),this):this}}),Va=function(){return"undefined"==typeof window?void 0:window}(),Wa=new Map,Xa=Va&&(()=>{const a=document.createElement("style");return i(a,"type","text/css"),document.head.appendChild(a),a})();var Ya={add(a,b){return Wa.has(a)||Wa.set(a,b),this.inject(),this},inject(){return Xa?(Xa.innerHTML=[...Wa.values()].join("\n"),this):this},remove(a){return Xa?(Wa.has(a)&&(Wa.delete(a),this.inject()),this):this}};const Za=Object.freeze({$(a){return f(a,this.root)},$$(a){return e(a,this.root)},ref(a){return e(a,this.root).map(a=>a[fa]||a)}}),$a=Object.freeze({shouldUpdate:o,onBeforeMount:o,onMounted:o,onBeforeUpdate:o,onUpdated:o,onBeforeUnmount:o,onUnmounted:o}),_a={update:o,mount:o,unmount:o,clone:o,createDOM:o};const{DOM_COMPONENT_INSTANCE_PROPERTY:ab,COMPONENTS_IMPLEMENTATION_MAP:bb,PLUGINS_SET:cb}=ia,db=((...a)=>a.reduce((a,b)=>(...c)=>a(b(...c))))(a=>a({}),X);a.register=function(a,{css:b,template:c,tag:d}){return bb.has(a)&&l(`The component "${a}" was already registered`),bb.set(a,X({name:a,css:b,template:c,tag:d})),bb},a.unregister=function(a){return bb.has(a)||l(`The component "${a}" was never registered`),bb.delete(a),Ya.remove(a),bb},a.mount=function(a,b,c){return e(a).map(a=>da(a,b,c))},a.unmount=function(a){return e(a).map(a=>(a[ab]&&a[ab].unmount(),a))},a.install=function(a){return c(a)||l("Plugins must be of type function"),cb.has(a)&&l("This plugin was already install"),cb.add(a),cb},a.uninstall=function(a){return cb.has(a)||l("This plugin was never installed"),cb.delete(a),cb},a.component=db,a.version="v4.0.0-alpha.5",a.__={cssManager:Ya,defineComponent:Y,globals:ia},Object.defineProperty(a,"__esModule",{value:!0})});