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