{"version":3,"sources":["src/common/bind-events.js","src/common/bind-requests.js","src/common/monitor-view-events.js","src/common/trigger-method.js","src/mixins/behaviors.js","src/config/features.js","src/mixins/triggers.js","src/config/dom.js","src/common/view.js","src/common/build-region.js","src/config/renderer.js","src/view.js","src/child-view-container.js","src/utils/proxy.js","src/utils/extend.js","src/common/normalize-methods.js","src/utils/error.js","src/common/get-option.js","src/common/merge-options.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/delegate-entity-events.js","src/mixins/template-render.js","src/utils/get-namespaced-event-name.js","src/mixins/ui.js","src/mixins/view.js","src/region.js","src/mixins/regions.js","src/collection-view.js","src/behavior.js","src/application.js","src/backbone.marionette.js"],"names":["normalizeBindings","context","bindings","_","isObject","MarionetteError","normalizeMethods","call","bindEvents","entity","listenTo","this","unbindEvents","stopListening","bindRequests","channel","reply","unbindRequests","stopReplying","triggerMethodChildren","view","event","shouldTrigger","_getImmediateChildren","each","child","triggerMethod","shouldTriggerAttach","_isAttached","shouldAttach","shouldTriggerDetach","shouldDetach","triggerDOMRefresh","_isRendered","triggerDOMRemove","handleBeforeAttach","handleAttach","handleBeforeDetach","handleDetach","handleBeforeRender","handleRender","monitorViewEvents","_areViewEventsMonitored","on","getEventName","match","prefix","eventName","toUpperCase","methodName","getOnMethodName","method","getOption","result","isFunction","apply","drop","arguments","trigger","getBehaviorClass","options","behaviorClass","BehaviorClass","parseBehaviors","behaviors","allBehaviors","reduce","reducedBehaviors","behaviorDefiniton","behavior","_getBehaviorClass","push","isEnabled","name","FEATURES","buildViewTrigger","triggerDef","isString","shouldPreventDefault","preventDefault","shouldStopPropagation","stopPropagation","args","Array","_len","_key","concat","getEl","el","Backbone","$","setDomApi","mixin","prototype","Dom","extend","renderView","supportsRenderLifecycle","render","destroyView","disableDetachEvents","destroy","_disableDetachEvents","supportsDestroyLifecycle","remove","_isDestroyed","buildRegionFromObject","defaults","definition","RegionClass","regionClass","setRenderer","renderer","_renderHtml","childReducer","children","region","currentView","stringComparator","comparator","model","get","proxy","Model","hash","normalizedHash","_this","errorProps","Error","error","message","pick","captureStackTrace","url","urlRoot","optionName","undefined","mergeOptions","keys","key","option","splitter","methodCache","replace","events","CommonMixin","classOptions","Events","DestroyMixin","RadioMixin","channelName","Radio","_channel","radioEvents","radioRequests","_destroyRadio","ClassOptions","MarionetteObject","_setOptions","cid","uniqueId","cidPrefix","_initRadio","initialize","_invoke","invokeMap","invoke","BehaviorsMixin","_behaviors","triggers","memo","_triggers","_events","undelegate","without","DelegateEntityEventsMixin","collection","_modelEvents","_collectionEvents","TemplateRenderMixin","template","data","mixinTemplateContext","serializeData","html","attachElContent","serializedData","templateContext","serializeModel","serializeCollection","attributes","map","models","setContents","$el","delegateEventSplitter","getNamespacedEventName","namespace","TriggersMixin","value","normalizeUIKeys","ui","val","normalizeUIString","uiRegEx","uiString","r","slice","normalizeUIValues","property","propertyVal","UIMixin","uiBindings","_getUIBindings","_uiBindings","_ui","selector","_this2","DomApi","document","createDocumentFragment","length","find","childEl","contains","parentNode","detach","newEl","oldEl","parent","replaceChild","el1","el2","parent1","parent2","next1","nextSibling","next2","insertBefore","contents","_$el","_ref$_$el","_$contents","_ref$_$contents","append","hasChildNodes","ViewMixin","_proxyBehaviorViewProperties","_buildEventProxies","combinedEvents","_getBehaviorEvents","_getEvents","_getBehaviorTriggers","_getTriggers","View","delegateEvents","_getViewTriggers","_delegateEntityEvents","_delegateBehaviorEntityEvents","_undelegateEntityEvents","_undelegateBehaviorEntityEvents","unbindUIElements","_removeElement","_removeChildren","_destroyBehaviors","_deleteEntityEventHandlers","_triggerEventOnBehaviors","off","removeData","detachEl","_bindUIElements","_bindBehaviorUIElements","_unbindUIElements","_unbindBehaviorUIElements","_getUI","_childViewEvents","_childViewTriggers","_eventPrefix","_getEventPrefix","defaultPrefix","_childViewEventHandler","childViewEvents","childViewTriggers","Region","_initEl","_ensureElement","_getView","_isSwappingView","empty","_setupChildView","_attachView","_proxyChildViewEvents","_empty","parentView","_parentView","hasEl","documentElement","_shouldDisableMonitoring","shouldReplaceEl","replaceElement","_replaceEl","attachHtml","allowMissingEl","viewOptions","_getViewOptions","findEl","_restoreEl","replaceEl","_isReplaced","_detachView","appendContents","detachHtml","shouldDestroy","removeView","_stopChildViewEvents","shouldRestoreEl","detachContents","reset","_name","_removeReferences","buildRegion","RegionsMixin","regions","_regions","addRegions","isEmpty","_addRegions","regionDefinitions","partial","_addRegion","_removeRegion","_getRegions","bind","getRegions","getRegion","clone","show","detachView","_initBehaviors","_initRegions","constructor","delegateEntityEvents","setElement","hasContents","bindUIElements","getTemplate","_reInitRegions","_renderTemplate","removeRegions","Container","_init","methods","_views","_viewsByCid","_indexByModel","_updateLength","index","_addViewIndexes","splice","_sortBy","sort","sortedViews","sortBy","_set","views","shouldReset","view1","view2","view1Index","findIndexByView","view2Index","swapView","findByModelCid","modelCid","indexOf","findByCid","CollectionView","_initChildViewStorage","getEmptyRegion","_children","ChildViewContainer","_emptyRegion","isDestroyed","_onCollectionSort","_onCollectionReset","_onCollectionUpdate","_ref","add","merge","sortWithCollection","viewComparator","_destroyChildren","_addChildModels","changes","removedViews","removed","_removeChildModels","_addedViews","added","_detachChildren","_removeChildViews","_removeChildModel","findByModel","_removeChild","_remove","_addChildModel","_createChildView","_addChild","ChildView","_getChildView","childViewOptions","_getChildViewOptions","buildChildView","_add","childView","ChildViewClass","removeChildView","_initialEvents","_getChildViewContainer","childViewContainer","$container","_sortChildren","filter","getComparator","_sort","preventRender","shouldSort","setComparator","_viewComparator","_filterChildren","_renderChildren","viewFilter","_getFilter","attachViews","detachViews","getFilter","matcher","matches","shouldRender","setFilter","detachingViews","_detachChildView","_showEmptyView","_destroyEmptyView","els","_getBuffer","_attachChildren","elBuffer","createBuffer","EmptyView","_getEmptyView","_getEmptyViewOptions","emptyView","emptyRegion","hasView","emptyViewOptions","_swap","swapEl","hasIndex","_removeChildView","_destroyChildView","Behavior","_removeBehavior","behaviorEvents","behaviorHandler","behaviorTriggers","Application","_initRegion","_region","_bindEvents","_unbindEvents","_bindRequests","_unbindRequests","_mergeOptions","_getOption","_normalizeMethods","_triggerMethod","state"],"mappings":";;;;;;;;;;;gVAeA,SAISA,EAAkBC,EAASC,OAC7BC,EAAEC,SAASF,SACR,IAAIG,WACC,kCACJ,kCAIFC,EAAiBC,KAAKN,EAASC,GAGxC,SAASM,EAAWC,EAAQP,UACrBO,GAAWP,QAEXQ,SAASD,EAAQT,EAAkBW,KAAMT,IAEvCS,MAJ4BA,KAOrC,SAASC,EAAaH,EAAQP,UACvBO,EAEAP,QAKAW,cAAcJ,EAAQT,EAAkBW,KAAMT,IAE5CS,YANAE,cAAcJ,GACZE,MAJaA,KC1BxB,SAISX,EAAkBC,EAASC,OAC7BC,EAAEC,SAASF,SACR,IAAIG,WACC,kCACJ,oCAIFC,EAAiBC,KAAKN,EAASC,GAGxC,SAASY,EAAaC,EAASb,UACxBa,GAAYb,KAETc,MAAMhB,EAAkBW,KAAMT,GAAWS,MAE1CA,MAJ6BA,KAOtC,SAASM,EAAeF,EAASb,UAC1Ba,EAEAb,KAKGgB,aAAalB,EAAkBW,KAAMT,IAEtCS,SANGO,aAAa,KAAM,KAAMP,MAC1BA,MAJcA,KC/BzB,SAASQ,EAAsBC,EAAMC,EAAOC,GACrCF,EAAKG,yBACRC,KAAKJ,EAAKG,wBAAyB,SAAAE,GAC9BH,EAAcG,MACbC,cAAcL,EAAOI,KAI/B,SAASE,EAAoBP,UACnBA,EAAKQ,YAGf,SAASC,EAAaT,WACfO,EAAoBP,OACpBQ,aAAc,GACZ,GAGT,SAASE,EAAoBV,UACpBA,EAAKQ,YAGd,SAASG,EAAaX,WACfU,EAAoBV,OACpBQ,aAAc,GACZ,GAGT,SAASI,EAAkBZ,GACrBA,EAAKQ,aAAeR,EAAKa,eACtBP,cAAc,cAAeN,GAItC,SAASc,EAAiBd,GACpBA,EAAKQ,aAAeR,EAAKa,eACtBP,cAAc,aAAcN,GA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AA,EAAA,EAAA,GAAAC,EAAA,EAAAA,EAAAD,EAAAC,MAAAA,EAAA,GAAA5B,UAAA4B,YAEf2P,KAAPzR,MAAA6D,GAAYhG,GAAZkE,OAAqBJ,IACd9D,WAlC4D,kBAsC5DT,KAAKmU,YAAYzN,eCjC5B,IAAa7G,GAAakH,EAAM2V,GACnBzc,GAAe8G,EAAM4V,GACrBxc,GAAe4G,EAAM6V,GACrBtc,GAAiByG,EAAM8V,GACvB/U,GAAef,EAAM+V,GACrBra,GAAYsE,EAAMgW,GAClBpd,GAAmBoH,EAAMiW,GACzBjc,GAAgBgG,EAAMkW,iKAKV,SAAShY,MACjBD,UAAUC,MAClBD,UAAUC,MACZD,UAAUC,kBAEU,SAASoB,MACnBD,YAAYC,MACtBD,YAAYC,qH9B3CnB,SAAoBvC,EAAMoZ,UACjBnZ,GAASD,GAAQoZ","file":"backbone.marionette.min.js","sourcesContent":["// 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","// DOM Refresh\n// -----------\n\nimport _ from 'underscore';\n\n// Trigger method on children unless a pure Backbone.View\nfunction triggerMethodChildren(view, event, shouldTrigger) {\n if (!view._getImmediateChildren) { return; }\n _.each(view._getImmediateChildren(), child => {\n if (!shouldTrigger(child)) { return; }\n child.triggerMethod(event, child);\n });\n}\n\nfunction shouldTriggerAttach(view) {\n return !view._isAttached;\n}\n\nfunction shouldAttach(view) {\n if (!shouldTriggerAttach(view)) { return false; }\n view._isAttached = true;\n return true;\n}\n\nfunction shouldTriggerDetach(view) {\n return view._isAttached;\n}\n\nfunction shouldDetach(view) {\n if (!shouldTriggerDetach(view)) { return false; }\n view._isAttached = false;\n return true;\n}\n\nfunction triggerDOMRefresh(view) {\n if (view._isAttached && view._isRendered) {\n view.triggerMethod('dom:refresh', view);\n }\n}\n\nfunction triggerDOMRemove(view) {\n if (view._isAttached && view._isRendered) {\n view.triggerMethod('dom:remove', view);\n }\n}\n\nfunction handleBeforeAttach() {\n triggerMethodChildren(this, 'before:attach', shouldTriggerAttach);\n}\n\nfunction handleAttach() {\n triggerMethodChildren(this, 'attach', shouldAttach);\n triggerDOMRefresh(this);\n}\n\nfunction handleBeforeDetach() {\n triggerMethodChildren(this, 'before:detach', shouldTriggerDetach);\n triggerDOMRemove(this);\n}\n\nfunction handleDetach() {\n triggerMethodChildren(this, 'detach', shouldDetach);\n}\n\nfunction handleBeforeRender() {\n triggerDOMRemove(this);\n}\n\nfunction handleRender() {\n triggerDOMRefresh(this);\n}\n\n// Monitor a view's state, propagating attach/detach events to children and firing dom:refresh\n// whenever a rendered view is attached or an attached view is rendered.\nfunction monitorViewEvents(view) {\n if (view._areViewEventsMonitored || view.monitorViewEvents === false) { return; }\n\n view._areViewEventsMonitored = true;\n\n view.on({\n 'before:attach': handleBeforeAttach,\n 'attach': handleAttach,\n 'before:detach': handleBeforeDetach,\n 'detach': handleDetach,\n 'before:render': handleBeforeRender,\n 'render': handleRender\n });\n}\n\nexport default monitorViewEvents;\n","// Trigger Method\n// --------------\n\nimport _ from 'underscore';\nimport getOption from './get-option';\n\n// split the event name on the \":\"\nconst splitter = /(^|:)(\\w)/gi;\n\n// Only calc getOnMethodName once\nconst methodCache = {};\n\n// take the event section (\"section1:section2:section3\")\n// and turn it in to uppercase name onSection1Section2Section3\nfunction getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n}\n\nconst getOnMethodName = function(event) {\n if (!methodCache[event]) {\n methodCache[event] = 'on' + event.replace(splitter, getEventName);\n }\n\n return methodCache[event];\n};\n\n// Trigger an event and/or a corresponding method name. Examples:\n//\n// `this.triggerMethod(\"foo\")` will trigger the \"foo\" event and\n// call the \"onFoo\" method.\n//\n// `this.triggerMethod(\"foo:bar\")` will trigger the \"foo:bar\" event and\n// call the \"onFooBar\" method.\nexport default function triggerMethod(event) {\n // get the method name from the event name\n const methodName = getOnMethodName(event);\n const method = getOption.call(this, methodName);\n let result;\n\n // call the onMethodName if it exists\n if (_.isFunction(method)) {\n // pass all args, except the event name\n result = method.apply(this, _.drop(arguments));\n }\n\n // trigger the event\n this.trigger.apply(this, arguments);\n\n return result;\n}\n","import _ 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","// 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","// DomApi\n// ---------\nimport _ from 'underscore';\nimport Backbone from 'backbone';\n\n// Performant method for returning the jQuery instance\nfunction getEl(el) {\n return el instanceof Backbone.$ ? el : Backbone.$(el);\n}\n\n// Static setter\nexport function setDomApi(mixin) {\n this.prototype.Dom = _.extend({}, this.prototype.Dom, mixin);\n return this;\n}\n\nexport default {\n\n // Returns a new HTML DOM node instance\n createBuffer() {\n return document.createDocumentFragment();\n },\n\n // Lookup the `selector` string\n // Selector may also be a DOM element\n // Returns an array-like object of nodes\n getEl(selector) {\n return getEl(selector);\n },\n\n // Finds the `selector` string with the el\n // Returns an array-like object of nodes\n findEl(el, selector, _$el = getEl(el)) {\n return _$el.find(selector);\n },\n\n // Returns true if the el contains the node childEl\n hasEl(el, childEl) {\n return el.contains(childEl && childEl.parentNode);\n },\n\n // Detach `el` from the DOM without removing listeners\n detachEl(el, _$el = getEl(el)) {\n _$el.detach();\n },\n\n // Remove `oldEl` from the DOM and put `newEl` in its place\n replaceEl(newEl, oldEl) {\n if (newEl === oldEl) {\n return;\n }\n\n const parent = oldEl.parentNode;\n\n if (!parent) {\n return;\n }\n\n parent.replaceChild(newEl, oldEl);\n },\n\n // Swaps the location of `el1` and `el2` in the DOM\n swapEl(el1, el2) {\n if (el1 === el2) {\n return;\n }\n\n const parent1 = el1.parentNode;\n const parent2 = el2.parentNode;\n\n if (!parent1 || !parent2) {\n return;\n }\n\n const next1 = el1.nextSibling;\n const next2 = el2.nextSibling;\n\n parent1.insertBefore(el2, next1);\n parent2.insertBefore(el1, next2);\n },\n\n // Replace the contents of `el` with the HTML string of `html`\n setContents(el, html, _$el = getEl(el)) {\n _$el.html(html);\n },\n\n // Takes the DOM node `el` and appends the DOM node `contents`\n // to the end of the element's contents.\n appendContents(el, contents, {_$el = getEl(el), _$contents = getEl(contents)} = {}) {\n _$el.append(_$contents);\n },\n\n // Does the el have child nodes\n hasContents(el) {\n return !!el && el.hasChildNodes();\n },\n\n // Remove the inner contents of `el` from the DOM while leaving\n // `el` itself in the DOM.\n detachContents(el, _$el = getEl(el)) {\n _$el.contents().detach();\n }\n};\n","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","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","// Static setter for the renderer\nexport function setRenderer(renderer) {\n this.prototype._renderHtml = renderer;\n return this;\n}\n","// View\n// ---------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport monitorViewEvents from './common/monitor-view-events';\nimport ViewMixin from './mixins/view';\nimport RegionsMixin from './mixins/regions';\nimport { setDomApi } from './config/dom';\nimport { setRenderer } from './config/renderer';\n\nconst ClassOptions = [\n 'behaviors',\n 'childViewEventPrefix',\n 'childViewEvents',\n 'childViewTriggers',\n 'collectionEvents',\n 'events',\n 'modelEvents',\n 'regionClass',\n 'regions',\n 'template',\n 'templateContext',\n 'triggers',\n 'ui'\n];\n\n// Used by _getImmediateChildren\nfunction childReducer(children, region) {\n if (region.currentView) {\n children.push(region.currentView);\n }\n\n return children;\n}\n\n// The standard view. Includes view events, automatic rendering\n// templates, nested views, and more.\nconst View = Backbone.View.extend({\n\n constructor(options) {\n this._setOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this._initBehaviors();\n this._initRegions();\n\n Backbone.View.prototype.constructor.apply(this, arguments);\n\n this.delegateEntityEvents();\n\n this._triggerEventOnBehaviors('initialize', this, options);\n },\n\n // Overriding Backbone.View's `setElement` to handle\n // if an el was previously defined. If so, the view might be\n // rendered or attached on setElement.\n setElement() {\n Backbone.View.prototype.setElement.apply(this, arguments);\n\n this._isRendered = this.Dom.hasContents(this.el);\n this._isAttached = this.Dom.hasEl(document.documentElement, this.el);\n\n if (this._isRendered) {\n this.bindUIElements();\n }\n\n return this;\n },\n\n // If a template is available, renders it into the view's `el`\n // Re-inits regions and binds UI.\n render() {\n const template = this.getTemplate();\n\n if (template === false || this._isDestroyed) { return this; }\n\n this.triggerMethod('before:render', this);\n\n // If this is not the first render call, then we need to\n // re-initialize the `el` for each region\n if (this._isRendered) {\n this._reInitRegions();\n }\n\n this._renderTemplate(template);\n this.bindUIElements();\n\n this._isRendered = true;\n this.triggerMethod('render', this);\n\n return this;\n },\n\n // called by ViewMixin destroy\n _removeChildren() {\n this.removeRegions();\n },\n\n _getImmediateChildren() {\n return _.reduce(this._regions, childReducer, []);\n }\n}, {\n setRenderer,\n setDomApi\n});\n\n_.extend(View.prototype, ViewMixin, RegionsMixin);\n\nexport default View;\n","import _ from 'underscore';\n\n// Provide a container to store, retrieve and\n// shut down child views.\nconst Container = function() {\n this._init();\n};\n\n// Mix in methods from Underscore, for iteration, and other\n// collection related features.\n// Borrowing this code from Backbone.Collection:\n// https://github.com/jashkenas/backbone/blob/1.1.2/backbone.js#L962\nconst methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',\n 'select', 'reject', 'every', 'all', 'some', 'any', 'include',\n 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',\n 'last', 'without', 'isEmpty', 'pluck', 'reduce', 'partition'];\n\n_.each(methods, function(method) {\n Container.prototype[method] = function(...args) {\n return _[method].apply(_, [this._views].concat(args));\n };\n});\n\nfunction stringComparator(comparator, view) {\n return view.model && view.model.get(comparator);\n}\n\n// Container Methods\n// -----------------\n\n_.extend(Container.prototype, {\n\n // Initializes an empty container\n _init() {\n this._views = [];\n this._viewsByCid = {};\n this._indexByModel = {};\n this._updateLength();\n },\n\n // Add a view to this container. Stores the view\n // by `cid` and makes it searchable by the model\n // cid (and model itself). Additionally it stores\n // the view by index in the _views array\n _add(view, index = this._views.length) {\n this._addViewIndexes(view);\n\n // add to end by default\n this._views.splice(index, 0, view);\n\n this._updateLength();\n },\n\n _addViewIndexes(view) {\n // store the view\n this._viewsByCid[view.cid] = view;\n\n // index it by model\n if (view.model) {\n this._indexByModel[view.model.cid] = view;\n }\n },\n\n // Sort (mutate) and return the array of the child views.\n _sort(comparator, context) {\n if (typeof comparator === 'string') {\n comparator = _.partial(stringComparator, comparator);\n return this._sortBy(comparator);\n }\n\n if (comparator.length === 1) {\n return this._sortBy(comparator.bind(context));\n }\n\n return this._views.sort(comparator.bind(context));\n },\n\n // Makes `_.sortBy` mutate the array to match `this._views.sort`\n _sortBy(comparator) {\n const sortedViews = _.sortBy(this._views, comparator);\n\n this._set(sortedViews);\n\n return sortedViews;\n },\n\n // Replace array contents without overwriting the reference.\n // Should not add/remove views\n _set(views, shouldReset) {\n this._views.length = 0;\n\n this._views.push.apply(this._views, views.slice(0));\n\n if (shouldReset) {\n this._viewsByCid = {};\n this._indexByModel = {};\n\n _.each(views, this._addViewIndexes.bind(this));\n\n this._updateLength();\n }\n },\n\n // Swap views by index\n _swap(view1, view2) {\n const view1Index = this.findIndexByView(view1);\n const view2Index = this.findIndexByView(view2);\n\n if (view1Index === -1 || view2Index === -1) {\n return;\n }\n\n const swapView = this._views[view1Index];\n this._views[view1Index] = this._views[view2Index];\n this._views[view2Index] = swapView;\n },\n\n // Find a view by the model that was attached to it.\n // Uses the model's `cid` to find it.\n findByModel(model) {\n return this.findByModelCid(model.cid);\n },\n\n // Find a view by the `cid` of the model that was attached to it.\n findByModelCid(modelCid) {\n return this._indexByModel[modelCid];\n },\n\n // Find a view by index.\n findByIndex(index) {\n return this._views[index];\n },\n\n // Find the index of a view instance\n findIndexByView(view) {\n return this._views.indexOf(view);\n },\n\n // Retrieve a view by its `cid` directly\n findByCid(cid) {\n return this._viewsByCid[cid];\n },\n\n hasView(view) {\n return !!this.findByCid(view.cid);\n },\n\n // Remove a view and clean up index references.\n _remove(view) {\n if (!this._viewsByCid[view.cid]) {\n return;\n }\n\n // delete model index\n if (view.model) {\n delete this._indexByModel[view.model.cid];\n }\n\n // remove the view from the container\n delete this._viewsByCid[view.cid];\n\n const index = this.findIndexByView(view);\n this._views.splice(index, 1);\n\n this._updateLength();\n },\n\n // Update the `.length` attribute on this container\n _updateLength() {\n this.length = this._views.length;\n }\n});\n\nexport default Container;\n","//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","// 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","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';\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","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","// ViewMixin\n// ---------\n\nimport Backbone from 'backbone';\nimport _ from 'underscore';\nimport BehaviorsMixin from './behaviors';\nimport CommonMixin from './common';\nimport DelegateEntityEventsMixin from './delegate-entity-events';\nimport TemplateRenderMixin from './template-render';\nimport TriggersMixin from './triggers';\nimport UIMixin from './ui';\nimport { isEnabled } from '../config/features';\nimport DomApi from '../config/dom';\n\n// MixinOptions\n// - behaviors\n// - childViewEventPrefix\n// - childViewEvents\n// - childViewTriggers\n// - collectionEvents\n// - modelEvents\n// - triggers\n// - ui\n\n\nconst ViewMixin = {\n Dom: DomApi,\n\n supportsRenderLifecycle: true,\n supportsDestroyLifecycle: true,\n\n _isDestroyed: false,\n\n isDestroyed() {\n return !!this._isDestroyed;\n },\n\n _isRendered: false,\n\n isRendered() {\n return !!this._isRendered;\n },\n\n _isAttached: false,\n\n isAttached() {\n return !!this._isAttached;\n },\n\n // Overriding Backbone.View's `delegateEvents` to handle\n // `events` and `triggers`\n delegateEvents(events) {\n this._proxyBehaviorViewProperties();\n this._buildEventProxies();\n\n const combinedEvents = _.extend({},\n this._getBehaviorEvents(),\n this._getEvents(events),\n this._getBehaviorTriggers(),\n this._getTriggers()\n );\n\n Backbone.View.prototype.delegateEvents.call(this, combinedEvents);\n\n return this;\n },\n\n // Allows Backbone.View events to utilize `@ui.` selectors\n _getEvents(events) {\n if (events) {\n return this.normalizeUIKeys(events);\n }\n\n if (!this.events) { return; }\n\n return this.normalizeUIKeys(_.result(this, 'events'));\n },\n\n // Configure `triggers` to forward DOM events to view\n // events. `triggers: {\"click .foo\": \"do:foo\"}`\n _getTriggers() {\n if (!this.triggers) { return; }\n\n // Allow `triggers` to be configured as a function\n const triggers = this.normalizeUIKeys(_.result(this, 'triggers'));\n\n // Configure the triggers, prevent default\n // action and stop propagation of DOM events\n return this._getViewTriggers(this, triggers);\n },\n\n // Handle `modelEvents`, and `collectionEvents` configuration\n delegateEntityEvents() {\n this._delegateEntityEvents(this.model, this.collection);\n\n // bind each behaviors model and collection events\n this._delegateBehaviorEntityEvents();\n\n return this;\n },\n\n // Handle unbinding `modelEvents`, and `collectionEvents` configuration\n undelegateEntityEvents() {\n this._undelegateEntityEvents(this.model, this.collection);\n\n // unbind each behaviors model and collection events\n this._undelegateBehaviorEntityEvents();\n\n return this;\n },\n\n // Handle destroying the view and its children.\n destroy(options) {\n if (this._isDestroyed) { return this; }\n const shouldTriggerDetach = this._isAttached && !this._disableDetachEvents;\n\n this.triggerMethod('before:destroy', this, options);\n if (shouldTriggerDetach) {\n this.triggerMethod('before:detach', this);\n }\n\n // unbind UI elements\n this.unbindUIElements();\n\n // remove the view from the DOM\n this._removeElement();\n\n if (shouldTriggerDetach) {\n this._isAttached = false;\n this.triggerMethod('detach', this);\n }\n\n // remove children after the remove to prevent extra paints\n this._removeChildren();\n\n this._isDestroyed = true;\n this._isRendered = false;\n\n // Destroy behaviors after _isDestroyed flag\n this._destroyBehaviors(options);\n\n this._deleteEntityEventHandlers();\n\n this.triggerMethod('destroy', this, options);\n this._triggerEventOnBehaviors('destroy', this, options);\n\n this.stopListening();\n\n return this;\n },\n\n // Equates to this.$el.remove\n _removeElement() {\n this.$el.off().removeData();\n this.Dom.detachEl(this.el, this.$el);\n },\n\n // This method binds the elements specified in the \"ui\" hash\n bindUIElements() {\n this._bindUIElements();\n this._bindBehaviorUIElements();\n\n return this;\n },\n\n // This method unbinds the elements specified in the \"ui\" hash\n unbindUIElements() {\n this._unbindUIElements();\n this._unbindBehaviorUIElements();\n\n return this;\n },\n\n getUI(name) {\n return this._getUI(name);\n },\n\n // Cache `childViewEvents` and `childViewTriggers`\n _buildEventProxies() {\n this._childViewEvents = this.normalizeMethods(_.result(this, 'childViewEvents'));\n this._childViewTriggers = _.result(this, 'childViewTriggers');\n this._eventPrefix = this._getEventPrefix();\n },\n\n _getEventPrefix() {\n const defaultPrefix = isEnabled('childViewEventPrefix') ? 'childview' : false;\n const prefix = _.result(this, 'childViewEventPrefix', defaultPrefix);\n\n return (prefix === false) ? prefix : prefix + ':';\n },\n\n _proxyChildViewEvents(view) {\n if (this._childViewEvents || this._childViewTriggers || this._eventPrefix) {\n this.listenTo(view, 'all', this._childViewEventHandler);\n }\n },\n\n _childViewEventHandler(eventName, ...args) {\n const childViewEvents = this._childViewEvents;\n\n // call collectionView childViewEvent if defined\n if (childViewEvents && childViewEvents[eventName]) {\n childViewEvents[eventName].apply(this, args);\n }\n\n // use the parent view's proxyEvent handlers\n const childViewTriggers = this._childViewTriggers;\n\n // Call the event with the proxy name on the parent layout\n if (childViewTriggers && childViewTriggers[eventName]) {\n this.triggerMethod(childViewTriggers[eventName], ...args);\n }\n\n if (this._eventPrefix) {\n this.triggerMethod(this._eventPrefix + eventName, ...args);\n }\n }\n};\n\n_.extend(ViewMixin, BehaviorsMixin, CommonMixin, DelegateEntityEventsMixin, TemplateRenderMixin, TriggersMixin, UIMixin);\n\nexport default ViewMixin;\n","// Region\n// ------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport MarionetteError from './utils/error';\nimport extend from './utils/extend';\nimport monitorViewEvents from './common/monitor-view-events';\nimport { renderView, destroyView } from './common/view';\nimport CommonMixin from './mixins/common';\nimport View from './view';\nimport DomApi, { setDomApi } from './config/dom';\n\nconst classErrorName = 'RegionError';\n\nconst ClassOptions = [\n 'allowMissingEl',\n 'parentEl',\n 'replaceElement'\n];\n\nconst Region = function(options) {\n this._setOptions(options, ClassOptions);\n\n this.cid = _.uniqueId(this.cidPrefix);\n\n // getOption necessary because options.el may be passed as undefined\n this._initEl = this.el = this.getOption('el');\n\n // Handle when this.el is passed in as a $ wrapped element.\n this.el = this.el instanceof Backbone.$ ? this.el[0] : this.el;\n\n if (!this.el) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'An \"el\" must be specified for a region.',\n url: 'marionette.region.html#additional-options'\n });\n }\n\n this.$el = this.getEl(this.el);\n\n this.initialize.apply(this, arguments);\n};\n\nRegion.extend = extend;\nRegion.setDomApi = setDomApi;\n\n// Region Methods\n// --------------\n\n_.extend(Region.prototype, CommonMixin, {\n Dom: DomApi,\n\n cidPrefix: 'mnr',\n replaceElement: false,\n _isReplaced: false,\n _isSwappingView: false,\n\n // This is a noop method intended to be overridden\n initialize() {},\n\n // Displays a view instance inside of the region. If necessary handles calling the `render`\n // method for you. Reads content directly from the `el` attribute.\n show(view, options) {\n if (!this._ensureElement(options)) {\n return;\n }\n\n view = this._getView(view, options);\n\n if (view === this.currentView) { return this; }\n\n this._isSwappingView = !!this.currentView;\n\n this.triggerMethod('before:show', this, view, options);\n\n // Assume an attached view is already in the region for pre-existing DOM\n if (!view._isAttached) {\n this.empty(options);\n }\n\n this._setupChildView(view);\n\n this.currentView = view;\n\n renderView(view);\n\n this._attachView(view, options);\n\n this.triggerMethod('show', this, view, options);\n\n this._isSwappingView = false;\n\n return this;\n },\n\n _setupChildView(view) {\n monitorViewEvents(view);\n\n this._proxyChildViewEvents(view);\n\n // We need to listen for if a view is destroyed in a way other than through the region.\n // If this happens we need to remove the reference to the currentView since once a view\n // has been destroyed we can not reuse it.\n view.on('destroy', this._empty, this);\n },\n\n _proxyChildViewEvents(view) {\n const parentView = this._parentView;\n\n if (!parentView) { return; }\n\n parentView._proxyChildViewEvents(view);\n },\n\n // If the regions parent view is not monitoring its attach/detach events\n _shouldDisableMonitoring() {\n return this._parentView && this._parentView.monitorViewEvents === false;\n },\n\n _attachView(view, options = {}) {\n const shouldTriggerAttach = !view._isAttached && this.Dom.hasEl(document.documentElement, this.el) && !this._shouldDisableMonitoring();\n const shouldReplaceEl = typeof options.replaceElement === 'undefined' ? !!_.result(this, 'replaceElement') : !!options.replaceElement;\n\n if (shouldTriggerAttach) {\n view.triggerMethod('before:attach', view);\n }\n\n if (shouldReplaceEl) {\n this._replaceEl(view);\n } else {\n this.attachHtml(view);\n }\n\n if (shouldTriggerAttach) {\n view._isAttached = true;\n view.triggerMethod('attach', view);\n }\n },\n\n _ensureElement(options = {}) {\n if (!_.isObject(this.el)) {\n this.$el = this.getEl(this.el);\n this.el = this.$el[0];\n // Make sure the $el contains only the el\n this.$el = this.Dom.getEl(this.el);\n }\n\n if (!this.$el || this.$el.length === 0) {\n const allowMissingEl = typeof options.allowMissingEl === 'undefined' ? !!_.result(this, 'allowMissingEl') : !!options.allowMissingEl;\n\n if (allowMissingEl) {\n return false;\n } else {\n throw new MarionetteError({\n name: classErrorName,\n message: `An \"el\" must exist in DOM for this region ${this.cid}`,\n url: 'marionette.region.html#additional-options'\n });\n }\n }\n return true;\n },\n\n _getView(view) {\n if (!view) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'The view passed is undefined and therefore invalid. You must pass a view instance to show.',\n url: 'marionette.region.html#showing-a-view'\n });\n }\n\n if (view._isDestroyed) {\n throw new MarionetteError({\n name: classErrorName,\n message: `View (cid: \"${view.cid}\") has already been destroyed and cannot be used.`,\n url: 'marionette.region.html#showing-a-view'\n });\n }\n\n if (view instanceof Backbone.View) {\n return view;\n }\n\n const viewOptions = this._getViewOptions(view);\n\n return new View(viewOptions);\n },\n\n // This allows for a template or a static string to be\n // used as a template\n _getViewOptions(viewOptions) {\n if (_.isFunction(viewOptions)) {\n return { template: viewOptions };\n }\n\n if (_.isObject(viewOptions)) {\n return viewOptions;\n }\n\n const template = function() { return viewOptions; };\n\n return { template };\n },\n\n // Override this method to change how the region finds the DOM element that it manages. Return\n // a jQuery selector object scoped to a provided parent el or the document if none exists.\n getEl(el) {\n const context = _.result(this, 'parentEl');\n\n if (context && _.isString(el)) {\n return this.Dom.findEl(context, el);\n }\n\n return this.Dom.getEl(el);\n },\n\n _replaceEl(view) {\n // always restore the el to ensure the regions el is present before replacing\n this._restoreEl();\n\n view.on('before:destroy', this._restoreEl, this);\n\n this.Dom.replaceEl(view.el, this.el);\n\n this._isReplaced = true;\n },\n\n // Restore the region's element in the DOM.\n _restoreEl() {\n // There is nothing to replace\n if (!this._isReplaced) {\n return;\n }\n\n const view = this.currentView;\n\n if (!view) {\n return;\n }\n\n this._detachView(view);\n\n this._isReplaced = false;\n },\n\n // Check to see if the region's el was replaced.\n isReplaced() {\n return !!this._isReplaced;\n },\n\n // Check to see if a view is being swapped by another\n isSwappingView() {\n return !!this._isSwappingView;\n },\n\n // Override this method to change how the new view is appended to the `$el` that the\n // region is managing\n attachHtml(view) {\n this.Dom.appendContents(this.el, view.el, {_$el: this.$el, _$contents: view.$el});\n },\n\n // Destroy the current view, if there is one. If there is no current view,\n // it will detach any html inside the region's `el`.\n empty(options = { allowMissingEl: true }) {\n const view = this.currentView;\n\n // If there is no view in the region we should only detach current html\n if (!view) {\n if (this._ensureElement(options)) {\n this.detachHtml();\n }\n return this;\n }\n\n this._empty(view, true);\n return this;\n },\n\n _empty(view, shouldDestroy) {\n view.off('destroy', this._empty, this);\n this.triggerMethod('before:empty', this, view);\n\n this._restoreEl();\n\n delete this.currentView;\n\n if (!view._isDestroyed) {\n if (shouldDestroy) {\n this.removeView(view);\n } else {\n this._detachView(view);\n }\n this._stopChildViewEvents(view);\n }\n\n this.triggerMethod('empty', this, view);\n },\n\n _stopChildViewEvents(view) {\n const parentView = this._parentView;\n\n if (!parentView) { return; }\n\n this._parentView.stopListening(view);\n },\n\n // Non-Marionette safe view.destroy\n destroyView(view) {\n if (view._isDestroyed) {\n return view;\n }\n\n destroyView(view, this._shouldDisableMonitoring());\n return view;\n },\n\n // Override this method to determine what happens when the view\n // is removed from the region when the view is not being detached\n removeView(view) {\n this.destroyView(view);\n },\n\n // Empties the Region without destroying the view\n // Returns the detached view\n detachView() {\n const view = this.currentView;\n\n if (!view) {\n return;\n }\n\n this._empty(view);\n\n return view;\n },\n\n _detachView(view) {\n const shouldTriggerDetach = view._isAttached && !this._shouldDisableMonitoring();\n const shouldRestoreEl = this._isReplaced;\n if (shouldTriggerDetach) {\n view.triggerMethod('before:detach', view);\n }\n\n if (shouldRestoreEl) {\n this.Dom.replaceEl(this.el, view.el);\n } else {\n this.detachHtml();\n }\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n view.triggerMethod('detach', view);\n }\n },\n\n // Override this method to change how the region detaches current content\n detachHtml() {\n this.Dom.detachContents(this.el, this.$el);\n },\n\n // Checks whether a view is currently present within the region. Returns `true` if there is\n // and `false` if no view is present.\n hasView() {\n return !!this.currentView;\n },\n\n // Reset the region by destroying any existing view and clearing out the cached `$el`.\n // The next time a view is shown via this region, the region will re-query the DOM for\n // the region's `el`.\n reset(options) {\n this.empty(options);\n\n if (this.$el) {\n this.el = this._initEl;\n }\n\n delete this.$el;\n return this;\n },\n\n _isDestroyed: false,\n\n isDestroyed() {\n return this._isDestroyed;\n },\n\n // Destroy the region, remove any child view\n // and remove the region from any associated view\n destroy(options) {\n if (this._isDestroyed) { return this; }\n\n this.triggerMethod('before:destroy', this, options);\n this._isDestroyed = true;\n\n this.reset(options);\n\n if (this._name) {\n this._parentView._removeReferences(this._name);\n }\n delete this._parentView;\n delete this._name;\n\n this.triggerMethod('destroy', this, options);\n this.stopListening();\n\n return this;\n }\n});\n\nexport default Region;\n","import _ from 'underscore';\nimport _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","// Collection View\n// ---------------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport MarionetteError from './utils/error';\nimport { renderView, destroyView } from './common/view';\nimport monitorViewEvents from './common/monitor-view-events';\nimport ChildViewContainer from './child-view-container';\nimport Region from './region';\nimport ViewMixin from './mixins/view';\nimport { setDomApi } from './config/dom';\nimport { setRenderer } from './config/renderer';\n\nconst classErrorName = 'CollectionViewError';\n\nconst ClassOptions = [\n 'behaviors',\n 'childView',\n 'childViewContainer',\n 'childViewEventPrefix',\n 'childViewEvents',\n 'childViewOptions',\n 'childViewTriggers',\n 'collectionEvents',\n 'emptyView',\n 'emptyViewOptions',\n 'events',\n 'modelEvents',\n 'sortWithCollection',\n 'template',\n 'templateContext',\n 'triggers',\n 'ui',\n 'viewComparator',\n 'viewFilter'\n];\n\n// A view that iterates over a Backbone.Collection\n// and renders an individual child view for each model.\nconst CollectionView = Backbone.View.extend({\n // flag for maintaining the sorted order of the collection\n sortWithCollection: true,\n\n // constructor\n constructor(options) {\n this._setOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this._initChildViewStorage();\n this._initBehaviors();\n\n Backbone.View.prototype.constructor.apply(this, arguments);\n\n // Init empty region\n this.getEmptyRegion();\n\n this.delegateEntityEvents();\n\n this._triggerEventOnBehaviors('initialize', this, options);\n },\n\n // Internal method to set up the `children` object for storing all of the child views\n // `_children` represents all child views\n // `children` represents only views filtered to be shown\n _initChildViewStorage() {\n this._children = new ChildViewContainer();\n this.children = new ChildViewContainer();\n },\n\n // Create an region to show the emptyView\n getEmptyRegion() {\n if (this._emptyRegion && !this._emptyRegion.isDestroyed()) {\n return this._emptyRegion;\n }\n\n this._emptyRegion = new Region({ el: this.el, replaceElement: false });\n\n this._emptyRegion._parentView = this;\n\n return this._emptyRegion;\n },\n\n // Configured the initial events that the collection view binds to.\n _initialEvents() {\n if (this._isRendered) { return; }\n\n this.listenTo(this.collection, {\n 'sort': this._onCollectionSort,\n 'reset': this._onCollectionReset,\n 'update': this._onCollectionUpdate\n });\n },\n\n // Internal method. This checks for any changes in the order of the collection.\n // If the index of any view doesn't match, it will re-sort.\n _onCollectionSort(collection, { add, merge, remove }) {\n if (!this.sortWithCollection || this.viewComparator === false) {\n return;\n }\n\n // If the data is changing we will handle the sort later in `_onCollectionUpdate`\n if (add || remove || merge) {\n return;\n }\n\n // If the only thing happening here is sorting, sort.\n this.sort();\n },\n\n _onCollectionReset() {\n this._destroyChildren();\n\n this._addChildModels(this.collection.models);\n\n this.sort();\n },\n\n // Handle collection update model additions and removals\n _onCollectionUpdate(collection, options) {\n const changes = options.changes;\n\n // Remove first since it'll be a shorter array lookup.\n const removedViews = changes.removed.length && this._removeChildModels(changes.removed);\n\n this._addedViews = changes.added.length && this._addChildModels(changes.added);\n\n this._detachChildren(removedViews);\n\n this.sort();\n\n // Destroy removed child views after all of the render is complete\n this._removeChildViews(removedViews);\n },\n\n _removeChildModels(models) {\n return _.reduce(models, (views, model) => {\n const removeView = this._removeChildModel(model);\n\n if (removeView) { views.push(removeView); }\n\n return views;\n }, []);\n },\n\n _removeChildModel(model) {\n const view = this._children.findByModel(model);\n\n if (view) { this._removeChild(view); }\n\n return view;\n },\n\n _removeChild(view) {\n this.triggerMethod('before:remove:child', this, view);\n\n this.children._remove(view);\n this._children._remove(view);\n\n this.triggerMethod('remove:child', this, view);\n },\n\n // Added views are returned for consistency with _removeChildModels\n _addChildModels(models) {\n return _.map(models, this._addChildModel.bind(this));\n },\n\n _addChildModel(model) {\n const view = this._createChildView(model);\n\n this._addChild(view);\n\n return view;\n },\n\n _createChildView(model) {\n const ChildView = this._getChildView(model);\n const childViewOptions = this._getChildViewOptions(model);\n const view = this.buildChildView(model, ChildView, childViewOptions);\n\n return view;\n },\n\n _addChild(view, index) {\n this.triggerMethod('before:add:child', this, view);\n\n this._setupChildView(view);\n this._children._add(view, index);\n this.children._add(view, index);\n\n this.triggerMethod('add:child', this, view);\n },\n\n // Retrieve the `childView` class\n // The `childView` property can be either a view class or a function that\n // returns a view class. If it is a function, it will receive the model that\n // will be passed to the view instance (created from the returned view class)\n _getChildView(child) {\n let childView = this.childView;\n\n if (!childView) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'A \"childView\" must be specified',\n url: 'marionette.collectionview.html#collectionviews-childview'\n });\n }\n\n childView = this._getView(childView, child);\n\n if (!childView) {\n throw new MarionetteError({\n name: classErrorName,\n message: '\"childView\" must be a view class or a function that returns a view class',\n url: 'marionette.collectionview.html#collectionviews-childview'\n });\n }\n\n return childView;\n },\n\n // First check if the `view` is a view class (the common case)\n // Then check if it's a function (which we assume that returns a view class)\n _getView(view, child) {\n if (view.prototype instanceof Backbone.View || view === Backbone.View) {\n return view;\n } else if (_.isFunction(view)) {\n return view.call(this, child);\n }\n },\n\n _getChildViewOptions(child) {\n if (_.isFunction(this.childViewOptions)) {\n return this.childViewOptions(child);\n }\n\n return this.childViewOptions;\n },\n\n // Build a `childView` for a model in the collection.\n // Override to customize the build\n buildChildView(child, ChildViewClass, childViewOptions) {\n const options = _.extend({model: child}, childViewOptions);\n return new ChildViewClass(options);\n },\n\n _setupChildView(view) {\n monitorViewEvents(view);\n\n // We need to listen for if a view is destroyed in a way other\n // than through the CollectionView.\n // If this happens we need to remove the reference to the view\n // since once a view has been destroyed we can not reuse it.\n view.on('destroy', this.removeChildView, this);\n\n // set up the child view event forwarding\n this._proxyChildViewEvents(view);\n },\n\n // used by ViewMixin's `_childViewEventHandler`\n _getImmediateChildren() {\n return this.children._views;\n },\n\n // Overriding Backbone.View's `setElement` to handle\n // if an el was previously defined. If so, the view might be\n // attached on setElement.\n setElement() {\n Backbone.View.prototype.setElement.apply(this, arguments);\n\n this._isAttached = this.Dom.hasEl(document.documentElement, this.el);\n\n return this;\n },\n\n // Render children views.\n render() {\n if (this._isDestroyed) { return this; }\n this.triggerMethod('before:render', this);\n\n this._destroyChildren();\n\n if (this.collection) {\n this._addChildModels(this.collection.models);\n this._initialEvents();\n }\n\n const template = this.getTemplate();\n\n if (template) {\n this._renderTemplate(template);\n this.bindUIElements();\n }\n this._getChildViewContainer();\n this.sort();\n\n this._isRendered = true;\n\n this.triggerMethod('render', this);\n return this;\n },\n\n // Get a container within the template to add the children within\n _getChildViewContainer() {\n const childViewContainer = _.result(this, 'childViewContainer');\n this.$container = childViewContainer ? this.$(childViewContainer) : this.$el;\n\n if (!this.$container.length) {\n throw new MarionetteError({\n name: classErrorName,\n message: `The specified \"childViewContainer\" was not found: ${childViewContainer}`,\n url: 'marionette.collectionview.html#defining-the-childviewcontainer'\n });\n }\n },\n\n // Sorts the children then filters and renders the results.\n sort() {\n this._sortChildren();\n\n this.filter();\n\n return this;\n },\n\n // Sorts views by viewComparator and sets the children to the new order\n _sortChildren() {\n if (!this._children.length) { return; }\n\n let viewComparator = this.getComparator();\n\n if (!viewComparator) { return; }\n\n // If children are sorted prevent added to end perf\n delete this._addedViews;\n\n this.triggerMethod('before:sort', this);\n\n this._children._sort(viewComparator, this);\n\n this.triggerMethod('sort', this);\n },\n\n // Sets the view's `viewComparator` and applies the sort if the view is ready.\n // To prevent the render pass `{ preventRender: true }` as the 2nd argument.\n setComparator(comparator, {preventRender} = {}) {\n const comparatorChanged = this.viewComparator !== comparator;\n const shouldSort = comparatorChanged && !preventRender;\n\n this.viewComparator = comparator;\n\n if (shouldSort) {\n this.sort();\n }\n\n return this;\n },\n\n // Clears the `viewComparator` and follows the same rules for rendering as `setComparator`.\n removeComparator(options) {\n return this.setComparator(null, options);\n },\n\n // If viewComparator is overriden it will be returned here.\n // Additionally override this function to provide custom\n // viewComparator logic\n getComparator() {\n if (this.viewComparator) { return this.viewComparator }\n\n if (!this.sortWithCollection || this.viewComparator === false || !this.collection) {\n return false;\n }\n\n return this._viewComparator;\n },\n\n // Default internal view comparator that order the views by\n // the order of the collection\n _viewComparator(view) {\n return this.collection.indexOf(view.model);\n },\n\n // This method filters the children views and renders the results\n filter() {\n if (this._isDestroyed) { return this; }\n\n this._filterChildren();\n\n this._renderChildren();\n\n return this;\n },\n\n _filterChildren() {\n if (!this._children.length) { return; }\n\n const viewFilter = this._getFilter();\n\n if (!viewFilter) {\n const shouldReset = this.children.length !== this._children.length;\n\n this.children._set(this._children._views, shouldReset);\n\n return;\n }\n\n // If children are filtered prevent added to end perf\n delete this._addedViews;\n\n this.triggerMethod('before:filter', this);\n\n const attachViews = [];\n const detachViews = [];\n\n _.each(this._children._views, (view, key, children) => {\n (viewFilter.call(this, view, key, children) ? attachViews : detachViews).push(view);\n });\n\n this._detachChildren(detachViews);\n\n // reset children\n this.children._set(attachViews, true);\n\n this.triggerMethod('filter', this, attachViews, detachViews);\n },\n\n // This method returns a function for the viewFilter\n _getFilter() {\n const viewFilter = this.getFilter();\n\n if (!viewFilter) { return false; }\n\n if (_.isFunction(viewFilter)) {\n return viewFilter;\n }\n\n // Support filter predicates `{ fooFlag: true }`\n if (_.isObject(viewFilter)) {\n const matcher = _.matches(viewFilter);\n return function(view) {\n return matcher(view.model && view.model.attributes);\n };\n }\n\n // Filter by model attribute\n if (_.isString(viewFilter)) {\n return function(view) {\n return view.model && view.model.get(viewFilter);\n };\n }\n\n throw new MarionetteError({\n name: classErrorName,\n message: '\"viewFilter\" must be a function, predicate object literal, a string indicating a model attribute, or falsy',\n url: 'marionette.collectionview.html#defining-the-viewfilter'\n });\n },\n\n // Override this function to provide custom\n // viewFilter logic\n getFilter() {\n return this.viewFilter;\n },\n\n // Sets the view's `viewFilter` and applies the filter if the view is ready.\n // To prevent the render pass `{ preventRender: true }` as the 2nd argument.\n setFilter(filter, {preventRender} = {}) {\n const filterChanged = this.viewFilter !== filter;\n const shouldRender = filterChanged && !preventRender;\n\n this.viewFilter = filter;\n\n if (shouldRender) {\n this.filter();\n }\n\n return this;\n },\n\n // Clears the `viewFilter` and follows the same rules for rendering as `setFilter`.\n removeFilter(options) {\n return this.setFilter(null, options);\n },\n\n _detachChildren(detachingViews) {\n _.each(detachingViews, this._detachChildView.bind(this));\n },\n\n _detachChildView(view) {\n const shouldTriggerDetach = view._isAttached && this.monitorViewEvents !== false;\n if (shouldTriggerDetach) {\n view.triggerMethod('before:detach', view);\n }\n\n this.detachHtml(view);\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n view.triggerMethod('detach', view);\n }\n },\n\n // Override this method to change how the collectionView detaches a child view\n detachHtml(view) {\n this.Dom.detachEl(view.el, view.$el);\n },\n\n _renderChildren() {\n const views = this._addedViews || this.children._views;\n\n this.triggerMethod('before:render:children', this, views);\n\n if (this.isEmpty()) {\n this._showEmptyView();\n } else {\n this._destroyEmptyView();\n\n const els = this._getBuffer(views);\n\n this._attachChildren(els, views);\n }\n\n delete this._addedViews;\n\n this.triggerMethod('render:children', this, views);\n },\n\n // Renders each view and creates a fragment buffer from them\n _getBuffer(views) {\n const elBuffer = this.Dom.createBuffer();\n\n _.each(views, view => {\n renderView(view);\n this.Dom.appendContents(elBuffer, view.el, {_$contents: view.$el});\n });\n\n return elBuffer;\n },\n\n _attachChildren(els, views) {\n const shouldTriggerAttach = this._isAttached && this.monitorViewEvents !== false;\n\n views = shouldTriggerAttach ? views : [];\n\n _.each(views, view => {\n if (view._isAttached) { return; }\n view.triggerMethod('before:attach', view);\n });\n\n this.attachHtml(els, this.$container);\n\n _.each(views, view => {\n if (view._isAttached) { return; }\n view._isAttached = true;\n view.triggerMethod('attach', view);\n });\n },\n\n // Override this method to do something other than `.append`.\n // You can attach any HTML at this point including the els.\n attachHtml(els, $container) {\n this.Dom.appendContents($container[0], els, {_$el: $container});\n },\n\n isEmpty() {\n return !this.children.length;\n },\n\n _showEmptyView() {\n const EmptyView = this._getEmptyView();\n\n if (!EmptyView) {\n return;\n }\n\n const options = this._getEmptyViewOptions();\n\n const emptyRegion = this.getEmptyRegion();\n\n emptyRegion.show(new EmptyView(options));\n },\n\n // Retrieve the empty view class\n _getEmptyView() {\n const emptyView = this.emptyView;\n\n if (!emptyView) { return; }\n\n return this._getView(emptyView);\n },\n\n // Remove the emptyView\n _destroyEmptyView() {\n const emptyRegion = this.getEmptyRegion();\n // Only empty if a view is show so the region\n // doesn't detach any other unrelated HTML\n if (emptyRegion.hasView()) {\n emptyRegion.empty();\n }\n },\n\n //\n _getEmptyViewOptions() {\n const emptyViewOptions = this.emptyViewOptions || this.childViewOptions;\n\n if (_.isFunction(emptyViewOptions)) {\n return emptyViewOptions.call(this);\n }\n\n return emptyViewOptions;\n },\n\n swapChildViews(view1, view2) {\n if (!this._children.hasView(view1) || !this._children.hasView(view2)) {\n throw new MarionetteError({\n name: classErrorName,\n message: 'Both views must be children of the collection view to swap.',\n url: 'marionette.collectionview.html#swapping-child-views'\n });\n }\n\n this._children._swap(view1, view2);\n this.Dom.swapEl(view1.el, view2.el);\n\n // If the views are not filtered the same, refilter\n if (this.children.hasView(view1) !== this.children.hasView(view2)) {\n this.filter();\n } else {\n this.children._swap(view1, view2);\n }\n\n return this;\n },\n\n // Render the child's view and add it to the HTML for the collection view at a given index, based on the current sort\n addChildView(view, index) {\n if (!view || view._isDestroyed) {\n return view;\n }\n\n if (!this._isRendered) {\n this.render();\n }\n\n const hasIndex = (typeof index !== 'undefined');\n\n // Only cache views if added to the end\n if (!hasIndex || index >= this._children.length) {\n this._addedViews = [view];\n }\n this._addChild(view, index);\n\n if (hasIndex) {\n this._renderChildren();\n } else {\n this.sort();\n }\n\n return view;\n },\n\n // Detach a view from the children. Best used when adding a\n // childView from `addChildView`\n detachChildView(view) {\n this.removeChildView(view, { shouldDetach: true });\n\n return view;\n },\n\n // Remove the child view and destroy it. Best used when adding a\n // childView from `addChildView`\n // The options argument is for internal use only\n removeChildView(view, options) {\n if (!view) {\n return view;\n }\n\n this._removeChildView(view, options);\n\n this._removeChild(view);\n\n if (this.isEmpty()) {\n this._showEmptyView();\n }\n\n return view;\n },\n\n _removeChildViews(views) {\n _.each(views, this._removeChildView.bind(this));\n },\n\n _removeChildView(view, {shouldDetach} = {}) {\n view.off('destroy', this.removeChildView, this);\n\n if (shouldDetach) {\n this._detachChildView(view);\n } else {\n this._destroyChildView(view);\n }\n\n this.stopListening(view);\n },\n\n _destroyChildView(view) {\n if (view._isDestroyed) {\n return;\n }\n\n const shouldDisableEvents = this.monitorViewEvents === false;\n destroyView(view, shouldDisableEvents);\n },\n\n // called by ViewMixin destroy\n _removeChildren() {\n this._destroyChildren();\n const emptyRegion = this.getEmptyRegion();\n emptyRegion.destroy();\n delete this._addedViews;\n },\n\n // Destroy the child views that this collection view is holding on to, if any\n _destroyChildren() {\n if (!this._children.length) {\n return;\n }\n\n this.triggerMethod('before:destroy:children', this);\n if (this.monitorViewEvents === false) {\n this.Dom.detachContents(this.el, this.$el);\n }\n\n this._removeChildViews(this._children._views);\n\n // After all children have been destroyed re-init the container\n this._children._init();\n this.children._init();\n\n this.triggerMethod('destroy:children', this);\n }\n}, {\n setDomApi,\n setRenderer\n});\n\n_.extend(CollectionView.prototype, ViewMixin);\n\nexport default CollectionView;\n","// Behavior\n// --------\n\n// A Behavior is an isolated set of DOM /\n// user interactions that can be mixed into any View.\n// Behaviors allow you to blackbox View specific interactions\n// into portable logical chunks, keeping your views simple and your code DRY.\n\nimport _ from 'underscore';\nimport extend from './utils/extend';\nimport getNamespacedEventName from './utils/get-namespaced-event-name';\nimport CommonMixin from './mixins/common';\nimport DelegateEntityEventsMixin from './mixins/delegate-entity-events';\nimport TriggersMixin from './mixins/triggers';\nimport UIMixin from './mixins/ui';\n\nconst ClassOptions = [\n 'collectionEvents',\n 'events',\n 'modelEvents',\n 'triggers',\n 'ui'\n];\n\nconst Behavior = function(options, view) {\n // Setup reference to the view.\n // this comes in handle when a behavior\n // wants to directly talk up the chain\n // to the view.\n this.view = view;\n\n this._setOptions(options, ClassOptions);\n this.cid = _.uniqueId(this.cidPrefix);\n\n // Construct an internal UI hash using the behaviors UI\n // hash combined and overridden by the view UI hash.\n // This allows the user to use UI hash elements defined\n // in the parent view as well as those defined in the behavior.\n // This order will help the reuse and share of a behavior\n // between multiple views, while letting a view override\n // a selector under an UI key.\n this.ui = _.extend({}, _.result(this, 'ui'), _.result(view, 'ui'));\n\n // Proxy view triggers\n this.listenTo(view, 'all', this.triggerMethod);\n\n this.initialize.apply(this, arguments);\n};\n\nBehavior.extend = extend;\n\n// Behavior Methods\n// --------------\n\n_.extend(Behavior.prototype, CommonMixin, DelegateEntityEventsMixin, TriggersMixin, UIMixin, {\n cidPrefix: 'mnb',\n\n // This is a noop method intended to be overridden\n initialize() {},\n\n // proxy behavior $ method to the view\n // this is useful for doing jquery DOM lookups\n // scoped to behaviors view.\n $() {\n return this.view.$.apply(this.view, arguments);\n },\n\n // Stops the behavior from listening to events.\n destroy() {\n this.stopListening();\n\n this.view._removeBehavior(this);\n\n this._deleteEntityEventHandlers();\n\n return this;\n },\n\n proxyViewProperties() {\n this.$el = this.view.$el;\n this.el = this.view.el;\n\n return this;\n },\n\n bindUIElements() {\n this._bindUIElements();\n\n return this;\n },\n\n unbindUIElements() {\n this._unbindUIElements();\n\n return this;\n },\n\n getUI(name) {\n return this._getUI(name);\n },\n\n // Handle `modelEvents`, and `collectionEvents` configuration\n delegateEntityEvents() {\n this._delegateEntityEvents(this.view.model, this.view.collection);\n\n return this;\n },\n\n undelegateEntityEvents() {\n this._undelegateEntityEvents(this.view.model, this.view.collection);\n\n return this;\n },\n\n _getEvents() {\n if (!this.events) { return; }\n\n // Normalize behavior events hash to allow\n // a user to use the @ui. syntax.\n const behaviorEvents = this.normalizeUIKeys(_.result(this, 'events'));\n\n // binds the handler to the behavior and builds a unique eventName\n return _.reduce(behaviorEvents, (events, behaviorHandler, key) => {\n if (!_.isFunction(behaviorHandler)) {\n behaviorHandler = this[behaviorHandler];\n }\n if (!behaviorHandler) { return events; }\n key = getNamespacedEventName(key, this.cid);\n events[key] = behaviorHandler.bind(this);\n return events;\n }, {});\n },\n\n // Internal method to build all trigger handlers for a given behavior\n _getTriggers() {\n if (!this.triggers) { return; }\n\n // Normalize behavior triggers hash to allow\n // a user to use the @ui. syntax.\n const behaviorTriggers = this.normalizeUIKeys(_.result(this, 'triggers'));\n\n return this._getViewTriggers(this.view, behaviorTriggers);\n }\n});\n\nexport default Behavior;\n","// Application\n// -----------\n\nimport _ from 'underscore';\nimport extend from './utils/extend';\nimport buildRegion from './common/build-region';\nimport CommonMixin from './mixins/common';\nimport DestroyMixin from './mixins/destroy';\nimport RadioMixin from './mixins/radio';\nimport Region from './region';\n\nconst ClassOptions = [\n 'channelName',\n 'radioEvents',\n 'radioRequests',\n 'region',\n 'regionClass'\n];\n\nconst Application = function(options) {\n this._setOptions(options, ClassOptions);\n this.cid = _.uniqueId(this.cidPrefix);\n this._initRegion();\n this._initRadio();\n this.initialize.apply(this, arguments);\n};\n\nApplication.extend = extend;\n\n// Application Methods\n// --------------\n\n_.extend(Application.prototype, CommonMixin, DestroyMixin, RadioMixin, {\n cidPrefix: 'mna',\n\n // This is a noop method intended to be overridden\n initialize() {},\n\n // Kick off all of the application's processes.\n start(options) {\n this.triggerMethod('before:start', this, options);\n this.triggerMethod('start', this, options);\n return this;\n },\n\n regionClass: Region,\n\n _initRegion() {\n const region = this.region;\n\n if (!region) { return; }\n\n const defaults = {\n regionClass: this.regionClass\n };\n\n this._region = buildRegion(region, defaults);\n },\n\n getRegion() {\n return this._region;\n },\n\n showView(view, ...args) {\n const region = this.getRegion();\n region.show(view, ...args);\n return view;\n },\n\n getView() {\n return this.getRegion().currentView;\n }\n});\n\nexport default Application;\n","import {version} from '../package.json';\n\nimport proxy from './utils/proxy';\nimport extend from './utils/extend';\n\nimport {\n bindEvents as _bindEvents,\n unbindEvents as _unbindEvents\n} from './common/bind-events';\nimport {\n bindRequests as _bindRequests,\n unbindRequests as _unbindRequests\n} from './common/bind-requests';\nimport _getOption from './common/get-option';\nimport _mergeOptions from './common/merge-options';\nimport monitorViewEvents from './common/monitor-view-events';\nimport _normalizeMethods from './common/normalize-methods';\nimport _triggerMethod from './common/trigger-method';\n\nimport Events from './mixins/events';\n\nimport MnObject from './object';\nimport View from './view';\nimport CollectionView from './collection-view';\nimport Behavior from './behavior';\nimport Region from './region';\nimport Application from './application';\n\nimport DomApi from './config/dom';\n\nimport {\n isEnabled,\n setEnabled\n} from './config/features';\n\n// Utilities\n\nexport const bindEvents = proxy(_bindEvents);\nexport const unbindEvents = proxy(_unbindEvents);\nexport const bindRequests = proxy(_bindRequests);\nexport const unbindRequests = proxy(_unbindRequests);\nexport const mergeOptions = proxy(_mergeOptions);\nexport const getOption = proxy(_getOption);\nexport const normalizeMethods = proxy(_normalizeMethods);\nexport const triggerMethod = proxy(_triggerMethod);\n\n\n// Configuration\n\nexport const setDomApi = function(mixin) {\n CollectionView.setDomApi(mixin);\n Region.setDomApi(mixin);\n View.setDomApi(mixin);\n};\nexport const setRenderer = function(renderer) {\n CollectionView.setRenderer(renderer);\n View.setRenderer(renderer);\n};\n\nexport {\n View,\n CollectionView,\n MnObject,\n Region,\n Behavior,\n Application,\n isEnabled,\n setEnabled,\n monitorViewEvents,\n Events,\n extend,\n DomApi,\n version as VERSION\n};\n"]}