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