Comparing version 3.0.0-alpha.3 to 3.0.0-alpha.4
@@ -0,6 +1,18 @@ | ||
import observable from 'riot-observable' | ||
import compiler from 'riot-compiler' | ||
import * as r from '../index' | ||
import { T_STRING } from '../global-variables' | ||
import { extend, isFunction, $$, getAttr, mkEl, isObject } from '../util' | ||
export function mount(a, b, c) { | ||
var ret | ||
compile(function () { ret = r.mount(a, b, c) }) | ||
return ret | ||
} | ||
/* | ||
Compilation for the browser | ||
*/ | ||
riot.compile = (function () { | ||
export var compile = (function () { | ||
@@ -55,3 +67,3 @@ var | ||
function compileTag (src, opts, url) { | ||
var code = compile(src, opts, url) | ||
var code = compiler.compile(src, opts, url) | ||
@@ -89,3 +101,3 @@ globalEval(code, url) | ||
if (/^\s*</m.test(arg)) { | ||
var js = compile(arg, opts) | ||
var js = compiler.compile(arg, opts) | ||
if (fn !== true) globalEval(js) | ||
@@ -98,3 +110,3 @@ if (isFunction(fn)) fn(js, arg, opts) | ||
GET(arg, function (str, opts, url) { | ||
var js = compile(str, opts, url) | ||
var js = compiler.compile(str, opts, url) | ||
globalEval(js, url) | ||
@@ -124,3 +136,3 @@ if (fn) fn(js, str, opts) | ||
} else { | ||
promise = riot.observable() | ||
promise = observable() | ||
compileScripts(fn, opts) | ||
@@ -133,9 +145,8 @@ } | ||
// reassign mount methods ----- | ||
var mount = riot.mount | ||
// extend the default riot methods | ||
export default extend({}, r, { | ||
compile: compile, | ||
mount: mount, | ||
parsers: compiler.parsers | ||
}) | ||
riot.mount = function (a, b, c) { | ||
var ret | ||
riot.compile(function () { ret = mount(a, b, c) }) | ||
return ret | ||
} |
@@ -1,11 +0,9 @@ | ||
var riot = { version: 'WIP', settings: {} }, | ||
export | ||
const | ||
// be aware, internal usage | ||
// ATTENTION: prefix the global dynamic variables with `__` | ||
// counter to give a unique id to all the Tag instances | ||
__uid = 0, | ||
// tags instances cache | ||
__virtualDom = [], | ||
__VIRTUAL_DOM = [], | ||
// tags implementation cache | ||
__tagImpl = {}, | ||
__TAG_IMPL = {}, | ||
@@ -27,2 +25,4 @@ /** | ||
T_FUNCTION = 'function', | ||
WIN = typeof window == T_UNDEF ? undefined : window, | ||
// special native tags that cannot be treated like the others | ||
@@ -41,5 +41,5 @@ SPECIAL_TAGS_REGEX = /^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/, | ||
// version# for IE 8-11, 0 for others | ||
IE_VERSION = (window && window.document || {}).documentMode | 0, | ||
IE_VERSION = (WIN && WIN.document || {}).documentMode | 0, | ||
// detect firefox to fix #1374 | ||
FIREFOX = window && !!window.InstallTrigger | ||
FIREFOX = WIN && !!WIN.InstallTrigger |
@@ -0,1 +1,27 @@ | ||
import o from 'riot-observable' | ||
import styleManager from './tag/styleManager' | ||
import { tmpl, brackets } from 'riot-tmpl' | ||
import { | ||
isFunction, | ||
setAttr, | ||
getAttr, | ||
$$, | ||
each, | ||
mountTo, | ||
isObject, | ||
extend | ||
} from './util' | ||
import { | ||
__TAG_IMPL, | ||
__VIRTUAL_DOM, | ||
T_STRING, | ||
T_UNDEF, | ||
GLOBAL_MIXIN, | ||
RIOT_TAG_IS, | ||
RIOT_TAG | ||
} from './global-variables' | ||
/** | ||
@@ -5,4 +31,12 @@ * Riot public api | ||
export var observable = o | ||
// export the brackets.settings | ||
export var settings = brackets.settings | ||
// share methods for other riot parts, e.g. compiler | ||
riot.util = { brackets: brackets, tmpl: tmpl } | ||
export var util = { | ||
tmpl: tmpl, | ||
brackets: brackets, | ||
styleNode: styleManager.styleNode | ||
} | ||
@@ -12,3 +46,3 @@ /** | ||
*/ | ||
riot.mixin = (function() { | ||
export var mixin = (function() { | ||
var mixins = {}, | ||
@@ -21,10 +55,10 @@ globals = mixins[GLOBAL_MIXIN] = {}, | ||
* @param { String } name - mixin name (global mixin if object) | ||
* @param { Object } mixin - mixin logic | ||
* @param { Object } mix - mixin logic | ||
* @param { Boolean } g - is global? | ||
* @returns { Object } the mixin logic | ||
*/ | ||
return function(name, mixin, g) { | ||
return function(name, mix, g) { | ||
// Unnamed global | ||
if (isObject(name)) { | ||
riot.mixin('__unnamed_'+_id++, name, true) | ||
mixin(`__unnamed_${_id++}`, name, true) | ||
return | ||
@@ -36,5 +70,16 @@ } | ||
// Getter | ||
if (!mixin) return store[name] | ||
if (!mix) { | ||
if (typeof store[name] === T_UNDEF) { | ||
throw new Error('Unregistered mixin: ' + name) | ||
} | ||
return store[name] | ||
} | ||
// Setter | ||
store[name] = extend(store[name] || {}, mixin) | ||
if (isFunction(mix)) { | ||
extend(mix.prototype, store[name] || {}) | ||
store[name] = mix | ||
} | ||
else { | ||
store[name] = extend(store[name] || {}, mix) | ||
} | ||
} | ||
@@ -47,3 +92,3 @@ | ||
* @param { String } name - name/id of the new riot tag | ||
* @param { String } html - tag template | ||
* @param { String } tmpl - tag template | ||
* @param { String } css - custom tag css | ||
@@ -54,3 +99,3 @@ * @param { String } attrs - root tag attributes | ||
*/ | ||
riot.tag = function(name, html, css, attrs, fn) { | ||
export function tag(name, tmpl, css, attrs, fn) { | ||
if (isFunction(attrs)) { | ||
@@ -68,3 +113,3 @@ fn = attrs | ||
name = name.toLowerCase() | ||
__tagImpl[name] = { name: name, tmpl: html, attrs: attrs, fn: fn } | ||
__TAG_IMPL[name] = { name, tmpl, attrs, fn } | ||
return name | ||
@@ -74,5 +119,11 @@ } | ||
/** | ||
* Export the Tag constructor | ||
* TODO: make a better tag constructor | ||
*/ | ||
// export function Tag() {} | ||
/** | ||
* Create a new riot tag implementation (for use by the compiler) | ||
* @param { String } name - name/id of the new riot tag | ||
* @param { String } html - tag template | ||
* @param { String } tmpl - tag template | ||
* @param { String } css - custom tag css | ||
@@ -83,6 +134,6 @@ * @param { String } attrs - root tag attributes | ||
*/ | ||
riot.tag2 = function(name, html, css, attrs, fn) { | ||
export function tag2(name, tmpl, css, attrs, fn) { | ||
if (css) styleManager.add(css) | ||
//if (bpair) riot.settings.brackets = bpair | ||
__tagImpl[name] = { name: name, tmpl: html, attrs: attrs, fn: fn } | ||
__TAG_IMPL[name] = { name, tmpl, attrs, fn } | ||
return name | ||
@@ -98,3 +149,3 @@ } | ||
*/ | ||
riot.mount = function(selector, tagName, opts) { | ||
export function mount(selector, tagName, opts) { | ||
@@ -112,3 +163,3 @@ var els, | ||
e = e.trim().toLowerCase() | ||
list += ',[' + RIOT_TAG_IS + '="' + e + '"],[' + RIOT_TAG + '="' + e + '"]' | ||
list += `,[${RIOT_TAG_IS}="${e}"],[${RIOT_TAG}="${e}"]` | ||
} | ||
@@ -120,3 +171,3 @@ }) | ||
function selectAllTags() { | ||
var keys = Object.keys(__tagImpl) | ||
var keys = Object.keys(__TAG_IMPL) | ||
return keys + addRiotTags(keys) | ||
@@ -199,4 +250,4 @@ } | ||
*/ | ||
riot.update = function() { | ||
return each(__virtualDom, function(tag) { | ||
export function update() { | ||
return each(__VIRTUAL_DOM, function(tag) { | ||
tag.update() | ||
@@ -206,4 +257,4 @@ }) | ||
riot.unregister = function(name) { | ||
delete __tagImpl[name] | ||
export function unregister(name) { | ||
delete __TAG_IMPL[name] | ||
} | ||
@@ -214,7 +265,4 @@ | ||
*/ | ||
riot.vdom = __virtualDom | ||
export var vdom = __VIRTUAL_DOM | ||
/** | ||
* Export the Tag constructor | ||
*/ | ||
riot.Tag = Tag | ||
@@ -0,2 +1,28 @@ | ||
import { | ||
T_STRING, | ||
T_OBJECT, | ||
__TAG_IMPL, | ||
SPECIAL_TAGS_REGEX, | ||
FIREFOX | ||
} from '../global-variables' | ||
import { | ||
remAttr, | ||
getAttr, | ||
getTagName, | ||
getTag, | ||
isArray, | ||
arrayishAdd, | ||
arrayishRemove, | ||
defineProperty, | ||
getOuterHTML, | ||
moveChildTag, | ||
each, | ||
makeVirtual, | ||
moveVirtual | ||
} from '../util' | ||
import { tmpl } from 'riot-tmpl' | ||
import Tag from './tag' | ||
/** | ||
@@ -15,3 +41,3 @@ * Convert the item looped into an object used to extend the child tag properties | ||
*/ | ||
function mkitem(expr, key, val, base) { | ||
export function mkitem(expr, key, val, base) { | ||
var item = base ? Object.create(base) : {} | ||
@@ -30,3 +56,3 @@ item[expr.key] = key | ||
*/ | ||
function unmountRedundant(items, tags, tagName, parent) { | ||
export function unmountRedundant(items, tags, tagName, parent) { | ||
@@ -50,3 +76,3 @@ var i = tags.length, | ||
*/ | ||
function moveNestedTags(child, i) { | ||
export function moveNestedTags(child, i) { | ||
Object.keys(child.tags).forEach(function(tagName) { | ||
@@ -70,3 +96,3 @@ var tag = child.tags[tagName] | ||
*/ | ||
function _each(dom, parent, expr) { | ||
export default function _each(dom, parent, expr) { | ||
@@ -78,3 +104,3 @@ // remove the each property from the original tag | ||
tagName = getTagName(dom), | ||
impl = __tagImpl[tagName] || { tmpl: getOuterHTML(dom) }, | ||
impl = __TAG_IMPL[tagName] || { tmpl: getOuterHTML(dom) }, | ||
useRoot = SPECIAL_TAGS_REGEX.test(tagName), | ||
@@ -127,3 +153,5 @@ root = dom.parentNode, | ||
// reorder only if the items are objects | ||
var _mustReorder = mustReorder && item instanceof Object && !hasKeys, | ||
var | ||
_mustReorder = mustReorder && typeof item == T_OBJECT && !hasKeys, | ||
oldPos = oldItems.indexOf(item), | ||
@@ -144,7 +172,7 @@ pos = ~oldPos && _mustReorder ? oldPos : i, | ||
tag = new Tag(impl, { | ||
parent: parent, | ||
parent, | ||
isLoop: true, | ||
hasImpl: !!__tagImpl[tagName], | ||
hasImpl: !!__TAG_IMPL[tagName], | ||
root: useRoot ? root : dom.cloneNode(), | ||
item: item | ||
item | ||
}, dom.innerHTML) | ||
@@ -151,0 +179,0 @@ |
@@ -0,3 +1,7 @@ | ||
import { remAttr, unmountAll } from '../util' | ||
import { tmpl } from 'riot-tmpl' | ||
import parseExpressions from './parse' | ||
import update from './update' | ||
function IfExpr(dom, parentTag, expr) { | ||
export default function IfExpr(dom, parentTag, expr) { | ||
remAttr(dom, 'if') | ||
@@ -4,0 +8,0 @@ this.parentTag = parentTag |
@@ -0,4 +1,5 @@ | ||
import { IE_VERSION, SPECIAL_TAGS_REGEX } from '../global-variables' | ||
import { mkEl, isSVGTag, setInnerHTML, $ } from '../util' | ||
/* | ||
lib/browser/tag/mkdom.js | ||
Includes hacks needed for the Internet Explorer version 9 and below | ||
@@ -8,107 +9,93 @@ See: http://kangax.github.io/compat-table/es5/#ie8 | ||
*/ | ||
var mkdom = (function (checkIE) { | ||
var | ||
reHasYield = /<yield\b/i, | ||
reYieldAll = /<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/ig, | ||
reYieldCls = /<yield\s+to=[^>]+>[\S\s]*?<\/yield\s*>\s*/ig, | ||
reYieldDest = /<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/ig, | ||
rsYieldSrc = '<yield\\s+to=[\'"]@[\'"]\\s*>([\\S\\s]*?)</yield\\s*>', | ||
rootEls = { tr: 'tbody', th: 'tr', td: 'tr', col: 'colgroup' }, | ||
GENERIC = 'div' | ||
const | ||
reHasYield = /<yield\b/i, | ||
reYieldAll = /<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>|>)/ig, | ||
reYieldSrc = /<yield\s+to=['"]([^'">]*)['"]\s*>([\S\s]*?)<\/yield\s*>/ig, | ||
reYieldDest = /<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/ig, | ||
rootEls = { tr: 'tbody', th: 'tr', td: 'tr', col: 'colgroup' }, | ||
tblTags = IE_VERSION && IE_VERSION < 10 | ||
? SPECIAL_TAGS_REGEX : /^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/, | ||
GENERIC = 'div' | ||
checkIE = checkIE && checkIE < 10 | ||
var tblTags = checkIE | ||
? SPECIAL_TAGS_REGEX : /^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/ | ||
/** | ||
* Creates a DOM element to wrap the given content. Normally an `DIV`, but can be | ||
* also a `TABLE`, `SELECT`, `TBODY`, `TR`, or `COLGROUP` element. | ||
* | ||
* @param {string} impl - Tag implementation with the template and root attributes | ||
* @param {string} [html] - HTML content that comes from the DOM element where you | ||
* will mount the tag, mostly the original tag in the page | ||
* @param {object} [attr] - Plain object where to store the root attributes | ||
* @returns {HTMLElement} DOM element with _templ_ merged through `YIELD` with the _html_. | ||
*/ | ||
function _mkdom(impl, html, attr) { | ||
/* | ||
Creates the root element for table or select child elements: | ||
tr/th/td/thead/tfoot/tbody/caption/col/colgroup/option/optgroup | ||
*/ | ||
function specialTags(el, templ, tagName) { | ||
var templ = impl.tmpl, | ||
match = templ && templ.match(/^\s*<([-\w]+)/), | ||
tagName = match && match[1].toLowerCase(), | ||
el = mkEl(GENERIC, isSVGTag(tagName)) | ||
var | ||
select = tagName[0] === 'o', | ||
parent = select ? 'select>' : 'table>' | ||
if (!html) html = '' | ||
// trim() is important here, this ensures we don't have artifacts, | ||
// so we can check if we have only one element inside the parent | ||
el.innerHTML = '<' + parent + templ.trim() + '</' + parent | ||
parent = el.firstChild | ||
if (impl.attrs) attr.attrs = replaceYield(impl.attrs, html) | ||
// returns the immediate parent if tr/th/td/col is the only element, if not | ||
// returns the whole tree, as this can include additional elements | ||
if (select) { | ||
parent.selectedIndex = -1 // for IE9, compatible w/current riot behavior | ||
} else { | ||
// avoids insertion of cointainer inside container (ex: tbody inside tbody) | ||
var tname = rootEls[tagName] | ||
if (tname && parent.childElementCount === 1) parent = $(tname, parent) | ||
} | ||
return parent | ||
} | ||
// replace all the yield tags with the tag inner html | ||
templ = replaceYield(templ, html) | ||
/* | ||
Replace the yield tag from any tag template with the innerHTML of the | ||
original tag in the page | ||
*/ | ||
function replaceYield(templ, html) { | ||
// do nothing if no yield | ||
if (!reHasYield.test(templ)) return templ | ||
/* istanbul ignore next */ | ||
if (tblTags.test(tagName)) | ||
el = specialTags(el, templ, tagName) | ||
else | ||
setInnerHTML(el, templ) | ||
// be careful with #1343 - string on the source having `$1` | ||
var src = {} | ||
el.stub = true | ||
html = html && html.replace(reYieldSrc, function (_, ref, text) { | ||
src[ref] = src[ref] || text // preserve first definition | ||
return '' | ||
}).trim() | ||
return el | ||
} | ||
return templ | ||
.replace(reYieldDest, function (_, ref, def) { // yield with from - to attrs | ||
return src[ref] || def || '' | ||
}) | ||
.replace(reYieldAll, function (_, def) { // yield without any "from" | ||
return html || def || '' | ||
}) | ||
} | ||
/* | ||
Creates the root element for table or select child elements: | ||
tr/th/td/thead/tfoot/tbody/caption/col/colgroup/option/optgroup | ||
*/ | ||
function specialTags(el, templ, tagName) { | ||
var | ||
select = tagName[0] === 'o', | ||
parent = select ? 'select>' : 'table>' | ||
/** | ||
* Creates a DOM element to wrap the given content. Normally an `DIV`, but can be | ||
* also a `TABLE`, `SELECT`, `TBODY`, `TR`, or `COLGROUP` element. | ||
* | ||
* @param {string} templ - The template coming from the custom tag definition | ||
* @param {string} [html] - HTML content that comes from the DOM element where you | ||
* will mount the tag, mostly the original tag in the page | ||
* @returns {HTMLElement} DOM element with _templ_ merged through `YIELD` with the _html_. | ||
*/ | ||
export default function mkdom(templ, html) { | ||
var match = templ && templ.match(/^\s*<([-\w]+)/), | ||
tagName = match && match[1].toLowerCase(), | ||
el = mkEl(GENERIC, isSVGTag(tagName)) | ||
// trim() is important here, this ensures we don't have artifacts, | ||
// so we can check if we have only one element inside the parent | ||
el.innerHTML = '<' + parent + templ.trim() + '</' + parent | ||
parent = el.firstChild | ||
// replace all the yield tags with the tag inner html | ||
templ = replaceYield(templ, html) | ||
// returns the immediate parent if tr/th/td/col is the only element, if not | ||
// returns the whole tree, as this can include additional elements | ||
if (select) { | ||
parent.selectedIndex = -1 // for IE9, compatible w/current riot behavior | ||
} else { | ||
// avoids insertion of cointainer inside container (ex: tbody inside tbody) | ||
var tname = rootEls[tagName] | ||
if (tname && parent.childNodes.length === 1) parent = $(tname, parent) | ||
} | ||
return parent | ||
} | ||
/* istanbul ignore next */ | ||
if (tblTags.test(tagName)) | ||
el = specialTags(el, templ, tagName) | ||
else | ||
setInnerHTML(el, templ) | ||
/* | ||
Replace the yield tag from any tag template with the innerHTML of the | ||
original tag in the page | ||
*/ | ||
function replaceYield(templ, html) { | ||
// do nothing if no yield | ||
if (!reHasYield.test(templ)) return templ | ||
el.stub = true | ||
// be careful with #1343 - string on the source having `$1` | ||
var n = 1 | ||
templ = templ.replace(reYieldDest, function (_, ref, def) { | ||
var m = html.match(RegExp(rsYieldSrc.replace('@', ref), 'i')) | ||
n = 0 | ||
return (m ? m[1] : def) || '' | ||
}) | ||
return el | ||
} | ||
// yield without any "from", replace yield in templ with the innerHTML | ||
if (n || reHasYield.test(templ)) { | ||
if (html) html = html.replace(reYieldCls, '').trim() | ||
templ = templ.replace(reYieldAll, function (_, def) { | ||
return html || def || '' | ||
}) | ||
} | ||
return templ | ||
} | ||
return _mkdom | ||
})(IE_VERSION) |
@@ -1,2 +0,12 @@ | ||
function NamedExpr(dom, attrName, attrValue, parent) { | ||
import { tmpl } from 'riot-tmpl' | ||
import { | ||
getImmediateCustomParentTag, | ||
isBlank, | ||
arrayishAdd, | ||
setAttr, | ||
remAttr, | ||
arrayishRemove | ||
} from '../util' | ||
export default function NamedExpr(dom, attrName, attrValue, parent) { | ||
this.dom = dom | ||
@@ -3,0 +13,0 @@ this.attr = attrName |
@@ -1,2 +0,9 @@ | ||
function parseExpressions(root, tag, expressions, includeRoot) { | ||
import IfExpr from './if' | ||
import NamedExpr from './named' | ||
import _each from './each' | ||
import { tmpl } from 'riot-tmpl' | ||
import { RIOT_TAG, BOOL_ATTRS } from '../global-variables' | ||
import { walk, getAttr, each, getTag, initChildTag, remAttr } from '../util' | ||
export default function parseExpressions(root, tag, expressions, includeRoot) { | ||
var base = {parent: {children: expressions}} | ||
@@ -3,0 +10,0 @@ |
@@ -1,12 +0,12 @@ | ||
/** | ||
* Object that will be used to inject and manage the css of every tag instance | ||
*/ | ||
var styleManager = (function(_riot) { | ||
import { $, mkEl, setAttr } from '../util' | ||
import { WIN } from '../global-variables' | ||
if (!window) return { // skip injection on the server | ||
add: function () {}, | ||
inject: function () {} | ||
} | ||
var styleNode, | ||
// Create cache and shortcut to the correct property | ||
cssTextProp, | ||
stylesToInject = '' | ||
var styleNode = (function () { | ||
// skip the following code on the server | ||
if (WIN) { | ||
styleNode = (function () { | ||
// create a new style element with the correct type | ||
@@ -26,37 +26,30 @@ var newNode = mkEl('style') | ||
})() | ||
cssTextProp = styleNode.styleSheet | ||
} | ||
// Create cache and shortcut to the correct property | ||
var cssTextProp = styleNode.styleSheet, | ||
stylesToInject = '' | ||
// Expose the style node in a non-modificable property | ||
Object.defineProperty(_riot, 'styleNode', { | ||
value: styleNode, | ||
writable: true | ||
}) | ||
/** | ||
* Object that will be used to inject and manage the css of every tag instance | ||
*/ | ||
export default { | ||
styleNode: styleNode, | ||
/** | ||
* Public api | ||
* Save a tag style to be later injected into DOM | ||
* @param { String } css [description] | ||
*/ | ||
return { | ||
/** | ||
* Save a tag style to be later injected into DOM | ||
* @param { String } css [description] | ||
*/ | ||
add: function(css) { | ||
stylesToInject += css | ||
}, | ||
/** | ||
* Inject all previously saved tag styles into DOM | ||
* innerHTML seems slow: http://jsperf.com/riot-insert-style | ||
*/ | ||
inject: function() { | ||
if (stylesToInject) { | ||
if (cssTextProp) cssTextProp.cssText += stylesToInject | ||
else styleNode.innerHTML += stylesToInject | ||
stylesToInject = '' | ||
} | ||
add: function(css) { | ||
if (WIN) stylesToInject += css | ||
}, | ||
/** | ||
* Inject all previously saved tag styles into DOM | ||
* innerHTML seems slow: http://jsperf.com/riot-insert-style | ||
*/ | ||
inject: function() { | ||
if (stylesToInject && WIN) { | ||
if (cssTextProp) cssTextProp.cssText += stylesToInject | ||
else styleNode.innerHTML += stylesToInject | ||
stylesToInject = '' | ||
} | ||
} | ||
} | ||
})(riot) | ||
@@ -1,4 +0,44 @@ | ||
function Tag(impl, conf, innerHTML) { | ||
import observable from 'riot-observable' | ||
import parseExpressions from './parse' | ||
import update from './update' | ||
import { tmpl } from 'riot-tmpl' | ||
import mkdom from './mkdom' | ||
import { mixin } from '../index' | ||
var self = riot.observable(this), | ||
import { | ||
GLOBAL_MIXIN, | ||
T_FUNCTION, | ||
T_UNDEF, | ||
T_STRING, | ||
RESERVED_WORDS_BLACKLIST, | ||
__VIRTUAL_DOM, | ||
RIOT_TAG_IS, | ||
RIOT_TAG | ||
} from '../global-variables' | ||
import { inherit, | ||
cleanUpData, | ||
defineProperty, | ||
extend, | ||
each, | ||
isFunction, | ||
walkAttributes, | ||
toCamel, | ||
isObject, | ||
isWritable, | ||
isInStub, | ||
contains, | ||
setAttr, | ||
remAttr, | ||
unmountAll, | ||
arrayishRemove, | ||
getImmediateCustomParentTag | ||
} from '../util' | ||
// counter to give a unique id to all the Tag instances | ||
var __uid = 0 | ||
export default function Tag(impl, conf, innerHTML) { | ||
var self = observable(this), | ||
opts = inherit(conf.opts) || {}, | ||
@@ -12,9 +52,8 @@ parent = conf.parent, | ||
root = conf.root, | ||
fn = impl.fn, | ||
tagName = conf.tagName || root.tagName.toLowerCase(), attr = {}, | ||
implAttr = {}, | ||
tagName = conf.tagName || root.tagName.toLowerCase(), | ||
attr = {}, | ||
propsInSyncWithParent = [], | ||
dom | ||
// only call unmount if we have a valid __tagImpl (has name property) | ||
// only call unmount if we have a valid __TAG_IMPL (has name property) | ||
if (impl.name && root._tag) root._tag.unmount(true) | ||
@@ -31,3 +70,5 @@ | ||
extend(this, { parent: parent, root: root, opts: opts, tags: {} }, item) | ||
extend(this, { parent: parent, root: root, opts: opts}, item) | ||
// protect the "tags" property from being overridden | ||
defineProperty(this, 'tags', {}) | ||
@@ -41,4 +82,3 @@ // grab attributes | ||
dom = mkdom(impl, innerHTML, implAttr) | ||
implAttr = implAttr.attrs || '' | ||
dom = mkdom(impl.tmpl, innerHTML) | ||
@@ -94,3 +134,3 @@ // options | ||
defineProperty(this, 'update', function tagUpdate(data) { | ||
if (typeof self.shouldUpdate == T_FUNCTION && !self.shouldUpdate()) return | ||
if (isFunction(self.shouldUpdate) && !self.shouldUpdate()) return | ||
@@ -121,3 +161,3 @@ // make sure the data passed will not override | ||
mix = typeof mix === T_STRING ? riot.mixin(mix) : mix | ||
mix = typeof mix === T_STRING ? mixin(mix) : mix | ||
@@ -156,3 +196,3 @@ // check if the mixin is a function | ||
// add global mixin | ||
var globalMixin = riot.mixin(GLOBAL_MIXIN) | ||
var globalMixin = mixin(GLOBAL_MIXIN) | ||
if (globalMixin) | ||
@@ -164,10 +204,10 @@ for (var i in globalMixin) | ||
// initialiation | ||
if (fn) fn.call(self, opts) | ||
if (impl.fn) impl.fn.call(self, opts) | ||
// update the root adding custom attributes coming from the compiler | ||
// it fixes also #1087 | ||
if (implAttr || hasImpl) { | ||
walkAttributes(implAttr, function (k, v) { setAttr(root, k, v) }) | ||
if (impl.attrs) | ||
walkAttributes(impl.attrs, function (k, v) { setAttr(root, k, v) }) | ||
if (impl.attrs || hasImpl) | ||
parseExpressions(self.root, self, expressions) | ||
} | ||
@@ -214,3 +254,3 @@ // parse layout after init. fn may calculate args for nested custom tags | ||
ptag, | ||
tagIndex = __virtualDom.indexOf(self) | ||
tagIndex = __VIRTUAL_DOM.indexOf(self) | ||
@@ -221,3 +261,3 @@ self.trigger('before-unmount') | ||
if (~tagIndex) | ||
__virtualDom.splice(tagIndex, 1) | ||
__VIRTUAL_DOM.splice(tagIndex, 1) | ||
@@ -224,0 +264,0 @@ if (p) { |
@@ -0,1 +1,26 @@ | ||
import { tmpl } from 'riot-tmpl' | ||
import { | ||
RIOT_PREFIX, | ||
T_OBJECT, | ||
RIOT_TAG, | ||
WIN, | ||
__TAG_IMPL, | ||
IE_VERSION | ||
} from '../global-variables' | ||
import { | ||
each, | ||
remAttr, | ||
isFunction, | ||
startsWith, | ||
setAttr, | ||
getImmediateCustomParentTag, | ||
initChildTag, | ||
isArray, | ||
isWritable, | ||
makeVirtual | ||
} from '../util' | ||
/** | ||
@@ -8,3 +33,3 @@ * Attach an event to a DOM node | ||
*/ | ||
function setEventHandler(name, handler, dom, tag) { | ||
export function setEventHandler(name, handler, dom, tag) { | ||
@@ -23,3 +48,3 @@ dom[name] = function(e) { | ||
// cross browser event fix | ||
e = e || window.event | ||
e = e || WIN.event | ||
@@ -48,3 +73,3 @@ // override the event properties | ||
*/ | ||
function update(expressions, tag) { | ||
export default function update(expressions, tag) { | ||
@@ -64,10 +89,2 @@ each(expressions, function(expr, i) { | ||
// leave out riot- prefixes from strings inside textarea | ||
// fix #815: any value -> string | ||
if (parent && parent.tagName == 'TEXTAREA') { | ||
value = ('' + value).replace(/riot-/g, '') | ||
// change textarea's value | ||
parent.value = value | ||
} | ||
if (expr._riot_id) { // if it's a tag | ||
@@ -106,5 +123,15 @@ if (expr.isMounted) { | ||
// text node | ||
// textarea and text nodes have no attribute name | ||
if (!attrName) { | ||
dom.nodeValue = '' + value // #815 related | ||
// about #815 w/o replace: the browser converts the value to a string, | ||
// the comparison by "==" does too, but not in the server | ||
value += '' | ||
// test for parent avoids error with invalid assignment to nodeValue | ||
if (parent) { | ||
if (parent.tagName === 'TEXTAREA') { | ||
parent.value = value // #1113 | ||
if (!IE_VERSION) dom.nodeValue = value // #1625 IE throws here, nodeValue | ||
} // will be available on 'updated' | ||
else dom.nodeValue = value | ||
} | ||
return | ||
@@ -177,3 +204,3 @@ } | ||
expr.impl = __tagImpl[tagName] | ||
expr.impl = __TAG_IMPL[tagName] | ||
conf = {root: expr.dom, parent: parent, hasImpl: true, tagName: tagName} | ||
@@ -180,0 +207,0 @@ expr.tag = initChildTag(expr.impl, conf, expr.dom.innerHTML, parent) |
@@ -1,17 +0,2 @@ | ||
import 'browser/wrap/prefix' | ||
import 'browser/global-variables' | ||
/* istanbul ignore next */ | ||
import '../node_modules/riot-observable/dist/riot.observable.js' | ||
/* istanbul ignore next */ | ||
import '../node_modules/riot-tmpl/dist/riot.tmpl.js' | ||
import 'browser/tag/mkdom' | ||
import 'browser/tag/each' | ||
import 'browser/tag/if' | ||
import 'browser/tag/named' | ||
import 'browser/tag/styleManager' | ||
import 'browser/tag/parse' | ||
import 'browser/tag/tag' | ||
import 'browser/tag/update' | ||
import 'browser/tag/util' | ||
import 'browser/index' | ||
import 'browser/wrap/suffix' | ||
import * as r from './browser/index' | ||
export default r |
@@ -1,20 +0,3 @@ | ||
import 'browser/wrap/prefix' | ||
import 'browser/global-variables' | ||
/* istanbul ignore next */ | ||
import '../node_modules/riot-observable/dist/riot.observable.js' | ||
/* istanbul ignore next */ | ||
import '../node_modules/riot-tmpl/dist/riot.tmpl.js' | ||
import 'browser/tag/mkdom' | ||
import 'browser/tag/each' | ||
import 'browser/tag/if' | ||
import 'browser/tag/named' | ||
import 'browser/tag/styleManager' | ||
import 'browser/tag/parse' | ||
import 'browser/tag/tag' | ||
import 'browser/tag/update' | ||
import 'browser/tag/util' | ||
import 'browser/index' | ||
/* istanbul ignore next */ | ||
import '../node_modules/riot-compiler/dist/riot.compiler.js' | ||
import 'browser/compiler/compile' | ||
import 'browser/wrap/suffix' | ||
import r from './browser/compiler/compile' | ||
export default r | ||
// allow to require('riot') | ||
var riot = module.exports = require(process.env.RIOT || require('path').resolve(__dirname, '../../riot')) | ||
const riot = module.exports = require(process.env.RIOT || require('path').resolve(__dirname, '../../riot')), | ||
// simple-dom helper | ||
sdom = require('./sdom'), | ||
compiler = require('riot-compiler') | ||
var compiler = require('riot-compiler') | ||
// allow to require('riot').compile | ||
riot.compile = compiler.compile | ||
riot.parsers = compiler.parsers | ||
function render(tagName, opts) { | ||
var tag = render.tag(tagName, opts), | ||
html = sdom.serialize(tag.root) | ||
// unmount the tag avoiding memory leaks | ||
tag.unmount() | ||
return html | ||
} | ||
// extend the render function with some static methods | ||
render.dom = function(tagName, opts) { | ||
return riot.render.tag(tagName, opts).root | ||
} | ||
render.tag = function(tagName, opts) { | ||
var root = document.createElement(tagName), | ||
tag = riot.mount(root, opts)[0] | ||
return tag | ||
} | ||
// allow to require('some.tag') | ||
require.extensions['.tag'] = function(module, filename) { | ||
var src = riot.compile(require('fs').readFileSync(filename, 'utf8')) | ||
var src = compiler.compile(require('fs').readFileSync(filename, 'utf8')) | ||
module._compile( | ||
@@ -20,21 +35,16 @@ 'var riot = require(process.env.RIOT || "riot/riot.js");module.exports =' + src | ||
// simple-dom helper | ||
var sdom = require('./sdom') | ||
// extend the riot api adding some useful serverside methods | ||
module.exports = exports.default = Object.assign({ | ||
// allow to require('riot').compile | ||
compile: compiler.compile, | ||
parsers: compiler.parsers, | ||
render: render | ||
}, riot) | ||
riot.render = function(tagName, opts) { | ||
var tag = riot.render.tag(tagName, opts), | ||
html = sdom.serialize(tag.root) | ||
// unmount the tag avoiding memory leaks | ||
tag.unmount() | ||
return html | ||
} | ||
riot.render.dom = function(tagName, opts) { | ||
return riot.render.tag(tagName, opts).root | ||
} | ||
riot.render.tag = function(tagName, opts) { | ||
var root = document.createElement(tagName), | ||
tag = riot.mount(root, opts)[0] | ||
return tag | ||
} | ||
@@ -13,2 +13,5 @@ // simple-dom helper | ||
// easy like a pie! closes #1780 | ||
document.createElementNS = document.createElement | ||
// add `innerHTML` property to simple-dom element | ||
@@ -15,0 +18,0 @@ Object.defineProperty(simpleDom.Element.prototype, 'innerHTML', { |
{ | ||
"name": "riot", | ||
"version": "3.0.0-alpha.3", | ||
"version": "3.0.0-alpha.4", | ||
"description": "A React-like user interface micro-library", | ||
@@ -52,14 +52,15 @@ "homepage": "http://riotjs.com/", | ||
"simple-dom": "0.3.0", | ||
"simple-html-tokenizer": "^0.2.3" | ||
"simple-html-tokenizer": "^0.2.5" | ||
}, | ||
"devDependencies": { | ||
"babel-plugin-transform-es2015-template-literals": "^6.8.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"benchmark": "^2.1.0", | ||
"cheerio": "^0.20.0", | ||
"coveralls": "^2.11.9", | ||
"eslint": "^2.9.0", | ||
"eslint": "^2.10.2", | ||
"expect.js": "^0.3.1", | ||
"glob": "^7.0.3", | ||
"istanbul": "^0.4.3", | ||
"jsdom": "^9.0.0", | ||
"jsdom": "^9.1.0", | ||
"karma": "^0.13.22", | ||
@@ -74,3 +75,7 @@ "karma-babel-preprocessor": "^6.0.1", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"smash": "0.0.15", | ||
"rollup": "^0.26.3", | ||
"rollup-plugin-alias": "^1.2.0", | ||
"rollup-plugin-babel": "^2.4.0", | ||
"rollup-plugin-commonjs": "^2.2.1", | ||
"rollup-plugin-npm": "^1.4.0", | ||
"uglify-js": "latest" | ||
@@ -86,5 +91,3 @@ }, | ||
"riot+compiler.js", | ||
"riot+compiler.min.js", | ||
"riot+compiler.csp.js", | ||
"riot+compiler.csp.min.js" | ||
"riot+compiler.min.js" | ||
], | ||
@@ -91,0 +94,0 @@ "bin": { |
@@ -28,3 +28,3 @@ | ||
| Vue | 1.0.21 | 25.98kb | | ||
| Riot | 2.4.0 | 9.18kb | | ||
| Riot | 2.4.1 | 9.23kb | | ||
@@ -129,2 +129,3 @@ | ||
- [An express, riot, jade, webpack simple boilerplate](https://github.com/revington/frontend-boilerplate) | ||
- [Riot.js vs React.js comparison of a simple comment box](https://github.com/vitogit/riot.js-vs-react.js-comment-box) | ||
@@ -143,2 +144,3 @@ ### Tutorials | ||
- [Using TDD with Riot+mocha+chai](http://vitomd.com/blog/coding/tutorial_tdd_riot_mocha/) | ||
- [The Basics - from ground up to connected tag-networks](http://happy-css.com/lessons/riotjs/) | ||
@@ -172,2 +174,3 @@ ### Video Tutorials | ||
- [Riot Routehandler](https://github.com/crisward/riot-routehandler)-[(Demo)](http://codepen.io/crisward/pen/xwGJpM?editors=101) | ||
- [Riot Flipcard](https://github.com/crisward/riot-flipcard) - [(Demo)](https://crisward.github.io/riot-flipcard/) | ||
- [Riot Grid](https://github.com/crisward/riot-grid) - [(Demo)](http://codepen.io/crisward/pen/rxepMX?editors=101) | ||
@@ -174,0 +177,0 @@ - [ESLint Riot Plugin](https://github.com/txchen/eslint-plugin-riot) |
@@ -1,2 +0,2 @@ | ||
/* Riot v3.0.0-alpha.3, @license MIT */ | ||
!function(e,t){"use strict";function n(e,t,n,r){var i=r?Object.create(r):{};return i[e.key]=t,e.pos&&(i[e.pos]=n),i}function r(e,t,n,r){for(var i,o=t.length,a=e.length;o>a;)i=t[--o],t.splice(o,1),i.unmount(),q(r.tags,n,i,!0)}function i(e,t){Object.keys(e.tags).forEach(function(n){var r=e.tags[n];A(r)?d(r,function(e){T(e,n,t)}):T(r,n,t)})}function o(e,t,o){b(e,"each");var a,u=typeof _(e,"no-reorder")!==re||b(e,"no-reorder"),s=S(e),c=Y[s]||{tmpl:g(e)},f=ue.test(s),p=e.parentNode,h=document.createTextNode(""),m=C(e),v="option"===s.toLowerCase(),y=[],x=[],w="VIRTUAL"==e.tagName;o=he.loopKeys(o),o.isLoop=!0;var N=_(e,"if");return N&&b(e,"if"),p.insertBefore(h,e),p.removeChild(e),o.update=function(){var d=he(o.val,t),g=document.createDocumentFragment();if(p=h.parentNode,A(d)||(a=d||!1,d=a?Object.keys(d).map(function(e){return n(o,e,d[e])}):[]),N&&(d=d.filter(function(e,r){var i=n(o,e,r,t);return!!he(N,i)})),d.forEach(function(r,d){var h,v=u&&r instanceof Object&&!a,b=x.indexOf(r),_=~b&&v?b:d,N=y[_];r=!a&&o.key?n(o,r,d):r,!v&&!N||v&&!~b||!N?(N=new l(c,{parent:t,isLoop:!0,hasImpl:!!Y[s],root:f?p:e.cloneNode(),item:r},e.innerHTML),N.mount(),h=N.root,d==y.length?w?z(N,g):g.appendChild(h):(w?z(N,p,y[d]):p.insertBefore(h,y[d].root),x.splice(d,0,r)),y.splice(d,0,N),m&&V(t.tags,s,N,!0),_=d):N.update(r),_!==d&&v&&(w?Z(N,p,y[d]):p.insertBefore(N.root,y[d].root),o.pos&&(N[o.pos]=d),y.splice(d,0,y.splice(_,1)[0]),x.splice(d,0,x.splice(_,1)[0]),!m&&N.tags&&i(N,d)),N._item=r,O(N,"_parent",t)}),r(d,y,s,t),v){if(p.appendChild(g),pe&&!p.multiple)for(var b=0;b<p.length;b++)if(p[b].__riot1374){p.selectedIndex=b,delete p[b].__riot1374;break}}else p.insertBefore(g,h);x=d.slice()},o.unmount=function(){d(y,function(e){e.unmount()})},o}function a(e,t,n){b(e,"if"),this.parentTag=t,this.expr=n,this.stub=document.createTextNode(""),this.pristine=e;var r=e.parentNode;r.insertBefore(this.stub,e),r.removeChild(e)}function u(e,t,n,r){this.dom=e,this.attr=t,this.rawValue=n,this.parent=r,this.customParent=L(r),this.hasExp=he.hasExpr(n),this.firstRun=!0}function s(e,t,n,r){var i={parent:{children:n}};k(e,function(n,i){var s,l,c,f=n.nodeType,p=i.parent;if(3==f&&"STYLE"!=n.parentNode.tagName&&he.hasExpr(n.nodeValue)&&p.children.push({dom:n,expr:n.nodeValue}),1!=f)return i;if(s=_(n,"each"))return p.children.push(o(n,t,s)),!1;if(s=_(n,"if"))return p.children.push(new a(n,t,s)),!1;var h=[],g=[];d(n.attributes,function(e){var r=e.name,i=ce.test(r),o=he.hasExpr(e.value);return"name"===r||"id"===r?(l=new u(n,r,e.value,t),p.children.push(l),g.push(l),void h.push(l)):(l={dom:n,expr:e.value,attr:e.name,bool:i},h.push(l),o?(p.children.push(l),i?(b(n,r),!1):void 0):void 0)}),(l=_(n,te))&&he.hasExpr(l)&&(s={isRtag:!0,expr:l,dom:n,children:[]},p.children.push(s),p=s);var m=C(n);if(m&&(n!==e||r)){var v={root:n,parent:t,hasImpl:!0,ownAttrs:h};return c=E(m,v,n.innerHTML,t),p.children.push(c),d(g,function(e){e.tag=c}),!1}return{parent:p}},i)}function l(e,t,n){function r(){var e=g&&p?u:c||u;m?d(m||[],function(e){var t=e.hasOwnProperty("value")?e.value:e.expr;l[w(e.attr)]=t}):d(_.attributes,function(t){var n=t.value,r=he.hasExpr(n);r&&m||(l[w(t.name)]=r?he(n,e):n)})}function i(e){for(var t in v)typeof u[t]!==oe&&j(u,t)&&(u[t]=e[t])}function o(){d(Object.keys(u.parent),function(e){var t=!se.test(e)&&I(A,e);(typeof u[e]===oe||t)&&(t||A.push(e),u[e]=u.parent[e])})}var a,u=Q.observable(this),l=U(t.opts)||{},c=t.parent,p=t.isLoop,g=t.hasImpl,m=t.ownAttrs,v=P(t.item),x=[],_=t.root,C=e.fn,T=t.tagName||_.tagName.toLowerCase(),E={},S={},A=[];e.name&&_._tag&&_._tag.unmount(!0),this.isMounted=!1,_.isLoop=p,this._hasImpl=g,O(this,"_riot_id",++W),R(this,{parent:c,root:_,opts:l,tags:{}},v),d(_.attributes,function(e){var t=e.value;he.hasExpr(t)&&(E[e.name]=t)}),a=ge(e,n,S),S=S.attrs||"",O(this,"update",function(e){return typeof u.shouldUpdate!=ae||u.shouldUpdate()?(e=P(e),p&&!g&&o(),e&&y(v)&&(i(e),v=e),R(u,e),r(),u.isMounted&&u.trigger("update",e),f(x,u),u.isMounted&&u.trigger("updated"),this):void 0}),O(this,"mixin",function(){return d(arguments,function(e){var t;e=typeof e===re?Q.mixin(e):e,h(e)?(t=new e,e=e.prototype):t=e,d(Object.getOwnPropertyNames(e),function(e){"init"!=e&&(u[e]=h(t[e])?t[e].bind(u):t[e])}),t.init&&t.init.bind(u)()}),this}),O(this,"mount",function(e){r(),_._tag=this;var t=Q.mixin(J);if(t)for(var n in t)t.hasOwnProperty(n)&&u.mixin(t[n]);if(C&&C.call(u,l),(S||g)&&($(S,function(e,t){N(_,e,t)}),s(u.root,u,x)),s(a,u,x),u.update(v),u.trigger("before-mount"),p&&!g)u.root=_=a.firstChild;else{for(;a.firstChild;)_.appendChild(a.firstChild);_.stub&&(u.root=_=c.root)}O(u,"root",_),u.isMounted=!0,!u.parent||u.parent.isMounted?u.trigger("mount"):u.parent.one("mount",function(){H(u.root)||u.trigger("mount")})}),O(this,"unmount",function(e){var t,n=u.root,r=n.parentNode,i=X.indexOf(u);if(u.trigger("before-unmount"),~i&&X.splice(i,1),r){if(c)t=L(c),q(t.tags,T,u);else for(;n.firstChild;)n.removeChild(n.firstChild);e?(b(r,ne),b(r,te)):r.removeChild(n)}this._virts&&d(this._virts,function(e){e.parentNode&&e.parentNode.removeChild(e)}),M(x),u.trigger("unmount"),u.off("*"),u.isMounted=!1,delete u.root._tag})}function c(t,n,r,i){r[t]=function(t){var o=i._parent,a=i._item;if(!a)for(;o&&!a;)a=o._item,o=o._parent;t=t||e.event,j(t,"currentTarget")&&(t.currentTarget=r),j(t,"target")&&(t.target=t.srcElement),j(t,"which")&&(t.which=t.charCode||t.keyCode),t.item=a,n.call(i,t),t.preventUpdate||L(i).update()}}function f(e,t){d(e,function(e,n){var r=e.dom,i=e.attr,o=he(e.expr,t),a=r&&r.parentNode,u="value"==i;if(e.bool?o=o?i:!1:null==o&&(o=""),a&&"TEXTAREA"==a.tagName&&(o=(""+o).replace(/riot-/g,""),a.value=o),e._riot_id){if(e.isMounted)e.update();else if(e.mount(),"VIRTUAL"==e.root.tagName){var s=document.createDocumentFragment();z(e,s),e.root.parentElement.replaceChild(s,e.root)}}else{if(e.update)return void e.update();var l=e.value;if(e.value=o,e.isRtag&&o)return p(e,t);if(!(u&&r.value==o||!u&&l===o)){if(!i)return void(r.nodeValue=""+o);if(b(r,i),h(o))c(i,o,r,t);else if(/^(show|hide)$/.test(i))"hide"==i&&(o=!o),r.style.display=o?"":"none";else if("value"==i)r.value=o;else if(G(i,ee)&&i!=te)o&&N(r,i.slice(ee.length),o);else{if("selected"==i&&a&&/^(SELECT|OPTGROUP)$/.test(a.nodeName)&&o&&(a.value=r.value),e.bool&&(r[i]=o,!o))return;(0===o||o&&typeof o!==ie)&&N(r,i,o)}}}})}function p(e,t){var n,r=he(e.value,t);if(e.tag&&e.tagName==r)return void e.tag.update();if(e.tag){var i=e.tag.opts.riotTag,o=e.tag._parent.tags[i];A(o)?o.splice(o.indexOf(e.tag),1):delete e.tag._parent.tags[i]}e.impl=Y[r],n={root:e.dom,parent:t,hasImpl:!0,tagName:r},e.tag=E(e.impl,n,e.dom.innerHTML,t),e.tagName=r,e.tag.mount(),e.tag.update()}function d(e,t){for(var n,r=e?e.length:0,i=0;r>i;i++)n=e[i],null!=n&&t(n,i)===!1&&i--;return e}function h(e){return typeof e===ae||!1}function g(e){if(e.outerHTML)return e.outerHTML;var t=B("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function m(e,t){if(typeof e.innerHTML!=oe)e.innerHTML=t;else{var n=(new DOMParser).parseFromString(t,"application/xml");e.appendChild(e.ownerDocument.importNode(n.documentElement,!0))}}function v(e){return~le.indexOf(e)}function y(e){return e&&typeof e===ie}function x(e){return typeof e===oe||null===e||""===e}function b(e,t){e.removeAttribute(t)}function w(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function _(e,t){return e.getAttribute(t)}function N(e,t,n){e.setAttribute(t,n)}function C(e){return e.tagName&&Y[_(e,ne)||_(e,te)||e.tagName.toLowerCase()]}function T(e,t,n){var r,i=e.parent;i&&(r=i.tags[t],A(r)?r.splice(n,0,r.splice(r.indexOf(e),1)[0]):V(i.tags,t,e))}function E(e,t,n,r){var i=new l(e,t,n),o=t.tagName||S(t.root,!0),a=L(r);return i.parent=a,i._parent=r,V(a.tags,o,i),a!==r&&V(r.tags,o,i),t.root.innerHTML="",i}function L(e){for(var t=e;!t._hasImpl&&t.parent;)t=t.parent;return t}function M(e){var t,n,r=e.length;for(t=0;r>t;t++)n=e[t],n instanceof l?n.unmount(!0):n.unmount&&n.unmount()}function O(e,t,n,r){return Object.defineProperty(e,t,R({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function S(e,t){var n=C(e),r=!t&&_(e,"name"),i=r&&!he.hasExpr(r)?r:n?n.name:e.tagName.toLowerCase();return i}function R(e){for(var t,n=arguments,r=1;r<n.length;++r)if(t=n[r])for(var i in t)j(e,i)&&(e[i]=t[i]);return e}function I(e,t){return~e.indexOf(t)}function A(e){return Array.isArray(e)||e instanceof Array}function j(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return typeof e[t]===oe||n&&n.writable}function P(e){if(!(e instanceof l||e&&typeof e.trigger==ae))return e;var t={};for(var n in e)se.test(n)||(t[n]=e[n]);return t}function k(e,t,n){if(e){var r,i=t(e,n);if(i===!1)return;for(e=e.firstChild;e;)r=e.nextSibling,k(e,t,i),e=r}}function $(e,t){for(var n,r=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g;n=r.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function H(e){for(;e;){if(e.inStub)return!0;e=e.parentNode}return!1}function B(e,t){return t?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(e)}function F(e,t){return(t||document).querySelectorAll(e)}function D(e,t){return(t||document).querySelector(e)}function U(e){function t(){}return t.prototype=e,new t}function V(e,t,n,r){var i=e[t],o=A(i);i&&i===n||(!i&&r?e[t]=[n]:i?(!o||o&&!I(i,n))&&(o?i.push(n):e[t]=[i,n]):e[t]=n)}function q(e,t,n,r){A(e[t])?(d(e[t],function(r,i){r===n&&e[t].splice(i,1)}),e[t].length?1!=e[t].length||r||(e[t]=e[t][0]):delete e[t]):delete e[t]}function G(e,t){return e.slice(0,t.length)===t}function K(e,t,n){var r=Y[t],i=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";var o={root:e,opts:n};return n&&n.parent&&(o.parent=n.parent),r&&e&&(r=new l(r,o,i)),r&&r.mount&&(r.mount(!0),I(X,r)||X.push(r)),r}function z(e,t,n){var r,i,o=document.createTextNode(""),a=document.createTextNode("");for(e._head=e.root.insertBefore(o,e.root.firstChild),e._tail=e.root.appendChild(a),i=e._head,e._virts=[];i;)r=i.nextSibling,n?t.insertBefore(i,n._head):t.appendChild(i),e._virts.push(i),i=r}function Z(e,t,n){for(var r,i=e._head;i;)if(r=i.nextSibling,t.insertBefore(i,n._head),i=r,i==e._tail){t.insertBefore(i,n._head);break}}var Q={version:"v3.0.0-alpha.3",settings:{}},W=0,X=[],Y={},J="__global_mixin",ee="riot-",te="data-is",ne="data-is",re="string",ie="object",oe="undefined",ae="function",ue=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/,se=/^(?:_(?:item|id|parent)|update|root|(?:un)?mount|mixin|is(?:Mounted|Loop)|tags|parent|opts|trigger|o(?:n|ff|ne))$/,le=["altGlyph","animate","animateColor","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","font","foreignObject","g","glyph","glyphRef","image","line","linearGradient","marker","mask","missing-glyph","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tref","tspan","use"],ce=/^(?: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)$/,fe=0|(e&&e.document||{}).documentMode,pe=e&&!!e.InstallTrigger;Q.observable=function(e){function t(e,t){for(var n,r,i=e.split(" "),o=i.length,a=0;o>a;a++)n=i[a],r=n.indexOf("."),n&&t(~r?n.substring(0,r):n,a,~r?n.slice(r+1):null)}e=e||{};var n={},r=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(r,i){return"function"!=typeof i?e:(t(r,function(e,t,r){(n[e]=n[e]||[]).push(i),i.typed=t>0,i.ns=r}),e)},enumerable:!1,writable:!1,configurable:!1},off:{value:function(r,i){return"*"!=r||i?t(r,function(e,t,r){if(i||r)for(var o,a=n[e],u=0;o=a&&a[u];++u)(o==i||r&&o.ns==r)&&a.splice(u--,1);else delete n[e]}):n={},e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(i){for(var o,a=arguments.length-1,u=new Array(a),s=0;a>s;s++)u[s]=arguments[s+1];return t(i,function(t,i,a){o=r.call(n[t]||[],0);for(var s,l=0;s=o[l];++l)s.busy||(s.busy=1,a&&s.ns!=a||s.apply(e,s.typed?[t].concat(u):u),o[l]!==s&&l--,s.busy=0);n["*"]&&"*"!=t&&e.trigger.apply(e,["*",t].concat(u))}),e},enumerable:!1,writable:!1,configurable:!1}}),e};var de=function(e){function t(e){return e}function n(e,t){return t||(t=v),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?l:"")}function r(e){if(e===h)return g;var t=e.split(" ");if(2!==t.length||/[\x00-\x1F<>a-zA-Z0-9'",;\\]/.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(/(?=[[\]()*+?.^$|])/g,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:g[4],t),t[5]=n(e.length>3?/\\({|})/g:g[5],t),t[6]=n(g[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+p,l),t[8]=e,t}function i(e){return e instanceof RegExp?u(e):v[e]}function o(e){(e||(e=h))!==v[8]&&(v=r(e),u=e===h?t:n,v[9]=u(g[9])),m=e}function a(e){var t;e=e||{},t=e.brackets,Object.defineProperty(e,"brackets",{set:o,get:function(){return m},enumerable:!0}),s=e,o(t)}var u,s,l="g",c=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,f=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'/g,p=f.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?(\/)[gim]*/.source,d={"(":RegExp("([()])|"+p,l),"[":RegExp("([[\\]])|"+p,l),"{":RegExp("([{}])|"+p,l)},h="{ }",g=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+p,l),h,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],m=e,v=[];return i.split=function(e,t,n){function r(e){t||a?l.push(e&&e.replace(n[5],"$1")):l.push(e)}function i(e,t,n){var r,i=d[t];for(i.lastIndex=n,n=1;(r=i.exec(e))&&(!r[1]||(r[1]===t?++n:--n)););return n?e.length:i.lastIndex}n||(n=v);var o,a,u,s,l=[],c=n[6];for(a=u=c.lastIndex=0;o=c.exec(e);){if(s=o.index,a){if(o[2]){c.lastIndex=i(e,o[2],c.lastIndex);continue}if(!o[3])continue}o[1]||(r(e.slice(u,s)),u=c.lastIndex,c=n[6+(a^=1)],c.lastIndex=u)}return e&&u<e.length&&r(e.slice(u)),l},i.hasExpr=function(e){return v[4].test(e)},i.loopKeys=function(e){var t=e.match(v[9]);return t?{key:t[1],pos:t[2],val:v[0]+t[3].trim()+v[1]}:{val:e.trim()}},i.array=function(e){return e?r(e):v},Object.defineProperty(i,"settings",{set:a,get:function(){return s}}),i.settings="undefined"!=typeof Q&&Q.settings||{},i.set=o,i.R_STRINGS=f,i.R_MLCOMMS=c,i.S_QBLOCKS=p,i}(),he=function(){function t(e,t){return e?(u[e]||(u[e]=r(e))).call(t,n):e}function n(e,n){t.errorHandler&&(e.riotData={tagName:n&&n.root&&n.root.tagName,_riot_id:n&&n._riot_id},t.errorHandler(e))}function r(e){var t=i(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function i(e){var t,n=[],r=de.split(e.replace(f,'"'),1);if(r.length>2||r[0]){var i,a,u=[];for(i=a=0;i<r.length;++i)t=r[i],t&&(t=1&i?o(t,1,n):'"'+t.replace(/\\/g,"\\\\").replace(/\r\n?|\n/g,"\\n").replace(/"/g,'\\"')+'"')&&(u[a++]=t);t=2>a?u[0]:"["+u.join(",")+'].join("")'}else t=o(r[1],0,n);return n[0]&&(t=t.replace(p,function(e,t){return n[t].replace(/\r/g,"\\r").replace(/\n/g,"\\n")})),t}function o(e,t,n){function r(t,n){var r,i=1,o=d[t];for(o.lastIndex=n.lastIndex;r=o.exec(e);)if(r[0]===t)++i;else if(!--i)break;n.lastIndex=i?e.length:o.lastIndex}if(e=e.replace(c,function(e,t){return e.length>2&&!t?s+(n.push(e)-1)+"~":e}).replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,o=[],u=0;e&&(i=e.match(l))&&!i.index;){var f,p,h=/,|([[{(])|$/g;for(e=RegExp.rightContext,f=i[2]?n[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];p=(i=h.exec(e))[1];)r(p,h);p=e.slice(0,i.index),e=RegExp.rightContext,o[u++]=a(p,1,f)}e=u?u>1?"["+o.join(",")+'].join(" ").trim()':o[0]:a(e,t)}return e}function a(e,t,n){var r;return e=e.replace(g,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+h+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!m.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var u={};t.haveRaw=de.hasRaw,t.hasExpr=de.hasExpr,t.loopKeys=de.loopKeys,t.errorHandler=null;var s="⁗",l=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,c=RegExp(de.S_QBLOCKS,"g"),f=/\u2057/g,p=/\u2057(\d+)~/g,d={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},h='"in this?this:'+("object"!=typeof e?"global":"window")+").",g=/[,{][$\w]+:|(^ *|[^$\w\.])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,m=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return t.parse=function(e){return e},t.version=de.version="v2.4.0",t}(),ge=function(e){function t(e,t,i){var o=e.tmpl,a=o&&o.match(/^\s*<([-\w]+)/),u=a&&a[1].toLowerCase(),s=B(c,v(u));return t||(t=""),e.attrs&&(i.attrs=r(e.attrs,t)),o=r(o,t),f.test(u)?s=n(s,o,u):m(s,o),s.stub=!0,s}function n(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"</"+i,i=e.firstChild,r)i.selectedIndex=-1;else{var o=l[n];o&&1===i.childNodes.length&&(i=D(o,i))}return i}function r(e,t){if(!i.test(e))return e;var n=1;return e=e.replace(u,function(e,r,i){var o=t.match(RegExp(s.replace("@",r),"i"));return n=0,(o?o[1]:i)||""}),(n||i.test(e))&&(t&&(t=t.replace(a,"").trim()),e=e.replace(o,function(e,n){return t||n||""})),e}var i=/<yield\b/i,o=/<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,a=/<yield\s+to=[^>]+>[\S\s]*?<\/yield\s*>\s*/gi,u=/<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,s="<yield\\s+to=['\"]@['\"]\\s*>([\\S\\s]*?)</yield\\s*>",l={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},c="div";e=e&&10>e;var f=e?ue:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/;return t}(fe);a.prototype.update=function(){var e=he(this.expr,this.parentTag);e&&!this.current?(this.current=this.pristine.cloneNode(!0),this.stub.parentNode.insertBefore(this.current,this.stub),this.expressions=[],s(this.current,this.parentTag,this.expressions,!0)):!e&&this.current&&(M(this.expressions),this.current.parentNode.removeChild(this.current),this.current=null,this.expressions=[]),e&&f(this.expressions,this.parentTag)},a.prototype.unmount=function(){M(this.expressions||[]),delete this.pristine,delete this.parentNode,delete this.stub},u.prototype.update=function(){var e=this.rawValue;if(this.hasExp&&(e=he(this.rawValue,this.parent)),this.firstRun||e!==this.value){var t=this.tag||this.dom;x(this.value)||q(this.customParent,this.value,t),x(e)?b(this.dom,this.attr):(V(this.customParent,e,t),N(this.dom,this.attr,e)),this.value=e,this.firstRun=!1}},u.prototype.unmount=function(){var e=this.tag||this.dom;x(this.value)||q(this.customParent,this.value,e),delete this.dom,delete this.parent,delete this.customParent};var me=function(t){if(!e)return{add:function(){},inject:function(){}};var n=function(){var e=B("style");N(e,"type","text/css");var t=D("style[type=riot]");return t?(t.id&&(e.id=t.id),t.parentNode.replaceChild(e,t)):document.getElementsByTagName("head")[0].appendChild(e),e}(),r=n.styleSheet,i="";return Object.defineProperty(t,"styleNode",{value:n,writable:!0}),{add:function(e){i+=e},inject:function(){i&&(r?r.cssText+=i:n.innerHTML+=i,i="")}}}(Q);(function(e){var t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame;if(!t||/iP(ad|hone|od).*OS 6/.test(e.navigator.userAgent)){var n=0;t=function(e){var t=Date.now(),r=Math.max(16-(t-n),0);setTimeout(function(){e(n=t+r)},r)}}return t})(e||{});Q.util={brackets:de,tmpl:he},Q.mixin=function(){var e={},t=e[J]={},n=0;return function(r,i,o){if(y(r))return void Q.mixin("__unnamed_"+n++,r,!0);var a=o?t:e;return i?void(a[r]=R(a[r]||{},i)):a[r]}}(),Q.tag=function(e,t,n,r,i){return h(r)&&(i=r,/^[\w\-]+\s?=/.test(n)?(r=n,n=""):r=""),n&&(h(n)?i=n:me.add(n)),e=e.toLowerCase(),Y[e]={name:e,tmpl:t,attrs:r,fn:i},e},Q.tag2=function(e,t,n,r,i){return n&&me.add(n),Y[e]={name:e,tmpl:t,attrs:r,fn:i},e},Q.mount=function(e,t,n){function r(e){var t="";return d(e,function(e){/[^-\w]/.test(e)||(e=e.trim().toLowerCase(),t+=",["+ne+'="'+e+'"],['+te+'="'+e+'"]')}),t}function i(){var e=Object.keys(Y);return e+r(e)}function o(e){if(e.tagName){var r=_(e,ne)||_(e,te);t&&r!==t&&(r=t,N(e,ne,t),N(e,te,t));var i=K(e,r||e.tagName.toLowerCase(),n);i&&s.push(i)}else e.length&&d(e,o)}var a,u,s=[];if(me.inject(),y(t)&&(n=t,t=0),typeof e===re?("*"===e?e=u=i():e+=r(e.split(/, */)),a=e?F(e):[]):a=e,"*"===t){if(t=u||i(),a.tagName)a=F(t,a);else{var l=[];d(a,function(e){l.push(F(t,e))}),a=l}t=0}return o(a),s},Q.update=function(){return d(X,function(e){e.update()})},Q.unregister=function(e){delete Y[e]},Q.vdom=X,Q.Tag=l,typeof exports===ie?module.exports=Q:typeof define===ae&&typeof define.amd!==oe?define(function(){return Q}):e.riot=Q}("undefined"!=typeof window?window:void 0); | ||
/* Riot v3.0.0-alpha.4, @license MIT */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.riot=t()}(this,function(){"use strict";function e(e,t,n,r){n[e]=function(e){var i=r._parent,o=r._item;if(!o)for(;i&&!o;)o=i._item,i=i._parent;e=e||pe.event,$(e,"currentTarget")&&(e.currentTarget=n),$(e,"target")&&(e.target=e.srcElement),$(e,"which")&&(e.which=e.charCode||e.keyCode),e.item=o,t.call(r,e),e.preventUpdate||M(r).update()}}function t(t,r){h(t,function(t,i){var o=t.dom,a=t.attr,u=be(t.expr,r),s=o&&o.parentNode,l="value"==a;if(t.bool?u=u?a:!1:null==u&&(u=""),t._riot_id){if(t.isMounted)t.update();else if(t.mount(),"VIRTUAL"==t.root.tagName){var f=document.createDocumentFragment();Z(t,f),t.root.parentElement.replaceChild(f,t.root)}}else{if(t.update)return void t.update();var c=t.value;if(t.value=u,t.isRtag&&u)return n(t,r);if(!(l&&o.value==u||!l&&c===u)){if(!a)return u+="",void(s&&("TEXTAREA"===s.tagName?(s.value=u,ve||(o.nodeValue=u)):o.nodeValue=u));if(w(o,a),g(u))e(a,u,o,r);else if(/^(show|hide)$/.test(a))"hide"==a&&(u=!u),o.style.display=u?"":"none";else if("value"==a)o.value=u;else if(z(a,oe)&&a!=ae)u&&C(o,a.slice(oe.length),u);else{if("selected"==a&&s&&/^(SELECT|OPTGROUP)$/.test(s.nodeName)&&u&&(s.value=o.value),t.bool&&(o[a]=u,!u))return;(0===u||u&&typeof u!==le)&&C(o,a,u)}}}})}function n(e,t){var n,r=be(e.value,t);if(e.tag&&e.tagName==r)return void e.tag.update();if(e.tag){var i=e.tag.opts.riotTag,o=e.tag._parent.tags[i];A(o)?o.splice(o.indexOf(e.tag),1):delete e.tag._parent.tags[i]}e.impl=re[r],n={root:e.dom,parent:t,hasImpl:!0,tagName:r},e.tag=L(e.impl,n,e.dom.innerHTML,t),e.tagName=r,e.tag.mount(),e.tag.update()}function r(e,t,n){w(e,"if"),this.parentTag=t,this.expr=n,this.stub=document.createTextNode(""),this.pristine=e;var r=e.parentNode;r.insertBefore(this.stub,e),r.removeChild(e)}function i(e,t,n,r){this.dom=e,this.attr=t,this.rawValue=n,this.parent=r,this.customParent=M(r),this.hasExp=be.hasExpr(n),this.firstRun=!0}function o(e,t,n,r){var i=r?Object.create(r):{};return i[e.key]=t,e.pos&&(i[e.pos]=n),i}function a(e,t,n,r){for(var i,o=t.length,a=e.length;o>a;)i=t[--o],t.splice(o,1),i.unmount(),K(r.tags,n,i,!0)}function u(e,t){Object.keys(e.tags).forEach(function(n){var r=e.tags[n];A(r)?h(r,function(e){T(e,n,t)}):T(r,n,t)})}function s(e,t,n){w(e,"each");var r,i=typeof N(e,"no-reorder")!==se||w(e,"no-reorder"),s=R(e),l=re[s]||{tmpl:m(e)},f=de.test(s),c=e.parentNode,p=document.createTextNode(""),g=E(e),v="option"===s.toLowerCase(),y=[],x=[],b="VIRTUAL"==e.tagName;n=be.loopKeys(n),n.isLoop=!0;var _=N(e,"if");return _&&w(e,"if"),c.insertBefore(p,e),c.removeChild(e),n.update=function(){var h=be(n.val,t),m=document.createDocumentFragment();if(c=p.parentNode,A(h)||(r=h||!1,h=r?Object.keys(h).map(function(e){return o(n,e,h[e])}):[]),_&&(h=h.filter(function(e,r){var i=o(n,e,r,t);return!!be(_,i)})),h.forEach(function(a,p){var h,v=i&&typeof a==le&&!r,w=x.indexOf(a),_=~w&&v?w:p,N=y[_];a=!r&&n.key?o(n,a,p):a,!v&&!N||v&&!~w||!N?(N=new d(l,{parent:t,isLoop:!0,hasImpl:!!re[s],root:f?c:e.cloneNode(),item:a},e.innerHTML),N.mount(),h=N.root,p==y.length?b?Z(N,m):m.appendChild(h):(b?Z(N,c,y[p]):c.insertBefore(h,y[p].root),x.splice(p,0,a)),y.splice(p,0,N),g&&G(t.tags,s,N,!0),_=p):N.update(a),_!==p&&v&&(b?Q(N,c,y[p]):c.insertBefore(N.root,y[p].root),n.pos&&(N[n.pos]=p),y.splice(p,0,y.splice(_,1)[0]),x.splice(p,0,x.splice(_,1)[0]),!g&&N.tags&&u(N,p)),N._item=a,S(N,"_parent",t)}),a(h,y,s,t),v){if(c.appendChild(m),ye&&!c.multiple)for(var w=0;w<c.length;w++)if(c[w].__riot1374){c.selectedIndex=w,delete c[w].__riot1374;break}}else c.insertBefore(m,p);x=h.slice()},n.unmount=function(){h(y,function(e){e.unmount()})},n}function l(e,t,n,o){var a={parent:{children:n}};H(e,function(n,a){var u,l,f,c=n.nodeType,p=a.parent;if(3==c&&"STYLE"!=n.parentNode.tagName&&be.hasExpr(n.nodeValue)&&p.children.push({dom:n,expr:n.nodeValue}),1!=c)return a;if(u=N(n,"each"))return p.children.push(s(n,t,u)),!1;if(u=N(n,"if"))return p.children.push(new r(n,t,u)),!1;var d=[],g=[];h(n.attributes,function(e){var r=e.name,o=me.test(r),a=be.hasExpr(e.value);return"name"===r||"id"===r?(l=new i(n,r,e.value,t),p.children.push(l),g.push(l),void d.push(l)):(l={dom:n,expr:e.value,attr:e.name,bool:o},d.push(l),a?(p.children.push(l),o?(w(n,r),!1):void 0):void 0)}),(l=N(n,ae))&&be.hasExpr(l)&&(u={isRtag:!0,expr:l,dom:n,children:[]},p.children.push(u),p=u);var m=E(n);if(m&&(n!==e||o)){var v={root:n,parent:t,hasImpl:!0,ownAttrs:d};return f=L(m,v,n.innerHTML,t),p.children.push(f),h(g,function(e){e.tag=f}),!1}return{parent:p}},a)}function f(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"</"+i,i=e.firstChild,r)i.selectedIndex=-1;else{var o=Le[n];o&&1===i.childElementCount&&(i=U(o,i))}return i}function c(e,t){if(!Ne.test(e))return e;var n={};return t=t&&t.replace(Ee,function(e,t,r){return n[t]=n[t]||r,""}).trim(),e.replace(Te,function(e,t,r){return n[t]||r||""}).replace(Ce,function(e,n){return t||n||""})}function p(e,t){var n=e&&e.match(/^\s*<([-\w]+)/),r=n&&n[1].toLowerCase(),i=F(Oe,y(r));return e=c(e,t),Me.test(r)?i=f(i,e,r):v(i,e),i.stub=!0,i}function d(e,n,r){function i(){var e=m&&d?s:c||s;v?h(v||[],function(e){var t=e.hasOwnProperty("value")?e.value:e.expr;f[_(e.attr)]=t}):h(N.attributes,function(t){var n=t.value,r=be.hasExpr(n);r&&v||(f[_(t.name)]=r?be(n,e):n)})}function o(e){for(var t in y)typeof s[t]!==fe&&$(s,t)&&(s[t]=e[t])}function a(){h(Object.keys(s.parent),function(e){var t=!he.test(e)&&j(L,e);(typeof s[e]===fe||t)&&(t||L.push(e),s[e]=s.parent[e])})}var u,s=te(this),f=V(n.opts)||{},c=n.parent,d=n.isLoop,m=n.hasImpl,v=n.ownAttrs,y=k(n.item),b=[],N=n.root,E=n.tagName||N.tagName.toLowerCase(),T={},L=[];e.name&&N._tag&&N._tag.unmount(!0),this.isMounted=!1,N.isLoop=d,this._hasImpl=m,S(this,"_riot_id",++Se),I(this,{parent:c,root:N,opts:f},y),S(this,"tags",{}),h(N.attributes,function(e){var t=e.value;be.hasExpr(t)&&(T[e.name]=t)}),u=p(e.tmpl,r),S(this,"update",function(e){return!g(s.shouldUpdate)||s.shouldUpdate()?(e=k(e),d&&!m&&a(),e&&x(y)&&(o(e),y=e),I(s,e),i(),s.isMounted&&s.trigger("update",e),t(b,s),s.isMounted&&s.trigger("updated"),this):void 0}),S(this,"mixin",function(){return h(arguments,function(e){var t;e=typeof e===se?ke(e):e,g(e)?(t=new e,e=e.prototype):t=e,h(Object.getOwnPropertyNames(e),function(e){"init"!=e&&(s[e]=g(t[e])?t[e].bind(s):t[e])}),t.init&&t.init.bind(s)()}),this}),S(this,"mount",function(t){i(),N._tag=this;var n=ke(ie);if(n)for(var r in n)n.hasOwnProperty(r)&&s.mixin(n[r]);if(e.fn&&e.fn.call(s,f),e.attrs&&P(e.attrs,function(e,t){C(N,e,t)}),(e.attrs||m)&&l(s.root,s,b),l(u,s,b),s.update(y),s.trigger("before-mount"),d&&!m)s.root=N=u.firstChild;else{for(;u.firstChild;)N.appendChild(u.firstChild);N.stub&&(s.root=N=c.root)}S(s,"root",N),s.isMounted=!0,!s.parent||s.parent.isMounted?s.trigger("mount"):s.parent.one("mount",function(){B(s.root)||s.trigger("mount")})}),S(this,"unmount",function(e){var t,n=s.root,r=n.parentNode,i=ne.indexOf(s);if(s.trigger("before-unmount"),~i&&ne.splice(i,1),r){if(c)t=M(c),K(t.tags,E,s);else for(;n.firstChild;)n.removeChild(n.firstChild);e?(w(r,ue),w(r,ae)):r.removeChild(n)}this._virts&&h(this._virts,function(e){e.parentNode&&e.parentNode.removeChild(e)}),O(b),s.trigger("unmount"),s.off("*"),s.isMounted=!1,delete s.root._tag})}function h(e,t){for(var n,r=e?e.length:0,i=0;r>i;i++)n=e[i],null!=n&&t(n,i)===!1&&i--;return e}function g(e){return typeof e===ce||!1}function m(e){if(e.outerHTML)return e.outerHTML;var t=F("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function v(e,t){if(typeof e.innerHTML!=fe)e.innerHTML=t;else{var n=(new DOMParser).parseFromString(t,"application/xml");e.appendChild(e.ownerDocument.importNode(n.documentElement,!0))}}function y(e){return~ge.indexOf(e)}function x(e){return e&&typeof e===le}function b(e){return typeof e===fe||null===e||""===e}function w(e,t){e.removeAttribute(t)}function _(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function N(e,t){return e.getAttribute(t)}function C(e,t,n){e.setAttribute(t,n)}function E(e){return e.tagName&&re[N(e,ue)||N(e,ae)||e.tagName.toLowerCase()]}function T(e,t,n){var r,i=e.parent;i&&(r=i.tags[t],A(r)?r.splice(n,0,r.splice(r.indexOf(e),1)[0]):G(i.tags,t,e))}function L(e,t,n,r){var i=new d(e,t,n),o=t.tagName||R(t.root,!0),a=M(r);return i.parent=a,i._parent=r,G(a.tags,o,i),a!==r&&G(r.tags,o,i),t.root.innerHTML="",i}function M(e){for(var t=e;!t._hasImpl&&t.parent;)t=t.parent;return t}function O(e){var t,n,r=e.length;for(t=0;r>t;t++)n=e[t],n instanceof d?n.unmount(!0):n.unmount&&n.unmount()}function S(e,t,n,r){return Object.defineProperty(e,t,I({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function R(e,t){var n=E(e),r=!t&&N(e,"name"),i=r&&!be.hasExpr(r)?r:n?n.name:e.tagName.toLowerCase();return i}function I(e){for(var t,n=arguments,r=1;r<n.length;++r)if(t=n[r])for(var i in t)$(e,i)&&(e[i]=t[i]);return e}function j(e,t){return~e.indexOf(t)}function A(e){return Array.isArray(e)||e instanceof Array}function $(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return typeof e[t]===fe||n&&n.writable}function k(e){if(!(e instanceof d||e&&typeof e.trigger==ce))return e;var t={};for(var n in e)he.test(n)||(t[n]=e[n]);return t}function H(e,t,n){if(e){var r,i=t(e,n);if(i===!1)return;for(e=e.firstChild;e;)r=e.nextSibling,H(e,t,i),e=r}}function P(e,t){for(var n,r=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g;n=r.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function B(e){for(;e;){if(e.inStub)return!0;e=e.parentNode}return!1}function F(e,t){return t?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(e)}function D(e,t){return(t||document).querySelectorAll(e)}function U(e,t){return(t||document).querySelector(e)}function V(e){function t(){}return t.prototype=e,new t}function G(e,t,n,r){var i=e[t],o=A(i);i&&i===n||(!i&&r?e[t]=[n]:i?(!o||o&&!j(i,n))&&(o?i.push(n):e[t]=[i,n]):e[t]=n)}function K(e,t,n,r){A(e[t])?(h(e[t],function(r,i){r===n&&e[t].splice(i,1)}),e[t].length?1!=e[t].length||r||(e[t]=e[t][0]):delete e[t]):delete e[t]}function z(e,t){return e.slice(0,t.length)===t}function q(e,t,n){var r=re[t],i=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";var o={root:e,opts:n};return n&&n.parent&&(o.parent=n.parent),r&&e&&(r=new d(r,o,i)),r&&r.mount&&(r.mount(!0),j(ne,r)||ne.push(r)),r}function Z(e,t,n){var r,i,o=document.createTextNode(""),a=document.createTextNode("");for(e._head=e.root.insertBefore(o,e.root.firstChild),e._tail=e.root.appendChild(a),i=e._head,e._virts=[];i;)r=i.nextSibling,n?t.insertBefore(i,n._head):t.appendChild(i),e._virts.push(i),i=r}function Q(e,t,n){for(var r,i=e._head;i;)if(r=i.nextSibling,t.insertBefore(i,n._head),i=r,i==e._tail){t.insertBefore(i,n._head);break}}function X(e,t,n,r,i){return g(r)&&(i=r,/^[\w\-]+\s?=/.test(n)?(r=n,n=""):r=""),n&&(g(n)?i=n:Ie.add(n)),e=e.toLowerCase(),re[e]={name:e,tmpl:t,attrs:r,fn:i},e}function Y(e,t,n,r,i){return n&&Ie.add(n),re[e]={name:e,tmpl:t,attrs:r,fn:i},e}function J(e,t,n){function r(e){var t="";return h(e,function(e){/[^-\w]/.test(e)||(e=e.trim().toLowerCase(),t+=",["+ue+'="'+e+'"],['+ae+'="'+e+'"]')}),t}function i(){var e=Object.keys(re);return e+r(e)}function o(e){if(e.tagName){var r=N(e,ue)||N(e,ae);t&&r!==t&&(r=t,C(e,ue,t),C(e,ae,t));var i=q(e,r||e.tagName.toLowerCase(),n);i&&s.push(i)}else e.length&&h(e,o)}var a,u,s=[];if(Ie.inject(),x(t)&&(n=t,t=0),typeof e===se?("*"===e?e=u=i():e+=r(e.split(/, */)),a=e?D(e):[]):a=e,"*"===t){if(t=u||i(),a.tagName)a=D(t,a);else{var l=[];h(a,function(e){l.push(D(t,e))}),a=l}t=0}return o(a),s}function W(){return h(ne,function(e){e.update()})}function ee(e){delete re[e]}var te=function(e){function t(e,t){for(var n,r,i=e.split(" "),o=i.length,a=0;o>a;a++)n=i[a],r=n.indexOf("."),n&&t(~r?n.substring(0,r):n,a,~r?n.slice(r+1):null)}e=e||{};var n={},r=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(r,i){return"function"!=typeof i?e:(t(r,function(e,t,r){(n[e]=n[e]||[]).push(i),i.typed=t>0,i.ns=r}),e)},enumerable:!1,writable:!1,configurable:!1},off:{value:function(r,i){return"*"!=r||i?t(r,function(e,t,r){if(i||r)for(var o,a=n[e],u=0;o=a&&a[u];++u)(o==i||r&&o.ns==r)&&a.splice(u--,1);else delete n[e]}):n={},e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(i){for(var o,a=arguments.length-1,u=new Array(a),s=0;a>s;s++)u[s]=arguments[s+1];return t(i,function(t,i,a){o=r.call(n[t]||[],0);for(var s,l=0;s=o[l];++l)s.busy||(s.busy=1,a&&s.ns!=a||s.apply(e,s.typed?[t].concat(u):u),o[l]!==s&&l--,s.busy=0);n["*"]&&"*"!=t&&e.trigger.apply(e,["*",t].concat(u))}),e},enumerable:!1,writable:!1,configurable:!1}}),e},ne=[],re={},ie="__global_mixin",oe="riot-",ae="data-is",ue="data-is",se="string",le="object",fe="undefined",ce="function",pe=typeof window==fe?void 0:window,de=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/,he=/^(?:_(?:item|id|parent)|update|root|(?:un)?mount|mixin|is(?:Mounted|Loop)|tags|parent|opts|trigger|o(?:n|ff|ne))$/,ge=["altGlyph","animate","animateColor","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","font","foreignObject","g","glyph","glyphRef","image","line","linearGradient","marker","mask","missing-glyph","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tref","tspan","use"],me=/^(?: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)$/,ve=0|(pe&&pe.document||{}).documentMode,ye=pe&&!!pe.InstallTrigger,xe=function(e){function t(e){return e}function n(e,t){return t||(t=v),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?l:"")}function r(e){if(e===h)return g;var t=e.split(" ");if(2!==t.length||/[\x00-\x1F<>a-zA-Z0-9'",;\\]/.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(/(?=[[\]()*+?.^$|])/g,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:g[4],t),t[5]=n(e.length>3?/\\({|})/g:g[5],t),t[6]=n(g[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+p,l),t[8]=e,t}function i(e){return e instanceof RegExp?u(e):v[e]}function o(e){(e||(e=h))!==v[8]&&(v=r(e),u=e===h?t:n,v[9]=u(g[9])),m=e}function a(e){var t;e=e||{},t=e.brackets,Object.defineProperty(e,"brackets",{set:o,get:function(){return m},enumerable:!0}),s=e,o(t)}var u,s,l="g",f=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,c=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'/g,p=c.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?(\/)[gim]*/.source,d={"(":RegExp("([()])|"+p,l),"[":RegExp("([[\\]])|"+p,l),"{":RegExp("([{}])|"+p,l)},h="{ }",g=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+p,l),h,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],m=e,v=[];return i.split=function(e,t,n){function r(e){t||a?l.push(e&&e.replace(n[5],"$1")):l.push(e)}function i(e,t,n){var r,i=d[t];for(i.lastIndex=n,n=1;(r=i.exec(e))&&(!r[1]||(r[1]===t?++n:--n)););return n?e.length:i.lastIndex}n||(n=v);var o,a,u,s,l=[],f=n[6];for(a=u=f.lastIndex=0;o=f.exec(e);){if(s=o.index,a){if(o[2]){f.lastIndex=i(e,o[2],f.lastIndex);continue}if(!o[3])continue}o[1]||(r(e.slice(u,s)),u=f.lastIndex,f=n[6+(a^=1)],f.lastIndex=u)}return e&&u<e.length&&r(e.slice(u)),l},i.hasExpr=function(e){return v[4].test(e)},i.loopKeys=function(e){var t=e.match(v[9]);return t?{key:t[1],pos:t[2],val:v[0]+t[3].trim()+v[1]}:{val:e.trim()}},i.array=function(e){return e?r(e):v},Object.defineProperty(i,"settings",{set:a,get:function(){return s}}),i.settings="undefined"!=typeof riot&&riot.settings||{},i.set=o,i.R_STRINGS=c,i.R_MLCOMMS=f,i.S_QBLOCKS=p,i}(),be=function(){function e(e,r){return e?(a[e]||(a[e]=n(e))).call(r,t):e}function t(t,n){e.errorHandler&&(t.riotData={tagName:n&&n.root&&n.root.tagName,_riot_id:n&&n._riot_id},e.errorHandler(t))}function n(e){var t=r(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function r(e){var t,n=[],r=xe.split(e.replace(f,'"'),1);if(r.length>2||r[0]){var o,a,u=[];for(o=a=0;o<r.length;++o)t=r[o],t&&(t=1&o?i(t,1,n):'"'+t.replace(/\\/g,"\\\\").replace(/\r\n?|\n/g,"\\n").replace(/"/g,'\\"')+'"')&&(u[a++]=t);t=2>a?u[0]:"["+u.join(",")+'].join("")'}else t=i(r[1],0,n);return n[0]&&(t=t.replace(c,function(e,t){return n[t].replace(/\r/g,"\\r").replace(/\n/g,"\\n")})),t}function i(e,t,n){function r(t,n){var r,i=1,o=p[t];for(o.lastIndex=n.lastIndex;r=o.exec(e);)if(r[0]===t)++i;else if(!--i)break;n.lastIndex=i?e.length:o.lastIndex}if(e=e.replace(l,function(e,t){return e.length>2&&!t?u+(n.push(e)-1)+"~":e}).replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,a=[],f=0;e&&(i=e.match(s))&&!i.index;){var c,d,h=/,|([[{(])|$/g;for(e=RegExp.rightContext,c=i[2]?n[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];d=(i=h.exec(e))[1];)r(d,h);d=e.slice(0,i.index),e=RegExp.rightContext,a[f++]=o(d,1,c)}e=f?f>1?"["+a.join(",")+'].join(" ").trim()':a[0]:o(e,t)}return e}function o(e,t,n){var r;return e=e.replace(h,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+d+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!g.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var a={};e.haveRaw=xe.hasRaw,e.hasExpr=xe.hasExpr,e.loopKeys=xe.loopKeys,e.errorHandler=null;var u="⁗",s=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,l=RegExp(xe.S_QBLOCKS,"g"),f=/\u2057/g,c=/\u2057(\d+)~/g,p={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},d='"in this?this:'+("object"!=typeof window?"global":"window")+").",h=/[,{][$\w]+:|(^ *|[^$\w\.])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,g=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.parse=function(e){return e},e.version=xe.version="v2.4.0",e}();r.prototype.update=function(){var e=be(this.expr,this.parentTag);e&&!this.current?(this.current=this.pristine.cloneNode(!0),this.stub.parentNode.insertBefore(this.current,this.stub),this.expressions=[],l(this.current,this.parentTag,this.expressions,!0)):!e&&this.current&&(O(this.expressions),this.current.parentNode.removeChild(this.current),this.current=null,this.expressions=[]),e&&t(this.expressions,this.parentTag)},r.prototype.unmount=function(){O(this.expressions||[]),delete this.pristine,delete this.parentNode,delete this.stub},i.prototype.update=function(){var e=this.rawValue;if(this.hasExp&&(e=be(this.rawValue,this.parent)),this.firstRun||e!==this.value){var t=this.tag||this.dom;b(this.value)||K(this.customParent,this.value,t),b(e)?w(this.dom,this.attr):(G(this.customParent,e,t),C(this.dom,this.attr,e)),this.value=e,this.firstRun=!1}},i.prototype.unmount=function(){var e=this.tag||this.dom;b(this.value)||K(this.customParent,this.value,e),delete this.dom,delete this.parent,delete this.customParent};var we,_e,Ne=/<yield\b/i,Ce=/<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>|>)/gi,Ee=/<yield\s+to=['"]([^'">]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,Te=/<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,Le={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},Me=ve&&10>ve?de:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,Oe="div",Se=0,Re="";pe&&(we=function(){var e=F("style");C(e,"type","text/css");var t=U("style[type=riot]");return t?(t.id&&(e.id=t.id),t.parentNode.replaceChild(e,t)):document.getElementsByTagName("head")[0].appendChild(e),e}(),_e=we.styleSheet);var Ie={styleNode:we,add:function(e){pe&&(Re+=e)},inject:function(){Re&&pe&&(_e?_e.cssText+=Re:we.innerHTML+=Re,Re="")}},je=te,Ae=xe.settings,$e={tmpl:be,brackets:xe,styleNode:Ie.styleNode},ke=function(){var e={},t=e[ie]={},n=0;return function(r,i,o){if(x(r))return void ke("__unnamed_"+n++,r,!0);var a=o?t:e;if(!i){if(typeof a[r]===fe)throw new Error("Unregistered mixin: "+r);return a[r]}g(i)?(I(i.prototype,a[r]||{}),a[r]=i):a[r]=I(a[r]||{},i)}}(),He=ne,Pe=Object.freeze({observable:je,settings:Ae,util:$e,mixin:ke,tag:X,tag2:Y,mount:J,update:W,unregister:ee,vdom:He});return Pe}); |
@@ -1,2 +0,2 @@ | ||
/* Riot v3.0.0-alpha.3, @license MIT */ | ||
!function(e,t){"use strict";function n(e,t,n,r){var i=r?Object.create(r):{};return i[e.key]=t,e.pos&&(i[e.pos]=n),i}function r(e,t,n,r){for(var i,o=t.length,a=e.length;o>a;)i=t[--o],t.splice(o,1),i.unmount(),U(r.tags,n,i,!0)}function i(e,t){Object.keys(e.tags).forEach(function(n){var r=e.tags[n];A(r)?d(r,function(e){E(e,n,t)}):E(r,n,t)})}function o(e,t,o){b(e,"each");var a,s=typeof C(e,"no-reorder")!==re||b(e,"no-reorder"),u=R(e),l=W[u]||{tmpl:g(e)},f=se.test(u),p=e.parentNode,h=document.createTextNode(""),m=S(e),v="option"===u.toLowerCase(),x=[],y=[],w="VIRTUAL"==e.tagName;o=he.loopKeys(o),o.isLoop=!0;var _=C(e,"if");return _&&b(e,"if"),p.insertBefore(h,e),p.removeChild(e),o.update=function(){var d=he(o.val,t),g=document.createDocumentFragment();if(p=h.parentNode,A(d)||(a=d||!1,d=a?Object.keys(d).map(function(e){return n(o,e,d[e])}):[]),_&&(d=d.filter(function(e,r){var i=n(o,e,r,t);return!!he(_,i)})),d.forEach(function(r,d){var h,v=s&&r instanceof Object&&!a,b=y.indexOf(r),C=~b&&v?b:d,_=x[C];r=!a&&o.key?n(o,r,d):r,!v&&!_||v&&!~b||!_?(_=new c(l,{parent:t,isLoop:!0,hasImpl:!!W[u],root:f?p:e.cloneNode(),item:r},e.innerHTML),_.mount(),h=_.root,d==x.length?w?K(_,g):g.appendChild(h):(w?K(_,p,x[d]):p.insertBefore(h,x[d].root),y.splice(d,0,r)),x.splice(d,0,_),m&&Z(t.tags,u,_,!0),C=d):_.update(r),C!==d&&v&&(w?V(_,p,x[d]):p.insertBefore(_.root,x[d].root),o.pos&&(_[o.pos]=d),x.splice(d,0,x.splice(C,1)[0]),y.splice(d,0,y.splice(C,1)[0]),!m&&_.tags&&i(_,d)),_._item=r,L(_,"_parent",t)}),r(d,x,u,t),v){if(p.appendChild(g),pe&&!p.multiple)for(var b=0;b<p.length;b++)if(p[b].__riot1374){p.selectedIndex=b,delete p[b].__riot1374;break}}else p.insertBefore(g,h);y=d.slice()},o.unmount=function(){d(x,function(e){e.unmount()})},o}function a(e,t,n){b(e,"if"),this.parentTag=t,this.expr=n,this.stub=document.createTextNode(""),this.pristine=e;var r=e.parentNode;r.insertBefore(this.stub,e),r.removeChild(e)}function s(e,t,n,r){this.dom=e,this.attr=t,this.rawValue=n,this.parent=r,this.customParent=O(r),this.hasExp=he.hasExpr(n),this.firstRun=!0}function u(e,t,n,r){var i={parent:{children:n}};$(e,function(n,i){var u,c,l,f=n.nodeType,p=i.parent;if(3==f&&"STYLE"!=n.parentNode.tagName&&he.hasExpr(n.nodeValue)&&p.children.push({dom:n,expr:n.nodeValue}),1!=f)return i;if(u=C(n,"each"))return p.children.push(o(n,t,u)),!1;if(u=C(n,"if"))return p.children.push(new a(n,t,u)),!1;var h=[],g=[];d(n.attributes,function(e){var r=e.name,i=le.test(r),o=he.hasExpr(e.value);return"name"===r||"id"===r?(c=new s(n,r,e.value,t),p.children.push(c),g.push(c),void h.push(c)):(c={dom:n,expr:e.value,attr:e.name,bool:i},h.push(c),o?(p.children.push(c),i?(b(n,r),!1):void 0):void 0)}),(c=C(n,te))&&he.hasExpr(c)&&(u={isRtag:!0,expr:c,dom:n,children:[]},p.children.push(u),p=u);var m=S(n);if(m&&(n!==e||r)){var v={root:n,parent:t,hasImpl:!0,ownAttrs:h};return l=N(m,v,n.innerHTML,t),p.children.push(l),d(g,function(e){e.tag=l}),!1}return{parent:p}},i)}function c(e,t,n){function r(){var e=g&&p?s:l||s;m?d(m||[],function(e){var t=e.hasOwnProperty("value")?e.value:e.expr;c[w(e.attr)]=t}):d(C.attributes,function(t){var n=t.value,r=he.hasExpr(n);r&&m||(c[w(t.name)]=r?he(n,e):n)})}function i(e){for(var t in v)typeof s[t]!==oe&&I(s,t)&&(s[t]=e[t])}function o(){d(Object.keys(s.parent),function(e){var t=!ue.test(e)&&j(A,e);(typeof s[e]===oe||t)&&(t||A.push(e),s[e]=s.parent[e])})}var a,s=Q.observable(this),c=D(t.opts)||{},l=t.parent,p=t.isLoop,g=t.hasImpl,m=t.ownAttrs,v=F(t.item),y=[],C=t.root,S=e.fn,E=t.tagName||C.tagName.toLowerCase(),N={},R={},A=[];e.name&&C._tag&&C._tag.unmount(!0),this.isMounted=!1,C.isLoop=p,this._hasImpl=g,L(this,"_riot_id",++J),M(this,{parent:l,root:C,opts:c,tags:{}},v),d(C.attributes,function(e){var t=e.value;he.hasExpr(t)&&(N[e.name]=t)}),a=ge(e,n,R),R=R.attrs||"",L(this,"update",function(e){return typeof s.shouldUpdate!=ae||s.shouldUpdate()?(e=F(e),p&&!g&&o(),e&&x(v)&&(i(e),v=e),M(s,e),r(),s.isMounted&&s.trigger("update",e),f(y,s),s.isMounted&&s.trigger("updated"),this):void 0}),L(this,"mixin",function(){return d(arguments,function(e){var t;e=typeof e===re?Q.mixin(e):e,h(e)?(t=new e,e=e.prototype):t=e,d(Object.getOwnPropertyNames(e),function(e){"init"!=e&&(s[e]=h(t[e])?t[e].bind(s):t[e])}),t.init&&t.init.bind(s)()}),this}),L(this,"mount",function(e){r(),C._tag=this;var t=Q.mixin(Y);if(t)for(var n in t)t.hasOwnProperty(n)&&s.mixin(t[n]);if(S&&S.call(s,c),(R||g)&&(k(R,function(e,t){_(C,e,t)}),u(s.root,s,y)),u(a,s,y),s.update(v),s.trigger("before-mount"),p&&!g)s.root=C=a.firstChild;else{for(;a.firstChild;)C.appendChild(a.firstChild);C.stub&&(s.root=C=l.root)}L(s,"root",C),s.isMounted=!0,!s.parent||s.parent.isMounted?s.trigger("mount"):s.parent.one("mount",function(){P(s.root)||s.trigger("mount")})}),L(this,"unmount",function(e){var t,n=s.root,r=n.parentNode,i=X.indexOf(s);if(s.trigger("before-unmount"),~i&&X.splice(i,1),r){if(l)t=O(l),U(t.tags,E,s);else for(;n.firstChild;)n.removeChild(n.firstChild);e?(b(r,ne),b(r,te)):r.removeChild(n)}this._virts&&d(this._virts,function(e){e.parentNode&&e.parentNode.removeChild(e)}),T(y),s.trigger("unmount"),s.off("*"),s.isMounted=!1,delete s.root._tag})}function l(t,n,r,i){r[t]=function(t){var o=i._parent,a=i._item;if(!a)for(;o&&!a;)a=o._item,o=o._parent;t=t||e.event,I(t,"currentTarget")&&(t.currentTarget=r),I(t,"target")&&(t.target=t.srcElement),I(t,"which")&&(t.which=t.charCode||t.keyCode),t.item=a,n.call(i,t),t.preventUpdate||O(i).update()}}function f(e,t){d(e,function(e,n){var r=e.dom,i=e.attr,o=he(e.expr,t),a=r&&r.parentNode,s="value"==i;if(e.bool?o=o?i:!1:null==o&&(o=""),a&&"TEXTAREA"==a.tagName&&(o=(""+o).replace(/riot-/g,""),a.value=o),e._riot_id){if(e.isMounted)e.update();else if(e.mount(),"VIRTUAL"==e.root.tagName){var u=document.createDocumentFragment();K(e,u),e.root.parentElement.replaceChild(u,e.root)}}else{if(e.update)return void e.update();var c=e.value;if(e.value=o,e.isRtag&&o)return p(e,t);if(!(s&&r.value==o||!s&&c===o)){if(!i)return void(r.nodeValue=""+o);if(b(r,i),h(o))l(i,o,r,t);else if(/^(show|hide)$/.test(i))"hide"==i&&(o=!o),r.style.display=o?"":"none";else if("value"==i)r.value=o;else if(q(i,ee)&&i!=te)o&&_(r,i.slice(ee.length),o);else{if("selected"==i&&a&&/^(SELECT|OPTGROUP)$/.test(a.nodeName)&&o&&(a.value=r.value),e.bool&&(r[i]=o,!o))return;(0===o||o&&typeof o!==ie)&&_(r,i,o)}}}})}function p(e,t){var n,r=he(e.value,t);if(e.tag&&e.tagName==r)return void e.tag.update();if(e.tag){var i=e.tag.opts.riotTag,o=e.tag._parent.tags[i];A(o)?o.splice(o.indexOf(e.tag),1):delete e.tag._parent.tags[i]}e.impl=W[r],n={root:e.dom,parent:t,hasImpl:!0,tagName:r},e.tag=N(e.impl,n,e.dom.innerHTML,t),e.tagName=r,e.tag.mount(),e.tag.update()}function d(e,t){for(var n,r=e?e.length:0,i=0;r>i;i++)n=e[i],null!=n&&t(n,i)===!1&&i--;return e}function h(e){return typeof e===ae||!1}function g(e){if(e.outerHTML)return e.outerHTML;var t=H("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function m(e,t){if(typeof e.innerHTML!=oe)e.innerHTML=t;else{var n=(new DOMParser).parseFromString(t,"application/xml");e.appendChild(e.ownerDocument.importNode(n.documentElement,!0))}}function v(e){return~ce.indexOf(e)}function x(e){return e&&typeof e===ie}function y(e){return typeof e===oe||null===e||""===e}function b(e,t){e.removeAttribute(t)}function w(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function C(e,t){return e.getAttribute(t)}function _(e,t,n){e.setAttribute(t,n)}function S(e){return e.tagName&&W[C(e,ne)||C(e,te)||e.tagName.toLowerCase()]}function E(e,t,n){var r,i=e.parent;i&&(r=i.tags[t],A(r)?r.splice(n,0,r.splice(r.indexOf(e),1)[0]):Z(i.tags,t,e))}function N(e,t,n,r){var i=new c(e,t,n),o=t.tagName||R(t.root,!0),a=O(r);return i.parent=a,i._parent=r,Z(a.tags,o,i),a!==r&&Z(r.tags,o,i),t.root.innerHTML="",i}function O(e){for(var t=e;!t._hasImpl&&t.parent;)t=t.parent;return t}function T(e){var t,n,r=e.length;for(t=0;r>t;t++)n=e[t],n instanceof c?n.unmount(!0):n.unmount&&n.unmount()}function L(e,t,n,r){return Object.defineProperty(e,t,M({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function R(e,t){var n=S(e),r=!t&&C(e,"name"),i=r&&!he.hasExpr(r)?r:n?n.name:e.tagName.toLowerCase();return i}function M(e){for(var t,n=arguments,r=1;r<n.length;++r)if(t=n[r])for(var i in t)I(e,i)&&(e[i]=t[i]);return e}function j(e,t){return~e.indexOf(t)}function A(e){return Array.isArray(e)||e instanceof Array}function I(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return typeof e[t]===oe||n&&n.writable}function F(e){if(!(e instanceof c||e&&typeof e.trigger==ae))return e;var t={};for(var n in e)ue.test(n)||(t[n]=e[n]);return t}function $(e,t,n){if(e){var r,i=t(e,n);if(i===!1)return;for(e=e.firstChild;e;)r=e.nextSibling,$(e,t,i),e=r}}function k(e,t){for(var n,r=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g;n=r.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function P(e){for(;e;){if(e.inStub)return!0;e=e.parentNode}return!1}function H(e,t){return t?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(e)}function B(e,t){return(t||document).querySelectorAll(e)}function z(e,t){return(t||document).querySelector(e)}function D(e){function t(){}return t.prototype=e,new t}function Z(e,t,n,r){var i=e[t],o=A(i);i&&i===n||(!i&&r?e[t]=[n]:i?(!o||o&&!j(i,n))&&(o?i.push(n):e[t]=[i,n]):e[t]=n)}function U(e,t,n,r){A(e[t])?(d(e[t],function(r,i){r===n&&e[t].splice(i,1)}),e[t].length?1!=e[t].length||r||(e[t]=e[t][0]):delete e[t]):delete e[t]}function q(e,t){return e.slice(0,t.length)===t}function G(e,t,n){var r=W[t],i=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";var o={root:e,opts:n};return n&&n.parent&&(o.parent=n.parent),r&&e&&(r=new c(r,o,i)),r&&r.mount&&(r.mount(!0),j(X,r)||X.push(r)),r}function K(e,t,n){var r,i,o=document.createTextNode(""),a=document.createTextNode("");for(e._head=e.root.insertBefore(o,e.root.firstChild),e._tail=e.root.appendChild(a),i=e._head,e._virts=[];i;)r=i.nextSibling,n?t.insertBefore(i,n._head):t.appendChild(i),e._virts.push(i),i=r}function V(e,t,n){for(var r,i=e._head;i;)if(r=i.nextSibling,t.insertBefore(i,n._head),i=r,i==e._tail){t.insertBefore(i,n._head);break}}var Q={version:"v3.0.0-alpha.3",settings:{}},J=0,X=[],W={},Y="__global_mixin",ee="riot-",te="data-is",ne="data-is",re="string",ie="object",oe="undefined",ae="function",se=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/,ue=/^(?:_(?:item|id|parent)|update|root|(?:un)?mount|mixin|is(?:Mounted|Loop)|tags|parent|opts|trigger|o(?:n|ff|ne))$/,ce=["altGlyph","animate","animateColor","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","font","foreignObject","g","glyph","glyphRef","image","line","linearGradient","marker","mask","missing-glyph","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tref","tspan","use"],le=/^(?: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)$/,fe=0|(e&&e.document||{}).documentMode,pe=e&&!!e.InstallTrigger;Q.observable=function(e){function t(e,t){for(var n,r,i=e.split(" "),o=i.length,a=0;o>a;a++)n=i[a],r=n.indexOf("."),n&&t(~r?n.substring(0,r):n,a,~r?n.slice(r+1):null)}e=e||{};var n={},r=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(r,i){return"function"!=typeof i?e:(t(r,function(e,t,r){(n[e]=n[e]||[]).push(i),i.typed=t>0,i.ns=r}),e)},enumerable:!1,writable:!1,configurable:!1},off:{value:function(r,i){return"*"!=r||i?t(r,function(e,t,r){if(i||r)for(var o,a=n[e],s=0;o=a&&a[s];++s)(o==i||r&&o.ns==r)&&a.splice(s--,1);else delete n[e]}):n={},e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(i){for(var o,a=arguments.length-1,s=new Array(a),u=0;a>u;u++)s[u]=arguments[u+1];return t(i,function(t,i,a){o=r.call(n[t]||[],0);for(var u,c=0;u=o[c];++c)u.busy||(u.busy=1,a&&u.ns!=a||u.apply(e,u.typed?[t].concat(s):s),o[c]!==u&&c--,u.busy=0);n["*"]&&"*"!=t&&e.trigger.apply(e,["*",t].concat(s))}),e},enumerable:!1,writable:!1,configurable:!1}}),e};var de=function(e){function t(e){return e}function n(e,t){return t||(t=v),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?c:"")}function r(e){if(e===h)return g;var t=e.split(" ");if(2!==t.length||/[\x00-\x1F<>a-zA-Z0-9'",;\\]/.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(/(?=[[\]()*+?.^$|])/g,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:g[4],t),t[5]=n(e.length>3?/\\({|})/g:g[5],t),t[6]=n(g[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+p,c),t[8]=e,t}function i(e){return e instanceof RegExp?s(e):v[e]}function o(e){(e||(e=h))!==v[8]&&(v=r(e),s=e===h?t:n,v[9]=s(g[9])),m=e}function a(e){var t;e=e||{},t=e.brackets,Object.defineProperty(e,"brackets",{set:o,get:function(){return m},enumerable:!0}),u=e,o(t)}var s,u,c="g",l=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,f=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'/g,p=f.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?(\/)[gim]*/.source,d={"(":RegExp("([()])|"+p,c),"[":RegExp("([[\\]])|"+p,c),"{":RegExp("([{}])|"+p,c)},h="{ }",g=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+p,c),h,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],m=e,v=[];return i.split=function(e,t,n){function r(e){t||a?c.push(e&&e.replace(n[5],"$1")):c.push(e)}function i(e,t,n){var r,i=d[t];for(i.lastIndex=n,n=1;(r=i.exec(e))&&(!r[1]||(r[1]===t?++n:--n)););return n?e.length:i.lastIndex}n||(n=v);var o,a,s,u,c=[],l=n[6];for(a=s=l.lastIndex=0;o=l.exec(e);){if(u=o.index,a){if(o[2]){l.lastIndex=i(e,o[2],l.lastIndex);continue}if(!o[3])continue}o[1]||(r(e.slice(s,u)),s=l.lastIndex,l=n[6+(a^=1)],l.lastIndex=s)}return e&&s<e.length&&r(e.slice(s)),c},i.hasExpr=function(e){return v[4].test(e)},i.loopKeys=function(e){var t=e.match(v[9]);return t?{key:t[1],pos:t[2],val:v[0]+t[3].trim()+v[1]}:{val:e.trim()}},i.array=function(e){return e?r(e):v},Object.defineProperty(i,"settings",{set:a,get:function(){return u}}),i.settings="undefined"!=typeof Q&&Q.settings||{},i.set=o,i.R_STRINGS=f,i.R_MLCOMMS=l,i.S_QBLOCKS=p,i}(),he=function(){function t(e,t){return e?(s[e]||(s[e]=r(e))).call(t,n):e}function n(e,n){t.errorHandler&&(e.riotData={tagName:n&&n.root&&n.root.tagName,_riot_id:n&&n._riot_id},t.errorHandler(e))}function r(e){var t=i(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function i(e){var t,n=[],r=de.split(e.replace(f,'"'),1);if(r.length>2||r[0]){var i,a,s=[];for(i=a=0;i<r.length;++i)t=r[i],t&&(t=1&i?o(t,1,n):'"'+t.replace(/\\/g,"\\\\").replace(/\r\n?|\n/g,"\\n").replace(/"/g,'\\"')+'"')&&(s[a++]=t);t=2>a?s[0]:"["+s.join(",")+'].join("")'}else t=o(r[1],0,n);return n[0]&&(t=t.replace(p,function(e,t){return n[t].replace(/\r/g,"\\r").replace(/\n/g,"\\n")})),t}function o(e,t,n){function r(t,n){var r,i=1,o=d[t];for(o.lastIndex=n.lastIndex;r=o.exec(e);)if(r[0]===t)++i;else if(!--i)break;n.lastIndex=i?e.length:o.lastIndex}if(e=e.replace(l,function(e,t){return e.length>2&&!t?u+(n.push(e)-1)+"~":e}).replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,o=[],s=0;e&&(i=e.match(c))&&!i.index;){var f,p,h=/,|([[{(])|$/g;for(e=RegExp.rightContext,f=i[2]?n[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];p=(i=h.exec(e))[1];)r(p,h);p=e.slice(0,i.index),e=RegExp.rightContext,o[s++]=a(p,1,f)}e=s?s>1?"["+o.join(",")+'].join(" ").trim()':o[0]:a(e,t)}return e}function a(e,t,n){var r;return e=e.replace(g,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+h+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!m.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var s={};t.haveRaw=de.hasRaw,t.hasExpr=de.hasExpr,t.loopKeys=de.loopKeys,t.errorHandler=null;var u="⁗",c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,l=RegExp(de.S_QBLOCKS,"g"),f=/\u2057/g,p=/\u2057(\d+)~/g,d={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},h='"in this?this:'+("object"!=typeof e?"global":"window")+").",g=/[,{][$\w]+:|(^ *|[^$\w\.])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,m=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return t.parse=function(e){return e},t.version=de.version="v2.4.0",t}(),ge=function(e){function t(e,t,i){var o=e.tmpl,a=o&&o.match(/^\s*<([-\w]+)/),s=a&&a[1].toLowerCase(),u=H(l,v(s));return t||(t=""),e.attrs&&(i.attrs=r(e.attrs,t)),o=r(o,t),f.test(s)?u=n(u,o,s):m(u,o),u.stub=!0,u}function n(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"</"+i,i=e.firstChild,r)i.selectedIndex=-1;else{var o=c[n];o&&1===i.childNodes.length&&(i=z(o,i))}return i}function r(e,t){if(!i.test(e))return e;var n=1;return e=e.replace(s,function(e,r,i){var o=t.match(RegExp(u.replace("@",r),"i"));return n=0,(o?o[1]:i)||""}),(n||i.test(e))&&(t&&(t=t.replace(a,"").trim()),e=e.replace(o,function(e,n){return t||n||""})),e}var i=/<yield\b/i,o=/<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,a=/<yield\s+to=[^>]+>[\S\s]*?<\/yield\s*>\s*/gi,s=/<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,u="<yield\\s+to=['\"]@['\"]\\s*>([\\S\\s]*?)</yield\\s*>",c={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},l="div";e=e&&10>e;var f=e?se:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/;return t}(fe);a.prototype.update=function(){var e=he(this.expr,this.parentTag);e&&!this.current?(this.current=this.pristine.cloneNode(!0),this.stub.parentNode.insertBefore(this.current,this.stub),this.expressions=[],u(this.current,this.parentTag,this.expressions,!0)):!e&&this.current&&(T(this.expressions),this.current.parentNode.removeChild(this.current),this.current=null,this.expressions=[]),e&&f(this.expressions,this.parentTag)},a.prototype.unmount=function(){T(this.expressions||[]),delete this.pristine,delete this.parentNode,delete this.stub},s.prototype.update=function(){var e=this.rawValue;if(this.hasExp&&(e=he(this.rawValue,this.parent)),this.firstRun||e!==this.value){var t=this.tag||this.dom;y(this.value)||U(this.customParent,this.value,t),y(e)?b(this.dom,this.attr):(Z(this.customParent,e,t),_(this.dom,this.attr,e)),this.value=e,this.firstRun=!1}},s.prototype.unmount=function(){var e=this.tag||this.dom;y(this.value)||U(this.customParent,this.value,e),delete this.dom,delete this.parent,delete this.customParent};var me=function(t){if(!e)return{add:function(){},inject:function(){}};var n=function(){var e=H("style");_(e,"type","text/css");var t=z("style[type=riot]");return t?(t.id&&(e.id=t.id),t.parentNode.replaceChild(e,t)):document.getElementsByTagName("head")[0].appendChild(e),e}(),r=n.styleSheet,i="";return Object.defineProperty(t,"styleNode",{value:n,writable:!0}),{add:function(e){i+=e},inject:function(){i&&(r?r.cssText+=i:n.innerHTML+=i,i="")}}}(Q);(function(e){var t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame;if(!t||/iP(ad|hone|od).*OS 6/.test(e.navigator.userAgent)){var n=0;t=function(e){var t=Date.now(),r=Math.max(16-(t-n),0);setTimeout(function(){e(n=t+r)},r)}}return t})(e||{});Q.util={brackets:de,tmpl:he},Q.mixin=function(){var e={},t=e[Y]={},n=0;return function(r,i,o){if(x(r))return void Q.mixin("__unnamed_"+n++,r,!0);var a=o?t:e;return i?void(a[r]=M(a[r]||{},i)):a[r]}}(),Q.tag=function(e,t,n,r,i){return h(r)&&(i=r,/^[\w\-]+\s?=/.test(n)?(r=n,n=""):r=""),n&&(h(n)?i=n:me.add(n)),e=e.toLowerCase(),W[e]={name:e,tmpl:t,attrs:r,fn:i},e},Q.tag2=function(e,t,n,r,i){return n&&me.add(n),W[e]={name:e,tmpl:t,attrs:r,fn:i},e},Q.mount=function(e,t,n){function r(e){var t="";return d(e,function(e){/[^-\w]/.test(e)||(e=e.trim().toLowerCase(),t+=",["+ne+'="'+e+'"],['+te+'="'+e+'"]')}),t}function i(){var e=Object.keys(W);return e+r(e)}function o(e){if(e.tagName){var r=C(e,ne)||C(e,te);t&&r!==t&&(r=t,_(e,ne,t),_(e,te,t));var i=G(e,r||e.tagName.toLowerCase(),n);i&&u.push(i)}else e.length&&d(e,o)}var a,s,u=[];if(me.inject(),x(t)&&(n=t,t=0),typeof e===re?("*"===e?e=s=i():e+=r(e.split(/, */)),a=e?B(e):[]):a=e,"*"===t){if(t=s||i(),a.tagName)a=B(t,a);else{var c=[];d(a,function(e){c.push(B(t,e))}),a=c}t=0}return o(a),u},Q.update=function(){return d(X,function(e){e.update()})},Q.unregister=function(e){delete W[e]},Q.vdom=X,Q.Tag=c;var ve=function(){function t(t){var n=e[t];if(n)return n;throw new Error(t+" parser not found.")}function n(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}var r={html:{jade:function(e,r,i){return r=n({pretty:!0,filename:i,doctype:"html"},r),t("jade").render(e,r)}},css:{less:function(e,r,i,o){var a;return i=n({sync:!0,syncImport:!0,filename:o},i),t("less").render(r,i,function(e,t){if(e)throw e;a=t.css}),a}},js:{es6:function(e,r){return r=n({blacklist:["useStrict","strict","react"],sourceMaps:!1,comments:!1},r),t("babel").transform(e,r).code},babel:function(e,r,i){return t("babel").transform(e,n({filename:i},r)).code},coffee:function(e,r){return t("CoffeeScript").compile(e,n({bare:!0},r))},livescript:function(e,r){return t("livescript").compile(e,n({bare:!0,header:!1},r))},typescript:function(e,n){return t("typescript")(e,n)},none:function(e){return e}}};return r.js.javascript=r.js.none,r.js.coffeescript=r.js.coffee,r}();Q.parsers=ve;var xe=function(){function e(e){var t,n=N;for(~e.indexOf("\r")&&(e=e.replace(/\r\n?/g,"\n")),n.lastIndex=0;t=n.exec(e);)"<"===t[0][0]&&(e=RegExp.leftContext+RegExp.rightContext,n.lastIndex=t[3]+1);return e}function t(e,t){var n,r,i,o=[];for(E.lastIndex=0,e=e.replace(/\s+/g," ");n=E.exec(e);){var a=n[1].toLowerCase(),s=n[2];s?(s[0]!==P&&(s=P+(s[0]===H?s.slice(1,-1):s)+P),"type"===a&&j.test(s)?r=s:(I.test(s)&&("value"===a?i=1:~L.indexOf(a)&&(a="riot-"+a)),o.push(a+"="+s))):o.push(a)}return r&&(i&&(r=P+t._bp[0]+H+r.slice(1,-1)+H+t._bp[1]+P),o.push("type="+r)),o.join(" ")}function n(e,t,n){var r=n._bp;if(e&&r[4].test(e)){for(var i,o=t.expr&&(t.parser||t.type)?s:0,a=de.split(e,0,r),u=1;u<a.length;u+=2)i=a[u],"^"===i[0]?i=i.slice(1):o&&(i=o(i,t).trim(),";"===i.slice(-1)&&(i=i.slice(0,-1))),a[u]=$+(n.push(i)-1)+r[1];e=a.join("")}return e}function r(e,t){return t.length&&(e=e.replace(F,function(e,n){return t._bp[0]+t[n].trim().replace(/[\r\n]+/g," ").replace(/"/g,k)})),e}function i(e,i,o){if(e=n(e,i,o).replace(O,function(e,n,r,i){return n=n.toLowerCase(),i=i&&!R.test(n)?"></"+n:"",r&&(n+=" "+t(r,o)),"<"+n+i+">"}),!i.whitespace){var a=[];/<pre[\s>]/.test(e)&&(e=e.replace(M,function(e){return a.push(e),""})),e=e.trim().replace(/\s+/g," "),a.length&&(e=e.replace(/\u0002/g,function(){return a.shift()}))}return i.compact&&(e=e.replace(T,"><$1")),r(e,o).replace(A,"")}function o(t,n,r){return Array.isArray(n)?(r=n,n={}):(r||(r=[]),n||(n={})),r._bp=de.array(n.brackets),i(e(t),n,r)}function a(e){function t(e,t,n){for(t.lastIndex=0;n=t.exec(e);)"/"!==n[0][0]||n[1]||n[2]||(e=u.leftContext+" "+u.rightContext,t.lastIndex=n[3]+1);return e}function n(e,t){var n,r=1;for(t.lastIndex=0;r&&(n=t.exec(e));)"{"===n[0]?++r:"}"===n[0]&&--r;return r?e.length:t.lastIndex}var r,i,o,a,s=[],u=RegExp;for(~e.indexOf("/")&&(e=t(e,D));r=e.match(B);)s.push(u.leftContext),e=u.rightContext,o=n(e,z),a=r[1],i=!/^(?:if|while|for|switch|catch|function)$/.test(a),a=i?r[0].replace(a,"this."+a+" = function"):r[0],s.push(a,e.slice(0,o)),e=e.slice(o),i&&!/^\s*.\s*bind\b/.test(e)&&s.push(".bind(this)");return s.length?s.join("")+e:e}function s(e,t,n,r,i){if(!/\S/.test(e))return"";n||(n=t.type);var o=t.parser||(n?ve.js[n]:a);if(!o)throw new Error('JS parser not found: "'+n+'"');return o(e,r,i).replace(/\r\n?/g,"\n").replace(A,"")}function u(e,t,n,r){return"string"==typeof t&&(r=n,n=t,t={}),n&&"object"==typeof n&&(r=n,n=""),r||(r={}),s(e,t||{},n,r.parserOptions,r.url)}function c(e,t){var n=":scope";return t.replace(Z,function(t,r,i){return i?(i=i.replace(/[^,]+/g,function(t){var r=t.trim();return r&&"from"!==r&&"to"!==r&&"%"!==r.slice(-1)?r=r.indexOf(n)<0?e+" "+r+',[riot-tag="'+e+'"] '+r+',[data-is="'+e+'"] '+r:r.replace(n,e)+","+r.replace(n,'[riot-tag="'+e+'"]')+","+r.replace(n,'[data-is="'+e+'"]'):t}),r?r+" "+i:i):t})}function l(e,t,n,r){var i=(r||(r={})).scoped;if(n)if("scoped-css"===n)i=!0;else if(ve.css[n])e=ve.css[n](t,e,r.parserOpts||{},r.url);else if("css"!==n)throw new Error('CSS parser not found: "'+n+'"');if(e=e.replace(de.R_MLCOMMS,"").replace(/\s+/g," ").trim(),i){if(!t)throw new Error("Can not parse scoped CSS without a tagName");e=c(t,e)}return e}function f(e,t,n){return t&&"object"==typeof t?(n=t,t=""):n||(n={}),l(e,n.tagName,t,n)}function p(e,t){return e?(e=H+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+H,t&&~e.indexOf("\n")?e.replace(/\n/g,"\\n"):e):"''"}function d(e,t,n,r,i,o){var a=o.debug?",\n ":", ",s="});";return i&&"\n"!==i.slice(-1)&&(s="\n"+s),"riot.tag2('"+e+H+a+p(t,1)+a+p(n)+a+p(r)+", function(opts) {\n"+i+s}function h(e){if(/<[-\w]/.test(e))for(var t,n=e.lastIndexOf("<"),r=e.length;~n;){if(t=e.slice(n,r).match(G))return n+=t.index+t[0].length,[e.slice(0,n),e.slice(n)];r=n,n=e.lastIndexOf("<",n-1)}return["",e]}function g(e){if(e){var t=e.match(U);if(t=t&&(t[2]||t[3]))return t.replace("text/","")}return""}function m(e,t){if(e){var n=e.match(RegExp("\\s"+t+q,"i"));if(n=n&&n[1])return/^['"]/.test(n)?n.slice(1,-1):n}return""}function v(e){return e.replace("&",/&/g).replace("<",/</g).replace(">",/>/g).replace(""",/"/g).replace("'",/'/g)}function x(e){var t=v(m(e,"options"));return t?JSON.parse(t):null}function y(e,t,n,r){var i=g(n),o=m(n,"src");return o?!1:s(e,t,i,x(n),r)}function b(e,t,n,r,i){var o={parserOpts:x(n),scoped:n&&/\sscoped(\s|=|$)/i.test(n),url:r};return l(e,i,g(n)||t.style,o)}function w(e,t,n,r){var i=ve.html[n];if(!i)throw new Error('Template parser not found: "'+n+'"');return i(e,r,t)}function C(o,a,u){var c,l=[];a||(a={}),c=a.exclude?function(e){return a.exclude.indexOf(e)<0}:function(){return 1},u||(u="");var f=de.array(a.brackets);return a.template&&(o=w(o,u,a.template,a.templateOptions)),o=e(o).replace(K,function(e,o,p,g,m,v){var x="",w="",C="",_=[];if(_._bp=f,p=p.toLowerCase(),g=g&&c("attribs")?r(t(n(g,a,_),_),_):"",(m||(m=v))&&/\S/.test(m))if(v)c("html")&&(C=i(v,a,_));else{m=m.replace(RegExp("^"+o,"gm"),""),m=m.replace(J,function(e,t,n){return c("css")&&(w+=(w?" ":"")+b(n,a,t,u,p)),""}),m=m.replace(V,function(e,t,n){if(c("js")){var r=y(n,a,t,u);r&&(x+=(x?"\n":"")+r)}return""});var S=h(m.replace(A,""));c("html")&&(C=i(S[0],a,_)),c("js")&&(m=s(S[1],a,null,null,u),m&&(x+=(x?"\n":"")+m))}return x=/\S/.test(x)?x.replace(/\n{3,}/g,"\n\n"):"",a.entities?(l.push({tagName:p,html:C,css:w,attribs:g,js:x}),""):d(p,C,w,g,x,a)}),a.entities?l:o}var _=/"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source,S=de.R_STRINGS.source,E=/ *([-\w:\xA0-\xFF]+) ?(?:= ?('[^']*'|"[^"]*"|\S+))?/g,N=RegExp(/<!--(?!>)[\S\s]*?-->/.source+"|"+_,"g"),O=/<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^"'\/>]*(?:(?:"[^"]*"|'[^']*'|\/[^>])[^'"\/>]*)*)|\s*)(\/?)>/g,T=/>[ \t]+<(-?[A-Za-z]|\/[-A-Za-z])/g,L=["style","src","d"],R=/^(?:input|img|br|wbr|hr|area|base|col|embed|keygen|link|meta|param|source|track)$/,M=/<pre(?:\s+(?:[^">]*|"[^"]*")*)?>([\S\s]+?)<\/pre\s*>/gi,j=/^"(?:number|date(?:time)?|time|month|email|color)\b/i,A=/[ \t]+$/gm,I=/\x01#\d/,F=/\x01#(\d+)/g,$="#",k="⁗",P='"',H="'",B=/^[ \t]*([$_A-Za-z][$\w]*)\s*\([^()]*\)\s*{/m,z=RegExp("[{}]|"+de.S_QBLOCKS,"g"),D=RegExp(de.R_MLCOMMS.source+"|//[^\r\n]*|"+de.S_QBLOCKS,"g"),Z=RegExp("([{}]|^)[ ;]*([^@ ;{}][^{}]*)(?={)|"+_,"g"),U=/\stype\s*=\s*(?:(['"])(.+?)\1|(\S+))/i,q="\\s*=\\s*("+S+"|{[^}]+}|\\S+)",G=/\/>\n|^<(?:\/?-?[A-Za-z][-\w\xA0-\xFF]*\s*|-?[A-Za-z][-\w\xA0-\xFF]*\s+[-\w:\xA0-\xFF][\S\s]*?)>\n/,K=RegExp(/^([ \t]*)<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^'"\/>]+(?:(?:@|\/[^>])[^'"\/>]*)*)|\s*)?(?:\/>|>[ \t]*\n?([\S\s]*)^\1<\/\2\s*>|>(.*)<\/\2\s*>)/.source.replace("@",S),"gim"),V=/<script(\s+[^>]*)?>\n?([\S\s]*?)<\/script\s*>/gi,J=/<style(\s+[^>]*)?>\n?([\S\s]*?)<\/style\s*>/gi;return Q.util.compiler={compile:C,html:o,css:f,js:u,version:"v3.0.0-alpha.1"},C}();Q.compile=function(){function e(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){4===r.readyState&&(200===r.status||!r.status&&r.responseText.length)&&t(r.responseText,n,e)},r.open("GET",e,!0),r.send("")}function n(e,t){if(typeof e===re){var n=H("script"),r=document.documentElement;t&&(e+="\n//# sourceURL="+t+".js"),n.text=e,r.appendChild(n),r.removeChild(n)}}function r(t,r){function a(){i.trigger("ready"),o=!0,t&&t()}function s(e,t,r){var i=xe(e,t,r);n(i,r),--c||a()}var u=B('script[type="riot/tag"]'),c=u.length;if(c)for(var l=0;l<u.length;++l){var f=u[l],p=M({template:C(f,"template")},r),d=C(f,"src");d?e(d,s,p):s(f.innerHTML,p)}else a()}var i,o;return function(a,s,u){if(typeof a===re){if(x(s)&&(u=s,s=!1),/^\s*</m.test(a)){var c=xe(a,u);return s!==!0&&n(c),h(s)&&s(c,a,u),c}e(a,function(e,t,r){var i=xe(e,t,r);n(i,r),s&&s(i,e,t)})}else{if(h(a)?(u=s,s=a):(u=a,s=t),o)return s&&s();i?s&&i.on("ready",s):(i=Q.observable(),r(s,u))}}}();var ye=Q.mount;Q.mount=function(e,t,n){var r;return Q.compile(function(){r=ye(e,t,n)}),r},typeof exports===ie?module.exports=Q:typeof define===ae&&typeof define.amd!==oe?define(function(){return Q}):e.riot=Q}("undefined"!=typeof window?window:void 0); | ||
/* Riot v3.0.0-alpha.4, @license MIT */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.riot=t()}(this,function(){"use strict";function e(e){var t,n=je;for(~e.indexOf("\r")&&(e=e.replace(/\r\n?/g,"\n")),n.lastIndex=0;t=n.exec(e);)"<"===t[0][0]&&(e=RegExp.leftContext+RegExp.rightContext,n.lastIndex=t[3]+1);return e}function t(e,t){var n,r,i,o=[];for(Re.lastIndex=0,e=e.replace(/\s+/g," ");n=Re.exec(e);){var a=n[1].toLowerCase(),s=n[2];s?(s[0]!==De&&(s=De+(s[0]===Ve?s.slice(1,-1):s)+De),"type"===a&&He.test(s)?r=s:(Be.test(s)&&("value"===a?i=1:~$e.indexOf(a)&&(a="riot-"+a)),o.push(a+"="+s))):o.push(a)}return r&&(i&&(r=De+t._bp[0]+Ve+r.slice(1,-1)+Ve+t._bp[1]+De),o.push("type="+r)),o.join(" ")}function n(e,t,n){var r=n._bp;if(e&&r[4].test(e)){for(var i,o=t.expr&&(t.parser||t.type)?s:0,a=Ne.split(e,0,r),u=1;u<a.length;u+=2)i=a[u],"^"===i[0]?i=i.slice(1):o&&(i=o(i,t).trim(),";"===i.slice(-1)&&(i=i.slice(0,-1))),a[u]=Ue+(n.push(i)-1)+r[1];e=a.join("")}return e}function r(e,t){return t.length&&(e=e.replace(ze,function(e,n){return t._bp[0]+t[n].trim().replace(/[\r\n]+/g," ").replace(/"/g,Ze)})),e}function i(e,i,o){if(e=n(e,i,o).replace(Ae,function(e,n,r,i){return n=n.toLowerCase(),i=i&&!ke.test(n)?"></"+n:"",r&&(n+=" "+t(r,o)),"<"+n+i+">"}),!i.whitespace){var a=[];/<pre[\s>]/.test(e)&&(e=e.replace(Fe,function(e){return a.push(e),""})),e=e.trim().replace(/\s+/g," "),a.length&&(e=e.replace(/\u0002/g,function(){return a.shift()}))}return i.compact&&(e=e.replace(Ie,"><$1")),r(e,o).replace(Pe,"")}function o(t,n,r){return Array.isArray(n)?(r=n,n={}):(r||(r=[]),n||(n={})),r._bp=Ne.array(n.brackets),i(e(t),n,r)}function a(e){function t(e,t,n){for(t.lastIndex=0;n=t.exec(e);)"/"!==n[0][0]||n[1]||n[2]||(e=u.leftContext+" "+u.rightContext,t.lastIndex=n[3]+1);return e}function n(e,t){var n,r=1;for(t.lastIndex=0;r&&(n=t.exec(e));)"{"===n[0]?++r:"}"===n[0]&&--r;return r?e.length:t.lastIndex}var r,i,o,a,s=[],u=RegExp;for(~e.indexOf("/")&&(e=t(e,qe));r=e.match(Ge);)s.push(u.leftContext),e=u.rightContext,o=n(e,Ke),a=r[1],i=!/^(?:if|while|for|switch|catch|function)$/.test(a),a=i?r[0].replace(a,"this."+a+" = function"):r[0],s.push(a,e.slice(0,o)),e=e.slice(o),i&&!/^\s*.\s*bind\b/.test(e)&&s.push(".bind(this)");return s.length?s.join("")+e:e}function s(e,t,n,r,i){if(!/\S/.test(e))return"";n||(n=t.type);var o=t.parser||(n?Oe.js[n]:a);if(!o)throw new Error('JS parser not found: "'+n+'"');return o(e,r,i).replace(/\r\n?/g,"\n").replace(Pe,"")}function u(e,t,n,r){return"string"==typeof t&&(r=n,n=t,t={}),n&&"object"==typeof n&&(r=n,n=""),r||(r={}),s(e,t||{},n,r.parserOptions,r.url)}function c(e,t){var n=":scope";return t.replace(Qe,function(t,r,i){return i?(i=i.replace(/[^,]+/g,function(t){var r=t.trim();return r&&"from"!==r&&"to"!==r&&"%"!==r.slice(-1)?r=r.indexOf(n)<0?e+" "+r+',[riot-tag="'+e+'"] '+r+',[data-is="'+e+'"] '+r:r.replace(n,e)+","+r.replace(n,'[riot-tag="'+e+'"]')+","+r.replace(n,'[data-is="'+e+'"]'):t}),r?r+" "+i:i):t})}function l(e,t,n,r){var i=(r||(r={})).scoped;if(n)if("scoped-css"===n)i=!0;else if(Oe.css[n])e=Oe.css[n](t,e,r.parserOpts||{},r.url);else if("css"!==n)throw new Error('CSS parser not found: "'+n+'"');if(e=e.replace(Ne.R_MLCOMMS,"").replace(/\s+/g," ").trim(),i){if(!t)throw new Error("Can not parse scoped CSS without a tagName");e=c(t,e)}return e}function f(e,t,n){return t&&"object"==typeof t?(n=t,t=""):n||(n={}),l(e,n.tagName,t,n)}function p(e,t){return e?(e=Ve+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+Ve,t&&~e.indexOf("\n")?e.replace(/\n/g,"\\n"):e):"''"}function d(e,t,n,r,i,o){var a=o.debug?",\n ":", ",s="});";return i&&"\n"!==i.slice(-1)&&(s="\n"+s),"riot.tag2('"+e+Ve+a+p(t,1)+a+p(n)+a+p(r)+", function(opts) {\n"+i+s}function h(e){if(/<[-\w]/.test(e))for(var t,n=e.lastIndexOf("<"),r=e.length;~n;){if(t=e.slice(n,r).match(Ye))return n+=t.index+t[0].length,[e.slice(0,n),e.slice(n)];r=n,n=e.lastIndexOf("<",n-1)}return["",e]}function g(e){if(e){var t=e.match(Je);if(t=t&&(t[2]||t[3]))return t.replace("text/","")}return""}function m(e,t){if(e){var n=e.match(RegExp("\\s"+t+Xe,"i"));if(n=n&&n[1])return/^['"]/.test(n)?n.slice(1,-1):n}return""}function v(e){return e.replace("&",/&/g).replace("<",/</g).replace(">",/>/g).replace(""",/"/g).replace("'",/'/g)}function x(e){var t=v(m(e,"options"));return t?JSON.parse(t):null}function y(e,t,n,r){var i=g(n),o=m(n,"src");return o?!1:s(e,t,i,x(n),r)}function b(e,t,n,r,i){var o={parserOpts:x(n),scoped:n&&/\sscoped(\s|=|$)/i.test(n),url:r};return l(e,i,g(n)||t.style,o)}function w(e,t,n,r){var i=Oe.html[n];if(!i)throw new Error('Template parser not found: "'+n+'"');return i(e,r,t)}function C(o,a,u){var c,l=[];a||(a={}),c=a.exclude?function(e){return a.exclude.indexOf(e)<0}:function(){return 1},u||(u="");var f=Ne.array(a.brackets);return a.template&&(o=w(o,u,a.template,a.templateOptions)),o=e(o).replace(We,function(e,o,p,g,m,v){var x="",w="",C="",_=[];if(_._bp=f,p=p.toLowerCase(),g=g&&c("attribs")?r(t(n(g,a,_),_),_):"",(m||(m=v))&&/\S/.test(m))if(v)c("html")&&(C=i(v,a,_));else{m=m.replace(RegExp("^"+o,"gm"),""),m=m.replace(tt,function(e,t,n){return c("css")&&(w+=(w?" ":"")+b(n,a,t,u,p)),""}),m=m.replace(et,function(e,t,n){if(c("js")){var r=y(n,a,t,u);r&&(x+=(x?"\n":"")+r)}return""});var S=h(m.replace(Pe,""));c("html")&&(C=i(S[0],a,_)),c("js")&&(m=s(S[1],a,null,null,u),m&&(x+=(x?"\n":"")+m))}return x=/\S/.test(x)?x.replace(/\n{3,}/g,"\n\n"):"",a.entities?(l.push({tagName:p,html:C,css:w,attribs:g,js:x}),""):d(p,C,w,g,x,a)}),a.entities?l:o}function _(e,t,n,r){n[e]=function(e){var i=r._parent,o=r._item;if(!o)for(;i&&!o;)o=i._item,i=i._parent;e=e||ht.event,ie(e,"currentTarget")&&(e.currentTarget=n),ie(e,"target")&&(e.target=e.srcElement),ie(e,"which")&&(e.which=e.charCode||e.keyCode),e.item=o,t.call(r,e),e.preventUpdate||X(r).update()}}function S(e,t){F(e,function(e,n){var r=e.dom,i=e.attr,o=Le(e.expr,t),a=r&&r.parentNode,s="value"==i;if(e.bool?o=o?i:!1:null==o&&(o=""),e._riot_id){if(e.isMounted)e.update();else if(e.mount(),"VIRTUAL"==e.root.tagName){var u=document.createDocumentFragment();ve(e,u),e.root.parentElement.replaceChild(u,e.root)}}else{if(e.update)return void e.update();var c=e.value;if(e.value=o,e.isRtag&&o)return E(e,t);if(!(s&&r.value==o||!s&&c===o)){if(!i)return o+="",void(a&&("TEXTAREA"===a.tagName?(a.value=o,yt||(r.nodeValue=o)):r.nodeValue=o));if(D(r,i),H(o))_(i,o,r,t);else if(/^(show|hide)$/.test(i))"hide"==i&&(o=!o),r.style.display=o?"":"none";else if("value"==i)r.value=o;else if(ge(i,st)&&i!=ut)o&&K(r,i.slice(st.length),o);else{if("selected"==i&&a&&/^(SELECT|OPTGROUP)$/.test(a.nodeName)&&o&&(a.value=r.value),e.bool&&(r[i]=o,!o))return;(0===o||o&&typeof o!==ft)&&K(r,i,o)}}}})}function E(e,t){var n,r=Le(e.value,t);if(e.tag&&e.tagName==r)return void e.tag.update();if(e.tag){var i=e.tag.opts.riotTag,o=e.tag._parent.tags[i];re(o)?o.splice(o.indexOf(e.tag),1):delete e.tag._parent.tags[i]}e.impl=ot[r],n={root:e.dom,parent:t,hasImpl:!0,tagName:r},e.tag=J(e.impl,n,e.dom.innerHTML,t),e.tagName=r,e.tag.mount(),e.tag.update()}function N(e,t,n){D(e,"if"),this.parentTag=t,this.expr=n,this.stub=document.createTextNode(""),this.pristine=e;var r=e.parentNode;r.insertBefore(this.stub,e),r.removeChild(e)}function L(e,t,n,r){this.dom=e,this.attr=t,this.rawValue=n,this.parent=r,this.customParent=X(r),this.hasExp=Le.hasExpr(n),this.firstRun=!0}function O(e,t,n,r){var i=r?Object.create(r):{};return i[e.key]=t,e.pos&&(i[e.pos]=n),i}function T(e,t,n,r){for(var i,o=t.length,a=e.length;o>a;)i=t[--o],t.splice(o,1),i.unmount(),he(r.tags,n,i,!0)}function M(e,t){Object.keys(e.tags).forEach(function(n){var r=e.tags[n];re(r)?F(r,function(e){Q(e,n,t)}):Q(r,n,t)})}function R(e,t,n){D(e,"each");var r,i=typeof G(e,"no-reorder")!==lt||D(e,"no-reorder"),o=ee(e),a=ot[o]||{tmpl:P(e)},s=gt.test(o),u=e.parentNode,c=document.createTextNode(""),l=q(e),f="option"===o.toLowerCase(),p=[],d=[],h="VIRTUAL"==e.tagName;n=Le.loopKeys(n),n.isLoop=!0;var g=G(e,"if");return g&&D(e,"if"),u.insertBefore(c,e),u.removeChild(e),n.update=function(){var m=Le(n.val,t),v=document.createDocumentFragment();if(u=c.parentNode,re(m)||(r=m||!1,m=r?Object.keys(m).map(function(e){return O(n,e,m[e])}):[]),g&&(m=m.filter(function(e,r){var i=O(n,e,r,t);return!!Le(g,i)})),m.forEach(function(c,f){var g,m=i&&typeof c==ft&&!r,x=d.indexOf(c),y=~x&&m?x:f,b=p[y];c=!r&&n.key?O(n,c,f):c,!m&&!b||m&&!~x||!b?(b=new k(a,{parent:t,isLoop:!0,hasImpl:!!ot[o],root:s?u:e.cloneNode(),item:c},e.innerHTML),b.mount(),g=b.root,f==p.length?h?ve(b,v):v.appendChild(g):(h?ve(b,u,p[f]):u.insertBefore(g,p[f].root),d.splice(f,0,c)),p.splice(f,0,b),l&&de(t.tags,o,b,!0),y=f):b.update(c),y!==f&&m&&(h?xe(b,u,p[f]):u.insertBefore(b.root,p[f].root),n.pos&&(b[n.pos]=f),p.splice(f,0,p.splice(y,1)[0]),d.splice(f,0,d.splice(y,1)[0]),!l&&b.tags&&M(b,f)),b._item=c,W(b,"_parent",t)}),T(m,p,o,t),f){if(u.appendChild(v),bt&&!u.multiple)for(var x=0;x<u.length;x++)if(u[x].__riot1374){u.selectedIndex=x,delete u[x].__riot1374;break}}else u.insertBefore(v,c);d=m.slice()},n.unmount=function(){F(p,function(e){e.unmount()})},n}function j(e,t,n,r){var i={parent:{children:n}};ae(e,function(n,i){var o,a,s,u=n.nodeType,c=i.parent;if(3==u&&"STYLE"!=n.parentNode.tagName&&Le.hasExpr(n.nodeValue)&&c.children.push({dom:n,expr:n.nodeValue}),1!=u)return i;if(o=G(n,"each"))return c.children.push(R(n,t,o)),!1;if(o=G(n,"if"))return c.children.push(new N(n,t,o)),!1;var l=[],f=[];F(n.attributes,function(e){var r=e.name,i=xt.test(r),o=Le.hasExpr(e.value);return"name"===r||"id"===r?(a=new L(n,r,e.value,t),c.children.push(a),f.push(a),void l.push(a)):(a={dom:n,expr:e.value,attr:e.name,bool:i},l.push(a),o?(c.children.push(a),i?(D(n,r),!1):void 0):void 0)}),(a=G(n,ut))&&Le.hasExpr(a)&&(o={isRtag:!0,expr:a,dom:n,children:[]},c.children.push(o),c=o);var p=q(n);if(p&&(n!==e||r)){var d={root:n,parent:t,hasImpl:!0,ownAttrs:l};return s=J(p,d,n.innerHTML,t),c.children.push(s),F(f,function(e){e.tag=s}),!1}return{parent:c}},i)}function A(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"</"+i,i=e.firstChild,r)i.selectedIndex=-1;else{var o=Lt[n];o&&1===i.childElementCount&&(i=fe(o,i))}return i}function I(e,t){if(!_t.test(e))return e;var n={};return t=t&&t.replace(Et,function(e,t,r){return n[t]=n[t]||r,""}).trim(),e.replace(Nt,function(e,t,r){return n[t]||r||""}).replace(St,function(e,n){return t||n||""})}function $(e,t){var n=e&&e.match(/^\s*<([-\w]+)/),r=n&&n[1].toLowerCase(),i=ce(Tt,z(r));return e=I(e,t),Ot.test(r)?i=A(i,e,r):B(i,e),i.stub=!0,i}function k(e,t,n){function r(){var e=f&&l?s:c||s;p?F(p||[],function(e){var t=e.hasOwnProperty("value")?e.value:e.expr;u[V(e.attr)]=t}):F(g.attributes,function(t){var n=t.value,r=Le.hasExpr(n);r&&p||(u[V(t.name)]=r?Le(n,e):n)})}function i(e){for(var t in d)typeof s[t]!==pt&&ie(s,t)&&(s[t]=e[t])}function o(){F(Object.keys(s.parent),function(e){var t=!mt.test(e)&&ne(x,e);(typeof s[e]===pt||t)&&(t||x.push(e),s[e]=s.parent[e])})}var a,s=Ee(this),u=pe(t.opts)||{},c=t.parent,l=t.isLoop,f=t.hasImpl,p=t.ownAttrs,d=oe(t.item),h=[],g=t.root,m=t.tagName||g.tagName.toLowerCase(),v={},x=[];e.name&&g._tag&&g._tag.unmount(!0),this.isMounted=!1,g.isLoop=l,this._hasImpl=f,W(this,"_riot_id",++Mt),te(this,{parent:c,root:g,opts:u},d),W(this,"tags",{}),F(g.attributes,function(e){var t=e.value;Le.hasExpr(t)&&(v[e.name]=t)}),a=$(e.tmpl,n),W(this,"update",function(e){return!H(s.shouldUpdate)||s.shouldUpdate()?(e=oe(e),l&&!f&&o(),e&&U(d)&&(i(e),d=e),te(s,e),r(),s.isMounted&&s.trigger("update",e),S(h,s),s.isMounted&&s.trigger("updated"),this):void 0}),W(this,"mixin",function(){return F(arguments,function(e){var t;e=typeof e===lt?kt(e):e,H(e)?(t=new e,e=e.prototype):t=e,F(Object.getOwnPropertyNames(e),function(e){"init"!=e&&(s[e]=H(t[e])?t[e].bind(s):t[e])}),t.init&&t.init.bind(s)()}),this}),W(this,"mount",function(t){r(),g._tag=this;var n=kt(at);if(n)for(var i in n)n.hasOwnProperty(i)&&s.mixin(n[i]);if(e.fn&&e.fn.call(s,u),e.attrs&&se(e.attrs,function(e,t){K(g,e,t)}),(e.attrs||f)&&j(s.root,s,h),j(a,s,h),s.update(d),s.trigger("before-mount"),l&&!f)s.root=g=a.firstChild;else{for(;a.firstChild;)g.appendChild(a.firstChild);g.stub&&(s.root=g=c.root)}W(s,"root",g),s.isMounted=!0,!s.parent||s.parent.isMounted?s.trigger("mount"):s.parent.one("mount",function(){ue(s.root)||s.trigger("mount")})}),W(this,"unmount",function(e){var t,n=s.root,r=n.parentNode,i=it.indexOf(s);if(s.trigger("before-unmount"),~i&&it.splice(i,1),r){if(c)t=X(c),he(t.tags,m,s);else for(;n.firstChild;)n.removeChild(n.firstChild);e?(D(r,ct),D(r,ut)):r.removeChild(n)}this._virts&&F(this._virts,function(e){e.parentNode&&e.parentNode.removeChild(e)}),Y(h),s.trigger("unmount"),s.off("*"),s.isMounted=!1,delete s.root._tag})}function F(e,t){for(var n,r=e?e.length:0,i=0;r>i;i++)n=e[i],null!=n&&t(n,i)===!1&&i--;return e}function H(e){return typeof e===dt||!1}function P(e){if(e.outerHTML)return e.outerHTML;var t=ce("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function B(e,t){if(typeof e.innerHTML!=pt)e.innerHTML=t;else{var n=(new DOMParser).parseFromString(t,"application/xml");e.appendChild(e.ownerDocument.importNode(n.documentElement,!0))}}function z(e){return~vt.indexOf(e)}function U(e){return e&&typeof e===ft}function Z(e){return typeof e===pt||null===e||""===e}function D(e,t){e.removeAttribute(t)}function V(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function G(e,t){return e.getAttribute(t)}function K(e,t,n){e.setAttribute(t,n)}function q(e){return e.tagName&&ot[G(e,ct)||G(e,ut)||e.tagName.toLowerCase()]}function Q(e,t,n){var r,i=e.parent;i&&(r=i.tags[t],re(r)?r.splice(n,0,r.splice(r.indexOf(e),1)[0]):de(i.tags,t,e))}function J(e,t,n,r){var i=new k(e,t,n),o=t.tagName||ee(t.root,!0),a=X(r);return i.parent=a,i._parent=r,de(a.tags,o,i),a!==r&&de(r.tags,o,i),t.root.innerHTML="",i}function X(e){for(var t=e;!t._hasImpl&&t.parent;)t=t.parent;return t}function Y(e){var t,n,r=e.length;for(t=0;r>t;t++)n=e[t],n instanceof k?n.unmount(!0):n.unmount&&n.unmount()}function W(e,t,n,r){return Object.defineProperty(e,t,te({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function ee(e,t){var n=q(e),r=!t&&G(e,"name"),i=r&&!Le.hasExpr(r)?r:n?n.name:e.tagName.toLowerCase();return i}function te(e){for(var t,n=arguments,r=1;r<n.length;++r)if(t=n[r])for(var i in t)ie(e,i)&&(e[i]=t[i]);return e}function ne(e,t){return~e.indexOf(t)}function re(e){return Array.isArray(e)||e instanceof Array}function ie(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return typeof e[t]===pt||n&&n.writable}function oe(e){if(!(e instanceof k||e&&typeof e.trigger==dt))return e;var t={};for(var n in e)mt.test(n)||(t[n]=e[n]);return t}function ae(e,t,n){if(e){var r,i=t(e,n);if(i===!1)return;for(e=e.firstChild;e;)r=e.nextSibling,ae(e,t,i),e=r}}function se(e,t){for(var n,r=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g;n=r.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function ue(e){for(;e;){if(e.inStub)return!0;e=e.parentNode}return!1}function ce(e,t){return t?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(e)}function le(e,t){return(t||document).querySelectorAll(e)}function fe(e,t){return(t||document).querySelector(e)}function pe(e){function t(){}return t.prototype=e,new t}function de(e,t,n,r){var i=e[t],o=re(i);i&&i===n||(!i&&r?e[t]=[n]:i?(!o||o&&!ne(i,n))&&(o?i.push(n):e[t]=[i,n]):e[t]=n)}function he(e,t,n,r){re(e[t])?(F(e[t],function(r,i){r===n&&e[t].splice(i,1)}),e[t].length?1!=e[t].length||r||(e[t]=e[t][0]):delete e[t]):delete e[t]}function ge(e,t){return e.slice(0,t.length)===t}function me(e,t,n){var r=ot[t],i=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";var o={root:e,opts:n};return n&&n.parent&&(o.parent=n.parent),r&&e&&(r=new k(r,o,i)),r&&r.mount&&(r.mount(!0),ne(it,r)||it.push(r)),r}function ve(e,t,n){var r,i,o=document.createTextNode(""),a=document.createTextNode("");for(e._head=e.root.insertBefore(o,e.root.firstChild),e._tail=e.root.appendChild(a),i=e._head,e._virts=[];i;)r=i.nextSibling,n?t.insertBefore(i,n._head):t.appendChild(i),e._virts.push(i),i=r}function xe(e,t,n){for(var r,i=e._head;i;)if(r=i.nextSibling,t.insertBefore(i,n._head),i=r,i==e._tail){t.insertBefore(i,n._head);break}}function ye(e,t,n,r,i){return H(r)&&(i=r,/^[\w\-]+\s?=/.test(n)?(r=n,n=""):r=""),n&&(H(n)?i=n:jt.add(n)),e=e.toLowerCase(),ot[e]={name:e,tmpl:t,attrs:r,fn:i},e}function be(e,t,n,r,i){return n&&jt.add(n),ot[e]={name:e,tmpl:t,attrs:r,fn:i},e}function we(e,t,n){function r(e){var t="";return F(e,function(e){/[^-\w]/.test(e)||(e=e.trim().toLowerCase(),t+=",["+ct+'="'+e+'"],['+ut+'="'+e+'"]')}),t}function i(){var e=Object.keys(ot);return e+r(e)}function o(e){if(e.tagName){var r=G(e,ct)||G(e,ut);t&&r!==t&&(r=t,K(e,ct,t),K(e,ut,t));var i=me(e,r||e.tagName.toLowerCase(),n);i&&u.push(i)}else e.length&&F(e,o)}var a,s,u=[];if(jt.inject(),U(t)&&(n=t,t=0),typeof e===lt?("*"===e?e=s=i():e+=r(e.split(/, */)),a=e?le(e):[]):a=e,"*"===t){if(t=s||i(),a.tagName)a=le(t,a);else{var c=[];F(a,function(e){c.push(le(t,e))}),a=c}t=0}return o(a),u}function Ce(){return F(it,function(e){e.update()})}function _e(e){delete ot[e]}function Se(e,t,n){var r;return Pt(function(){r=we(e,t,n)}),r}var Ee=function(e){function t(e,t){for(var n,r,i=e.split(" "),o=i.length,a=0;o>a;a++)n=i[a],r=n.indexOf("."),n&&t(~r?n.substring(0,r):n,a,~r?n.slice(r+1):null)}e=e||{};var n={},r=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(r,i){return"function"!=typeof i?e:(t(r,function(e,t,r){(n[e]=n[e]||[]).push(i),i.typed=t>0,i.ns=r}),e)},enumerable:!1,writable:!1,configurable:!1},off:{value:function(r,i){return"*"!=r||i?t(r,function(e,t,r){if(i||r)for(var o,a=n[e],s=0;o=a&&a[s];++s)(o==i||r&&o.ns==r)&&a.splice(s--,1);else delete n[e]}):n={},e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(i){for(var o,a=arguments.length-1,s=new Array(a),u=0;a>u;u++)s[u]=arguments[u+1];return t(i,function(t,i,a){o=r.call(n[t]||[],0);for(var u,c=0;u=o[c];++c)u.busy||(u.busy=1,a&&u.ns!=a||u.apply(e,u.typed?[t].concat(s):s),o[c]!==u&&c--,u.busy=0);n["*"]&&"*"!=t&&e.trigger.apply(e,["*",t].concat(s))}),e},enumerable:!1,writable:!1,configurable:!1}}),e},Ne=function(e){function t(e){return e}function n(e,t){return t||(t=v),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?c:"")}function r(e){if(e===h)return g;var t=e.split(" ");if(2!==t.length||/[\x00-\x1F<>a-zA-Z0-9'",;\\]/.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(/(?=[[\]()*+?.^$|])/g,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:g[4],t),t[5]=n(e.length>3?/\\({|})/g:g[5],t),t[6]=n(g[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+p,c),t[8]=e,t}function i(e){return e instanceof RegExp?s(e):v[e]}function o(e){(e||(e=h))!==v[8]&&(v=r(e),s=e===h?t:n,v[9]=s(g[9])),m=e}function a(e){var t;e=e||{},t=e.brackets,Object.defineProperty(e,"brackets",{set:o,get:function(){return m},enumerable:!0}),u=e,o(t)}var s,u,c="g",l=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,f=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'/g,p=f.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?(\/)[gim]*/.source,d={"(":RegExp("([()])|"+p,c),"[":RegExp("([[\\]])|"+p,c),"{":RegExp("([{}])|"+p,c)},h="{ }",g=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+p,c),h,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],m=e,v=[];return i.split=function(e,t,n){function r(e){t||a?c.push(e&&e.replace(n[5],"$1")):c.push(e)}function i(e,t,n){var r,i=d[t];for(i.lastIndex=n,n=1;(r=i.exec(e))&&(!r[1]||(r[1]===t?++n:--n)););return n?e.length:i.lastIndex}n||(n=v);var o,a,s,u,c=[],l=n[6];for(a=s=l.lastIndex=0;o=l.exec(e);){if(u=o.index,a){if(o[2]){l.lastIndex=i(e,o[2],l.lastIndex);continue}if(!o[3])continue}o[1]||(r(e.slice(s,u)),s=l.lastIndex,l=n[6+(a^=1)],l.lastIndex=s)}return e&&s<e.length&&r(e.slice(s)),c},i.hasExpr=function(e){return v[4].test(e)},i.loopKeys=function(e){var t=e.match(v[9]);return t?{key:t[1],pos:t[2],val:v[0]+t[3].trim()+v[1]}:{val:e.trim()}},i.array=function(e){return e?r(e):v},Object.defineProperty(i,"settings",{set:a,get:function(){return u}}),i.settings="undefined"!=typeof riot&&riot.settings||{},i.set=o,i.R_STRINGS=f,i.R_MLCOMMS=l,i.S_QBLOCKS=p,i}(),Le=function(){function e(e,r){return e?(a[e]||(a[e]=n(e))).call(r,t):e}function t(t,n){e.errorHandler&&(t.riotData={tagName:n&&n.root&&n.root.tagName,_riot_id:n&&n._riot_id},e.errorHandler(t))}function n(e){var t=r(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function r(e){var t,n=[],r=Ne.split(e.replace(l,'"'),1);if(r.length>2||r[0]){var o,a,s=[];for(o=a=0;o<r.length;++o)t=r[o],t&&(t=1&o?i(t,1,n):'"'+t.replace(/\\/g,"\\\\").replace(/\r\n?|\n/g,"\\n").replace(/"/g,'\\"')+'"')&&(s[a++]=t);t=2>a?s[0]:"["+s.join(",")+'].join("")'}else t=i(r[1],0,n);return n[0]&&(t=t.replace(f,function(e,t){return n[t].replace(/\r/g,"\\r").replace(/\n/g,"\\n")})),t}function i(e,t,n){function r(t,n){var r,i=1,o=p[t];for(o.lastIndex=n.lastIndex;r=o.exec(e);)if(r[0]===t)++i;else if(!--i)break;n.lastIndex=i?e.length:o.lastIndex}if(e=e.replace(c,function(e,t){return e.length>2&&!t?s+(n.push(e)-1)+"~":e}).replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,a=[],l=0;e&&(i=e.match(u))&&!i.index;){var f,d,h=/,|([[{(])|$/g;for(e=RegExp.rightContext,f=i[2]?n[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];d=(i=h.exec(e))[1];)r(d,h);d=e.slice(0,i.index),e=RegExp.rightContext,a[l++]=o(d,1,f)}e=l?l>1?"["+a.join(",")+'].join(" ").trim()':a[0]:o(e,t)}return e}function o(e,t,n){var r;return e=e.replace(h,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+d+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!g.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var a={};e.haveRaw=Ne.hasRaw,e.hasExpr=Ne.hasExpr,e.loopKeys=Ne.loopKeys,e.errorHandler=null;var s="⁗",u=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,c=RegExp(Ne.S_QBLOCKS,"g"),l=/\u2057/g,f=/\u2057(\d+)~/g,p={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},d='"in this?this:'+("object"!=typeof window?"global":"window")+").",h=/[,{][$\w]+:|(^ *|[^$\w\.])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,g=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.parse=function(e){return e},e.version=Ne.version="v2.4.0",e}(),Oe=function(){function e(e){var t=window[e];if(t)return t;throw new Error(e+" parser not found.")}function t(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}var n={html:{jade:function(n,r,i){return r=t({pretty:!0,filename:i,doctype:"html"},r),e("jade").render(n,r)}},css:{less:function(n,r,i,o){var a;return i=t({sync:!0,syncImport:!0,filename:o},i),e("less").render(r,i,function(e,t){if(e)throw e;a=t.css}),a}},js:{es6:function(n,r){return r=t({blacklist:["useStrict","strict","react"],sourceMaps:!1,comments:!1},r),e("babel").transform(n,r).code},babel:function(n,r,i){return e("babel").transform(n,t({filename:i},r)).code},coffee:function(n,r){return e("CoffeeScript").compile(n,t({bare:!0},r))},livescript:function(n,r){return e("livescript").compile(n,t({bare:!0,header:!1},r))},typescript:function(t,n){return e("typescript")(t,n)},none:function(e){return e}}};return n.js.javascript=n.js.none,n.js.coffeescript=n.js.coffee,n}(),Te=/"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source,Me=Ne.R_STRINGS.source,Re=/ *([-\w:\xA0-\xFF]+) ?(?:= ?('[^']*'|"[^"]*"|\S+))?/g,je=RegExp(/<!--(?!>)[\S\s]*?-->/.source+"|"+Te,"g"),Ae=/<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^"'\/>]*(?:(?:"[^"]*"|'[^']*'|\/[^>])[^'"\/>]*)*)|\s*)(\/?)>/g,Ie=/>[ \t]+<(-?[A-Za-z]|\/[-A-Za-z])/g,$e=["style","src","d"],ke=/^(?:input|img|br|wbr|hr|area|base|col|embed|keygen|link|meta|param|source|track)$/,Fe=/<pre(?:\s+(?:[^">]*|"[^"]*")*)?>([\S\s]+?)<\/pre\s*>/gi,He=/^"(?:number|date(?:time)?|time|month|email|color)\b/i,Pe=/[ \t]+$/gm,Be=/\x01#\d/,ze=/\x01#(\d+)/g,Ue="#",Ze="⁗",De='"',Ve="'",Ge=/^[ \t]*([$_A-Za-z][$\w]*)\s*\([^()]*\)\s*{/m,Ke=RegExp("[{}]|"+Ne.S_QBLOCKS,"g"),qe=RegExp(Ne.R_MLCOMMS.source+"|//[^\r\n]*|"+Ne.S_QBLOCKS,"g"),Qe=RegExp("([{}]|^)[ ;]*([^@ ;{}][^{}]*)(?={)|"+Te,"g"),Je=/\stype\s*=\s*(?:(['"])(.+?)\1|(\S+))/i,Xe="\\s*=\\s*("+Me+"|{[^}]+}|\\S+)",Ye=/\/>\n|^<(?:\/?-?[A-Za-z][-\w\xA0-\xFF]*\s*|-?[A-Za-z][-\w\xA0-\xFF]*\s+[-\w:\xA0-\xFF][\S\s]*?)>\n/,We=RegExp(/^([ \t]*)<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^'"\/>]+(?:(?:@|\/[^>])[^'"\/>]*)*)|\s*)?(?:\/>|>[ \t]*\n?([\S\s]*)^\1<\/\2\s*>|>(.*)<\/\2\s*>)/.source.replace("@",Me),"gim"),et=/<script(\s+[^>]*)?>\n?([\S\s]*?)<\/script\s*>/gi,tt=/<style(\s+[^>]*)?>\n?([\S\s]*?)<\/style\s*>/gi,nt="v3.0.0-alpha.1",rt={compile:C,compileHTML:o,compileCSS:f,compileJS:u,parsers:Oe,version:nt},it=[],ot={},at="__global_mixin",st="riot-",ut="data-is",ct="data-is",lt="string",ft="object",pt="undefined",dt="function",ht=typeof window==pt?void 0:window,gt=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/,mt=/^(?:_(?:item|id|parent)|update|root|(?:un)?mount|mixin|is(?:Mounted|Loop)|tags|parent|opts|trigger|o(?:n|ff|ne))$/,vt=["altGlyph","animate","animateColor","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","font","foreignObject","g","glyph","glyphRef","image","line","linearGradient","marker","mask","missing-glyph","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tref","tspan","use"],xt=/^(?: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)$/,yt=0|(ht&&ht.document||{}).documentMode,bt=ht&&!!ht.InstallTrigger;N.prototype.update=function(){var e=Le(this.expr,this.parentTag);e&&!this.current?(this.current=this.pristine.cloneNode(!0),this.stub.parentNode.insertBefore(this.current,this.stub),this.expressions=[],j(this.current,this.parentTag,this.expressions,!0)):!e&&this.current&&(Y(this.expressions),this.current.parentNode.removeChild(this.current),this.current=null,this.expressions=[]),e&&S(this.expressions,this.parentTag)},N.prototype.unmount=function(){Y(this.expressions||[]),delete this.pristine,delete this.parentNode,delete this.stub},L.prototype.update=function(){var e=this.rawValue;if(this.hasExp&&(e=Le(this.rawValue,this.parent)),this.firstRun||e!==this.value){var t=this.tag||this.dom;Z(this.value)||he(this.customParent,this.value,t),Z(e)?D(this.dom,this.attr):(de(this.customParent,e,t),K(this.dom,this.attr,e)),this.value=e,this.firstRun=!1}},L.prototype.unmount=function(){var e=this.tag||this.dom;Z(this.value)||he(this.customParent,this.value,e),delete this.dom,delete this.parent,delete this.customParent};var wt,Ct,_t=/<yield\b/i,St=/<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>|>)/gi,Et=/<yield\s+to=['"]([^'">]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,Nt=/<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,Lt={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},Ot=yt&&10>yt?gt:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,Tt="div",Mt=0,Rt="";ht&&(wt=function(){var e=ce("style");K(e,"type","text/css");var t=fe("style[type=riot]");return t?(t.id&&(e.id=t.id),t.parentNode.replaceChild(e,t)):document.getElementsByTagName("head")[0].appendChild(e),e}(),Ct=wt.styleSheet);var jt={styleNode:wt,add:function(e){ht&&(Rt+=e)},inject:function(){Rt&&ht&&(Ct?Ct.cssText+=Rt:wt.innerHTML+=Rt,Rt="")}},At=Ee,It=Ne.settings,$t={tmpl:Le,brackets:Ne,styleNode:jt.styleNode},kt=function(){var e={},t=e[at]={},n=0;return function(r,i,o){if(U(r))return void kt("__unnamed_"+n++,r,!0);var a=o?t:e;if(!i){if(typeof a[r]===pt)throw new Error("Unregistered mixin: "+r);return a[r]}H(i)?(te(i.prototype,a[r]||{}),a[r]=i):a[r]=te(a[r]||{},i)}}(),Ft=it,Ht=Object.freeze({observable:At,settings:It,util:$t,mixin:kt,tag:ye,tag2:be,mount:we,update:Ce,unregister:_e,vdom:Ft}),Pt=function(){function e(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){4===r.readyState&&(200===r.status||!r.status&&r.responseText.length)&&t(r.responseText,n,e)},r.open("GET",e,!0),r.send("")}function t(e,t){if(typeof e===lt){var n=ce("script"),r=document.documentElement;t&&(e+="\n//# sourceURL="+t+".js"),n.text=e,r.appendChild(n),r.removeChild(n)}}function n(n,o){function a(){r.trigger("ready"),i=!0,n&&n()}function s(e,n,r){var i=rt.compile(e,n,r);t(i,r),--c||a()}var u=le('script[type="riot/tag"]'),c=u.length;if(c)for(var l=0;l<u.length;++l){var f=u[l],p=te({template:G(f,"template")},o),d=G(f,"src");d?e(d,s,p):s(f.innerHTML,p)}else a()}var r,i;return function(o,a,s){if(typeof o===lt){if(U(a)&&(s=a,a=!1),/^\s*</m.test(o)){var u=rt.compile(o,s);return a!==!0&&t(u),H(a)&&a(u,o,s),u}e(o,function(e,n,r){var i=rt.compile(e,n,r);t(i,r),a&&a(i,e,n)})}else{if(H(o)?(s=a,a=o):(s=o,a=void 0),i)return a&&a();r?a&&r.on("ready",a):(r=Ee(),n(a,s))}}}(),Bt=te({},Ht,{compile:Pt,mount:Se,parsers:rt.parsers});return Bt}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
250
0
720820
25
25
14336
Updatedsimple-html-tokenizer@^0.2.5