{"version":3,"file":"ractive.min.js","sources":["../src/view/items/Section.js","../src/view/items/element/specials/Select.js","../src/view/items/element/specials/Textarea.js","../src/view/items/Text.js","../src/config/visibility.js","../src/view/items/element/transitions/prefix.js","../src/view/items/element/transitions/createTransitions.js","../src/view/items/element/transitions/hyphenate.js","../src/view/items/element/Transition.js","../src/view/items/triple/insertHtml.js","../src/view/items/Triple.js","../src/view/items/createItem.js","../src/view/Fragment.js","../src/events/HookQueue.js","../src/Ractive/initialise.js","../src/Ractive/render.js","../src/Ractive/prototype/reset.js","../src/Ractive/prototype/resetPartial.js","../src/Ractive/prototype/reverse.js","../src/Ractive/prototype/shift.js","../src/Ractive/prototype/sort.js","../src/Ractive/prototype/splice.js","../src/Ractive/prototype/unrender.js","../src/Ractive/prototype/unshift.js","../src/Ractive/prototype.js","../src/extend/_extend.js","../src/Ractive.js","../src/view/items/element/binding/CheckboxNameBinding.js","../src/view/items/element/binding/ContentEditableBinding.js","../src/view/items/element/binding/GenericBinding.js","../src/view/items/element/binding/FileBinding.js","../src/view/items/element/binding/MultipleSelectBinding.js","../src/view/items/element/binding/NumericBinding.js","../src/view/items/element/binding/RadioBinding.js","../src/view/items/element/binding/RadioNameBinding.js","../src/view/items/element/binding/SingleSelectBinding.js","../src/view/items/Element.js","../src/view/items/element/specials/Form.js","../src/view/items/element/ElementEvents.js","../src/view/items/component/RactiveEvent.js","../src/view/items/shared/EventDirective.js","../src/view/items/shared/Mustache.js","../src/view/items/Interpolator.js","../src/view/items/element/specials/Input.js","../src/utils/parseJSON.js","../src/view/items/component/Mapping.js","../src/view/items/element/specials/Option.js","../src/view/items/Partial.js","../src/view/RepeatedFragment.js","../src/Ractive/config/runtime-parser.js","../src/shared/getFunction.js","../src/Ractive/config/custom/template.js","../src/Ractive/config/registries.js","../src/Ractive/config/config.js","../src/view/items/shared/Item.js","../src/model/ComputationChild.js","../src/model/Computation.js","../src/view/resolvers/ExpressionProxy.js","../src/view/resolvers/ReferenceExpressionProxy.js","../src/view/items/Alias.js","../src/utils/hyphenateCamel.js","../src/view/helpers/specialAttrs.js","../src/view/items/element/attribute/getUpdateDelegate.js","../src/view/items/element/attribute/propertyNames.js","../src/view/items/element/ConditionalAttribute.js","../src/view/items/element/Attribute.js","../src/view/items/element/BindingFlag.js","../src/view/items/Comment.js","../src/Ractive/prototype/teardown.js","../src/model/specials/RactiveModel.js","../src/model/RootModel.js","../src/Ractive/construct.js","../src/view/items/Component.js","../src/view/items/element/Decorator.js","../src/view/items/Doctype.js","../src/view/items/element/binding/Binding.js","../src/view/items/element/binding/CheckboxBinding.js","../src/view/items/element/binding/getBindingGroup.js","../src/shared/Ticker.js","../src/model/helpers/getPrefixer.js","../src/model/Model.js","../src/model/specials/SharedModel.js","../src/view/resolvers/resolveReference.js","../src/shared/getRactiveContext.js","../src/shared/set.js","../src/Ractive/prototype/shared/add.js","../src/Ractive/prototype/animate.js","../src/events/fireEvent.js","../src/events/Hook.js","../src/Ractive/prototype/attachChild.js","../src/Ractive/prototype/detach.js","../src/Ractive/prototype/detachChild.js","../src/config/types.js","../src/Ractive/prototype/shared/makeArrayMethod.js","../src/Ractive/prototype/update.js","../src/shared/Context.js","../src/Ractive/static/getContext.js","../src/utils/dom.js","../src/config/namespaces.js","../src/Ractive/prototype/insert.js","../src/Ractive/prototype/observe/Observer.js","../src/Ractive/prototype/observe/Pattern.js","../src/Ractive/prototype/observe/Array.js","../src/Ractive/prototype/observeOnce.js","../src/Ractive/prototype/shared/trim.js","../src/Ractive/prototype/shared/notEmptyString.js","../src/Ractive/prototype/pop.js","../src/Ractive/prototype/push.js","../src/global/css.js","../src/Ractive/config/custom/adapt.js","../src/utils/cleanCss.js","../src/Ractive/config/custom/css/transform.js","../src/model/specials/CSSModel.js","../src/Ractive/config/custom/css/css.js","../src/Ractive/config/custom/data.js","../src/config/template.js","../src/parse/utils/createFunction.js","../src/parse/Parser.js","../src/parse/converters/mustache/readDelimiterChange.js","../src/parse/converters/expressions/readTypeof.js","../src/parse/converters/expressions/primary/literal/readRegexpLiteral.js","../src/utils/escapeRegExp.js","../src/parse/converters/utils/getLowestIndex.js","../src/utils/html.js","../src/parse/converters/expressions/shared/errors.js","../src/parse/converters/expressions/primary/literal/readNumberLiteral.js","../src/parse/converters/expressions/primary/literal/stringLiteral/makeQuotedStringMatcher.js","../src/parse/converters/expressions/primary/literal/readStringLiteral.js","../src/parse/converters/expressions/primary/literal/readTemplateStringLiteral.js","../src/parse/converters/expressions/shared/patterns.js","../src/parse/converters/expressions/shared/readKey.js","../src/parse/converters/expressions/primary/literal/readObjectLiteral.js","../src/parse/converters/expressions/primary/literal/readArrayLiteral.js","../src/parse/converters/expressions/primary/readReference.js","../src/parse/converters/expressions/readPrimary.js","../src/parse/converters/expressions/readMemberOrInvocation.js","../src/parse/converters/expressions/readLogicalOr.js","../src/parse/converters/element/readAttribute.js","../src/parse/converters/readMustache.js","../src/parse/converters/mustache/readAliases.js","../src/parse/converters/mustache/section/readElse.js","../src/parse/converters/mustache/section/readElseIf.js","../src/parse/converters/mustache/handlebarsBlockCodes.js","../src/parse/converters/mustache/readSection.js","../src/parse/converters/readHtmlComment.js","../src/parse/utils/stripStandalones.js","../src/parse/utils/trimWhitespace.js","../src/parse/utils/cleanup.js","../src/parse/converters/element/readClosingTag.js","../src/parse/converters/readElement.js","../src/parse/converters/readPartialDefinitionSection.js","../src/Ractive/shared.js","../src/parse/_parse.js","../src/view/items/shared/progressiveText.js","../src/view/items/partial/getPartialTemplate.js","../src/view/items/component/getComponentConstructor.js","../src/view/items/asyncProxy.js","../src/view/helpers/processItems.js","../src/Ractive/prototype/render.js","../src/Ractive/prototype/resetTemplate.js","../src/Ractive/prototype/set.js","../src/Ractive/prototype/subtract.js","../src/Ractive/prototype/toggle.js","../src/Ractive/prototype/toCSS.js","../src/Ractive/prototype/toHTML.js","../src/Ractive/prototype/toText.js","../src/Ractive/prototype/transition.js","../src/Ractive/prototype/unlink.js","../src/Ractive/prototype/updateModel.js","../src/Ractive/static/isInstance.js","../src/Ractive/static/styleGet.js","../src/Ractive/static/sharedSet.js","../src/Ractive/static/sharedGet.js","../src/extend/_macro.js","../src/Ractive/static/keypaths.js","../src/Ractive/static/findPlugin.js","../src/polyfills/Object.assign.js","../src/utils/object.js","../src/utils/is.js","../src/polyfills/performance.now.js","../src/polyfills/array.find.js","../src/polyfills/node.contains.js","../src/polyfills/Promise.js","../src/polyfills/requestAnimationFrame.js","../src/Ractive/config/defaults.js","../src/utils/log.js","../src/Ractive/static/easing.js","../src/config/environment.js","../src/utils/noop.js","../src/config/errors.js","../src/global/capture.js","../src/Ractive/static/interpolators.js","../src/shared/keypaths.js","../src/model/specials/KeyModel.js","../src/model/specials/KeypathModel.js","../src/utils/bind.js","../src/model/ModelBase.js","../src/model/LinkModel.js","../src/global/TransitionManager.js","../src/global/runloop.js","../src/parse/converters/expressions/readConditional.js","../src/parse/converters/readExpression.js","../src/parse/converters/expressions/shared/readExpressionList.js","../src/parse/converters/readExpressionOrReference.js","../src/parse/utils/flattenExpression.js","../src/parse/utils/refineExpression.js","../src/parse/converters/mustache/readTriple.js","../src/parse/converters/mustache/readUnescaped.js","../src/parse/converters/mustache/readPartial.js","../src/parse/converters/mustache/readMustacheComment.js","../src/parse/converters/mustache/readInterpolator.js","../src/parse/converters/mustache/section/readClosing.js","../src/parse/converters/readText.js","../src/parse/converters/readTemplate.js","../src/parse/utils/insertExpressions.js","../src/Ractive/config/wrapPrototypeMethod.js","../src/Ractive/config/deprecate.js","../src/view/resolvers/resolve.js","../src/Ractive/helpers/getComputationSignature.js","../src/Ractive/helpers/subscribe.js","../src/view/items/shared/directiveArgs.js","../src/view/items/element/binding/handleDomEvent.js","../src/utils/getSelectedOptions.js","../src/view/items/element/binding/selectBinding.js","../src/shared/registry.js","../src/shared/interpolate.js","../src/utils/array.js","../src/shared/methodCallers.js","../src/shared/rebind.js","../src/Ractive/prototype/add.js","../src/events/eventStack.js","../src/shared/anchors.js","../src/Ractive/prototype/find.js","../src/Ractive/prototype/findAll.js","../src/Ractive/prototype/findAllComponents.js","../src/Ractive/prototype/findComponent.js","../src/Ractive/prototype/findContainer.js","../src/Ractive/prototype/findParent.js","../src/view/items/shared/findElement.js","../src/shared/getNewIndices.js","../src/Ractive/prototype/fire.js","../src/Ractive/prototype/get.js","../src/Ractive/prototype/getContext.js","../src/Ractive/prototype/link.js","../src/Ractive/prototype/observe.js","../src/Ractive/prototype/off.js","../src/Ractive/prototype/on.js","../src/Ractive/prototype/once.js","../src/Ractive/prototype/readLink.js","../src/utils/id.js","../src/Ractive/static/styleSet.js","../src/parse/converters/expressions/primary/literal/readBooleanLiteral.js","../src/parse/converters/expressions/primary/literal/objectLiteral/keyValuePair.js","../src/parse/converters/expressions/primary/literal/objectLiteral/keyValuePairs.js","../src/parse/converters/expressions/primary/readLiteral.js","../src/parse/converters/expressions/primary/readBracketedExpression.js","../src/parse/converters/expressions/shared/readRefinement.js"],"sourcesContent":["import { SECTION_EACH, SECTION_IF, SECTION_IF_WITH, SECTION_UNLESS, SECTION_WITH } from 'config/types';\nimport { createDocumentFragment } from 'utils/dom';\nimport { isArray, isObject, isObjectLike } from 'utils/is';\nimport { keep } from 'shared/set';\nimport runloop from 'src/global/runloop';\nimport Fragment from '../Fragment';\nimport RepeatedFragment from '../RepeatedFragment';\nimport { MustacheContainer } from './shared/Mustache';\nimport { keys } from 'utils/object';\n\nfunction isEmpty ( value ) {\n\treturn !value ||\n\t ( isArray( value ) && value.length === 0 ) ||\n\t\t ( isObject( value ) && keys( value ).length === 0 );\n}\n\nfunction getType ( value, hasIndexRef ) {\n\tif ( hasIndexRef || isArray( value ) ) return SECTION_EACH;\n\tif ( isObjectLike( value ) ) return SECTION_IF_WITH;\n\tif ( value === undefined ) return null;\n\treturn SECTION_IF;\n}\n\nexport default class Section extends MustacheContainer {\n\tconstructor ( options ) {\n\t\tsuper( options );\n\n\t\tthis.sectionType = options.template.n || null;\n\t\tthis.templateSectionType = this.sectionType;\n\t\tthis.subordinate = options.template.l === 1;\n\t\tthis.fragment = null;\n\t}\n\n\tbind () {\n\t\tsuper.bind();\n\n\t\tif ( this.subordinate ) {\n\t\t\tthis.sibling = this.up.items[ this.up.items.indexOf( this ) - 1 ];\n\t\t\tthis.sibling.nextSibling = this;\n\t\t}\n\n\t\t// if we managed to bind, we need to create children\n\t\tif ( this.model ) {\n\t\t\tthis.dirty = true;\n\t\t\tthis.update();\n\t\t} else if ( this.sectionType && this.sectionType === SECTION_UNLESS && ( !this.sibling || !this.sibling.isTruthy() ) ) {\n\t\t\tthis.fragment = new Fragment({\n\t\t\t\towner: this,\n\t\t\t\ttemplate: this.template.f\n\t\t\t}).bind();\n\t\t}\n\t}\n\n\tdetach () {\n\t\tconst frag = this.fragment || this.detached;\n\t\treturn frag ? frag.detach() : super.detach();\n\t}\n\n\tisTruthy () {\n\t\tif ( this.subordinate && this.sibling.isTruthy() ) return true;\n\t\tconst value = !this.model ? undefined : this.model.isRoot ? this.model.value : this.model.get();\n\t\treturn !!value && ( this.templateSectionType === SECTION_IF_WITH || !isEmpty( value ) );\n\t}\n\n\trebind ( next, previous, safe ) {\n\t\tif ( super.rebind( next, previous, safe ) ) {\n\t\t\tif ( this.fragment && this.sectionType !== SECTION_IF && this.sectionType !== SECTION_UNLESS ) {\n\t\t\t\tthis.fragment.rebind( next );\n\t\t\t}\n\t\t}\n\t}\n\n\trender ( target, occupants ) {\n\t\tthis.rendered = true;\n\t\tif ( this.fragment ) this.fragment.render( target, occupants );\n\t}\n\n\tshuffle ( newIndices ) {\n\t\tif ( this.fragment && this.sectionType === SECTION_EACH ) {\n\t\t\tthis.fragment.shuffle( newIndices );\n\t\t}\n\t}\n\n\tunbind () {\n\t\tsuper.unbind();\n\t\tif ( this.fragment ) this.fragment.unbind();\n\t}\n\n\tunrender ( shouldDestroy ) {\n\t\tif ( this.rendered && this.fragment ) this.fragment.unrender( shouldDestroy );\n\t\tthis.rendered = false;\n\t}\n\n\tupdate () {\n\t\tif ( !this.dirty ) return;\n\n\t\tif ( this.fragment && this.sectionType !== SECTION_IF && this.sectionType !== SECTION_UNLESS ) {\n\t\t\tthis.fragment.context = this.model;\n\t\t}\n\n\t\tif ( !this.model && this.sectionType !== SECTION_UNLESS ) return;\n\n\t\tthis.dirty = false;\n\n\t\tconst value = !this.model ? undefined : this.model.isRoot ? this.model.value : this.model.get();\n\t\tconst siblingFalsey = !this.subordinate || !this.sibling.isTruthy();\n\t\tconst lastType = this.sectionType;\n\n\t\t// watch for switching section types\n\t\tif ( this.sectionType === null || this.templateSectionType === null ) this.sectionType = getType( value, this.template.i );\n\t\tif ( lastType && lastType !== this.sectionType && this.fragment ) {\n\t\t\tif ( this.rendered ) {\n\t\t\t\tthis.fragment.unbind().unrender( true );\n\t\t\t}\n\n\t\t\tthis.fragment = null;\n\t\t}\n\n\t\tlet newFragment;\n\n\t\tconst fragmentShouldExist = this.sectionType === SECTION_EACH || // each always gets a fragment, which may have no iterations\n\t\t this.sectionType === SECTION_WITH || // with (partial context) always gets a fragment\n\t\t ( siblingFalsey && ( this.sectionType === SECTION_UNLESS ? !this.isTruthy() : this.isTruthy() ) ); // if, unless, and if-with depend on siblings and the condition\n\n\t\tif ( fragmentShouldExist ) {\n\t\t\tif ( !this.fragment ) this.fragment = this.detached;\n\n\t\t\tif ( this.fragment ) {\n\t\t\t\t// check for detached fragment\n\t\t\t\tif ( this.detached ) {\n\t\t\t\t\tattach( this, this.fragment );\n\t\t\t\t\tthis.detached = false;\n\t\t\t\t\tthis.rendered = true;\n\t\t\t\t}\n\n\t\t\t\tif ( !this.fragment.bound ) this.fragment.bind( this.model );\n\t\t\t\tthis.fragment.update();\n\t\t\t} else {\n\t\t\t\tif ( this.sectionType === SECTION_EACH ) {\n\t\t\t\t\tnewFragment = new RepeatedFragment({\n\t\t\t\t\t\towner: this,\n\t\t\t\t\t\ttemplate: this.template.f,\n\t\t\t\t\t\tindexRef: this.template.i\n\t\t\t\t\t}).bind( this.model );\n\t\t\t\t} else {\n\t\t\t\t\t// only with and if-with provide context - if and unless do not\n\t\t\t\t\tconst context = this.sectionType !== SECTION_IF && this.sectionType !== SECTION_UNLESS ? this.model : null;\n\t\t\t\t\tnewFragment = new Fragment({\n\t\t\t\t\t\towner: this,\n\t\t\t\t\t\ttemplate: this.template.f\n\t\t\t\t\t}).bind( context );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif ( this.fragment && this.rendered ) {\n\t\t\t\tif ( keep !== true ) {\n\t\t\t\t\tthis.fragment.unbind().unrender( true );\n\t\t\t\t} else {\n\t\t\t\t\tthis.unrender( false );\n\t\t\t\t\tthis.detached = this.fragment;\n\t\t\t\t\trunloop.promise().then( () => {\n\t\t\t\t\t\tif ( this.detached ) this.detach();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if ( this.fragment ) {\n\t\t\t\tthis.fragment.unbind();\n\t\t\t}\n\n\t\t\tthis.fragment = null;\n\t\t}\n\n\t\tif ( newFragment ) {\n\t\t\tif ( this.rendered ) {\n\t\t\t\tattach( this, newFragment );\n\t\t\t}\n\n\t\t\tthis.fragment = newFragment;\n\t\t}\n\n\t\tif ( this.nextSibling ) {\n\t\t\tthis.nextSibling.dirty = true;\n\t\t\tthis.nextSibling.update();\n\t\t}\n\t}\n}\n\nfunction attach ( section, fragment ) {\n\tconst anchor = section.up.findNextNode( section );\n\n\tif ( anchor ) {\n\t\tconst docFrag = createDocumentFragment();\n\t\tfragment.render( docFrag );\n\n\t\tanchor.parentNode.insertBefore( docFrag, anchor );\n\t} else {\n\t\tfragment.render( section.up.findParentNode() );\n\t}\n}\n","import { toArray } from 'utils/array';\nimport getSelectedOptions from 'utils/getSelectedOptions';\nimport Element from '../../Element';\nimport { isArray, isFunction } from 'utils/is';\n\nexport default class Select extends Element {\n\tconstructor ( options ) {\n\t\tsuper( options );\n\t\tthis.options = [];\n\t}\n\n\tfoundNode ( node ) {\n\t\tif ( this.binding ) {\n\t\t\tconst selectedOptions = getSelectedOptions( node );\n\n\t\t\tif ( selectedOptions.length > 0 ) {\n\t\t\t\tthis.selectedOptions = selectedOptions;\n\t\t\t}\n\t\t}\n\t}\n\n\trender ( target, occupants ) {\n\t\tsuper.render( target, occupants );\n\t\tthis.sync();\n\n\t\tconst node = this.node;\n\n\t\tlet i = node.options.length;\n\t\twhile ( i-- ) {\n\t\t\tnode.options[i].defaultSelected = node.options[i].selected;\n\t\t}\n\n\t\tthis.rendered = true;\n\t}\n\n\tsync () {\n\t\tconst selectNode = this.node;\n\n\t\tif ( !selectNode ) return;\n\n\t\tconst options = toArray( selectNode.options );\n\n\t\tif ( this.selectedOptions ) {\n\t\t\toptions.forEach( o => {\n\t\t\t\tif ( this.selectedOptions.indexOf( o ) >= 0 ) o.selected = true;\n\t\t\t\telse o.selected = false;\n\t\t\t});\n\t\t\tthis.binding.setFromNode( selectNode );\n\t\t\tdelete this.selectedOptions;\n\t\t\treturn;\n\t\t}\n\n\t\tconst selectValue = this.getAttribute( 'value' );\n\t\tconst isMultiple = this.getAttribute( 'multiple' );\n\t\tconst array = isMultiple && isArray( selectValue );\n\n\t\t// If the ', '' ]\n\t};\n}\n\nexport default function ( html, node ) {\n\tconst nodes = [];\n\n\t// render 0 and false\n\tif ( html == null || html === '' ) return nodes;\n\n\tlet container;\n\tlet wrapper;\n\tlet selectedOption;\n\n\t/* istanbul ignore if */\n\tif ( ieBug && ( wrapper = ieBlacklist[ node.tagName ] ) ) {\n\t\tcontainer = element( 'DIV' );\n\t\tcontainer.innerHTML = wrapper[0] + html + wrapper[1];\n\t\tcontainer = container.querySelector( '.x' );\n\n\t\tif ( container.tagName === 'SELECT' ) {\n\t\t\tselectedOption = container.options[ container.selectedIndex ];\n\t\t}\n\t}\n\n\telse if ( node.namespaceURI === svg ) {\n\t\tcontainer = element( 'DIV' );\n\t\tcontainer.innerHTML = '' + html + '';\n\t\tcontainer = container.querySelector( '.x' );\n\t}\n\n\telse if ( node.tagName === 'TEXTAREA' ) {\n\t\tcontainer = createElement( 'div' );\n\n\t\tif ( typeof container.textContent !== 'undefined' ) {\n\t\t\tcontainer.textContent = html;\n\t\t} else {\n\t\t\tcontainer.innerHTML = html;\n\t\t}\n\t}\n\n\telse {\n\t\tcontainer = element( node.tagName );\n\t\tcontainer.innerHTML = html;\n\n\t\tif ( container.tagName === 'SELECT' ) {\n\t\t\tselectedOption = container.options[ container.selectedIndex ];\n\t\t}\n\t}\n\n\tlet child;\n\twhile ( child = container.firstChild ) {\n\t\tnodes.push( child );\n\t\tcontainer.removeChild( child );\n\t}\n\n\t// This is really annoying. Extracting