{"version":3,"sources":["src/common/trigger-method.js","src/common/monitor-view-events.js","src/common/bind-events.js","src/common/bind-requests.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/next-child-view-container.js","src/utils/proxy.js","src/utils/extend.js","src/utils/deprecate.js","src/common/is-node-attached.js","src/common/merge-options.js","src/common/get-option.js","src/common/normalize-methods.js","src/error.js","src/utils/set-options.js","src/mixins/common.js","src/mixins/radio.js","src/object.js","src/template-cache.js","src/utils/invoke.js","src/mixins/delegate-entity-events.js","src/utils/get-namespaced-event-name.js","src/mixins/ui.js","src/mixins/view.js","src/region.js","src/mixins/regions.js","src/config/renderer.js","src/view.js","src/utils/emulate-collection.js","src/child-view-container.js","src/collection-view.js","src/next-collection-view.js","src/composite-view.js","src/behavior.js","src/application.js","src/app-router.js","src/backbone.marionette.js","src/config/behaviors-lookup.js"],"names":["getEventName","match","prefix","eventName","toUpperCase","triggerMethod","event","args","Array","_len","_key","arguments","methodName","getOnMethodName","method","getOption","call","this","result","_","isFunction","apply","trigger","triggerMethodOn","context","_len2","_key2","triggerMethodChildren","view","shouldTrigger","_getImmediateChildren","each","child","shouldTriggerAttach","_isAttached","shouldAttach","shouldTriggerDetach","shouldDetach","triggerDOMRefresh","_isRendered","triggerDOMRemove","handleBeforeAttach","handleAttach","handleBeforeDetach","handleDetach","handleBeforeRender","handleRender","monitorViewEvents","_areViewEventsMonitored","on","bindFromStrings","target","entity","evt","methods","actionName","methodNames","split","length","MarionetteError","iterateEvents","bindings","isObject","isString","bindEvents","unbindEvents","stopListening","iterateReplies","channel","normalizedRadioRequests","normalizeMethods","bindRequests","unbindRequests","stopReplying","getBehaviorClass","options","key","behaviorClass","Marionette","Behaviors","behaviorsLookup","parseBehaviors","behaviors","chain","map","BehaviorClass","behavior","nestedBehaviors","concat","flatten","value","isEnabled","name","FEATURES","buildViewTrigger","triggerDef","shouldPreventDefault","preventDefault","shouldStopPropagation","stopPropagation","getEl","el","Backbone","$","setDomApi","mixin","prototype","Dom","extend","renderView","supportsRenderLifecycle","render","destroyView","destroy","supportsDestroyLifecycle","_shouldDisableEvents","remove","_isDestroyed","buildRegionFromDefinition","definition","defaults","opts","buildRegionFromObject","regionClass","selector","RegionClass","omit","stringComparator","comparator","model","get","proxy","Model","deprecate","message","test","prev","next","url","DEV_MODE","undefined","_cache","_warn","_console","console","warn","log","noop","isNodeAttached","document","documentElement","contains","parentNode","mergeOptions","keys","option","optionName","hash","reduce","normalizedHash","_this","splitter","memoize","replace","errorProps","Error","error","pick","captureStackTrace","urlRoot","CommonMixin","RadioMixin","channelName","Radio","_channel","radioEvents","radioRequests","_destroyRadio","ClassOptions","MarionetteObject","hasOwnProperty","_setOptions","_setCid","_initRadio","initialize","Events","cid","uniqueId","cidPrefix","TemplateCache","templateId","cachedTemplate","templateCaches","load","i","compiledTemplate","template","loadTemplate","compileTemplate","$template","html","rawTemplate","_invoke","invokeMap","invoke","BehaviorsMixin","_behaviors","_getBehaviors","triggers","memo","_triggers","events","_events","undelegate","without","DelegateEntityEventsMixin","collection","modelEvents","collectionEvents","delegateEventSplitter","getNamespacedEventName","namespace","TriggersMixin","normalizeUIKeys","ui","val","normalizeUIString","uiString","r","slice","normalizeUIValues","properties","isArray","property","propertyVal","UIMixin","uiBindings","_getUIBindings","_uiBindings","_ui","$el","_this2","DomApi","createDocumentFragment","find","childEl","detach","newEl","oldEl","parent","replaceChild","el1","el2","parent1","parent2","next1","nextSibling","next2","insertBefore","contents","_$el","_ref$_$el","_$contents","_ref$_$contents","append","hasChildNodes","ViewMixin","eventsArg","_proxyBehaviorViewProperties","_buildEventProxies","viewEvents","_getEvents","combinedEvents","_getBehaviorEvents","_getBehaviorTriggers","getTriggers","View","delegateEvents","_getViewTriggers","_delegateEntityEvents","_delegateBehaviorEntityEvents","_undelegateEntityEvents","_undelegateBehaviorEntityEvents","unbindUIElements","_removeElement","_removeChildren","_destroyBehaviors","off","removeData","detachEl","_bindUIElements","_bindBehaviorUIElements","_unbindUIElements","_unbindBehaviorUIElements","_getUI","ret","_triggerEventOnBehaviors","_childViewEvents","_childViewTriggers","listenTo","_childViewEventHandler","childViewEvents","childViewTriggers","childEventName","Region","_initEl","_ensureElement","_getView","currentView","_isSwappingView","empty","_setupChildView","_attachView","_proxyChildViewEvents","_empty","parentView","_parentView","_shouldDisableMonitoring","shouldReplaceEl","replaceElement","_replaceEl","attachHtml","allowMissingEl","viewOptions","_getViewOptions","findEl","_restoreEl","replaceEl","_isReplaced","_detachView","appendContents","detachHtml","shouldDestroy","preventDestroy","removeView","_stopChildViewEvents","shouldRestoreEl","detachContents","reset","_name","_removeReferences","buildRegion","RegionsMixin","regions","_regions","addRegions","isEmpty","_addRegions","regionDefinitions","partial","_addRegion","region","_removeRegion","_getRegions","bind","getRegions","getRegion","clone","show","detachView","Renderer","data","_initBehaviors","_initRegions","constructor","delegateEntityEvents","serializeModel","serializeCollection","attributes","setElement","hasContents","bindUIElements","_reInitRegions","_renderTemplate","getTemplate","mixinTemplateContext","serializeData","_renderHtml","attachElContent","templateContext","setContents","removeRegions","compact","renderer","emulateCollection","object","listProperty","list","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","add","values","customIndex","_add","viewCid","findByModelCid","modelCid","findByCid","index","_remove","some","size","CollectionView","once","_initialEvents","_initChildViewStorage","_bufferedChildren","_isBuffering","triggerOnChildren","attachBuffer","_createBuffer","children","_onCollectionAdd","_onCollectionUpdate","sort","_sortViews","at","indexOf","filter","_filteredSortedModels","_shouldAddChild","_destroyEmptyView","_addChild","changes","_removeChildModels","removed","models","removedViews","_getRemovedViews","_updateIndices","_showEmptyView","removingViews","findByModel","_removeChildView","push","_renderChildren","preventRender","canBeRendered","filterChanged","previousModels","_applyModelDeltas","setFilter","currentIds","removeModels","prevModel","_showingEmptyView","filteredOutModels","elsToReorder","viewEls","_index","elBuffer","createBuffer","_appendReorderedChildren","reorderOnSort","reorder","item","_this4","resortView","_destroyChildren","processedModels","_startBuffering","_showCollection","_endBuffering","ChildView","_getChildView","childViewOptions","_getChildViewOptions","buildChildView","addedAt","viewComparator","getViewComparator","Math","min","max","addedModel","_sortModelsBy","splice","_filterModels","_this5","sortBy","EmptyView","_getEmptyView","emptyViewOptions","_emptyViewIndex","addChildView","emptyView","childView","_createView","increment","laterView","ChildViewClass","collectionView","buffer","b","_insertBefore","_insertAfter","beforeEl","siblings","before","ChildViewContainer","_init","_viewsByCid","_sortBy","sortedViews","_set","view1","view2","view1Index","findIndexByView","view2Index","swapView","getEmptyRegion","_emptyRegion","isDestroyed","_onCollectionSort","_onCollectionReset","_ref","merge","sortWithCollection","_addedViews","added","_addChildModels","_detachChildren","_showChildren","_removeChildViews","_removeChildModel","_removeChild","_addChildModel","_createChildView","removeChildView","_sortChildren","allViewsFiltered","_getEmptyViewOptions","emptyRegion","hasView","getComparator","_sort","shouldSort","setComparator","_viewComparator","filteredViews","_filterChildren","viewFilter","_getFilter","addedViews","attachViews","detachViews","getFilter","matcher","matches","shouldRender","detachingViews","_detachChildView","els","_getBuffer","_attachChildren","_swap","swapEl","hasEl","_destroyChildView","CompositeView","renderChildren","_isRendering","resetChildViewContainer","compositeView","$container","getChildViewContainer","containerView","$childViewContainer","container","childViewContainer","charAt","substr","MixinFromView","Behavior","_removeBehavior","behaviorEvents","behaviorHandler","behaviorTriggers","Application","_initRegion","_region","AppRouter","Router","appRoutes","controller","_getController","processAppRoutes","_processOnRoute","route","_addAppRoute","routeName","routeArgs","onRoute","routePath","invert","routeNames","reverse","previousMarionette","noConflict","setEnabled","state","NextCollectionView","Object","VERSION"],"mappings":";;;;;;;;;;;wUAWA,SAASA,EAAaC,EAAOC,EAAQC,UAC5BA,EAAUC,cAcnB,SAAgBC,EAAcC,8BAAUC,EAAMC,MAAAC,EAAA,EAAAA,EAAA,EAAA,GAAAC,EAAA,EAAAA,EAAAD,EAAAC,MAAAA,EAAA,GAAAC,UAAAD,OAEtCE,EAAaC,EAAgBP,GAC7BQ,EAASC,EAAUC,KAAK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Uhe,UAAWgE,GC7C9B,IAAMgb,GAAqBpf,EAASxB,WAC9BA,GAAawB,EAASxB,qBAM5BA,GAAW6gB,WAAa,oBACb7gB,WAAa4gB,GACfzkB,MAIT6D,GAAWd,WAAamE,EAAMnE,GAC9Bc,GAAWb,aAAekE,EAAMlE,GAChCa,GAAWP,aAAe4D,EAAM5D,GAChCO,GAAWN,eAAiB2D,EAAM3D,GAClCM,GAAW2E,aAAetB,EAAMsB,GAChC3E,GAAW/D,UAAYoH,EAAMpH,GAC7B+D,GAAWR,iBAAmB6D,EAAM7D,GACpCQ,GAAW8B,OAASA,EACpB9B,GAAWsE,eAAiBA,EAC5BtE,GAAWuD,UAAYA,EACvBvD,GAAWzE,cAAgB8H,EAAM9H,GACjCyE,GAAWvD,gBAAkBA,EAC7BuD,GAAWa,UAAYA,EACvBb,GAAW8gB,WpCjEX,SAAoBhgB,EAAMigB,UACjBhgB,GAASD,GAAQigB,GoCiE1B/gB,GAAW/B,kBAAoBA,EAE/B+B,GAAWC,aACXD,GAAWC,UAAUC,gBCtErB,iBACQ,IAAIrB,WACC,uDACJ,6CDsETmB,GAAWyf,YAAcA,GACzBzf,GAAW4f,UAAYA,GACvB5f,GAAW0R,SAAWA,GACtB1R,GAAW+G,cAAgBA,EAC3B/G,GAAWsM,KAAOA,GAClBtM,GAAWwU,eAAiBA,GAC5BxU,GAAWghB,mBAAqBA,GAChChhB,GAAWse,cAAgBA,GAC3Bte,GAAWof,SAAWA,GACtBpf,GAAWkO,OAASA,GACpBlO,GAAWuF,MAAQ1G,EACnBmB,GAAWihB,OAAS5a,EAGpBrG,GAAW6D,UAAW,EACtB7D,GAAWe,SAAWA,GACtBf,GAAWkhB,gBACXlhB,GAAWoK,OAASA,GACpBpK,GAAW0B,UAAY,SAASC,MACfD,UAAUC,MACXD,UAAUC,MACLD,UAAUC,MACtBD,UAAUC,MACZD,UAAUC","file":"backbone.marionette.min.js","sourcesContent":["// 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// 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 = _.memoize(function(event) {\n return 'on' + event.replace(splitter, getEventName);\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 function triggerMethod(event, ...args) {\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, args);\n }\n\n // trigger the event\n this.trigger.apply(this, arguments);\n\n return result;\n}\n\n// triggerMethodOn invokes triggerMethod on a specific context\n//\n// e.g. `Marionette.triggerMethodOn(view, 'show')`\n// will trigger a \"show\" event or invoke onShow the view.\nexport function triggerMethodOn(context, ...args) {\n if (_.isFunction(context.triggerMethod)) {\n return context.triggerMethod.apply(context, args);\n }\n\n return triggerMethod.apply(context, args);\n}\n","// DOM Refresh\n// -----------\n\nimport _ from 'underscore';\nimport { triggerMethodOn } from './trigger-method';\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 triggerMethodOn(child, 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 triggerMethodOn(view, 'dom:refresh', view);\n }\n}\n\nfunction triggerDOMRemove(view) {\n if (view._isAttached && view._isRendered) {\n triggerMethodOn(view, '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","// 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 deprecate from '../utils/deprecate';\nimport MarionetteError from '../error';\n\n// Bind/unbind the event to handlers specified as a string of\n// handler names on the target object\nfunction bindFromStrings(target, entity, evt, methods, actionName) {\n const methodNames = methods.split(/\\s+/);\n\n if (methodNames.length > 1) {\n deprecate('Multiple handlers for a single event are deprecated. If needed, use a single handler to call multiple methods.')\n }\n\n _.each(methodNames, function(methodName) {\n const method = target[methodName];\n if (!method) {\n throw new MarionetteError(`Method \"${methodName}\" was configured as an event handler, but does not exist.`);\n }\n\n target[actionName](entity, evt, method);\n });\n}\n\n// generic looping function\nfunction iterateEvents(target, entity, bindings, actionName) {\n // type-check bindings\n if (!_.isObject(bindings)) {\n throw new MarionetteError({\n message: 'Bindings must be an object.',\n url: 'marionette.functions.html#marionettebindevents'\n });\n }\n\n // iterate the bindings and bind/unbind them\n _.each(bindings, function(method, evt) {\n\n // allow for a list of method names as a string\n if (_.isString(method)) {\n bindFromStrings(target, entity, evt, method, actionName);\n return;\n }\n\n target[actionName](entity, evt, method);\n });\n}\n\nfunction bindEvents(entity, bindings) {\n if (!entity || !bindings) { return this; }\n\n iterateEvents(this, entity, bindings, 'listenTo');\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 iterateEvents(this, entity, bindings, 'stopListening');\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 '../error';\n\nfunction iterateReplies(target, channel, bindings, actionName) {\n // type-check bindings\n if (!_.isObject(bindings)) {\n throw new MarionetteError({\n message: 'Bindings must be an object.',\n url: 'marionette.functions.html#marionettebindrequests'\n });\n }\n\n const normalizedRadioRequests = normalizeMethods.call(target, bindings);\n\n channel[actionName](normalizedRadioRequests, target);\n}\n\nfunction bindRequests(channel, bindings) {\n if (!channel || !bindings) { return this; }\n\n iterateReplies(this, channel, bindings, 'reply');\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 iterateReplies(this, channel, bindings, 'stopReplying');\n return this;\n}\n\nexport {\n bindRequests,\n unbindRequests\n};\n","import _ from 'underscore';\nimport _invoke from '../utils/invoke';\nimport { triggerMethod } from '../common/trigger-method';\nimport Marionette from '../backbone.marionette';\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 delegate the lookup to the users `behaviorsLookup` implementation.\nfunction getBehaviorClass(options, key) {\n if (options.behaviorClass) {\n return options.behaviorClass;\n //treat functions as a Behavior constructor\n } else if (_.isFunction(options)) {\n return options;\n }\n\n // behaviorsLookup can be either a flat object or a method\n if (_.isFunction(Marionette.Behaviors.behaviorsLookup)) {\n return Marionette.Behaviors.behaviorsLookup(options, key)[key];\n }\n\n return Marionette.Behaviors.behaviorsLookup[key];\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) {\n return _.chain(behaviors).map(function(options, key) {\n const BehaviorClass = getBehaviorClass(options, key);\n //if we're passed a class directly instead of an object\n const _options = options === BehaviorClass ? {} : options;\n const behavior = new BehaviorClass(_options, view);\n const nestedBehaviors = parseBehaviors(view, _.result(behavior, 'behaviors'));\n\n return [behavior].concat(nestedBehaviors);\n }).flatten().value();\n}\n\nexport default {\n _initBehaviors() {\n this._behaviors = this._getBehaviors();\n },\n\n _getBehaviors() {\n const behaviors = _.result(this, 'behaviors');\n\n // Behaviors defined on a view can be a flat object literal\n // or it can be a function that returns an object.\n return _.isObject(behaviors) ? parseBehaviors(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(...args) {\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', ...args);\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() {\n const behaviors = this._behaviors;\n // Use good ol' for as this is a very hot function\n for (let i = 0, length = behaviors && behaviors.length; i < length; i++) {\n triggerMethod.apply(behaviors[i], arguments);\n }\n }\n};\n","// Add Feature flags here\n// e.g. 'class' => false\nconst FEATURES = {\n childViewEventPrefix: true,\n triggersStopPropagation: true,\n triggersPreventDefault: true\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) {\n if (shouldPreventDefault) {\n event.preventDefault();\n }\n\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n view.triggerMethod(eventName, view, event);\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","import { triggerMethodOn } from '../common/trigger-method';\n\nexport function renderView(view) {\n if (view._isRendered) {\n return;\n }\n\n if (!view.supportsRenderLifecycle) {\n triggerMethodOn(view, 'before:render', view);\n }\n\n view.render();\n\n if (!view.supportsRenderLifecycle) {\n view._isRendered = true;\n triggerMethodOn(view, 'render', view);\n }\n}\n\nexport function destroyView(view) {\n if (view.destroy) {\n view.destroy();\n return;\n }\n\n if (!view.supportsDestroyLifecycle) {\n triggerMethodOn(view, 'before:destroy', view);\n }\n\n const shouldTriggerDetach = view._isAttached && !view._shouldDisableEvents;\n\n if (shouldTriggerDetach) {\n triggerMethodOn(view, 'before:detach', view);\n }\n\n view.remove();\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n triggerMethodOn(view, 'detach', view);\n }\n\n view._isDestroyed = true;\n\n if (!view.supportsDestroyLifecycle) {\n triggerMethodOn(view, 'destroy', view);\n }\n}\n","import _ from 'underscore';\nimport deprecate from '../utils/deprecate';\nimport MarionetteError from '../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 return buildRegionFromDefinition(definition, defaults);\n}\n\nfunction buildRegionFromDefinition(definition, defaults) {\n const opts = _.extend({}, defaults);\n\n if (_.isString(definition)) {\n _.extend(opts, { el: definition });\n\n return buildRegionFromObject(opts);\n }\n\n if (_.isFunction(definition)) {\n _.extend(opts, { regionClass: definition });\n\n return buildRegionFromObject(opts);\n }\n\n if (_.isObject(definition)) {\n if (definition.selector) {\n deprecate('The selector option on a Region definition object is deprecated. Use el to pass a selector string');\n }\n\n _.extend(opts, { el: definition.selector }, definition);\n\n return buildRegionFromObject(opts);\n }\n\n throw new MarionetteError({\n message: 'Improper region configuration type.',\n url: 'marionette.region.html#region-configuration-types'\n });\n}\n\nfunction buildRegionFromObject(definition) {\n const RegionClass = definition.regionClass\n\n const options = _.omit(definition, 'regionClass');\n\n return new RegionClass(options);\n}\n","import _ from 'underscore';\nimport emulateCollection from './utils/emulate-collection';\n\n// Provide a container to store, retrieve and\n// shut down child views.\nconst Container = function() {\n this._init();\n};\n\nemulateCollection(Container.prototype, '_views');\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 const viewCid = view.cid;\n\n // store the view\n this._viewsByCid[viewCid] = view;\n\n // index it by model\n if (view.model) {\n this._indexByModel[view.model.cid] = viewCid;\n }\n\n // add to end by default\n this._views.splice(index, 0, view);\n\n this._updateLength();\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(_.bind(comparator, context));\n }\n\n return this._views.sort(_.bind(comparator, 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 _set(views) {\n this._views.length = 0;\n\n this._views.push.apply(this._views, views.slice(0));\n\n this._updateLength();\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 // Uses the model's `cid` to find the view `cid` and\n // retrieve the view using it.\n findByModelCid(modelCid) {\n const viewCid = this._indexByModel[modelCid];\n return this.findByCid(viewCid);\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","/* global console */\n\nimport _ from 'underscore';\n\nimport Marionette from '../backbone.marionette';\n\nconst deprecate = function(message, test) {\n if (_.isObject(message)) {\n message = (\n message.prev + ' is going to be removed in the future. ' +\n 'Please use ' + message.next + ' instead.' +\n (message.url ? ' See: ' + message.url : '')\n );\n }\n\n if (!Marionette.DEV_MODE) {\n return;\n }\n\n if ((test === undefined || !test) && !deprecate._cache[message]) {\n deprecate._warn('Deprecation warning: ' + message);\n deprecate._cache[message] = true;\n }\n};\n\n/* istanbul ignore next: can't clear console */\ndeprecate._console = typeof console !== 'undefined' ? console : {};\ndeprecate._warn = function() {\n const warn = deprecate._console.warn || deprecate._console.log || _.noop;\n return warn.apply(deprecate._console, arguments);\n};\ndeprecate._cache = {};\n\nexport default deprecate;\n","// Marionette.isNodeAttached\n// -------------------------\n\n// Determine if `el` is a child of the document\nconst isNodeAttached = function(el) {\n return document.documentElement.contains(el && el.parentNode);\n};\n\nexport default isNodeAttached;\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","// 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// 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 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 './utils/extend';\nimport {version} from '../package.json';\n\nconst errorProps = ['description', 'fileName', 'lineNumber', 'name', 'message', 'number'];\n\nconst MarionetteError = extend.call(Error, {\n urlRoot: `http://marionettejs.com/docs/v${version}/`,\n\n constructor(message, options) {\n if (_.isObject(message)) {\n options = message;\n message = options.message;\n } else if (!options) {\n options = {};\n }\n\n const error = Error.call(this, message);\n _.extend(this, _.pick(error, errorProps), _.pick(options, errorProps));\n\n this.captureStackTrace();\n\n if (options.url) {\n this.url = this.urlRoot + options.url;\n }\n },\n\n captureStackTrace() {\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, MarionetteError);\n }\n },\n\n toString() {\n return this.name + ': ' + this.message + (this.url ? ' See: ' + this.url : '');\n }\n});\n\nMarionetteError.extend = extend;\n\nexport default MarionetteError;\n","import _ from 'underscore';\n\n// Internal utility for setting options consistently across Mn\nconst setOptions = function(options) {\n this.options = _.extend({}, _.result(this, 'options'), options);\n};\n\nexport default setOptions;\n","import _setOptions from '../utils/set-options';\nimport getOption from '../common/get-option';\nimport mergeOptions from '../common/merge-options';\nimport normalizeMethods from '../common/normalize-methods';\nimport {\n bindEvents,\n unbindEvents\n} from '../common/bind-events';\n\nexport default {\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,\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","import _ from 'underscore';\nimport Radio from 'backbone.radio';\n\nimport {\n bindRequests,\n unbindRequests\n} from '../common/bind-requests';\n\nimport {\n bindEvents,\n unbindEvents\n} from '../common/bind-events';\n\nimport MarionetteError from '../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 name: 'BackboneRadioMissing',\n message: 'The dependency \"backbone.radio\" is missing.'\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 // Proxy `bindEvents`\n bindEvents: bindEvents,\n\n // Proxy `unbindEvents`\n unbindEvents: unbindEvents,\n\n // Proxy `bindRequests`\n bindRequests: bindRequests,\n\n // Proxy `unbindRequests`\n unbindRequests: unbindRequests\n\n};\n","// Object\n// ------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport extend from './utils/extend';\nimport { triggerMethod } from './common/trigger-method';\nimport CommonMixin from './mixins/common';\nimport RadioMixin from './mixins/radio';\n\nconst ClassOptions = [\n 'channelName',\n 'radioEvents',\n 'radioRequests'\n];\n\n// A Base Class that other Classes should descend from.\n// Object borrows many conventions and utilities from Backbone.\nconst MarionetteObject = function(options) {\n if (!this.hasOwnProperty('options')) {\n this._setOptions(options);\n }\n this.mergeOptions(options, ClassOptions);\n this._setCid();\n this._initRadio();\n this.initialize.apply(this, arguments);\n};\n\nMarionetteObject.extend = extend;\n\n// Object Methods\n// --------------\n\n// Ensure it can trigger events with Backbone.Events\n_.extend(MarionetteObject.prototype, Backbone.Events, CommonMixin, RadioMixin, {\n cidPrefix: 'mno',\n\n // for parity with Marionette.AbstractView lifecyle\n _isDestroyed: false,\n\n isDestroyed() {\n return this._isDestroyed;\n },\n\n //this is a noop method intended to be overridden by classes that extend from this base\n initialize() {},\n\n _setCid() {\n if (this.cid) { return; }\n this.cid = _.uniqueId(this.cidPrefix);\n },\n\n destroy(...args) {\n if (this._isDestroyed) { return this; }\n\n this.triggerMethod('before:destroy', this, ...args);\n\n this._isDestroyed = true;\n this.triggerMethod('destroy', this, ...args);\n this.stopListening();\n\n return this;\n },\n\n triggerMethod\n});\n\nexport default MarionetteObject;\n","// Template Cache\n// --------------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport MarionetteError from './error';\n\n// Manage templates stored in `<script>` blocks,\n// caching them for faster access.\nconst TemplateCache = function(templateId) {\n this.templateId = templateId;\n};\n\n// TemplateCache object-level methods. Manage the template\n// caches from these method calls instead of creating\n// your own TemplateCache instances\n_.extend(TemplateCache, {\n\n templateCaches: {},\n\n // Get the specified template by id. Either\n // retrieves the cached version, or loads it\n // from the DOM.\n get(templateId, options) {\n let cachedTemplate = this.templateCaches[templateId];\n\n if (!cachedTemplate) {\n cachedTemplate = new TemplateCache(templateId);\n this.templateCaches[templateId] = cachedTemplate;\n }\n\n return cachedTemplate.load(options);\n },\n\n // Clear templates from the cache. If no arguments\n // are specified, clears all templates:\n // `clear()`\n //\n // If arguments are specified, clears each of the\n // specified templates from the cache:\n // `clear(\"#t1\", \"#t2\", \"...\")`\n clear(...args) {\n let i;\n const length = args.length;\n\n if (length > 0) {\n for (i = 0; i < length; i++) {\n delete this.templateCaches[args[i]];\n }\n } else {\n this.templateCaches = {};\n }\n }\n});\n\n// TemplateCache instance methods, allowing each\n// template cache object to manage its own state\n// and know whether or not it has been loaded\n_.extend(TemplateCache.prototype, {\n\n // Internal method to load the template\n load(options) {\n // Guard clause to prevent loading this template more than once\n if (this.compiledTemplate) {\n return this.compiledTemplate;\n }\n\n // Load the template and compile it\n const template = this.loadTemplate(this.templateId, options);\n this.compiledTemplate = this.compileTemplate(template, options);\n\n return this.compiledTemplate;\n },\n\n // Load a template from the DOM, by default. Override\n // this method to provide your own template retrieval\n // For asynchronous loading with AMD/RequireJS, consider\n // using a template-loader plugin as described here:\n // https://github.com/marionettejs/backbone.marionette/wiki/Using-marionette-with-requirejs\n loadTemplate(templateId, options) {\n const $template = Backbone.$(templateId);\n\n if (!$template.length) {\n throw new MarionetteError({\n name: 'NoTemplateError',\n message: `Could not find template: \"${templateId}\"`\n });\n }\n return $template.html();\n },\n\n // Pre-compile the template before caching it. Override\n // this method if you do not need to pre-compile a template\n // (JST / RequireJS for example) or if you want to change\n // the template engine used (Handebars, etc).\n compileTemplate(rawTemplate, options) {\n return _.template(rawTemplate, options);\n }\n});\n\nexport default TemplateCache;\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\nimport {\n bindEvents,\n unbindEvents\n} from '../common/bind-events';\n\n// MixinOptions\n// - collectionEvents\n// - modelEvents\n\nexport default {\n // Handle `modelEvents`, and `collectionEvents` configuration\n _delegateEntityEvents(model, collection) {\n const modelEvents = _.result(this, 'modelEvents');\n\n if (modelEvents) {\n unbindEvents.call(this, model, modelEvents);\n bindEvents.call(this, model, modelEvents);\n }\n\n\n const collectionEvents = _.result(this, 'collectionEvents');\n\n if (collectionEvents) {\n unbindEvents.call(this, collection, collectionEvents);\n bindEvents.call(this, collection, collectionEvents);\n }\n },\n\n _undelegateEntityEvents(model, collection) {\n const modelEvents = _.result(this, 'modelEvents');\n unbindEvents.call(this, model, modelEvents);\n\n const collectionEvents = _.result(this, 'collectionEvents');\n unbindEvents.call(this, collection, collectionEvents);\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\n// utility method for parsing @ui. syntax strings\n// into associated selector\nconst normalizeUIString = function(uiString, ui) {\n return uiString.replace(/@ui\\.[a-zA-Z-_$0-9]*/g, (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, properties) {\n _.each(hash, (val, key) => {\n if (_.isString(val)) {\n hash[key] = normalizeUIString(val, ui);\n } else if (_.isObject(val) && _.isArray(properties)) {\n _.extend(val, normalizeUIValues(_.pick(val, properties), ui));\n /* Value is an object, and we got an array of embedded property names to normalize. */\n _.each(properties, (property) => {\n const propertyVal = val[property];\n if (_.isString(propertyVal)) {\n val[property] = normalizeUIString(propertyVal, ui);\n }\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, properties) {\n const uiBindings = this._getUIBindings();\n return normalizeUIValues(hash, uiBindings, properties);\n },\n\n _getUIBindings() {\n const uiBindings = _.result(this, '_uiBindings');\n const ui = _.result(this, 'ui');\n return uiBindings || 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 { triggerMethod } from '../common/trigger-method';\nimport BehaviorsMixin from './behaviors';\nimport CommonMixin from './common';\nimport DelegateEntityEventsMixin from './delegate-entity-events';\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(eventsArg) {\n\n this._proxyBehaviorViewProperties();\n this._buildEventProxies();\n\n const viewEvents = this._getEvents(eventsArg);\n\n if (typeof eventsArg === 'undefined') {\n this.events = viewEvents;\n }\n\n const combinedEvents = _.extend({},\n this._getBehaviorEvents(),\n viewEvents,\n this._getBehaviorTriggers(),\n this.getTriggers()\n );\n\n Backbone.View.prototype.delegateEvents.call(this, combinedEvents);\n\n return this;\n },\n\n _getEvents(eventsArg) {\n const events = eventsArg || this.events;\n\n if (_.isFunction(events)) {\n return this.normalizeUIKeys(events.call(this));\n }\n\n return this.normalizeUIKeys(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(...args) {\n if (this._isDestroyed) { return this; }\n const shouldTriggerDetach = this._isAttached && !this._shouldDisableEvents;\n\n this.triggerMethod('before:destroy', this, ...args);\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(...args);\n\n this.triggerMethod('destroy', this, ...args);\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 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 // used as the prefix for child view events\n // that are forwarded through the layoutview\n childViewEventPrefix() {\n return isEnabled('childViewEventPrefix') ? 'childview' : false;\n },\n\n // import the `triggerMethod` to trigger events with corresponding\n // methods if the method exists\n triggerMethod() {\n const ret = triggerMethod.apply(this, arguments);\n\n this._triggerEventOnBehaviors.apply(this, arguments);\n\n return ret;\n },\n\n // Cache `childViewEvents` and `childViewTriggers`\n _buildEventProxies() {\n this._childViewEvents = _.result(this, 'childViewEvents');\n this._childViewTriggers = _.result(this, 'childViewTriggers');\n },\n\n _proxyChildViewEvents(view) {\n this.listenTo(view, 'all', this._childViewEventHandler);\n },\n\n _childViewEventHandler(eventName, ...args) {\n const childViewEvents = this.normalizeMethods(this._childViewEvents);\n\n // call collectionView childViewEvent if defined\n if (typeof childViewEvents !== 'undefined' && _.isFunction(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 && _.isString(childViewTriggers[eventName])) {\n this.triggerMethod(childViewTriggers[eventName], ...args);\n }\n\n const prefix = _.result(this, 'childViewEventPrefix');\n\n if (prefix !== false) {\n const childEventName = prefix + ':' + eventName;\n\n this.triggerMethod(childEventName, ...args);\n }\n }\n};\n\n_.extend(ViewMixin, BehaviorsMixin, CommonMixin, DelegateEntityEventsMixin, TriggersMixin, UIMixin);\n\nexport default ViewMixin;\n","// Region\n// ------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport deprecate from './utils/deprecate';\nimport { renderView, destroyView } from './common/view';\nimport monitorViewEvents from './common/monitor-view-events';\nimport isNodeAttached from './common/is-node-attached';\nimport { triggerMethodOn } from './common/trigger-method';\nimport MarionetteObject from './object';\nimport MarionetteError from './error';\nimport View from './view';\nimport DomApi, { setDomApi } from './config/dom';\n\nconst ClassOptions = [\n 'allowMissingEl',\n 'parentEl',\n 'replaceElement'\n];\n\nconst Region = MarionetteObject.extend({\n Dom: DomApi,\n\n cidPrefix: 'mnr',\n replaceElement: false,\n _isReplaced: false,\n _isSwappingView: false,\n\n constructor(options) {\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\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: 'NoElError',\n message: 'An \"el\" must be specified for a region.'\n });\n }\n\n this.$el = this.getEl(this.el);\n MarionetteObject.call(this, options);\n },\n\n // Displays a backbone view instance inside of the region. Handles calling the `render`\n // method for you. Reads content directly from the `el` attribute. The `preventDestroy`\n // option can be used to prevent a view from the old view being destroyed on show.\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 && isNodeAttached(this.el) && !this._shouldDisableMonitoring();\n const shouldReplaceEl = typeof options.replaceElement === 'undefined' ? !!_.result(this, 'replaceElement') : !!options.replaceElement;\n\n if (shouldTriggerAttach) {\n triggerMethodOn(view, '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 triggerMethodOn(view, '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(`An \"el\" must exist in DOM for this region ${this.cid}`);\n }\n }\n return true;\n },\n\n _getView(view) {\n if (!view) {\n throw new MarionetteError({\n name: 'ViewNotValid',\n message: 'The view passed is undefined and therefore invalid. You must pass a view instance to show.'\n });\n }\n\n if (view._isDestroyed) {\n throw new MarionetteError({\n name: 'ViewDestroyedError',\n message: `View (cid: \"${view.cid}\") has already been destroyed and cannot be used.`\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, it does\n // nothing and returns immediately.\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 const shouldDestroy = !options.preventDestroy;\n\n if (!shouldDestroy) {\n deprecate('The preventDestroy option is deprecated. Use Region#detachView');\n }\n\n this._empty(view, shouldDestroy);\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 destroyView(view) {\n if (view._isDestroyed) {\n return view;\n }\n\n view._shouldDisableEvents = this._shouldDisableMonitoring();\n destroyView(view);\n return view;\n },\n\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 triggerMethodOn(view, '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 triggerMethodOn(view, '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 destroy(options) {\n if (this._isDestroyed) { return this; }\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 return MarionetteObject.prototype.destroy.apply(this, arguments);\n }\n}, {\n setDomApi\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, ['selector', '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, _.bind(this._removeRegion, 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 // Get all regions\n _getRegions() {\n return _.clone(this._regions);\n },\n\n getRegions() {\n if (!this._isRendered) {\n this.render();\n }\n return this._getRegions();\n },\n\n showChildView(name, view, ...args) {\n const region = this.getRegion(name);\n return region.show(view, ...args);\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","// Renderer\n// --------\n\nimport _ from 'underscore';\nimport MarionetteError from '../error';\nimport TemplateCache from '../template-cache';\n\n// Render a template with data by passing in the template\n// selector and the data to render.\nconst Renderer = {\n\n // Render a template with data. The `template` parameter is\n // passed to the `TemplateCache` object to retrieve the\n // template function. Override this method to provide your own\n // custom rendering and template handling for all of Marionette.\n render(template, data) {\n if (!template) {\n throw new MarionetteError({\n name: 'TemplateNotFoundError',\n message: 'Cannot render the template since its false, null or undefined.'\n });\n }\n\n const templateFunc = _.isFunction(template) ? template : TemplateCache.get(template);\n\n return templateFunc(data);\n }\n};\n\nexport default Renderer;\n","// View\n// ---------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport deprecate from './utils/deprecate';\nimport isNodeAttached from './common/is-node-attached';\nimport monitorViewEvents from './common/monitor-view-events';\nimport ViewMixin from './mixins/view';\nimport RegionsMixin from './mixins/regions';\nimport Renderer from './config/renderer';\nimport { setDomApi } from './config/dom';\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// The standard view. Includes view events, automatic rendering\n// of Underscore templates, nested views, and more.\nconst View = Backbone.View.extend({\n\n constructor(options) {\n this.render = _.bind(this.render, this);\n\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this._initBehaviors();\n this._initRegions();\n\n const args = Array.prototype.slice.call(arguments);\n args[0] = this.options;\n Backbone.View.prototype.constructor.apply(this, args);\n\n this.delegateEntityEvents();\n\n this._triggerEventOnBehaviors('initialize', this);\n },\n\n // Serialize the view's model *or* collection, if\n // it exists, for the template\n serializeData() {\n if (!this.model && !this.collection) {\n return {};\n }\n\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 return {\n items: this.serializeCollection()\n };\n },\n\n // Prepares the special `model` property of a view\n // for being displayed in the template. By default\n // we simply clone the attributes. Override this if\n // you need a custom transformation for your view's model\n serializeModel() {\n if (!this.model) { return {}; }\n return _.clone(this.model.attributes);\n },\n\n // Serialize a collection by cloning each of\n // its model's attributes\n serializeCollection() {\n if (!this.collection) { return {}; }\n return this.collection.map(function(model) { return _.clone(model.attributes); });\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 = isNodeAttached(this.el);\n\n if (this._isRendered) {\n this.bindUIElements();\n }\n\n return this;\n },\n\n // Render the view, defaulting to underscore.js templates.\n // You can override this in your view definition to provide\n // a very specific rendering for your view. In general, though,\n // you should override the `Marionette.Renderer` object to\n // change how Marionette renders views.\n // Subsequent renders after the first will re-render all nested\n // views.\n render() {\n if (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();\n this.bindUIElements();\n\n this._isRendered = true;\n this.triggerMethod('render', this);\n\n return this;\n },\n\n // Internal method to render the template with the serialized data\n // and template context via the `Marionette.Renderer` object.\n _renderTemplate() {\n const template = this.getTemplate();\n\n // Allow template-less views\n if (template === false) {\n deprecate('template:false is deprecated. Use _.noop.');\n return;\n }\n\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 this.attachElContent(html);\n },\n\n // Renders the data into the template\n _renderHtml(template, data) {\n return Renderer.render(template, data, this);\n },\n\n // Get the template for this view\n // instance. You can set a `template` attribute in the view\n // definition or pass a `template: \"whatever\"` 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(target = {}) {\n const templateContext = _.result(this, 'templateContext');\n return _.extend(target, templateContext);\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 // return this;\n // }\n // ```\n attachElContent(html) {\n this.Dom.setContents(this.el, html, this.$el);\n\n return this;\n },\n\n // called by ViewMixin destroy\n _removeChildren() {\n this.removeRegions();\n },\n\n _getImmediateChildren() {\n return _.chain(this._getRegions())\n .map('currentView')\n .compact()\n .value();\n }\n}, {\n // Sets the renderer for the Marionette.View class\n setRenderer(renderer) {\n this.prototype._renderHtml = renderer;\n return this;\n },\n\n setDomApi\n});\n\n_.extend(View.prototype, ViewMixin, RegionsMixin);\n\nexport default View;\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\n\nimport _ from 'underscore';\n\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\nconst emulateCollection = function(object, listProperty) {\n _.each(methods, function(method) {\n object[method] = function() {\n const list = _.result(this, listProperty);\n const args = Array.prototype.slice.call(arguments);\n return _[method].apply(_, [list].concat(args));\n };\n });\n};\n\nexport default emulateCollection;\n","import _ from 'underscore';\nimport emulateCollection from './utils/emulate-collection';\n\n// Provide a container to store, retrieve and\n// shut down child views.\nconst Container = function(views) {\n this._views = {};\n this._indexByModel = {};\n this._indexByCustom = {};\n this._updateLength();\n\n _.each(views, _.bind(this.add, this));\n};\n\nemulateCollection(Container.prototype, '_getViews');\n\n// Container Methods\n// -----------------\n\n_.extend(Container.prototype, {\n\n _getViews() {\n return _.values(this._views);\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). Optionally specify\n // a custom key to store an retrieve the view.\n add(view, customIndex) {\n return this._add(view, customIndex)._updateLength();\n },\n\n // To be used when avoiding call _updateLength\n // When you are done adding all your new views\n // call _updateLength\n _add(view, customIndex) {\n const viewCid = view.cid;\n\n // store the view\n this._views[viewCid] = view;\n\n // index it by model\n if (view.model) {\n this._indexByModel[view.model.cid] = viewCid;\n }\n\n // index by custom\n if (customIndex) {\n this._indexByCustom[customIndex] = viewCid;\n }\n\n return this;\n },\n\n // Find a view by the model that was attached to\n // it. 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\n // it. Uses the model's `cid` to find the view `cid` and\n // retrieve the view using it.\n findByModelCid(modelCid) {\n const viewCid = this._indexByModel[modelCid];\n return this.findByCid(viewCid);\n },\n\n // Find a view by a custom indexer.\n findByCustom(index) {\n const viewCid = this._indexByCustom[index];\n return this.findByCid(viewCid);\n },\n\n // Find by index. This is not guaranteed to be a\n // stable index.\n findByIndex(index) {\n return _.values(this._views)[index];\n },\n\n // retrieve a view by its `cid` directly\n findByCid(cid) {\n return this._views[cid];\n },\n\n // Remove a view\n remove(view) {\n return this._remove(view)._updateLength();\n },\n\n // To be used when avoiding call _updateLength\n // When you are done adding all your new views\n // call _updateLength\n _remove(view) {\n const viewCid = view.cid;\n\n // delete model index\n if (view.model) {\n delete this._indexByModel[view.model.cid];\n }\n\n // delete custom index\n _.some(this._indexByCustom, _.bind(function(cid, key) {\n if (cid === viewCid) {\n delete this._indexByCustom[key];\n return true;\n }\n }, this));\n\n // remove the view from the container\n delete this._views[viewCid];\n\n return this;\n },\n\n // Update the `.length` attribute on this container\n _updateLength() {\n this.length = _.size(this._views);\n\n return this;\n }\n});\n\nexport default Container;\n","// Collection View\n// ---------------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport { renderView, destroyView } from './common/view';\nimport isNodeAttached from './common/is-node-attached';\nimport monitorViewEvents from './common/monitor-view-events';\nimport { triggerMethodOn } from './common/trigger-method';\nimport ChildViewContainer from './child-view-container';\nimport MarionetteError from './error';\nimport ViewMixin from './mixins/view';\nimport { setDomApi } from './config/dom';\n\nconst ClassOptions = [\n 'behaviors',\n 'childView',\n 'childViewEventPrefix',\n 'childViewEvents',\n 'childViewOptions',\n 'childViewTriggers',\n 'collectionEvents',\n 'events',\n 'filter',\n 'emptyView',\n 'emptyViewOptions',\n 'modelEvents',\n 'reorderOnSort',\n 'sort',\n 'triggers',\n 'ui',\n 'viewComparator'\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\n // flag for maintaining the sorted order of the collection\n sort: true,\n\n // constructor\n // option to pass `{sort: false}` to prevent the `CollectionView` from\n // maintaining the sorted order of the collection.\n // This will fallback onto appending childView's to the end.\n //\n // option to pass `{viewComparator: compFunction()}` to allow the `CollectionView`\n // to use a custom sort order for the collection.\n constructor(options) {\n this.render = _.bind(this.render, this);\n\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this._initBehaviors();\n this.once('render', this._initialEvents);\n this._initChildViewStorage();\n this._bufferedChildren = [];\n\n const args = Array.prototype.slice.call(arguments);\n args[0] = this.options;\n Backbone.View.prototype.constructor.apply(this, args);\n\n this.delegateEntityEvents();\n\n this._triggerEventOnBehaviors('initialize', this);\n },\n\n // Instead of inserting elements one by one into the page, it's much more performant to insert\n // elements into a document fragment and then insert that document fragment into the page\n _startBuffering() {\n this._isBuffering = true;\n },\n\n _endBuffering() {\n const shouldTriggerAttach = this._isAttached && this.monitorViewEvents !== false;\n const triggerOnChildren = shouldTriggerAttach ? this._getImmediateChildren() : [];\n\n this._isBuffering = false;\n\n _.each(triggerOnChildren, child => {\n triggerMethodOn(child, 'before:attach', child);\n });\n\n this.attachBuffer(this, this._createBuffer());\n\n _.each(triggerOnChildren, child => {\n child._isAttached = true;\n triggerMethodOn(child, 'attach', child);\n });\n\n this._bufferedChildren = [];\n },\n\n _getImmediateChildren() {\n return _.values(this.children._views);\n },\n\n // Configured the initial events that the collection view binds to.\n _initialEvents() {\n if (this.collection) {\n this.listenTo(this.collection, 'add', this._onCollectionAdd);\n this.listenTo(this.collection, 'update', this._onCollectionUpdate);\n this.listenTo(this.collection, 'reset', this.render);\n\n if (this.sort) {\n this.listenTo(this.collection, 'sort', this._sortViews);\n }\n }\n },\n\n // Handle a child added to the collection\n _onCollectionAdd(child, collection, opts) {\n // `index` is present when adding with `at` since BB 1.2; indexOf fallback for < 1.2\n let index = opts.at !== undefined && (opts.index || collection.indexOf(child));\n\n // When filtered or when there is no initial index, calculate index.\n if (this.filter || index === false) {\n index = _.indexOf(this._filteredSortedModels(index), child);\n }\n\n if (this._shouldAddChild(child, index)) {\n this._destroyEmptyView();\n this._addChild(child, index)\n }\n },\n\n // Handle collection update model removals\n _onCollectionUpdate(collection, options) {\n const changes = options.changes;\n this._removeChildModels(changes.removed);\n },\n\n // Remove the child views and destroy them.\n // This function also updates the indices of later views\n // in the collection in order to keep the children in sync with the collection.\n // \"models\" is an array of models and the corresponding views\n // will be removed and destroyed from the CollectionView\n _removeChildModels(models) {\n // Used to determine where to update the remaining\n // sibling view indices after these views are removed.\n const removedViews = this._getRemovedViews(models);\n\n if (!removedViews.length) {\n return;\n }\n\n this.children._updateLength();\n\n // decrement the index of views after this one\n this._updateIndices(removedViews, false);\n\n if (this.isEmpty()) {\n this._showEmptyView();\n }\n },\n\n // Returns the views that will be used for re-indexing\n // through CollectionView#_updateIndices.\n _getRemovedViews(models) {\n\n // Returning a view means something was removed.\n return _.reduce(models, (removingViews, model) => {\n const view = model && this.children.findByModel(model);\n\n if (!view || view._isDestroyed) {\n return removingViews;\n }\n\n this._removeChildView(view);\n\n removingViews.push(view);\n\n return removingViews;\n }, []);\n },\n\n _removeChildView(view) {\n this.triggerMethod('before:remove:child', this, view);\n\n this.children._remove(view);\n view._shouldDisableEvents = this.monitorViewEvents === false;\n destroyView(view);\n\n this.stopListening(view);\n this.triggerMethod('remove:child', this, view);\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 = isNodeAttached(this.el);\n\n return this;\n },\n\n // Render children views. Override this method to provide your own implementation of a\n // render function for the collection view.\n render() {\n if (this._isDestroyed) { return this; }\n this.triggerMethod('before:render', this);\n this._renderChildren();\n this._isRendered = true;\n this.triggerMethod('render', this);\n return this;\n },\n\n // An efficient rendering used for filtering. Instead of modifying the whole DOM for the\n // collection view, we are only adding or removing the related childrenViews.\n setFilter(filter, {preventRender} = {}) {\n const canBeRendered = this._isRendered && !this._isDestroyed;\n const filterChanged = this.filter !== filter;\n const shouldRender = canBeRendered && filterChanged && !preventRender;\n\n if (shouldRender) {\n const previousModels = this._filteredSortedModels();\n this.filter = filter;\n const models = this._filteredSortedModels();\n this._applyModelDeltas(models, previousModels);\n } else {\n this.filter = filter;\n }\n\n return this;\n },\n\n // `removeFilter` is actually an alias for removing filters.\n removeFilter(options) {\n return this.setFilter(null, options);\n },\n\n // Calculate and apply difference by cid between `models` and `previousModels`.\n _applyModelDeltas(models, previousModels) {\n const currentIds = {};\n _.each(models, (model, index) => {\n const addedChildNotExists = !this.children.findByModel(model);\n if (addedChildNotExists) {\n this._onCollectionAdd(model, this.collection, {at: index});\n }\n currentIds[model.cid] = true;\n });\n\n const removeModels = _.filter(previousModels, (prevModel) => {\n return !currentIds[prevModel.cid] && this.children.findByModel(prevModel);\n });\n\n this._removeChildModels(removeModels);\n },\n\n // Reorder DOM after sorting. When your element's rendering do not use their index,\n // you can pass reorderOnSort: true to only reorder the DOM after a sort instead of\n // rendering all the collectionView.\n reorder() {\n const children = this.children;\n const models = this._filteredSortedModels();\n\n if (!models.length && this._showingEmptyView) { return this; }\n\n const anyModelsAdded = _.some(models, function(model) {\n return !children.findByModel(model);\n });\n\n // If there are any new models added due to filtering we need to add child views,\n // so render as normal.\n if (anyModelsAdded) {\n this.render();\n } else {\n\n const filteredOutModels = [];\n\n // Get the DOM nodes in the same order as the models and\n // find the model that were children before but aren't in this new order.\n const elsToReorder = _.reduce(this.children._views, function(viewEls, view) {\n const index = _.indexOf(models, view.model);\n\n if (index === -1) {\n filteredOutModels.push(view.model);\n return viewEls;\n }\n\n view._index = index;\n\n viewEls[index] = view.el;\n\n return viewEls;\n }, new Array(models.length));\n\n this.triggerMethod('before:reorder', this);\n\n const elBuffer = this.Dom.createBuffer();\n\n _.each(elsToReorder, (el) => {\n this.Dom.appendContents(elBuffer, el);\n });\n\n // Since append moves elements that are already in the DOM, appending the elements\n // will effectively reorder them.\n this._appendReorderedChildren(elBuffer);\n\n // remove any views that have been filtered out\n this._removeChildModels(filteredOutModels);\n\n this.triggerMethod('reorder', this);\n }\n return this;\n },\n\n // Render view after sorting. Override this method to change how the view renders\n // after a `sort` on the collection.\n resortView() {\n if (this.reorderOnSort) {\n this.reorder();\n } else {\n this._renderChildren();\n }\n return this;\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 render.\n _sortViews() {\n const models = this._filteredSortedModels();\n\n // check for any changes in sort order of views\n const orderChanged = _.find(models, (item, index) => {\n const view = this.children.findByModel(item);\n return !view || view._index !== index;\n });\n\n if (orderChanged) {\n this.resortView();\n }\n },\n\n // Internal reference to what index a `emptyView` is.\n _emptyViewIndex: -1,\n\n // Internal method. Separated so that CompositeView can append to the childViewContainer\n // if necessary\n _appendReorderedChildren(children) {\n this.Dom.appendContents(this.el, children, {_$el: this.$el});\n },\n\n // Internal method. Separated so that CompositeView can have more control over events\n // being triggered, around the rendering process\n _renderChildren() {\n if (this._isRendered) {\n this._destroyEmptyView();\n this._destroyChildren();\n }\n\n const models = this._filteredSortedModels();\n if (this.isEmpty({processedModels: models})) {\n this._showEmptyView();\n } else {\n this.triggerMethod('before:render:children', this);\n this._startBuffering();\n this._showCollection(models);\n this._endBuffering();\n this.triggerMethod('render:children', this);\n }\n },\n\n _createView(model, index) {\n const ChildView = this._getChildView(model);\n const childViewOptions = this._getChildViewOptions(model, index);\n const view = this.buildChildView(model, ChildView, childViewOptions);\n return view;\n },\n\n _setupChildView(view, index) {\n monitorViewEvents(view);\n\n // set up the child view event forwarding\n this._proxyChildViewEvents(view);\n\n if (this.sort) {\n view._index = index;\n }\n },\n\n // Internal method to loop through collection and show each child view.\n _showCollection(models) {\n _.each(models, _.bind(this._addChild, this));\n this.children._updateLength();\n },\n\n // Allow the collection to be sorted by a custom view comparator\n _filteredSortedModels(addedAt) {\n if (!this.collection || !this.collection.length) { return []; }\n\n const viewComparator = this.getViewComparator();\n let models = this.collection.models;\n addedAt = Math.min(Math.max(addedAt, 0), models.length - 1);\n\n if (viewComparator) {\n let addedModel;\n // Preserve `at` location, even for a sorted view\n if (addedAt) {\n addedModel = models[addedAt];\n models = models.slice(0, addedAt).concat(models.slice(addedAt + 1));\n }\n models = this._sortModelsBy(models, viewComparator);\n if (addedModel) {\n models.splice(addedAt, 0, addedModel);\n }\n }\n\n // Filter after sorting in case the filter uses the index\n models = this._filterModels(models);\n\n return models;\n },\n\n getViewComparator() {\n return this.viewComparator;\n },\n\n // Filter an array of models, if a filter exists\n _filterModels(models) {\n if (this.filter) {\n models = _.filter(models, (model, index) => {\n return this._shouldAddChild(model, index);\n });\n }\n return models;\n },\n\n _sortModelsBy(models, comparator) {\n if (typeof comparator === 'string') {\n return _.sortBy(models, (model) => {\n return model.get(comparator);\n });\n } else if (comparator.length === 1) {\n return _.sortBy(models, _.bind(comparator, this));\n } else {\n return _.clone(models).sort(_.bind(comparator, this));\n }\n },\n\n // Internal method to show an empty view in place of a collection of child views,\n // when the collection is empty\n _showEmptyView() {\n const EmptyView = this._getEmptyView();\n\n if (EmptyView && !this._showingEmptyView) {\n this._showingEmptyView = true;\n\n const model = new Backbone.Model();\n let emptyViewOptions =\n this.emptyViewOptions || this.childViewOptions;\n if (_.isFunction(emptyViewOptions)) {\n emptyViewOptions = emptyViewOptions.call(this, model, this._emptyViewIndex);\n }\n\n const view = this.buildChildView(model, EmptyView, emptyViewOptions);\n\n this.triggerMethod('before:render:empty', this, view);\n this.addChildView(view, 0);\n this.triggerMethod('render:empty', this, view);\n }\n },\n\n // Internal method to destroy an existing emptyView instance if one exists. Called when\n // a collection view has been rendered empty, and then a child is added to the collection.\n _destroyEmptyView() {\n if (this._showingEmptyView) {\n this.triggerMethod('before:remove:empty', this);\n\n this._destroyChildren();\n delete this._showingEmptyView;\n\n this.triggerMethod('remove:empty', this);\n }\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 // 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: 'NoChildViewError',\n message: 'A \"childView\" must be specified'\n });\n }\n\n childView = this._getView(childView, child);\n\n if (!childView) {\n throw new MarionetteError({\n name: 'InvalidChildViewError',\n message: '\"childView\" must be a view class or a function that returns a view class'\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 // Internal method for building and adding a child view\n _addChild(child, index) {\n const view = this._createView(child, index);\n this.addChildView(view, index);\n\n return view;\n },\n\n _getChildViewOptions(child, index) {\n if (_.isFunction(this.childViewOptions)) {\n return this.childViewOptions(child, index);\n }\n\n return this.childViewOptions;\n },\n\n // Render the child's view and add it to the HTML for the collection view at a given index.\n // This will also update the indices of later views in the collection in order to keep the\n // children in sync with the collection.\n addChildView(view, index) {\n this.triggerMethod('before:add:child', this, view);\n this._setupChildView(view, index);\n\n // Store the child view itself so we can properly remove and/or destroy it later\n if (this._isBuffering) {\n // Add to children, but don't update children's length.\n this.children._add(view);\n } else {\n // increment indices of views after this one\n this._updateIndices(view, true);\n this.children.add(view);\n }\n\n renderView(view);\n\n this._attachView(view, index);\n\n this.triggerMethod('add:child', this, view);\n\n return view;\n },\n\n // Internal method. This decrements or increments the indices of views after the added/removed\n // view to keep in sync with the collection.\n _updateIndices(views, increment) {\n if (!this.sort) {\n return;\n }\n\n if (!increment) {\n _.each(_.sortBy(this.children._views, '_index'), (view, index) => {\n view._index = index;\n });\n\n return;\n }\n\n const view = _.isArray(views) ? _.max(views, '_index') : views;\n\n if (_.isObject(view)) {\n // update the indexes of views after this one\n _.each(this.children._views, (laterView) => {\n if (laterView._index >= view._index) {\n laterView._index += 1;\n }\n });\n }\n },\n\n _attachView(view, index) {\n // Only trigger attach if already attached and not buffering,\n // otherwise _endBuffering() or Region#show() handles this.\n const shouldTriggerAttach = !view._isAttached && !this._isBuffering && this._isAttached && this.monitorViewEvents !== false;\n\n if (shouldTriggerAttach) {\n triggerMethodOn(view, 'before:attach', view);\n }\n\n this.attachHtml(this, view, index);\n\n if (shouldTriggerAttach) {\n view._isAttached = true;\n triggerMethodOn(view, 'attach', view);\n }\n },\n\n // Build a `childView` for a model in the collection.\n buildChildView(child, ChildViewClass, childViewOptions) {\n const options = _.extend({model: child}, childViewOptions);\n return new ChildViewClass(options);\n },\n\n // Remove the child view and destroy it. This function also updates the indices of later views\n // in the collection in order to keep the children in sync with the collection.\n removeChildView(view) {\n if (!view || view._isDestroyed) {\n return view;\n }\n\n this._removeChildView(view);\n this.children._updateLength();\n // decrement the index of views after this one\n this._updateIndices(view, false);\n return view;\n },\n\n // check if the collection is empty or optionally whether an array of pre-processed models is empty\n isEmpty(options) {\n let models;\n if (_.result(options, 'processedModels')) {\n models = options.processedModels;\n } else {\n models = this.collection ? this.collection.models : [];\n models = this._filterModels(models);\n }\n return models.length === 0;\n },\n\n // You might need to override this if you've overridden attachHtml\n attachBuffer(collectionView, buffer) {\n this.Dom.appendContents(collectionView.el, buffer, {_$el: collectionView.$el});\n },\n\n // Create a fragment buffer from the currently buffered children\n _createBuffer() {\n const elBuffer = this.Dom.createBuffer();\n _.each(this._bufferedChildren, (b) => {\n this.Dom.appendContents(elBuffer, b.el, {_$contents: b.$el});\n });\n return elBuffer;\n },\n\n // Append the HTML to the collection's `el`. Override this method to do something other\n // than `.append`.\n attachHtml(collectionView, childView, index) {\n if (collectionView._isBuffering) {\n // buffering happens on reset events and initial renders\n // in order to reduce the number of inserts into the\n // document, which are expensive.\n collectionView._bufferedChildren.splice(index, 0, childView);\n } else {\n // If we've already rendered the main collection, append\n // the new child into the correct order if we need to. Otherwise\n // append to the end.\n if (!collectionView._insertBefore(childView, index)) {\n collectionView._insertAfter(childView);\n }\n }\n },\n\n // Internal method. Check whether we need to insert the view into the correct position.\n _insertBefore(childView, index) {\n let currentView;\n const findPosition = this.sort && (index < this.children.length - 1);\n if (findPosition) {\n // Find the view after this one\n currentView = _.find(this.children._views, (view) => {\n return view._index === index + 1;\n });\n }\n\n if (currentView) {\n this.beforeEl(currentView.el, childView.el);\n return true;\n }\n\n return false;\n },\n\n // Override to handle DOM inserting differently\n beforeEl(el, siblings) {\n this.$(el).before(siblings);\n },\n\n // Internal method. Append a view to the end of the $el\n _insertAfter(childView) {\n this.Dom.appendContents(this.el, childView.el, {_$el: this.$el, _$contents: childView.$el});\n },\n\n // Internal method to set up the `children` object for storing all of the child views\n _initChildViewStorage() {\n this.children = new ChildViewContainer();\n },\n\n // called by ViewMixin destroy\n _removeChildren() {\n this._destroyChildren();\n },\n\n // Destroy the child views that this collection view is holding on to, if any\n _destroyChildren(options) {\n if (!this.children.length) {\n return;\n }\n\n this.triggerMethod('before:destroy:children', this);\n _.each(this.children._views, _.bind(this._removeChildView, this));\n this.children._updateLength();\n this.triggerMethod('destroy:children', this);\n },\n\n // Return true if the given child should be shown. Return false otherwise.\n // The filter will be passed (child, index, collection), where\n // 'child' is the given model\n // 'index' is the index of that model in the collection\n // 'collection' is the collection referenced by this CollectionView\n _shouldAddChild(child, index) {\n const filter = this.filter;\n return !_.isFunction(filter) || filter.call(this, child, index, this.collection);\n }\n}, {\n setDomApi\n});\n\n_.extend(CollectionView.prototype, ViewMixin);\n\nexport default CollectionView;\n","// Next Collection View\n// ---------------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport { renderView, destroyView } from './common/view';\nimport isNodeAttached from './common/is-node-attached';\nimport monitorViewEvents from './common/monitor-view-events';\nimport { triggerMethodOn } from './common/trigger-method';\nimport ChildViewContainer from './next-child-view-container';\nimport MarionetteError from './error';\nimport Region from './region';\nimport ViewMixin from './mixins/view';\nimport { setDomApi } from './config/dom';\n\nconst ClassOptions = [\n 'behaviors',\n 'childView',\n 'childViewEventPrefix',\n 'childViewEvents',\n 'childViewOptions',\n 'childViewTriggers',\n 'collectionEvents',\n 'emptyView',\n 'emptyViewOptions',\n 'events',\n 'modelEvents',\n 'sortWithCollection',\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);\n\n this.mergeOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this.once('render', this._initialEvents);\n\n // This children container isn't really used by a render, but it provides\n // the ability to check `this.children.length` prior to rendering\n // It also allows for cases where only addChildView is used\n this._initChildViewStorage();\n this._initBehaviors();\n\n const args = Array.prototype.slice.call(arguments);\n args[0] = this.options;\n Backbone.View.prototype.constructor.apply(this, args);\n\n // Init empty region\n this.getEmptyRegion();\n\n this.delegateEntityEvents();\n\n this._triggerEventOnBehaviors('initialize', this);\n },\n\n // Internal method to set up the `children` object for storing all of the child views\n _initChildViewStorage() {\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 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.render();\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._showChildren();\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\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, _.bind(this._addChildModel, 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\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: 'NoChildViewError',\n message: 'A \"childView\" must be specified'\n });\n }\n\n childView = this._getView(childView, child);\n\n if (!childView) {\n throw new MarionetteError({\n name: 'InvalidChildViewError',\n message: '\"childView\" must be a view class or a function that returns a view class'\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 = isNodeAttached(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 // After all children have been destroyed re-init the container\n this.children._init();\n\n if (this.collection) {\n this._addChildModels(this.collection.models);\n }\n\n this._showChildren();\n\n this._isRendered = true;\n\n this.triggerMethod('render', this);\n return this;\n },\n\n // Sorts the children then filters and renders the results.\n sort() {\n if (this._isDestroyed) { return this; }\n\n if (!this.children.length) { return this; }\n\n this._showChildren();\n\n return this;\n },\n\n _showChildren() {\n if (this.isEmpty()) {\n this._showEmptyView();\n return;\n }\n\n this._sortChildren();\n\n this.filter();\n },\n\n // Returns true if the collectionView is considered empty.\n // This is called twice during a render. Once to check the data,\n // and again when views are filtered. Override this function to\n // customize what empty means.\n isEmpty(allViewsFiltered) {\n return allViewsFiltered || !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 // Sorts views by viewComparator and sets the children to the new order\n _sortChildren() {\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 re-filters the children views and re-renders the results\n filter() {\n if (this._isDestroyed) { return this; }\n\n if (!this.children.length) { return this; }\n\n const filteredViews = this._filterChildren();\n\n this._renderChildren(filteredViews);\n\n return this;\n },\n\n _filterChildren() {\n const viewFilter = this._getFilter();\n const addedViews = this._addedViews;\n\n delete this._addedViews;\n\n if (!viewFilter) {\n if (addedViews) { return addedViews; }\n\n return this.children._views;\n }\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 this.triggerMethod('filter', this, attachViews, detachViews);\n\n return attachViews;\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: 'InvalidViewFilterError',\n message: '\"viewFilter\" must be a function, predicate object literal, a string indicating a model attribute, or falsy'\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, _.bind(this._detachChildView, this));\n },\n\n _detachChildView(view) {\n const shouldTriggerDetach = view._isAttached && this.monitorViewEvents !== false;\n if (shouldTriggerDetach) {\n triggerMethodOn(view, 'before:detach', view);\n }\n\n this.detachHtml(view);\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n triggerMethodOn(view, '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(views) {\n if (this.isEmpty(!views.length)) {\n this._showEmptyView();\n return;\n }\n\n this._destroyEmptyView();\n\n this.triggerMethod('before:render:children', this, views);\n\n const els = this._getBuffer(views);\n\n this._attachChildren(els, views);\n\n this.triggerMethod('render:children', this, views);\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 triggerMethodOn(view, 'before:attach', view);\n });\n\n this.attachHtml(els);\n\n _.each(views, view => {\n if (view._isAttached) { return; }\n view._isAttached = true;\n triggerMethodOn(view, 'attach', view);\n });\n },\n\n // Renders each view in children 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 // Override this method to do something other than `.append`.\n // You can attach any HTML at this point including the els.\n attachHtml(els) {\n this.Dom.appendContents(this.el, els, {_$el: this.$el});\n },\n\n swapChildViews(view1, view2) {\n if (!this.children.hasView(view1) || !this.children.hasView(view2)) {\n throw new MarionetteError({\n name: 'ChildSwapError',\n message: 'Both views must be children of the collection view'\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.Dom.hasEl(this.el, view1.el) !== this.Dom.hasEl(this.el, view2.el)) {\n this.filter();\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 // Only cache views if added to the end\n if (!index || index >= this.children.length) {\n this._addedViews = [view];\n }\n this._addChild(view, index);\n this._showChildren();\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, _.bind(this._removeChildView, 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 view._shouldDisableEvents = this.monitorViewEvents === false;\n destroyView(view);\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 || !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 _.each(this.children._views, _.bind(this._removeChildView, this));\n this.triggerMethod('destroy:children', this);\n }\n}, {\n setDomApi\n});\n\n_.extend(CollectionView.prototype, ViewMixin);\n\nexport default CollectionView;\n","// Composite View\n// --------------\n\nimport _ from 'underscore';\nimport deprecate from './utils/deprecate';\nimport MarionetteError from './error';\nimport CollectionView from './collection-view';\nimport View from './view';\n\nconst ClassOptions = [\n 'childViewContainer',\n 'template',\n 'templateContext'\n];\n\n// Used for rendering a branch-leaf, hierarchical structure.\n// Extends directly from CollectionView\n// @deprecated\nconst CompositeView = CollectionView.extend({\n\n // Setting up the inheritance chain which allows changes to\n // Marionette.CollectionView.prototype.constructor which allows overriding\n // option to pass '{sort: false}' to prevent the CompositeView from\n // maintaining the sorted order of the collection.\n // This will fallback onto appending childView's to the end.\n constructor(options) {\n deprecate('CompositeView is deprecated. Convert to View at your earliest convenience');\n\n this.mergeOptions(options, ClassOptions);\n\n CollectionView.prototype.constructor.apply(this, arguments);\n },\n\n // Configured the initial events that the composite view\n // binds to. Override this method to prevent the initial\n // events, or to add your own initial events.\n _initialEvents() {\n\n // Bind only after composite view is rendered to avoid adding child views\n // to nonexistent childViewContainer\n\n if (this.collection) {\n this.listenTo(this.collection, 'add', this._onCollectionAdd);\n this.listenTo(this.collection, 'update', this._onCollectionUpdate);\n this.listenTo(this.collection, 'reset', this.renderChildren);\n\n if (this.sort) {\n this.listenTo(this.collection, 'sort', this._sortViews);\n }\n }\n },\n\n // Retrieve the `childView` to be used when rendering each of\n // the items in the collection. The default is to return\n // `this.childView` or Marionette.CompositeView if no `childView`\n // has been defined. As happens in CollectionView, `childView` can\n // be a function (which should return a view class).\n _getChildView(child) {\n let childView = this.childView;\n\n // for CompositeView, if `childView` is not specified, we'll get the same\n // composite view class rendered for each child in the collection\n // then check if the `childView` is a view class (the common case)\n // finally check if it's a function (which we assume that returns a view class)\n if (!childView) {\n return this.constructor;\n }\n\n childView = this._getView(childView, child);\n\n if (!childView) {\n throw new MarionetteError({\n name: 'InvalidChildViewError',\n message: '\"childView\" must be a view class or a function that returns a view class'\n });\n }\n\n return childView;\n },\n\n // Return the serialized model\n serializeData() {\n return this.serializeModel();\n },\n\n // Renders the model and the collection.\n render() {\n if (this._isDestroyed) { return this; }\n this._isRendering = true;\n this.resetChildViewContainer();\n\n this.triggerMethod('before:render', this);\n\n this._renderTemplate();\n this.bindUIElements();\n this.renderChildren();\n\n this._isRendering = false;\n this._isRendered = true;\n this.triggerMethod('render', this);\n return this;\n },\n\n renderChildren() {\n if (this._isRendered || this._isRendering) {\n CollectionView.prototype._renderChildren.call(this);\n }\n },\n\n // You might need to override this if you've overridden attachHtml\n attachBuffer(compositeView, buffer) {\n const $container = this.getChildViewContainer(compositeView);\n this.Dom.appendContents($container[0], buffer, {_$el: $container});\n },\n\n // Internal method. Append a view to the end of the $el.\n // Overidden from CollectionView to ensure view is appended to\n // childViewContainer\n _insertAfter(childView) {\n const $container = this.getChildViewContainer(this, childView);\n this.Dom.appendContents($container[0], childView.el, {_$el: $container, _$contents: childView.$el});\n },\n\n // Internal method. Append reordered childView'.\n // Overidden from CollectionView to ensure reordered views\n // are appended to childViewContainer\n _appendReorderedChildren(children) {\n const $container = this.getChildViewContainer(this);\n this.Dom.appendContents($container[0], children, {_$el: $container});\n },\n\n // Internal method to ensure an `$childViewContainer` exists, for the\n // `attachHtml` method to use.\n getChildViewContainer(containerView, childView) {\n if (!!containerView.$childViewContainer) {\n return containerView.$childViewContainer;\n }\n\n let container;\n const childViewContainer = containerView.childViewContainer;\n if (childViewContainer) {\n\n const selector = _.result(containerView, 'childViewContainer');\n\n if (selector.charAt(0) === '@' && containerView.ui) {\n container = containerView.ui[selector.substr(4)];\n } else {\n container = this.$(selector);\n }\n\n if (container.length <= 0) {\n throw new MarionetteError({\n name: 'ChildViewContainerMissingError',\n message: `The specified \"childViewContainer\" was not found: ${containerView.childViewContainer}`\n });\n }\n\n } else {\n container = containerView.$el;\n }\n\n containerView.$childViewContainer = container;\n return container;\n },\n\n // Internal method to reset the `$childViewContainer` on render\n resetChildViewContainer() {\n if (this.$childViewContainer) {\n this.$childViewContainer = undefined;\n }\n }\n});\n\n// To prevent duplication but allow the best View organization\n// Certain View methods are mixed directly into the deprecated CompositeView\nconst MixinFromView = _.pick(View.prototype, 'serializeModel', 'getTemplate', '_renderTemplate', '_renderHtml', 'mixinTemplateContext', 'attachElContent');\n_.extend(CompositeView.prototype, MixinFromView);\n\nexport default CompositeView;\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 deprecate from './utils/deprecate';\nimport getNamespacedEventName from './utils/get-namespaced-event-name';\nimport MarionetteObject from './object';\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 = MarionetteObject.extend({\n cidPrefix: 'mnb',\n\n constructor(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 if (this.defaults) {\n deprecate('Behavior defaults are deprecated. For similar functionality set options on the Behavior class.');\n }\n\n this.defaults = _.clone(_.result(this, 'defaults', {}));\n\n this._setOptions(_.extend({}, this.defaults, options));\n this.mergeOptions(this.options, ClassOptions);\n\n // Construct an internal UI hash using\n // the behaviors UI hash and then the view UI hash.\n // This allows the user to use UI hash elements\n // defined in the parent view as well as those\n // defined in the given behavior.\n // This order will help the reuse and share of a behavior\n // between multiple views, while letting a view override a\n // selector under an UI key.\n this.ui = _.extend({}, _.result(this, 'ui'), _.result(view, 'ui'));\n\n MarionetteObject.apply(this, arguments);\n },\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 // Overrides Object#destroy to prevent additional events from being triggered.\n destroy() {\n this.stopListening();\n\n this.view._removeBehavior(this);\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 // 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] = _.bind(behaviorHandler, 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});\n\n_.extend(Behavior.prototype, DelegateEntityEventsMixin, TriggersMixin, UIMixin);\n\nexport default Behavior;\n","// Application\n// -----------\nimport buildRegion from './common/build-region';\nimport MarionetteObject from './object';\nimport Region from './region';\n\nconst ClassOptions = [\n 'region',\n 'regionClass'\n];\n\n// A container for a Marionette application.\nconst Application = MarionetteObject.extend({\n cidPrefix: 'mna',\n\n constructor(options) {\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n this._initRegion();\n\n MarionetteObject.prototype.constructor.apply(this, arguments);\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 return region.show(view, ...args);\n },\n\n getView() {\n return this.getRegion().currentView;\n },\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});\n\nexport default Application;\n","// App Router\n// ----------\n\n// Reduce the boilerplate code of handling route events\n// and then calling a single method on another object,\n// called a controller.\n// Have your routers configured to call the method on\n// your controller, directly.\n//\n// Configure an AppRouter with `appRoutes`.\n//\n// App routers can only take one `controller` object.\n// It is recommended that you divide your controller\n// objects in to smaller pieces of related functionality\n// and have multiple routers / controllers, instead of\n// just one giant router and controller.\n//\n// You can also add standard routes to an AppRouter.\n\nimport Backbone from 'backbone';\nimport _ from 'underscore';\nimport { triggerMethod } from './common/trigger-method';\nimport MarionetteError from './error';\nimport CommonMixin from './mixins/common';\n\nconst ClassOptions = [\n 'appRoutes',\n 'controller'\n];\n\nconst AppRouter = Backbone.Router.extend({\n\n constructor(options) {\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n Backbone.Router.apply(this, arguments);\n\n const appRoutes = this.appRoutes;\n const controller = this._getController();\n this.processAppRoutes(controller, appRoutes);\n this.on('route', this._processOnRoute, this);\n },\n\n // Similar to route method on a Backbone Router but\n // method is called on the controller\n appRoute(route, methodName) {\n const controller = this._getController();\n this._addAppRoute(controller, route, methodName);\n return this;\n },\n\n // process the route event and trigger the onRoute\n // method call, if it exists\n _processOnRoute(routeName, routeArgs) {\n // make sure an onRoute before trying to call it\n if (_.isFunction(this.onRoute)) {\n // find the path that matches the current route\n const routePath = _.invert(this.appRoutes)[routeName];\n this.onRoute(routeName, routePath, routeArgs);\n }\n },\n\n // Internal method to process the `appRoutes` for the\n // router, and turn them in to routes that trigger the\n // specified method on the specified `controller`.\n processAppRoutes(controller, appRoutes) {\n if (!appRoutes) { return this; }\n\n const routeNames = _.keys(appRoutes).reverse(); // Backbone requires reverted order of routes\n\n _.each(routeNames, route => {\n this._addAppRoute(controller, route, appRoutes[route]);\n });\n\n return this;\n },\n\n _getController() {\n return this.controller;\n },\n\n _addAppRoute(controller, route, methodName) {\n const method = controller[methodName];\n\n if (!method) {\n throw new MarionetteError(`Method \"${methodName}\" was not found on the controller`);\n }\n\n this.route(route, methodName, _.bind(method, controller));\n },\n\n triggerMethod: triggerMethod\n});\n\n_.extend(AppRouter.prototype, CommonMixin);\n\nexport default AppRouter;\n","import Backbone from 'backbone';\nimport {version} from '../package.json';\n\nimport proxy from './utils/proxy';\nimport extend from './utils/extend';\nimport deprecate from './utils/deprecate';\n\nimport isNodeAttached from './common/is-node-attached';\nimport mergeOptions from './common/merge-options';\nimport getOption from './common/get-option';\nimport normalizeMethods from './common/normalize-methods';\nimport monitorViewEvents from './common/monitor-view-events';\n\nimport {\n bindEvents,\n unbindEvents\n} from './common/bind-events';\n\nimport {\n bindRequests,\n unbindRequests\n} from './common/bind-requests';\n\nimport {\n triggerMethod,\n triggerMethodOn\n} from './common/trigger-method';\n\n\nimport MarionetteObject from './object';\nimport TemplateCache from './template-cache';\nimport View from './view';\nimport CollectionView from './collection-view';\nimport NextCollectionView from './next-collection-view';\nimport CompositeView from './composite-view';\nimport Behavior from './behavior';\nimport Region from './region';\nimport Application from './application';\nimport AppRouter from './app-router';\nimport MarionetteError from './error';\n\nimport behaviorsLookup from './config/behaviors-lookup';\nimport DomApi from './config/dom';\nimport Renderer from './config/renderer';\n\nimport {\n FEATURES,\n isEnabled,\n setEnabled\n} from './config/features';\n\nconst previousMarionette = Backbone.Marionette;\nconst Marionette = Backbone.Marionette = {};\n\n// This allows you to run multiple instances of Marionette on the same\n// webapp. After loading the new version, call `noConflict()` to\n// get a reference to it. At the same time the old version will be\n// returned to Backbone.Marionette.\nMarionette.noConflict = function() {\n Backbone.Marionette = previousMarionette;\n return this;\n};\n\n// Utilities\nMarionette.bindEvents = proxy(bindEvents);\nMarionette.unbindEvents = proxy(unbindEvents);\nMarionette.bindRequests = proxy(bindRequests);\nMarionette.unbindRequests = proxy(unbindRequests);\nMarionette.mergeOptions = proxy(mergeOptions);\nMarionette.getOption = proxy(getOption);\nMarionette.normalizeMethods = proxy(normalizeMethods);\nMarionette.extend = extend;\nMarionette.isNodeAttached = isNodeAttached;\nMarionette.deprecate = deprecate;\nMarionette.triggerMethod = proxy(triggerMethod);\nMarionette.triggerMethodOn = triggerMethodOn;\nMarionette.isEnabled = isEnabled;\nMarionette.setEnabled = setEnabled;\nMarionette.monitorViewEvents = monitorViewEvents;\n\nMarionette.Behaviors = {};\nMarionette.Behaviors.behaviorsLookup = behaviorsLookup;\n\n// Classes\nMarionette.Application = Application;\nMarionette.AppRouter = AppRouter;\nMarionette.Renderer = Renderer;\nMarionette.TemplateCache = TemplateCache;\nMarionette.View = View;\nMarionette.CollectionView = CollectionView;\nMarionette.NextCollectionView = NextCollectionView;\nMarionette.CompositeView = CompositeView;\nMarionette.Behavior = Behavior;\nMarionette.Region = Region;\nMarionette.Error = MarionetteError;\nMarionette.Object = MarionetteObject;\n\n// Configuration\nMarionette.DEV_MODE = false;\nMarionette.FEATURES = FEATURES;\nMarionette.VERSION = version;\nMarionette.DomApi = DomApi;\nMarionette.setDomApi = function(mixin) {\n CollectionView.setDomApi(mixin);\n CompositeView.setDomApi(mixin);\n NextCollectionView.setDomApi(mixin);\n Region.setDomApi(mixin);\n View.setDomApi(mixin);\n};\n\nexport default Marionette;\n","import MarionetteError from '../error';\n\n// Placeholder method to be extended by the user.\n// The method should define the object that stores the behaviors.\n// i.e.\n//\n// ```js\n// Marionette.Behaviors.behaviorsLookup: function() {\n// return App.Behaviors\n// }\n// ```\nexport default function behaviorsLookup() {\n throw new MarionetteError({\n message: 'You must define where your behaviors are stored.',\n url: 'marionette.behaviors.md#behaviorslookup'\n });\n}\n"]}