{"version":3,"file":"ractive.min.js","sources":["ractive.js"],"sourcesContent":["/*\n\tRactive.js v0.8.12\n\tThu Mar 16 2017 17:26:29 GMT+0000 (UTC) - commit af463e0d2dff780e82e7c2a1ea218c7350d57bd6\n\n\thttp://ractivejs.org\n\thttp://twitter.com/RactiveJS\n\n\tReleased under the MIT License.\n*/\n\n\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t((function() { var current = global.Ractive; var next = factory(); next.noConflict = function() { global.Ractive = current; return next; }; return global.Ractive = next; })());\n}(this, function () { 'use strict';\n\n\tvar defaults = {\n\t\t// render placement:\n\t\tel: void 0,\n\t\tappend:\t\t\t\t false,\n\n\t\t// template:\n\t\ttemplate: null,\n\n\t\t// parse:\n\t\tdelimiters: [ '{{', '}}' ],\n\t\ttripleDelimiters: [ '{{{', '}}}' ],\n\t\tstaticDelimiters: [ '[[', ']]' ],\n\t\tstaticTripleDelimiters: [ '[[[', ']]]' ],\n\t\tcsp: \t\t\t\t\ttrue,\n\t\tinterpolate: false,\n\t\tpreserveWhitespace: false,\n\t\tsanitize: false,\n\t\tstripComments: true,\n\t\tcontextLines: 0,\n\n\t\t// data & binding:\n\t\tdata: {},\n\t\tcomputed: {},\n\t\tmagic: false,\n\t\tmodifyArrays: false,\n\t\tadapt: [],\n\t\tisolated: false,\n\t\ttwoway: true,\n\t\tlazy: false,\n\n\t\t// transitions:\n\t\tnoIntro: false,\n\t\ttransitionsEnabled: true,\n\t\tcomplete: void 0,\n\n\t\t// css:\n\t\tcss: null,\n\t\tnoCssTransform: false\n\t};\n\n\t// These are a subset of the easing equations found at\n\t// https://raw.github.com/danro/easing-js - license info\n\t// follows:\n\n\t// --------------------------------------------------\n\t// easing.js v0.5.4\n\t// Generic set of easing functions with AMD support\n\t// https://github.com/danro/easing-js\n\t// This code may be freely distributed under the MIT license\n\t// http://danro.mit-license.org/\n\t// --------------------------------------------------\n\t// All functions adapted from Thomas Fuchs & Jeremy Kahn\n\t// Easing Equations (c) 2003 Robert Penner, BSD license\n\t// https://raw.github.com/danro/easing-js/master/LICENSE\n\t// --------------------------------------------------\n\n\t// In that library, the functions named easeIn, easeOut, and\n\t// easeInOut below are named easeInCubic, easeOutCubic, and\n\t// (you guessed it) easeInOutCubic.\n\t//\n\t// You can add additional easing functions to this list, and they\n\t// will be globally available.\n\n\n\tvar easing = {\n\t\tlinear: function ( pos ) { return pos; },\n\t\teaseIn: function ( pos ) { return Math.pow( pos, 3 ); },\n\t\teaseOut: function ( pos ) { return ( Math.pow( ( pos - 1 ), 3 ) + 1 ); },\n\t\teaseInOut: function ( pos ) {\n\t\t\tif ( ( pos /= 0.5 ) < 1 ) { return ( 0.5 * Math.pow( pos, 3 ) ); }\n\t\t\treturn ( 0.5 * ( Math.pow( ( pos - 2 ), 3 ) + 2 ) );\n\t\t}\n\t};\n\n\tvar legacy = null;\n\n\t/*global console, navigator */\n\n\tvar win = typeof window !== 'undefined' ? window : null;\n\tvar doc = win ? document : null;\n\n\tvar isClient = !!doc;\n\tvar isJsdom = ( typeof navigator !== 'undefined' && /jsDom/.test( navigator.appName ) );\n\tvar hasConsole = ( typeof console !== 'undefined' && typeof console.warn === 'function' && typeof console.warn.apply === 'function' );\n\n\tvar magicSupported;\n\ttry {\n\t\tObject.defineProperty({}, 'test', { value: 0 });\n\t\tmagicSupported = true;\n\t} catch ( e ) {\n\t\tmagicSupported = false;\n\t}\n\n\tvar svg = doc ?\n\t\tdoc.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1' ) :\n\t\tfalse;\n\n\tvar vendors = [ 'o', 'ms', 'moz', 'webkit' ];\n\n\tvar html = 'http://www.w3.org/1999/xhtml';\n\tvar mathml = 'http://www.w3.org/1998/Math/MathML';\n\tvar svg$1 = 'http://www.w3.org/2000/svg';\n\tvar xlink = 'http://www.w3.org/1999/xlink';\n\tvar xml = 'http://www.w3.org/XML/1998/namespace';\n\tvar xmlns = 'http://www.w3.org/2000/xmlns';\n\n\tvar namespaces = { html: html, mathml: mathml, svg: svg$1, xlink: xlink, xml: xml, xmlns: xmlns };\n\n\tvar createElement;\n\tvar matches;\n\tvar div;\n\tvar methodNames;\n\tvar unprefixed;\n\tvar prefixed;\n\tvar i;\n\tvar j;\n\tvar makeFunction;\n\t// Test for SVG support\n\tif ( !svg ) {\n\t\tcreateElement = function ( type, ns, extend ) {\n\t\t\tif ( ns && ns !== html ) {\n\t\t\t\tthrow 'This browser does not support namespaces other than http://www.w3.org/1999/xhtml. The most likely cause of this error is that you\\'re trying to render SVG in an older browser. See http://docs.ractivejs.org/latest/svg-and-older-browsers for more information';\n\t\t\t}\n\n\t\t\treturn extend ?\n\t\t\t\tdoc.createElement( type, extend ) :\n\t\t\t\tdoc.createElement( type );\n\t\t};\n\t} else {\n\t\tcreateElement = function ( type, ns, extend ) {\n\t\t\tif ( !ns || ns === html ) {\n\t\t\t\treturn extend ?\n\t\t\t\t\tdoc.createElement( type, extend ) :\n\t\t\t\t\tdoc.createElement( type );\n\t\t\t}\n\n\t\t\treturn extend ?\n\t\t\t\tdoc.createElementNS( ns, type, extend ) :\n\t\t\t\tdoc.createElementNS( ns, type );\n\t\t};\n\t}\n\n\tfunction createDocumentFragment () {\n\t\treturn doc.createDocumentFragment();\n\t}\n\n\tfunction getElement ( input ) {\n\t\tvar output;\n\n\t\tif ( !input || typeof input === 'boolean' ) { return; }\n\n\t\tif ( !win || !doc || !input ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// We already have a DOM node - no work to do. (Duck typing alert!)\n\t\tif ( input.nodeType ) {\n\t\t\treturn input;\n\t\t}\n\n\t\t// Get node from string\n\t\tif ( typeof input === 'string' ) {\n\t\t\t// try ID first\n\t\t\toutput = doc.getElementById( input );\n\n\t\t\t// then as selector, if possible\n\t\t\tif ( !output && doc.querySelector ) {\n\t\t\t\toutput = doc.querySelector( input );\n\t\t\t}\n\n\t\t\t// did it work?\n\t\t\tif ( output && output.nodeType ) {\n\t\t\t\treturn output;\n\t\t\t}\n\t\t}\n\n\t\t// If we've been given a collection (jQuery, Zepto etc), extract the first item\n\t\tif ( input[0] && input[0].nodeType ) {\n\t\t\treturn input[0];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif ( !isClient ) {\n\t\tmatches = null;\n\t} else {\n\t\tdiv = createElement( 'div' );\n\t\tmethodNames = [ 'matches', 'matchesSelector' ];\n\n\t\tmakeFunction = function ( methodName ) {\n\t\t\treturn function ( node, selector ) {\n\t\t\t\treturn node[ methodName ]( selector );\n\t\t\t};\n\t\t};\n\n\t\ti = methodNames.length;\n\n\t\twhile ( i-- && !matches ) {\n\t\t\tunprefixed = methodNames[i];\n\n\t\t\tif ( div[ unprefixed ] ) {\n\t\t\t\tmatches = makeFunction( unprefixed );\n\t\t\t} else {\n\t\t\t\tj = vendors.length;\n\t\t\t\twhile ( j-- ) {\n\t\t\t\t\tprefixed = vendors[i] + unprefixed.substr( 0, 1 ).toUpperCase() + unprefixed.substring( 1 );\n\n\t\t\t\t\tif ( div[ prefixed ] ) {\n\t\t\t\t\t\tmatches = makeFunction( prefixed );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// IE8...\n\t\tif ( !matches ) {\n\t\t\tmatches = function ( node, selector ) {\n\t\t\t\tvar nodes, parentNode, i;\n\n\t\t\t\tparentNode = node.parentNode;\n\n\t\t\t\tif ( !parentNode ) {\n\t\t\t\t\t// empty dummy
\n\t\t\t\t\tdiv.innerHTML = '';\n\n\t\t\t\t\tparentNode = div;\n\t\t\t\t\tnode = node.cloneNode();\n\n\t\t\t\t\tdiv.appendChild( node );\n\t\t\t\t}\n\n\t\t\t\tnodes = parentNode.querySelectorAll( selector );\n\n\t\t\t\ti = nodes.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( nodes[i] === node ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}\n\t}\n\n\tfunction detachNode ( node ) {\n\t\tif ( node && typeof node.parentNode !== 'unknown' && node.parentNode ) {\n\t\t\tnode.parentNode.removeChild( node );\n\t\t}\n\n\t\treturn node;\n\t}\n\n\tfunction safeToStringValue ( value ) {\n\t\treturn ( value == null || !value.toString ) ? '' : '' + value;\n\t}\n\n\tfunction safeAttributeString ( string ) {\n\t\treturn safeToStringValue( string )\n\t\t\t.replace( /&/g, '&' )\n\t\t\t.replace( /\"/g, '"' )\n\t\t\t.replace( /'/g, ''' );\n\t}\n\n\tvar decamel = /[A-Z]/g;\n\tfunction decamelize ( string ) {\n\t\treturn string.replace( decamel, function ( s ) { return (\"-\" + (s.toLowerCase())); } );\n\t}\n\n\tvar create;\n\tvar defineProperty;\n\tvar defineProperties;\n\ttry {\n\t\tObject.defineProperty({}, 'test', { get: function() {}, set: function() {} });\n\n\t\tif ( doc ) {\n\t\t\tObject.defineProperty( createElement( 'div' ), 'test', { value: 0 });\n\t\t}\n\n\t\tdefineProperty = Object.defineProperty;\n\t} catch ( err ) {\n\t\t// Object.defineProperty doesn't exist, or we're in IE8 where you can\n\t\t// only use it with DOM objects (what were you smoking, MSFT?)\n\t\tdefineProperty = function ( obj, prop, desc ) {\n\t\t\tif ( desc.get ) obj[ prop ] = desc.get();\n\t\t\telse obj[ prop ] = desc.value;\n\t\t};\n\t}\n\n\ttry {\n\t\ttry {\n\t\t\tObject.defineProperties({}, { test: { value: 0 } });\n\t\t} catch ( err ) {\n\t\t\t// TODO how do we account for this? noMagic = true;\n\t\t\tthrow err;\n\t\t}\n\n\t\tif ( doc ) {\n\t\t\tObject.defineProperties( createElement( 'div' ), { test: { value: 0 } });\n\t\t}\n\n\t\tdefineProperties = Object.defineProperties;\n\t} catch ( err ) {\n\t\tdefineProperties = function ( obj, props ) {\n\t\t\tvar prop;\n\n\t\t\tfor ( prop in props ) {\n\t\t\t\tif ( props.hasOwnProperty( prop ) ) {\n\t\t\t\t\tdefineProperty( obj, prop, props[ prop ] );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\ttry {\n\t\tObject.create( null );\n\n\t\tcreate = Object.create;\n\t} catch ( err ) {\n\t\t// sigh\n\t\tcreate = (function () {\n\t\t\tvar F = function () {};\n\n\t\t\treturn function ( proto, props ) {\n\t\t\t\tvar obj;\n\n\t\t\t\tif ( proto === null ) {\n\t\t\t\t\treturn {};\n\t\t\t\t}\n\n\t\t\t\tF.prototype = proto;\n\t\t\t\tobj = new F();\n\n\t\t\t\tif ( props ) {\n\t\t\t\t\tObject.defineProperties( obj, props );\n\t\t\t\t}\n\n\t\t\t\treturn obj;\n\t\t\t};\n\t\t}());\n\t}\n\n\tfunction extendObj ( target ) {\n\t\tvar sources = [], len = arguments.length - 1;\n\t\twhile ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];\n\n\t\tvar prop;\n\n\t\tsources.forEach( function ( source ) {\n\t\t\tfor ( prop in source ) {\n\t\t\t\tif ( hasOwn.call( source, prop ) ) {\n\t\t\t\t\ttarget[ prop ] = source[ prop ];\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn target;\n\t}\n\n\tfunction fillGaps ( target ) {\n\t\tvar sources = [], len = arguments.length - 1;\n\t\twhile ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];\n\n\t\tsources.forEach( function ( s ) {\n\t\t\tfor ( var key in s ) {\n\t\t\t\tif ( hasOwn.call( s, key ) && !( key in target ) ) {\n\t\t\t\t\ttarget[ key ] = s[ key ];\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn target;\n\t}\n\n\tvar hasOwn = Object.prototype.hasOwnProperty;\n\n\tvar toString = Object.prototype.toString;\n\t// thanks, http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/\n\tfunction isArray ( thing ) {\n\t\treturn toString.call( thing ) === '[object Array]';\n\t}\n\n\tfunction isEqual ( a, b ) {\n\t\tif ( a === null && b === null ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( typeof a === 'object' || typeof b === 'object' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn a === b;\n\t}\n\n\t// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric\n\tfunction isNumeric ( thing ) {\n\t\treturn !isNaN( parseFloat( thing ) ) && isFinite( thing );\n\t}\n\n\tfunction isObject ( thing ) {\n\t\treturn ( thing && toString.call( thing ) === '[object Object]' );\n\t}\n\n\tfunction noop () {}\n\n\tvar alreadyWarned = {};\n\tvar log;\n\tvar printWarning;\n\tvar welcome;\n\tif ( hasConsole ) {\n\t\tvar welcomeIntro = [\n\t\t\t(\"%cRactive.js %c0.8.12 %cin debug mode, %cmore...\"),\n\t\t\t'color: rgb(114, 157, 52); font-weight: normal;',\n\t\t\t'color: rgb(85, 85, 85); font-weight: normal;',\n\t\t\t'color: rgb(85, 85, 85); font-weight: normal;',\n\t\t\t'color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;'\n\t\t];\n\t\tvar welcomeMessage = \"You're running Ractive 0.8.12 in debug mode - messages will be printed to the console to help you fix problems and optimise your application.\\n\\nTo disable debug mode, add this line at the start of your app:\\n Ractive.DEBUG = false;\\n\\nTo disable debug mode when your app is minified, add this snippet:\\n Ractive.DEBUG = /unminified/.test(function(){/*unminified*/});\\n\\nGet help and support:\\n http://docs.ractivejs.org\\n http://stackoverflow.com/questions/tagged/ractivejs\\n http://groups.google.com/forum/#!forum/ractive-js\\n http://twitter.com/ractivejs\\n\\nFound a bug? Raise an issue:\\n https://github.com/ractivejs/ractive/issues\\n\\n\";\n\n\t\twelcome = function () {\n\t\t\tif ( Ractive.WELCOME_MESSAGE === false ) {\n\t\t\t\twelcome = noop;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar message = 'WELCOME_MESSAGE' in Ractive ? Ractive.WELCOME_MESSAGE : welcomeMessage;\n\t\t\tvar hasGroup = !!console.groupCollapsed;\n\t\t\tif ( hasGroup ) console.groupCollapsed.apply( console, welcomeIntro );\n\t\t\tconsole.log( message );\n\t\t\tif ( hasGroup ) {\n\t\t\t\tconsole.groupEnd( welcomeIntro );\n\t\t\t}\n\n\t\t\twelcome = noop;\n\t\t};\n\n\t\tprintWarning = function ( message, args ) {\n\t\t\twelcome();\n\n\t\t\t// extract information about the instance this message pertains to, if applicable\n\t\t\tif ( typeof args[ args.length - 1 ] === 'object' ) {\n\t\t\t\tvar options = args.pop();\n\t\t\t\tvar ractive = options ? options.ractive : null;\n\n\t\t\t\tif ( ractive ) {\n\t\t\t\t\t// if this is an instance of a component that we know the name of, add\n\t\t\t\t\t// it to the message\n\t\t\t\t\tvar name;\n\t\t\t\t\tif ( ractive.component && ( name = ractive.component.name ) ) {\n\t\t\t\t\t\tmessage = \"<\" + name + \"> \" + message;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar node;\n\t\t\t\t\tif ( node = ( options.node || ( ractive.fragment && ractive.fragment.rendered && ractive.find( '*' ) ) ) ) {\n\t\t\t\t\t\targs.push( node );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.warn.apply( console, [ '%cRactive.js: %c' + message, 'color: rgb(114, 157, 52);', 'color: rgb(85, 85, 85);' ].concat( args ) );\n\t\t};\n\n\t\tlog = function () {\n\t\t\tconsole.log.apply( console, arguments );\n\t\t};\n\t} else {\n\t\tprintWarning = log = welcome = noop;\n\t}\n\n\tfunction format ( message, args ) {\n\t\treturn message.replace( /%s/g, function () { return args.shift(); } );\n\t}\n\n\tfunction fatal ( message ) {\n\t\tvar args = [], len = arguments.length - 1;\n\t\twhile ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];\n\n\t\tmessage = format( message, args );\n\t\tthrow new Error( message );\n\t}\n\n\tfunction logIfDebug () {\n\t\tif ( Ractive.DEBUG ) {\n\t\t\tlog.apply( null, arguments );\n\t\t}\n\t}\n\n\tfunction warn ( message ) {\n\t\tvar args = [], len = arguments.length - 1;\n\t\twhile ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];\n\n\t\tmessage = format( message, args );\n\t\tprintWarning( message, args );\n\t}\n\n\tfunction warnOnce ( message ) {\n\t\tvar args = [], len = arguments.length - 1;\n\t\twhile ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];\n\n\t\tmessage = format( message, args );\n\n\t\tif ( alreadyWarned[ message ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\talreadyWarned[ message ] = true;\n\t\tprintWarning( message, args );\n\t}\n\n\tfunction warnIfDebug () {\n\t\tif ( Ractive.DEBUG ) {\n\t\t\twarn.apply( null, arguments );\n\t\t}\n\t}\n\n\tfunction warnOnceIfDebug () {\n\t\tif ( Ractive.DEBUG ) {\n\t\t\twarnOnce.apply( null, arguments );\n\t\t}\n\t}\n\n\t// Error messages that are used (or could be) in multiple places\n\tvar badArguments = 'Bad arguments';\n\tvar noRegistryFunctionReturn = 'A function was specified for \"%s\" %s, but no %s was returned';\n\tvar missingPlugin = function ( name, type ) { return (\"Missing \\\"\" + name + \"\\\" \" + type + \" plugin. You may need to download a plugin via http://docs.ractivejs.org/latest/plugins#\" + type + \"s\"); };\n\n\tfunction findInViewHierarchy ( registryName, ractive, name ) {\n\t\tvar instance = findInstance( registryName, ractive, name );\n\t\treturn instance ? instance[ registryName ][ name ] : null;\n\t}\n\n\tfunction findInstance ( registryName, ractive, name ) {\n\t\twhile ( ractive ) {\n\t\t\tif ( name in ractive[ registryName ] ) {\n\t\t\t\treturn ractive;\n\t\t\t}\n\n\t\t\tif ( ractive.isolated ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tractive = ractive.parent;\n\t\t}\n\t}\n\n\tfunction interpolate ( from, to, ractive, type ) {\n\t\tif ( from === to ) return null;\n\n\t\tif ( type ) {\n\t\t\tvar interpol = findInViewHierarchy( 'interpolators', ractive, type );\n\t\t\tif ( interpol ) return interpol( from, to ) || null;\n\n\t\t\tfatal( missingPlugin( type, 'interpolator' ) );\n\t\t}\n\n\t\treturn interpolators.number( from, to ) ||\n\t\t interpolators.array( from, to ) ||\n\t\t interpolators.object( from, to ) ||\n\t\t null;\n\t}\n\n\tfunction snap ( to ) {\n\t\treturn function () { return to; };\n\t}\n\n\tvar interpolators = {\n\t\tnumber: function ( from, to ) {\n\t\t\tvar delta;\n\n\t\t\tif ( !isNumeric( from ) || !isNumeric( to ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tfrom = +from;\n\t\t\tto = +to;\n\n\t\t\tdelta = to - from;\n\n\t\t\tif ( !delta ) {\n\t\t\t\treturn function () { return from; };\n\t\t\t}\n\n\t\t\treturn function ( t ) {\n\t\t\t\treturn from + ( t * delta );\n\t\t\t};\n\t\t},\n\n\t\tarray: function ( from, to ) {\n\t\t\tvar intermediate, interpolators, len, i;\n\n\t\t\tif ( !isArray( from ) || !isArray( to ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tintermediate = [];\n\t\t\tinterpolators = [];\n\n\t\t\ti = len = Math.min( from.length, to.length );\n\t\t\twhile ( i-- ) {\n\t\t\t\tinterpolators[i] = interpolate( from[i], to[i] );\n\t\t\t}\n\n\t\t\t// surplus values - don't interpolate, but don't exclude them either\n\t\t\tfor ( i=len; i elements caused the binding on the