{"version":3,"file":"backbone.marionette.js","sources":["src/utils/proxy.js","src/utils/extend.js","src/common/normalize-methods.js","src/utils/error.js","src/common/bind-events.js","src/common/bind-requests.js","src/common/get-option.js","src/common/merge-options.js","src/common/monitor-view-events.js","src/common/trigger-method.js","src/mixins/events.js","src/mixins/common.js","src/mixins/destroy.js","src/mixins/radio.js","src/object.js","src/utils/invoke.js","src/mixins/behaviors.js","src/mixins/delegate-entity-events.js","src/mixins/template-render.js","src/utils/get-namespaced-event-name.js","src/config/features.js","src/mixins/triggers.js","src/mixins/ui.js","src/config/dom.js","src/mixins/view.js","src/common/view.js","src/region.js","src/common/build-region.js","src/mixins/regions.js","src/config/renderer.js","src/view.js","src/child-view-container.js","src/collection-view.js","src/behavior.js","src/application.js","src/backbone.marionette.js"],"sourcesContent":["//Internal utility for creating context style global utils\nconst proxy = function(method) {\n return function(context, ...args) {\n return method.apply(context, args);\n };\n};\n\nexport default proxy;\n","// Marionette.extend\n// -----------------\n\nimport Backbone from 'backbone';\n\n// Borrow the Backbone `extend` method so we can use it as needed\nconst extend = Backbone.Model.extend;\n\nexport default extend;\n","import _ from 'underscore';\n\n// Marionette.normalizeMethods\n// ----------------------\n\n// Pass in a mapping of events => functions or function names\n// and return a mapping of events => functions\nconst normalizeMethods = function(hash) {\n if (!hash) { return }\n\n return _.reduce(hash, (normalizedHash, method, name) => {\n if (!_.isFunction(method)) {\n method = this[method];\n }\n if (method) {\n normalizedHash[name] = method;\n }\n return normalizedHash;\n }, {});\n};\n\nexport default normalizeMethods;\n","// Error\n// -----\n\nimport _ from 'underscore';\nimport extend from './extend';\nimport {version} from '../../package.json';\n\nconst errorProps = ['description', 'fileName', 'lineNumber', 'name', 'message', 'number', 'url'];\n\nconst MarionetteError = extend.call(Error, {\n urlRoot: `http://marionettejs.com/docs/v${version}/`,\n\n url: '',\n\n constructor(options) {\n const error = Error.call(this, options.message);\n _.extend(this, _.pick(error, errorProps), _.pick(options, errorProps));\n\n if (Error.captureStackTrace) {\n this.captureStackTrace();\n }\n\n this.url = this.urlRoot + this.url;\n },\n\n captureStackTrace() {\n Error.captureStackTrace(this, MarionetteError);\n },\n\n toString() {\n return `${ this.name }: ${ this.message } See: ${ this.url }`;\n }\n});\n\nexport default MarionetteError;\n","// Bind Entity Events & Unbind Entity Events\n// -----------------------------------------\n//\n// These methods are used to bind/unbind a backbone \"entity\" (e.g. collection/model)\n// to methods on a target object.\n//\n// The first parameter, `target`, must have the Backbone.Events module mixed in.\n//\n// The second parameter is the `entity` (Backbone.Model, Backbone.Collection or\n// any object that has Backbone.Events mixed in) to bind the events from.\n//\n// The third parameter is a hash of { \"event:name\": \"eventHandler\" }\n// configuration. Multiple handlers can be separated by a space. A\n// function can be supplied instead of a string handler name.\n\nimport _ from 'underscore';\nimport normalizeMethods from './normalize-methods';\nimport MarionetteError from '../utils/error';\n\nfunction normalizeBindings(context, bindings) {\n if (!_.isObject(bindings)) {\n throw new MarionetteError({\n message: 'Bindings must be an object.',\n url: 'common.html#bindevents'\n });\n }\n\n return normalizeMethods.call(context, bindings);\n}\n\nfunction bindEvents(entity, bindings) {\n if (!entity || !bindings) { return this; }\n\n this.listenTo(entity, normalizeBindings(this, bindings));\n\n return this;\n}\n\nfunction unbindEvents(entity, bindings) {\n if (!entity) { return this; }\n\n if (!bindings) {\n this.stopListening(entity);\n return this;\n }\n\n this.stopListening(entity, normalizeBindings(this, bindings));\n\n return this;\n}\n\n// Export Public API\nexport {\n bindEvents,\n unbindEvents\n};\n","// Bind/Unbind Radio Requests\n// -----------------------------------------\n//\n// These methods are used to bind/unbind a backbone.radio request\n// to methods on a target object.\n//\n// The first parameter, `target`, will set the context of the reply method\n//\n// The second parameter is the `Radio.channel` to bind the reply to.\n//\n// The third parameter is a hash of { \"request:name\": \"replyHandler\" }\n// configuration. A function can be supplied instead of a string handler name.\n\nimport _ from 'underscore';\nimport normalizeMethods from './normalize-methods';\nimport MarionetteError from '../utils/error';\n\nfunction normalizeBindings(context, bindings) {\n if (!_.isObject(bindings)) {\n throw new MarionetteError({\n message: 'Bindings must be an object.',\n url: 'common.html#bindrequests'\n });\n }\n\n return normalizeMethods.call(context, bindings);\n}\n\nfunction bindRequests(channel, bindings) {\n if (!channel || !bindings) { return this; }\n\n channel.reply(normalizeBindings(this, bindings), this);\n\n return this;\n}\n\nfunction unbindRequests(channel, bindings) {\n if (!channel) { return this; }\n\n if (!bindings) {\n channel.stopReplying(null, null, this);\n return this;\n }\n\n channel.stopReplying(normalizeBindings(this, bindings));\n\n return this;\n}\n\nexport {\n bindRequests,\n unbindRequests\n};\n","// Marionette.getOption\n// --------------------\n\n// Retrieve an object, function or other value from the\n// object or its `options`, with `options` taking precedence.\nconst getOption = function(optionName) {\n if (!optionName) { return; }\n if (this.options && (this.options[optionName] !== undefined)) {\n return this.options[optionName];\n } else {\n return this[optionName];\n }\n};\n\nexport default getOption;\n","import _ from 'underscore';\n\n// Merge `keys` from `options` onto `this`\nconst mergeOptions = function(options, keys) {\n if (!options) { return; }\n\n _.each(keys, (key) => {\n const option = options[key];\n if (option !== undefined) {\n this[key] = option;\n }\n });\n};\n\nexport default mergeOptions;\n","// DOM Refresh\n// -----------\n\nimport _ from 'underscore';\n\n// Trigger method on children unless a pure Backbone.View\nfunction triggerMethodChildren(view, event, shouldTrigger) {\n if (!view._getImmediateChildren) { return; }\n _.each(view._getImmediateChildren(), child => {\n if (!shouldTrigger(child)) { return; }\n child.triggerMethod(event, child);\n });\n}\n\nfunction shouldTriggerAttach(view) {\n return !view._isAttached;\n}\n\nfunction shouldAttach(view) {\n if (!shouldTriggerAttach(view)) { return false; }\n view._isAttached = true;\n return true;\n}\n\nfunction shouldTriggerDetach(view) {\n return view._isAttached;\n}\n\nfunction shouldDetach(view) {\n if (!shouldTriggerDetach(view)) { return false; }\n view._isAttached = false;\n return true;\n}\n\nfunction triggerDOMRefresh(view) {\n if (view._isAttached && view._isRendered) {\n view.triggerMethod('dom:refresh', view);\n }\n}\n\nfunction triggerDOMRemove(view) {\n if (view._isAttached && view._isRendered) {\n view.triggerMethod('dom:remove', view);\n }\n}\n\nfunction handleBeforeAttach() {\n triggerMethodChildren(this, 'before:attach', shouldTriggerAttach);\n}\n\nfunction handleAttach() {\n triggerMethodChildren(this, 'attach', shouldAttach);\n triggerDOMRefresh(this);\n}\n\nfunction handleBeforeDetach() {\n triggerMethodChildren(this, 'before:detach', shouldTriggerDetach);\n triggerDOMRemove(this);\n}\n\nfunction handleDetach() {\n triggerMethodChildren(this, 'detach', shouldDetach);\n}\n\nfunction handleBeforeRender() {\n triggerDOMRemove(this);\n}\n\nfunction handleRender() {\n triggerDOMRefresh(this);\n}\n\n// Monitor a view's state, propagating attach/detach events to children and firing dom:refresh\n// whenever a rendered view is attached or an attached view is rendered.\nfunction monitorViewEvents(view) {\n if (view._areViewEventsMonitored || view.monitorViewEvents === false) { return; }\n\n view._areViewEventsMonitored = true;\n\n view.on({\n 'before:attach': handleBeforeAttach,\n 'attach': handleAttach,\n 'before:detach': handleBeforeDetach,\n 'detach': handleDetach,\n 'before:render': handleBeforeRender,\n 'render': handleRender\n });\n}\n\nexport default monitorViewEvents;\n","// Trigger Method\n// --------------\n\nimport _ from 'underscore';\nimport getOption from './get-option';\n\n// split the event name on the \":\"\nconst splitter = /(^|:)(\\w)/gi;\n\n// Only calc getOnMethodName once\nconst methodCache = {};\n\n// take the event section (\"section1:section2:section3\")\n// and turn it in to uppercase name onSection1Section2Section3\nfunction getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n}\n\nconst getOnMethodName = function(event) {\n if (!methodCache[event]) {\n methodCache[event] = 'on' + event.replace(splitter, getEventName);\n }\n\n return methodCache[event];\n};\n\n// Trigger an event and/or a corresponding method name. Examples:\n//\n// `this.triggerMethod(\"foo\")` will trigger the \"foo\" event and\n// call the \"onFoo\" method.\n//\n// `this.triggerMethod(\"foo:bar\")` will trigger the \"foo:bar\" event and\n// call the \"onFooBar\" method.\nexport default function triggerMethod(event) {\n // get the method name from the event name\n const methodName = getOnMethodName(event);\n const method = getOption.call(this, methodName);\n let result;\n\n // call the onMethodName if it exists\n if (_.isFunction(method)) {\n // pass all args, except the event name\n result = method.apply(this, _.drop(arguments));\n }\n\n // trigger the event\n this.trigger.apply(this, arguments);\n\n return result;\n}\n","import triggerMethod from '../common/trigger-method';\n\nexport default {\n triggerMethod\n}\n","import _ from 'underscore';\nimport Backbone from 'backbone';\n\nimport getOption from '../common/get-option';\nimport mergeOptions from '../common/merge-options';\nimport normalizeMethods from '../common/normalize-methods';\nimport triggerMethod from '../common/trigger-method';\nimport {\n bindEvents,\n unbindEvents\n} from '../common/bind-events';\nimport {\n bindRequests,\n unbindRequests\n} from '../common/bind-requests';\n\nconst CommonMixin = {\n\n // Imports the \"normalizeMethods\" to transform hashes of\n // events=>function references/names to a hash of events=>function references\n normalizeMethods,\n\n _setOptions(options, classOptions) {\n this.options = _.extend({}, _.result(this, 'options'), options);\n this.mergeOptions(options, classOptions);\n },\n\n // A handy way to merge passed-in options onto the instance\n mergeOptions,\n\n // Enable getting options from this or this.options by name.\n getOption,\n\n // Enable binding view's events from another entity.\n bindEvents,\n\n // Enable unbinding view's events from another entity.\n unbindEvents,\n\n // Enable binding view's requests.\n bindRequests,\n\n // Enable unbinding view's requests.\n unbindRequests,\n\n triggerMethod\n};\n\n_.extend(CommonMixin, Backbone.Events);\n\nexport default CommonMixin;\n","export default {\n _isDestroyed: false,\n\n isDestroyed() {\n return this._isDestroyed;\n },\n\n destroy(options) {\n if (this._isDestroyed) { return this; }\n\n this.triggerMethod('before:destroy', this, options);\n this._isDestroyed = true;\n this.triggerMethod('destroy', this, options);\n this.stopListening();\n\n return this;\n }\n};\n","import _ from 'underscore';\nimport Radio from 'backbone.radio';\nimport MarionetteError from '../utils/error';\n\n// MixinOptions\n// - channelName\n// - radioEvents\n// - radioRequests\n\nexport default {\n\n _initRadio() {\n const channelName = _.result(this, 'channelName');\n\n if (!channelName) {\n return;\n }\n\n /* istanbul ignore next */\n if (!Radio) {\n throw new MarionetteError({\n message: 'The dependency \"backbone.radio\" is missing.',\n url: 'backbone.radio.html#marionette-integration'\n });\n }\n\n const channel = this._channel = Radio.channel(channelName);\n\n const radioEvents = _.result(this, 'radioEvents');\n this.bindEvents(channel, radioEvents);\n\n const radioRequests = _.result(this, 'radioRequests');\n this.bindRequests(channel, radioRequests);\n\n this.on('destroy', this._destroyRadio);\n },\n\n _destroyRadio() {\n this._channel.stopReplying(null, null, this);\n },\n\n getChannel() {\n return this._channel;\n }\n};\n","// Object\n// ------\n\nimport _ from 'underscore';\nimport extend from './utils/extend';\nimport CommonMixin from './mixins/common';\nimport DestroyMixin from './mixins/destroy';\nimport RadioMixin from './mixins/radio';\n\nconst ClassOptions = [\n 'channelName',\n 'radioEvents',\n 'radioRequests'\n];\n\n// Object borrows many conventions and utilities from Backbone.\nconst MarionetteObject = function(options) {\n this._setOptions(options, ClassOptions);\n this.cid = _.uniqueId(this.cidPrefix);\n this._initRadio();\n this.initialize.apply(this, arguments);\n};\n\nMarionetteObject.extend = extend;\n\n// Object Methods\n// --------------\n\n_.extend(MarionetteObject.prototype, CommonMixin, DestroyMixin, RadioMixin, {\n cidPrefix: 'mno',\n\n // This is a noop method intended to be overridden\n initialize() {}\n});\n\nexport default MarionetteObject;\n","// Implementation of the invoke method (http://underscorejs.org/#invoke) with support for\n// lodash v3, v4, and underscore.js\nimport _ from 'underscore';\n\nexport default _.invokeMap || _.invoke;\n","import _ from 'underscore';\nimport MarionetteError from '../utils/error';\nimport _invoke from '../utils/invoke';\n\n// MixinOptions\n// - behaviors\n\n// Takes care of getting the behavior class\n// given options and a key.\n// If a user passes in options.behaviorClass\n// default to using that.\n// If a user passes in a Behavior Class directly, use that\n// Otherwise an error is thrown\nfunction getBehaviorClass(options) {\n if (options.behaviorClass) {\n return { BehaviorClass: options.behaviorClass, options };\n }\n\n //treat functions as a Behavior constructor\n if (_.isFunction(options)) {\n return { BehaviorClass: options, options: {} };\n }\n\n throw new MarionetteError({\n message: 'Unable to get behavior class. A Behavior constructor should be passed directly or as behaviorClass property of options',\n url: 'marionette.behavior.html#defining-and-attaching-behaviors'\n });\n}\n\n// Iterate over the behaviors object, for each behavior\n// instantiate it and get its grouped behaviors.\n// This accepts a list of behaviors in either an object or array form\nfunction parseBehaviors(view, behaviors, allBehaviors) {\n return _.reduce(behaviors, (reducedBehaviors, behaviorDefiniton) => {\n const { BehaviorClass, options } = getBehaviorClass(behaviorDefiniton);\n const behavior = new BehaviorClass(options, view);\n reducedBehaviors.push(behavior);\n\n return parseBehaviors(view, _.result(behavior, 'behaviors'), reducedBehaviors);\n }, allBehaviors);\n}\n\nexport default {\n _initBehaviors() {\n this._behaviors = parseBehaviors(this, _.result(this, 'behaviors'), []);\n },\n\n _getBehaviorTriggers() {\n const triggers = _invoke(this._behaviors, '_getTriggers');\n return _.reduce(triggers, function(memo, _triggers) {\n return _.extend(memo, _triggers);\n }, {});\n },\n\n _getBehaviorEvents() {\n const events = _invoke(this._behaviors, '_getEvents');\n return _.reduce(events, function(memo, _events) {\n return _.extend(memo, _events);\n }, {});\n },\n\n // proxy behavior $el to the view's $el.\n _proxyBehaviorViewProperties() {\n _invoke(this._behaviors, 'proxyViewProperties');\n },\n\n // delegate modelEvents and collectionEvents\n _delegateBehaviorEntityEvents() {\n _invoke(this._behaviors, 'delegateEntityEvents');\n },\n\n // undelegate modelEvents and collectionEvents\n _undelegateBehaviorEntityEvents() {\n _invoke(this._behaviors, 'undelegateEntityEvents');\n },\n\n _destroyBehaviors(options) {\n // Call destroy on each behavior after\n // destroying the view.\n // This unbinds event listeners\n // that behaviors have registered for.\n _invoke(this._behaviors, 'destroy', options);\n },\n\n // Remove a behavior\n _removeBehavior(behavior) {\n // Don't worry about the clean up if the view is destroyed\n if (this._isDestroyed) { return; }\n\n // Remove behavior-only triggers and events\n this.undelegate(`.trig${ behavior.cid } .${ behavior.cid }`);\n\n this._behaviors = _.without(this._behaviors, behavior);\n },\n\n _bindBehaviorUIElements() {\n _invoke(this._behaviors, 'bindUIElements');\n },\n\n _unbindBehaviorUIElements() {\n _invoke(this._behaviors, 'unbindUIElements');\n },\n\n _triggerEventOnBehaviors(eventName, view, options) {\n _invoke(this._behaviors, 'triggerMethod', eventName, view, options);\n }\n};\n","import _ from 'underscore';\n\n// MixinOptions\n// - collectionEvents\n// - modelEvents\n\nexport default {\n // Handle `modelEvents`, and `collectionEvents` configuration\n _delegateEntityEvents(model, collection) {\n if (model) {\n this._modelEvents = _.result(this, 'modelEvents');\n this.bindEvents(model, this._modelEvents);\n }\n\n if (collection) {\n this._collectionEvents = _.result(this, 'collectionEvents');\n this.bindEvents(collection, this._collectionEvents);\n }\n },\n\n // Remove any previously delegate entity events\n _undelegateEntityEvents(model, collection) {\n if (this._modelEvents) {\n this.unbindEvents(model, this._modelEvents);\n delete this._modelEvents;\n }\n\n if (this._collectionEvents) {\n this.unbindEvents(collection, this._collectionEvents);\n delete this._collectionEvents;\n }\n },\n\n // Remove cached event handlers\n _deleteEntityEventHandlers() {\n delete this._modelEvents;\n delete this._collectionEvents;\n }\n};\n","import _ from 'underscore';\n\n// MixinOptions\n// - template\n// - templateContext\n\nexport default {\n\n // Internal method to render the template with the serialized data\n // and template context\n _renderTemplate(template) {\n // Add in entity data and template context\n const data = this.mixinTemplateContext(this.serializeData()) || {};\n\n // Render and add to el\n const html = this._renderHtml(template, data);\n if (typeof html !== 'undefined') {\n this.attachElContent(html);\n }\n },\n\n // Get the template for this view instance.\n // You can set a `template` attribute in the view definition\n // or pass a `template: TemplateFunction` parameter in\n // to the constructor options.\n getTemplate() {\n return this.template;\n },\n\n // Mix in template context methods. Looks for a\n // `templateContext` attribute, which can either be an\n // object literal, or a function that returns an object\n // literal. All methods and attributes from this object\n // are copies to the object passed in.\n mixinTemplateContext(serializedData) {\n const templateContext = _.result(this, 'templateContext');\n if (!templateContext) { return serializedData; };\n if (!serializedData) { return templateContext; };\n return _.extend({}, serializedData, templateContext);\n },\n\n // Serialize the view's model *or* collection, if\n // it exists, for the template\n serializeData() {\n // If we have a model, we serialize that\n if (this.model) {\n return this.serializeModel();\n }\n\n // Otherwise, we serialize the collection,\n // making it available under the `items` property\n if (this.collection) {\n return {\n items: this.serializeCollection()\n };\n }\n },\n\n // Prepares the special `model` property of a view\n // for being displayed in the template. Override this if\n // you need a custom transformation for your view's model\n serializeModel() {\n return this.model.attributes;\n },\n\n // Serialize a collection\n serializeCollection() {\n return _.map(this.collection.models, model => model.attributes);\n },\n\n // Renders the data into the template\n _renderHtml(template, data) {\n return template(data);\n },\n\n // Attaches the content of a given view.\n // This method can be overridden to optimize rendering,\n // or to render in a non standard way.\n //\n // For example, using `innerHTML` instead of `$el.html`\n //\n // ```js\n // attachElContent(html) {\n // this.el.innerHTML = html;\n // }\n // ```\n attachElContent(html) {\n this.Dom.setContents(this.el, html, this.$el);\n }\n};\n","// Borrow event splitter from Backbone\nconst delegateEventSplitter = /^(\\S+)\\s*(.*)$/;\n\n// Set event name to be namespaced using a unique index\n// to generate a non colliding event namespace\n// http://api.jquery.com/event.namespace/\nconst getNamespacedEventName = function(eventName, namespace) {\n const match = eventName.match(delegateEventSplitter);\n return `${ match[1] }.${ namespace } ${ match[2] }`;\n};\n\nexport default getNamespacedEventName;\n","// Add Feature flags here\n// e.g. 'class' => false\nconst FEATURES = {\n childViewEventPrefix: false,\n triggersStopPropagation: true,\n triggersPreventDefault: true,\n DEV_MODE: false\n};\n\nfunction isEnabled(name) {\n return !!FEATURES[name];\n}\n\nfunction setEnabled(name, state) {\n return FEATURES[name] = state;\n}\n\nexport {\n FEATURES,\n setEnabled,\n isEnabled\n};\n","import _ from 'underscore';\nimport getNamespacedEventName from '../utils/get-namespaced-event-name';\nimport { isEnabled } from '../config/features';\n\n// Internal method to create an event handler for a given `triggerDef` like\n// 'click:foo'\nfunction buildViewTrigger(view, triggerDef) {\n if (_.isString(triggerDef)) {\n triggerDef = {event: triggerDef};\n }\n\n const eventName = triggerDef.event;\n\n let shouldPreventDefault = !!triggerDef.preventDefault;\n\n if (isEnabled('triggersPreventDefault')) {\n shouldPreventDefault = triggerDef.preventDefault !== false;\n }\n\n let shouldStopPropagation = !!triggerDef.stopPropagation;\n\n if (isEnabled('triggersStopPropagation')) {\n shouldStopPropagation = triggerDef.stopPropagation !== false;\n }\n\n return function(event, ...args) {\n if (shouldPreventDefault) {\n event.preventDefault();\n }\n\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n view.triggerMethod(eventName, view, event, ...args);\n };\n}\n\nexport default {\n\n // Configure `triggers` to forward DOM events to view\n // events. `triggers: {\"click .foo\": \"do:foo\"}`\n _getViewTriggers(view, triggers) {\n // Configure the triggers, prevent default\n // action and stop propagation of DOM events\n return _.reduce(triggers, (events, value, key) => {\n key = getNamespacedEventName(key, `trig${ this.cid }`);\n events[key] = buildViewTrigger(view, value);\n return events;\n }, {});\n }\n\n};\n","import _ from 'underscore';\n// allows for the use of the @ui. syntax within\n// a given key for triggers and events\n// swaps the @ui with the associated selector.\n// Returns a new, non-mutated, parsed events hash.\nconst normalizeUIKeys = function(hash, ui) {\n return _.reduce(hash, (memo, val, key) => {\n const normalizedKey = normalizeUIString(key, ui);\n memo[normalizedKey] = val;\n return memo;\n }, {});\n};\n\nconst uiRegEx = /@ui\\.[a-zA-Z-_$0-9]*/g;\n\n// utility method for parsing @ui. syntax strings\n// into associated selector\nconst normalizeUIString = function(uiString, ui) {\n return uiString.replace(uiRegEx, (r) => {\n return ui[r.slice(4)];\n });\n};\n\n// allows for the use of the @ui. syntax within\n// a given value for regions\n// swaps the @ui with the associated selector\nconst normalizeUIValues = function(hash, ui, property) {\n _.each(hash, (val, key) => {\n if (_.isString(val)) {\n hash[key] = normalizeUIString(val, ui);\n } else if (val) {\n const propertyVal = val[property];\n if (_.isString(propertyVal)) {\n val[property] = normalizeUIString(propertyVal, ui);\n }\n }\n });\n return hash;\n};\n\nexport default {\n\n // normalize the keys of passed hash with the views `ui` selectors.\n // `{\"@ui.foo\": \"bar\"}`\n normalizeUIKeys(hash) {\n const uiBindings = this._getUIBindings();\n return normalizeUIKeys(hash, uiBindings);\n },\n\n // normalize the passed string with the views `ui` selectors.\n // `\"@ui.bar\"`\n normalizeUIString(uiString) {\n const uiBindings = this._getUIBindings();\n return normalizeUIString(uiString, uiBindings);\n },\n\n // normalize the values of passed hash with the views `ui` selectors.\n // `{foo: \"@ui.bar\"}`\n normalizeUIValues(hash, property) {\n const uiBindings = this._getUIBindings();\n return normalizeUIValues(hash, uiBindings, property);\n },\n\n _getUIBindings() {\n const uiBindings = _.result(this, '_uiBindings');\n return uiBindings || _.result(this, 'ui');\n },\n\n // This method binds the elements specified in the \"ui\" hash inside the view's code with\n // the associated jQuery selectors.\n _bindUIElements() {\n if (!this.ui) { return; }\n\n // store the ui hash in _uiBindings so they can be reset later\n // and so re-rendering the view will be able to find the bindings\n if (!this._uiBindings) {\n this._uiBindings = this.ui;\n }\n\n // get the bindings result, as a function or otherwise\n const bindings = _.result(this, '_uiBindings');\n\n // empty the ui so we don't have anything to start with\n this._ui = {};\n\n // bind each of the selectors\n _.each(bindings, (selector, key) => {\n this._ui[key] = this.$(selector);\n });\n\n this.ui = this._ui;\n },\n\n _unbindUIElements() {\n if (!this.ui || !this._uiBindings) { return; }\n\n // delete all of the existing ui bindings\n _.each(this.ui, ($el, name) => {\n delete this.ui[name];\n });\n\n // reset the ui element to the original bindings configuration\n this.ui = this._uiBindings;\n delete this._uiBindings;\n delete this._ui;\n },\n\n _getUI(name) {\n return this._ui[name];\n }\n};\n","// DomApi\n// ---------\nimport _ from 'underscore';\nimport Backbone from 'backbone';\n\n// Performant method for returning the jQuery instance\nfunction getEl(el) {\n return el instanceof Backbone.$ ? el : Backbone.$(el);\n}\n\n// Static setter\nexport function setDomApi(mixin) {\n this.prototype.Dom = _.extend({}, this.prototype.Dom, mixin);\n return this;\n}\n\nexport default {\n\n // Returns a new HTML DOM node instance\n createBuffer() {\n return document.createDocumentFragment();\n },\n\n // Lookup the `selector` string\n // Selector may also be a DOM element\n // Returns an array-like object of nodes\n getEl(selector) {\n return getEl(selector);\n },\n\n // Finds the `selector` string with the el\n // Returns an array-like object of nodes\n findEl(el, selector, _$el = getEl(el)) {\n return _$el.find(selector);\n },\n\n // Returns true if the el contains the node childEl\n hasEl(el, childEl) {\n return el.contains(childEl && childEl.parentNode);\n },\n\n // Detach `el` from the DOM without removing listeners\n detachEl(el, _$el = getEl(el)) {\n _$el.detach();\n },\n\n // Remove `oldEl` from the DOM and put `newEl` in its place\n replaceEl(newEl, oldEl) {\n if (newEl === oldEl) {\n return;\n }\n\n const parent = oldEl.parentNode;\n\n if (!parent) {\n return;\n }\n\n parent.replaceChild(newEl, oldEl);\n },\n\n // Swaps the location of `el1` and `el2` in the DOM\n swapEl(el1, el2) {\n if (el1 === el2) {\n return;\n }\n\n const parent1 = el1.parentNode;\n const parent2 = el2.parentNode;\n\n if (!parent1 || !parent2) {\n return;\n }\n\n const next1 = el1.nextSibling;\n const next2 = el2.nextSibling;\n\n parent1.insertBefore(el2, next1);\n parent2.insertBefore(el1, next2);\n },\n\n // Replace the contents of `el` with the HTML string of `html`\n setContents(el, html, _$el = getEl(el)) {\n _$el.html(html);\n },\n\n // Takes the DOM node `el` and appends the DOM node `contents`\n // to the end of the element's contents.\n appendContents(el, contents, {_$el = getEl(el), _$contents = getEl(contents)} = {}) {\n _$el.append(_$contents);\n },\n\n // Does the el have child nodes\n hasContents(el) {\n return !!el && el.hasChildNodes();\n },\n\n // Remove the inner contents of `el` from the DOM while leaving\n // `el` itself in the DOM.\n detachContents(el, _$el = getEl(el)) {\n _$el.contents().detach();\n }\n};\n","// ViewMixin\n// ---------\n\nimport Backbone from 'backbone';\nimport _ from 'underscore';\nimport BehaviorsMixin from './behaviors';\nimport CommonMixin from './common';\nimport DelegateEntityEventsMixin from './delegate-entity-events';\nimport TemplateRenderMixin from './template-render';\nimport TriggersMixin from './triggers';\nimport UIMixin from './ui';\nimport { isEnabled } from '../config/features';\nimport DomApi from '../config/dom';\n\n// MixinOptions\n// - behaviors\n// - childViewEventPrefix\n// - childViewEvents\n// - childViewTriggers\n// - collectionEvents\n// - modelEvents\n// - triggers\n// - ui\n\n\nconst ViewMixin = {\n Dom: DomApi,\n\n supportsRenderLifecycle: true,\n supportsDestroyLifecycle: true,\n\n _isDestroyed: false,\n\n isDestroyed() {\n return !!this._isDestroyed;\n },\n\n _isRendered: false,\n\n isRendered() {\n return !!this._isRendered;\n },\n\n _isAttached: false,\n\n isAttached() {\n return !!this._isAttached;\n },\n\n // Overriding Backbone.View's `delegateEvents` to handle\n // `events` and `triggers`\n delegateEvents(events) {\n this._proxyBehaviorViewProperties();\n this._buildEventProxies();\n\n const combinedEvents = _.extend({},\n this._getBehaviorEvents(),\n this._getEvents(events),\n this._getBehaviorTriggers(),\n this._getTriggers()\n );\n\n Backbone.View.prototype.delegateEvents.call(this, combinedEvents);\n\n return this;\n },\n\n // Allows Backbone.View events to utilize `@ui.` selectors\n _getEvents(events) {\n if (events) {\n return this.normalizeUIKeys(events);\n }\n\n if (!this.events) { return; }\n\n return this.normalizeUIKeys(_.result(this, 'events'));\n },\n\n // Configure `triggers` to forward DOM events to view\n // events. `triggers: {\"click .foo\": \"do:foo\"}`\n _getTriggers() {\n if (!this.triggers) { return; }\n\n // Allow `triggers` to be configured as a function\n const triggers = this.normalizeUIKeys(_.result(this, 'triggers'));\n\n // Configure the triggers, prevent default\n // action and stop propagation of DOM events\n return this._getViewTriggers(this, triggers);\n },\n\n // Handle `modelEvents`, and `collectionEvents` configuration\n delegateEntityEvents() {\n this._delegateEntityEvents(this.model, this.collection);\n\n // bind each behaviors model and collection events\n this._delegateBehaviorEntityEvents();\n\n return this;\n },\n\n // Handle unbinding `modelEvents`, and `collectionEvents` configuration\n undelegateEntityEvents() {\n this._undelegateEntityEvents(this.model, this.collection);\n\n // unbind each behaviors model and collection events\n this._undelegateBehaviorEntityEvents();\n\n return this;\n },\n\n // Handle destroying the view and its children.\n destroy(options) {\n if (this._isDestroyed) { return this; }\n const shouldTriggerDetach = this._isAttached && !this._disableDetachEvents;\n\n this.triggerMethod('before:destroy', this, options);\n if (shouldTriggerDetach) {\n this.triggerMethod('before:detach', this);\n }\n\n // unbind UI elements\n this.unbindUIElements();\n\n // remove the view from the DOM\n this._removeElement();\n\n if (shouldTriggerDetach) {\n this._isAttached = false;\n this.triggerMethod('detach', this);\n }\n\n // remove children after the remove to prevent extra paints\n this._removeChildren();\n\n this._isDestroyed = true;\n this._isRendered = false;\n\n // Destroy behaviors after _isDestroyed flag\n this._destroyBehaviors(options);\n\n this._deleteEntityEventHandlers();\n\n this.triggerMethod('destroy', this, options);\n this._triggerEventOnBehaviors('destroy', this, options);\n\n this.stopListening();\n\n return this;\n },\n\n // Equates to this.$el.remove\n _removeElement() {\n this.$el.off().removeData();\n this.Dom.detachEl(this.el, this.$el);\n },\n\n // This method binds the elements specified in the \"ui\" hash\n bindUIElements() {\n this._bindUIElements();\n this._bindBehaviorUIElements();\n\n return this;\n },\n\n // This method unbinds the elements specified in the \"ui\" hash\n unbindUIElements() {\n this._unbindUIElements();\n this._unbindBehaviorUIElements();\n\n return this;\n },\n\n getUI(name) {\n return this._getUI(name);\n },\n\n // Cache `childViewEvents` and `childViewTriggers`\n _buildEventProxies() {\n this._childViewEvents = this.normalizeMethods(_.result(this, 'childViewEvents'));\n this._childViewTriggers = _.result(this, 'childViewTriggers');\n this._eventPrefix = this._getEventPrefix();\n },\n\n _getEventPrefix() {\n const defaultPrefix = isEnabled('childViewEventPrefix') ? 'childview' : false;\n const prefix = _.result(this, 'childViewEventPrefix', defaultPrefix);\n\n return (prefix === false) ? prefix : prefix + ':';\n },\n\n _proxyChildViewEvents(view) {\n if (this._childViewEvents || this._childViewTriggers || this._eventPrefix) {\n this.listenTo(view, 'all', this._childViewEventHandler);\n }\n },\n\n _childViewEventHandler(eventName, ...args) {\n const childViewEvents = this._childViewEvents;\n\n // call collectionView childViewEvent if defined\n if (childViewEvents && childViewEvents[eventName]) {\n childViewEvents[eventName].apply(this, args);\n }\n\n // use the parent view's proxyEvent handlers\n const childViewTriggers = this._childViewTriggers;\n\n // Call the event with the proxy name on the parent layout\n if (childViewTriggers && childViewTriggers[eventName]) {\n this.triggerMethod(childViewTriggers[eventName], ...args);\n }\n\n if (this._eventPrefix) {\n this.triggerMethod(this._eventPrefix + eventName, ...args);\n }\n }\n};\n\n_.extend(ViewMixin, BehaviorsMixin, CommonMixin, DelegateEntityEventsMixin, TemplateRenderMixin, TriggersMixin, UIMixin);\n\nexport default ViewMixin;\n","export function renderView(view) {\n if (view._isRendered) {\n return;\n }\n\n if (!view.supportsRenderLifecycle) {\n view.triggerMethod('before:render', view);\n }\n\n view.render();\n view._isRendered = true;\n\n if (!view.supportsRenderLifecycle) {\n view.triggerMethod('render', view);\n }\n}\n\nexport function destroyView(view, disableDetachEvents) {\n if (view.destroy) {\n // Attach flag for public destroy function internal check\n view._disableDetachEvents = disableDetachEvents;\n view.destroy();\n return;\n }\n\n // Destroy for non-Marionette Views\n if (!view.supportsDestroyLifecycle) {\n view.triggerMethod('before:destroy', view);\n }\n\n const shouldTriggerDetach = view._isAttached && !disableDetachEvents;\n\n if (shouldTriggerDetach) {\n view.triggerMethod('before:detach', view);\n }\n\n view.remove();\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n view.triggerMethod('detach', view);\n }\n\n view._isDestroyed = true;\n\n if (!view.supportsDestroyLifecycle) {\n view.triggerMethod('destroy', view);\n }\n}\n","// Region\n// ------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport MarionetteError from './utils/error';\nimport extend from './utils/extend';\nimport monitorViewEvents from './common/monitor-view-events';\nimport { renderView, destroyView } from './common/view';\nimport CommonMixin from './mixins/common';\nimport View from './view';\nimport DomApi, { setDomApi } from './config/dom';\n\nconst classErrorName = 'RegionError';\n\nconst ClassOptions = [\n 'allowMissingEl',\n 'parentEl',\n 'replaceElement'\n];\n\nconst Region = function(options) {\n this._setOptions(options, ClassOptions);\n\n this.cid = _.uniqueId(this.cidPrefix);\n\n // getOption necessary because options.el may be passed as undefined\n this._initEl = this.el = this.getOption('el');\n\n // Handle when this.el is passed in as a $ wrapped element.\n this.el = this.el instanceof Backbone.$ ? this.el[0] : this.el;\n\n if (!this.el) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'An \"el\" must be specified for a region.',\n url: 'marionette.region.html#additional-options'\n });\n }\n\n this.$el = this.getEl(this.el);\n\n this.initialize.apply(this, arguments);\n};\n\nRegion.extend = extend;\nRegion.setDomApi = setDomApi;\n\n// Region Methods\n// --------------\n\n_.extend(Region.prototype, CommonMixin, {\n Dom: DomApi,\n\n cidPrefix: 'mnr',\n replaceElement: false,\n _isReplaced: false,\n _isSwappingView: false,\n\n // This is a noop method intended to be overridden\n initialize() {},\n\n // Displays a view instance inside of the region. If necessary handles calling the `render`\n // method for you. Reads content directly from the `el` attribute.\n show(view, options) {\n if (!this._ensureElement(options)) {\n return;\n }\n\n view = this._getView(view, options);\n\n if (view === this.currentView) { return this; }\n\n this._isSwappingView = !!this.currentView;\n\n this.triggerMethod('before:show', this, view, options);\n\n // Assume an attached view is already in the region for pre-existing DOM\n if (!view._isAttached) {\n this.empty(options);\n }\n\n this._setupChildView(view);\n\n this.currentView = view;\n\n renderView(view);\n\n this._attachView(view, options);\n\n this.triggerMethod('show', this, view, options);\n\n this._isSwappingView = false;\n\n return this;\n },\n\n _setupChildView(view) {\n monitorViewEvents(view);\n\n this._proxyChildViewEvents(view);\n\n // We need to listen for if a view is destroyed in a way other than through the region.\n // If this happens we need to remove the reference to the currentView since once a view\n // has been destroyed we can not reuse it.\n view.on('destroy', this._empty, this);\n },\n\n _proxyChildViewEvents(view) {\n const parentView = this._parentView;\n\n if (!parentView) { return; }\n\n parentView._proxyChildViewEvents(view);\n },\n\n // If the regions parent view is not monitoring its attach/detach events\n _shouldDisableMonitoring() {\n return this._parentView && this._parentView.monitorViewEvents === false;\n },\n\n _attachView(view, options = {}) {\n const shouldTriggerAttach = !view._isAttached && this.Dom.hasEl(document.documentElement, this.el) && !this._shouldDisableMonitoring();\n const shouldReplaceEl = typeof options.replaceElement === 'undefined' ? !!_.result(this, 'replaceElement') : !!options.replaceElement;\n\n if (shouldTriggerAttach) {\n view.triggerMethod('before:attach', view);\n }\n\n if (shouldReplaceEl) {\n this._replaceEl(view);\n } else {\n this.attachHtml(view);\n }\n\n if (shouldTriggerAttach) {\n view._isAttached = true;\n view.triggerMethod('attach', view);\n }\n },\n\n _ensureElement(options = {}) {\n if (!_.isObject(this.el)) {\n this.$el = this.getEl(this.el);\n this.el = this.$el[0];\n // Make sure the $el contains only the el\n this.$el = this.Dom.getEl(this.el);\n }\n\n if (!this.$el || this.$el.length === 0) {\n const allowMissingEl = typeof options.allowMissingEl === 'undefined' ? !!_.result(this, 'allowMissingEl') : !!options.allowMissingEl;\n\n if (allowMissingEl) {\n return false;\n } else {\n throw new MarionetteError({\n name: classErrorName,\n message: `An \"el\" must exist in DOM for this region ${this.cid}`,\n url: 'marionette.region.html#additional-options'\n });\n }\n }\n return true;\n },\n\n _getView(view) {\n if (!view) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'The view passed is undefined and therefore invalid. You must pass a view instance to show.',\n url: 'marionette.region.html#showing-a-view'\n });\n }\n\n if (view._isDestroyed) {\n throw new MarionetteError({\n name: classErrorName,\n message: `View (cid: \"${view.cid}\") has already been destroyed and cannot be used.`,\n url: 'marionette.region.html#showing-a-view'\n });\n }\n\n if (view instanceof Backbone.View) {\n return view;\n }\n\n const viewOptions = this._getViewOptions(view);\n\n return new View(viewOptions);\n },\n\n // This allows for a template or a static string to be\n // used as a template\n _getViewOptions(viewOptions) {\n if (_.isFunction(viewOptions)) {\n return { template: viewOptions };\n }\n\n if (_.isObject(viewOptions)) {\n return viewOptions;\n }\n\n const template = function() { return viewOptions; };\n\n return { template };\n },\n\n // Override this method to change how the region finds the DOM element that it manages. Return\n // a jQuery selector object scoped to a provided parent el or the document if none exists.\n getEl(el) {\n const context = _.result(this, 'parentEl');\n\n if (context && _.isString(el)) {\n return this.Dom.findEl(context, el);\n }\n\n return this.Dom.getEl(el);\n },\n\n _replaceEl(view) {\n // always restore the el to ensure the regions el is present before replacing\n this._restoreEl();\n\n view.on('before:destroy', this._restoreEl, this);\n\n this.Dom.replaceEl(view.el, this.el);\n\n this._isReplaced = true;\n },\n\n // Restore the region's element in the DOM.\n _restoreEl() {\n // There is nothing to replace\n if (!this._isReplaced) {\n return;\n }\n\n const view = this.currentView;\n\n if (!view) {\n return;\n }\n\n this._detachView(view);\n\n this._isReplaced = false;\n },\n\n // Check to see if the region's el was replaced.\n isReplaced() {\n return !!this._isReplaced;\n },\n\n // Check to see if a view is being swapped by another\n isSwappingView() {\n return !!this._isSwappingView;\n },\n\n // Override this method to change how the new view is appended to the `$el` that the\n // region is managing\n attachHtml(view) {\n this.Dom.appendContents(this.el, view.el, {_$el: this.$el, _$contents: view.$el});\n },\n\n // Destroy the current view, if there is one. If there is no current view,\n // it will detach any html inside the region's `el`.\n empty(options = { allowMissingEl: true }) {\n const view = this.currentView;\n\n // If there is no view in the region we should only detach current html\n if (!view) {\n if (this._ensureElement(options)) {\n this.detachHtml();\n }\n return this;\n }\n\n this._empty(view, true);\n return this;\n },\n\n _empty(view, shouldDestroy) {\n view.off('destroy', this._empty, this);\n this.triggerMethod('before:empty', this, view);\n\n this._restoreEl();\n\n delete this.currentView;\n\n if (!view._isDestroyed) {\n if (shouldDestroy) {\n this.removeView(view);\n } else {\n this._detachView(view);\n }\n this._stopChildViewEvents(view);\n }\n\n this.triggerMethod('empty', this, view);\n },\n\n _stopChildViewEvents(view) {\n const parentView = this._parentView;\n\n if (!parentView) { return; }\n\n this._parentView.stopListening(view);\n },\n\n // Non-Marionette safe view.destroy\n destroyView(view) {\n if (view._isDestroyed) {\n return view;\n }\n\n destroyView(view, this._shouldDisableMonitoring());\n return view;\n },\n\n // Override this method to determine what happens when the view\n // is removed from the region when the view is not being detached\n removeView(view) {\n this.destroyView(view);\n },\n\n // Empties the Region without destroying the view\n // Returns the detached view\n detachView() {\n const view = this.currentView;\n\n if (!view) {\n return;\n }\n\n this._empty(view);\n\n return view;\n },\n\n _detachView(view) {\n const shouldTriggerDetach = view._isAttached && !this._shouldDisableMonitoring();\n const shouldRestoreEl = this._isReplaced;\n if (shouldTriggerDetach) {\n view.triggerMethod('before:detach', view);\n }\n\n if (shouldRestoreEl) {\n this.Dom.replaceEl(this.el, view.el);\n } else {\n this.detachHtml();\n }\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n view.triggerMethod('detach', view);\n }\n },\n\n // Override this method to change how the region detaches current content\n detachHtml() {\n this.Dom.detachContents(this.el, this.$el);\n },\n\n // Checks whether a view is currently present within the region. Returns `true` if there is\n // and `false` if no view is present.\n hasView() {\n return !!this.currentView;\n },\n\n // Reset the region by destroying any existing view and clearing out the cached `$el`.\n // The next time a view is shown via this region, the region will re-query the DOM for\n // the region's `el`.\n reset(options) {\n this.empty(options);\n\n if (this.$el) {\n this.el = this._initEl;\n }\n\n delete this.$el;\n return this;\n },\n\n _isDestroyed: false,\n\n isDestroyed() {\n return this._isDestroyed;\n },\n\n // Destroy the region, remove any child view\n // and remove the region from any associated view\n destroy(options) {\n if (this._isDestroyed) { return this; }\n\n this.triggerMethod('before:destroy', this, options);\n this._isDestroyed = true;\n\n this.reset(options);\n\n if (this._name) {\n this._parentView._removeReferences(this._name);\n }\n delete this._parentView;\n delete this._name;\n\n this.triggerMethod('destroy', this, options);\n this.stopListening();\n\n return this;\n }\n});\n\nexport default Region;\n","import _ from 'underscore';\nimport MarionetteError from '../utils/error';\nimport Region from '../region';\n\n// return the region instance from the definition\nexport default function(definition, defaults) {\n if (definition instanceof Region) {\n return definition;\n }\n\n if (_.isString(definition)) {\n return buildRegionFromObject(defaults, { el: definition });\n }\n\n if (_.isFunction(definition)) {\n return buildRegionFromObject(defaults, { regionClass: definition });\n }\n\n if (_.isObject(definition)) {\n return buildRegionFromObject(defaults, definition);\n }\n\n throw new MarionetteError({\n message: 'Improper region configuration type.',\n url: 'marionette.region.html#defining-regions'\n });\n}\n\nfunction buildRegionFromObject(defaults, definition) {\n const options = _.extend({}, defaults, definition);\n\n const RegionClass = options.regionClass\n\n delete options.regionClass;\n\n return new RegionClass(options);\n}\n","import _ from 'underscore';\nimport _invoke from '../utils/invoke';\nimport buildRegion from '../common/build-region';\nimport Region from '../region';\n\n// MixinOptions\n// - regions\n// - regionClass\n\nexport default {\n regionClass: Region,\n\n // Internal method to initialize the regions that have been defined in a\n // `regions` attribute on this View.\n _initRegions() {\n\n // init regions hash\n this.regions = this.regions || {};\n this._regions = {};\n\n this.addRegions(_.result(this, 'regions'));\n },\n\n // Internal method to re-initialize all of the regions by updating\n // the `el` that they point to\n _reInitRegions() {\n _invoke(this._regions, 'reset');\n },\n\n // Add a single region, by name, to the View\n addRegion(name, definition) {\n const regions = {};\n regions[name] = definition;\n return this.addRegions(regions)[name];\n },\n\n // Add multiple regions as a {name: definition, name2: def2} object literal\n addRegions(regions) {\n // If there's nothing to add, stop here.\n if (_.isEmpty(regions)) {\n return;\n }\n\n // Normalize region selectors hash to allow\n // a user to use the @ui. syntax.\n regions = this.normalizeUIValues(regions, 'el');\n\n // Add the regions definitions to the regions property\n this.regions = _.extend({}, this.regions, regions);\n\n return this._addRegions(regions);\n },\n\n // internal method to build and add regions\n _addRegions(regionDefinitions) {\n const defaults = {\n regionClass: this.regionClass,\n parentEl: _.partial(_.result, this, 'el')\n };\n\n return _.reduce(regionDefinitions, (regions, definition, name) => {\n regions[name] = buildRegion(definition, defaults);\n this._addRegion(regions[name], name);\n return regions;\n }, {});\n },\n\n _addRegion(region, name) {\n this.triggerMethod('before:add:region', this, name, region);\n\n region._parentView = this;\n region._name = name;\n\n this._regions[name] = region;\n\n this.triggerMethod('add:region', this, name, region);\n },\n\n // Remove a single region from the View, by name\n removeRegion(name) {\n const region = this._regions[name];\n\n this._removeRegion(region, name);\n\n return region;\n },\n\n // Remove all regions from the View\n removeRegions() {\n const regions = this._getRegions();\n\n _.each(this._regions, this._removeRegion.bind(this));\n\n return regions;\n },\n\n _removeRegion(region, name) {\n this.triggerMethod('before:remove:region', this, name, region);\n\n region.destroy();\n\n this.triggerMethod('remove:region', this, name, region);\n },\n\n // Called in a region's destroy\n _removeReferences(name) {\n delete this.regions[name];\n delete this._regions[name];\n },\n\n // Empty all regions in the region manager, but\n // leave them attached\n emptyRegions() {\n const regions = this.getRegions();\n _invoke(regions, 'empty');\n return regions;\n },\n\n // Checks to see if view contains region\n // Accepts the region name\n // hasRegion('main')\n hasRegion(name) {\n return !!this.getRegion(name);\n },\n\n // Provides access to regions\n // Accepts the region name\n // getRegion('main')\n getRegion(name) {\n if (!this._isRendered) {\n this.render();\n }\n return this._regions[name];\n },\n\n _getRegions() {\n return _.clone(this._regions);\n },\n\n // Get all regions\n getRegions() {\n if (!this._isRendered) {\n this.render();\n }\n return this._getRegions();\n },\n\n showChildView(name, view, options) {\n const region = this.getRegion(name);\n region.show(view, options);\n return view;\n },\n\n detachChildView(name) {\n return this.getRegion(name).detachView();\n },\n\n getChildView(name) {\n return this.getRegion(name).currentView;\n }\n\n};\n","// Static setter for the renderer\nexport function setRenderer(renderer) {\n this.prototype._renderHtml = renderer;\n return this;\n}\n","// View\n// ---------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport monitorViewEvents from './common/monitor-view-events';\nimport ViewMixin from './mixins/view';\nimport RegionsMixin from './mixins/regions';\nimport { setDomApi } from './config/dom';\nimport { setRenderer } from './config/renderer';\n\nconst ClassOptions = [\n 'behaviors',\n 'childViewEventPrefix',\n 'childViewEvents',\n 'childViewTriggers',\n 'collectionEvents',\n 'events',\n 'modelEvents',\n 'regionClass',\n 'regions',\n 'template',\n 'templateContext',\n 'triggers',\n 'ui'\n];\n\n// Used by _getImmediateChildren\nfunction childReducer(children, region) {\n if (region.currentView) {\n children.push(region.currentView);\n }\n\n return children;\n}\n\n// The standard view. Includes view events, automatic rendering\n// templates, nested views, and more.\nconst View = Backbone.View.extend({\n\n constructor(options) {\n this._setOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this._initBehaviors();\n this._initRegions();\n\n Backbone.View.prototype.constructor.apply(this, arguments);\n\n this.delegateEntityEvents();\n\n this._triggerEventOnBehaviors('initialize', this, options);\n },\n\n // Overriding Backbone.View's `setElement` to handle\n // if an el was previously defined. If so, the view might be\n // rendered or attached on setElement.\n setElement() {\n Backbone.View.prototype.setElement.apply(this, arguments);\n\n this._isRendered = this.Dom.hasContents(this.el);\n this._isAttached = this.Dom.hasEl(document.documentElement, this.el);\n\n if (this._isRendered) {\n this.bindUIElements();\n }\n\n return this;\n },\n\n // If a template is available, renders it into the view's `el`\n // Re-inits regions and binds UI.\n render() {\n const template = this.getTemplate();\n\n if (template === false || this._isDestroyed) { return this; }\n\n this.triggerMethod('before:render', this);\n\n // If this is not the first render call, then we need to\n // re-initialize the `el` for each region\n if (this._isRendered) {\n this._reInitRegions();\n }\n\n this._renderTemplate(template);\n this.bindUIElements();\n\n this._isRendered = true;\n this.triggerMethod('render', this);\n\n return this;\n },\n\n // called by ViewMixin destroy\n _removeChildren() {\n this.removeRegions();\n },\n\n _getImmediateChildren() {\n return _.reduce(this._regions, childReducer, []);\n }\n}, {\n setRenderer,\n setDomApi\n});\n\n_.extend(View.prototype, ViewMixin, RegionsMixin);\n\nexport default View;\n","import _ from 'underscore';\n\n// Provide a container to store, retrieve and\n// shut down child views.\nconst Container = function() {\n this._init();\n};\n\n// Mix in methods from Underscore, for iteration, and other\n// collection related features.\n// Borrowing this code from Backbone.Collection:\n// https://github.com/jashkenas/backbone/blob/1.1.2/backbone.js#L962\nconst methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',\n 'select', 'reject', 'every', 'all', 'some', 'any', 'include',\n 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',\n 'last', 'without', 'isEmpty', 'pluck', 'reduce', 'partition'];\n\n_.each(methods, function(method) {\n Container.prototype[method] = function(...args) {\n return _[method].apply(_, [this._views].concat(args));\n };\n});\n\nfunction stringComparator(comparator, view) {\n return view.model && view.model.get(comparator);\n}\n\n// Container Methods\n// -----------------\n\n_.extend(Container.prototype, {\n\n // Initializes an empty container\n _init() {\n this._views = [];\n this._viewsByCid = {};\n this._indexByModel = {};\n this._updateLength();\n },\n\n // Add a view to this container. Stores the view\n // by `cid` and makes it searchable by the model\n // cid (and model itself). Additionally it stores\n // the view by index in the _views array\n _add(view, index = this._views.length) {\n this._addViewIndexes(view);\n\n // add to end by default\n this._views.splice(index, 0, view);\n\n this._updateLength();\n },\n\n _addViewIndexes(view) {\n // store the view\n this._viewsByCid[view.cid] = view;\n\n // index it by model\n if (view.model) {\n this._indexByModel[view.model.cid] = view;\n }\n },\n\n // Sort (mutate) and return the array of the child views.\n _sort(comparator, context) {\n if (typeof comparator === 'string') {\n comparator = _.partial(stringComparator, comparator);\n return this._sortBy(comparator);\n }\n\n if (comparator.length === 1) {\n return this._sortBy(comparator.bind(context));\n }\n\n return this._views.sort(comparator.bind(context));\n },\n\n // Makes `_.sortBy` mutate the array to match `this._views.sort`\n _sortBy(comparator) {\n const sortedViews = _.sortBy(this._views, comparator);\n\n this._set(sortedViews);\n\n return sortedViews;\n },\n\n // Replace array contents without overwriting the reference.\n // Should not add/remove views\n _set(views, shouldReset) {\n this._views.length = 0;\n\n this._views.push.apply(this._views, views.slice(0));\n\n if (shouldReset) {\n this._viewsByCid = {};\n this._indexByModel = {};\n\n _.each(views, this._addViewIndexes.bind(this));\n\n this._updateLength();\n }\n },\n\n // Swap views by index\n _swap(view1, view2) {\n const view1Index = this.findIndexByView(view1);\n const view2Index = this.findIndexByView(view2);\n\n if (view1Index === -1 || view2Index === -1) {\n return;\n }\n\n const swapView = this._views[view1Index];\n this._views[view1Index] = this._views[view2Index];\n this._views[view2Index] = swapView;\n },\n\n // Find a view by the model that was attached to it.\n // Uses the model's `cid` to find it.\n findByModel(model) {\n return this.findByModelCid(model.cid);\n },\n\n // Find a view by the `cid` of the model that was attached to it.\n findByModelCid(modelCid) {\n return this._indexByModel[modelCid];\n },\n\n // Find a view by index.\n findByIndex(index) {\n return this._views[index];\n },\n\n // Find the index of a view instance\n findIndexByView(view) {\n return this._views.indexOf(view);\n },\n\n // Retrieve a view by its `cid` directly\n findByCid(cid) {\n return this._viewsByCid[cid];\n },\n\n hasView(view) {\n return !!this.findByCid(view.cid);\n },\n\n // Remove a view and clean up index references.\n _remove(view) {\n if (!this._viewsByCid[view.cid]) {\n return;\n }\n\n // delete model index\n if (view.model) {\n delete this._indexByModel[view.model.cid];\n }\n\n // remove the view from the container\n delete this._viewsByCid[view.cid];\n\n const index = this.findIndexByView(view);\n this._views.splice(index, 1);\n\n this._updateLength();\n },\n\n // Update the `.length` attribute on this container\n _updateLength() {\n this.length = this._views.length;\n }\n});\n\nexport default Container;\n","// Collection View\n// ---------------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport MarionetteError from './utils/error';\nimport { renderView, destroyView } from './common/view';\nimport monitorViewEvents from './common/monitor-view-events';\nimport ChildViewContainer from './child-view-container';\nimport Region from './region';\nimport ViewMixin from './mixins/view';\nimport { setDomApi } from './config/dom';\nimport { setRenderer } from './config/renderer';\n\nconst classErrorName = 'CollectionViewError';\n\nconst ClassOptions = [\n 'behaviors',\n 'childView',\n 'childViewContainer',\n 'childViewEventPrefix',\n 'childViewEvents',\n 'childViewOptions',\n 'childViewTriggers',\n 'collectionEvents',\n 'emptyView',\n 'emptyViewOptions',\n 'events',\n 'modelEvents',\n 'sortWithCollection',\n 'template',\n 'templateContext',\n 'triggers',\n 'ui',\n 'viewComparator',\n 'viewFilter'\n];\n\n// A view that iterates over a Backbone.Collection\n// and renders an individual child view for each model.\nconst CollectionView = Backbone.View.extend({\n // flag for maintaining the sorted order of the collection\n sortWithCollection: true,\n\n // constructor\n constructor(options) {\n this._setOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this._initChildViewStorage();\n this._initBehaviors();\n\n Backbone.View.prototype.constructor.apply(this, arguments);\n\n // Init empty region\n this.getEmptyRegion();\n\n this.delegateEntityEvents();\n\n this._triggerEventOnBehaviors('initialize', this, options);\n },\n\n // Internal method to set up the `children` object for storing all of the child views\n // `_children` represents all child views\n // `children` represents only views filtered to be shown\n _initChildViewStorage() {\n this._children = new ChildViewContainer();\n this.children = new ChildViewContainer();\n },\n\n // Create an region to show the emptyView\n getEmptyRegion() {\n if (this._emptyRegion && !this._emptyRegion.isDestroyed()) {\n return this._emptyRegion;\n }\n\n this._emptyRegion = new Region({ el: this.el, replaceElement: false });\n\n this._emptyRegion._parentView = this;\n\n return this._emptyRegion;\n },\n\n // Configured the initial events that the collection view binds to.\n _initialEvents() {\n if (this._isRendered) { return; }\n\n this.listenTo(this.collection, {\n 'sort': this._onCollectionSort,\n 'reset': this._onCollectionReset,\n 'update': this._onCollectionUpdate\n });\n },\n\n // Internal method. This checks for any changes in the order of the collection.\n // If the index of any view doesn't match, it will re-sort.\n _onCollectionSort(collection, { add, merge, remove }) {\n if (!this.sortWithCollection || this.viewComparator === false) {\n return;\n }\n\n // If the data is changing we will handle the sort later in `_onCollectionUpdate`\n if (add || remove || merge) {\n return;\n }\n\n // If the only thing happening here is sorting, sort.\n this.sort();\n },\n\n _onCollectionReset() {\n this._destroyChildren();\n\n this._addChildModels(this.collection.models);\n\n this.sort();\n },\n\n // Handle collection update model additions and removals\n _onCollectionUpdate(collection, options) {\n const changes = options.changes;\n\n // Remove first since it'll be a shorter array lookup.\n const removedViews = changes.removed.length && this._removeChildModels(changes.removed);\n\n this._addedViews = changes.added.length && this._addChildModels(changes.added);\n\n this._detachChildren(removedViews);\n\n this.sort();\n\n // Destroy removed child views after all of the render is complete\n this._removeChildViews(removedViews);\n },\n\n _removeChildModels(models) {\n return _.reduce(models, (views, model) => {\n const removeView = this._removeChildModel(model);\n\n if (removeView) { views.push(removeView); }\n\n return views;\n }, []);\n },\n\n _removeChildModel(model) {\n const view = this._children.findByModel(model);\n\n if (view) { this._removeChild(view); }\n\n return view;\n },\n\n _removeChild(view) {\n this.triggerMethod('before:remove:child', this, view);\n\n this.children._remove(view);\n this._children._remove(view);\n\n this.triggerMethod('remove:child', this, view);\n },\n\n // Added views are returned for consistency with _removeChildModels\n _addChildModels(models) {\n return _.map(models, this._addChildModel.bind(this));\n },\n\n _addChildModel(model) {\n const view = this._createChildView(model);\n\n this._addChild(view);\n\n return view;\n },\n\n _createChildView(model) {\n const ChildView = this._getChildView(model);\n const childViewOptions = this._getChildViewOptions(model);\n const view = this.buildChildView(model, ChildView, childViewOptions);\n\n return view;\n },\n\n _addChild(view, index) {\n this.triggerMethod('before:add:child', this, view);\n\n this._setupChildView(view);\n this._children._add(view, index);\n this.children._add(view, index);\n\n this.triggerMethod('add:child', this, view);\n },\n\n // Retrieve the `childView` class\n // The `childView` property can be either a view class or a function that\n // returns a view class. If it is a function, it will receive the model that\n // will be passed to the view instance (created from the returned view class)\n _getChildView(child) {\n let childView = this.childView;\n\n if (!childView) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'A \"childView\" must be specified',\n url: 'marionette.collectionview.html#collectionviews-childview'\n });\n }\n\n childView = this._getView(childView, child);\n\n if (!childView) {\n throw new MarionetteError({\n name: classErrorName,\n message: '\"childView\" must be a view class or a function that returns a view class',\n url: 'marionette.collectionview.html#collectionviews-childview'\n });\n }\n\n return childView;\n },\n\n // First check if the `view` is a view class (the common case)\n // Then check if it's a function (which we assume that returns a view class)\n _getView(view, child) {\n if (view.prototype instanceof Backbone.View || view === Backbone.View) {\n return view;\n } else if (_.isFunction(view)) {\n return view.call(this, child);\n }\n },\n\n _getChildViewOptions(child) {\n if (_.isFunction(this.childViewOptions)) {\n return this.childViewOptions(child);\n }\n\n return this.childViewOptions;\n },\n\n // Build a `childView` for a model in the collection.\n // Override to customize the build\n buildChildView(child, ChildViewClass, childViewOptions) {\n const options = _.extend({model: child}, childViewOptions);\n return new ChildViewClass(options);\n },\n\n _setupChildView(view) {\n monitorViewEvents(view);\n\n // We need to listen for if a view is destroyed in a way other\n // than through the CollectionView.\n // If this happens we need to remove the reference to the view\n // since once a view has been destroyed we can not reuse it.\n view.on('destroy', this.removeChildView, this);\n\n // set up the child view event forwarding\n this._proxyChildViewEvents(view);\n },\n\n // used by ViewMixin's `_childViewEventHandler`\n _getImmediateChildren() {\n return this.children._views;\n },\n\n // Overriding Backbone.View's `setElement` to handle\n // if an el was previously defined. If so, the view might be\n // attached on setElement.\n setElement() {\n Backbone.View.prototype.setElement.apply(this, arguments);\n\n this._isAttached = this.Dom.hasEl(document.documentElement, this.el);\n\n return this;\n },\n\n // Render children views.\n render() {\n if (this._isDestroyed) { return this; }\n this.triggerMethod('before:render', this);\n\n this._destroyChildren();\n\n if (this.collection) {\n this._addChildModels(this.collection.models);\n this._initialEvents();\n }\n\n const template = this.getTemplate();\n\n if (template) {\n this._renderTemplate(template);\n this.bindUIElements();\n }\n this._getChildViewContainer();\n this.sort();\n\n this._isRendered = true;\n\n this.triggerMethod('render', this);\n return this;\n },\n\n // Get a container within the template to add the children within\n _getChildViewContainer() {\n const childViewContainer = _.result(this, 'childViewContainer');\n this.$container = childViewContainer ? this.$(childViewContainer) : this.$el;\n\n if (!this.$container.length) {\n throw new MarionetteError({\n name: classErrorName,\n message: `The specified \"childViewContainer\" was not found: ${childViewContainer}`,\n url: 'marionette.collectionview.html#defining-the-childviewcontainer'\n });\n }\n },\n\n // Sorts the children then filters and renders the results.\n sort() {\n this._sortChildren();\n\n this.filter();\n\n return this;\n },\n\n // Sorts views by viewComparator and sets the children to the new order\n _sortChildren() {\n if (!this._children.length) { return; }\n\n let viewComparator = this.getComparator();\n\n if (!viewComparator) { return; }\n\n // If children are sorted prevent added to end perf\n delete this._addedViews;\n\n this.triggerMethod('before:sort', this);\n\n this._children._sort(viewComparator, this);\n\n this.triggerMethod('sort', this);\n },\n\n // Sets the view's `viewComparator` and applies the sort if the view is ready.\n // To prevent the render pass `{ preventRender: true }` as the 2nd argument.\n setComparator(comparator, {preventRender} = {}) {\n const comparatorChanged = this.viewComparator !== comparator;\n const shouldSort = comparatorChanged && !preventRender;\n\n this.viewComparator = comparator;\n\n if (shouldSort) {\n this.sort();\n }\n\n return this;\n },\n\n // Clears the `viewComparator` and follows the same rules for rendering as `setComparator`.\n removeComparator(options) {\n return this.setComparator(null, options);\n },\n\n // If viewComparator is overriden it will be returned here.\n // Additionally override this function to provide custom\n // viewComparator logic\n getComparator() {\n if (this.viewComparator) { return this.viewComparator }\n\n if (!this.sortWithCollection || this.viewComparator === false || !this.collection) {\n return false;\n }\n\n return this._viewComparator;\n },\n\n // Default internal view comparator that order the views by\n // the order of the collection\n _viewComparator(view) {\n return this.collection.indexOf(view.model);\n },\n\n // This method filters the children views and renders the results\n filter() {\n if (this._isDestroyed) { return this; }\n\n this._filterChildren();\n\n this._renderChildren();\n\n return this;\n },\n\n _filterChildren() {\n if (!this._children.length) { return; }\n\n const viewFilter = this._getFilter();\n\n if (!viewFilter) {\n const shouldReset = this.children.length !== this._children.length;\n\n this.children._set(this._children._views, shouldReset);\n\n return;\n }\n\n // If children are filtered prevent added to end perf\n delete this._addedViews;\n\n this.triggerMethod('before:filter', this);\n\n const attachViews = [];\n const detachViews = [];\n\n _.each(this._children._views, (view, key, children) => {\n (viewFilter.call(this, view, key, children) ? attachViews : detachViews).push(view);\n });\n\n this._detachChildren(detachViews);\n\n // reset children\n this.children._set(attachViews, true);\n\n this.triggerMethod('filter', this, attachViews, detachViews);\n },\n\n // This method returns a function for the viewFilter\n _getFilter() {\n const viewFilter = this.getFilter();\n\n if (!viewFilter) { return false; }\n\n if (_.isFunction(viewFilter)) {\n return viewFilter;\n }\n\n // Support filter predicates `{ fooFlag: true }`\n if (_.isObject(viewFilter)) {\n const matcher = _.matches(viewFilter);\n return function(view) {\n return matcher(view.model && view.model.attributes);\n };\n }\n\n // Filter by model attribute\n if (_.isString(viewFilter)) {\n return function(view) {\n return view.model && view.model.get(viewFilter);\n };\n }\n\n throw new MarionetteError({\n name: classErrorName,\n message: '\"viewFilter\" must be a function, predicate object literal, a string indicating a model attribute, or falsy',\n url: 'marionette.collectionview.html#defining-the-viewfilter'\n });\n },\n\n // Override this function to provide custom\n // viewFilter logic\n getFilter() {\n return this.viewFilter;\n },\n\n // Sets the view's `viewFilter` and applies the filter if the view is ready.\n // To prevent the render pass `{ preventRender: true }` as the 2nd argument.\n setFilter(filter, {preventRender} = {}) {\n const filterChanged = this.viewFilter !== filter;\n const shouldRender = filterChanged && !preventRender;\n\n this.viewFilter = filter;\n\n if (shouldRender) {\n this.filter();\n }\n\n return this;\n },\n\n // Clears the `viewFilter` and follows the same rules for rendering as `setFilter`.\n removeFilter(options) {\n return this.setFilter(null, options);\n },\n\n _detachChildren(detachingViews) {\n _.each(detachingViews, this._detachChildView.bind(this));\n },\n\n _detachChildView(view) {\n const shouldTriggerDetach = view._isAttached && this.monitorViewEvents !== false;\n if (shouldTriggerDetach) {\n view.triggerMethod('before:detach', view);\n }\n\n this.detachHtml(view);\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n view.triggerMethod('detach', view);\n }\n },\n\n // Override this method to change how the collectionView detaches a child view\n detachHtml(view) {\n this.Dom.detachEl(view.el, view.$el);\n },\n\n _renderChildren() {\n const views = this._addedViews || this.children._views;\n\n this.triggerMethod('before:render:children', this, views);\n\n if (this.isEmpty()) {\n this._showEmptyView();\n } else {\n this._destroyEmptyView();\n\n const els = this._getBuffer(views);\n\n this._attachChildren(els, views);\n }\n\n delete this._addedViews;\n\n this.triggerMethod('render:children', this, views);\n },\n\n // Renders each view and creates a fragment buffer from them\n _getBuffer(views) {\n const elBuffer = this.Dom.createBuffer();\n\n _.each(views, view => {\n renderView(view);\n this.Dom.appendContents(elBuffer, view.el, {_$contents: view.$el});\n });\n\n return elBuffer;\n },\n\n _attachChildren(els, views) {\n const shouldTriggerAttach = this._isAttached && this.monitorViewEvents !== false;\n\n views = shouldTriggerAttach ? views : [];\n\n _.each(views, view => {\n if (view._isAttached) { return; }\n view.triggerMethod('before:attach', view);\n });\n\n this.attachHtml(els, this.$container);\n\n _.each(views, view => {\n if (view._isAttached) { return; }\n view._isAttached = true;\n view.triggerMethod('attach', view);\n });\n },\n\n // Override this method to do something other than `.append`.\n // You can attach any HTML at this point including the els.\n attachHtml(els, $container) {\n this.Dom.appendContents($container[0], els, {_$el: $container});\n },\n\n isEmpty() {\n return !this.children.length;\n },\n\n _showEmptyView() {\n const EmptyView = this._getEmptyView();\n\n if (!EmptyView) {\n return;\n }\n\n const options = this._getEmptyViewOptions();\n\n const emptyRegion = this.getEmptyRegion();\n\n emptyRegion.show(new EmptyView(options));\n },\n\n // Retrieve the empty view class\n _getEmptyView() {\n const emptyView = this.emptyView;\n\n if (!emptyView) { return; }\n\n return this._getView(emptyView);\n },\n\n // Remove the emptyView\n _destroyEmptyView() {\n const emptyRegion = this.getEmptyRegion();\n // Only empty if a view is show so the region\n // doesn't detach any other unrelated HTML\n if (emptyRegion.hasView()) {\n emptyRegion.empty();\n }\n },\n\n //\n _getEmptyViewOptions() {\n const emptyViewOptions = this.emptyViewOptions || this.childViewOptions;\n\n if (_.isFunction(emptyViewOptions)) {\n return emptyViewOptions.call(this);\n }\n\n return emptyViewOptions;\n },\n\n swapChildViews(view1, view2) {\n if (!this._children.hasView(view1) || !this._children.hasView(view2)) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'Both views must be children of the collection view to swap.',\n url: 'marionette.collectionview.html#swapping-child-views'\n });\n }\n\n this._children._swap(view1, view2);\n this.Dom.swapEl(view1.el, view2.el);\n\n // If the views are not filtered the same, refilter\n if (this.children.hasView(view1) !== this.children.hasView(view2)) {\n this.filter();\n } else {\n this.children._swap(view1, view2);\n }\n\n return this;\n },\n\n // Render the child's view and add it to the HTML for the collection view at a given index, based on the current sort\n addChildView(view, index) {\n if (!view || view._isDestroyed) {\n return view;\n }\n\n if (!this._isRendered) {\n this.render();\n }\n\n const hasIndex = (typeof index !== 'undefined');\n\n // Only cache views if added to the end\n if (!hasIndex || index >= this._children.length) {\n this._addedViews = [view];\n }\n this._addChild(view, index);\n\n if (hasIndex) {\n this._renderChildren();\n } else {\n this.sort();\n }\n\n return view;\n },\n\n // Detach a view from the children. Best used when adding a\n // childView from `addChildView`\n detachChildView(view) {\n this.removeChildView(view, { shouldDetach: true });\n\n return view;\n },\n\n // Remove the child view and destroy it. Best used when adding a\n // childView from `addChildView`\n // The options argument is for internal use only\n removeChildView(view, options) {\n if (!view) {\n return view;\n }\n\n this._removeChildView(view, options);\n\n this._removeChild(view);\n\n if (this.isEmpty()) {\n this._showEmptyView();\n }\n\n return view;\n },\n\n _removeChildViews(views) {\n _.each(views, this._removeChildView.bind(this));\n },\n\n _removeChildView(view, {shouldDetach} = {}) {\n view.off('destroy', this.removeChildView, this);\n\n if (shouldDetach) {\n this._detachChildView(view);\n } else {\n this._destroyChildView(view);\n }\n\n this.stopListening(view);\n },\n\n _destroyChildView(view) {\n if (view._isDestroyed) {\n return;\n }\n\n const shouldDisableEvents = this.monitorViewEvents === false;\n destroyView(view, shouldDisableEvents);\n },\n\n // called by ViewMixin destroy\n _removeChildren() {\n this._destroyChildren();\n const emptyRegion = this.getEmptyRegion();\n emptyRegion.destroy();\n delete this._addedViews;\n },\n\n // Destroy the child views that this collection view is holding on to, if any\n _destroyChildren() {\n if (!this._children.length) {\n return;\n }\n\n this.triggerMethod('before:destroy:children', this);\n if (this.monitorViewEvents === false) {\n this.Dom.detachContents(this.el, this.$el);\n }\n\n this._removeChildViews(this._children._views);\n\n // After all children have been destroyed re-init the container\n this._children._init();\n this.children._init();\n\n this.triggerMethod('destroy:children', this);\n }\n}, {\n setDomApi,\n setRenderer\n});\n\n_.extend(CollectionView.prototype, ViewMixin);\n\nexport default CollectionView;\n","// Behavior\n// --------\n\n// A Behavior is an isolated set of DOM /\n// user interactions that can be mixed into any View.\n// Behaviors allow you to blackbox View specific interactions\n// into portable logical chunks, keeping your views simple and your code DRY.\n\nimport _ from 'underscore';\nimport extend from './utils/extend';\nimport getNamespacedEventName from './utils/get-namespaced-event-name';\nimport CommonMixin from './mixins/common';\nimport DelegateEntityEventsMixin from './mixins/delegate-entity-events';\nimport TriggersMixin from './mixins/triggers';\nimport UIMixin from './mixins/ui';\n\nconst ClassOptions = [\n 'collectionEvents',\n 'events',\n 'modelEvents',\n 'triggers',\n 'ui'\n];\n\nconst Behavior = function(options, view) {\n // Setup reference to the view.\n // this comes in handle when a behavior\n // wants to directly talk up the chain\n // to the view.\n this.view = view;\n\n this._setOptions(options, ClassOptions);\n this.cid = _.uniqueId(this.cidPrefix);\n\n // Construct an internal UI hash using the behaviors UI\n // hash combined and overridden by the view UI hash.\n // This allows the user to use UI hash elements defined\n // in the parent view as well as those defined in the behavior.\n // This order will help the reuse and share of a behavior\n // between multiple views, while letting a view override\n // a selector under an UI key.\n this.ui = _.extend({}, _.result(this, 'ui'), _.result(view, 'ui'));\n\n // Proxy view triggers\n this.listenTo(view, 'all', this.triggerMethod);\n\n this.initialize.apply(this, arguments);\n};\n\nBehavior.extend = extend;\n\n// Behavior Methods\n// --------------\n\n_.extend(Behavior.prototype, CommonMixin, DelegateEntityEventsMixin, TriggersMixin, UIMixin, {\n cidPrefix: 'mnb',\n\n // This is a noop method intended to be overridden\n initialize() {},\n\n // proxy behavior $ method to the view\n // this is useful for doing jquery DOM lookups\n // scoped to behaviors view.\n $() {\n return this.view.$.apply(this.view, arguments);\n },\n\n // Stops the behavior from listening to events.\n destroy() {\n this.stopListening();\n\n this.view._removeBehavior(this);\n\n this._deleteEntityEventHandlers();\n\n return this;\n },\n\n proxyViewProperties() {\n this.$el = this.view.$el;\n this.el = this.view.el;\n\n return this;\n },\n\n bindUIElements() {\n this._bindUIElements();\n\n return this;\n },\n\n unbindUIElements() {\n this._unbindUIElements();\n\n return this;\n },\n\n getUI(name) {\n return this._getUI(name);\n },\n\n // Handle `modelEvents`, and `collectionEvents` configuration\n delegateEntityEvents() {\n this._delegateEntityEvents(this.view.model, this.view.collection);\n\n return this;\n },\n\n undelegateEntityEvents() {\n this._undelegateEntityEvents(this.view.model, this.view.collection);\n\n return this;\n },\n\n _getEvents() {\n if (!this.events) { return; }\n\n // Normalize behavior events hash to allow\n // a user to use the @ui. syntax.\n const behaviorEvents = this.normalizeUIKeys(_.result(this, 'events'));\n\n // binds the handler to the behavior and builds a unique eventName\n return _.reduce(behaviorEvents, (events, behaviorHandler, key) => {\n if (!_.isFunction(behaviorHandler)) {\n behaviorHandler = this[behaviorHandler];\n }\n if (!behaviorHandler) { return events; }\n key = getNamespacedEventName(key, this.cid);\n events[key] = behaviorHandler.bind(this);\n return events;\n }, {});\n },\n\n // Internal method to build all trigger handlers for a given behavior\n _getTriggers() {\n if (!this.triggers) { return; }\n\n // Normalize behavior triggers hash to allow\n // a user to use the @ui. syntax.\n const behaviorTriggers = this.normalizeUIKeys(_.result(this, 'triggers'));\n\n return this._getViewTriggers(this.view, behaviorTriggers);\n }\n});\n\nexport default Behavior;\n","// Application\n// -----------\n\nimport _ from 'underscore';\nimport extend from './utils/extend';\nimport buildRegion from './common/build-region';\nimport CommonMixin from './mixins/common';\nimport DestroyMixin from './mixins/destroy';\nimport RadioMixin from './mixins/radio';\nimport Region from './region';\n\nconst ClassOptions = [\n 'channelName',\n 'radioEvents',\n 'radioRequests',\n 'region',\n 'regionClass'\n];\n\nconst Application = function(options) {\n this._setOptions(options, ClassOptions);\n this.cid = _.uniqueId(this.cidPrefix);\n this._initRegion();\n this._initRadio();\n this.initialize.apply(this, arguments);\n};\n\nApplication.extend = extend;\n\n// Application Methods\n// --------------\n\n_.extend(Application.prototype, CommonMixin, DestroyMixin, RadioMixin, {\n cidPrefix: 'mna',\n\n // This is a noop method intended to be overridden\n initialize() {},\n\n // Kick off all of the application's processes.\n start(options) {\n this.triggerMethod('before:start', this, options);\n this.triggerMethod('start', this, options);\n return this;\n },\n\n regionClass: Region,\n\n _initRegion() {\n const region = this.region;\n\n if (!region) { return; }\n\n const defaults = {\n regionClass: this.regionClass\n };\n\n this._region = buildRegion(region, defaults);\n },\n\n getRegion() {\n return this._region;\n },\n\n showView(view, ...args) {\n const region = this.getRegion();\n region.show(view, ...args);\n return view;\n },\n\n getView() {\n return this.getRegion().currentView;\n }\n});\n\nexport default Application;\n","import {version} from '../package.json';\n\nimport proxy from './utils/proxy';\nimport extend from './utils/extend';\n\nimport {\n bindEvents as _bindEvents,\n unbindEvents as _unbindEvents\n} from './common/bind-events';\nimport {\n bindRequests as _bindRequests,\n unbindRequests as _unbindRequests\n} from './common/bind-requests';\nimport _getOption from './common/get-option';\nimport _mergeOptions from './common/merge-options';\nimport monitorViewEvents from './common/monitor-view-events';\nimport _normalizeMethods from './common/normalize-methods';\nimport _triggerMethod from './common/trigger-method';\n\nimport Events from './mixins/events';\n\nimport MnObject from './object';\nimport View from './view';\nimport CollectionView from './collection-view';\nimport Behavior from './behavior';\nimport Region from './region';\nimport Application from './application';\n\nimport DomApi from './config/dom';\n\nimport {\n isEnabled,\n setEnabled\n} from './config/features';\n\n// Utilities\n\nexport const bindEvents = proxy(_bindEvents);\nexport const unbindEvents = proxy(_unbindEvents);\nexport const bindRequests = proxy(_bindRequests);\nexport const unbindRequests = proxy(_unbindRequests);\nexport const mergeOptions = proxy(_mergeOptions);\nexport const getOption = proxy(_getOption);\nexport const normalizeMethods = proxy(_normalizeMethods);\nexport const triggerMethod = proxy(_triggerMethod);\n\n\n// Configuration\n\nexport const setDomApi = function(mixin) {\n CollectionView.setDomApi(mixin);\n Region.setDomApi(mixin);\n View.setDomApi(mixin);\n};\nexport const setRenderer = function(renderer) {\n CollectionView.setRenderer(renderer);\n View.setRenderer(renderer);\n};\n\nexport {\n View,\n CollectionView,\n MnObject,\n Region,\n Behavior,\n Application,\n isEnabled,\n setEnabled,\n monitorViewEvents,\n Events,\n extend,\n DomApi,\n version as VERSION\n};\n"],"names":["proxy","method","context","args","apply","extend","Backbone","Model","normalizeMethods","hash","_","reduce","normalizedHash","name","isFunction","errorProps","MarionetteError","call","Error","version","options","error","message","pick","captureStackTrace","url","urlRoot","normalizeBindings","bindings","isObject","bindEvents","entity","listenTo","unbindEvents","stopListening","bindRequests","channel","reply","unbindRequests","stopReplying","getOption","optionName","undefined","mergeOptions","keys","each","key","option","triggerMethodChildren","view","event","shouldTrigger","_getImmediateChildren","child","triggerMethod","shouldTriggerAttach","_isAttached","shouldAttach","shouldTriggerDetach","shouldDetach","triggerDOMRefresh","_isRendered","triggerDOMRemove","handleBeforeAttach","handleAttach","handleBeforeDetach","handleDetach","handleBeforeRender","handleRender","monitorViewEvents","_areViewEventsMonitored","on","splitter","methodCache","getEventName","match","prefix","eventName","toUpperCase","getOnMethodName","replace","methodName","result","drop","arguments","trigger","CommonMixin","classOptions","Events","_isDestroyed","channelName","Radio","_channel","radioEvents","radioRequests","_destroyRadio","ClassOptions","MarionetteObject","_setOptions","cid","uniqueId","cidPrefix","_initRadio","initialize","prototype","DestroyMixin","RadioMixin","invokeMap","invoke","getBehaviorClass","behaviorClass","BehaviorClass","parseBehaviors","behaviors","allBehaviors","reducedBehaviors","behaviorDefiniton","behavior","push","_behaviors","triggers","_invoke","memo","_triggers","events","_events","undelegate","without","model","collection","_modelEvents","_collectionEvents","template","data","mixinTemplateContext","serializeData","html","_renderHtml","attachElContent","serializedData","templateContext","serializeModel","serializeCollection","attributes","map","models","Dom","setContents","el","$el","delegateEventSplitter","getNamespacedEventName","namespace","FEATURES","isEnabled","setEnabled","state","buildViewTrigger","triggerDef","isString","shouldPreventDefault","preventDefault","shouldStopPropagation","stopPropagation","value","normalizeUIKeys","ui","val","normalizedKey","normalizeUIString","uiRegEx","uiString","r","slice","normalizeUIValues","property","propertyVal","uiBindings","_getUIBindings","_uiBindings","_ui","selector","$","getEl","setDomApi","mixin","document","createDocumentFragment","_$el","find","childEl","contains","parentNode","detach","newEl","oldEl","parent","replaceChild","el1","el2","parent1","parent2","next1","nextSibling","next2","insertBefore","contents","_$contents","append","hasChildNodes","ViewMixin","DomApi","_proxyBehaviorViewProperties","_buildEventProxies","combinedEvents","_getBehaviorEvents","_getEvents","_getBehaviorTriggers","_getTriggers","View","delegateEvents","_getViewTriggers","_delegateEntityEvents","_delegateBehaviorEntityEvents","_undelegateEntityEvents","_undelegateBehaviorEntityEvents","_disableDetachEvents","unbindUIElements","_removeElement","_removeChildren","_destroyBehaviors","_deleteEntityEventHandlers","_triggerEventOnBehaviors","off","removeData","detachEl","_bindUIElements","_bindBehaviorUIElements","_unbindUIElements","_unbindBehaviorUIElements","_getUI","_childViewEvents","_childViewTriggers","_eventPrefix","_getEventPrefix","defaultPrefix","_childViewEventHandler","childViewEvents","childViewTriggers","BehaviorsMixin","DelegateEntityEventsMixin","TemplateRenderMixin","TriggersMixin","UIMixin","renderView","supportsRenderLifecycle","render","destroyView","disableDetachEvents","destroy","supportsDestroyLifecycle","remove","classErrorName","Region","_initEl","_ensureElement","_getView","currentView","_isSwappingView","empty","_setupChildView","_attachView","_proxyChildViewEvents","_empty","parentView","_parentView","hasEl","documentElement","_shouldDisableMonitoring","shouldReplaceEl","replaceElement","_replaceEl","attachHtml","length","allowMissingEl","viewOptions","_getViewOptions","findEl","_restoreEl","replaceEl","_isReplaced","_detachView","appendContents","detachHtml","shouldDestroy","removeView","_stopChildViewEvents","shouldRestoreEl","detachContents","reset","_name","_removeReferences","definition","defaults","buildRegionFromObject","regionClass","RegionClass","regions","_regions","addRegions","isEmpty","_addRegions","regionDefinitions","partial","buildRegion","_addRegion","region","_removeRegion","_getRegions","bind","getRegions","getRegion","clone","show","detachView","setRenderer","renderer","childReducer","children","_initBehaviors","_initRegions","constructor","delegateEntityEvents","setElement","hasContents","bindUIElements","getTemplate","_reInitRegions","_renderTemplate","removeRegions","RegionsMixin","Container","_init","methods","_views","concat","stringComparator","comparator","get","_viewsByCid","_indexByModel","_updateLength","index","_addViewIndexes","splice","_sortBy","sort","sortedViews","sortBy","_set","views","shouldReset","view1","view2","view1Index","findIndexByView","view2Index","swapView","findByModelCid","modelCid","indexOf","findByCid","CollectionView","_initChildViewStorage","getEmptyRegion","_children","ChildViewContainer","_emptyRegion","isDestroyed","_onCollectionSort","_onCollectionReset","_onCollectionUpdate","add","merge","sortWithCollection","viewComparator","_destroyChildren","_addChildModels","changes","removedViews","removed","_removeChildModels","_addedViews","added","_detachChildren","_removeChildViews","_removeChildModel","findByModel","_removeChild","_remove","_addChildModel","_createChildView","_addChild","ChildView","_getChildView","childViewOptions","_getChildViewOptions","buildChildView","_add","childView","ChildViewClass","removeChildView","_initialEvents","_getChildViewContainer","childViewContainer","$container","_sortChildren","filter","getComparator","_sort","preventRender","comparatorChanged","shouldSort","setComparator","_viewComparator","_filterChildren","_renderChildren","viewFilter","_getFilter","attachViews","detachViews","getFilter","matcher","matches","filterChanged","shouldRender","setFilter","detachingViews","_detachChildView","_showEmptyView","_destroyEmptyView","els","_getBuffer","_attachChildren","elBuffer","createBuffer","EmptyView","_getEmptyView","_getEmptyViewOptions","emptyRegion","emptyView","hasView","emptyViewOptions","_swap","swapEl","hasIndex","_removeChildView","_destroyChildView","shouldDisableEvents","Behavior","_removeBehavior","behaviorEvents","behaviorHandler","behaviorTriggers","Application","_initRegion","_region","_bindEvents","_unbindEvents","_bindRequests","_unbindRequests","_mergeOptions","_getOption","_normalizeMethods","_triggerMethod"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAMA,QAAQ,SAARA,KAAQ,CAASC,MAAT,EAAiB;SACtB,UAASC,OAAT,EAA2B;sCAANC,IAAM;UAAA;;;WACzBF,OAAOG,KAAP,CAAaF,OAAb,EAAsBC,IAAtB,CAAP;GADF;CADF;;ACDA;;;AAGA,AAEA;AACA,IAAME,SAASC,SAASC,KAAT,CAAeF,MAA9B;;ACJA;;;;;AAKA,IAAMG,qBAAmB,SAAnBA,gBAAmB,CAASC,IAAT,EAAe;;;MAClC,CAACA,IAAL,EAAW;;;;SAEJC,EAAEC,MAAF,CAASF,IAAT,EAAe,UAACG,cAAD,EAAiBX,MAAjB,EAAyBY,IAAzB,EAAkC;QAClD,CAACH,EAAEI,UAAF,CAAab,MAAb,CAAL,EAA2B;eAChB,MAAKA,MAAL,CAAT;;QAEEA,MAAJ,EAAY;qBACKY,IAA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