-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathel.min.js
2 lines (2 loc) · 59.2 KB
/
el.min.js
1
2
var El=function(){"use strict";function toString(obj){return Object.prototype.toString.call(obj)}var isFunction;var isFunction$1=isFunction=function(value){var str;if(typeof window!=="undefined"&&value===window.alert){return true}str=toString(value);return str==="[object Function]"||str==="[object GeneratorFunction]"||str==="[object AsyncFunction]"};const __TAGS_CACHE=[];const __TAG_IMPL={};const YIELD_TAG="yield";const GLOBAL_MIXIN="__global_mixin";const ATTRS_PREFIX="riot-";const REF_DIRECTIVES=["ref","data-ref"];const IS_DIRECTIVE="data-is";const CONDITIONAL_DIRECTIVE="if";const LOOP_DIRECTIVE="each";const LOOP_NO_REORDER_DIRECTIVE="no-reorder";const SHOW_DIRECTIVE="show";const HIDE_DIRECTIVE="hide";const KEY_DIRECTIVE="key";const RIOT_EVENTS_KEY="__riot-events__";const T_STRING="string";const T_OBJECT="object";const T_UNDEF="undefined";const T_FUNCTION="function";const XLINK_NS="http://www.w3.org/1999/xlink";const SVG_NS="http://www.w3.org/2000/svg";const XLINK_REGEX=/^xlink:(\w+)/;const WIN=typeof window===T_UNDEF?undefined:window;const RE_SPECIAL_TAGS=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/;const RE_SPECIAL_TAGS_NO_OPTION=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/;const RE_EVENTS_PREFIX=/^on/;const RE_HTML_ATTRS=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g;const CASE_SENSITIVE_ATTRIBUTES={viewbox:"viewBox",preserveaspectratio:"preserveAspectRatio"};const RE_BOOL_ATTRS=/^(?:disabled|checked|readonly|required|allowfullscreen|auto(?:focus|play)|compact|controls|default|formnovalidate|hidden|ismap|itemscope|loop|multiple|muted|no(?:resize|shade|validate|wrap)?|open|reversed|seamless|selected|sortable|truespeed|typemustmatch)$/;const IE_VERSION=(WIN&&WIN.document||{}).documentMode|0;function $$(selector,ctx){return[].slice.call((ctx||document).querySelectorAll(selector))}function $(selector,ctx){return(ctx||document).querySelector(selector)}function createFrag(){return document.createDocumentFragment()}function createDOMPlaceholder(){return document.createTextNode("")}function isSvg(el){const owner=el.ownerSVGElement;return!!owner||owner===null}function mkEl(name){return name==="svg"?document.createElementNS(SVG_NS,name):document.createElement(name)}function setInnerHTML(container,html,isSvg){if(isSvg){const node=container.ownerDocument.importNode((new DOMParser).parseFromString(`<svg xmlns="${SVG_NS}">${html}</svg>`,"application/xml").documentElement,true);container.appendChild(node)}else{container.innerHTML=html}}function toggleVisibility(dom,show){dom.style.display=show?"":"none";dom.hidden=show?false:true}function remAttr(dom,name){dom.removeAttribute(name)}function styleObjectToString(style){return Object.keys(style).reduce((acc,prop)=>{return`${acc} ${prop}: ${style[prop]};`},"")}function getAttr(dom,name){return dom.getAttribute(name)}function setAttr(dom,name,val){const xlink=XLINK_REGEX.exec(name);if(xlink&&xlink[1])dom.setAttributeNS(XLINK_NS,xlink[1],val);else dom.setAttribute(name,val)}function safeInsert(root,curr,next){root.insertBefore(curr,next.parentNode&&next)}function walkAttrs(html,fn){if(!html)return;let m;while(m=RE_HTML_ATTRS.exec(html))fn(m[1].toLowerCase(),m[2]||m[3]||m[4])}function walkNodes(dom,fn,context){if(dom){const res=fn(dom,context);let next;if(res===false)return;dom=dom.firstChild;while(dom){next=dom.nextSibling;walkNodes(dom,fn,res);dom=next}}}var dom=Object.freeze({$$:$$,$:$,createFrag:createFrag,createDOMPlaceholder:createDOMPlaceholder,isSvg:isSvg,mkEl:mkEl,setInnerHTML:setInnerHTML,toggleVisibility:toggleVisibility,remAttr:remAttr,styleObjectToString:styleObjectToString,getAttr:getAttr,setAttr:setAttr,safeInsert:safeInsert,walkAttrs:walkAttrs,walkNodes:walkNodes});let styleNode;let cssTextProp;let byName={};let remainder=[];let needsInject=false;if(WIN){styleNode=(()=>{const newNode=mkEl("style");const userNode=$("style[type=riot]");setAttr(newNode,"type","text/css");if(userNode){if(userNode.id)newNode.id=userNode.id;userNode.parentNode.replaceChild(newNode,userNode)}else document.head.appendChild(newNode);return newNode})();cssTextProp=styleNode.styleSheet}var styleManager={styleNode:styleNode,add(css,name){if(name)byName[name]=css;else remainder.push(css);needsInject=true},inject(){if(!WIN||!needsInject)return;needsInject=false;const style=Object.keys(byName).map(k=>byName[k]).concat(remainder).join("\n");if(cssTextProp)cssTextProp.cssText=style;else styleNode.innerHTML=style}};var skipRegex=function(){var beforeReChars="[{(,;:?=|&!^~>%*/";var beforeReWords=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"];var wordsLastChar=beforeReWords.reduce(function(s,w){return s+w.slice(-1)},"");var RE_REGEX=/^\/(?=[^*>\/])[^[\/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\\/]*)*?\/[gimuy]*/;var RE_VN_CHAR=/[$\w]/;function prev(code,pos){while(--pos>=0&&/\s/.test(code[pos]));return pos}function _skipRegex(code,start){var re=/.*/g;var pos=re.lastIndex=start++;var match=re.exec(code)[0].match(RE_REGEX);if(match){var next=pos+match[0].length;pos=prev(code,pos);var c=code[pos];if(pos<0||~beforeReChars.indexOf(c)){return next}if(c==="."){if(code[pos-1]==="."){start=next}}else if(c==="+"||c==="-"){if(code[--pos]!==c||(pos=prev(code,pos))<0||!RE_VN_CHAR.test(code[pos])){start=next}}else if(~wordsLastChar.indexOf(c)){var end=pos+1;while(--pos>=0&&RE_VN_CHAR.test(code[pos]));if(~beforeReWords.indexOf(code.slice(pos+1,end))){start=next}}}return start}return _skipRegex}();var brackets=function(UNDEF){var REGLOB="g",R_MLCOMMS=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,R_STRINGS=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,S_QBLOCKS=R_STRINGS.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,UNSUPPORTED=RegExp("[\\"+"x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),NEED_ESCAPE=/(?=[[\]()*+?.^$|])/g,S_QBLOCK2=R_STRINGS.source+"|"+/(\/)(?![*\/])/.source,FINDBRACES={"(":RegExp("([()])|"+S_QBLOCK2,REGLOB),"[":RegExp("([[\\]])|"+S_QBLOCK2,REGLOB),"{":RegExp("([{}])|"+S_QBLOCK2,REGLOB)},DEFAULT="{ }";var _pairs=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+S_QBLOCK2,REGLOB),DEFAULT,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/];var cachedBrackets=UNDEF,_regex,_cache=[],_settings;function _loopback(re){return re}function _rewrite(re,bp){if(!bp)bp=_cache;return new RegExp(re.source.replace(/{/g,bp[2]).replace(/}/g,bp[3]),re.global?REGLOB:"")}function _create(pair){if(pair===DEFAULT)return _pairs;var arr=pair.split(" ");if(arr.length!==2||UNSUPPORTED.test(pair)){throw new Error('Unsupported brackets "'+pair+'"')}arr=arr.concat(pair.replace(NEED_ESCAPE,"\\").split(" "));arr[4]=_rewrite(arr[1].length>1?/{[\S\s]*?}/:_pairs[4],arr);arr[5]=_rewrite(pair.length>3?/\\({|})/g:_pairs[5],arr);arr[6]=_rewrite(_pairs[6],arr);arr[7]=RegExp("\\\\("+arr[3]+")|([[({])|("+arr[3]+")|"+S_QBLOCK2,REGLOB);arr[8]=pair;return arr}function _brackets(reOrIdx){return reOrIdx instanceof RegExp?_regex(reOrIdx):_cache[reOrIdx]}_brackets.split=function split(str,tmpl,_bp){if(!_bp)_bp=_cache;var parts=[],match,isexpr,start,pos,re=_bp[6];var qblocks=[];var prevStr="";var mark,lastIndex;isexpr=start=re.lastIndex=0;while(match=re.exec(str)){lastIndex=re.lastIndex;pos=match.index;if(isexpr){if(match[2]){var ch=match[2];var rech=FINDBRACES[ch];var ix=1;rech.lastIndex=lastIndex;while(match=rech.exec(str)){if(match[1]){if(match[1]===ch)++ix;else if(!--ix)break}else{rech.lastIndex=pushQBlock(match.index,rech.lastIndex,match[2])}}re.lastIndex=ix?str.length:rech.lastIndex;continue}if(!match[3]){re.lastIndex=pushQBlock(pos,lastIndex,match[4]);continue}}if(!match[1]){unescapeStr(str.slice(start,pos));start=re.lastIndex;re=_bp[6+(isexpr^=1)];re.lastIndex=start}}if(str&&start<str.length){unescapeStr(str.slice(start))}parts.qblocks=qblocks;return parts;function unescapeStr(s){if(prevStr){s=prevStr+s;prevStr=""}if(tmpl||isexpr){parts.push(s&&s.replace(_bp[5],"$1"))}else{parts.push(s)}}function pushQBlock(_pos,_lastIndex,slash){if(slash){_lastIndex=skipRegex(str,_pos)}if(tmpl&&_lastIndex>_pos+2){mark="⁗"+qblocks.length+"~";qblocks.push(str.slice(_pos,_lastIndex));prevStr+=str.slice(start,_pos)+mark;start=_lastIndex}return _lastIndex}};_brackets.hasExpr=function hasExpr(str){return _cache[4].test(str)};_brackets.loopKeys=function loopKeys(expr){var m=expr.match(_cache[9]);return m?{key:m[1],pos:m[2],val:_cache[0]+m[3].trim()+_cache[1]}:{val:expr.trim()}};_brackets.array=function array(pair){return pair?_create(pair):_cache};function _reset(pair){if((pair||(pair=DEFAULT))!==_cache[8]){_cache=_create(pair);_regex=pair===DEFAULT?_loopback:_rewrite;_cache[9]=_regex(_pairs[9])}cachedBrackets=pair}function _setSettings(o){var b;o=o||{};b=o.brackets;Object.defineProperty(o,"brackets",{set:_reset,get:function(){return cachedBrackets},enumerable:true});_settings=o;_reset(b)}Object.defineProperty(_brackets,"settings",{set:_setSettings,get:function(){return _settings}});_brackets.settings=typeof riot!=="undefined"&&riot.settings||{};_brackets.set=_reset;_brackets.skipRegex=skipRegex;_brackets.R_STRINGS=R_STRINGS;_brackets.R_MLCOMMS=R_MLCOMMS;_brackets.S_QBLOCKS=S_QBLOCKS;_brackets.S_QBLOCK2=S_QBLOCK2;return _brackets}();var tmpl=function(){var _cache={};function _tmpl(str,data){if(!str)return str;return(_cache[str]||(_cache[str]=_create(str))).call(data,_logErr.bind({data:data,tmpl:str}))}_tmpl.hasExpr=brackets.hasExpr;_tmpl.loopKeys=brackets.loopKeys;_tmpl.clearCache=function(){_cache={}};_tmpl.errorHandler=null;function _logErr(err,ctx){err.riotData={tagName:ctx&&ctx.__&&ctx.__.tagName,_riot_id:ctx&&ctx._riot_id};if(_tmpl.errorHandler)_tmpl.errorHandler(err);else if(typeof console!=="undefined"&&typeof console.error==="function"){console.error(err.message);console.log("<%s> %s",err.riotData.tagName||"Unknown tag",this.tmpl);console.log(this.data)}}function _create(str){var expr=_getTmpl(str);if(expr.slice(0,11)!=="try{return ")expr="return "+expr;return new Function("E",expr+";")}var RE_DQUOTE=/\u2057/g;var RE_QBMARK=/\u2057(\d+)~/g;function _getTmpl(str){var parts=brackets.split(str.replace(RE_DQUOTE,'"'),1);var qstr=parts.qblocks;var expr;if(parts.length>2||parts[0]){var i,j,list=[];for(i=j=0;i<parts.length;++i){expr=parts[i];if(expr&&(expr=i&1?_parseExpr(expr,1,qstr):'"'+expr.replace(/\\/g,"\\\\").replace(/\r\n?|\n/g,"\\n").replace(/"/g,'\\"')+'"'))list[j++]=expr}expr=j<2?list[0]:"["+list.join(",")+'].join("")'}else{expr=_parseExpr(parts[1],0,qstr)}if(qstr.length){expr=expr.replace(RE_QBMARK,function(_,pos){return qstr[pos].replace(/\r/g,"\\r").replace(/\n/g,"\\n")})}return expr}var RE_CSNAME=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/;var RE_BREND={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g};function _parseExpr(expr,asText,qstr){expr=expr.replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1");if(expr){var list=[],cnt=0,match;while(expr&&(match=expr.match(RE_CSNAME))&&!match.index){var key,jsb,re=/,|([[{(])|$/g;expr=RegExp.rightContext;key=match[2]?qstr[match[2]].slice(1,-1).trim().replace(/\s+/g," "):match[1];while(jsb=(match=re.exec(expr))[1])skipBraces(jsb,re);jsb=expr.slice(0,match.index);expr=RegExp.rightContext;list[cnt++]=_wrapExpr(jsb,1,key)}expr=!cnt?_wrapExpr(expr,asText):cnt>1?"["+list.join(",")+'].join(" ").trim()':list[0]}return expr;function skipBraces(ch,re){var mm,lv=1,ir=RE_BREND[ch];ir.lastIndex=re.lastIndex;while(mm=ir.exec(expr)){if(mm[0]===ch)++lv;else if(!--lv)break}re.lastIndex=lv?expr.length:ir.lastIndex}}var JS_CONTEXT='"in this?this:'+(typeof window!=="object"?"global":"window")+").",JS_VARNAME=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,JS_NOPROPS=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;function _wrapExpr(expr,asText,key){var tb;expr=expr.replace(JS_VARNAME,function(match,p,mvar,pos,s){if(mvar){pos=tb?0:pos+match.length;if(mvar!=="this"&&mvar!=="global"&&mvar!=="window"){match=p+'("'+mvar+JS_CONTEXT+mvar;if(pos)tb=(s=s[pos])==="."||s==="("||s==="["}else if(pos){tb=!JS_NOPROPS.test(s.slice(pos))}}return match});if(tb){expr="try{return "+expr+"}catch(e){E(e,this)}"}if(key){expr=(tb?"function(){"+expr+"}.call(this)":"("+expr+")")+'?"'+key+'":""'}else if(asText){expr="function(v){"+(tb?expr.replace("return ","v="):"v=("+expr+")")+';return v||v===0?v:""}.call(this)'}return expr}_tmpl.version=brackets.version="v3.0.8";return _tmpl}();var observable$1=function(el){el=el||{};var callbacks={},slice=Array.prototype.slice;Object.defineProperties(el,{on:{value:function(event,fn){if(typeof fn=="function")(callbacks[event]=callbacks[event]||[]).push(fn);return el},enumerable:false,writable:false,configurable:false},off:{value:function(event,fn){if(event=="*"&&!fn)callbacks={};else{if(fn){var arr=callbacks[event];for(var i=0,cb;cb=arr&&arr[i];++i){if(cb==fn)arr.splice(i--,1)}}else delete callbacks[event]}return el},enumerable:false,writable:false,configurable:false},one:{value:function(event,fn){function on(){el.off(event,on);fn.apply(el,arguments)}return el.on(event,on)},enumerable:false,writable:false,configurable:false},trigger:{value:function(event){var arglen=arguments.length-1,args=new Array(arglen),fns,fn,i;for(i=0;i<arglen;i++){args[i]=arguments[i+1]}fns=slice.call(callbacks[event]||[],0);for(i=0;fn=fns[i];++i){fn.apply(el,args)}if(callbacks["*"]&&event!="*")el.trigger.apply(el,["*",event].concat(args));return el},enumerable:false,writable:false,configurable:false}});return el};function isBoolAttr(value){return RE_BOOL_ATTRS.test(value)}function isFunction$2(value){return typeof value===T_FUNCTION}function isObject(value){return value&&typeof value===T_OBJECT}function isUndefined(value){return typeof value===T_UNDEF}function isString(value){return typeof value===T_STRING}function isBlank(value){return isNil(value)||value===""}function isNil(value){return isUndefined(value)||value===null}function isArray(value){return Array.isArray(value)||value instanceof Array}function isWritable(obj,key){const descriptor=getPropDescriptor(obj,key);return isUndefined(obj[key])||descriptor&&descriptor.writable}var check=Object.freeze({isBoolAttr:isBoolAttr,isFunction:isFunction$2,isObject:isObject,isUndefined:isUndefined,isString:isString,isBlank:isBlank,isNil:isNil,isArray:isArray,isWritable:isWritable});function each(list,fn){const len=list?list.length:0;let i=0;for(;i<len;i++)fn(list[i],i);return list}function contains(array,item){return array.indexOf(item)!==-1}function toCamel(str){return str.replace(/-(\w)/g,(_,c)=>c.toUpperCase())}function startsWith(str,value){return str.slice(0,value.length)===value}function defineProperty(el,key,value,options){Object.defineProperty(el,key,extend({value:value,enumerable:false,writable:false,configurable:true},options));return el}const uid=function(){let i=-1;return()=>++i}();const getPropDescriptor=(o,k)=>Object.getOwnPropertyDescriptor(o,k);function extend(src){let obj;let i=1;const args=arguments;const l=args.length;for(;i<l;i++){if(obj=args[i]){for(const key in obj){if(isWritable(src,key))src[key]=obj[key]}}}return src}var misc=Object.freeze({each:each,contains:contains,toCamel:toCamel,startsWith:startsWith,defineProperty:defineProperty,uid:uid,getPropDescriptor:getPropDescriptor,extend:extend});var settings$1=extend(Object.create(brackets.settings),{skipAnonymousTags:true,autoUpdate:true});function handleEvent(dom,handler,e){let ptag=this.__.parent;let item=this.__.item;if(!item)while(ptag&&!item){item=ptag.__.item;ptag=ptag.__.parent}if(isWritable(e,"currentTarget"))e.currentTarget=dom;if(isWritable(e,"target"))e.target=e.srcElement;if(isWritable(e,"which"))e.which=e.charCode||e.keyCode;e.item=item;handler.call(this,e);if(!settings$1.autoUpdate)return;if(!e.preventUpdate){const p=getImmediateCustomParentTag(this);if(p.isMounted)p.update()}}function setEventHandler(name,handler,dom,tag){let eventName;const cb=handleEvent.bind(tag,dom,handler);dom[name]=null;eventName=name.replace(RE_EVENTS_PREFIX,"");if(!contains(tag.__.listeners,dom))tag.__.listeners.push(dom);if(!dom[RIOT_EVENTS_KEY])dom[RIOT_EVENTS_KEY]={};if(dom[RIOT_EVENTS_KEY][name])dom.removeEventListener(eventName,dom[RIOT_EVENTS_KEY][name]);dom[RIOT_EVENTS_KEY][name]=cb;dom.addEventListener(eventName,cb,false)}function updateDataIs(expr,parent,tagName){let tag=expr.tag||expr.dom._tag;let ref;const{head:head}=tag?tag.__:{};const isVirtual=expr.dom.tagName==="VIRTUAL";if(tag&&expr.tagName===tagName){tag.update();return}if(tag){if(isVirtual){ref=createDOMPlaceholder();head.parentNode.insertBefore(ref,head)}tag.unmount(true)}if(!isString(tagName))return;expr.impl=__TAG_IMPL[tagName];if(!expr.impl)return;expr.tag=tag=initChildTag(expr.impl,{root:expr.dom,parent:parent,tagName:tagName},expr.dom.innerHTML,parent);each(expr.attrs,a=>setAttr(tag.root,a.name,a.value));expr.tagName=tagName;tag.mount();if(isVirtual)makeReplaceVirtual(tag,ref||tag.root);parent.__.onUnmount=(()=>{const delName=tag.opts.dataIs;arrayishRemove(tag.parent.tags,delName,tag);arrayishRemove(tag.__.parent.tags,delName,tag);tag.unmount()})}function normalizeAttrName(attrName){if(!attrName)return null;attrName=attrName.replace(ATTRS_PREFIX,"");if(CASE_SENSITIVE_ATTRIBUTES[attrName])attrName=CASE_SENSITIVE_ATTRIBUTES[attrName];return attrName}function updateExpression(expr){if(this.root&&getAttr(this.root,"virtualized"))return;const dom=expr.dom;const attrName=normalizeAttrName(expr.attr);const isToggle=contains([SHOW_DIRECTIVE,HIDE_DIRECTIVE],attrName);const isVirtual=expr.root&&expr.root.tagName==="VIRTUAL";const{isAnonymous:isAnonymous}=this.__;const parent=dom&&(expr.parent||dom.parentNode);const isStyleAttr=attrName==="style";const isClassAttr=attrName==="class";let value;if(expr._riot_id){if(expr.__.wasCreated){expr.update()}else{expr.mount();if(isVirtual){makeReplaceVirtual(expr,expr.root)}}return}if(expr.update)return expr.update();const context=isToggle&&!isAnonymous?inheritParentProps.call(this):this;value=tmpl(expr.expr,context);const hasValue=!isBlank(value);const isObj=isObject(value);if(isObj){if(isClassAttr){value=tmpl(JSON.stringify(value),this)}else if(isStyleAttr){value=styleObjectToString(value)}}if(expr.attr&&(!expr.wasParsedOnce||!hasValue||value===false)){remAttr(dom,getAttr(dom,expr.attr)?expr.attr:attrName)}if(expr.bool)value=value?attrName:false;if(expr.isRtag)return updateDataIs(expr,this,value);if(expr.wasParsedOnce&&expr.value===value)return;expr.value=value;expr.wasParsedOnce=true;if(isObj&&!isClassAttr&&!isStyleAttr&&!isToggle)return;if(!hasValue)value="";if(!attrName){value+="";if(parent){expr.parent=parent;if(parent.tagName==="TEXTAREA"){parent.value=value;if(!IE_VERSION)dom.nodeValue=value}else dom.nodeValue=value}return}if(isFunction$2(value)){setEventHandler(attrName,value,dom,this)}else if(isToggle){toggleVisibility(dom,attrName===HIDE_DIRECTIVE?!value:value)}else{if(expr.bool){dom[attrName]=value}if(attrName==="value"&&dom.value!==value){dom.value=value}else if(hasValue&&value!==false){setAttr(dom,attrName,value)}if(isStyleAttr&&dom.hidden)toggleVisibility(dom,false)}}function updateAllExpressions(expressions){each(expressions,updateExpression.bind(this))}var IfExpr={init(dom,tag,expr){remAttr(dom,CONDITIONAL_DIRECTIVE);this.tag=tag;this.expr=expr;this.stub=createDOMPlaceholder();this.pristine=dom;const p=dom.parentNode;p.insertBefore(this.stub,dom);p.removeChild(dom);return this},update(){this.value=tmpl(this.expr,this.tag);if(this.value&&!this.current){this.current=this.pristine.cloneNode(true);this.stub.parentNode.insertBefore(this.current,this.stub);this.expressions=parseExpressions.apply(this.tag,[this.current,true])}else if(!this.value&&this.current){unmountAll(this.expressions);if(this.current._tag){this.current._tag.unmount()}else if(this.current.parentNode){this.current.parentNode.removeChild(this.current)}this.current=null;this.expressions=[]}if(this.value)updateAllExpressions.call(this.tag,this.expressions)},unmount(){unmountAll(this.expressions||[])}};var RefExpr={init(dom,parent,attrName,attrValue){this.dom=dom;this.attr=attrName;this.rawValue=attrValue;this.parent=parent;this.hasExp=tmpl.hasExpr(attrValue);return this},update(){const old=this.value;const customParent=this.parent&&getImmediateCustomParentTag(this.parent);const tagOrDom=this.dom.__ref||this.tag||this.dom;this.value=this.hasExp?tmpl(this.rawValue,this.parent):this.rawValue;if(!isBlank(old)&&customParent)arrayishRemove(customParent.refs,old,tagOrDom);if(!isBlank(this.value)&&isString(this.value)){if(customParent)arrayishAdd(customParent.refs,this.value,tagOrDom,null,this.parent.__.index);if(this.value!==old){setAttr(this.dom,this.attr,this.value)}}else{remAttr(this.dom,this.attr)}if(!this.dom.__ref)this.dom.__ref=tagOrDom},unmount(){const tagOrDom=this.tag||this.dom;const customParent=this.parent&&getImmediateCustomParentTag(this.parent);if(!isBlank(this.value)&&customParent)arrayishRemove(customParent.refs,this.value,tagOrDom)}};function mkitem(expr,key,val,base){const item=base?Object.create(base):{};item[expr.key]=key;if(expr.pos)item[expr.pos]=val;return item}function unmountRedundant(items,tags){let i=tags.length;const j=items.length;while(i>j){i--;remove.apply(tags[i],[tags,i])}}function remove(tags,i){tags.splice(i,1);this.unmount();arrayishRemove(this.parent,this,this.__.tagName,true)}function moveNestedTags(i){each(Object.keys(this.tags),tagName=>{moveChildTag.apply(this.tags[tagName],[tagName,i])})}function move(root,nextTag,isVirtual){if(isVirtual)moveVirtual.apply(this,[root,nextTag]);else safeInsert(root,this.root,nextTag.root)}function insert(root,nextTag,isVirtual){if(isVirtual)makeVirtual.apply(this,[root,nextTag]);else safeInsert(root,this.root,nextTag.root)}function append(root,isVirtual){if(isVirtual)makeVirtual.call(this,root);else root.appendChild(this.root)}function getItemId(keyAttr,originalItem,keyedItem,hasKeyAttrExpr){if(keyAttr){return hasKeyAttrExpr?tmpl(keyAttr,keyedItem):originalItem[keyAttr]}return originalItem}function _each(dom,parent,expr){const mustReorder=typeof getAttr(dom,LOOP_NO_REORDER_DIRECTIVE)!==T_STRING||remAttr(dom,LOOP_NO_REORDER_DIRECTIVE);const keyAttr=getAttr(dom,KEY_DIRECTIVE);const hasKeyAttrExpr=keyAttr?tmpl.hasExpr(keyAttr):false;const tagName=getTagName(dom);const impl=__TAG_IMPL[tagName];const parentNode=dom.parentNode;const placeholder=createDOMPlaceholder();const child=getTag(dom);const ifExpr=getAttr(dom,CONDITIONAL_DIRECTIVE);const tags=[];const isLoop=true;const innerHTML=dom.innerHTML;const isAnonymous=!__TAG_IMPL[tagName];const isVirtual=dom.tagName==="VIRTUAL";let oldItems=[];let hasKeys;remAttr(dom,LOOP_DIRECTIVE);remAttr(dom,KEY_DIRECTIVE);expr=tmpl.loopKeys(expr);expr.isLoop=true;if(ifExpr)remAttr(dom,CONDITIONAL_DIRECTIVE);parentNode.insertBefore(placeholder,dom);parentNode.removeChild(dom);expr.update=function updateEach(){expr.value=tmpl(expr.val,parent);let items=expr.value;const frag=createFrag();const isObject$$1=!isArray(items)&&!isString(items);const root=placeholder.parentNode;const tmpItems=[];if(!root)return;if(isObject$$1){hasKeys=items||false;items=hasKeys?Object.keys(items).map(key=>mkitem(expr,items[key],key)):[]}else{hasKeys=false}if(ifExpr){items=items.filter((item,i)=>{if(expr.key&&!isObject$$1)return!!tmpl(ifExpr,mkitem(expr,item,i,parent));return!!tmpl(ifExpr,extend(Object.create(parent),item))})}each(items,(_item,i)=>{const item=!hasKeys&&expr.key?mkitem(expr,_item,i):_item;const itemId=getItemId(keyAttr,_item,item,hasKeyAttrExpr);const doReorder=mustReorder&&typeof _item===T_OBJECT&&!hasKeys;const oldPos=oldItems.indexOf(itemId);const isNew=oldPos===-1;const pos=!isNew&&doReorder?oldPos:i;let tag=tags[pos];const mustAppend=i>=oldItems.length;const mustCreate=doReorder&&isNew||!doReorder&&!tag;if(mustCreate){tag=createTag(impl,{parent:parent,isLoop:isLoop,isAnonymous:isAnonymous,tagName:tagName,root:dom.cloneNode(isAnonymous),item:item,index:i},innerHTML);tag.mount();if(mustAppend)append.apply(tag,[frag||root,isVirtual]);else insert.apply(tag,[root,tags[i],isVirtual]);if(!mustAppend)oldItems.splice(i,0,item);tags.splice(i,0,tag);if(child)arrayishAdd(parent.tags,tagName,tag,true)}else if(pos!==i&&doReorder){if(keyAttr||contains(items,oldItems[pos])){move.apply(tag,[root,tags[i],isVirtual]);tags.splice(i,0,tags.splice(pos,1)[0]);oldItems.splice(i,0,oldItems.splice(pos,1)[0])}if(expr.pos)tag[expr.pos]=i;if(!child&&tag.tags)moveNestedTags.call(tag,i)}tag.__.item=item;tag.__.index=i;tag.__.parent=parent;tmpItems[i]=itemId;if(!mustCreate)tag.update(item)});unmountRedundant(items,tags);oldItems=tmpItems.slice();root.insertBefore(frag,placeholder)};expr.unmount=(()=>{each(tags,t=>{t.unmount()})});return expr}function parseExpressions(root,mustIncludeRoot){const expressions=[];walkNodes(root,dom=>{const type=dom.nodeType;let attr;let tagImpl;if(!mustIncludeRoot&&dom===root)return;if(type===3&&dom.parentNode.tagName!=="STYLE"&&tmpl.hasExpr(dom.nodeValue))expressions.push({dom:dom,expr:dom.nodeValue});if(type!==1)return;const isVirtual=dom.tagName==="VIRTUAL";if(attr=getAttr(dom,LOOP_DIRECTIVE)){if(isVirtual)setAttr(dom,"loopVirtual",true);expressions.push(_each(dom,this,attr));return false}if(attr=getAttr(dom,CONDITIONAL_DIRECTIVE)){expressions.push(Object.create(IfExpr).init(dom,this,attr));return false}if(attr=getAttr(dom,IS_DIRECTIVE)){if(tmpl.hasExpr(attr)){expressions.push({isRtag:true,expr:attr,dom:dom,attrs:[].slice.call(dom.attributes)});return false}}tagImpl=getTag(dom);if(isVirtual){if(getAttr(dom,"virtualized")){dom.parentElement.removeChild(dom)}if(!tagImpl&&!getAttr(dom,"virtualized")&&!getAttr(dom,"loopVirtual"))tagImpl={tmpl:dom.outerHTML}}if(tagImpl&&(dom!==root||mustIncludeRoot)){if(isVirtual&&!getAttr(dom,IS_DIRECTIVE)){setAttr(dom,"virtualized",true);const tag=createTag({tmpl:dom.outerHTML},{root:dom,parent:this},dom.innerHTML);expressions.push(tag)}else{expressions.push(initChildTag(tagImpl,{root:dom,parent:this},dom.innerHTML,this));return false}}parseAttributes.apply(this,[dom,dom.attributes,(attr,expr)=>{if(!expr)return;expressions.push(expr)}])});return expressions}function parseAttributes(dom,attrs,fn){each(attrs,attr=>{if(!attr)return false;const name=attr.name;const bool=isBoolAttr(name);let expr;if(contains(REF_DIRECTIVES,name)&&dom.tagName.toLowerCase()!==YIELD_TAG){expr=Object.create(RefExpr).init(dom,this,name,attr.value)}else if(tmpl.hasExpr(attr.value)){expr={dom:dom,expr:attr.value,attr:name,bool:bool}}fn(attr,expr)})}const reHasYield=/<yield\b/i;const reYieldAll=/<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>|>)/gi;const reYieldSrc=/<yield\s+to=['"]([^'">]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi;const reYieldDest=/<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi;const rootEls={tr:"tbody",th:"tr",td:"tr",col:"colgroup"};const tblTags=IE_VERSION&&IE_VERSION<10?RE_SPECIAL_TAGS:RE_SPECIAL_TAGS_NO_OPTION;const GENERIC="div";const SVG="svg";function specialTags(el,tmpl,tagName){let select=tagName[0]==="o",parent=select?"select>":"table>";el.innerHTML="<"+parent+tmpl.trim()+"</"+parent;parent=el.firstChild;if(select){parent.selectedIndex=-1}else{const tname=rootEls[tagName];if(tname&&parent.childElementCount===1)parent=$(tname,parent)}return parent}function replaceYield(tmpl,html){if(!reHasYield.test(tmpl))return tmpl;const src={};html=html&&html.replace(reYieldSrc,function(_,ref,text){src[ref]=src[ref]||text;return""}).trim();return tmpl.replace(reYieldDest,function(_,ref,def){return src[ref]||def||""}).replace(reYieldAll,function(_,def){return html||def||""})}function mkdom(tmpl,html,isSvg$$1){const match=tmpl&&tmpl.match(/^\s*<([-\w]+)/);const tagName=match&&match[1].toLowerCase();let el=mkEl(isSvg$$1?SVG:GENERIC);tmpl=replaceYield(tmpl,html);if(tblTags.test(tagName))el=specialTags(el,tmpl,tagName);else setInnerHTML(el,tmpl,isSvg$$1);return el}function Tag$1(el,opts){const{name:name,tmpl:tmpl,css:css,attrs:attrs,onCreate:onCreate}=this;if(!__TAG_IMPL[name]){tag$1(name,tmpl,css,attrs,onCreate);__TAG_IMPL[name].class=this.constructor}mountTo(el,name,opts,this);if(css)styleManager.inject();return this}function tag$1(name,tmpl,css,attrs,fn){if(isFunction$2(attrs)){fn=attrs;if(/^[\w-]+\s?=/.test(css)){attrs=css;css=""}else attrs=""}if(css){if(isFunction$2(css))fn=css;else styleManager.add(css)}name=name.toLowerCase();__TAG_IMPL[name]={name:name,tmpl:tmpl,attrs:attrs,fn:fn};return name}function tag2$1(name,tmpl,css,attrs,fn){if(css)styleManager.add(css,name);__TAG_IMPL[name]={name:name,tmpl:tmpl,attrs:attrs,fn:fn};return name}function mount$1(selector,tagName,opts){const tags=[];let elem,allTags;function pushTagsTo(root){if(root.tagName){let riotTag=getAttr(root,IS_DIRECTIVE),tag;if(tagName&&riotTag!==tagName){riotTag=tagName;setAttr(root,IS_DIRECTIVE,tagName)}tag=mountTo(root,riotTag||root.tagName.toLowerCase(),opts);if(tag)tags.push(tag)}else if(root.length)each(root,pushTagsTo)}styleManager.inject();if(isObject(tagName)){opts=tagName;tagName=0}if(isString(selector)){selector=selector==="*"?allTags=selectTags():selector+selectTags(selector.split(/, */));elem=selector?$$(selector):[]}else elem=selector;if(tagName==="*"){tagName=allTags||selectTags();if(elem.tagName)elem=$$(tagName,elem);else{var nodeList=[];each(elem,_el=>nodeList.push($$(tagName,_el)));elem=nodeList}tagName=0}pushTagsTo(elem);return tags}const mixins={};const globals=mixins[GLOBAL_MIXIN]={};let mixins_id=0;function mixin$1(name,mix,g){if(isObject(name)){mixin$1(`__${mixins_id++}__`,name,true);return}const store=g?globals:mixins;if(!mix){if(isUndefined(store[name]))throw new Error(`Unregistered mixin: ${name}`);return store[name]}store[name]=isFunction$2(mix)?extend(mix.prototype,store[name]||{})&&mix:extend(store[name]||{},mix)}function update$1(){return each(__TAGS_CACHE,tag=>tag.update())}function unregister$1(name){__TAG_IMPL[name]=null}const version$1="WIP";var core=Object.freeze({Tag:Tag$1,tag:tag$1,tag2:tag2$1,mount:mount$1,mixin:mixin$1,update:update$1,unregister:unregister$1,version:version$1});function updateOpts(isLoop,parent,isAnonymous,opts,instAttrs){if(isLoop&&isAnonymous)return;const ctx=isLoop?inheritParentProps.call(this):parent||this;each(instAttrs,attr=>{if(attr.expr)updateExpression.call(ctx,attr.expr);opts[toCamel(attr.name).replace(ATTRS_PREFIX,"")]=attr.expr?attr.expr.value:attr.value})}function setMountState(value){const{isAnonymous:isAnonymous}=this.__;defineProperty(this,"isMounted",value);if(!isAnonymous){if(value)this.trigger("mount");else{this.trigger("unmount");this.off("*");this.__.wasCreated=false}}}function createTag(impl={},conf={},innerHTML){const tag=conf.context||{};const opts=extend({},conf.opts);const parent=conf.parent;const isLoop=conf.isLoop;const isAnonymous=!!conf.isAnonymous;const skipAnonymous=settings$1.skipAnonymousTags&&isAnonymous;const item=conf.item;const index=conf.index;const instAttrs=[];const implAttrs=[];const expressions=[];const root=conf.root;const tagName=conf.tagName||getTagName(root);const isVirtual=tagName==="virtual";const isInline=!isVirtual&&!impl.tmpl;let dom;if(!skipAnonymous)observable$1(tag);if(impl.name&&root._tag)root._tag.unmount(true);defineProperty(tag,"isMounted",false);defineProperty(tag,"__",{isAnonymous:isAnonymous,instAttrs:instAttrs,innerHTML:innerHTML,tagName:tagName,index:index,isLoop:isLoop,isInline:isInline,listeners:[],virts:[],wasCreated:false,tail:null,head:null,parent:null,item:null});defineProperty(tag,"_riot_id",uid());defineProperty(tag,"root",root);extend(tag,{opts:opts},item);defineProperty(tag,"parent",parent||null);defineProperty(tag,"tags",{});defineProperty(tag,"refs",{});if(isInline||isLoop&&isAnonymous){dom=root}else{if(!isVirtual)root.innerHTML="";dom=mkdom(impl.tmpl,innerHTML,isSvg(root))}defineProperty(tag,"update",function tagUpdate(data){const nextOpts={};const canTrigger=tag.isMounted&&!skipAnonymous;if(isAnonymous&&parent)extend(tag,parent)
;extend(tag,data);updateOpts.apply(tag,[isLoop,parent,isAnonymous,nextOpts,instAttrs]);if(canTrigger&&tag.isMounted&&isFunction$2(tag.shouldUpdate)&&!tag.shouldUpdate(data,nextOpts)){return tag}extend(opts,nextOpts);if(canTrigger)tag.trigger("update",data);updateAllExpressions.call(tag,expressions);if(canTrigger)tag.trigger("updated");return tag});defineProperty(tag,"mixin",function tagMixin(){each(arguments,mix=>{let instance;let obj;let props=[];const propsBlacklist=["init","__proto__"];mix=isString(mix)?mixin$1(mix):mix;if(isFunction$2(mix)){instance=new mix}else instance=mix;const proto=Object.getPrototypeOf(instance);do{props=props.concat(Object.getOwnPropertyNames(obj||instance))}while(obj=Object.getPrototypeOf(obj||instance));each(props,key=>{if(!contains(propsBlacklist,key)){const descriptor=getPropDescriptor(instance,key)||getPropDescriptor(proto,key);const hasGetterSetter=descriptor&&(descriptor.get||descriptor.set);if(!tag.hasOwnProperty(key)&&hasGetterSetter){Object.defineProperty(tag,key,descriptor)}else{tag[key]=isFunction$2(instance[key])?instance[key].bind(tag):instance[key]}}});if(instance.init)instance.init.bind(tag)(opts)});return tag});defineProperty(tag,"mount",function tagMount(){root._tag=tag;parseAttributes.apply(parent,[root,root.attributes,(attr,expr)=>{if(!isAnonymous&&RefExpr.isPrototypeOf(expr))expr.tag=tag;attr.expr=expr;instAttrs.push(attr)}]);walkAttrs(impl.attrs,(k,v)=>{implAttrs.push({name:k,value:v})});parseAttributes.apply(tag,[root,implAttrs,(attr,expr)=>{if(expr)expressions.push(expr);else setAttr(root,attr.name,attr.value)}]);updateOpts.apply(tag,[isLoop,parent,isAnonymous,opts,instAttrs]);const globalMixin=mixin$1(GLOBAL_MIXIN);if(globalMixin&&!skipAnonymous){for(const i in globalMixin){if(globalMixin.hasOwnProperty(i)){tag.mixin(globalMixin[i])}}}if(impl.fn)impl.fn.call(tag,opts);if(!skipAnonymous)tag.trigger("before-mount");each(parseExpressions.apply(tag,[dom,isAnonymous]),e=>expressions.push(e));tag.update(item);if(!isAnonymous&&!isInline){while(dom.firstChild)root.appendChild(dom.firstChild)}defineProperty(tag,"root",root);if(!skipAnonymous&&tag.parent){const p=getImmediateCustomParentTag(tag.parent);p.one(!p.isMounted?"mount":"updated",()=>{setMountState.call(tag,true)})}else{setMountState.call(tag,true)}tag.__.wasCreated=true;return tag});defineProperty(tag,"unmount",function tagUnmount(mustKeepRoot){const el=tag.root;const p=el.parentNode;const tagIndex=__TAGS_CACHE.indexOf(tag);if(!skipAnonymous)tag.trigger("before-unmount");walkAttrs(impl.attrs,name=>{if(startsWith(name,ATTRS_PREFIX))name=name.slice(ATTRS_PREFIX.length);remAttr(root,name)});tag.__.listeners.forEach(dom=>{Object.keys(dom[RIOT_EVENTS_KEY]).forEach(eventName=>{dom.removeEventListener(eventName,dom[RIOT_EVENTS_KEY][eventName])})});if(tagIndex!==-1)__TAGS_CACHE.splice(tagIndex,1);if(parent&&!isAnonymous){const ptag=getImmediateCustomParentTag(parent);if(isVirtual){Object.keys(tag.tags).forEach(tagName=>arrayishRemove(ptag.tags,tagName,tag.tags[tagName]))}else{arrayishRemove(ptag.tags,tagName,tag)}}if(tag.__.virts){each(tag.__.virts,v=>{if(v.parentNode)v.parentNode.removeChild(v)})}unmountAll(expressions);each(instAttrs,a=>a.expr&&a.expr.unmount&&a.expr.unmount());if(mustKeepRoot)setInnerHTML(el,"");else if(p)p.removeChild(el);if(tag.__.onUnmount)tag.__.onUnmount();if(!tag.isMounted)setMountState.call(tag,true);setMountState.call(tag,false);delete tag.root._tag;return tag});return tag}function getTag(dom){return dom.tagName&&__TAG_IMPL[getAttr(dom,IS_DIRECTIVE)||getAttr(dom,IS_DIRECTIVE)||dom.tagName.toLowerCase()]}function moveChildTag(tagName,newPos){const parent=this.parent;let tags;if(!parent)return;tags=parent.tags[tagName];if(isArray(tags))tags.splice(newPos,0,tags.splice(tags.indexOf(this),1)[0]);else arrayishAdd(parent.tags,tagName,this)}function initChildTag(child,opts,innerHTML,parent){const tag=createTag(child,opts,innerHTML);const tagName=opts.tagName||getTagName(opts.root,true);const ptag=getImmediateCustomParentTag(parent);defineProperty(tag,"parent",ptag);tag.__.parent=parent;arrayishAdd(ptag.tags,tagName,tag);if(ptag!==parent)arrayishAdd(parent.tags,tagName,tag);return tag}function getImmediateCustomParentTag(tag){let ptag=tag;while(ptag.__.isAnonymous){if(!ptag.parent)break;ptag=ptag.parent}return ptag}function unmountAll(expressions){each(expressions,expr=>{if(expr.unmount)expr.unmount(true);else if(expr.tagName)expr.tag.unmount(true);else if(expr.unmount)expr.unmount()})}function getTagName(dom,skipDataIs){const child=getTag(dom);const namedTag=!skipDataIs&&getAttr(dom,IS_DIRECTIVE);return namedTag&&!tmpl.hasExpr(namedTag)?namedTag:child?child.name:dom.tagName.toLowerCase()}function arrayishAdd(obj,key,value,ensureArray,index){const dest=obj[key];const isArr=isArray(dest);const hasIndex=!isUndefined(index);if(dest&&dest===value)return;if(!dest&&ensureArray)obj[key]=[value];else if(!dest)obj[key]=value;else{if(isArr){const oldIndex=dest.indexOf(value);if(oldIndex===index)return;if(oldIndex!==-1)dest.splice(oldIndex,1);if(hasIndex){dest.splice(index,0,value)}else{dest.push(value)}}else obj[key]=[dest,value]}}function arrayishRemove(obj,key,value,ensureArray){if(isArray(obj[key])){let index=obj[key].indexOf(value);if(index!==-1)obj[key].splice(index,1);if(!obj[key].length)delete obj[key];else if(obj[key].length===1&&!ensureArray)obj[key]=obj[key][0]}else if(obj[key]===value)delete obj[key]}function mountTo(root,tagName,opts,ctx){const impl=__TAG_IMPL[tagName];const implClass=__TAG_IMPL[tagName].class;const context=ctx||(implClass?Object.create(implClass.prototype):{});const innerHTML=root._innerHTML=root._innerHTML||root.innerHTML;const conf=extend({root:root,opts:opts,context:context},{parent:opts?opts.parent:null});let tag;if(impl&&root)tag=createTag(impl,conf,innerHTML);if(tag&&tag.mount){tag.mount(true);if(!contains(__TAGS_CACHE,tag))__TAGS_CACHE.push(tag)}return tag}function makeReplaceVirtual(tag,ref){const frag=createFrag();makeVirtual.call(tag,frag);ref.parentNode.replaceChild(frag,ref)}function makeVirtual(src,target){const head=createDOMPlaceholder();const tail=createDOMPlaceholder();const frag=createFrag();let sib;let el;this.root.insertBefore(head,this.root.firstChild);this.root.appendChild(tail);this.__.head=el=head;this.__.tail=tail;while(el){sib=el.nextSibling;frag.appendChild(el);this.__.virts.push(el);el=sib}if(target)src.insertBefore(frag,target.__.head);else src.appendChild(frag)}function inheritParentProps(){if(this.parent)return extend(Object.create(this),this.parent);return this}function moveVirtual(src,target){let el=this.__.head;let sib;const frag=createFrag();while(el){sib=el.nextSibling;frag.appendChild(el);el=sib;if(el===this.__.tail){frag.appendChild(el);src.insertBefore(frag,target.__.head);break}}}function selectTags(tags){if(!tags){const keys=Object.keys(__TAG_IMPL);return keys+selectTags(keys)}return tags.filter(t=>!/[^-\w]/.test(t)).reduce((list,t)=>{const name=t.trim().toLowerCase();return list+`,[${IS_DIRECTIVE}="${name}"]`},"")}var tags=Object.freeze({getTag:getTag,moveChildTag:moveChildTag,initChildTag:initChildTag,getImmediateCustomParentTag:getImmediateCustomParentTag,unmountAll:unmountAll,getTagName:getTagName,arrayishAdd:arrayishAdd,arrayishRemove:arrayishRemove,mountTo:mountTo,makeReplaceVirtual:makeReplaceVirtual,makeVirtual:makeVirtual,inheritParentProps:inheritParentProps,moveVirtual:moveVirtual,selectTags:selectTags});const settings=settings$1;const util={tmpl:tmpl,brackets:brackets,styleManager:styleManager,vdom:__TAGS_CACHE,styleNode:styleManager.styleNode,dom:dom,check:check,misc:misc,tags:tags};var riot$1=extend({},core,{observable:observable$1,settings:settings,util:util});var isNumber;var isNumber$1=isNumber=function(value){return toString(value)==="[object Number]"};var isObject$1;var isObject$2=isObject$1=function(value){return toString(value)==="[object Object]"};var getOwnSymbols;var objectAssign;var shouldUseNative;var toObject;var slice=[].slice;getOwnSymbols=Object.getOwnPropertySymbols;toObject=function(val){if(val===null||val===void 0){throw new TypeError("Object.assign cannot be called with null or undefined")}return Object(val)};shouldUseNative=function(){var err,i,j,k,len,letter,order2,ref,test1,test2,test3;try{if(!Object.assign){return false}test1=new String("abc");test1[5]="de";if(Object.getOwnPropertyNames(test1)[0]==="5"){return false}test2={};for(i=j=0;j<=9;i=++j){test2["_"+String.fromCharCode(i)]=i}order2=Object.getOwnPropertyNames(test2).map(function(n){return test2[n]});if(order2.join("")!=="0123456789"){return false}test3={};ref="abcdefghijklmnopqrst".split("");for(k=0,len=ref.length;k<len;k++){letter=ref[k];test3[letter]=letter}if(Object.keys(Object.assign({},test3)).join("")!=="abcdefghijklmnopqrst"){return false}return true}catch(error){return false}};var index=objectAssign=function(){if(shouldUseNative()){return Object.assign}return function(){var from,j,k,key,len,len1,ref,source,sources,symbol,target,to;target=arguments[0],sources=2<=arguments.length?slice.call(arguments,1):[];to=toObject(target);for(j=0,len=sources.length;j<len;j++){source=sources[j];from=Object(source);for(key in from){if(Object.prototype.hasOwnProperty.call(from,key)){to[key]=from[key]}}if(getOwnSymbols){ref=getOwnSymbols(from);for(k=0,len1=ref.length;k<len1;k++){symbol=ref[k];if(Object.prototype.propIsEnumerable.call(from,symbol)){to[symbol]=from[symbol]}}}}return to}}();var Ref;var nextId;var indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item)return i}return-1};nextId=function(){var ids;ids=0;return function(){return ids++}}();var Ref$1=Ref=function(){function Ref(_value,parent,key1){this._value=_value;this.parent=parent;this.key=key1;this._cache={};this._children={};this._numChildren=0;this._id=nextId();if(this.parent!=null){this.parent._children[this._id]=this;this.parent._numChildren++}observable$1(this)}Ref.prototype._mutate=function(key){var child,id,ref;this._cache={};ref=this._children;for(id in ref){child=ref[id];child._mutate()}return this};Ref.prototype.clear=function(){var child,id,ref;this._cache={};ref=this._children;for(id in ref){child=ref[id];child.clear()}this._children={};this._numChildren=0;this._value=void 0;if(this.parent!=null){return this.parent.set(this.key,void 0)}};Ref.prototype.destroy=function(){var child,id,ref;ref=this._children;for(id in ref){child=ref[id];child.destroy()}delete this._cache;delete this._children;this.off("*");if(this.parent){delete this.parent._children[this._id];this.parent._numChildren--}return this};Ref.prototype.value=function(state){if(!this.parent){if(state!=null){this._value=state}return this._value}if(state!=null){return this.parent.set(this.key,state)}else{return this.parent.get(this.key)}};Ref.prototype.ref=function(key){if(!key){return this}return new Ref(null,this,key)};Ref.prototype.get=function(key){if(!key){return this.value()}else{if(this._cache[key]){return this._cache[key]}return this._cache[key]=this.index(key)}};Ref.prototype.set=function(key,value){var k,oldValue,v;if(isObject$2(key)){for(k in key){v=key[k];this.set(k,v)}return this}oldValue=this.get(key);this._mutate(key);if(value==null){if(isObject$2(key)){this.value(index(this.value(),key))}else{this.index(key,value,false)}}else{this.index(key,value,false)}this._triggerSet(key,value,oldValue);this._triggerSetChildren(key,value,oldValue);return this};Ref.prototype._triggerSetChildren=function(key,value,oldValue){var child,childKeys,childRemainderKey,i,id,keyPart,keyParts,partialKey,ref,ref1,regExps,results;if(this._numChildren===0){return this}key=key+"";keyParts=key.split(".");partialKey="";childKeys=[];regExps={};for(i in keyParts){keyPart=keyParts[i];if(partialKey===""){partialKey=keyPart}else{partialKey+="."+keyPart}childKeys[i]=partialKey;regExps[partialKey]=new RegExp("^"+partialKey+".?")}ref=this._children;results=[];for(id in ref){child=ref[id];if(ref1=child.key,indexOf.call(childKeys,ref1)>=0){childRemainderKey=key.replace(regExps[child.key],"");child.trigger("set",childRemainderKey,value,oldValue);results.push(child._triggerSetChildren(childRemainderKey,value,oldValue))}else{results.push(void 0)}}return results};Ref.prototype._triggerSet=function(key,value,oldValue){var parentKey;this.trigger("set",key,value,oldValue);if(this.parent){parentKey=this.key+"."+key;return this.parent._triggerSet(parentKey,value,oldValue)}};Ref.prototype.extend=function(key,value){var clone;this._mutate(key);if(value==null){this.value(index(this.value(),key))}else{if(isObject$2(value)){this.value(index(this.ref(key).get(),value))}else{clone=this.clone();this.set(key,value);this.value(index(clone.get(),this.value()))}}return this};Ref.prototype.clone=function(key){return new Ref(index({},this.get(key)))};Ref.prototype.index=function(key,value,get,obj){var next,prop,props;if(get==null){get=true}if(obj==null){obj=this.value()}if(this.parent){return this.parent.index(this.key+"."+key,value,get)}if(isNumber$1(key)){key=String(key)}props=key.split(".");if(get){while(prop=props.shift()){if(!props.length){return obj!=null?obj[prop]:void 0}obj=obj!=null?obj[prop]:void 0}return}if(this._value==null){this._value={};if(obj==null){obj=this._value}}while(prop=props.shift()){if(!props.length){return obj[prop]=value}else{next=props[0];if(obj[prop]==null){if(isNaN(Number(next))){if(obj[prop]==null){obj[prop]={}}}else{if(obj[prop]==null){obj[prop]=[]}}}}obj=obj[prop]}};return Ref}();var methods;var refer;methods=["extend","get","index","ref","set","value","clear","destroy","on","off","one","trigger"];refer=function(state,ref){var fn,i,len,method,wrapper;if(ref==null){ref=null}if(ref==null){ref=new Ref$1(state)}wrapper=function(key){return ref.get(key)};fn=function(method){return wrapper[method]=function(){return ref[method].apply(ref,arguments)}};for(i=0,len=methods.length;i<len;i++){method=methods[i];fn(method)}wrapper.refer=function(key){return refer(null,ref.ref(key))};wrapper.clone=function(key){return refer(null,ref.clone(key))};return wrapper};refer.Ref=Ref$1;var refer$1=refer;var PromiseInspection;var PromiseInspection$1=PromiseInspection=function(){function PromiseInspection(arg){this.state=arg.state,this.value=arg.value,this.reason=arg.reason}PromiseInspection.prototype.isFulfilled=function(){return this.state==="fulfilled"};PromiseInspection.prototype.isRejected=function(){return this.state==="rejected"};return PromiseInspection}();var _undefined$1=void 0;var _undefinedString$1="undefined";var soon;soon=function(){var bufferSize,callQueue,cqYield,fq,fqStart;fq=[];fqStart=0;bufferSize=1024;callQueue=function(){var err;while(fq.length-fqStart){try{fq[fqStart]()}catch(error){err=error;if(typeof console!=="undefined"){console.error(err)}}fq[fqStart++]=_undefined$1;if(fqStart===bufferSize){fq.splice(0,bufferSize);fqStart=0}}};cqYield=function(){var dd,mo;if(typeof MutationObserver!==_undefinedString$1){dd=document.createElement("div");mo=new MutationObserver(callQueue);mo.observe(dd,{attributes:true});return function(){dd.setAttribute("a",0)}}if(typeof setImmediate!==_undefinedString$1){return function(){setImmediate(callQueue)}}return function(){setTimeout(callQueue,0)}}();return function(fn){fq.push(fn);if(fq.length-fqStart===1){cqYield()}}}();var soon$1=soon;var Promise$1;var STATE_FULFILLED;var STATE_PENDING;var STATE_REJECTED;var _undefined;var rejectClient;var resolveClient;_undefined=void 0;STATE_PENDING=_undefined;STATE_FULFILLED="fulfilled";STATE_REJECTED="rejected";resolveClient=function(c,arg){var err,yret;if(typeof c.y==="function"){try{yret=c.y.call(_undefined,arg);c.p.resolve(yret)}catch(error){err=error;c.p.reject(err)}}else{c.p.resolve(arg)}};rejectClient=function(c,reason){var err,yret;if(typeof c.n==="function"){try{yret=c.n.call(_undefined,reason);c.p.resolve(yret)}catch(error){err=error;c.p.reject(err)}}else{c.p.reject(reason)}};Promise$1=function(){function Promise(fn){if(fn){fn(function(_this){return function(arg){return _this.resolve(arg)}}(this),function(_this){return function(arg){return _this.reject(arg)}}(this))}}Promise.prototype.resolve=function(value){var clients,err,first,next;if(this.state!==STATE_PENDING){return}if(value===this){return this.reject(new TypeError("Attempt to resolve promise with self"))}if(value&&(typeof value==="function"||typeof value==="object")){try{first=true;next=value.then;if(typeof next==="function"){next.call(value,function(_this){return function(ra){if(first){if(first){first=false}_this.resolve(ra)}}}(this),function(_this){return function(rr){if(first){first=false;_this.reject(rr)}}}(this));return}}catch(error){err=error;if(first){this.reject(err)}return}}this.state=STATE_FULFILLED;this.v=value;if(clients=this.c){soon$1(function(_this){return function(){var c,i,len;for(i=0,len=clients.length;i<len;i++){c=clients[i];resolveClient(c,value)}}}(this))}};Promise.prototype.reject=function(reason){var clients;if(this.state!==STATE_PENDING){return}this.state=STATE_REJECTED;this.v=reason;if(clients=this.c){soon$1(function(){var c,i,len;for(i=0,len=clients.length;i<len;i++){c=clients[i];rejectClient(c,reason)}})}else if(!Promise.suppressUncaughtRejectionError&&typeof console!=="undefined"){console.log("Broken Promise, please catch rejections: ",reason,reason?reason.stack:null)}};Promise.prototype.then=function(onFulfilled,onRejected){var a,client,p,s;p=new Promise;client={y:onFulfilled,n:onRejected,p:p};if(this.state===STATE_PENDING){if(this.c){this.c.push(client)}else{this.c=[client]}}else{s=this.state;a=this.v;soon$1(function(){if(s===STATE_FULFILLED){resolveClient(client,a)}else{rejectClient(client,a)}})}return p};Promise.prototype["catch"]=function(cfn){return this.then(null,cfn)};Promise.prototype["finally"]=function(cfn){return this.then(cfn,cfn)};Promise.prototype.timeout=function(ms,msg){msg=msg||"timeout";return new Promise(function(_this){return function(resolve,reject){setTimeout(function(){return reject(Error(msg))},ms);_this.then(function(val){resolve(val)},function(err){reject(err)})}}(this))};Promise.prototype.callback=function(cb){if(typeof cb==="function"){this.then(function(val){return cb(null,val)});this["catch"](function(err){return cb(err,null)})}return this};return Promise}();var Promise$2=Promise$1;var resolve=function(val){var z;z=new Promise$2;z.resolve(val);return z};var reject=function(err){var z;z=new Promise$2;z.reject(err);return z};var all=function(ps){var i,j,len,p,rc,resolvePromise,results,retP;results=[];rc=0;retP=new Promise$2;resolvePromise=function(p,i){if(!p||typeof p.then!=="function"){p=resolve(p)}p.then(function(yv){results[i]=yv;rc++;if(rc===ps.length){retP.resolve(results)}},function(nv){retP.reject(nv)})};for(i=j=0,len=ps.length;j<len;i=++j){p=ps[i];resolvePromise(p,i)}if(!ps.length){retP.resolve(results)}return retP};var reflect=function(promise){return new Promise$2(function(resolve,reject){return promise.then(function(value){return resolve(new PromiseInspection$1({state:"fulfilled",value:value}))})["catch"](function(err){return resolve(new PromiseInspection$1({state:"rejected",reason:err}))})})};var settle=function(promises){return all(promises.map(reflect))};Promise$2.all=all;Promise$2.reflect=reflect;Promise$2.reject=reject;Promise$2.resolve=resolve;Promise$2.settle=settle;Promise$2.soon=soon$1;var browser=function(){var loadTime,now;if(typeof performance!=="undefined"&&performance!==null&&performance.now){now=function(){return performance.now()}}else{now=function(){return Date.now()-loadTime};loadTime=(new Date).getTime()}return now}();var frameDuration;var id$1;var last;var queue;var requestAnimationFrame$1;frameDuration=1e3/60;id$1=0;last=0;queue=[];var raf=requestAnimationFrame$1=function(callback){var next,now_;if(queue.length===0){now_=browser();next=Math.max(0,frameDuration-(now_-last));last=next+now_;setTimeout(function(){var cp,err,i,len,x;cp=queue.slice(0);queue.length=0;for(i=0,len=cp.length;i<len;i++){x=cp[i];if(!x.cancelled){try{x.callback(last)}catch(error){err=error;setTimeout(function(){throw err},0)}}}},Math.round(next))}queue.push({handle:++id$1,callback:callback,cancelled:false});return id$1};var id;var p;var rafId;var scheduleUpdate;var todos;todos={};rafId=-1;p=null;id=0;if(window.Promise==null){window.Promise=Promise$2}if(window.requestAnimationFrame==null){window.requestAnimationFrame=raf}scheduleUpdate=function(tag$$1){var currentTag,parentTag;if(!p){p=new Promise$2;p.then(function(){var _,todo;for(_ in todos){todo=todos[_];todo.update()}p=null;todos={};return rafId=-1})}if(todos["*"]){return p}if(!tag$$1){todos={"*":riot$1}}else if(tag$$1.update==null){throw new Error("tag has no update routine")}else{currentTag=tag$$1;while(currentTag!=null){parentTag=currentTag.parent;if(!currentTag._schedulingId){currentTag._schedulingId=id++}else if(todos[currentTag.schedulingId]!=null){return p}currentTag=parentTag}todos[tag$$1._schedulingId]=tag$$1}if(rafId===-1){rafId=requestAnimationFrame(function(){return p.resolve()})}return p};var View;var collapsePrototype;var setPrototypeOf;var slice$1=[].slice;setPrototypeOf=function(){var mixinProperties,setProtoOf;setProtoOf=function(obj,proto){return obj.__proto__=proto};mixinProperties=function(obj,proto){var prop,results;results=[];for(prop in proto){if(obj[prop]==null){results.push(obj[prop]=proto[prop])}else{results.push(void 0)}}return results};if(Object.setPrototypeOf||{__proto__:[]}instanceof Array){return setProtoOf}else{return mixinProperties}}();collapsePrototype=function(collapse,proto){var i,len,member,members,parentProto;if(proto===View.prototype){return}parentProto=Object.getPrototypeOf(proto);collapsePrototype(collapse,parentProto);if(members=Object.getOwnPropertyNames(parentProto)){for(i=0,len=members.length;i<len;i++){member=members[i];collapse[member]=parentProto[member]}}return index(collapse,parentProto)};View=function(){View.register=function(){return new this};View.prototype.tag="";View.prototype.html="";View.prototype.css="";View.prototype.attrs="";View.prototype.events=null;function View(){var newProto;newProto=collapsePrototype({},this);this.beforeInit();riot$1.tag(this.tag,this.html,this.css,this.attrs,function(opts){var fn,handler,k,name,parent,proto,ref,ref1,self,v;if(newProto!=null){for(k in newProto){v=newProto[k];if(isFunction$1(v)){(function(_this){return function(v){var oldFn;if(_this[k]!=null){oldFn=_this[k];return _this[k]=function(){var args;args=1<=arguments.length?slice$1.call(arguments,0):[];oldFn.apply(_this,args);return v.apply(_this,args)}}else{return _this[k]=function(){var args;args=1<=arguments.length?slice$1.call(arguments,0):[];return v.apply(_this,args)}}}})(this)(v)}else{this[k]=v}}}self=this;parent=(ref=self.parent)!=null?ref:opts.parent;proto=Object.getPrototypeOf(self);while(parent&&parent!==proto){setPrototypeOf(self,parent);self=parent;parent=self.parent;proto=Object.getPrototypeOf(self)}if(opts!=null){for(k in opts){v=opts[k];this[k]=v}}if(this.events!=null){ref1=this.events;fn=function(_this){return function(name,handler){if(typeof handler==="string"){return _this.on(name,function(){var args;args=1<=arguments.length?slice$1.call(arguments,0):[];return _this[handler].apply(_this,args)})}else{return _this.on(name,function(){var args;args=1<=arguments.length?slice$1.call(arguments,0):[];return handler.apply(_this,args)})}}}(this);for(name in ref1){handler=ref1[name];fn(name,handler)}}return this.init(opts)})}View.prototype.beforeInit=function(){};View.prototype.init=function(){};View.prototype.scheduleUpdate=function(){return scheduleUpdate(this)};return View}();var View$1=View;var inputify;var isRef;isRef=function(o){return o!=null&&isFunction$1(o.ref)};inputify=function(data,configs){var config,fn,inputs,name,ref;if(configs==null){configs={}}ref=data;if(!isRef(ref)){ref=refer$1(data)}inputs={};fn=function(name,config){var fn1,i,input,len,middleware,middlewareFn,validate;middleware=[];if(config&&config.length>0){fn1=function(name,middlewareFn){return middleware.push(function(pair){ref=pair[0],name=pair[1];return Promise$2.resolve(pair).then(function(pair){return middlewareFn.call(pair[0],pair[0].get(pair[1]),pair[1],pair[0])}).then(function(v){ref.set(name,v);return pair})})};for(i=0,len=config.length;i<len;i++){middlewareFn=config[i];fn1(name,middlewareFn)}}middleware.push(function(pair){ref=pair[0],name=pair[1];return Promise$2.resolve(ref.get(name))});validate=function(ref,name){var j,len1,p;p=Promise$2.resolve([ref,name]);for(j=0,len1=middleware.length;j<len1;j++){middlewareFn=middleware[j];p=p.then(middlewareFn)}return p};input={name:name,ref:ref,config:config,validate:validate};observable$1(input);return inputs[name]=input};for(name in configs){config=configs[name];fn(name,config)}return inputs};var inputify$1=inputify;var Form;var extend$1=function(child,parent){for(var key in parent){if(hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child};var hasProp={}.hasOwnProperty;Form=function(superClass){extend$1(Form,superClass);function Form(){return Form.__super__.constructor.apply(this,arguments)}Form.prototype.html="<yield/>";Form.prototype.initInputs=function(){this.inputs={};if(this.configs!=null){return this.inputs=inputify$1(this.data,this.configs)}};Form.prototype.init=function(){return this.initInputs()};Form.prototype.submit=function(e){var input,name,p,pRef,ps,ref;ps=[];ref=this.inputs;for(name in ref){input=ref[name];pRef={};input.trigger("validate",pRef);if(pRef.p!=null){ps.push(pRef.p)}}p=Promise$2.settle(ps).then(function(_this){return function(results){var i,len,result;for(i=0,len=results.length;i<len;i++){result=results[i];if(!result.isFulfilled()){return}}return _this._submit.apply(_this,arguments)}}(this));if(e!=null){e.preventDefault();e.stopPropagation()}return p};Form.prototype._submit=function(){};return Form}(View$1);var Form$1=Form;var Input;var extend$2=function(child,parent){for(var key in parent){if(hasProp$1.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child};var hasProp$1={}.hasOwnProperty;Input=function(superClass){extend$2(Input,superClass);function Input(){return Input.__super__.constructor.apply(this,arguments)}Input.prototype.input=null;Input.prototype.valid=false;Input.prototype.errorMessage="";Input.prototype.init=function(){var ref1,ref2;if(this.input==null&&this.lookup==null&&this.bind==null){throw new Error("No input or bind provided")}if(this.input==null&&this.inputs!=null){this.input=this.inputs[(ref1=this.lookup)!=null?ref1:this.bind]}if(this.input==null){this.input={name:(ref2=this.lookup)!=null?ref2:this.bind,ref:this.data,validate:function(ref,name){return Promise.resolve([ref,name])}};observable$1(this.input)}this.input.on("validate",function(_this){return function(pRef){return _this.validate(pRef)}}(this));return this.input.ref.on("set",function(_this){return function(n,v1,v2){if(n===_this.input.name&&v1!==v2){_this._change(v1,true);return _this.scheduleUpdate()}}}(this))};Input.prototype.getValue=function(event){return event.target.value};Input.prototype.change=function(event){var value;value=this.getValue(event);return this._change(value)};Input.prototype._change=function(value,forced){var name,ref,ref1;ref1=this.input,ref=ref1.ref,name=ref1.name;if(!forced&&value===ref.get(name)){return}this.input.ref.set(name,value);this.clearError();return this.validate()};Input.prototype.error=function(err){var ref1;return this.errorMessage=(ref1=err!=null?err.message:void 0)!=null?ref1:err};Input.prototype.changed=function(){};Input.prototype.clearError=function(){return this.errorMessage=""};Input.prototype.validate=function(pRef){var p;p=this.input.validate(this.input.ref,this.input.name).then(function(_this){return function(value){_this.changed(value);_this.valid=true;return _this.scheduleUpdate()}}(this))["catch"](function(_this){return function(err){_this.error(err);_this.valid=false;_this.scheduleUpdate();throw err}}(this));if(pRef!=null){pRef.p=p}return p};return Input}(View$1);var Input$1=Input;var Views;var Views$1=Views={Form:Form$1,Input:Input$1,View:View$1,inputify:inputify$1};var El;var fn;var k;var v;El={Views:Views$1,View:Views$1.View,Form:Views$1.Form,Input:Views$1.Input,ref:refer$1,riot:riot$1,scheduleUpdate:function(){return scheduleUpdate()}};fn=function(k,v){if(isFunction$1(v)){return El[k]=function(){return v.apply(riot$1,arguments)}}};for(k in riot$1){v=riot$1[k];fn(k,v)}var El$1=El;return El$1}();