From 19186e79f4888ad5bb1f664136d4307c1867f896 Mon Sep 17 00:00:00 2001 From: Paul Falgout Date: Sun, 21 Apr 2019 22:49:02 +0900 Subject: [PATCH] Bump and build 4.1.1 --- bower.json | 2 +- changelog.md | 5 +++++ lib/backbone.marionette.esm.js | 2 +- lib/backbone.marionette.js | 2 +- lib/backbone.marionette.js.map | 2 +- lib/backbone.marionette.min.js | 2 +- lib/backbone.marionette.min.js.map | 2 +- package.json | 2 +- 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index 27be97df44..a69055ab1f 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "backbone.marionette", "description": "The Backbone Framework", "homepage": "https://marionettejs.com/", - "version": "4.1.0", + "version": "4.1.1", "main": "./lib/backbone.marionette.js", "license": "MIT", "keywords": [ diff --git a/changelog.md b/changelog.md index 0c368cfb40..3c5d5f8615 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +### v4.1.1 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v4.1.0...v4.1.1) + +#### Fixes +* Error in the build + ### v4.1.0 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v4.0.0...v4.1.0) #### Features diff --git a/lib/backbone.marionette.esm.js b/lib/backbone.marionette.esm.js index ad0491819e..a90f3dbd39 100644 --- a/lib/backbone.marionette.esm.js +++ b/lib/backbone.marionette.esm.js @@ -1267,7 +1267,7 @@ _.extend(Region.prototype, CommonMixin, { }); } - this.$el = this.getEl(el); + return this.getEl(el); }, _setEl: function _setEl() { this.$el = this._getEl(this.el); diff --git a/lib/backbone.marionette.js b/lib/backbone.marionette.js index 7e4d2afe6f..f720d33abb 100644 --- a/lib/backbone.marionette.js +++ b/lib/backbone.marionette.js @@ -1291,7 +1291,7 @@ }); } - this.$el = this.getEl(el); + return this.getEl(el); }, _setEl: function _setEl() { this.$el = this._getEl(this.el); diff --git a/lib/backbone.marionette.js.map b/lib/backbone.marionette.js.map index f590eb2df9..55b959e9d9 100644 --- a/lib/backbone.marionette.js.map +++ b/lib/backbone.marionette.js.map @@ -1 +1 @@ -{"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 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 // Returns the document element for a given DOM element\n getDocumentEl(el) {\n return el.ownerDocument.documentElement;\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) {\n return getEl(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 _isElAttached() {\n return !!this.el && this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);\n },\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 || this._isDestroying) { return this; }\n this._isDestroying = true;\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 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 if (view._isShown) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'View is already shown in a Region or CollectionView',\n url: 'marionette.region.html#showing-a-view'\n });\n }\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 (this.currentView || !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 _getEl(el) {\n if (!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(el);\n },\n\n _setEl() {\n this.$el = this._getEl(this.el);\n\n if (this.$el.length) {\n this.el = this.$el[0];\n }\n\n // Make sure the $el contains only the el\n if (this.$el.length > 1) {\n this.$el = this.Dom.getEl(this.el);\n }\n },\n\n // Set the `el` of the region and move any current view to the new `el`.\n _setElement(el) {\n if (el === this.el) { return this; }\n\n const shouldReplace = this._isReplaced;\n\n this._restoreEl();\n\n this.el = el;\n\n this._setEl();\n\n if (this.currentView) {\n const view = this.currentView;\n\n if (shouldReplace) {\n this._replaceEl(view);\n } else {\n this.attachHtml(view);\n }\n }\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 _isElAttached() {\n return this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);\n },\n\n _attachView(view, { replaceElement } = {}) {\n const shouldTriggerAttach = !view._isAttached && this._isElAttached() && !this._shouldDisableMonitoring();\n const shouldReplaceEl = typeof replaceElement === 'undefined' ? !!_.result(this, 'replaceElement') : !!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 // Corresponds that view is shown in a marionette Region or CollectionView\n view._isShown = true;\n },\n\n _ensureElement(options = {}) {\n if (!_.isObject(this.el)) {\n this._setEl();\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 view._isShown = false;\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 this.el = this._initEl;\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._isElAttached();\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 const $emptyEl = this.$container || this.$el;\n\n if (this._emptyRegion && !this._emptyRegion.isDestroyed()) {\n this._emptyRegion._setElement($emptyEl[0]);\n return this._emptyRegion;\n }\n\n this._emptyRegion = new Region({ el: $emptyEl[0], 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._isElAttached();\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 view._isShown = false;\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 // If there are unrendered views prevent add to end perf\n if (this._hasUnrenderedViews) {\n delete this._addedViews;\n delete this._hasUnrenderedViews;\n }\n\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 // corresponds that view is shown in a Region or CollectionView\n view._isShown = true;\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, options = {}) {\n if (!view || view._isDestroyed) {\n return view;\n }\n\n if (view._isShown) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'View is already shown in a Region or CollectionView',\n url: 'marionette.region.html#showing-a-view'\n });\n }\n\n if (_.isObject(index)) {\n options = index;\n }\n\n // If options has defined index we should use it\n if (options.index != null) {\n index = options.index;\n }\n\n if (!this._isRendered) {\n this.render();\n }\n\n this._addChild(view, index);\n\n if (options.preventRender) {\n this._hasUnrenderedViews = true;\n return view;\n }\n\n const hasIndex = (typeof index !== 'undefined');\n const isAddedToEnd = !hasIndex || index >= this._children.length;\n\n // Only cache views if added to the end and there is no unrendered views\n if (isAddedToEnd && !this._hasUnrenderedViews) {\n this._addedViews = [view];\n }\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 as 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\n};\n\nexport default {\n View,\n CollectionView,\n MnObject,\n Object: MnObject,\n Region,\n Behavior,\n Application,\n isEnabled,\n setEnabled,\n monitorViewEvents,\n Events,\n extend,\n DomApi,\n VERSION\n};\n"],"names":["proxy","method","context","args","apply","extend","Backbone","Model","normalizeMethods","hash","_","reduce","normalizedHash","name","isFunction","errorProps","MarionetteError","call","Error","urlRoot","version","url","constructor","options","error","message","pick","captureStackTrace","toString","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","_setOptions","classOptions","Events","_isDestroyed","isDestroyed","destroy","_initRadio","channelName","Radio","_channel","radioEvents","radioRequests","_destroyRadio","getChannel","ClassOptions","MarionetteObject","cid","uniqueId","cidPrefix","initialize","prototype","DestroyMixin","RadioMixin","invokeMap","invoke","getBehaviorClass","behaviorClass","BehaviorClass","parseBehaviors","behaviors","allBehaviors","reducedBehaviors","behaviorDefiniton","behavior","push","_initBehaviors","_behaviors","_getBehaviorTriggers","triggers","_invoke","memo","_triggers","_getBehaviorEvents","events","_events","_proxyBehaviorViewProperties","_delegateBehaviorEntityEvents","_undelegateBehaviorEntityEvents","_destroyBehaviors","_removeBehavior","undelegate","without","_bindBehaviorUIElements","_unbindBehaviorUIElements","_triggerEventOnBehaviors","_delegateEntityEvents","model","collection","_modelEvents","_collectionEvents","_undelegateEntityEvents","_deleteEntityEventHandlers","_renderTemplate","template","data","mixinTemplateContext","serializeData","html","_renderHtml","attachElContent","getTemplate","serializedData","templateContext","serializeModel","items","serializeCollection","attributes","map","models","Dom","setContents","el","$el","delegateEventSplitter","getNamespacedEventName","namespace","FEATURES","childViewEventPrefix","triggersStopPropagation","triggersPreventDefault","DEV_MODE","isEnabled","setEnabled","state","buildViewTrigger","triggerDef","isString","shouldPreventDefault","preventDefault","shouldStopPropagation","stopPropagation","_getViewTriggers","value","normalizeUIKeys","ui","val","normalizedKey","normalizeUIString","uiRegEx","uiString","r","slice","normalizeUIValues","property","propertyVal","uiBindings","_getUIBindings","_bindUIElements","_uiBindings","_ui","selector","$","_unbindUIElements","_getUI","getEl","setDomApi","mixin","createBuffer","document","createDocumentFragment","getDocumentEl","ownerDocument","documentElement","findEl","find","hasEl","childEl","contains","parentNode","detachEl","_$el","detach","replaceEl","newEl","oldEl","parent","replaceChild","swapEl","el1","el2","parent1","parent2","next1","nextSibling","next2","insertBefore","appendContents","contents","_$contents","append","hasContents","hasChildNodes","detachContents","ViewMixin","DomApi","_isElAttached","supportsRenderLifecycle","supportsDestroyLifecycle","isRendered","isAttached","delegateEvents","_buildEventProxies","combinedEvents","_getEvents","_getTriggers","View","delegateEntityEvents","undelegateEntityEvents","_isDestroying","_disableDetachEvents","unbindUIElements","_removeElement","_removeChildren","off","removeData","bindUIElements","getUI","_childViewEvents","_childViewTriggers","_eventPrefix","_getEventPrefix","defaultPrefix","_proxyChildViewEvents","_childViewEventHandler","childViewEvents","childViewTriggers","BehaviorsMixin","DelegateEntityEventsMixin","TemplateRenderMixin","TriggersMixin","UIMixin","renderView","render","destroyView","disableDetachEvents","remove","classErrorName","Region","_initEl","_getEl","replaceElement","_isReplaced","_isSwappingView","show","_ensureElement","_getView","currentView","_isShown","empty","_setupChildView","_attachView","_setEl","length","_setElement","shouldReplace","_restoreEl","_replaceEl","attachHtml","_empty","parentView","_parentView","_shouldDisableMonitoring","shouldReplaceEl","allowMissingEl","viewOptions","_getViewOptions","_detachView","isReplaced","isSwappingView","detachHtml","shouldDestroy","removeView","_stopChildViewEvents","detachView","shouldRestoreEl","hasView","reset","_name","_removeReferences","definition","defaults","buildRegionFromObject","regionClass","RegionClass","_initRegions","regions","_regions","addRegions","_reInitRegions","addRegion","isEmpty","_addRegions","regionDefinitions","parentEl","partial","buildRegion","_addRegion","region","removeRegion","_removeRegion","removeRegions","_getRegions","bind","emptyRegions","getRegions","hasRegion","getRegion","clone","showChildView","detachChildView","getChildView","setRenderer","renderer","childReducer","children","setElement","RegionsMixin","Container","_init","methods","_views","concat","stringComparator","comparator","get","_viewsByCid","_indexByModel","_updateLength","_add","index","_addViewIndexes","splice","_sort","_sortBy","sort","sortedViews","sortBy","_set","views","shouldReset","_swap","view1","view2","view1Index","findIndexByView","view2Index","swapView","findByModel","findByModelCid","modelCid","findByIndex","indexOf","findByCid","_remove","CollectionView","sortWithCollection","_initChildViewStorage","getEmptyRegion","_children","ChildViewContainer","$emptyEl","$container","_emptyRegion","_initialEvents","_onCollectionSort","_onCollectionReset","_onCollectionUpdate","add","merge","viewComparator","_destroyChildren","_addChildModels","changes","removedViews","removed","_removeChildModels","_addedViews","added","_detachChildren","_removeChildViews","_removeChildModel","_removeChild","_addChildModel","_createChildView","_addChild","ChildView","_getChildView","childViewOptions","_getChildViewOptions","buildChildView","childView","ChildViewClass","removeChildView","_getChildViewContainer","childViewContainer","_sortChildren","filter","getComparator","setComparator","preventRender","comparatorChanged","shouldSort","removeComparator","_viewComparator","_filterChildren","_renderChildren","viewFilter","_getFilter","attachViews","detachViews","getFilter","matcher","matches","setFilter","filterChanged","shouldRender","removeFilter","detachingViews","_detachChildView","_hasUnrenderedViews","_showEmptyView","_destroyEmptyView","els","_getBuffer","_attachChildren","elBuffer","EmptyView","_getEmptyView","_getEmptyViewOptions","emptyRegion","emptyView","emptyViewOptions","swapChildViews","addChildView","hasIndex","isAddedToEnd","_removeChildView","_destroyChildView","shouldDisableEvents","Behavior","proxyViewProperties","behaviorEvents","behaviorHandler","behaviorTriggers","Application","_initRegion","start","_region","showView","getView","_bindEvents","_unbindEvents","_bindRequests","_unbindRequests","_mergeOptions","_getOption","_normalizeMethods","_triggerMethod","MnObject","Object","VERSION"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA,IAAMA,KAAK,GAAG,SAARA,KAAQ,CAASC,MAAT,EAAiB;EAC7B,SAAO,UAASC,OAA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Af,CAAyBC,KAAzB;EACAiF,EAAAA,MAAM,CAAClF,SAAP,CAAiBC,KAAjB;EACAiD,EAAAA,IAAI,CAAClD,SAAL,CAAeC,KAAf;EACD,CAJM;AAKP,MAAa2J,aAAW,GAAG,SAAdA,WAAc,CAASC,QAAT,EAAmB;EAC5C0C,EAAAA,cAAc,CAAC3C,WAAf,CAA2BC,QAA3B;EACA3G,EAAAA,IAAI,CAAC0G,WAAL,CAAiBC,QAAjB;EACD,CAHM;AAKP,AAgBA,4BAAe;EACb3G,EAAAA,IAAI,EAAJA,IADa;EAEbqJ,EAAAA,cAAc,EAAdA,cAFa;EAGbwG,EAAAA,QAAQ,EAARA,gBAHa;EAIbC,EAAAA,MAAM,EAAED,gBAJK;EAKb7N,EAAAA,MAAM,EAANA,MALa;EAMb0M,EAAAA,QAAQ,EAARA,QANa;EAObK,EAAAA,WAAW,EAAXA,WAPa;EAQbnU,EAAAA,SAAS,EAATA,SARa;EASbC,EAAAA,UAAU,EAAVA,UATa;EAUb9G,EAAAA,iBAAiB,EAAjBA,iBAVa;EAWboB,EAAAA,MAAM,EAANA,MAXa;EAYbtF,EAAAA,MAAM,EAANA,MAZa;EAabwP,EAAAA,MAAM,EAANA,MAba;EAcb0Q,EAAAA,OAAO,EAAPA;EAda,CAAf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"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 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 // Returns the document element for a given DOM element\n getDocumentEl(el) {\n return el.ownerDocument.documentElement;\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) {\n return getEl(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 _isElAttached() {\n return !!this.el && this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);\n },\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 || this._isDestroying) { return this; }\n this._isDestroying = true;\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 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 if (view._isShown) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'View is already shown in a Region or CollectionView',\n url: 'marionette.region.html#showing-a-view'\n });\n }\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 (this.currentView || !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 _getEl(el) {\n if (!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 return this.getEl(el);\n },\n\n _setEl() {\n this.$el = this._getEl(this.el);\n\n if (this.$el.length) {\n this.el = this.$el[0];\n }\n\n // Make sure the $el contains only the el\n if (this.$el.length > 1) {\n this.$el = this.Dom.getEl(this.el);\n }\n },\n\n // Set the `el` of the region and move any current view to the new `el`.\n _setElement(el) {\n if (el === this.el) { return this; }\n\n const shouldReplace = this._isReplaced;\n\n this._restoreEl();\n\n this.el = el;\n\n this._setEl();\n\n if (this.currentView) {\n const view = this.currentView;\n\n if (shouldReplace) {\n this._replaceEl(view);\n } else {\n this.attachHtml(view);\n }\n }\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 _isElAttached() {\n return this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);\n },\n\n _attachView(view, { replaceElement } = {}) {\n const shouldTriggerAttach = !view._isAttached && this._isElAttached() && !this._shouldDisableMonitoring();\n const shouldReplaceEl = typeof replaceElement === 'undefined' ? !!_.result(this, 'replaceElement') : !!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 // Corresponds that view is shown in a marionette Region or CollectionView\n view._isShown = true;\n },\n\n _ensureElement(options = {}) {\n if (!_.isObject(this.el)) {\n this._setEl();\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 view._isShown = false;\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 this.el = this._initEl;\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._isElAttached();\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 const $emptyEl = this.$container || this.$el;\n\n if (this._emptyRegion && !this._emptyRegion.isDestroyed()) {\n this._emptyRegion._setElement($emptyEl[0]);\n return this._emptyRegion;\n }\n\n this._emptyRegion = new Region({ el: $emptyEl[0], 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._isElAttached();\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 view._isShown = false;\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 // If there are unrendered views prevent add to end perf\n if (this._hasUnrenderedViews) {\n delete this._addedViews;\n delete this._hasUnrenderedViews;\n }\n\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 // corresponds that view is shown in a Region or CollectionView\n view._isShown = true;\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, options = {}) {\n if (!view || view._isDestroyed) {\n return view;\n }\n\n if (view._isShown) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'View is already shown in a Region or CollectionView',\n url: 'marionette.region.html#showing-a-view'\n });\n }\n\n if (_.isObject(index)) {\n options = index;\n }\n\n // If options has defined index we should use it\n if (options.index != null) {\n index = options.index;\n }\n\n if (!this._isRendered) {\n this.render();\n }\n\n this._addChild(view, index);\n\n if (options.preventRender) {\n this._hasUnrenderedViews = true;\n return view;\n }\n\n const hasIndex = (typeof index !== 'undefined');\n const isAddedToEnd = !hasIndex || index >= this._children.length;\n\n // Only cache views if added to the end and there is no unrendered views\n if (isAddedToEnd && !this._hasUnrenderedViews) {\n this._addedViews = [view];\n }\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 as 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\n};\n\nexport default {\n View,\n CollectionView,\n MnObject,\n Object: MnObject,\n Region,\n Behavior,\n Application,\n isEnabled,\n setEnabled,\n monitorViewEvents,\n Events,\n extend,\n DomApi,\n VERSION\n};\n"],"names":["proxy","method","context","args","apply","extend","Backbone","Model","normalizeMethods","hash","_","reduce","normalizedHash","name","isFunction","errorProps","MarionetteError","call","Error","urlRoot","version","url","constructor","options","error","message","pick","captureStackTrace","toString","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","_setOptions","classOptions","Events","_isDestroyed","isDestroyed","destroy","_initRadio","channelName","Radio","_channel","radioEvents","radioRequests","_destroyRadio","getChannel","ClassOptions","MarionetteObject","cid","uniqueId","cidPrefix","initialize","prototype","DestroyMixin","RadioMixin","invokeMap","invoke","getBehaviorClass","behaviorClass","BehaviorClass","parseBehaviors","behaviors","allBehaviors","reducedBehaviors","behaviorDefiniton","behavior","push","_initBehaviors","_behaviors","_getBehaviorTriggers","triggers","_invoke","memo","_triggers","_getBehaviorEvents","events","_events","_proxyBehaviorViewProperties","_delegateBehaviorEntityEvents","_undelegateBehaviorEntityEvents","_destroyBehaviors","_removeBehavior","undelegate","without","_bindBehaviorUIElements","_unbindBehaviorUIElements","_triggerEventOnBehaviors","_delegateEntityEvents","model","collection","_modelEvents","_collectionEvents","_undelegateEntityEvents","_deleteEntityEventHandlers","_renderTemplate","template","data","mixinTemplateContext","serializeData","html","_renderHtml","attachElContent","getTemplate","serializedData","templateContext","serializeModel","items","serializeCollection","attributes","map","models","Dom","setContents","el","$el","delegateEventSplitter","getNamespacedEventName","namespace","FEATURES","childViewEventPrefix","triggersStopPropagation","triggersPreventDefault","DEV_MODE","isEnabled","setEnabled","state","buildViewTrigger","triggerDef","isString","shouldPreventDefault","preventDefault","shouldStopPropagation","stopPropagation","_getViewTriggers","value","normalizeUIKeys","ui","val","normalizedKey","normalizeUIString","uiRegEx","uiString","r","slice","normalizeUIValues","property","propertyVal","uiBindings","_getUIBindings","_bindUIElements","_uiBindings","_ui","selector","$","_unbindUIElements","_getUI","getEl","setDomApi","mixin","createBuffer","document","createDocumentFragment","getDocumentEl","ownerDocument","documentElement","findEl","find","hasEl","childEl","contains","parentNode","detachEl","_$el","detach","replaceEl","newEl","oldEl","parent","replaceChild","swapEl","el1","el2","parent1","parent2","next1","nextSibling","next2","insertBefore","appendContents","contents","_$contents","append","hasContents","hasChildNodes","detachContents","ViewMixin","DomApi","_isElAttached","supportsRenderLifecycle","supportsDestroyLifecycle","isRendered","isAttached","delegateEvents","_buildEventProxies","combinedEvents","_getEvents","_getTriggers","View","delegateEntityEvents","undelegateEntityEvents","_isDestroying","_disableDetachEvents","unbindUIElements","_removeElement","_removeChildren","off","removeData","bindUIElements","getUI","_childViewEvents","_childViewTriggers","_eventPrefix","_getEventPrefix","defaultPrefix","_proxyChildViewEvents","_childViewEventHandler","childViewEvents","childViewTriggers","BehaviorsMixin","DelegateEntityEventsMixin","TemplateRenderMixin","TriggersMixin","UIMixin","renderView","render","destroyView","disableDetachEvents","remove","classErrorName","Region","_initEl","_getEl","replaceElement","_isReplaced","_isSwappingView","show","_ensureElement","_getView","currentView","_isShown","empty","_setupChildView","_attachView","_setEl","length","_setElement","shouldReplace","_restoreEl","_replaceEl","attachHtml","_empty","parentView","_parentView","_shouldDisableMonitoring","shouldReplaceEl","allowMissingEl","viewOptions","_getViewOptions","_detachView","isReplaced","isSwappingView","detachHtml","shouldDestroy","removeView","_stopChildViewEvents","detachView","shouldRestoreEl","hasView","reset","_name","_removeReferences","definition","defaults","buildRegionFromObject","regionClass","RegionClass","_initRegions","regions","_regions","addRegions","_reInitRegions","addRegion","isEmpty","_addRegions","regionDefinitions","parentEl","partial","buildRegion","_addRegion","region","removeRegion","_removeRegion","removeRegions","_getRegions","bind","emptyRegions","getRegions","hasRegion","getRegion","clone","showChildView","detachChildView","getChildView","setRenderer","renderer","childReducer","children","setElement","RegionsMixin","Container","_init","methods","_views","concat","stringComparator","comparator","get","_viewsByCid","_indexByModel","_updateLength","_add","index","_addViewIndexes","splice","_sort","_sortBy","sort","sortedViews","sortBy","_set","views","shouldReset","_swap","view1","view2","view1Index","findIndexByView","view2Index","swapView","findByModel","findByModelCid","modelCid","findByIndex","indexOf","findByCid","_remove","CollectionView","sortWithCollection","_initChildViewStorage","getEmptyRegion","_children","ChildViewContainer","$emptyEl","$container","_emptyRegion","_initialEvents","_onCollectionSort","_onCollectionReset","_onCollectionUpdate","add","merge","viewComparator","_destroyChildren","_addChildModels","changes","removedViews","removed","_removeChildModels","_addedViews","added","_detachChildren","_removeChildViews","_removeChildModel","_removeChild","_addChildModel","_createChildView","_addChild","ChildView","_getChildView","childViewOptions","_getChildViewOptions","buildChildView","childView","ChildViewClass","removeChildView","_getChildViewContainer","childViewContainer","_sortChildren","filter","getComparator","setComparator","preventRender","comparatorChanged","shouldSort","removeComparator","_viewComparator","_filterChildren","_renderChildren","viewFilter","_getFilter","attachViews","detachViews","getFilter","matcher","matches","setFilter","filterChanged","shouldRender","removeFilter","detachingViews","_detachChildView","_hasUnrenderedViews","_showEmptyView","_destroyEmptyView","els","_getBuffer","_attachChildren","elBuffer","EmptyView","_getEmptyView","_getEmptyViewOptions","emptyRegion","emptyView","emptyViewOptions","swapChildViews","addChildView","hasIndex","isAddedToEnd","_removeChildView","_destroyChildView","shouldDisableEvents","Behavior","proxyViewProperties","behaviorEvents","behaviorHandler","behaviorTriggers","Application","_initRegion","start","_region","showView","getView","_bindEvents","_unbindEvents","_bindRequests","_unbindRequests","_mergeOptions","_getOption","_normalizeMethods","_triggerMethod","MnObject","Object","VERSION"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA,IAAMA,KAAK,GAAG,SAARA,KAAQ,CAASC,MAAT,EAAiB;EAC7B,SAAO,UAASC,OAAT,EAA2B;EAAA,sCAANC,IAAM;EAANA,MAAAA,IAAM;EAAA;;EAChC,WAAOF,MAAM,CAACG,KAAP,CAAaF,OAAb,EAAsBC,IAAtB,CAAP;EACD,GAFD;EAGD,CAJD;;ECDA;AACA;EAKA,IAAME,MAAM,GAAGC,QAAQ,CAACC,KAAT,CAAeF,MAA9B;;ECHA;EAEA;EACA;;EACA,IAAMG,gBAAgB,GAAG,SAAnBA,gBAAmB,CAASC,IAAT,EAAe;EAAA;;EACtC,MAAI,CAACA,IAAL,EAAW;EAAE;EAAQ;;EAErB,SAAOC,CAAC,CAACC,MAAF,CAASF,IAAT,EAAe,UAACG,cAAD,EAAiBX,MAAjB,EAAyBY,IAAzB,EAAkC;EACtD,Q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AA,MAAM,EAANA,MALa;EAMb0M,EAAAA,QAAQ,EAARA,QANa;EAObK,EAAAA,WAAW,EAAXA,WAPa;EAQbnU,EAAAA,SAAS,EAATA,SARa;EASbC,EAAAA,UAAU,EAAVA,UATa;EAUb9G,EAAAA,iBAAiB,EAAjBA,iBAVa;EAWboB,EAAAA,MAAM,EAANA,MAXa;EAYbtF,EAAAA,MAAM,EAANA,MAZa;EAabwP,EAAAA,MAAM,EAANA,MAba;EAcb0Q,EAAAA,OAAO,EAAPA;EAda,CAAf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/lib/backbone.marionette.min.js b/lib/backbone.marionette.min.js index d644b2efbf..85d2c88143 100644 --- a/lib/backbone.marionette.min.js +++ b/lib/backbone.marionette.min.js @@ -9,5 +9,5 @@ * * http://marionettejs.com */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("backbone"),require("underscore"),require("backbone.radio")):"function"==typeof define&&define.amd?define(["exports","backbone","underscore","backbone.radio"],t):(e=e||self,function(){var i=e.Marionette,n=e.Marionette={};t(n,e.Backbone,e._,e.Backbone.Radio),n.noConflict=function(){return e.Marionette=i,n}}())}(this,function(e,t,i,n){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,i=i&&i.hasOwnProperty("default")?i.default:i,n=n&&n.hasOwnProperty("default")?n.default:n;var s=function(e){return function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;s1?i-1:0),h=1;h1&&void 0!==arguments[1]?arguments[1]:ie(e)).detach()},replaceEl:function(e,t){if(e!==t){var i=t.parentNode;i&&i.replaceChild(e,t)}},swapEl:function(e,t){if(e!==t){var i=e.parentNode,n=t.parentNode;if(i&&n){var s=e.nextSibling,r=t.nextSibling;i.insertBefore(t,s),n.insertBefore(e,r)}}},setContents:function(e,t){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie(e)).html(t)},appendContents:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i._$el,s=void 0===n?ie(e):n,r=i._$contents,o=void 0===r?ie(t):r;s.append(o)},hasContents:function(e){return!!e&&e.hasChildNodes()},detachContents:function(e){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:ie(e)).contents().detach()}},re={Dom:se,_isElAttached:function(){return!!this.el&&this.Dom.hasEl(this.Dom.getDocumentEl(this.el),this.el)},supportsRenderLifecycle:!0,supportsDestroyLifecycle:!0,_isDestroyed:!1,isDestroyed:function(){return!!this._isDestroyed},_isRendered:!1,isRendered:function(){return!!this._isRendered},_isAttached:!1,isAttached:function(){return!!this._isAttached},delegateEvents:function(e){this._proxyBehaviorViewProperties(),this._buildEventProxies();var n=i.extend({},this._getBehaviorEvents(),this._getEvents(e),this._getBehaviorTriggers(),this._getTriggers());return t.View.prototype.delegateEvents.call(this,n),this},_getEvents:function(e){return e?this.normalizeUIKeys(e):this.events?this.normalizeUIKeys(i.result(this,"events")):void 0},_getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(i.result(this,"triggers"));return this._getViewTriggers(this,e)}},delegateEntityEvents:function(){return this._delegateEntityEvents(this.model,this.collection),this._delegateBehaviorEntityEvents(),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.model,this.collection),this._undelegateBehaviorEntityEvents(),this},destroy:function(e){if(this._isDestroyed||this._isDestroying)return this;this._isDestroying=!0;var t=this._isAttached&&!this._disableDetachEvents;return this.triggerMethod("before:destroy",this,e),t&&this.triggerMethod("before:detach",this),this.unbindUIElements(),this._removeElement(),t&&(this._isAttached=!1,this.triggerMethod("detach",this)),this._removeChildren(),this._isDestroyed=!0,this._isRendered=!1,this._destroyBehaviors(e),this._deleteEntityEventHandlers(),this.triggerMethod("destroy",this,e),this._triggerEventOnBehaviors("destroy",this,e),this.stopListening(),this},_removeElement:function(){this.$el.off().removeData(),this.Dom.detachEl(this.el,this.$el)},bindUIElements:function(){return this._bindUIElements(),this._bindBehaviorUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this._unbindBehaviorUIElements(),this},getUI:function(e){return this._getUI(e)},_buildEventProxies:function(){this._childViewEvents=this.normalizeMethods(i.result(this,"childViewEvents")),this._childViewTriggers=i.result(this,"childViewTriggers"),this._eventPrefix=this._getEventPrefix()},_getEventPrefix:function(){var e=!!G("childViewEventPrefix")&&"childview",t=i.result(this,"childViewEventPrefix",e);return!1===t?t:t+":"},_proxyChildViewEvents:function(e){(this._childViewEvents||this._childViewTriggers||this._eventPrefix)&&this.listenTo(e,"all",this._childViewEventHandler)},_childViewEventHandler:function(e){for(var t=this._childViewEvents,i=arguments.length,n=new Array(i>1?i-1:0),s=1;s1&&(this.$el=this.Dom.getEl(this.el))},_setElement:function(e){if(e===this.el)return this;var t=this._isReplaced;if(this._restoreEl(),this.el=e,this._setEl(),this.currentView){var i=this.currentView;t?this._replaceEl(i):this.attachHtml(i)}return this},_setupChildView:function(e){I(e),this._proxyChildViewEvents(e),e.on("destroy",this._empty,this)},_proxyChildViewEvents:function(e){var t=this._parentView;t&&t._proxyChildViewEvents(e)},_shouldDisableMonitoring:function(){return this._parentView&&!1===this._parentView.monitorViewEvents},_isElAttached:function(){return this.Dom.hasEl(this.Dom.getDocumentEl(this.el),this.el)},_attachView:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).replaceElement,n=!e._isAttached&&this._isElAttached()&&!this._shouldDisableMonitoring(),s=void 0===t?!!i.result(this,"replaceElement"):!!t;n&&e.triggerMethod("before:attach",e),s?this._replaceEl(e):this.attachHtml(e),n&&(e._isAttached=!0,e.triggerMethod("attach",e)),e._isShown=!0},_ensureElement:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(i.isObject(this.el)||this._setEl(),!this.$el||0===this.$el.length){if(void 0===e.allowMissingEl?!!i.result(this,"allowMissingEl"):!!e.allowMissingEl)return!1;throw new d({name:"RegionError",message:'An "el" must exist in DOM for this region '.concat(this.cid),url:"marionette.region.html#additional-options"})}return!0},_getView:function(e){if(!e)throw new d({name:"RegionError",message:"The view passed is undefined and therefore invalid. You must pass a view instance to show.",url:"marionette.region.html#showing-a-view"});if(e._isDestroyed)throw new d({name:"RegionError",message:'View (cid: "'.concat(e.cid,'") has already been destroyed and cannot be used.'),url:"marionette.region.html#showing-a-view"});if(e instanceof t.View)return e;var i=this._getViewOptions(e);return new ve(i)},_getViewOptions:function(e){if(i.isFunction(e))return{template:e};if(i.isObject(e))return e;return{template:function(){return e}}},getEl:function(e){var t=i.result(this,"parentEl");return t&&i.isString(e)?this.Dom.findEl(t,e):this.Dom.getEl(e)},_replaceEl:function(e){this._restoreEl(),e.on("before:destroy",this._restoreEl,this),this.Dom.replaceEl(e.el,this.el),this._isReplaced=!0},_restoreEl:function(){if(this._isReplaced){var e=this.currentView;e&&(this._detachView(e),this._isReplaced=!1)}},isReplaced:function(){return!!this._isReplaced},isSwappingView:function(){return!!this._isSwappingView},attachHtml:function(e){this.Dom.appendContents(this.el,e.el,{_$el:this.$el,_$contents:e.$el})},empty:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{allowMissingEl:!0},t=this.currentView;return t?(this._empty(t,!0),this):(this._ensureElement(e)&&this.detachHtml(),this)},_empty:function(e,t){e.off("destroy",this._empty,this),this.triggerMethod("before:empty",this,e),this._restoreEl(),delete this.currentView,e._isDestroyed||(t?this.removeView(e):this._detachView(e),e._isShown=!1,this._stopChildViewEvents(e)),this.triggerMethod("empty",this,e)},_stopChildViewEvents:function(e){this._parentView&&this._parentView.stopListening(e)},destroyView:function(e){return e._isDestroyed?e:(he(e,this._shouldDisableMonitoring()),e)},removeView:function(e){this.destroyView(e)},detachView:function(){var e=this.currentView;if(e)return this._empty(e),e},_detachView:function(e){var t=e._isAttached&&!this._shouldDisableMonitoring(),i=this._isReplaced;t&&e.triggerMethod("before:detach",e),i?this.Dom.replaceEl(this.el,e.el):this.detachHtml(),t&&(e._isAttached=!1,e.triggerMethod("detach",e))},detachHtml:function(){this.Dom.detachContents(this.el,this.$el)},hasView:function(){return!!this.currentView},reset:function(e){return this.empty(e),this.el=this._initEl,delete this.$el,this},_isDestroyed:!1,isDestroyed:function(){return this._isDestroyed},destroy:function(e){return this._isDestroyed?this:(this.triggerMethod("before:destroy",this,e),this._isDestroyed=!0,this.reset(e),this._name&&this._parentView._removeReferences(this._name),delete this._parentView,delete this._name,this.triggerMethod("destroy",this,e),this.stopListening(),this)}});var ue={regionClass:le,_initRegions:function(){this.regions=this.regions||{},this._regions={},this.addRegions(i.result(this,"regions"))},_reInitRegions:function(){H(this._regions,"reset")},addRegion:function(e,t){var i={};return i[e]=t,this.addRegions(i)[e]},addRegions:function(e){if(!i.isEmpty(e))return e=this.normalizeUIValues(e,"el"),this.regions=i.extend({},this.regions,e),this._addRegions(e)},_addRegions:function(e){var t=this,n={regionClass:this.regionClass,parentEl:i.partial(i.result,this,"el")};return i.reduce(e,function(e,i,s){return e[s]=ae(i,n),t._addRegion(e[s],s),e},{})},_addRegion:function(e,t){this.triggerMethod("before:add:region",this,t,e),e._parentView=this,e._name=t,this._regions[t]=e,this.triggerMethod("add:region",this,t,e)},removeRegion:function(e){var t=this._regions[e];return this._removeRegion(t,e),t},removeRegions:function(){var e=this._getRegions();return i.each(this._regions,this._removeRegion.bind(this)),e},_removeRegion:function(e,t){this.triggerMethod("before:remove:region",this,t,e),e.destroy(),this.triggerMethod("remove:region",this,t,e)},_removeReferences:function(e){delete this.regions[e],delete this._regions[e]},emptyRegions:function(){var e=this.getRegions();return H(e,"empty"),e},hasRegion:function(e){return!!this.getRegion(e)},getRegion:function(e){return this._isRendered||this.render(),this._regions[e]},_getRegions:function(){return i.clone(this._regions)},getRegions:function(){return this._isRendered||this.render(),this._getRegions()},showChildView:function(e,t,i){return this.getRegion(e).show(t,i),t},detachChildView:function(e){return this.getRegion(e).detachView()},getChildView:function(e){return this.getRegion(e).currentView}};function ge(e){return this.prototype._renderHtml=e,this}var _e=["behaviors","childViewEventPrefix","childViewEvents","childViewTriggers","collectionEvents","events","modelEvents","regionClass","regions","template","templateContext","triggers","ui"];function fe(e,t){return t.currentView&&e.push(t.currentView),e}var ve=t.View.extend({constructor:function(e){this._setOptions(e,_e),I(this),this._initBehaviors(),this._initRegions(),t.View.prototype.constructor.apply(this,arguments),this.delegateEntityEvents(),this._triggerEventOnBehaviors("initialize",this,e)},setElement:function(){return t.View.prototype.setElement.apply(this,arguments),this._isRendered=this.Dom.hasContents(this.el),this._isAttached=this._isElAttached(),this._isRendered&&this.bindUIElements(),this},render:function(){var e=this.getTemplate();return!1===e||this._isDestroyed?this:(this.triggerMethod("before:render",this),this._isRendered&&this._reInitRegions(),this._renderTemplate(e),this.bindUIElements(),this._isRendered=!0,this.triggerMethod("render",this),this)},_removeChildren:function(){this.removeRegions()},_getImmediateChildren:function(){return i.reduce(this._regions,fe,[])}},{setRenderer:ge,setDomApi:ne});i.extend(ve.prototype,re,ue);var me=function(){this._init()};function pe(e,t){return t.model&&t.model.get(e)}i.each(["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck","reduce","partition"],function(e){me.prototype[e]=function(){for(var t=arguments.length,n=new Array(t),s=0;s1&&void 0!==arguments[1]?arguments[1]:this._views.length;this._addViewIndexes(e),this._views.splice(t,0,e),this._updateLength()},_addViewIndexes:function(e){this._viewsByCid[e.cid]=e,e.model&&(this._indexByModel[e.model.cid]=e)},_sort:function(e,t){return"string"==typeof e?(e=i.partial(pe,e),this._sortBy(e)):1===e.length?this._sortBy(e.bind(t)):this._views.sort(e.bind(t))},_sortBy:function(e){var t=i.sortBy(this._views,e);return this._set(t),t},_set:function(e,t){this._views.length=0,this._views.push.apply(this._views,e.slice(0)),t&&(this._viewsByCid={},this._indexByModel={},i.each(e,this._addViewIndexes.bind(this)),this._updateLength())},_swap:function(e,t){var i=this.findIndexByView(e),n=this.findIndexByView(t);if(-1!==i&&-1!==n){var s=this._views[i];this._views[i]=this._views[n],this._views[n]=s}},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){return this._indexByModel[e]},findByIndex:function(e){return this._views[e]},findIndexByView:function(e){return this._views.indexOf(e)},findByCid:function(e){return this._viewsByCid[e]},hasView:function(e){return!!this.findByCid(e.cid)},_remove:function(e){if(this._viewsByCid[e.cid]){e.model&&delete this._indexByModel[e.model.cid],delete this._viewsByCid[e.cid];var t=this.findIndexByView(e);this._views.splice(t,1),this._updateLength()}},_updateLength:function(){this.length=this._views.length}});var we=["behaviors","childView","childViewContainer","childViewEventPrefix","childViewEvents","childViewOptions","childViewTriggers","collectionEvents","emptyView","emptyViewOptions","events","modelEvents","sortWithCollection","template","templateContext","triggers","ui","viewComparator","viewFilter"],Ee=t.View.extend({sortWithCollection:!0,constructor:function(e){this._setOptions(e,we),I(this),this._initChildViewStorage(),this._initBehaviors(),t.View.prototype.constructor.apply(this,arguments),this.getEmptyRegion(),this.delegateEntityEvents(),this._triggerEventOnBehaviors("initialize",this,e)},_initChildViewStorage:function(){this._children=new me,this.children=new me},getEmptyRegion:function(){var e=this.$container||this.$el;return this._emptyRegion&&!this._emptyRegion.isDestroyed()?(this._emptyRegion._setElement(e[0]),this._emptyRegion):(this._emptyRegion=new le({el:e[0],replaceElement:!1}),this._emptyRegion._parentView=this,this._emptyRegion)},_initialEvents:function(){this._isRendered||this.listenTo(this.collection,{sort:this._onCollectionSort,reset:this._onCollectionReset,update:this._onCollectionUpdate})},_onCollectionSort:function(e,t){var i=t.add,n=t.merge,s=t.remove;this.sortWithCollection&&!1!==this.viewComparator&&(i||s||n||this.sort())},_onCollectionReset:function(){this._destroyChildren(),this._addChildModels(this.collection.models),this.sort()},_onCollectionUpdate:function(e,t){var i=t.changes,n=i.removed.length&&this._removeChildModels(i.removed);this._addedViews=i.added.length&&this._addChildModels(i.added),this._detachChildren(n),this.sort(),this._removeChildViews(n)},_removeChildModels:function(e){var t=this;return i.reduce(e,function(e,i){var n=t._removeChildModel(i);return n&&e.push(n),e},[])},_removeChildModel:function(e){var t=this._children.findByModel(e);return t&&this._removeChild(t),t},_removeChild:function(e){this.triggerMethod("before:remove:child",this,e),this.children._remove(e),this._children._remove(e),this.triggerMethod("remove:child",this,e)},_addChildModels:function(e){return i.map(e,this._addChildModel.bind(this))},_addChildModel:function(e){var t=this._createChildView(e);return this._addChild(t),t},_createChildView:function(e){var t=this._getChildView(e),i=this._getChildViewOptions(e);return this.buildChildView(e,t,i)},_addChild:function(e,t){this.triggerMethod("before:add:child",this,e),this._setupChildView(e),this._children._add(e,t),this.children._add(e,t),this.triggerMethod("add:child",this,e)},_getChildView:function(e){var t=this.childView;if(!t)throw new d({name:"CollectionViewError",message:'A "childView" must be specified',url:"marionette.collectionview.html#collectionviews-childview"});if(!(t=this._getView(t,e)))throw new d({name:"CollectionViewError",message:'"childView" must be a view class or a function that returns a view class',url:"marionette.collectionview.html#collectionviews-childview"});return t},_getView:function(e,n){return e.prototype instanceof t.View||e===t.View?e:i.isFunction(e)?e.call(this,n):void 0},_getChildViewOptions:function(e){return i.isFunction(this.childViewOptions)?this.childViewOptions(e):this.childViewOptions},buildChildView:function(e,t,n){return new t(i.extend({model:e},n))},_setupChildView:function(e){I(e),e.on("destroy",this.removeChildView,this),this._proxyChildViewEvents(e)},_getImmediateChildren:function(){return this.children._views},setElement:function(){return t.View.prototype.setElement.apply(this,arguments),this._isAttached=this._isElAttached(),this},render:function(){if(this._isDestroyed)return this;this.triggerMethod("before:render",this),this._destroyChildren(),this.collection&&(this._addChildModels(this.collection.models),this._initialEvents());var e=this.getTemplate();return e&&(this._renderTemplate(e),this.bindUIElements()),this._getChildViewContainer(),this.sort(),this._isRendered=!0,this.triggerMethod("render",this),this},_getChildViewContainer:function(){var e=i.result(this,"childViewContainer");if(this.$container=e?this.$(e):this.$el,!this.$container.length)throw new d({name:"CollectionViewError",message:'The specified "childViewContainer" was not found: '.concat(e),url:"marionette.collectionview.html#defining-the-childviewcontainer"})},sort:function(){return this._sortChildren(),this.filter(),this},_sortChildren:function(){if(this._children.length){var e=this.getComparator();e&&(delete this._addedViews,this.triggerMethod("before:sort",this),this._children._sort(e,this),this.triggerMethod("sort",this))}},setComparator:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventRender,i=this.viewComparator!==e&&!t;return this.viewComparator=e,i&&this.sort(),this},removeComparator:function(e){return this.setComparator(null,e)},getComparator:function(){return this.viewComparator?this.viewComparator:!(!this.sortWithCollection||!1===this.viewComparator||!this.collection)&&this._viewComparator},_viewComparator:function(e){return this.collection.indexOf(e.model)},filter:function(){return this._isDestroyed?this:(this._filterChildren(),this._renderChildren(),this)},_filterChildren:function(){var e=this;if(this._children.length){var t=this._getFilter();if(t){delete this._addedViews,this.triggerMethod("before:filter",this);var n=[],s=[];i.each(this._children._views,function(i,r,o){(t.call(e,i,r,o)?n:s).push(i)}),this._detachChildren(s),this.children._set(n,!0),this.triggerMethod("filter",this,n,s)}else{var r=this.children.length!==this._children.length;this.children._set(this._children._views,r)}}},_getFilter:function(){var e=this.getFilter();if(!e)return!1;if(i.isFunction(e))return e;if(i.isObject(e)){var t=i.matches(e);return function(e){return t(e.model&&e.model.attributes)}}if(i.isString(e))return function(t){return t.model&&t.model.get(e)};throw new d({name:"CollectionViewError",message:'"viewFilter" must be a function, predicate object literal, a string indicating a model attribute, or falsy',url:"marionette.collectionview.html#defining-the-viewfilter"})},getFilter:function(){return this.viewFilter},setFilter:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventRender,i=this.viewFilter!==e&&!t;return this.viewFilter=e,i&&this.filter(),this},removeFilter:function(e){return this.setFilter(null,e)},_detachChildren:function(e){i.each(e,this._detachChildView.bind(this))},_detachChildView:function(e){var t=e._isAttached&&!1!==this.monitorViewEvents;t&&e.triggerMethod("before:detach",e),this.detachHtml(e),t&&(e._isAttached=!1,e.triggerMethod("detach",e)),e._isShown=!1},detachHtml:function(e){this.Dom.detachEl(e.el,e.$el)},_renderChildren:function(){this._hasUnrenderedViews&&(delete this._addedViews,delete this._hasUnrenderedViews);var e=this._addedViews||this.children._views;if(this.triggerMethod("before:render:children",this,e),this.isEmpty())this._showEmptyView();else{this._destroyEmptyView();var t=this._getBuffer(e);this._attachChildren(t,e)}delete this._addedViews,this.triggerMethod("render:children",this,e)},_getBuffer:function(e){var t=this,n=this.Dom.createBuffer();return i.each(e,function(e){oe(e),e._isShown=!0,t.Dom.appendContents(n,e.el,{_$contents:e.$el})}),n},_attachChildren:function(e,t){t=this._isAttached&&!1!==this.monitorViewEvents?t:[],i.each(t,function(e){e._isAttached||e.triggerMethod("before:attach",e)}),this.attachHtml(e,this.$container),i.each(t,function(e){e._isAttached||(e._isAttached=!0,e.triggerMethod("attach",e))})},attachHtml:function(e,t){this.Dom.appendContents(t[0],e,{_$el:t})},isEmpty:function(){return!this.children.length},_showEmptyView:function(){var e=this._getEmptyView();if(e){var t=this._getEmptyViewOptions();this.getEmptyRegion().show(new e(t))}},_getEmptyView:function(){var e=this.emptyView;if(e)return this._getView(e)},_destroyEmptyView:function(){var e=this.getEmptyRegion();e.hasView()&&e.empty()},_getEmptyViewOptions:function(){var e=this.emptyViewOptions||this.childViewOptions;return i.isFunction(e)?e.call(this):e},swapChildViews:function(e,t){if(!this._children.hasView(e)||!this._children.hasView(t))throw new d({name:"CollectionViewError",message:"Both views must be children of the collection view to swap.",url:"marionette.collectionview.html#swapping-child-views"});return this._children._swap(e,t),this.Dom.swapEl(e.el,t.el),this.children.hasView(e)!==this.children.hasView(t)?this.filter():this.children._swap(e,t),this},addChildView:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||e._isDestroyed)return e;if(e._isShown)throw new d({name:"CollectionViewError",message:"View is already shown in a Region or CollectionView",url:"marionette.region.html#showing-a-view"});if(i.isObject(t)&&(n=t),null!=n.index&&(t=n.index),this._isRendered||this.render(),this._addChild(e,t),n.preventRender)return this._hasUnrenderedViews=!0,e;var s=void 0!==t;return(!s||t>=this._children.length)&&!this._hasUnrenderedViews&&(this._addedViews=[e]),s?this._renderChildren():this.sort(),e},detachChildView:function(e){return this.removeChildView(e,{shouldDetach:!0}),e},removeChildView:function(e,t){return e?(this._removeChildView(e,t),this._removeChild(e),this.isEmpty()&&this._showEmptyView(),e):e},_removeChildViews:function(e){i.each(e,this._removeChildView.bind(this))},_removeChildView:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shouldDetach;e.off("destroy",this.removeChildView,this),t?this._detachChildView(e):this._destroyChildView(e),this.stopListening(e)},_destroyChildView:function(e){e._isDestroyed||he(e,!1===this.monitorViewEvents)},_removeChildren:function(){this._destroyChildren(),this.getEmptyRegion().destroy(),delete this._addedViews},_destroyChildren:function(){this._children.length&&(this.triggerMethod("before:destroy:children",this),!1===this.monitorViewEvents&&this.Dom.detachContents(this.el,this.$el),this._removeChildViews(this._children._views),this._children._init(),this.children._init(),this.triggerMethod("destroy:children",this))}},{setDomApi:ne,setRenderer:ge});i.extend(Ee.prototype,re);var ye=["collectionEvents","events","modelEvents","triggers","ui"],Ve=function(e,t){this.view=t,this._setOptions(e,ye),this.cid=i.uniqueId(this.cidPrefix),this.ui=i.extend({},i.result(this,"ui"),i.result(t,"ui")),this.listenTo(t,"all",this.triggerMethod),this.initialize.apply(this,arguments)};Ve.extend=r,i.extend(Ve.prototype,T,N,Q,te,{cidPrefix:"mnb",initialize:function(){},$:function(){return this.view.$.apply(this.view,arguments)},destroy:function(){return this.stopListening(),this.view._removeBehavior(this),this._deleteEntityEventHandlers(),this},proxyViewProperties:function(){return this.$el=this.view.$el,this.el=this.view.el,this},bindUIElements:function(){return this._bindUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this},getUI:function(e){return this._getUI(e)},delegateEntityEvents:function(){return this._delegateEntityEvents(this.view.model,this.view.collection),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.view.model,this.view.collection),this},_getEvents:function(){var e=this;if(this.events){var t=this.normalizeUIKeys(i.result(this,"events"));return i.reduce(t,function(t,n,s){return i.isFunction(n)||(n=e[n]),n?(t[s=Y(s,e.cid)]=n.bind(e),t):t},{})}},_getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(i.result(this,"triggers"));return this._getViewTriggers(this.view,e)}}});var Ce=["channelName","radioEvents","radioRequests","region","regionClass"],be=function(e){this._setOptions(e,Ce),this.cid=i.uniqueId(this.cidPrefix),this._initRegion(),this._initRadio(),this.initialize.apply(this,arguments)};be.extend=r,i.extend(be.prototype,T,z,F,{cidPrefix:"mna",initialize:function(){},start:function(e){return this.triggerMethod("before:start",this,e),this.triggerMethod("start",this,e),this},regionClass:le,_initRegion:function(){var e=this.region;if(e){var t={regionClass:this.regionClass};this._region=ae(e,t)}},getRegion:function(){return this._region},showView:function(e){for(var t=this.getRegion(),i=arguments.length,n=new Array(i>1?i-1:0),s=1;s1?i-1:0),s=1;s1?i-1:0),h=1;h1&&void 0!==arguments[1]?arguments[1]:ie(e)).detach()},replaceEl:function(e,t){if(e!==t){var i=t.parentNode;i&&i.replaceChild(e,t)}},swapEl:function(e,t){if(e!==t){var i=e.parentNode,n=t.parentNode;if(i&&n){var s=e.nextSibling,r=t.nextSibling;i.insertBefore(t,s),n.insertBefore(e,r)}}},setContents:function(e,t){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie(e)).html(t)},appendContents:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i._$el,s=void 0===n?ie(e):n,r=i._$contents,o=void 0===r?ie(t):r;s.append(o)},hasContents:function(e){return!!e&&e.hasChildNodes()},detachContents:function(e){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:ie(e)).contents().detach()}},re={Dom:se,_isElAttached:function(){return!!this.el&&this.Dom.hasEl(this.Dom.getDocumentEl(this.el),this.el)},supportsRenderLifecycle:!0,supportsDestroyLifecycle:!0,_isDestroyed:!1,isDestroyed:function(){return!!this._isDestroyed},_isRendered:!1,isRendered:function(){return!!this._isRendered},_isAttached:!1,isAttached:function(){return!!this._isAttached},delegateEvents:function(e){this._proxyBehaviorViewProperties(),this._buildEventProxies();var n=i.extend({},this._getBehaviorEvents(),this._getEvents(e),this._getBehaviorTriggers(),this._getTriggers());return t.View.prototype.delegateEvents.call(this,n),this},_getEvents:function(e){return e?this.normalizeUIKeys(e):this.events?this.normalizeUIKeys(i.result(this,"events")):void 0},_getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(i.result(this,"triggers"));return this._getViewTriggers(this,e)}},delegateEntityEvents:function(){return this._delegateEntityEvents(this.model,this.collection),this._delegateBehaviorEntityEvents(),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.model,this.collection),this._undelegateBehaviorEntityEvents(),this},destroy:function(e){if(this._isDestroyed||this._isDestroying)return this;this._isDestroying=!0;var t=this._isAttached&&!this._disableDetachEvents;return this.triggerMethod("before:destroy",this,e),t&&this.triggerMethod("before:detach",this),this.unbindUIElements(),this._removeElement(),t&&(this._isAttached=!1,this.triggerMethod("detach",this)),this._removeChildren(),this._isDestroyed=!0,this._isRendered=!1,this._destroyBehaviors(e),this._deleteEntityEventHandlers(),this.triggerMethod("destroy",this,e),this._triggerEventOnBehaviors("destroy",this,e),this.stopListening(),this},_removeElement:function(){this.$el.off().removeData(),this.Dom.detachEl(this.el,this.$el)},bindUIElements:function(){return this._bindUIElements(),this._bindBehaviorUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this._unbindBehaviorUIElements(),this},getUI:function(e){return this._getUI(e)},_buildEventProxies:function(){this._childViewEvents=this.normalizeMethods(i.result(this,"childViewEvents")),this._childViewTriggers=i.result(this,"childViewTriggers"),this._eventPrefix=this._getEventPrefix()},_getEventPrefix:function(){var e=!!G("childViewEventPrefix")&&"childview",t=i.result(this,"childViewEventPrefix",e);return!1===t?t:t+":"},_proxyChildViewEvents:function(e){(this._childViewEvents||this._childViewTriggers||this._eventPrefix)&&this.listenTo(e,"all",this._childViewEventHandler)},_childViewEventHandler:function(e){for(var t=this._childViewEvents,i=arguments.length,n=new Array(i>1?i-1:0),s=1;s1&&(this.$el=this.Dom.getEl(this.el))},_setElement:function(e){if(e===this.el)return this;var t=this._isReplaced;if(this._restoreEl(),this.el=e,this._setEl(),this.currentView){var i=this.currentView;t?this._replaceEl(i):this.attachHtml(i)}return this},_setupChildView:function(e){I(e),this._proxyChildViewEvents(e),e.on("destroy",this._empty,this)},_proxyChildViewEvents:function(e){var t=this._parentView;t&&t._proxyChildViewEvents(e)},_shouldDisableMonitoring:function(){return this._parentView&&!1===this._parentView.monitorViewEvents},_isElAttached:function(){return this.Dom.hasEl(this.Dom.getDocumentEl(this.el),this.el)},_attachView:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).replaceElement,n=!e._isAttached&&this._isElAttached()&&!this._shouldDisableMonitoring(),s=void 0===t?!!i.result(this,"replaceElement"):!!t;n&&e.triggerMethod("before:attach",e),s?this._replaceEl(e):this.attachHtml(e),n&&(e._isAttached=!0,e.triggerMethod("attach",e)),e._isShown=!0},_ensureElement:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(i.isObject(this.el)||this._setEl(),!this.$el||0===this.$el.length){if(void 0===e.allowMissingEl?!!i.result(this,"allowMissingEl"):!!e.allowMissingEl)return!1;throw new d({name:"RegionError",message:'An "el" must exist in DOM for this region '.concat(this.cid),url:"marionette.region.html#additional-options"})}return!0},_getView:function(e){if(!e)throw new d({name:"RegionError",message:"The view passed is undefined and therefore invalid. You must pass a view instance to show.",url:"marionette.region.html#showing-a-view"});if(e._isDestroyed)throw new d({name:"RegionError",message:'View (cid: "'.concat(e.cid,'") has already been destroyed and cannot be used.'),url:"marionette.region.html#showing-a-view"});if(e instanceof t.View)return e;var i=this._getViewOptions(e);return new ve(i)},_getViewOptions:function(e){if(i.isFunction(e))return{template:e};if(i.isObject(e))return e;return{template:function(){return e}}},getEl:function(e){var t=i.result(this,"parentEl");return t&&i.isString(e)?this.Dom.findEl(t,e):this.Dom.getEl(e)},_replaceEl:function(e){this._restoreEl(),e.on("before:destroy",this._restoreEl,this),this.Dom.replaceEl(e.el,this.el),this._isReplaced=!0},_restoreEl:function(){if(this._isReplaced){var e=this.currentView;e&&(this._detachView(e),this._isReplaced=!1)}},isReplaced:function(){return!!this._isReplaced},isSwappingView:function(){return!!this._isSwappingView},attachHtml:function(e){this.Dom.appendContents(this.el,e.el,{_$el:this.$el,_$contents:e.$el})},empty:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{allowMissingEl:!0},t=this.currentView;return t?(this._empty(t,!0),this):(this._ensureElement(e)&&this.detachHtml(),this)},_empty:function(e,t){e.off("destroy",this._empty,this),this.triggerMethod("before:empty",this,e),this._restoreEl(),delete this.currentView,e._isDestroyed||(t?this.removeView(e):this._detachView(e),e._isShown=!1,this._stopChildViewEvents(e)),this.triggerMethod("empty",this,e)},_stopChildViewEvents:function(e){this._parentView&&this._parentView.stopListening(e)},destroyView:function(e){return e._isDestroyed?e:(he(e,this._shouldDisableMonitoring()),e)},removeView:function(e){this.destroyView(e)},detachView:function(){var e=this.currentView;if(e)return this._empty(e),e},_detachView:function(e){var t=e._isAttached&&!this._shouldDisableMonitoring(),i=this._isReplaced;t&&e.triggerMethod("before:detach",e),i?this.Dom.replaceEl(this.el,e.el):this.detachHtml(),t&&(e._isAttached=!1,e.triggerMethod("detach",e))},detachHtml:function(){this.Dom.detachContents(this.el,this.$el)},hasView:function(){return!!this.currentView},reset:function(e){return this.empty(e),this.el=this._initEl,delete this.$el,this},_isDestroyed:!1,isDestroyed:function(){return this._isDestroyed},destroy:function(e){return this._isDestroyed?this:(this.triggerMethod("before:destroy",this,e),this._isDestroyed=!0,this.reset(e),this._name&&this._parentView._removeReferences(this._name),delete this._parentView,delete this._name,this.triggerMethod("destroy",this,e),this.stopListening(),this)}});var ue={regionClass:le,_initRegions:function(){this.regions=this.regions||{},this._regions={},this.addRegions(i.result(this,"regions"))},_reInitRegions:function(){H(this._regions,"reset")},addRegion:function(e,t){var i={};return i[e]=t,this.addRegions(i)[e]},addRegions:function(e){if(!i.isEmpty(e))return e=this.normalizeUIValues(e,"el"),this.regions=i.extend({},this.regions,e),this._addRegions(e)},_addRegions:function(e){var t=this,n={regionClass:this.regionClass,parentEl:i.partial(i.result,this,"el")};return i.reduce(e,function(e,i,s){return e[s]=ae(i,n),t._addRegion(e[s],s),e},{})},_addRegion:function(e,t){this.triggerMethod("before:add:region",this,t,e),e._parentView=this,e._name=t,this._regions[t]=e,this.triggerMethod("add:region",this,t,e)},removeRegion:function(e){var t=this._regions[e];return this._removeRegion(t,e),t},removeRegions:function(){var e=this._getRegions();return i.each(this._regions,this._removeRegion.bind(this)),e},_removeRegion:function(e,t){this.triggerMethod("before:remove:region",this,t,e),e.destroy(),this.triggerMethod("remove:region",this,t,e)},_removeReferences:function(e){delete this.regions[e],delete this._regions[e]},emptyRegions:function(){var e=this.getRegions();return H(e,"empty"),e},hasRegion:function(e){return!!this.getRegion(e)},getRegion:function(e){return this._isRendered||this.render(),this._regions[e]},_getRegions:function(){return i.clone(this._regions)},getRegions:function(){return this._isRendered||this.render(),this._getRegions()},showChildView:function(e,t,i){return this.getRegion(e).show(t,i),t},detachChildView:function(e){return this.getRegion(e).detachView()},getChildView:function(e){return this.getRegion(e).currentView}};function ge(e){return this.prototype._renderHtml=e,this}var _e=["behaviors","childViewEventPrefix","childViewEvents","childViewTriggers","collectionEvents","events","modelEvents","regionClass","regions","template","templateContext","triggers","ui"];function fe(e,t){return t.currentView&&e.push(t.currentView),e}var ve=t.View.extend({constructor:function(e){this._setOptions(e,_e),I(this),this._initBehaviors(),this._initRegions(),t.View.prototype.constructor.apply(this,arguments),this.delegateEntityEvents(),this._triggerEventOnBehaviors("initialize",this,e)},setElement:function(){return t.View.prototype.setElement.apply(this,arguments),this._isRendered=this.Dom.hasContents(this.el),this._isAttached=this._isElAttached(),this._isRendered&&this.bindUIElements(),this},render:function(){var e=this.getTemplate();return!1===e||this._isDestroyed?this:(this.triggerMethod("before:render",this),this._isRendered&&this._reInitRegions(),this._renderTemplate(e),this.bindUIElements(),this._isRendered=!0,this.triggerMethod("render",this),this)},_removeChildren:function(){this.removeRegions()},_getImmediateChildren:function(){return i.reduce(this._regions,fe,[])}},{setRenderer:ge,setDomApi:ne});i.extend(ve.prototype,re,ue);var me=function(){this._init()};function pe(e,t){return t.model&&t.model.get(e)}i.each(["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck","reduce","partition"],function(e){me.prototype[e]=function(){for(var t=arguments.length,n=new Array(t),s=0;s1&&void 0!==arguments[1]?arguments[1]:this._views.length;this._addViewIndexes(e),this._views.splice(t,0,e),this._updateLength()},_addViewIndexes:function(e){this._viewsByCid[e.cid]=e,e.model&&(this._indexByModel[e.model.cid]=e)},_sort:function(e,t){return"string"==typeof e?(e=i.partial(pe,e),this._sortBy(e)):1===e.length?this._sortBy(e.bind(t)):this._views.sort(e.bind(t))},_sortBy:function(e){var t=i.sortBy(this._views,e);return this._set(t),t},_set:function(e,t){this._views.length=0,this._views.push.apply(this._views,e.slice(0)),t&&(this._viewsByCid={},this._indexByModel={},i.each(e,this._addViewIndexes.bind(this)),this._updateLength())},_swap:function(e,t){var i=this.findIndexByView(e),n=this.findIndexByView(t);if(-1!==i&&-1!==n){var s=this._views[i];this._views[i]=this._views[n],this._views[n]=s}},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){return this._indexByModel[e]},findByIndex:function(e){return this._views[e]},findIndexByView:function(e){return this._views.indexOf(e)},findByCid:function(e){return this._viewsByCid[e]},hasView:function(e){return!!this.findByCid(e.cid)},_remove:function(e){if(this._viewsByCid[e.cid]){e.model&&delete this._indexByModel[e.model.cid],delete this._viewsByCid[e.cid];var t=this.findIndexByView(e);this._views.splice(t,1),this._updateLength()}},_updateLength:function(){this.length=this._views.length}});var we=["behaviors","childView","childViewContainer","childViewEventPrefix","childViewEvents","childViewOptions","childViewTriggers","collectionEvents","emptyView","emptyViewOptions","events","modelEvents","sortWithCollection","template","templateContext","triggers","ui","viewComparator","viewFilter"],Ee=t.View.extend({sortWithCollection:!0,constructor:function(e){this._setOptions(e,we),I(this),this._initChildViewStorage(),this._initBehaviors(),t.View.prototype.constructor.apply(this,arguments),this.getEmptyRegion(),this.delegateEntityEvents(),this._triggerEventOnBehaviors("initialize",this,e)},_initChildViewStorage:function(){this._children=new me,this.children=new me},getEmptyRegion:function(){var e=this.$container||this.$el;return this._emptyRegion&&!this._emptyRegion.isDestroyed()?(this._emptyRegion._setElement(e[0]),this._emptyRegion):(this._emptyRegion=new le({el:e[0],replaceElement:!1}),this._emptyRegion._parentView=this,this._emptyRegion)},_initialEvents:function(){this._isRendered||this.listenTo(this.collection,{sort:this._onCollectionSort,reset:this._onCollectionReset,update:this._onCollectionUpdate})},_onCollectionSort:function(e,t){var i=t.add,n=t.merge,s=t.remove;this.sortWithCollection&&!1!==this.viewComparator&&(i||s||n||this.sort())},_onCollectionReset:function(){this._destroyChildren(),this._addChildModels(this.collection.models),this.sort()},_onCollectionUpdate:function(e,t){var i=t.changes,n=i.removed.length&&this._removeChildModels(i.removed);this._addedViews=i.added.length&&this._addChildModels(i.added),this._detachChildren(n),this.sort(),this._removeChildViews(n)},_removeChildModels:function(e){var t=this;return i.reduce(e,function(e,i){var n=t._removeChildModel(i);return n&&e.push(n),e},[])},_removeChildModel:function(e){var t=this._children.findByModel(e);return t&&this._removeChild(t),t},_removeChild:function(e){this.triggerMethod("before:remove:child",this,e),this.children._remove(e),this._children._remove(e),this.triggerMethod("remove:child",this,e)},_addChildModels:function(e){return i.map(e,this._addChildModel.bind(this))},_addChildModel:function(e){var t=this._createChildView(e);return this._addChild(t),t},_createChildView:function(e){var t=this._getChildView(e),i=this._getChildViewOptions(e);return this.buildChildView(e,t,i)},_addChild:function(e,t){this.triggerMethod("before:add:child",this,e),this._setupChildView(e),this._children._add(e,t),this.children._add(e,t),this.triggerMethod("add:child",this,e)},_getChildView:function(e){var t=this.childView;if(!t)throw new d({name:"CollectionViewError",message:'A "childView" must be specified',url:"marionette.collectionview.html#collectionviews-childview"});if(!(t=this._getView(t,e)))throw new d({name:"CollectionViewError",message:'"childView" must be a view class or a function that returns a view class',url:"marionette.collectionview.html#collectionviews-childview"});return t},_getView:function(e,n){return e.prototype instanceof t.View||e===t.View?e:i.isFunction(e)?e.call(this,n):void 0},_getChildViewOptions:function(e){return i.isFunction(this.childViewOptions)?this.childViewOptions(e):this.childViewOptions},buildChildView:function(e,t,n){return new t(i.extend({model:e},n))},_setupChildView:function(e){I(e),e.on("destroy",this.removeChildView,this),this._proxyChildViewEvents(e)},_getImmediateChildren:function(){return this.children._views},setElement:function(){return t.View.prototype.setElement.apply(this,arguments),this._isAttached=this._isElAttached(),this},render:function(){if(this._isDestroyed)return this;this.triggerMethod("before:render",this),this._destroyChildren(),this.collection&&(this._addChildModels(this.collection.models),this._initialEvents());var e=this.getTemplate();return e&&(this._renderTemplate(e),this.bindUIElements()),this._getChildViewContainer(),this.sort(),this._isRendered=!0,this.triggerMethod("render",this),this},_getChildViewContainer:function(){var e=i.result(this,"childViewContainer");if(this.$container=e?this.$(e):this.$el,!this.$container.length)throw new d({name:"CollectionViewError",message:'The specified "childViewContainer" was not found: '.concat(e),url:"marionette.collectionview.html#defining-the-childviewcontainer"})},sort:function(){return this._sortChildren(),this.filter(),this},_sortChildren:function(){if(this._children.length){var e=this.getComparator();e&&(delete this._addedViews,this.triggerMethod("before:sort",this),this._children._sort(e,this),this.triggerMethod("sort",this))}},setComparator:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventRender,i=this.viewComparator!==e&&!t;return this.viewComparator=e,i&&this.sort(),this},removeComparator:function(e){return this.setComparator(null,e)},getComparator:function(){return this.viewComparator?this.viewComparator:!(!this.sortWithCollection||!1===this.viewComparator||!this.collection)&&this._viewComparator},_viewComparator:function(e){return this.collection.indexOf(e.model)},filter:function(){return this._isDestroyed?this:(this._filterChildren(),this._renderChildren(),this)},_filterChildren:function(){var e=this;if(this._children.length){var t=this._getFilter();if(t){delete this._addedViews,this.triggerMethod("before:filter",this);var n=[],s=[];i.each(this._children._views,function(i,r,o){(t.call(e,i,r,o)?n:s).push(i)}),this._detachChildren(s),this.children._set(n,!0),this.triggerMethod("filter",this,n,s)}else{var r=this.children.length!==this._children.length;this.children._set(this._children._views,r)}}},_getFilter:function(){var e=this.getFilter();if(!e)return!1;if(i.isFunction(e))return e;if(i.isObject(e)){var t=i.matches(e);return function(e){return t(e.model&&e.model.attributes)}}if(i.isString(e))return function(t){return t.model&&t.model.get(e)};throw new d({name:"CollectionViewError",message:'"viewFilter" must be a function, predicate object literal, a string indicating a model attribute, or falsy',url:"marionette.collectionview.html#defining-the-viewfilter"})},getFilter:function(){return this.viewFilter},setFilter:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventRender,i=this.viewFilter!==e&&!t;return this.viewFilter=e,i&&this.filter(),this},removeFilter:function(e){return this.setFilter(null,e)},_detachChildren:function(e){i.each(e,this._detachChildView.bind(this))},_detachChildView:function(e){var t=e._isAttached&&!1!==this.monitorViewEvents;t&&e.triggerMethod("before:detach",e),this.detachHtml(e),t&&(e._isAttached=!1,e.triggerMethod("detach",e)),e._isShown=!1},detachHtml:function(e){this.Dom.detachEl(e.el,e.$el)},_renderChildren:function(){this._hasUnrenderedViews&&(delete this._addedViews,delete this._hasUnrenderedViews);var e=this._addedViews||this.children._views;if(this.triggerMethod("before:render:children",this,e),this.isEmpty())this._showEmptyView();else{this._destroyEmptyView();var t=this._getBuffer(e);this._attachChildren(t,e)}delete this._addedViews,this.triggerMethod("render:children",this,e)},_getBuffer:function(e){var t=this,n=this.Dom.createBuffer();return i.each(e,function(e){oe(e),e._isShown=!0,t.Dom.appendContents(n,e.el,{_$contents:e.$el})}),n},_attachChildren:function(e,t){t=this._isAttached&&!1!==this.monitorViewEvents?t:[],i.each(t,function(e){e._isAttached||e.triggerMethod("before:attach",e)}),this.attachHtml(e,this.$container),i.each(t,function(e){e._isAttached||(e._isAttached=!0,e.triggerMethod("attach",e))})},attachHtml:function(e,t){this.Dom.appendContents(t[0],e,{_$el:t})},isEmpty:function(){return!this.children.length},_showEmptyView:function(){var e=this._getEmptyView();if(e){var t=this._getEmptyViewOptions();this.getEmptyRegion().show(new e(t))}},_getEmptyView:function(){var e=this.emptyView;if(e)return this._getView(e)},_destroyEmptyView:function(){var e=this.getEmptyRegion();e.hasView()&&e.empty()},_getEmptyViewOptions:function(){var e=this.emptyViewOptions||this.childViewOptions;return i.isFunction(e)?e.call(this):e},swapChildViews:function(e,t){if(!this._children.hasView(e)||!this._children.hasView(t))throw new d({name:"CollectionViewError",message:"Both views must be children of the collection view to swap.",url:"marionette.collectionview.html#swapping-child-views"});return this._children._swap(e,t),this.Dom.swapEl(e.el,t.el),this.children.hasView(e)!==this.children.hasView(t)?this.filter():this.children._swap(e,t),this},addChildView:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||e._isDestroyed)return e;if(e._isShown)throw new d({name:"CollectionViewError",message:"View is already shown in a Region or CollectionView",url:"marionette.region.html#showing-a-view"});if(i.isObject(t)&&(n=t),null!=n.index&&(t=n.index),this._isRendered||this.render(),this._addChild(e,t),n.preventRender)return this._hasUnrenderedViews=!0,e;var s=void 0!==t;return(!s||t>=this._children.length)&&!this._hasUnrenderedViews&&(this._addedViews=[e]),s?this._renderChildren():this.sort(),e},detachChildView:function(e){return this.removeChildView(e,{shouldDetach:!0}),e},removeChildView:function(e,t){return e?(this._removeChildView(e,t),this._removeChild(e),this.isEmpty()&&this._showEmptyView(),e):e},_removeChildViews:function(e){i.each(e,this._removeChildView.bind(this))},_removeChildView:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shouldDetach;e.off("destroy",this.removeChildView,this),t?this._detachChildView(e):this._destroyChildView(e),this.stopListening(e)},_destroyChildView:function(e){e._isDestroyed||he(e,!1===this.monitorViewEvents)},_removeChildren:function(){this._destroyChildren(),this.getEmptyRegion().destroy(),delete this._addedViews},_destroyChildren:function(){this._children.length&&(this.triggerMethod("before:destroy:children",this),!1===this.monitorViewEvents&&this.Dom.detachContents(this.el,this.$el),this._removeChildViews(this._children._views),this._children._init(),this.children._init(),this.triggerMethod("destroy:children",this))}},{setDomApi:ne,setRenderer:ge});i.extend(Ee.prototype,re);var ye=["collectionEvents","events","modelEvents","triggers","ui"],Ve=function(e,t){this.view=t,this._setOptions(e,ye),this.cid=i.uniqueId(this.cidPrefix),this.ui=i.extend({},i.result(this,"ui"),i.result(t,"ui")),this.listenTo(t,"all",this.triggerMethod),this.initialize.apply(this,arguments)};Ve.extend=r,i.extend(Ve.prototype,T,N,Q,te,{cidPrefix:"mnb",initialize:function(){},$:function(){return this.view.$.apply(this.view,arguments)},destroy:function(){return this.stopListening(),this.view._removeBehavior(this),this._deleteEntityEventHandlers(),this},proxyViewProperties:function(){return this.$el=this.view.$el,this.el=this.view.el,this},bindUIElements:function(){return this._bindUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this},getUI:function(e){return this._getUI(e)},delegateEntityEvents:function(){return this._delegateEntityEvents(this.view.model,this.view.collection),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.view.model,this.view.collection),this},_getEvents:function(){var e=this;if(this.events){var t=this.normalizeUIKeys(i.result(this,"events"));return i.reduce(t,function(t,n,s){return i.isFunction(n)||(n=e[n]),n?(t[s=Y(s,e.cid)]=n.bind(e),t):t},{})}},_getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(i.result(this,"triggers"));return this._getViewTriggers(this.view,e)}}});var Ce=["channelName","radioEvents","radioRequests","region","regionClass"],be=function(e){this._setOptions(e,Ce),this.cid=i.uniqueId(this.cidPrefix),this._initRegion(),this._initRadio(),this.initialize.apply(this,arguments)};be.extend=r,i.extend(be.prototype,T,z,F,{cidPrefix:"mna",initialize:function(){},start:function(e){return this.triggerMethod("before:start",this,e),this.triggerMethod("start",this,e),this},regionClass:le,_initRegion:function(){var e=this.region;if(e){var t={regionClass:this.regionClass};this._region=ae(e,t)}},getRegion:function(){return this._region},showView:function(e){for(var t=this.getRegion(),i=arguments.length,n=new Array(i>1?i-1:0),s=1;s 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 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 // Returns the document element for a given DOM element\n getDocumentEl(el) {\n return el.ownerDocument.documentElement;\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) {\n return getEl(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 _isElAttached() {\n return !!this.el && this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);\n },\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 || this._isDestroying) { return this; }\n this._isDestroying = true;\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 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 if (view._isShown) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'View is already shown in a Region or CollectionView',\n url: 'marionette.region.html#showing-a-view'\n });\n }\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 (this.currentView || !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 _getEl(el) {\n if (!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(el);\n },\n\n _setEl() {\n this.$el = this._getEl(this.el);\n\n if (this.$el.length) {\n this.el = this.$el[0];\n }\n\n // Make sure the $el contains only the el\n if (this.$el.length > 1) {\n this.$el = this.Dom.getEl(this.el);\n }\n },\n\n // Set the `el` of the region and move any current view to the new `el`.\n _setElement(el) {\n if (el === this.el) { return this; }\n\n const shouldReplace = this._isReplaced;\n\n this._restoreEl();\n\n this.el = el;\n\n this._setEl();\n\n if (this.currentView) {\n const view = this.currentView;\n\n if (shouldReplace) {\n this._replaceEl(view);\n } else {\n this.attachHtml(view);\n }\n }\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 _isElAttached() {\n return this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);\n },\n\n _attachView(view, { replaceElement } = {}) {\n const shouldTriggerAttach = !view._isAttached && this._isElAttached() && !this._shouldDisableMonitoring();\n const shouldReplaceEl = typeof replaceElement === 'undefined' ? !!_.result(this, 'replaceElement') : !!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 // Corresponds that view is shown in a marionette Region or CollectionView\n view._isShown = true;\n },\n\n _ensureElement(options = {}) {\n if (!_.isObject(this.el)) {\n this._setEl();\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 view._isShown = false;\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 this.el = this._initEl;\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._isElAttached();\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 const $emptyEl = this.$container || this.$el;\n\n if (this._emptyRegion && !this._emptyRegion.isDestroyed()) {\n this._emptyRegion._setElement($emptyEl[0]);\n return this._emptyRegion;\n }\n\n this._emptyRegion = new Region({ el: $emptyEl[0], 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._isElAttached();\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 view._isShown = false;\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 // If there are unrendered views prevent add to end perf\n if (this._hasUnrenderedViews) {\n delete this._addedViews;\n delete this._hasUnrenderedViews;\n }\n\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 // corresponds that view is shown in a Region or CollectionView\n view._isShown = true;\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, options = {}) {\n if (!view || view._isDestroyed) {\n return view;\n }\n\n if (view._isShown) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'View is already shown in a Region or CollectionView',\n url: 'marionette.region.html#showing-a-view'\n });\n }\n\n if (_.isObject(index)) {\n options = index;\n }\n\n // If options has defined index we should use it\n if (options.index != null) {\n index = options.index;\n }\n\n if (!this._isRendered) {\n this.render();\n }\n\n this._addChild(view, index);\n\n if (options.preventRender) {\n this._hasUnrenderedViews = true;\n return view;\n }\n\n const hasIndex = (typeof index !== 'undefined');\n const isAddedToEnd = !hasIndex || index >= this._children.length;\n\n // Only cache views if added to the end and there is no unrendered views\n if (isAddedToEnd && !this._hasUnrenderedViews) {\n this._addedViews = [view];\n }\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 as 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\n};\n\nexport default {\n View,\n CollectionView,\n MnObject,\n Object: MnObject,\n Region,\n Behavior,\n Application,\n isEnabled,\n setEnabled,\n monitorViewEvents,\n Events,\n extend,\n DomApi,\n VERSION\n};\n"],"names":["proxy","method","context","args","apply","extend","Backbone","Model","normalizeMethods","hash","_","reduce","normalizedHash","name","isFunction","_this","errorProps","MarionetteError","call","Error","urlRoot","url","constructor","options","error","this","message","pick","captureStackTrace","toString","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","result","methodName","drop","arguments","trigger","CommonMixin","_setOptions","classOptions","Events","_isDestroyed","isDestroyed","destroy","_initRadio","channelName","Radio","_channel","radioEvents","radioRequests","_destroyRadio","getChannel","ClassOptions","MarionetteObject","cid","uniqueId","cidPrefix","initialize","prototype","DestroyMixin","RadioMixin","invokeMap","invoke","parseBehaviors","behaviors","allBehaviors","reducedBehaviors","behaviorDefiniton","behaviorClass","BehaviorClass","getBehaviorClass","behavior","push","_initBehaviors","_behaviors","_getBehaviorTriggers","triggers","_invoke","memo","_triggers","_getBehaviorEvents","events","_events","_proxyBehaviorViewProperties","_delegateBehaviorEntityEvents","_undelegateBehaviorEntityEvents","_destroyBehaviors","_removeBehavior","undelegate","without","_bindBehaviorUIElements","_unbindBehaviorUIElements","_triggerEventOnBehaviors","_delegateEntityEvents","model","collection","_modelEvents","_collectionEvents","_undelegateEntityEvents","_deleteEntityEventHandlers","_renderTemplate","template","data","mixinTemplateContext","serializeData","html","_renderHtml","attachElContent","getTemplate","serializedData","templateContext","serializeModel","items","serializeCollection","attributes","map","models","Dom","setContents","el","$el","delegateEventSplitter","getNamespacedEventName","namespace","FEATURES","childViewEventPrefix","triggersStopPropagation","triggersPreventDefault","DEV_MODE","isEnabled","setEnabled","state","_getViewTriggers","value","triggerDef","isString","shouldPreventDefault","preventDefault","shouldStopPropagation","stopPropagation","buildViewTrigger","uiRegEx","normalizeUIString","uiString","ui","r","slice","normalizeUIKeys","val","_getUIBindings","uiBindings","normalizeUIValues","property","propertyVal","_bindUIElements","_uiBindings","_ui","selector","$","_unbindUIElements","_this2","_getUI","getEl","setDomApi","mixin","createBuffer","document","createDocumentFragment","getDocumentEl","ownerDocument","documentElement","findEl","find","hasEl","childEl","contains","parentNode","detachEl","detach","replaceEl","newEl","oldEl","parent","replaceChild","swapEl","el1","el2","parent1","parent2","next1","nextSibling","next2","insertBefore","appendContents","contents","_$el","_$contents","append","hasContents","hasChildNodes","detachContents","ViewMixin","DomApi","_isElAttached","supportsRenderLifecycle","supportsDestroyLifecycle","isRendered","isAttached","delegateEvents","_buildEventProxies","combinedEvents","_getEvents","_getTriggers","View","delegateEntityEvents","undelegateEntityEvents","_isDestroying","_disableDetachEvents","unbindUIElements","_removeElement","_removeChildren","off","removeData","bindUIElements","getUI","_childViewEvents","_childViewTriggers","_eventPrefix","_getEventPrefix","defaultPrefix","_proxyChildViewEvents","_childViewEventHandler","childViewEvents","childViewTriggers","renderView","render","destroyView","disableDetachEvents","remove","BehaviorsMixin","DelegateEntityEventsMixin","TemplateRenderMixin","TriggersMixin","UIMixin","Region","_initEl","_getEl","definition","defaults","buildRegionFromObject","regionClass","RegionClass","replaceElement","_isReplaced","_isSwappingView","show","_ensureElement","_getView","currentView","_isShown","empty","_setupChildView","_attachView","_setEl","length","_setElement","shouldReplace","_restoreEl","_replaceEl","attachHtml","_empty","parentView","_parentView","_shouldDisableMonitoring","shouldReplaceEl","allowMissingEl","viewOptions","_getViewOptions","_detachView","isReplaced","isSwappingView","detachHtml","shouldDestroy","removeView","_stopChildViewEvents","detachView","shouldRestoreEl","hasView","reset","_name","_removeReferences","_initRegions","regions","_regions","addRegions","_reInitRegions","addRegion","isEmpty","_addRegions","regionDefinitions","parentEl","partial","buildRegion","_addRegion","region","removeRegion","_removeRegion","removeRegions","_getRegions","bind","emptyRegions","getRegions","hasRegion","getRegion","clone","showChildView","detachChildView","getChildView","setRenderer","renderer","childReducer","children","setElement","RegionsMixin","Container","_init","stringComparator","comparator","get","_views","concat","_viewsByCid","_indexByModel","_updateLength","_add","index","_addViewIndexes","splice","_sort","_sortBy","sort","sortedViews","sortBy","_set","views","shouldReset","_swap","view1","view2","view1Index","findIndexByView","view2Index","swapView","findByModel","findByModelCid","modelCid","findByIndex","indexOf","findByCid","_remove","CollectionView","sortWithCollection","_initChildViewStorage","getEmptyRegion","_children","ChildViewContainer","$emptyEl","$container","_emptyRegion","_initialEvents","_onCollectionSort","_onCollectionReset","_onCollectionUpdate","add","merge","viewComparator","_destroyChildren","_addChildModels","changes","removedViews","removed","_removeChildModels","_addedViews","added","_detachChildren","_removeChildViews","_removeChildModel","_removeChild","_addChildModel","_createChildView","_addChild","ChildView","_getChildView","childViewOptions","_getChildViewOptions","buildChildView","childView","ChildViewClass","removeChildView","_getChildViewContainer","childViewContainer","_sortChildren","filter","getComparator","setComparator","preventRender","shouldSort","removeComparator","_viewComparator","_filterChildren","_renderChildren","viewFilter","_getFilter","attachViews","detachViews","getFilter","matcher","matches","setFilter","shouldRender","removeFilter","detachingViews","_detachChildView","_hasUnrenderedViews","_showEmptyView","_destroyEmptyView","els","_getBuffer","_attachChildren","elBuffer","_this3","EmptyView","_getEmptyView","_getEmptyViewOptions","emptyView","emptyRegion","emptyViewOptions","swapChildViews","addChildView","hasIndex","_removeChildView","_destroyChildView","Behavior","proxyViewProperties","behaviorEvents","behaviorHandler","behaviorTriggers","Application","_initRegion","start","_region","showView","getView","_bindEvents","_unbindEvents","_bindRequests","_unbindRequests","_mergeOptions","_getOption","_normalizeMethods","_triggerMethod","MnObject","Object","VERSION"],"mappings":";;;;;;;;;;;6jBACMA,EAAQ,SAASC,UACd,SAASC,8BAAYC,mCAAAA,2BACnBF,EAAOG,MAAMF,EAASC,KCG3BE,EAASC,EAASC,MAAMF,OCCxBG,EAAmB,SAASC,iBAC3BA,SAEEC,EAAEC,OAAOF,EAAM,SAACG,EAAgBX,EAAQY,UACxCH,EAAEI,WAAWb,KAChBA,EAASc,EAAKd,IAEZA,IACFW,EAAeC,GAAQZ,GAElBW,GACN,KCXCI,EAAa,CAAC,cAAe,WAAY,aAAc,OAAQ,UAAW,SAAU,OAEpFC,EAAkBZ,EAAOa,KAAKC,MAAO,CACzCC,6DAEAC,IAAK,GAELC,qBAAYC,OACJC,EAAQL,MAAMD,KAAKO,KAAMF,EAAQG,SACvChB,EAAEL,OAAOoB,KAAMf,EAAEiB,KAAKH,EAAOR,GAAaN,EAAEiB,KAAKJ,EAASP,IAEtDG,MAAMS,wBACHA,yBAGFP,IAAMI,KAAKL,QAAUK,KAAKJ,KAGjCO,6BACET,MAAMS,kBAAkBH,KAAMR,IAGhCY,oCACaJ,KAAKZ,kBAAWY,KAAKC,yBAAkBD,KAAKJ,QCX3D,SAASS,EAAkB5B,EAAS6B,OAC7BrB,EAAEsB,SAASD,SACR,IAAId,EAAgB,CACxBS,QAAS,8BACTL,IAAK,kCAIFb,EAAiBU,KAAKhB,EAAS6B,GAGxC,SAASE,EAAWC,EAAQH,UACrBG,GAAWH,QAEXI,SAASD,EAAQJ,EAAkBL,KAAMM,IAEvCN,MAJ4BA,KAOrC,SAASW,EAAaF,EAAQH,UACvBG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zD,EAAMggB,MA+BpB,CACbvP,KAAAA,GACAmJ,eAAAA,GACAqG,SAAAA,EACAC,OAAQD,EACRzN,OAAAA,GACAsM,SAAAA,GACAK,YAAAA,GACA9T,UAAAA,EACAC,WAAAA,EACA9G,kBAAAA,EACAoB,OAAAA,EACAvF,OAAAA,EACAyP,OAAAA,GACAqQ,iTAxCuB,SAAS3S,GAChCoM,GAAerM,UAAUC,GACzBgF,GAAOjF,UAAUC,GACjBiD,GAAKlD,UAAUC,iCAEU,SAAS2J,GAClCyC,GAAe1C,YAAYC,GAC3B1G,GAAKyG,YAAYC"} \ No newline at end of file +{"version":3,"file":"backbone.marionette.min.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 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 // Returns the document element for a given DOM element\n getDocumentEl(el) {\n return el.ownerDocument.documentElement;\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) {\n return getEl(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 _isElAttached() {\n return !!this.el && this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);\n },\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 || this._isDestroying) { return this; }\n this._isDestroying = true;\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 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 if (view._isShown) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'View is already shown in a Region or CollectionView',\n url: 'marionette.region.html#showing-a-view'\n });\n }\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 (this.currentView || !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 _getEl(el) {\n if (!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 return this.getEl(el);\n },\n\n _setEl() {\n this.$el = this._getEl(this.el);\n\n if (this.$el.length) {\n this.el = this.$el[0];\n }\n\n // Make sure the $el contains only the el\n if (this.$el.length > 1) {\n this.$el = this.Dom.getEl(this.el);\n }\n },\n\n // Set the `el` of the region and move any current view to the new `el`.\n _setElement(el) {\n if (el === this.el) { return this; }\n\n const shouldReplace = this._isReplaced;\n\n this._restoreEl();\n\n this.el = el;\n\n this._setEl();\n\n if (this.currentView) {\n const view = this.currentView;\n\n if (shouldReplace) {\n this._replaceEl(view);\n } else {\n this.attachHtml(view);\n }\n }\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 _isElAttached() {\n return this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);\n },\n\n _attachView(view, { replaceElement } = {}) {\n const shouldTriggerAttach = !view._isAttached && this._isElAttached() && !this._shouldDisableMonitoring();\n const shouldReplaceEl = typeof replaceElement === 'undefined' ? !!_.result(this, 'replaceElement') : !!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 // Corresponds that view is shown in a marionette Region or CollectionView\n view._isShown = true;\n },\n\n _ensureElement(options = {}) {\n if (!_.isObject(this.el)) {\n this._setEl();\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 view._isShown = false;\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 this.el = this._initEl;\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._isElAttached();\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 const $emptyEl = this.$container || this.$el;\n\n if (this._emptyRegion && !this._emptyRegion.isDestroyed()) {\n this._emptyRegion._setElement($emptyEl[0]);\n return this._emptyRegion;\n }\n\n this._emptyRegion = new Region({ el: $emptyEl[0], 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._isElAttached();\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 view._isShown = false;\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 // If there are unrendered views prevent add to end perf\n if (this._hasUnrenderedViews) {\n delete this._addedViews;\n delete this._hasUnrenderedViews;\n }\n\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 // corresponds that view is shown in a Region or CollectionView\n view._isShown = true;\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, options = {}) {\n if (!view || view._isDestroyed) {\n return view;\n }\n\n if (view._isShown) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'View is already shown in a Region or CollectionView',\n url: 'marionette.region.html#showing-a-view'\n });\n }\n\n if (_.isObject(index)) {\n options = index;\n }\n\n // If options has defined index we should use it\n if (options.index != null) {\n index = options.index;\n }\n\n if (!this._isRendered) {\n this.render();\n }\n\n this._addChild(view, index);\n\n if (options.preventRender) {\n this._hasUnrenderedViews = true;\n return view;\n }\n\n const hasIndex = (typeof index !== 'undefined');\n const isAddedToEnd = !hasIndex || index >= this._children.length;\n\n // Only cache views if added to the end and there is no unrendered views\n if (isAddedToEnd && !this._hasUnrenderedViews) {\n this._addedViews = [view];\n }\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 as 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\n};\n\nexport default {\n View,\n CollectionView,\n MnObject,\n Object: MnObject,\n Region,\n Behavior,\n Application,\n isEnabled,\n setEnabled,\n monitorViewEvents,\n Events,\n extend,\n DomApi,\n VERSION\n};\n"],"names":["proxy","method","context","args","apply","extend","Backbone","Model","normalizeMethods","hash","_","reduce","normalizedHash","name","isFunction","_this","errorProps","MarionetteError","call","Error","urlRoot","url","constructor","options","error","this","message","pick","captureStackTrace","toString","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","result","methodName","drop","arguments","trigger","CommonMixin","_setOptions","classOptions","Events","_isDestroyed","isDestroyed","destroy","_initRadio","channelName","Radio","_channel","radioEvents","radioRequests","_destroyRadio","getChannel","ClassOptions","MarionetteObject","cid","uniqueId","cidPrefix","initialize","prototype","DestroyMixin","RadioMixin","invokeMap","invoke","parseBehaviors","behaviors","allBehaviors","reducedBehaviors","behaviorDefiniton","behaviorClass","BehaviorClass","getBehaviorClass","behavior","push","_initBehaviors","_behaviors","_getBehaviorTriggers","triggers","_invoke","memo","_triggers","_getBehaviorEvents","events","_events","_proxyBehaviorViewProperties","_delegateBehaviorEntityEvents","_undelegateBehaviorEntityEvents","_destroyBehaviors","_removeBehavior","undelegate","without","_bindBehaviorUIElements","_unbindBehaviorUIElements","_triggerEventOnBehaviors","_delegateEntityEvents","model","collection","_modelEvents","_collectionEvents","_undelegateEntityEvents","_deleteEntityEventHandlers","_renderTemplate","template","data","mixinTemplateContext","serializeData","html","_renderHtml","attachElContent","getTemplate","serializedData","templateContext","serializeModel","items","serializeCollection","attributes","map","models","Dom","setContents","el","$el","delegateEventSplitter","getNamespacedEventName","namespace","FEATURES","childViewEventPrefix","triggersStopPropagation","triggersPreventDefault","DEV_MODE","isEnabled","setEnabled","state","_getViewTriggers","value","triggerDef","isString","shouldPreventDefault","preventDefault","shouldStopPropagation","stopPropagation","buildViewTrigger","uiRegEx","normalizeUIString","uiString","ui","r","slice","normalizeUIKeys","val","_getUIBindings","uiBindings","normalizeUIValues","property","propertyVal","_bindUIElements","_uiBindings","_ui","selector","$","_unbindUIElements","_this2","_getUI","getEl","setDomApi","mixin","createBuffer","document","createDocumentFragment","getDocumentEl","ownerDocument","documentElement","findEl","find","hasEl","childEl","contains","parentNode","detachEl","detach","replaceEl","newEl","oldEl","parent","replaceChild","swapEl","el1","el2","parent1","parent2","next1","nextSibling","next2","insertBefore","appendContents","contents","_$el","_$contents","append","hasContents","hasChildNodes","detachContents","ViewMixin","DomApi","_isElAttached","supportsRenderLifecycle","supportsDestroyLifecycle","isRendered","isAttached","delegateEvents","_buildEventProxies","combinedEvents","_getEvents","_getTriggers","View","delegateEntityEvents","undelegateEntityEvents","_isDestroying","_disableDetachEvents","unbindUIElements","_removeElement","_removeChildren","off","removeData","bindUIElements","getUI","_childViewEvents","_childViewTriggers","_eventPrefix","_getEventPrefix","defaultPrefix","_proxyChildViewEvents","_childViewEventHandler","childViewEvents","childViewTriggers","renderView","render","destroyView","disableDetachEvents","remove","BehaviorsMixin","DelegateEntityEventsMixin","TemplateRenderMixin","TriggersMixin","UIMixin","Region","_initEl","_getEl","definition","defaults","buildRegionFromObject","regionClass","RegionClass","replaceElement","_isReplaced","_isSwappingView","show","_ensureElement","_getView","currentView","_isShown","empty","_setupChildView","_attachView","_setEl","length","_setElement","shouldReplace","_restoreEl","_replaceEl","attachHtml","_empty","parentView","_parentView","_shouldDisableMonitoring","shouldReplaceEl","allowMissingEl","viewOptions","_getViewOptions","_detachView","isReplaced","isSwappingView","detachHtml","shouldDestroy","removeView","_stopChildViewEvents","detachView","shouldRestoreEl","hasView","reset","_name","_removeReferences","_initRegions","regions","_regions","addRegions","_reInitRegions","addRegion","isEmpty","_addRegions","regionDefinitions","parentEl","partial","buildRegion","_addRegion","region","removeRegion","_removeRegion","removeRegions","_getRegions","bind","emptyRegions","getRegions","hasRegion","getRegion","clone","showChildView","detachChildView","getChildView","setRenderer","renderer","childReducer","children","setElement","RegionsMixin","Container","_init","stringComparator","comparator","get","_views","concat","_viewsByCid","_indexByModel","_updateLength","_add","index","_addViewIndexes","splice","_sort","_sortBy","sort","sortedViews","sortBy","_set","views","shouldReset","_swap","view1","view2","view1Index","findIndexByView","view2Index","swapView","findByModel","findByModelCid","modelCid","findByIndex","indexOf","findByCid","_remove","CollectionView","sortWithCollection","_initChildViewStorage","getEmptyRegion","_children","ChildViewContainer","$emptyEl","$container","_emptyRegion","_initialEvents","_onCollectionSort","_onCollectionReset","_onCollectionUpdate","add","merge","viewComparator","_destroyChildren","_addChildModels","changes","removedViews","removed","_removeChildModels","_addedViews","added","_detachChildren","_removeChildViews","_removeChildModel","_removeChild","_addChildModel","_createChildView","_addChild","ChildView","_getChildView","childViewOptions","_getChildViewOptions","buildChildView","childView","ChildViewClass","removeChildView","_getChildViewContainer","childViewContainer","_sortChildren","filter","getComparator","setComparator","preventRender","shouldSort","removeComparator","_viewComparator","_filterChildren","_renderChildren","viewFilter","_getFilter","attachViews","detachViews","getFilter","matcher","matches","setFilter","shouldRender","removeFilter","detachingViews","_detachChildView","_hasUnrenderedViews","_showEmptyView","_destroyEmptyView","els","_getBuffer","_attachChildren","elBuffer","_this3","EmptyView","_getEmptyView","_getEmptyViewOptions","emptyView","emptyRegion","emptyViewOptions","swapChildViews","addChildView","hasIndex","_removeChildView","_destroyChildView","Behavior","proxyViewProperties","behaviorEvents","behaviorHandler","behaviorTriggers","Application","_initRegion","start","_region","showView","getView","_bindEvents","_unbindEvents","_bindRequests","_unbindRequests","_mergeOptions","_getOption","_normalizeMethods","_triggerMethod","MnObject","Object","VERSION"],"mappings":";;;;;;;;;;;6jBACMA,EAAQ,SAASC,UACd,SAASC,8BAAYC,mCAAAA,2BACnBF,EAAOG,MAAMF,EAASC,KCG3BE,EAASC,EAASC,MAAMF,OCCxBG,EAAmB,SAASC,iBAC3BA,SAEEC,EAAEC,OAAOF,EAAM,SAACG,EAAgBX,EAAQY,UACxCH,EAAEI,WAAWb,KAChBA,EAASc,EAAKd,IAEZA,IACFW,EAAeC,GAAQZ,GAElBW,GACN,KCXCI,EAAa,CAAC,cAAe,WAAY,aAAc,OAAQ,UAAW,SAAU,OAEpFC,EAAkBZ,EAAOa,KAAKC,MAAO,CACzCC,6DAEAC,IAAK,GAELC,qBAAYC,OACJC,EAAQL,MAAMD,KAAKO,KAAMF,EAAQG,SACvChB,EAAEL,OAAOoB,KAAMf,EAAEiB,KAAKH,EAAOR,GAAaN,EAAEiB,KAAKJ,EAASP,IAEtDG,MAAMS,wBACHA,yBAGFP,IAAMI,KAAKL,QAAUK,KAAKJ,KAGjCO,6BACET,MAAMS,kBAAkBH,KAAMR,IAGhCY,oCACaJ,KAAKZ,kBAAWY,KAAKC,yBAAkBD,KAAKJ,QCX3D,SAASS,EAAkB5B,EAAS6B,OAC7BrB,EAAEsB,SAASD,SACR,IAAId,EAAgB,CACxBS,QAAS,8BACTL,IAAK,kCAIFb,EAAiBU,KAAKhB,EAAS6B,GAGxC,SAASE,EAAWC,EAAQH,UACrBG,GAAWH,QAEXI,SAASD,EAAQJ,EAAkBL,KAAMM,IAEvCN,MAJ4BA,KAOrC,SAASW,EAAaF,EAAQH,UACvBG,EAEAH,QAKAM,cAAcH,EAAQJ,EAAkBL,KAAMM,IAE5CN,YANAY,cAAcH,GACZT,MAJaA,KCtBxB,SAASK,EAAkB5B,EAAS6B,OAC7BrB,EAAEsB,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AA,EACA9G,kBAAAA,EACAoB,OAAAA,EACAvF,OAAAA,EACAyP,OAAAA,GACAqQ,iTAxCuB,SAAS3S,GAChCoM,GAAerM,UAAUC,GACzBgF,GAAOjF,UAAUC,GACjBiD,GAAKlD,UAAUC,iCAEU,SAAS2J,GAClCyC,GAAe1C,YAAYC,GAC3B1G,GAAKyG,YAAYC"} \ No newline at end of file diff --git a/package.json b/package.json index 7d2ced2dba..9bc26a9f28 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "backbone.marionette", "description": "The Backbone Framework", - "version": "4.1.0", + "version": "4.1.1", "homepage": "https://marionettejs.com/", "browser": "lib/backbone.marionette.js", "main": "lib/backbone.marionette.js",