made with requirebin
Last active
August 29, 2015 14:18
-
-
Save dhritzkiv/4a343694a1772363a4de to your computer and use it in GitHub Desktop.
ampersand-select-view in ampersand-form-view@2.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var FormView = require("ampersand-form-view"); | |
var InputView = require("ampersand-input-view"); | |
var SelectView = require("ampersand-select-view"); | |
var Form = FormView.extend({ | |
fields: function() { | |
return [ | |
new InputView({ | |
name: "input field", | |
type: "text", | |
value: "a value", | |
parent: this | |
}), | |
new SelectView({ | |
name: 'option', | |
parent: this, | |
options: ["a", "b", "c"] | |
}) | |
] | |
} | |
}); | |
var el = document.createElement("form"); | |
document.body.appendChild(el); | |
var form = new Form({ | |
el: el | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var isObject=require("amp-is-object");module.exports=function(obj){if(!isObject(obj))return obj;var source,prop;for(var i=1,length=arguments.length;i<length;i++){source=arguments[i];for(prop in source){obj[prop]=source[prop]}}return obj}},{"amp-is-object":2}],2:[function(require,module,exports){module.exports=function isObject(obj){var type=typeof obj;return!!obj&&(type==="function"||type==="object")}},{}],3:[function(require,module,exports){var toString=Object.prototype.toString;var func=function isFunction(obj){return toString.call(obj)==="[object Function]"};if(typeof/./!=="function"){func=function isFunction(obj){return typeof obj=="function"||false}}module.exports=func},{}],4:[function(require,module,exports){var isFunction=require("amp-is-function");module.exports=function result(object,property,defaultValue){var value=object==null?void 0:object[property];if(value===void 0){return isFunction(defaultValue)?defaultValue():defaultValue}return isFunction(value)?object[property]():value}},{"amp-is-function":3}],5:[function(require,module,exports){(function(){var root=this,breaker={},nativeForEach=Array.prototype.forEach,hasOwnProperty=Object.prototype.hasOwnProperty,slice=Array.prototype.slice,idCounter=0;function miniscore(){return{keys:Object.keys,uniqueId:function(prefix){var id=++idCounter+"";return prefix?prefix+id:id},has:function(obj,key){return hasOwnProperty.call(obj,key)},each:function(obj,iterator,context){if(obj==null)return;if(nativeForEach&&obj.forEach===nativeForEach){obj.forEach(iterator,context)}else if(obj.length===+obj.length){for(var i=0,l=obj.length;i<l;i++){if(iterator.call(context,obj[i],i,obj)===breaker)return}}else{for(var key in obj){if(this.has(obj,key)){if(iterator.call(context,obj[key],key,obj)===breaker)return}}}},once:function(func){var ran=false,memo;return function(){if(ran)return memo;ran=true;memo=func.apply(this,arguments);func=null;return memo}}}}var _=miniscore(),Events;Events={on:function(name,callback,context){if(!eventsApi(this,"on",name,[callback,context])||!callback)return this;this._events||(this._events={});var events=this._events[name]||(this._events[name]=[]);events.push({callback:callback,context:context,ctx:context||this});return this},once:function(name,callback,context){if(!eventsApi(this,"once",name,[callback,context])||!callback)return this;var self=this;var once=_.once(function(){self.off(name,once);callback.apply(this,arguments)});once._callback=callback;return this.on(name,once,context)},off:function(name,callback,context){var retain,ev,events,names,i,l,j,k;if(!this._events||!eventsApi(this,"off",name,[callback,context]))return this;if(!name&&!callback&&!context){this._events={};return this}names=name?[name]:_.keys(this._events);for(i=0,l=names.length;i<l;i++){name=names[i];if(events=this._events[name]){this._events[name]=retain=[];if(callback||context){for(j=0,k=events.length;j<k;j++){ev=events[j];if(callback&&callback!==ev.callback&&callback!==ev.callback._callback||context&&context!==ev.context){retain.push(ev)}}}if(!retain.length)delete this._events[name]}}return this},trigger:function(name){if(!this._events)return this;var args=slice.call(arguments,1);if(!eventsApi(this,"trigger",name,args))return this;var events=this._events[name];var allEvents=this._events.all;if(events)triggerEvents(events,args);if(allEvents)triggerEvents(allEvents,arguments);return this},stopListening:function(obj,name,callback){var listeners=this._listeners;if(!listeners)return this;var deleteListener=!name&&!callback;if(typeof name==="object")callback=this;if(obj)(listeners={})[obj._listenerId]=obj;for(var id in listeners){listeners[id].off(name,callback,this);if(deleteListener)delete this._listeners[id]}return this}};var eventSplitter=/\s+/;var eventsApi=function(obj,action,name,rest){if(!name)return true;if(typeof name==="object"){for(var key in name){obj[action].apply(obj,[key,name[key]].concat(rest))}return false}if(eventSplitter.test(name)){var names=name.split(eventSplitter);for(var i=0,l=names.length;i<l;i++){obj[action].apply(obj,[names[i]].concat(rest))}return false}return true};var triggerEvents=function(events,args){var ev,i=-1,l=events.length,a1=args[0],a2=args[1],a3=args[2];switch(args.length){case 0:while(++i<l)(ev=events[i]).callback.call(ev.ctx);return;case 1:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1);return;case 2:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1,a2);return;case 3:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1,a2,a3);return;default:while(++i<l)(ev=events[i]).callback.apply(ev.ctx,args)}};var listenMethods={listenTo:"on",listenToOnce:"once"};_.each(listenMethods,function(implementation,method){Events[method]=function(obj,name,callback){var listeners=this._listeners||(this._listeners={});var id=obj._listenerId||(obj._listenerId=_.uniqueId("l"));listeners[id]=obj;if(typeof name==="object")callback=this;obj[implementation](name,callback,this);return this}});Events.bind=Events.on;Events.unbind=Events.off;Events.mixin=function(proto){var exports=["on","once","off","trigger","stopListening","listenTo","listenToOnce","bind","unbind"];_.each(exports,function(name){proto[name]=this[name]},this);return proto};if(typeof define==="function"){define(function(){return Events})}else if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=Events}exports.BackboneEvents=Events}else{root.BackboneEvents=Events}})(this)},{}],6:[function(require,module,exports){module.exports=require("./backbone-events-standalone")},{"./backbone-events-standalone":5}],"ampersand-form-view":[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-form-view"]=window.ampersand["ampersand-form-view"]||[];window.ampersand["ampersand-form-view"].push("2.4.0")}var BBEvents=require("backbone-events-standalone");var isFunction=require("amp-is-function");var extend=require("amp-extend");var result=require("amp-result");function FormView(opts){opts=opts||{};this.el=opts.el;this.validCallback=opts.validCallback||this.validCallback||function(){};this.submitCallback=opts.submitCallback||this.submitCallback||function(){};this.clean=opts.clean||this.clean||function(res){return res};if(opts.data)this.data=opts.data;if(opts.model)this.model=opts.model;this.valid=false;this.preventDefault=opts.preventDefault===false?false:true;this.autoAppend=opts.autoAppend===false?false:true;this._fieldViews={};this._fieldViewsArray=[];this.render();(opts.fields||result(this,"fields")||[]).forEach(this.addField.bind(this));if(this.initialize)this.initialize.apply(this,arguments);setTimeout(function(){this.checkValid(true)}.bind(this),0)}extend(FormView.prototype,BBEvents,{data:null,model:null,fields:null,clean:null,addField:function(fieldView){this._fieldViews[fieldView.name]=fieldView;this._fieldViewsArray.push(fieldView);if(this.fieldContainerEl){fieldView.parent=this;fieldView.render();this.fieldContainerEl.appendChild(fieldView.el)}},removeField:function(name){var field=this.getField(name);if(field){field.remove();delete this._fieldViews[name];this._fieldViewsArray.splice(this._fieldViewsArray.indexOf(field),1)}},getField:function(name){return this._fieldViews[name]},setValid:function(now,forceFire){var prev=this.valid;this.valid=now;if(prev!==now||forceFire){this.validCallback(now)}},checkValid:function(forceFire){var valid=this._fieldViewsArray.every(function(field){return field.valid});this.setValid(valid,forceFire);return valid},beforeSubmit:function(){this._fieldViewsArray.forEach(function(field){if(field.beforeSubmit)field.beforeSubmit()})},update:function(field){this.trigger("change:"+field.name,field);if(field.valid){this.checkValid()}else{this.setValid(false)}},remove:function(){this.el.removeEventListener("submit",this.handleSubmit,false);var parent=this.el.parentNode;if(parent)parent.removeChild(this.el);this._fieldViewsArray.forEach(function(field){field.remove()})},handleSubmit:function(e){this.beforeSubmit();this.checkValid();if(!this.valid){e.preventDefault();return false}if(this.preventDefault){e.preventDefault();this.submitCallback(this.getData());return false}},getData:function(){var res={};for(var key in this._fieldViews){res[key]=this._fieldViews[key].value}return this.clean(res)},reset:function(){this._fieldViewsArray.forEach(function(field){if(isFunction(field.reset)){field.reset()}})},clear:function(){this._fieldViewsArray.forEach(function(field){if(isFunction(field.clear)){field.clear()}})},render:function(){if(this.rendered)return;if(!this.el){this.el=document.createElement("form")}if(this.autoAppend){this.fieldContainerEl=this.el.querySelector("[data-hook~=field-container]")||this.el}this.handleSubmit=this.handleSubmit.bind(this);this.el.addEventListener("submit",this.handleSubmit,false);this.rendered=true}});FormView.extend=function(obj){var child=function(){FormView.apply(this,arguments)};extend(child.prototype,FormView.prototype);extend(child.prototype,obj);return child};module.exports=FormView},{"amp-extend":1,"amp-is-function":3,"amp-result":4,"backbone-events-standalone":6}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-dom"]=window.ampersand["ampersand-dom"]||[];window.ampersand["ampersand-dom"].push("1.4.0")}var dom=module.exports={text:function(el,val){el.textContent=getString(val)},addClass:function(el,cls){cls=getString(cls);if(!cls)return;if(Array.isArray(cls)){cls.forEach(function(c){dom.addClass(el,c)})}else if(el.classList){el.classList.add(cls)}else{if(!hasClass(el,cls)){if(el.classList){el.classList.add(cls)}else{el.className+=" "+cls}}}},removeClass:function(el,cls){if(Array.isArray(cls)){cls.forEach(function(c){dom.removeClass(el,c)})}else if(el.classList){cls=getString(cls);if(cls)el.classList.remove(cls)}else{el.className=el.className.replace(new RegExp("(^|\\b)"+cls.split(" ").join("|")+"(\\b|$)","gi")," ")}},hasClass:hasClass,switchClass:function(el,prevCls,newCls){if(prevCls)this.removeClass(el,prevCls);this.addClass(el,newCls)},addAttribute:function(el,attr){el.setAttribute(attr,"");if(hasBooleanProperty(el,attr))el[attr]=true},removeAttribute:function(el,attr){el.removeAttribute(attr);if(hasBooleanProperty(el,attr))el[attr]=false},setAttribute:function(el,attr,value){el.setAttribute(attr,getString(value))},getAttribute:function(el,attr){return el.getAttribute(attr)},hasAttribute:function(el,attr){return el.hasAttribute(attr)},hide:function(el,mode){if(!mode)mode="display";if(!isHidden(el)){storeDisplayStyle(el,mode);hide(el,mode)}},show:function(el,mode){if(!mode)mode="display";show(el,mode)},html:function(el,content){el.innerHTML=content}};function getString(val){if(!val&&val!==0){return""}else{return val}}function hasClass(el,cls){if(el.classList){return el.classList.contains(cls)}else{return new RegExp("(^| )"+cls+"( |$)","gi").test(el.className)}}function hasBooleanProperty(el,prop){var val=el[prop];return prop in el&&(val===true||val===false)}function isHidden(el){return dom.getAttribute(el,"data-anddom-hidden")==="true"}function storeDisplayStyle(el,mode){dom.setAttribute(el,"data-anddom-"+mode,el.style[mode])}function show(el,mode){el.style[mode]=dom.getAttribute(el,"data-anddom-"+mode)||"";dom.removeAttribute(el,"data-anddom-hidden")}function hide(el,mode){dom.setAttribute(el,"data-anddom-hidden","true");el.style[mode]=mode==="visibility"?"hidden":"none"}},{}],2:[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-view"]=window.ampersand["ampersand-view"]||[];window.ampersand["ampersand-view"].push("7.3.0")}var State=require("ampersand-state");var CollectionView=require("ampersand-collection-view");var domify=require("domify");var uniqueId=require("lodash.uniqueid");var pick=require("lodash.pick");var assign=require("lodash.assign");var forEach=require("lodash.foreach");var result=require("lodash.result");var last=require("lodash.last");var isString=require("lodash.isstring");var bind=require("lodash.bind");var flatten=require("lodash.flatten");var invoke=require("lodash.invoke");var events=require("events-mixin");var matches=require("matches-selector");var bindings=require("ampersand-dom-bindings");var getPath=require("get-object-path");function View(attrs){this.cid=uniqueId("view");attrs||(attrs={});var parent=attrs.parent;delete attrs.parent;BaseState.call(this,attrs,{init:false,parent:parent});this.on("change:el",this._handleElementChange,this);this._parsedBindings=bindings(this.bindings,this);this._initializeBindings();if(attrs.el&&!this.autoRender){this._handleElementChange()}this._initializeSubviews();this.template=attrs.template||this.template;this.initialize.apply(this,arguments);this.set(pick(attrs,viewOptions));if(this.autoRender&&this.template){this.render()}}var BaseState=State.extend({dataTypes:{element:{set:function(newVal){return{val:newVal,type:newVal instanceof Element?"element":typeof newVal}},compare:function(el1,el2){return el1===el2}},collection:{set:function(newVal){return{val:newVal,type:newVal&&newVal.isCollection?"collection":typeof newVal}},compare:function(currentVal,newVal){return currentVal===newVal}}},props:{model:"state",el:"element",collection:"collection"},derived:{rendered:{deps:["el"],fn:function(){return!!this.el}},hasData:{deps:["model"],fn:function(){return!!this.model}}}});var delegateEventSplitter=/^(\S+)\s*(.*)$/;var viewOptions=["model","collection","el"];View.prototype=Object.create(BaseState.prototype);assign(View.prototype,{query:function(selector){if(!selector)return this.el;if(typeof selector==="string"){if(matches(this.el,selector))return this.el;return this.el.querySelector(selector)||undefined}return selector},queryAll:function(selector){var res=[];if(!this.el)return res;if(selector==="")return[this.el];if(matches(this.el,selector))res.push(this.el);return res.concat(Array.prototype.slice.call(this.el.querySelectorAll(selector)))},queryByHook:function(hook){return this.query('[data-hook~="'+hook+'"]')},initialize:function(){},render:function(){this.renderWithTemplate(this);return this},remove:function(){var parsedBindings=this._parsedBindings;if(this.el&&this.el.parentNode)this.el.parentNode.removeChild(this.el);if(this._subviews)invoke(flatten(this._subviews),"remove");this.stopListening();forEach(parsedBindings,function(properties,modelName){forEach(properties,function(value,key){delete parsedBindings[modelName][key]});delete parsedBindings[modelName]});this.trigger("remove",this);return this},_handleElementChange:function(element,delegate){if(this.eventManager)this.eventManager.unbind();this.eventManager=events(this.el,this);this.delegateEvents();this._applyBindingsForKey();return this},delegateEvents:function(events){if(!(events||(events=result(this,"events"))))return this;this.undelegateEvents();for(var key in events){this.eventManager.bind(key,events[key])}return this},undelegateEvents:function(){this.eventManager.unbind();return this},registerSubview:function(view){this._subviews||(this._subviews=[]);this._subviews.push(view);if(view.el)view.parent=this;return view},renderSubview:function(view,container){if(typeof container==="string"){container=this.query(container)}this.registerSubview(view);view.render();(container||this.el).appendChild(view.el);return view},_applyBindingsForKey:function(name){if(!this.el)return;var fns=this._parsedBindings.getGrouped(name);var item;for(item in fns){fns[item].forEach(function(fn){fn(this.el,getPath(this,item),last(item.split(".")))},this)}},_initializeBindings:function(){if(!this.bindings)return;this.on("all",function(eventName){if(eventName.slice(0,7)==="change:"){this._applyBindingsForKey(eventName.split(":")[1])}},this)},_initializeSubviews:function(){if(!this.subviews)return;for(var item in this.subviews){this._parseSubview(this.subviews[item],item)}},_parseSubview:function(subview,name){var self=this;var opts={selector:subview.container||'[data-hook="'+subview.hook+'"]',waitFor:subview.waitFor||"",prepareView:subview.prepareView||function(el){return new subview.constructor({el:el,parent:self})}};function action(){var el,subview;if(!this.el||!(el=this.query(opts.selector)))return;if(!opts.waitFor||getPath(this,opts.waitFor)){subview=this[name]=opts.prepareView.call(this,el);subview.render();this.registerSubview(subview);this.off("change",action)}}this.on("change",action,this)},renderWithTemplate:function(context,templateArg){var template=templateArg||this.template;if(!template)throw new Error("Template string or function needed.");var newDom=isString(template)?template:template.call(this,context||this);if(isString(newDom))newDom=domify(newDom);var parent=this.el&&this.el.parentNode;if(parent)parent.replaceChild(newDom,this.el);if(newDom.nodeName==="#document-fragment")throw new Error("Views can only have one root element.");this.el=newDom;return this},cacheElements:function(hash){for(var item in hash){this[item]=this.query(hash[item])}return this},listenToAndRun:function(object,events,handler){var bound=bind(handler,this);this.listenTo(object,events,bound);bound()},animateRemove:function(){this.remove()},renderCollection:function(collection,ViewClass,container,opts){var containerEl=typeof container==="string"?this.query(container):container;var config=assign({collection:collection,el:containerEl||this.el,view:ViewClass,parent:this,viewOptions:{parent:this}},opts);var collectionView=new CollectionView(config);collectionView.render();return this.registerSubview(collectionView)}});View.extend=BaseState.extend;module.exports=View},{"ampersand-collection-view":3,"ampersand-dom-bindings":38,"ampersand-state":40,domify:104,"events-mixin":105,"get-object-path":110,"lodash.assign":111,"lodash.bind":121,"lodash.flatten":127,"lodash.foreach":132,"lodash.invoke":140,"lodash.isstring":147,"lodash.last":148,"lodash.pick":149,"lodash.result":161,"lodash.uniqueid":163,"matches-selector":165}],3:[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-collection-view"]=window.ampersand["ampersand-collection-view"]||[];window.ampersand["ampersand-collection-view"].push("1.4.0")}var assign=require("lodash.assign");var invoke=require("lodash.invoke");var pick=require("lodash.pick");var find=require("lodash.find");var difference=require("lodash.difference");var Events=require("ampersand-events");var ampExtend=require("ampersand-class-extend");var options=["collection","el","viewOptions","view","emptyView","filter","reverse","parent"];function CollectionView(spec){if(!spec){throw new ReferenceError("Collection view missing required parameters: collection, el")}if(!spec.collection){throw new ReferenceError("Collection view requires a collection")}if(!spec.el&&!this.insertSelf){throw new ReferenceError("Collection view requires an el")}assign(this,pick(spec,options));this.views=[];this.listenTo(this.collection,"add",this._addViewForModel);this.listenTo(this.collection,"remove",this._removeViewForModel);this.listenTo(this.collection,"sort",this._rerenderAll);this.listenTo(this.collection,"refresh reset",this._reset)}assign(CollectionView.prototype,Events,{render:function(){this._renderAll();return this},remove:function(){invoke(this.views,"remove");this.stopListening()},_getViewByModel:function(model){return find(this.views,function(view){return model===view.model})},_createViewForModel:function(model,renderOpts){var defaultViewOptions={model:model,collection:this.collection,parent:this};var view=new this.view(assign(defaultViewOptions,this.viewOptions));this.views.push(view);view.renderedByParentView=true;view.render(renderOpts);return view},_getOrCreateByModel:function(model,renderOpts){return this._getViewByModel(model)||this._createViewForModel(model,renderOpts)},_addViewForModel:function(model,collection,options){var matches=this.filter?this.filter(model):true;if(!matches){return}if(this.renderedEmptyView){this.renderedEmptyView.remove();delete this.renderedEmptyView}var view=this._getOrCreateByModel(model,{containerEl:this.el});if(options&&options.rerender){this._insertView(view)}else{this._insertViewAtIndex(view)}},_insertViewAtIndex:function(view){if(!view.insertSelf){var pos=this.collection.indexOf(view.model);var modelToInsertBefore,viewToInsertBefore;if(this.reverse){modelToInsertBefore=this.collection.at(pos-1)}else{modelToInsertBefore=this.collection.at(pos+1)}viewToInsertBefore=this._getViewByModel(modelToInsertBefore);if(viewToInsertBefore){this.el.insertBefore(view.el,viewToInsertBefore&&viewToInsertBefore.el)}else{this.el.appendChild(view.el)}}},_insertView:function(view){if(!view.insertSelf){if(this.reverse&&this.el.firstChild){this.el.insertBefore(view.el,this.el.firstChild)}else{this.el.appendChild(view.el)}}},_removeViewForModel:function(model){var view=this._getViewByModel(model);if(!view){return}var index=this.views.indexOf(view);if(index!==-1){view=this.views.splice(index,1)[0];this._removeView(view);if(this.views.length===0){this._renderEmptyView()}}},_removeView:function(view){if(view.animateRemove){view.animateRemove()}else{view.remove()}},_renderAll:function(){this.collection.each(this._addViewForModel,this);if(this.views.length===0){this._renderEmptyView()}},_rerenderAll:function(collection,options){options=options||{};this.collection.each(function(model){this._addViewForModel(model,this,assign(options,{rerender:true}))},this)},_renderEmptyView:function(){if(this.emptyView&&!this.renderedEmptyView){var view=this.renderedEmptyView=new this.emptyView({parent:this});this.el.appendChild(view.render().el)}},_reset:function(){var newViews=this.collection.map(this._getOrCreateByModel,this);var toRemove=difference(this.views,newViews);toRemove.forEach(this._removeView,this);this.views=newViews;this._rerenderAll();if(this.views.length===0){this._renderEmptyView()}}});CollectionView.extend=ampExtend;module.exports=CollectionView},{"ampersand-class-extend":4,"ampersand-events":5,"lodash.assign":111,"lodash.difference":16,"lodash.find":26,"lodash.invoke":140,"lodash.pick":149}],4:[function(require,module,exports){var assign=require("lodash.assign");var extend=function(protoProps){var parent=this;var child;var args=[].slice.call(arguments);if(protoProps&&protoProps.hasOwnProperty("constructor")){child=protoProps.constructor}else{child=function(){return parent.apply(this,arguments)}}assign(child,parent);var Surrogate=function(){this.constructor=child};Surrogate.prototype=parent.prototype;child.prototype=new Surrogate;if(protoProps){args.unshift(child.prototype);assign.apply(null,args)}child.__super__=parent.prototype;return child};module.exports=extend},{"lodash.assign":111}],5:[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-events"]=window.ampersand["ampersand-events"]||[];window.ampersand["ampersand-events"].push("1.1.1")}var runOnce=require("lodash.once");var uniqueId=require("lodash.uniqueid");var keys=require("lodash.keys");var isEmpty=require("lodash.isempty");var each=require("lodash.foreach");var bind=require("lodash.bind");var assign=require("lodash.assign");var slice=Array.prototype.slice;var eventSplitter=/\s+/;var Events={on:function(name,callback,context){if(!eventsApi(this,"on",name,[callback,context])||!callback)return this;this._events||(this._events={});var events=this._events[name]||(this._events[name]=[]);events.push({callback:callback,context:context,ctx:context||this});return this},once:function(name,callback,context){if(!eventsApi(this,"once",name,[callback,context])||!callback)return this;var self=this;var once=runOnce(function(){self.off(name,once);callback.apply(this,arguments)});once._callback=callback;return this.on(name,once,context)},off:function(name,callback,context){var retain,ev,events,names,i,l,j,k;if(!this._events||!eventsApi(this,"off",name,[callback,context]))return this;if(!name&&!callback&&!context){this._events=void 0;return this}names=name?[name]:keys(this._events);for(i=0,l=names.length;i<l;i++){name=names[i];if(events=this._events[name]){this._events[name]=retain=[];if(callback||context){for(j=0,k=events.length;j<k;j++){ev=events[j];if(callback&&callback!==ev.callback&&callback!==ev.callback._callback||context&&context!==ev.context){retain.push(ev)}}}if(!retain.length)delete this._events[name]}}return this},trigger:function(name){if(!this._events)return this;var args=slice.call(arguments,1);if(!eventsApi(this,"trigger",name,args))return this;var events=this._events[name];var allEvents=this._events.all;if(events)triggerEvents(events,args);if(allEvents)triggerEvents(allEvents,arguments);return this},stopListening:function(obj,name,callback){var listeningTo=this._listeningTo;if(!listeningTo)return this;var remove=!name&&!callback;if(!callback&&typeof name==="object")callback=this;if(obj)(listeningTo={})[obj._listenId]=obj;for(var id in listeningTo){obj=listeningTo[id];obj.off(name,callback,this);if(remove||isEmpty(obj._events))delete this._listeningTo[id]}return this},createEmitter:function(obj){return assign(obj||{},Events)}};Events.bind=Events.on;Events.unbind=Events.off;var eventsApi=function(obj,action,name,rest){if(!name)return true;if(typeof name==="object"){for(var key in name){obj[action].apply(obj,[key,name[key]].concat(rest))}return false}if(eventSplitter.test(name)){var names=name.split(eventSplitter);for(var i=0,l=names.length;i<l;i++){obj[action].apply(obj,[names[i]].concat(rest))}return false}return true};var triggerEvents=function(events,args){var ev;var i=-1;var l=events.length;var a1=args[0];var a2=args[1];var a3=args[2];switch(args.length){case 0:while(++i<l)(ev=events[i]).callback.call(ev.ctx);return;case 1:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1);return;case 2:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1,a2);return;case 3:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1,a2,a3);return;default:while(++i<l)(ev=events[i]).callback.apply(ev.ctx,args);return}};var listenMethods={listenTo:"on",listenToOnce:"once"};each(listenMethods,function(implementation,method){Events[method]=function(obj,name,callback,run){var listeningTo=this._listeningTo||(this._listeningTo={});var id=obj._listenId||(obj._listenId=uniqueId("l"));listeningTo[id]=obj;if(!callback&&typeof name==="object")callback=this;obj[implementation](name,callback,this);return this}});Events.listenToAndRun=function(obj,name,callback){Events.listenTo.apply(this,arguments);if(!callback&&typeof name==="object")callback=this;callback.apply(this);return this};module.exports=Events},{"lodash.assign":111,"lodash.bind":121,"lodash.foreach":132,"lodash.isempty":6,"lodash.keys":10,"lodash.once":14,"lodash.uniqueid":163}],6:[function(require,module,exports){var isArguments=require("lodash.isarguments"),isArray=require("lodash.isarray"),isFunction=require("lodash.isfunction"),isString=require("lodash.isstring"),keys=require("lodash.keys");function isObjectLike(value){return!!value&&typeof value=="object"}var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isEmpty(value){if(value==null){return true}var length=value.length;if(isLength(length)&&(isArray(value)||isString(value)||isArguments(value)||isObjectLike(value)&&isFunction(value.splice))){return!length}return!keys(value).length}module.exports=isEmpty},{"lodash.isarguments":7,"lodash.isarray":8,"lodash.isfunction":9,"lodash.isstring":147,"lodash.keys":10}],7:[function(require,module,exports){var argsTag="[object Arguments]";function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var objToString=objectProto.toString;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isArguments(value){var length=isObjectLike(value)?value.length:undefined;return isLength(length)&&objToString.call(value)==argsTag}module.exports=isArguments},{}],8:[function(require,module,exports){var arrayTag="[object Array]",funcTag="[object Function]";var reHostCtor=/^\[object .+?Constructor\]$/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var fnToString=Function.prototype.toString;var objToString=objectProto.toString;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}var isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag};function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}module.exports=isArray},{}],9:[function(require,module,exports){(function(global){var funcTag="[object Function]";var reHostCtor=/^\[object .+?Constructor\]$/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);function baseIsFunction(value){return typeof value=="function"||false}function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var fnToString=Function.prototype.toString;var objToString=objectProto.toString;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Uint8Array=isNative(Uint8Array=global.Uint8Array)&&Uint8Array;var isFunction=!(baseIsFunction(/x/)||Uint8Array&&!baseIsFunction(Uint8Array))?baseIsFunction:function(value){return objToString.call(value)==funcTag};function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}module.exports=isFunction}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],10:[function(require,module,exports){var isArguments=require("lodash.isarguments"),isArray=require("lodash.isarray"),isNative=require("lodash.isnative");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var propertyIsEnumerable=objectProto.propertyIsEnumerable; | |
var nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;var support={};(function(x){try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=true}})(0,0);function isIndex(value,length){value=+value;length=length==null?MAX_SAFE_INTEGER:length;return value>-1&&value%1==0&&value<length}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function shimKeys(object){var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length;var allowIndexes=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object));var index=-1,result=[];while(++index<propsLength){var key=props[index];if(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key)){result.push(key)}}return result}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}var keys=!nativeKeys?shimKeys:function(object){if(object){var Ctor=object.constructor,length=object.length}if(typeof Ctor=="function"&&Ctor.prototype===object||typeof object!="function"&&(length&&isLength(length))){return shimKeys(object)}return isObject(object)?nativeKeys(object):[]};function keysIn(object){if(object==null){return[]}if(!isObject(object)){object=Object(object)}var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;var Ctor=object.constructor,index=-1,isProto=typeof Ctor=="function"&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;while(++index<length){result[index]=index+""}for(var key in object){if(!(skipIndexes&&isIndex(key,length))&&!(key=="constructor"&&(isProto||!hasOwnProperty.call(object,key)))){result.push(key)}}return result}module.exports=keys},{"lodash.isarguments":11,"lodash.isarray":12,"lodash.isnative":13}],11:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],12:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],13:[function(require,module,exports){var funcTag="[object Function]";var reHostCtor=/^\[object .+?Constructor\]$/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var fnToString=Function.prototype.toString;var objToString=objectProto.toString;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}module.exports=isNative},{}],14:[function(require,module,exports){var before=require("lodash.before");function once(func){return before(func,2)}module.exports=once},{"lodash.before":15}],15:[function(require,module,exports){var FUNC_ERROR_TEXT="Expected a function";function before(n,func){var result;if(typeof func!="function"){if(typeof n=="function"){var temp=n;n=func;func=temp}else{throw new TypeError(FUNC_ERROR_TEXT)}}return function(){if(--n>0){result=func.apply(this,arguments)}else{func=null}return result}}module.exports=before},{}],16:[function(require,module,exports){var baseDifference=require("lodash._basedifference"),baseFlatten=require("lodash._baseflatten"),isArguments=require("lodash.isarguments"),isArray=require("lodash.isarray"),restParam=require("lodash.restparam");var difference=restParam(function(array,values){return isArray(array)||isArguments(array)?baseDifference(array,baseFlatten(values,false,true)):[]});module.exports=difference},{"lodash._basedifference":17,"lodash._baseflatten":22,"lodash.isarguments":23,"lodash.isarray":24,"lodash.restparam":25}],17:[function(require,module,exports){var baseIndexOf=require("lodash._baseindexof"),cacheIndexOf=require("lodash._cacheindexof"),createCache=require("lodash._createcache");function baseDifference(array,values){var length=array?array.length:0,result=[];if(!length){return result}var index=-1,indexOf=baseIndexOf,isCommon=true,cache=isCommon&&values.length>=200?createCache(values):null,valuesLength=values.length;if(cache){indexOf=cacheIndexOf;isCommon=false;values=cache}outer:while(++index<length){var value=array[index];if(isCommon&&value===value){var valuesIndex=valuesLength;while(valuesIndex--){if(values[valuesIndex]===value){continue outer}}result.push(value)}else if(indexOf(values,value,0)<0){result.push(value)}}return result}module.exports=baseDifference},{"lodash._baseindexof":18,"lodash._cacheindexof":19,"lodash._createcache":20}],18:[function(require,module,exports){function baseIndexOf(array,value,fromIndex){if(value!==value){return indexOfNaN(array,fromIndex)}var index=fromIndex-1,length=array.length;while(++index<length){if(array[index]===value){return index}}return-1}function indexOfNaN(array,fromIndex,fromRight){var length=array.length,index=fromIndex+(fromRight?0:-1);while(fromRight?index--:++index<length){var other=array[index];if(other!==other){return index}}return-1}module.exports=baseIndexOf},{}],19:[function(require,module,exports){function cacheIndexOf(cache,value){var data=cache.data,result=typeof value=="string"||isObject(value)?data.set.has(value):data.hash[value];return result?0:-1}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=cacheIndexOf},{}],20:[function(require,module,exports){(function(global){var isNative=require("lodash.isnative");var Set=isNative(Set=global.Set)&&Set;var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate;function SetCache(values){var length=values?values.length:0;this.data={hash:nativeCreate(null),set:new Set};while(length--){this.push(values[length])}}function cachePush(value){var data=this.data;if(typeof value=="string"||isObject(value)){data.set.add(value)}else{data.hash[value]=true}}var createCache=!(nativeCreate&&Set)?constant(null):function(values){return new SetCache(values)};function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}function constant(value){return function(){return value}}SetCache.prototype.push=cachePush;module.exports=createCache}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash.isnative":21}],21:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],22:[function(require,module,exports){var isArguments=require("lodash.isarguments"),isArray=require("lodash.isarray");function isObjectLike(value){return!!value&&typeof value=="object"}var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function baseFlatten(array,isDeep,isStrict){var index=-1,length=array.length,resIndex=-1,result=[];while(++index<length){var value=array[index];if(isObjectLike(value)&&isLength(value.length)&&(isArray(value)||isArguments(value))){if(isDeep){value=baseFlatten(value,isDeep,isStrict)}var valIndex=-1,valLength=value.length;result.length+=valLength;while(++valIndex<valLength){result[++resIndex]=value[valIndex]}}else if(!isStrict){result[++resIndex]=value}}return result}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}module.exports=baseFlatten},{"lodash.isarguments":23,"lodash.isarray":24}],23:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],24:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],25:[function(require,module,exports){var FUNC_ERROR_TEXT="Expected a function";var nativeMax=Math.max;function restParam(func,start){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}start=nativeMax(typeof start=="undefined"?func.length-1:+start||0,0);return function(){var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);while(++index<length){rest[index]=args[start+index]}switch(start){case 0:return func.call(this,rest);case 1:return func.call(this,args[0],rest);case 2:return func.call(this,args[0],args[1],rest)}var otherArgs=Array(start+1);index=-1;while(++index<start){otherArgs[index]=args[index]}otherArgs[start]=rest;return func.apply(this,otherArgs)}}module.exports=restParam},{}],26:[function(require,module,exports){var baseCallback=require("lodash._basecallback"),baseEach=require("lodash._baseeach"),baseFind=require("lodash._basefind"),baseFindIndex=require("lodash._basefindindex"),isArray=require("lodash.isarray"),keys=require("lodash.keys");function createFind(eachFunc,fromRight){return function(collection,predicate,thisArg){predicate=baseCallback(predicate,thisArg,3);if(isArray(collection)){var index=baseFindIndex(collection,predicate,fromRight);return index>-1?collection[index]:undefined}return baseFind(collection,predicate,eachFunc)}}var find=createFind(baseEach);module.exports=find},{"lodash._basecallback":27,"lodash._baseeach":31,"lodash._basefind":32,"lodash._basefindindex":33,"lodash.isarray":34,"lodash.keys":35}],27:[function(require,module,exports){var baseIsEqual=require("lodash._baseisequal"),bindCallback=require("lodash._bindcallback"),keys=require("lodash.keys");function baseCallback(func,thisArg,argCount){var type=typeof func;if(type=="function"){return typeof thisArg=="undefined"?func:bindCallback(func,thisArg,argCount)}if(func==null){return identity}if(type=="object"){return baseMatches(func)}return typeof thisArg=="undefined"?baseProperty(func+""):baseMatchesProperty(func+"",thisArg)}function baseIsMatch(object,props,values,strictCompareFlags,customizer){var index=-1,length=props.length,noCustomizer=!customizer;while(++index<length){if(noCustomizer&&strictCompareFlags[index]?values[index]!==object[props[index]]:!(props[index]in object)){return false}}index=-1;while(++index<length){var key=props[index],objValue=object[key],srcValue=values[index];if(noCustomizer&&strictCompareFlags[index]){var result=typeof objValue!="undefined"||key in object}else{result=customizer?customizer(objValue,srcValue,key):undefined;if(typeof result=="undefined"){result=baseIsEqual(srcValue,objValue,customizer,true)}}if(!result){return false}}return true}function baseMatches(source){var props=keys(source),length=props.length;if(!length){return constant(true)}if(length==1){var key=props[0],value=source[key];if(isStrictComparable(value)){return function(object){return object!=null&&object[key]===value&&(typeof value!="undefined"||key in toObject(object))}}}var values=Array(length),strictCompareFlags=Array(length);while(length--){value=source[props[length]];values[length]=value;strictCompareFlags[length]=isStrictComparable(value)}return function(object){return object!=null&&baseIsMatch(toObject(object),props,values,strictCompareFlags)}}function baseMatchesProperty(key,value){if(isStrictComparable(value)){return function(object){return object!=null&&object[key]===value&&(typeof value!="undefined"||key in toObject(object))}}return function(object){return object!=null&&baseIsEqual(value,object[key],null,true)}}function baseProperty(key){return function(object){return object==null?undefined:object[key]}}function isStrictComparable(value){return value===value&&(value===0?1/value>0:!isObject(value))}function toObject(value){return isObject(value)?value:Object(value)}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}function constant(value){return function(){return value}}function identity(value){return value}module.exports=baseCallback},{"lodash._baseisequal":28,"lodash._bindcallback":30,"lodash.keys":35}],28:[function(require,module,exports){var isArray=require("lodash.isarray"),isTypedArray=require("lodash.istypedarray"),keys=require("lodash.keys");var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",stringTag="[object String]";var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var objToString=objectProto.toString;function baseIsEqual(value,other,customizer,isLoose,stackA,stackB){if(value===other){return value!==0||1/value==1/other}var valType=typeof value,othType=typeof other;if(valType!="function"&&valType!="object"&&othType!="function"&&othType!="object"||value==null||other==null){return value!==value&&other!==other}return baseIsEqualDeep(value,other,baseIsEqual,customizer,isLoose,stackA,stackB)}function baseIsEqualDeep(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;if(!objIsArr){objTag=objToString.call(object);if(objTag==argsTag){objTag=objectTag}else if(objTag!=objectTag){objIsArr=isTypedArray(object)}}if(!othIsArr){othTag=objToString.call(other);if(othTag==argsTag){othTag=objectTag}else if(othTag!=objectTag){othIsArr=isTypedArray(other)}}var objIsObj=objTag==objectTag||isLoose&&objTag==funcTag,othIsObj=othTag==objectTag||isLoose&&othTag==funcTag,isSameTag=objTag==othTag;if(isSameTag&&!(objIsArr||objIsObj)){return equalByTag(object,other,objTag)}if(isLoose){if(!isSameTag&&!(objIsObj&&othIsObj)){return false}}else{var valWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(valWrapped||othWrapped){return equalFunc(valWrapped?object.value():object,othWrapped?other.value():other,customizer,isLoose,stackA,stackB)}if(!isSameTag){return false}}stackA||(stackA=[]);stackB||(stackB=[]);var length=stackA.length;while(length--){if(stackA[length]==object){return stackB[length]==other}}stackA.push(object);stackB.push(other);var result=(objIsArr?equalArrays:equalObjects)(object,other,equalFunc,customizer,isLoose,stackA,stackB);stackA.pop();stackB.pop();return result}function equalArrays(array,other,equalFunc,customizer,isLoose,stackA,stackB){var index=-1,arrLength=array.length,othLength=other.length,result=true;if(arrLength!=othLength&&!(isLoose&&othLength>arrLength)){return false}while(result&&++index<arrLength){var arrValue=array[index],othValue=other[index];result=undefined;if(customizer){result=isLoose?customizer(othValue,arrValue,index):customizer(arrValue,othValue,index)}if(typeof result=="undefined"){if(isLoose){var othIndex=othLength;while(othIndex--){othValue=other[othIndex];result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB);if(result){break}}}else{result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB)}}}return!!result}function equalByTag(object,other,tag){switch(tag){case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:object==0?1/object==1/other:object==+other;case regexpTag:case stringTag:return object==other+""}return false}function equalObjects(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isLoose){return false}var skipCtor=isLoose,index=-1;while(++index<objLength){var key=objProps[index],result=isLoose?key in other:hasOwnProperty.call(other,key);if(result){var objValue=object[key],othValue=other[key];result=undefined;if(customizer){result=isLoose?customizer(othValue,objValue,key):customizer(objValue,othValue,key)}if(typeof result=="undefined"){result=objValue&&objValue===othValue||equalFunc(objValue,othValue,customizer,isLoose,stackA,stackB)}}if(!result){return false}skipCtor||(skipCtor=key=="constructor")}if(!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&("constructor"in object&&"constructor"in other)&&!(typeof objCtor=="function"&&objCtor instanceof objCtor&&typeof othCtor=="function"&&othCtor instanceof othCtor)){return false}}return true}module.exports=baseIsEqual},{"lodash.isarray":34,"lodash.istypedarray":29,"lodash.keys":35}],29:[function(require,module,exports){var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]";var arrayBufferTag="[object ArrayBuffer]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var objToString=objectProto.toString;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objToString.call(value)]}module.exports=isTypedArray},{}],30:[function(require,module,exports){function bindCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function identity(value){return value}module.exports=bindCallback},{}],31:[function(require,module,exports){var keys=require("lodash.keys");var MAX_SAFE_INTEGER=Math.pow(2,53)-1;var baseEach=createBaseEach(baseForOwn);var baseFor=createBaseFor();function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){var length=collection?collection.length:0;if(!isLength(length)){return eachFunc(collection,iteratee)}var index=fromRight?length:-1,iterable=toObject(collection);while(fromRight?index--:++index<length){if(iteratee(iterable[index],index,iterable)===false){break}}return collection}}function createBaseFor(fromRight){return function(object,iteratee,keysFunc){var iterable=toObject(object),props=keysFunc(object),length=props.length,index=fromRight?length:-1;while(fromRight?index--:++index<length){var key=props[index];if(iteratee(iterable[key],key,iterable)===false){break}}return object}}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function toObject(value){return isObject(value)?value:Object(value)}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=baseEach},{"lodash.keys":35}],32:[function(require,module,exports){function baseFind(collection,predicate,eachFunc,retKey){var result;eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection)){result=retKey?key:value;return false}});return result}module.exports=baseFind},{}],33:[function(require,module,exports){function baseFindIndex(array,predicate,fromRight){var length=array.length,index=fromRight?length:-1;while(fromRight?index--:++index<length){if(predicate(array[index],index,array)){return index}}return-1}module.exports=baseFindIndex},{}],34:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],35:[function(require,module,exports){arguments[4][10][0].apply(exports,arguments)},{dup:10,"lodash.isarguments":36,"lodash.isarray":34,"lodash.isnative":37}],36:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],37:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],38:[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-dom-bindings"]=window.ampersand["ampersand-dom-bindings"]||[];window.ampersand["ampersand-dom-bindings"].push("3.5.0")}var Store=require("key-tree-store");var dom=require("ampersand-dom");var matchesSelector=require("matches-selector");module.exports=function(bindings,context){var store=new Store;var key,current;for(key in bindings){current=bindings[key];if(typeof current==="string"){store.add(key,getBindingFunc({type:"text",selector:current}))}else if(current.forEach){current.forEach(function(binding){store.add(key,getBindingFunc(binding,context))})}else{store.add(key,getBindingFunc(current,context))}}return store};var slice=Array.prototype.slice;function getMatches(el,selector){if(selector==="")return[el];var matches=[];if(matchesSelector(el,selector))matches.push(el);return matches.concat(slice.call(el.querySelectorAll(selector)))}function setAttributes(el,attrs){for(var name in attrs){dom.setAttribute(el,name,attrs[name])}}function removeAttributes(el,attrs){for(var name in attrs){dom.removeAttribute(el,name)}}function makeArray(val){return Array.isArray(val)?val:[val]}function getBindingFunc(binding,context){var type=binding.type||"text";var isCustomBinding=typeof type==="function";var selector=function(){if(typeof binding.selector==="string"){return binding.selector}else if(binding.hook){return'[data-hook~="'+binding.hook+'"]'}else{return""}}();var yes=binding.yes;var no=binding.no;var hasYesNo=!!(yes||no);var previousValue;if(isCustomBinding){return function(el,value){getMatches(el,selector).forEach(function(match){type.call(context,match,value,previousValue)});previousValue=value}}else if(type==="text"){return function(el,value){getMatches(el,selector).forEach(function(match){dom.text(match,value)})}}else if(type==="class"){return function(el,value){getMatches(el,selector).forEach(function(match){dom.switchClass(match,previousValue,value)});previousValue=value}}else if(type==="attribute"){if(!binding.name)throw Error('attribute bindings must have a "name"');return function(el,value){var names=makeArray(binding.name);getMatches(el,selector).forEach(function(match){names.forEach(function(name){dom.setAttribute(match,name,value)})});previousValue=value}}else if(type==="value"){return function(el,value){getMatches(el,selector).forEach(function(match){if(!value&&value!==0)value="";if(document.activeElement!==match)match.value=value});previousValue=value}}else if(type==="booleanClass"){if(hasYesNo){yes=makeArray(yes||"");no=makeArray(no||"");return function(el,value){var prevClass=value?no:yes;var newClass=value?yes:no;getMatches(el,selector).forEach(function(match){prevClass.forEach(function(pc){dom.removeClass(match,pc)});newClass.forEach(function(nc){dom.addClass(match,nc)})})}}else{return function(el,value,keyName){var name=makeArray(binding.name||keyName);getMatches(el,selector).forEach(function(match){name.forEach(function(className){dom[value?"addClass":"removeClass"](match,className)})})}}}else if(type==="booleanAttribute"){if(hasYesNo){yes=makeArray(yes||"");no=makeArray(no||"");return function(el,value){var prevAttribute=value?no:yes;var newAttribute=value?yes:no;getMatches(el,selector).forEach(function(match){prevAttribute.forEach(function(pa){if(pa){dom.removeAttribute(match,pa)}});newAttribute.forEach(function(na){if(na){dom.addAttribute(match,na)}})})}}else{return function(el,value,keyName){var name=makeArray(binding.name||keyName);getMatches(el,selector).forEach(function(match){name.forEach(function(attr){dom[value?"addAttribute":"removeAttribute"](match,attr)})})}}}else if(type==="toggle"){var mode=binding.mode||"display";if(hasYesNo){return function(el,value){getMatches(el,yes).forEach(function(match){dom[value?"show":"hide"](match,mode)});getMatches(el,no).forEach(function(match){dom[value?"hide":"show"](match,mode)})}}else{return function(el,value){getMatches(el,selector).forEach(function(match){dom[value?"show":"hide"](match,mode)})}}}else if(type==="switch"){if(!binding.cases)throw Error('switch bindings must have "cases"');return function(el,value){for(var item in binding.cases){getMatches(el,binding.cases[item]).forEach(function(match){dom[value===item?"show":"hide"](match)})}}}else if(type==="innerHTML"){return function(el,value){getMatches(el,selector).forEach(function(match){dom.html(match,value)})}}else if(type==="switchClass"){if(!binding.cases)throw Error('switchClass bindings must have "cases"');return function(el,value,keyName){var name=makeArray(binding.name||keyName);for(var item in binding.cases){getMatches(el,binding.cases[item]).forEach(function(match){name.forEach(function(className){dom[value===item?"addClass":"removeClass"](match,className)})})}}}else if(type==="switchAttribute"){if(!binding.cases)throw Error('switchAttribute bindings must have "cases"');return function(el,value,keyName){getMatches(el,selector).forEach(function(match){if(previousValue){removeAttributes(match,previousValue)}if(value in binding.cases){var attrs=binding.cases[value];if(typeof attrs==="string"){attrs={};attrs[binding.name||keyName]=binding.cases[value]}setAttributes(match,attrs);previousValue=attrs}})}}else{throw new Error("no such binding type: "+type)}}},{"ampersand-dom":1,"key-tree-store":39,"matches-selector":165}],39:[function(require,module,exports){var slice=Array.prototype.slice;function KeyTreeStore(){this.storage={}}KeyTreeStore.prototype.add=function(keypath,obj){var arr=this.storage[keypath]||(this.storage[keypath]=[]);arr.push(obj)};KeyTreeStore.prototype.remove=function(obj){var path,arr;for(path in this.storage){arr=this.storage[path];arr.some(function(item,index){if(item===obj){arr.splice(index,1);return true}})}};KeyTreeStore.prototype.get=function(keypath){var res=[];var key;for(key in this.storage){if(!keypath||keypath===key||key.indexOf(keypath+".")===0){res=res.concat(this.storage[key])}}return res};KeyTreeStore.prototype.getGrouped=function(keypath){var res={};var key;for(key in this.storage){if(!keypath||keypath===key||key.indexOf(keypath+".")===0){res[key]=slice.call(this.storage[key])}}return res};KeyTreeStore.prototype.getAll=function(keypath){var res={};var key;for(key in this.storage){if(keypath===key||key.indexOf(keypath+".")===0){res[key]=slice.call(this.storage[key])}}return res};KeyTreeStore.prototype.run=function(keypath,context){var args=slice.call(arguments,2);this.get(keypath).forEach(function(fn){fn.apply(context||this,args)})};module.exports=KeyTreeStore},{}],40:[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-state"]=window.ampersand["ampersand-state"]||[];window.ampersand["ampersand-state"].push("4.5.3")}var uniqueId=require("lodash.uniqueid");var assign=require("lodash.assign");var omit=require("lodash.omit");var escape=require("lodash.escape");var forEach=require("lodash.foreach");var includes=require("lodash.includes");var isString=require("lodash.isstring");var isObject=require("lodash.isobject");var isArray=require("lodash.isarray");var isDate=require("lodash.isdate");var isUndefined=require("lodash.isundefined");var isFunction=require("lodash.isfunction");var isNull=require("lodash.isnull");var isEmpty=require("lodash.isempty");var isEqual=require("lodash.isequal");var clone=require("lodash.clone");var has=require("lodash.has");var result=require("lodash.result");var keys=require("lodash.keys");var bind=require("lodash.bind");var defaults=require("lodash.defaults");var union=require("lodash.union");var Events=require("ampersand-events");var KeyTree=require("key-tree-store");var arrayNext=require("array-next");var changeRE=/^change:/;function Base(attrs,options){options||(options={});this.cid||(this.cid=uniqueId("state"));this._events={};this._values={};this._definition=Object.create(this._definition);if(options.parse)attrs=this.parse(attrs,options);this.parent=options.parent;this.collection=options.collection;this._keyTree=new KeyTree;this._initCollections();this._initChildren();this._cache={};this._previousAttributes={};if(attrs)this.set(attrs,assign({silent:true,initial:true},options));this._changed={};if(this._derived)this._initDerived();if(options.init!==false)this.initialize.apply(this,arguments)}assign(Base.prototype,Events,{extraProperties:"ignore",idAttribute:"id",namespaceAttribute:"namespace",typeAttribute:"modelType",initialize:function(){return this},getId:function(){return this[this.idAttribute]},getNamespace:function(){return this[this.namespaceAttribute]},getType:function(){return this[this.typeAttribute]},isNew:function(){return this.getId()==null},escape:function(attr){return escape(this.get(attr))},isValid:function(options){return this._validate({},assign(options||{},{validate:true}))},parse:function(resp,options){return resp},serialize:function(){var res=this.getAttributes({props:true},true);forEach(this._children,function(value,key){res[key]=this[key].serialize()},this);forEach(this._collections,function(value,key){res[key]=this[key].serialize()},this);return res},set:function(key,value,options){var self=this;var extraProperties=this.extraProperties;var changing,changes,newType,newVal,def,cast,err,attr,attrs,dataType,silent,unset,currentVal,initial,hasChanged,isEqual;if(isObject(key)||key===null){attrs=key;options=value}else{attrs={};attrs[key]=value}options=options||{};if(!this._validate(attrs,options))return false;unset=options.unset;silent=options.silent;initial=options.initial;changes=[];changing=this._changing;this._changing=true;if(!changing){this._previousAttributes=this.attributes;this._changed={}}for(attr in attrs){newVal=attrs[attr];newType=typeof newVal;currentVal=this._values[attr];def=this._definition[attr];if(!def){if(this._children[attr]||this._collections[attr]){this[attr].set(newVal,options);continue}else if(extraProperties==="ignore"){continue}else if(extraProperties==="reject"){throw new TypeError('No "'+attr+'" property defined on '+(this.type||"this")+' model and extraProperties not set to "ignore" or "allow"')}else if(extraProperties==="allow"){def=this._createPropertyDefinition(attr,"any")}else if(extraProperties){throw new TypeError('Invalid value for extraProperties: "'+extraProperties+'"')}}isEqual=this._getCompareForType(def.type);dataType=this._dataTypes[def.type];if(dataType&&dataType.set){cast=dataType.set(newVal);newVal=cast.val;newType=cast.type}if(def.test){err=def.test.call(this,newVal,newType);if(err){throw new TypeError("Property '"+attr+"' failed validation with error: "+err)}}if(isUndefined(newVal)&&def.required){throw new TypeError("Required property '"+attr+"' must be of type "+def.type+". Tried to set "+newVal)}if(isNull(newVal)&&def.required&&!def.allowNull){throw new TypeError("Property '"+attr+"' must be of type "+def.type+" (cannot be null). Tried to set "+newVal); | |
}if(def.type&&def.type!=="any"&&def.type!==newType&&!isNull(newVal)&&!isUndefined(newVal)){throw new TypeError("Property '"+attr+"' must be of type "+def.type+". Tried to set "+newVal)}if(def.values&&!includes(def.values,newVal)){throw new TypeError("Property '"+attr+"' must be one of values: "+def.values.join(", ")+". Tried to set "+newVal)}hasChanged=!isEqual(currentVal,newVal,attr);if(def.setOnce&¤tVal!==undefined&&hasChanged&&!initial){throw new TypeError("Property '"+attr+"' can only be set once.")}if(hasChanged){changes.push({prev:currentVal,val:newVal,key:attr});self._changed[attr]=newVal}else{delete self._changed[attr]}}forEach(changes,function(change){self._previousAttributes[change.key]=change.prev;if(unset){delete self._values[change.key]}else{self._values[change.key]=change.val}});if(!silent&&changes.length)self._pending=true;if(!silent){forEach(changes,function(change){self.trigger("change:"+change.key,self,change.val,options)})}if(changing)return this;if(!silent){while(this._pending){this._pending=false;this.trigger("change",this,options)}}this._pending=false;this._changing=false;return this},get:function(attr){return this[attr]},toggle:function(property){var def=this._definition[property];if(def.type==="boolean"){this[property]=!this[property]}else if(def&&def.values){this[property]=arrayNext(def.values,this[property])}else{throw new TypeError("Can only toggle properties that are type `boolean` or have `values` array.")}return this},previousAttributes:function(){return clone(this._previousAttributes)},hasChanged:function(attr){if(attr==null)return!isEmpty(this._changed);return has(this._changed,attr)},changedAttributes:function(diff){if(!diff)return this.hasChanged()?clone(this._changed):false;var val,changed=false;var old=this._changing?this._previousAttributes:this.attributes;var def,isEqual;for(var attr in diff){def=this._definition[attr];if(!def)continue;isEqual=this._getCompareForType(def.type);if(isEqual(old[attr],val=diff[attr]))continue;(changed||(changed={}))[attr]=val}return changed},toJSON:function(){return this.serialize()},unset:function(attrs,options){attrs=Array.isArray(attrs)?attrs:[attrs];forEach(attrs,function(key){var def=this._definition[key];var val;if(def.required){val=result(def,"default");return this.set(key,val,options)}else{return this.set(key,val,assign({},options,{unset:true}))}},this)},clear:function(options){var self=this;forEach(keys(this.attributes),function(key){self.unset(key,options)});return this},previous:function(attr){if(attr==null||!Object.keys(this._previousAttributes).length)return null;return this._previousAttributes[attr]},_getDefaultForType:function(type){var dataType=this._dataTypes[type];return dataType&&dataType.default},_getCompareForType:function(type){var dataType=this._dataTypes[type];if(dataType&&dataType.compare)return bind(dataType.compare,this);return isEqual},_validate:function(attrs,options){if(!options.validate||!this.validate)return true;attrs=assign({},this.attributes,attrs);var error=this.validationError=this.validate(attrs,options)||null;if(!error)return true;this.trigger("invalid",this,error,assign(options||{},{validationError:error}));return false},_createPropertyDefinition:function(name,desc,isSession){return createPropertyDefinition(this,name,desc,isSession)},_ensureValidType:function(type){return includes(["string","number","boolean","array","object","date","any"].concat(keys(this._dataTypes)),type)?type:undefined},getAttributes:function(options,raw){options||(options={});defaults(options,{session:false,props:false,derived:false});var res={};var val,item,def;for(item in this._definition){def=this._definition[item];if(options.session&&def.session||options.props&&!def.session){val=raw?this._values[item]:this[item];if(typeof val==="undefined")val=result(def,"default");if(typeof val!=="undefined")res[item]=val}}if(options.derived){for(item in this._derived)res[item]=this[item]}return res},_initDerived:function(){var self=this;forEach(this._derived,function(value,name){var def=self._derived[name];def.deps=def.depList;var update=function(options){options=options||{};var newVal=def.fn.call(self);if(self._cache[name]!==newVal||!def.cache){if(def.cache){self._previousAttributes[name]=self._cache[name]}self._cache[name]=newVal;self.trigger("change:"+name,self,self._cache[name])}};def.deps.forEach(function(propString){self._keyTree.add(propString,update)})});this.on("all",function(eventName){if(changeRE.test(eventName)){self._keyTree.get(eventName.split(":")[1]).forEach(function(fn){fn()})}},this)},_getDerivedProperty:function(name,flushCache){if(this._derived[name].cache){if(flushCache||!this._cache.hasOwnProperty(name)){this._cache[name]=this._derived[name].fn.apply(this)}return this._cache[name]}else{return this._derived[name].fn.apply(this)}},_initCollections:function(){var coll;if(!this._collections)return;for(coll in this._collections){this[coll]=new this._collections[coll](null,{parent:this})}},_initChildren:function(){var child;if(!this._children)return;for(child in this._children){this[child]=new this._children[child]({},{parent:this});this.listenTo(this[child],"all",this._getEventBubblingHandler(child))}},_getEventBubblingHandler:function(propertyName){return bind(function(name,model,newValue){if(changeRE.test(name)){this.trigger("change:"+propertyName+"."+name.split(":")[1],model,newValue)}else if(name==="change"){this.trigger("change",this)}},this)},_verifyRequired:function(){var attrs=this.attributes;for(var def in this._definition){if(this._definition[def].required&&typeof attrs[def]==="undefined"){return false}}return true}});Object.defineProperties(Base.prototype,{attributes:{get:function(){return this.getAttributes({props:true,session:true})}},all:{get:function(){return this.getAttributes({session:true,props:true,derived:true})}},isState:{get:function(){return true},set:function(){}}});function createPropertyDefinition(object,name,desc,isSession){var def=object._definition[name]={};var type,descArray;if(isString(desc)){type=object._ensureValidType(desc);if(type)def.type=type}else{if(isArray(desc)){descArray=desc;desc={type:descArray[0],required:descArray[1],"default":descArray[2]}}type=object._ensureValidType(desc.type);if(type)def.type=type;if(desc.required)def.required=true;if(desc.default&&typeof desc.default==="object"){throw new TypeError("The default value for "+name+" cannot be an object/array, must be a value or a function which returns a value/object/array")}def.default=desc.default;def.allowNull=desc.allowNull?desc.allowNull:false;if(desc.setOnce)def.setOnce=true;if(def.required&&isUndefined(def.default)&&!def.setOnce)def.default=object._getDefaultForType(type);def.test=desc.test;def.values=desc.values}if(isSession)def.session=true;Object.defineProperty(object,name,{set:function(val){this.set(name,val)},get:function(){var value=this._values[name];var typeDef=this._dataTypes[def.type];if(typeof value!=="undefined"){if(typeDef&&typeDef.get){value=typeDef.get(value)}return value}value=result(def,"default");this._values[name]=value;return value}});return def}function createDerivedProperty(modelProto,name,definition){var def=modelProto._derived[name]={fn:isFunction(definition)?definition:definition.fn,cache:definition.cache!==false,depList:definition.deps||[]};forEach(def.depList,function(dep){modelProto._deps[dep]=union(modelProto._deps[dep]||[],[name])});Object.defineProperty(modelProto,name,{get:function(){return this._getDerivedProperty(name)},set:function(){throw new TypeError('"'+name+"\" is a derived property, it can't be set directly.")}})}var dataTypes={string:{"default":function(){return""}},date:{set:function(newVal){var newType;if(newVal==null){newType=typeof null}else if(!isDate(newVal)){try{var dateVal=new Date(newVal).valueOf();if(isNaN(dateVal)){dateVal=new Date(parseInt(newVal,10)).valueOf();if(isNaN(dateVal))throw TypeError}newVal=dateVal;newType="date"}catch(e){newType=typeof newVal}}else{newType="date";newVal=newVal.valueOf()}return{val:newVal,type:newType}},get:function(val){if(val==null){return val}return new Date(val)},"default":function(){return new Date}},array:{set:function(newVal){return{val:newVal,type:isArray(newVal)?"array":typeof newVal}},"default":function(){return[]}},object:{set:function(newVal){var newType=typeof newVal;if(newType!=="object"&&isUndefined(newVal)){newVal=null;newType="object"}return{val:newVal,type:newType}},"default":function(){return{}}},state:{set:function(newVal){var isInstance=newVal instanceof Base||newVal&&newVal.isState;if(isInstance){return{val:newVal,type:"state"}}else{return{val:newVal,type:typeof newVal}}},compare:function(currentVal,newVal,attributeName){var isSame=currentVal===newVal;if(!isSame){if(currentVal){this.stopListening(currentVal)}if(newVal!=null){this.listenTo(newVal,"all",this._getEventBubblingHandler(attributeName))}}return isSame}}};function extend(protoProps){var parent=this;var child;var args=[].slice.call(arguments);if(protoProps&&protoProps.hasOwnProperty("constructor")){child=protoProps.constructor}else{child=function(){return parent.apply(this,arguments)}}assign(child,parent);var Surrogate=function(){this.constructor=child};Surrogate.prototype=parent.prototype;child.prototype=new Surrogate;child.prototype._derived=assign({},parent.prototype._derived);child.prototype._deps=assign({},parent.prototype._deps);child.prototype._definition=assign({},parent.prototype._definition);child.prototype._collections=assign({},parent.prototype._collections);child.prototype._children=assign({},parent.prototype._children);child.prototype._dataTypes=assign({},parent.prototype._dataTypes||dataTypes);if(protoProps){var omitFromExtend=["dataTypes","props","session","derived","collections","children"];args.forEach(function processArg(def){if(def.dataTypes){forEach(def.dataTypes,function(def,name){child.prototype._dataTypes[name]=def})}if(def.props){forEach(def.props,function(def,name){createPropertyDefinition(child.prototype,name,def)})}if(def.session){forEach(def.session,function(def,name){createPropertyDefinition(child.prototype,name,def,true)})}if(def.derived){forEach(def.derived,function(def,name){createDerivedProperty(child.prototype,name,def)})}if(def.collections){forEach(def.collections,function(constructor,name){child.prototype._collections[name]=constructor})}if(def.children){forEach(def.children,function(constructor,name){child.prototype._children[name]=constructor})}assign(child.prototype,omit(def,omitFromExtend))})}child.__super__=parent.prototype;return child}Base.extend=extend;module.exports=Base},{"ampersand-events":41,"array-next":44,"key-tree-store":45,"lodash.assign":111,"lodash.bind":121,"lodash.clone":46,"lodash.defaults":55,"lodash.escape":57,"lodash.foreach":132,"lodash.has":59,"lodash.includes":60,"lodash.isarray":64,"lodash.isdate":65,"lodash.isempty":66,"lodash.isequal":68,"lodash.isfunction":72,"lodash.isnull":73,"lodash.isobject":74,"lodash.isstring":147,"lodash.isundefined":75,"lodash.keys":76,"lodash.omit":79,"lodash.result":161,"lodash.union":95,"lodash.uniqueid":163}],41:[function(require,module,exports){arguments[4][5][0].apply(exports,arguments)},{dup:5,"lodash.assign":111,"lodash.bind":121,"lodash.foreach":132,"lodash.isempty":66,"lodash.keys":76,"lodash.once":42,"lodash.uniqueid":163}],42:[function(require,module,exports){arguments[4][14][0].apply(exports,arguments)},{dup:14,"lodash.before":43}],43:[function(require,module,exports){arguments[4][15][0].apply(exports,arguments)},{dup:15}],44:[function(require,module,exports){module.exports=function arrayNext(array,currentItem){var len=array.length;var newIndex=array.indexOf(currentItem)+1;if(newIndex>len-1)newIndex=0;return array[newIndex]}},{}],45:[function(require,module,exports){arguments[4][39][0].apply(exports,arguments)},{dup:39}],46:[function(require,module,exports){var baseClone=require("lodash._baseclone"),bindCallback=require("lodash._bindcallback"),isIterateeCall=require("lodash._isiterateecall");function clone(value,isDeep,customizer,thisArg){if(isDeep&&typeof isDeep!="boolean"&&isIterateeCall(value,isDeep,customizer)){isDeep=false}else if(typeof isDeep=="function"){thisArg=customizer;customizer=isDeep;isDeep=false}customizer=typeof customizer=="function"&&bindCallback(customizer,thisArg,1);return baseClone(value,isDeep,customizer)}module.exports=clone},{"lodash._baseclone":47,"lodash._bindcallback":53,"lodash._isiterateecall":54}],47:[function(require,module,exports){(function(global){var arrayCopy=require("lodash._arraycopy"),arrayEach=require("lodash._arrayeach"),baseCopy=require("lodash._basecopy"),baseFor=require("lodash._basefor"),isArray=require("lodash.isarray"),isNative=require("lodash.isnative"),keys=require("lodash.keys");var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]";var arrayBufferTag="[object ArrayBuffer]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var reFlags=/\w*$/;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[stringTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[mapTag]=cloneableTags[setTag]=cloneableTags[weakMapTag]=false;var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var objToString=objectProto.toString;var ArrayBuffer=isNative(ArrayBuffer=global.ArrayBuffer)&&ArrayBuffer,bufferSlice=isNative(bufferSlice=ArrayBuffer&&new ArrayBuffer(0).slice)&&bufferSlice,floor=Math.floor,Uint8Array=isNative(Uint8Array=global.Uint8Array)&&Uint8Array;var Float64Array=function(){try{var func=isNative(func=global.Float64Array)&&func,result=new func(new ArrayBuffer(10),0,1)&&func}catch(e){}return result}();var FLOAT64_BYTES_PER_ELEMENT=Float64Array?Float64Array.BYTES_PER_ELEMENT:0;function baseClone(value,isDeep,customizer,key,object,stackA,stackB){var result;if(customizer){result=object?customizer(value,key,object):customizer(value)}if(typeof result!="undefined"){return result}if(!isObject(value)){return value}var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep){return arrayCopy(value,result)}}else{var tag=objToString.call(value),isFunc=tag==funcTag;if(tag==objectTag||tag==argsTag||isFunc&&!object){result=initCloneObject(isFunc?{}:value);if(!isDeep){return baseCopy(value,result,keys(value))}}else{return cloneableTags[tag]?initCloneByTag(value,tag,isDeep):object?value:{}}}stackA||(stackA=[]);stackB||(stackB=[]);var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}stackA.push(value);stackB.push(result);(isArr?arrayEach:baseForOwn)(value,function(subValue,key){result[key]=baseClone(subValue,isDeep,customizer,key,value,stackA,stackB)});return result}function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function bufferClone(buffer){return bufferSlice.call(buffer,0)}if(!bufferSlice){bufferClone=!(ArrayBuffer&&Uint8Array)?constant(null):function(buffer){var byteLength=buffer.byteLength,floatLength=Float64Array?floor(byteLength/FLOAT64_BYTES_PER_ELEMENT):0,offset=floatLength*FLOAT64_BYTES_PER_ELEMENT,result=new ArrayBuffer(byteLength);if(floatLength){var view=new Float64Array(result,0,floatLength);view.set(new Float64Array(buffer,0,floatLength))}if(byteLength!=offset){view=new Uint8Array(result,offset);view.set(new Uint8Array(buffer,offset))}return result}}function initCloneArray(array){var length=array.length,result=new array.constructor(length);if(length&&typeof array[0]=="string"&&hasOwnProperty.call(array,"index")){result.index=array.index;result.input=array.input}return result}function initCloneObject(object){var Ctor=object.constructor;if(!(typeof Ctor=="function"&&Ctor instanceof Ctor)){Ctor=Object}return new Ctor}function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return bufferClone(object);case boolTag:case dateTag:return new Ctor(+object);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:var buffer=object.buffer;return new Ctor(isDeep?bufferClone(buffer):buffer,object.byteOffset,object.length);case numberTag:case stringTag:return new Ctor(object);case regexpTag:var result=new Ctor(object.source,reFlags.exec(object));result.lastIndex=object.lastIndex}return result}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}function constant(value){return function(){return value}}module.exports=baseClone}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash._arraycopy":48,"lodash._arrayeach":49,"lodash._basecopy":50,"lodash._basefor":51,"lodash.isarray":64,"lodash.isnative":52,"lodash.keys":76}],48:[function(require,module,exports){function arrayCopy(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length){array[index]=source[index]}return array}module.exports=arrayCopy},{}],49:[function(require,module,exports){function arrayEach(array,iteratee){var index=-1,length=array.length;while(++index<length){if(iteratee(array[index],index,array)===false){break}}return array}module.exports=arrayEach},{}],50:[function(require,module,exports){function baseCopy(source,object,props){if(!props){props=object;object={}}var index=-1,length=props.length;while(++index<length){var key=props[index];object[key]=source[key]}return object}module.exports=baseCopy},{}],51:[function(require,module,exports){var baseFor=createBaseFor();function createBaseFor(fromRight){return function(object,iteratee,keysFunc){var iterable=toObject(object),props=keysFunc(object),length=props.length,index=fromRight?length:-1;while(fromRight?index--:++index<length){var key=props[index];if(iteratee(iterable[key],key,iterable)===false){break}}return object}}function toObject(value){return isObject(value)?value:Object(value)}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=baseFor},{}],52:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],53:[function(require,module,exports){arguments[4][30][0].apply(exports,arguments)},{dup:30}],54:[function(require,module,exports){var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isIndex(value,length){value=+value;length=length==null?MAX_SAFE_INTEGER:length;return value>-1&&value%1==0&&value<length}function isIterateeCall(value,index,object){if(!isObject(object)){return false}var type=typeof index;if(type=="number"){var length=object.length,prereq=isLength(length)&&isIndex(index,length)}else{prereq=type=="string"&&index in object}if(prereq){var other=object[index];return value===value?value===other:other!==other}return false}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=isIterateeCall},{}],55:[function(require,module,exports){var assign=require("lodash.assign"),restParam=require("lodash.restparam");function assignDefaults(objectValue,sourceValue){return typeof objectValue=="undefined"?sourceValue:objectValue}var defaults=restParam(function(args){var object=args[0];if(object==null){return object}args.push(assignDefaults);return assign.apply(undefined,args)});module.exports=defaults},{"lodash.assign":111,"lodash.restparam":56}],56:[function(require,module,exports){arguments[4][25][0].apply(exports,arguments)},{dup:25}],57:[function(require,module,exports){var baseToString=require("lodash._basetostring");var reUnescapedHtml=/[&<>"'`]/g,reHasUnescapedHtml=RegExp(reUnescapedHtml.source);var htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function escapeHtmlChar(chr){return htmlEscapes[chr]}function escape(string){string=baseToString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}module.exports=escape},{"lodash._basetostring":58}],58:[function(require,module,exports){function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}module.exports=baseToString},{}],59:[function(require,module,exports){var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function has(object,key){return object?hasOwnProperty.call(object,key):false}module.exports=has},{}],60:[function(require,module,exports){var baseIndexOf=require("lodash._baseindexof"),baseValues=require("lodash._basevalues"),isIterateeCall=require("lodash._isiterateecall"),isArray=require("lodash.isarray"),isString=require("lodash.isstring"),keys=require("lodash.keys");var nativeMax=Math.max;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function includes(collection,target,fromIndex,guard){var length=collection?collection.length:0;if(!isLength(length)){collection=values(collection);length=collection.length}if(!length){return false}if(typeof fromIndex!="number"||guard&&isIterateeCall(target,fromIndex,guard)){fromIndex=0}else{fromIndex=fromIndex<0?nativeMax(length+fromIndex,0):fromIndex||0}return typeof collection=="string"||!isArray(collection)&&isString(collection)?fromIndex<length&&collection.indexOf(target,fromIndex)>-1:baseIndexOf(collection,target,fromIndex)>-1}function values(object){return baseValues(object,keys(object))}module.exports=includes},{"lodash._baseindexof":61,"lodash._basevalues":62,"lodash._isiterateecall":63,"lodash.isarray":64,"lodash.isstring":147,"lodash.keys":76}],61:[function(require,module,exports){arguments[4][18][0].apply(exports,arguments)},{dup:18}],62:[function(require,module,exports){function baseValues(object,props){var index=-1,length=props.length,result=Array(length);while(++index<length){result[index]=object[props[index]]}return result}module.exports=baseValues},{}],63:[function(require,module,exports){arguments[4][54][0].apply(exports,arguments)},{dup:54}],64:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],65:[function(require,module,exports){var dateTag="[object Date]";function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var objToString=objectProto.toString;function isDate(value){return isObjectLike(value)&&objToString.call(value)==dateTag}module.exports=isDate},{}],66:[function(require,module,exports){arguments[4][6][0].apply(exports,arguments)},{dup:6,"lodash.isarguments":67,"lodash.isarray":64,"lodash.isfunction":72,"lodash.isstring":147,"lodash.keys":76}],67:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],68:[function(require,module,exports){var baseIsEqual=require("lodash._baseisequal"),bindCallback=require("lodash._bindcallback");function isStrictComparable(value){return value===value&&(value===0?1/value>0:!isObject(value))}function isEqual(value,other,customizer,thisArg){customizer=typeof customizer=="function"&&bindCallback(customizer,thisArg,3);if(!customizer&&isStrictComparable(value)&&isStrictComparable(other)){return value===other}var result=customizer?customizer(value,other):undefined;return typeof result=="undefined"?baseIsEqual(value,other,customizer):!!result}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=isEqual},{"lodash._baseisequal":69,"lodash._bindcallback":71}],69:[function(require,module,exports){arguments[4][28][0].apply(exports,arguments)},{dup:28,"lodash.isarray":64,"lodash.istypedarray":70,"lodash.keys":76}],70:[function(require,module,exports){arguments[4][29][0].apply(exports,arguments)},{dup:29}],71:[function(require,module,exports){arguments[4][30][0].apply(exports,arguments)},{dup:30}],72:[function(require,module,exports){(function(global){var funcTag="[object Function]";var reHostCtor=/^\[object .+?Constructor\]$/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);function baseIsFunction(value){return typeof value=="function"||false}function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var fnToString=Function.prototype.toString;var objToString=objectProto.toString;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Uint8Array=isNative(Uint8Array=global.Uint8Array)&&Uint8Array;var isFunction=!(baseIsFunction(/x/)||Uint8Array&&!baseIsFunction(Uint8Array))?baseIsFunction:function(value){return objToString.call(value)==funcTag};function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}module.exports=isFunction}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],73:[function(require,module,exports){function isNull(value){return value===null}module.exports=isNull},{}],74:[function(require,module,exports){function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=isObject},{}],75:[function(require,module,exports){function isUndefined(value){return typeof value=="undefined"}module.exports=isUndefined},{}],76:[function(require,module,exports){arguments[4][10][0].apply(exports,arguments)},{dup:10,"lodash.isarguments":77,"lodash.isarray":64,"lodash.isnative":78}],77:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],78:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],79:[function(require,module,exports){var arrayMap=require("lodash._arraymap"),baseDifference=require("lodash._basedifference"),baseFlatten=require("lodash._baseflatten"),bindCallback=require("lodash._bindcallback"),pickByArray=require("lodash._pickbyarray"),pickByCallback=require("lodash._pickbycallback"),keysIn=require("lodash.keysin"),restParam=require("lodash.restparam");var omit=restParam(function(object,props){if(object==null){return{}}if(typeof props[0]!="function"){var props=arrayMap(baseFlatten(props),String);return pickByArray(object,baseDifference(keysIn(object),props))}var predicate=bindCallback(props[0],props[1],3);return pickByCallback(object,function(value,key,object){return!predicate(value,key,object)})});module.exports=omit},{"lodash._arraymap":80,"lodash._basedifference":81,"lodash._baseflatten":86,"lodash._bindcallback":88,"lodash._pickbyarray":89,"lodash._pickbycallback":90,"lodash.keysin":92,"lodash.restparam":94}],80:[function(require,module,exports){function arrayMap(array,iteratee){var index=-1,length=array.length,result=Array(length);while(++index<length){result[index]=iteratee(array[index],index,array)}return result}module.exports=arrayMap},{}],81:[function(require,module,exports){arguments[4][17][0].apply(exports,arguments)},{dup:17,"lodash._baseindexof":82,"lodash._cacheindexof":83,"lodash._createcache":84}],82:[function(require,module,exports){arguments[4][18][0].apply(exports,arguments)},{dup:18}],83:[function(require,module,exports){arguments[4][19][0].apply(exports,arguments)},{dup:19}],84:[function(require,module,exports){(function(global){var isNative=require("lodash.isnative");var Set=isNative(Set=global.Set)&&Set;var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate;function SetCache(values){var length=values?values.length:0;this.data={hash:nativeCreate(null),set:new Set};while(length--){this.push(values[length])}}function cachePush(value){var data=this.data;if(typeof value=="string"||isObject(value)){data.set.add(value)}else{data.hash[value]=true}}var createCache=!(nativeCreate&&Set)?constant(null):function(values){return new SetCache(values)};function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}function constant(value){return function(){return value}}SetCache.prototype.push=cachePush;module.exports=createCache}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash.isnative":85}],85:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],86:[function(require,module,exports){arguments[4][22][0].apply(exports,arguments)},{dup:22,"lodash.isarguments":87,"lodash.isarray":64}],87:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],88:[function(require,module,exports){arguments[4][30][0].apply(exports,arguments)},{dup:30}],89:[function(require,module,exports){function pickByArray(object,props){object=toObject(object);var index=-1,length=props.length,result={};while(++index<length){var key=props[index];if(key in object){result[key]=object[key]}}return result}function toObject(value){return isObject(value)?value:Object(value)}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=pickByArray},{}],90:[function(require,module,exports){var baseFor=require("lodash._basefor"),keysIn=require("lodash.keysin");function baseForIn(object,iteratee){return baseFor(object,iteratee,keysIn)}function pickByCallback(object,predicate){var result={};baseForIn(object,function(value,key,object){if(predicate(value,key,object)){result[key]=value}});return result}module.exports=pickByCallback},{"lodash._basefor":91,"lodash.keysin":92}],91:[function(require,module,exports){arguments[4][51][0].apply(exports,arguments)},{dup:51}],92:[function(require,module,exports){var isArguments=require("lodash.isarguments"),isArray=require("lodash.isarray");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var propertyIsEnumerable=objectProto.propertyIsEnumerable;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;var support={};(function(x){try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=true}})(0,0);function isIndex(value,length){value=+value;length=length==null?MAX_SAFE_INTEGER:length;return value>-1&&value%1==0&&value<length}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}function keysIn(object){if(object==null){return[]}if(!isObject(object)){object=Object(object)}var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;var Ctor=object.constructor,index=-1,isProto=typeof Ctor=="function"&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;while(++index<length){result[index]=index+""}for(var key in object){if(!(skipIndexes&&isIndex(key,length))&&!(key=="constructor"&&(isProto||!hasOwnProperty.call(object,key)))){result.push(key)}}return result}module.exports=keysIn; | |
},{"lodash.isarguments":93,"lodash.isarray":64}],93:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],94:[function(require,module,exports){arguments[4][25][0].apply(exports,arguments)},{dup:25}],95:[function(require,module,exports){var baseFlatten=require("lodash._baseflatten"),baseUniq=require("lodash._baseuniq"),restParam=require("lodash.restparam");var union=restParam(function(arrays){return baseUniq(baseFlatten(arrays,false,true))});module.exports=union},{"lodash._baseflatten":96,"lodash._baseuniq":98,"lodash.restparam":103}],96:[function(require,module,exports){arguments[4][22][0].apply(exports,arguments)},{dup:22,"lodash.isarguments":97,"lodash.isarray":64}],97:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],98:[function(require,module,exports){var baseIndexOf=require("lodash._baseindexof"),cacheIndexOf=require("lodash._cacheindexof"),createCache=require("lodash._createcache");function baseUniq(array,iteratee){var index=-1,indexOf=baseIndexOf,length=array.length,isCommon=true,isLarge=isCommon&&length>=200,seen=isLarge?createCache():null,result=[];if(seen){indexOf=cacheIndexOf;isCommon=false}else{isLarge=false;seen=iteratee?[]:result}outer:while(++index<length){var value=array[index],computed=iteratee?iteratee(value,index,array):value;if(isCommon&&value===value){var seenIndex=seen.length;while(seenIndex--){if(seen[seenIndex]===computed){continue outer}}if(iteratee){seen.push(computed)}result.push(value)}else if(indexOf(seen,computed,0)<0){if(iteratee||isLarge){seen.push(computed)}result.push(value)}}return result}module.exports=baseUniq},{"lodash._baseindexof":99,"lodash._cacheindexof":100,"lodash._createcache":101}],99:[function(require,module,exports){arguments[4][18][0].apply(exports,arguments)},{dup:18}],100:[function(require,module,exports){arguments[4][19][0].apply(exports,arguments)},{dup:19}],101:[function(require,module,exports){(function(global){var isNative=require("lodash.isnative");var Set=isNative(Set=global.Set)&&Set;var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate;function SetCache(values){var length=values?values.length:0;this.data={hash:nativeCreate(null),set:new Set};while(length--){this.push(values[length])}}function cachePush(value){var data=this.data;if(typeof value=="string"||isObject(value)){data.set.add(value)}else{data.hash[value]=true}}var createCache=!(nativeCreate&&Set)?constant(null):function(values){return new SetCache(values)};function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}function constant(value){return function(){return value}}SetCache.prototype.push=cachePush;module.exports=createCache}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash.isnative":102}],102:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],103:[function(require,module,exports){arguments[4][25][0].apply(exports,arguments)},{dup:25}],104:[function(require,module,exports){module.exports=parse;var div=document.createElement("div");div.innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';var innerHTMLBug=!div.getElementsByTagName("link").length;div=undefined;var map={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:innerHTMLBug?[1,"X<div>","</div>"]:[0,"",""]};map.td=map.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];map.option=map.optgroup=[1,'<select multiple="multiple">',"</select>"];map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"<table>","</table>"];map.polyline=map.ellipse=map.polygon=map.circle=map.text=map.line=map.path=map.rect=map.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function parse(html,doc){if("string"!=typeof html)throw new TypeError("String expected");if(!doc)doc=document;var m=/<([\w:]+)/.exec(html);if(!m)return doc.createTextNode(html);html=html.replace(/^\s+|\s+$/g,"");var tag=m[1];if(tag=="body"){var el=doc.createElement("html");el.innerHTML=html;return el.removeChild(el.lastChild)}var wrap=map[tag]||map._default;var depth=wrap[0];var prefix=wrap[1];var suffix=wrap[2];var el=doc.createElement("div");el.innerHTML=prefix+html+suffix;while(depth--)el=el.lastChild;if(el.firstChild==el.lastChild){return el.removeChild(el.firstChild)}var fragment=doc.createDocumentFragment();while(el.firstChild){fragment.appendChild(el.removeChild(el.firstChild))}return fragment}},{}],105:[function(require,module,exports){var events=require("component-event");var delegate=require("delegate-events");var forceCaptureEvents=["focus","blur"];module.exports=Events;function Events(el,obj){if(!(this instanceof Events))return new Events(el,obj);if(!el)throw new Error("element required");if(!obj)throw new Error("object required");this.el=el;this.obj=obj;this._events={}}Events.prototype.sub=function(event,method,cb){this._events[event]=this._events[event]||{};this._events[event][method]=cb};Events.prototype.bind=function(event,method){var e=parse(event);var el=this.el;var obj=this.obj;var name=e.name;var method=method||"on"+name;var args=[].slice.call(arguments,2);function cb(){var a=[].slice.call(arguments).concat(args);if(typeof method==="function"){method.apply(obj,a);return}if(!obj[method]){throw new Error(method+" method is not defined")}else{obj[method].apply(obj,a)}}if(e.selector){cb=delegate.bind(el,e.selector,name,cb)}else{events.bind(el,name,cb)}this.sub(name,method,cb);return cb};Events.prototype.unbind=function(event,method){if(0==arguments.length)return this.unbindAll();if(1==arguments.length)return this.unbindAllOf(event);var bindings=this._events[event];var capture=forceCaptureEvents.indexOf(event)!==-1;if(!bindings)return;var cb=bindings[method];if(!cb)return;events.unbind(this.el,event,cb,capture)};Events.prototype.unbindAll=function(){for(var event in this._events){this.unbindAllOf(event)}};Events.prototype.unbindAllOf=function(event){var bindings=this._events[event];if(!bindings)return;for(var method in bindings){this.unbind(event,method)}};function parse(event){var parts=event.split(/ +/);return{name:parts.shift(),selector:parts.join(" ")}}},{"component-event":106,"delegate-events":107}],106:[function(require,module,exports){var bind=window.addEventListener?"addEventListener":"attachEvent",unbind=window.removeEventListener?"removeEventListener":"detachEvent",prefix=bind!=="addEventListener"?"on":"";exports.bind=function(el,type,fn,capture){el[bind](prefix+type,fn,capture||false);return fn};exports.unbind=function(el,type,fn,capture){el[unbind](prefix+type,fn,capture||false);return fn}},{}],107:[function(require,module,exports){var closest=require("closest"),event=require("event");var forceCaptureEvents=["focus","blur"];exports.bind=function(el,selector,type,fn,capture){if(forceCaptureEvents.indexOf(type)!==-1)capture=true;return event.bind(el,type,function(e){var target=e.target||e.srcElement;e.delegateTarget=closest(target,selector,true,el);if(e.delegateTarget)fn.call(el,e)},capture)};exports.unbind=function(el,type,fn,capture){if(forceCaptureEvents.indexOf(type)!==-1)capture=true;event.unbind(el,type,fn,capture)}},{closest:108,event:106}],108:[function(require,module,exports){var matches=require("matches-selector");module.exports=function(element,selector,checkYoSelf){var parent=checkYoSelf?element:element.parentNode;while(parent&&parent!==document){if(matches(parent,selector))return parent;parent=parent.parentNode}}},{"matches-selector":109}],109:[function(require,module,exports){var proto=Element.prototype;var vendor=proto.matchesSelector||proto.webkitMatchesSelector||proto.mozMatchesSelector||proto.msMatchesSelector||proto.oMatchesSelector;module.exports=match;function match(el,selector){if(vendor)return vendor.call(el,selector);var nodes=el.parentNode.querySelectorAll(selector);for(var i=0;i<nodes.length;++i){if(nodes[i]==el)return true}return false}},{}],110:[function(require,module,exports){module.exports=get;function get(context,path){if(path.indexOf(".")==-1&&path.indexOf("[")==-1){return context[path]}var crumbs=path.split(/\.|\[|\]/g);var i=-1;var len=crumbs.length;var result;while(++i<len){if(i==0)result=context;if(!crumbs[i])continue;if(result==undefined)break;result=result[crumbs[i]]}return result}},{}],111:[function(require,module,exports){var baseAssign=require("lodash._baseassign"),createAssigner=require("lodash._createassigner");var assign=createAssigner(baseAssign);module.exports=assign},{"lodash._baseassign":112,"lodash._createassigner":118}],112:[function(require,module,exports){var baseCopy=require("lodash._basecopy"),keys=require("lodash.keys");function baseAssign(object,source,customizer){var props=keys(source);if(!customizer){return baseCopy(source,object,props)}var index=-1,length=props.length;while(++index<length){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);if((result===result?result!==value:value===value)||typeof value=="undefined"&&!(key in object)){object[key]=result}}return object}module.exports=baseAssign},{"lodash._basecopy":113,"lodash.keys":114}],113:[function(require,module,exports){arguments[4][50][0].apply(exports,arguments)},{dup:50}],114:[function(require,module,exports){arguments[4][10][0].apply(exports,arguments)},{dup:10,"lodash.isarguments":115,"lodash.isarray":116,"lodash.isnative":117}],115:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],116:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],117:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],118:[function(require,module,exports){var bindCallback=require("lodash._bindcallback"),isIterateeCall=require("lodash._isiterateecall");function createAssigner(assigner){return function(){var args=arguments,length=args.length,object=args[0];if(length<2||object==null){return object}var customizer=args[length-2],thisArg=args[length-1],guard=args[3];if(length>3&&typeof customizer=="function"){customizer=bindCallback(customizer,thisArg,5);length-=2}else{customizer=length>2&&typeof thisArg=="function"?thisArg:null;length-=customizer?1:0}if(guard&&isIterateeCall(args[1],args[2],guard)){customizer=length==3?null:customizer;length=2}var index=0;while(++index<length){var source=args[index];if(source){assigner(object,source,customizer)}}return object}}module.exports=createAssigner},{"lodash._bindcallback":119,"lodash._isiterateecall":120}],119:[function(require,module,exports){arguments[4][30][0].apply(exports,arguments)},{dup:30}],120:[function(require,module,exports){arguments[4][54][0].apply(exports,arguments)},{dup:54}],121:[function(require,module,exports){var createWrapper=require("lodash._createwrapper"),replaceHolders=require("lodash._replaceholders"),restParam=require("lodash.restparam");var BIND_FLAG=1,PARTIAL_FLAG=32;var bind=restParam(function(func,thisArg,partials){var bitmask=BIND_FLAG;if(partials.length){var holders=replaceHolders(partials,bind.placeholder);bitmask|=PARTIAL_FLAG}return createWrapper(func,bitmask,thisArg,partials,holders)});bind.placeholder={};module.exports=bind},{"lodash._createwrapper":122,"lodash._replaceholders":125,"lodash.restparam":126}],122:[function(require,module,exports){(function(global){var arrayCopy=require("lodash._arraycopy"),baseCreate=require("lodash._basecreate"),replaceHolders=require("lodash._replaceholders");var BIND_FLAG=1,BIND_KEY_FLAG=2,CURRY_BOUND_FLAG=4,CURRY_FLAG=8,CURRY_RIGHT_FLAG=16,PARTIAL_FLAG=32,PARTIAL_RIGHT_FLAG=64,ARY_FLAG=128;var FUNC_ERROR_TEXT="Expected a function";var nativeMax=Math.max,nativeMin=Math.min;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function composeArgs(args,partials,holders){var holdersLength=holders.length,argsIndex=-1,argsLength=nativeMax(args.length-holdersLength,0),leftIndex=-1,leftLength=partials.length,result=Array(argsLength+leftLength);while(++leftIndex<leftLength){result[leftIndex]=partials[leftIndex]}while(++argsIndex<holdersLength){result[holders[argsIndex]]=args[argsIndex]}while(argsLength--){result[leftIndex++]=args[argsIndex++]}return result}function composeArgsRight(args,partials,holders){var holdersIndex=-1,holdersLength=holders.length,argsIndex=-1,argsLength=nativeMax(args.length-holdersLength,0),rightIndex=-1,rightLength=partials.length,result=Array(argsLength+rightLength);while(++argsIndex<argsLength){result[argsIndex]=args[argsIndex]}var pad=argsIndex;while(++rightIndex<rightLength){result[pad+rightIndex]=partials[rightIndex]}while(++holdersIndex<holdersLength){result[pad+holders[holdersIndex]]=args[argsIndex++]}return result}function createBindWrapper(func,thisArg){var Ctor=createCtorWrapper(func);function wrapper(){var fn=this&&this!==global&&this instanceof wrapper?Ctor:func;return fn.apply(thisArg,arguments)}return wrapper}function createCtorWrapper(Ctor){return function(){var thisBinding=baseCreate(Ctor.prototype),result=Ctor.apply(thisBinding,arguments);return isObject(result)?result:thisBinding}}function createHybridWrapper(func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity){var isAry=bitmask&ARY_FLAG,isBind=bitmask&BIND_FLAG,isBindKey=bitmask&BIND_KEY_FLAG,isCurry=bitmask&CURRY_FLAG,isCurryBound=bitmask&CURRY_BOUND_FLAG,isCurryRight=bitmask&CURRY_RIGHT_FLAG;var Ctor=!isBindKey&&createCtorWrapper(func),key=func;function wrapper(){var length=arguments.length,index=length,args=Array(length);while(index--){args[index]=arguments[index]}if(partials){args=composeArgs(args,partials,holders)}if(partialsRight){args=composeArgsRight(args,partialsRight,holdersRight)}if(isCurry||isCurryRight){var placeholder=wrapper.placeholder,argsHolders=replaceHolders(args,placeholder);length-=argsHolders.length;if(length<arity){var newArgPos=argPos?arrayCopy(argPos):null,newArity=nativeMax(arity-length,0),newsHolders=isCurry?argsHolders:null,newHoldersRight=isCurry?null:argsHolders,newPartials=isCurry?args:null,newPartialsRight=isCurry?null:args;bitmask|=isCurry?PARTIAL_FLAG:PARTIAL_RIGHT_FLAG;bitmask&=~(isCurry?PARTIAL_RIGHT_FLAG:PARTIAL_FLAG);if(!isCurryBound){bitmask&=~(BIND_FLAG|BIND_KEY_FLAG)}var result=createHybridWrapper(func,bitmask,thisArg,newPartials,newsHolders,newPartialsRight,newHoldersRight,newArgPos,ary,newArity);result.placeholder=placeholder;return result}}var thisBinding=isBind?thisArg:this;if(isBindKey){func=thisBinding[key]}if(argPos){args=reorder(args,argPos)}if(isAry&&ary<args.length){args.length=ary}var fn=this&&this!==global&&this instanceof wrapper?Ctor||createCtorWrapper(func):func;return fn.apply(thisBinding,args)}return wrapper}function createPartialWrapper(func,bitmask,thisArg,partials){var isBind=bitmask&BIND_FLAG,Ctor=createCtorWrapper(func);function wrapper(){var argsIndex=-1,argsLength=arguments.length,leftIndex=-1,leftLength=partials.length,args=Array(argsLength+leftLength);while(++leftIndex<leftLength){args[leftIndex]=partials[leftIndex]}while(argsLength--){args[leftIndex++]=arguments[++argsIndex]}var fn=this&&this!==global&&this instanceof wrapper?Ctor:func;return fn.apply(isBind?thisArg:this,args)}return wrapper}function createWrapper(func,bitmask,thisArg,partials,holders,argPos,ary,arity){var isBindKey=bitmask&BIND_KEY_FLAG;if(!isBindKey&&typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var length=partials?partials.length:0;if(!length){bitmask&=~(PARTIAL_FLAG|PARTIAL_RIGHT_FLAG);partials=holders=null}length-=holders?holders.length:0;if(bitmask&PARTIAL_RIGHT_FLAG){var partialsRight=partials,holdersRight=holders;partials=holders=null}var newData=[func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity];newData[9]=arity==null?isBindKey?0:func.length:nativeMax(arity-length,0)||0;if(bitmask==BIND_FLAG){var result=createBindWrapper(newData[0],newData[2])}else if((bitmask==PARTIAL_FLAG||bitmask==(BIND_FLAG|PARTIAL_FLAG))&&!newData[4].length){result=createPartialWrapper.apply(undefined,newData)}else{result=createHybridWrapper.apply(undefined,newData)}return result}function isIndex(value,length){value=+value;length=length==null?MAX_SAFE_INTEGER:length;return value>-1&&value%1==0&&value<length}function reorder(array,indexes){var arrLength=array.length,length=nativeMin(indexes.length,arrLength),oldArray=arrayCopy(array);while(length--){var index=indexes[length];array[length]=isIndex(index,arrLength)?oldArray[index]:undefined}return array}function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=createWrapper}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash._arraycopy":123,"lodash._basecreate":124,"lodash._replaceholders":125}],123:[function(require,module,exports){arguments[4][48][0].apply(exports,arguments)},{dup:48}],124:[function(require,module,exports){(function(global){var baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||global.Object()}}();function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=baseCreate}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],125:[function(require,module,exports){var PLACEHOLDER="__lodash_placeholder__";function replaceHolders(array,placeholder){var index=-1,length=array.length,resIndex=-1,result=[];while(++index<length){if(array[index]===placeholder){array[index]=PLACEHOLDER;result[++resIndex]=index}}return result}module.exports=replaceHolders},{}],126:[function(require,module,exports){arguments[4][25][0].apply(exports,arguments)},{dup:25}],127:[function(require,module,exports){var baseFlatten=require("lodash._baseflatten"),isIterateeCall=require("lodash._isiterateecall");function flatten(array,isDeep,guard){var length=array?array.length:0;if(guard&&isIterateeCall(array,isDeep,guard)){isDeep=false}return length?baseFlatten(array,isDeep):[]}module.exports=flatten},{"lodash._baseflatten":128,"lodash._isiterateecall":131}],128:[function(require,module,exports){arguments[4][22][0].apply(exports,arguments)},{dup:22,"lodash.isarguments":129,"lodash.isarray":130}],129:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],130:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],131:[function(require,module,exports){arguments[4][54][0].apply(exports,arguments)},{dup:54}],132:[function(require,module,exports){var arrayEach=require("lodash._arrayeach"),baseEach=require("lodash._baseeach"),bindCallback=require("lodash._bindcallback"),isArray=require("lodash.isarray");function createForEach(arrayFunc,eachFunc){return function(collection,iteratee,thisArg){return typeof iteratee=="function"&&typeof thisArg=="undefined"&&isArray(collection)?arrayFunc(collection,iteratee):eachFunc(collection,bindCallback(iteratee,thisArg,3))}}var forEach=createForEach(arrayEach,baseEach);module.exports=forEach},{"lodash._arrayeach":133,"lodash._baseeach":134,"lodash._bindcallback":138,"lodash.isarray":139}],133:[function(require,module,exports){arguments[4][49][0].apply(exports,arguments)},{dup:49}],134:[function(require,module,exports){arguments[4][31][0].apply(exports,arguments)},{dup:31,"lodash.keys":135}],135:[function(require,module,exports){arguments[4][10][0].apply(exports,arguments)},{dup:10,"lodash.isarguments":136,"lodash.isarray":139,"lodash.isnative":137}],136:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],137:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],138:[function(require,module,exports){arguments[4][30][0].apply(exports,arguments)},{dup:30}],139:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],140:[function(require,module,exports){var baseEach=require("lodash._baseeach"),restParam=require("lodash.restparam");var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}var invoke=restParam(function(collection,methodName,args){var index=-1,isFunc=typeof methodName=="function",length=collection?collection.length:0,result=isLength(length)?Array(length):[];baseEach(collection,function(value){var func=isFunc?methodName:value!=null&&value[methodName];result[++index]=func?func.apply(value,args):undefined});return result});module.exports=invoke},{"lodash._baseeach":141,"lodash.restparam":146}],141:[function(require,module,exports){arguments[4][31][0].apply(exports,arguments)},{dup:31,"lodash.keys":142}],142:[function(require,module,exports){arguments[4][10][0].apply(exports,arguments)},{dup:10,"lodash.isarguments":143,"lodash.isarray":144,"lodash.isnative":145}],143:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],144:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],145:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],146:[function(require,module,exports){arguments[4][25][0].apply(exports,arguments)},{dup:25}],147:[function(require,module,exports){var stringTag="[object String]";function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var objToString=objectProto.toString;function isString(value){return typeof value=="string"||isObjectLike(value)&&objToString.call(value)==stringTag}module.exports=isString},{}],148:[function(require,module,exports){function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}module.exports=last},{}],149:[function(require,module,exports){var baseFlatten=require("lodash._baseflatten"),bindCallback=require("lodash._bindcallback"),pickByArray=require("lodash._pickbyarray"),pickByCallback=require("lodash._pickbycallback"),restParam=require("lodash.restparam");var pick=restParam(function(object,props){if(object==null){return{}}return typeof props[0]=="function"?pickByCallback(object,bindCallback(props[0],props[1],3)):pickByArray(object,baseFlatten(props))});module.exports=pick},{"lodash._baseflatten":150,"lodash._bindcallback":153,"lodash._pickbyarray":154,"lodash._pickbycallback":155,"lodash.restparam":160}],150:[function(require,module,exports){arguments[4][22][0].apply(exports,arguments)},{dup:22,"lodash.isarguments":151,"lodash.isarray":152}],151:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],152:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],153:[function(require,module,exports){arguments[4][30][0].apply(exports,arguments)},{dup:30}],154:[function(require,module,exports){arguments[4][89][0].apply(exports,arguments)},{dup:89}],155:[function(require,module,exports){arguments[4][90][0].apply(exports,arguments)},{dup:90,"lodash._basefor":156,"lodash.keysin":157}],156:[function(require,module,exports){arguments[4][51][0].apply(exports,arguments)},{dup:51}],157:[function(require,module,exports){arguments[4][92][0].apply(exports,arguments)},{dup:92,"lodash.isarguments":158,"lodash.isarray":159}],158:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{dup:7}],159:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],160:[function(require,module,exports){arguments[4][25][0].apply(exports,arguments)},{dup:25}],161:[function(require,module,exports){var isFunction=require("lodash.isfunction");function result(object,key,defaultValue){var value=object==null?undefined:object[key];if(typeof value=="undefined"){value=defaultValue}return isFunction(value)?value.call(object):value}module.exports=result},{"lodash.isfunction":162}],162:[function(require,module,exports){(function(global){var funcTag="[object Function]";var reHostCtor=/^\[object .+?Constructor\]$/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);function baseIsFunction(value){return typeof value=="function"||false}function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function isObjectLike(value){return!!value&&typeof value=="object"}var objectProto=Object.prototype;var fnToString=Function.prototype.toString;var objToString=objectProto.toString;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Uint8Array=isNative(Uint8Array=global.Uint8Array)&&Uint8Array;var isFunction=!(baseIsFunction(/x/)||Uint8Array&&!baseIsFunction(Uint8Array))?baseIsFunction:function(value){return objToString.call(value)==funcTag};function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}module.exports=isFunction}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],163:[function(require,module,exports){var baseToString=require("lodash._basetostring");var idCounter=0;function uniqueId(prefix){var id=++idCounter;return baseToString(prefix)+id}module.exports=uniqueId},{"lodash._basetostring":164}],164:[function(require,module,exports){arguments[4][58][0].apply(exports,arguments)},{dup:58}],165:[function(require,module,exports){"use strict";var proto=Element.prototype;var vendor=proto.matches||proto.matchesSelector||proto.webkitMatchesSelector||proto.mozMatchesSelector||proto.msMatchesSelector||proto.oMatchesSelector;module.exports=match;function match(el,selector){if(vendor)return vendor.call(el,selector);var nodes=el.parentNode.querySelectorAll(selector);for(var i=0;i<nodes.length;i++){if(nodes[i]==el)return true}return false}},{}],"ampersand-input-view":[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-input-view"]=window.ampersand["ampersand-input-view"]||[];window.ampersand["ampersand-input-view"].push("4.0.5")}var View=require("ampersand-view");var dom=require("ampersand-dom");var matchesSelector=require("matches-selector");var slice=Array.prototype.slice;function getMatches(el,selector){if(selector==="")return[el];var matches=[];if(matchesSelector(el,selector))matches.push(el);return matches.concat(slice.call(el.querySelectorAll(selector)))}module.exports=View.extend({template:["<label>",'<span data-hook="label"></span>','<input class="form-input">','<div data-hook="message-container" class="message message-below message-error">','<p data-hook="message-text"></p>',"</div>","</label>"].join(""),bindings:{name:{type:"attribute",selector:"input, textarea",name:"name"},label:[{hook:"label"},{type:"toggle",hook:"label"}],message:{type:"text",hook:"message-text"},showMessage:{type:"toggle",hook:"message-container"},placeholder:{type:"attribute",selector:"input, textarea",name:"placeholder"}},initialize:function(spec){spec||(spec={});this.tests=this.tests||spec.tests||[];this.on("change:type",this.handleTypeChange,this);this.handleChange=this.handleChange.bind(this);this.handleInputChanged=this.handleInputChanged.bind(this);var value=!spec.value&&spec.value!==0?"":spec.value;this.startingValue=value;this.inputValue=value;this.on("change:valid change:value",this.reportToParent,this);this.on("change:validityClass",this.validityClassChanged,this);if(spec.autoRender)this.autoRender=spec.autoRender;if(spec.template)this.template=spec.template;if(spec.beforeSubmit)this.beforeSubmit=spec.beforeSubmit},render:function(){this.renderWithTemplate();this.input=this.query("input")||this.query("textarea");this.handleTypeChange();this.initInputBindings();this.setValue(this.inputValue,!this.required);return this},props:{inputValue:"any",startingValue:"any",name:"string",type:["string",true,"text"],placeholder:["string",true,""],label:["string",true,""],required:["boolean",true,true],directlyEdited:["boolean",true,false],shouldValidate:["boolean",true,false],message:["string",true,""],requiredMessage:["string",true,"This field is required."],validClass:["string",true,"input-valid"],invalidClass:["string",true,"input-invalid"],validityClassSelector:["string",true,"input, textarea"]},derived:{value:{deps:["inputValue"],fn:function(){return this.inputValue}},valid:{cache:false,deps:["inputValue"],fn:function(){return!this.runTests()}},showMessage:{deps:["message","shouldValidate"],fn:function(){return this.shouldValidate&&this.message}},changed:{deps:["inputValue","startingValue"],fn:function(){return this.inputValue!==this.startingValue}},validityClass:{deps:["valid","validClass","invalidClass","shouldValidate"],fn:function(){if(!this.shouldValidate){return""}else{return this.valid?this.validClass:this.invalidClass}}}},setValue:function(value,skipValidation){if(!this.input){this.inputValue=value;return}if(!value&&value!==0){this.input.value=""}else{this.input.value=value.toString()}this.inputValue=this.clean(this.input.value);if(!skipValidation&&!this.getErrorMessage()){this.shouldValidate=true}else if(skipValidation){this.shouldValidate=false}},getErrorMessage:function(){var message="";if(this.required&&this.value===""){return this.requiredMessage}else{(this.tests||[]).some(function(test){message=test.call(this,this.value)||"";return message},this);return message}},handleTypeChange:function(){if(this.type==="textarea"&&this.input.tagName.toLowerCase()!=="textarea"){var parent=this.input.parentNode;var textarea=document.createElement("textarea");parent.replaceChild(textarea,this.input);this.input=textarea;this._applyBindingsForKey("")}else{this.input.type=this.type}},clean:function(val){return this.type==="number"?Number(val):val.trim()},handleInputChanged:function(){if(document.activeElement===this.input){this.directlyEdited=true}this.inputValue=this.clean(this.input.value)},handleChange:function(){if(this.inputValue&&this.changed){this.shouldValidate=true}this.runTests()},beforeSubmit:function(){this.inputValue=this.clean(this.input.value);this.shouldValidate=true;this.runTests()},runTests:function(){var message=this.getErrorMessage();if(!message&&this.inputValue&&this.changed){this.shouldValidate=true}this.message=message;return message},initInputBindings:function(){this.input.addEventListener("input",this.handleInputChanged,false);this.input.addEventListener("change",this.handleChange,false)},remove:function(){this.input.removeEventListener("input",this.handleInputChanged,false);this.input.removeEventListener("change",this.handleChange,false);View.prototype.remove.apply(this,arguments)},reset:function(){this.setValue(this.startingValue,true)},clear:function(){this.setValue("",true)},validityClassChanged:function(view,newClass){var oldClass=view.previousAttributes().validityClass;getMatches(this.el,this.validityClassSelector).forEach(function(match){dom.switchClass(match,oldClass,newClass)})},reportToParent:function(){if(this.parent)this.parent.update(this)}})},{"ampersand-dom":1,"ampersand-view":2,"matches-selector":165}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var toString=Object.prototype.toString;var nativeIsArray=Array.isArray;module.exports=nativeIsArray||function isArray(obj){return toString.call(obj)==="[object Array]"; | |
}},{}],2:[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-dom"]=window.ampersand["ampersand-dom"]||[];window.ampersand["ampersand-dom"].push("1.4.0")}var dom=module.exports={text:function(el,val){el.textContent=getString(val)},addClass:function(el,cls){cls=getString(cls);if(!cls)return;if(Array.isArray(cls)){cls.forEach(function(c){dom.addClass(el,c)})}else if(el.classList){el.classList.add(cls)}else{if(!hasClass(el,cls)){if(el.classList){el.classList.add(cls)}else{el.className+=" "+cls}}}},removeClass:function(el,cls){if(Array.isArray(cls)){cls.forEach(function(c){dom.removeClass(el,c)})}else if(el.classList){cls=getString(cls);if(cls)el.classList.remove(cls)}else{el.className=el.className.replace(new RegExp("(^|\\b)"+cls.split(" ").join("|")+"(\\b|$)","gi")," ")}},hasClass:hasClass,switchClass:function(el,prevCls,newCls){if(prevCls)this.removeClass(el,prevCls);this.addClass(el,newCls)},addAttribute:function(el,attr){el.setAttribute(attr,"");if(hasBooleanProperty(el,attr))el[attr]=true},removeAttribute:function(el,attr){el.removeAttribute(attr);if(hasBooleanProperty(el,attr))el[attr]=false},setAttribute:function(el,attr,value){el.setAttribute(attr,getString(value))},getAttribute:function(el,attr){return el.getAttribute(attr)},hasAttribute:function(el,attr){return el.hasAttribute(attr)},hide:function(el,mode){if(!mode)mode="display";if(!isHidden(el)){storeDisplayStyle(el,mode);hide(el,mode)}},show:function(el,mode){if(!mode)mode="display";show(el,mode)},html:function(el,content){el.innerHTML=content}};function getString(val){if(!val&&val!==0){return""}else{return val}}function hasClass(el,cls){if(el.classList){return el.classList.contains(cls)}else{return new RegExp("(^| )"+cls+"( |$)","gi").test(el.className)}}function hasBooleanProperty(el,prop){var val=el[prop];return prop in el&&(val===true||val===false)}function isHidden(el){return dom.getAttribute(el,"data-anddom-hidden")==="true"}function storeDisplayStyle(el,mode){dom.setAttribute(el,"data-anddom-"+mode,el.style[mode])}function show(el,mode){el.style[mode]=dom.getAttribute(el,"data-anddom-"+mode)||"";dom.removeAttribute(el,"data-anddom-hidden")}function hide(el,mode){dom.setAttribute(el,"data-anddom-hidden","true");el.style[mode]=mode==="visibility"?"hidden":"none"}},{}],3:[function(require,module,exports){module.exports=parse;var div=document.createElement("div");div.innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';var innerHTMLBug=!div.getElementsByTagName("link").length;div=undefined;var map={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:innerHTMLBug?[1,"X<div>","</div>"]:[0,"",""]};map.td=map.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];map.option=map.optgroup=[1,'<select multiple="multiple">',"</select>"];map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"<table>","</table>"];map.polyline=map.ellipse=map.polygon=map.circle=map.text=map.line=map.path=map.rect=map.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function parse(html,doc){if("string"!=typeof html)throw new TypeError("String expected");if(!doc)doc=document;var m=/<([\w:]+)/.exec(html);if(!m)return doc.createTextNode(html);html=html.replace(/^\s+|\s+$/g,"");var tag=m[1];if(tag=="body"){var el=doc.createElement("html");el.innerHTML=html;return el.removeChild(el.lastChild)}var wrap=map[tag]||map._default;var depth=wrap[0];var prefix=wrap[1];var suffix=wrap[2];var el=doc.createElement("div");el.innerHTML=prefix+html+suffix;while(depth--)el=el.lastChild;if(el.firstChild==el.lastChild){return el.removeChild(el.firstChild)}var fragment=doc.createDocumentFragment();while(el.firstChild){fragment.appendChild(el.removeChild(el.firstChild))}return fragment}},{}],4:[function(require,module,exports){"use strict";var proto=Element.prototype;var vendor=proto.matches||proto.matchesSelector||proto.webkitMatchesSelector||proto.mozMatchesSelector||proto.msMatchesSelector||proto.oMatchesSelector;module.exports=match;function match(el,selector){if(vendor)return vendor.call(el,selector);var nodes=el.parentNode.querySelectorAll(selector);for(var i=0;i<nodes.length;i++){if(nodes[i]==el)return true}return false}},{}],"ampersand-select-view":[function(require,module,exports){if(typeof window!=="undefined"){window.ampersand=window.ampersand||{};window.ampersand["ampersand-select-view"]=window.ampersand["ampersand-select-view"]||[];window.ampersand["ampersand-select-view"].push("3.0.1")}var domify=require("domify");var dom=require("ampersand-dom");var matches=require("matches-selector");var isArray=require("amp-is-array");var defaultTemplate=['<label class="select">','<span data-hook="label"></span>',"<select></select>",'<span data-hook="message-container" class="message message-below message-error">','<p data-hook="message-text"></p>',"</span>","</label>"].join("\n");function SelectView(opts){opts=opts||{};if(typeof opts.name!=="string")throw new Error("SelectView requires a name property.");this.name=opts.name;if(!Array.isArray(opts.options)&&!opts.options.isCollection){throw new Error("SelectView requires select options.")}this.options=opts.options;if(this.options.isCollection){this.idAttribute=opts.idAttribute||this.options.mainIndex||"id";this.textAttribute=opts.textAttribute||"text";this.disabledAttribute=opts.disabledAttribute}this.el=opts.el;this.label=opts.label||this.name;this.parent=opts.parent;this.template=opts.template||defaultTemplate;this.unselectedText=opts.unselectedText;this.yieldModel=opts.yieldModel===false?false:true;this.required=opts.required||false;this.validClass=opts.validClass||"input-valid";this.invalidClass=opts.invalidClass||"input-invalid";this.requiredMessage=opts.requiredMessage||"Selection required";this.onChange=this.onChange.bind(this);this.render();this.setValue(opts.value,opts.eagerValidate?false:true)}SelectView.prototype.render=function(){var elDom,labelEl;if(this.rendered)return;elDom=domify(this.template);if(!this.el)this.el=elDom;else this.el.appendChild(elDom);labelEl=this.el.querySelector("[data-hook~=label]");if(labelEl){labelEl.textContent=this.label;this.label=labelEl}else{delete this.label}if(this.el.tagName==="SELECT"){this.select=this.el}else{this.select=this.el.querySelector("select")}if(!this.select)throw new Error("no select found in template");if(matches(this.el,"select"))this.select=this.el;if(this.select)this.select.setAttribute("name",this.name);this.bindDOMEvents();this.renderOptions();this.updateSelectedOption();if(this.options.isCollection){this.options.on("add remove reset",function(){this.renderOptions();this.updateSelectedOption()}.bind(this))}this.rendered=true};SelectView.prototype.onChange=function(){var value=this.select.options[this.select.selectedIndex].value;if(this.options.isCollection&&this.yieldModel){value=this.getModelForId(value)}this.setValue(value)};SelectView.prototype.getModelForId=function(id){return this.options.filter(function(model){return model[this.idAttribute]==id}.bind(this))[0]};SelectView.prototype.bindDOMEvents=function(){this.el.addEventListener("change",this.onChange,false)};SelectView.prototype.renderOptions=function(){if(!this.select)return;this.select.innerHTML="";if(this.unselectedText){this.select.appendChild(createOption(null,this.unselectedText))}this.options.forEach(function(option){this.select.appendChild(createOption(this.getOptionValue(option),this.getOptionText(option),this.getOptionDisabled(option)))}.bind(this))};SelectView.prototype.updateSelectedOption=function(){var lookupValue=this.value;if(lookupValue===null||lookupValue===undefined||lookupValue===""){this.select.selectedIndex=0;return this}if(this.options.isCollection&&this.yieldModel){lookupValue=lookupValue&&lookupValue[this.idAttribute]}if(lookupValue||lookupValue===0){for(var i=this.select.options.length;i--;i){if(this.select.options[i].value==lookupValue){this.select.selectedIndex=i;return this}}}throw new Error("no option exists for value: "+lookupValue)};SelectView.prototype.remove=function(){if(this.el&&this.el.parentNode)this.el.parentNode.removeChild(this.el);this.el.removeEventListener("change",this.onChange,false)};SelectView.prototype.clear=function(){this.setValue(null,true);return this};SelectView.prototype.setValue=function(value,skipValidationMessage){var option;if(value===null||value===undefined||value===""){this.value=null}else{option=this.getOptionByValue(value);this.value=isArray(option)?option[0]:option}this.validate(skipValidationMessage);this.updateSelectedOption();if(this.parent)this.parent.update(this);return this};SelectView.prototype.validate=function(skipValidationMessage){if(!this.required){this.valid=true;return this.valid}if(this.required&&!this.value&&this.value!==0){this.valid=false;if(!skipValidationMessage)this.setMessage(this.requiredMessage)}else{this.valid=true;if(!skipValidationMessage)this.setMessage()}return this.valid};SelectView.prototype.getOptionByValue=function(value){var model;if(this.options.isCollection){if(this.options.indexOf(value)===-1)model=this.getModelForId(value);else model=value;return this.yieldModel?model:model[this.idAttribute]}else if(isArray(this.options)){if(this.options.length&&isArray(this.options[0])){for(var i=this.options.length-1;i>=0;i--){if(this.options[i][0]==value)return this.options[i]}}if(this.options.length&&this.options.indexOf(value)!==-1)return value;throw new Error("value not in set of provided options")}throw new Error("select option set invalid")};SelectView.prototype.getOptionValue=function(option){if(Array.isArray(option))return option[0];if(this.options.isCollection)return option[this.idAttribute];return option};SelectView.prototype.getOptionText=function(option){if(Array.isArray(option))return option[1];if(this.options.isCollection){if(this.textAttribute&&option[this.textAttribute]){return option[this.textAttribute]}}return option};SelectView.prototype.getOptionDisabled=function(option){if(Array.isArray(option))return option[2];if(this.options.isCollection&&this.disabledAttribute)return option[this.disabledAttribute];return false};SelectView.prototype.setMessage=function(message){var mContainer=this.el.querySelector("[data-hook~=message-container]");var mText=this.el.querySelector("[data-hook~=message-text]");if(!mContainer||!mText)return;if(message){dom.show(mContainer);mText.textContent=message;dom.addClass(this.el,this.invalidClass);dom.removeClass(this.el,this.validClass)}else{dom.hide(mContainer);mText.textContent="";dom.addClass(this.el,this.validClass);dom.removeClass(this.el,this.invalidClass)}};function createOption(value,text,disabled){var node=document.createElement("option");if(value===null||value===undefined){value=""}if(disabled)node.disabled=true;node.textContent=text;node.value=value;return node}module.exports=SelectView},{"amp-is-array":1,"ampersand-dom":2,domify:3,"matches-selector":4}]},{},[]);var FormView=require("ampersand-form-view");var InputView=require("ampersand-input-view");var SelectView=require("ampersand-select-view");var Form=FormView.extend({fields:function(){return[new InputView({name:"input field",type:"text",value:"a value",parent:this}),new SelectView({name:"option",parent:this,options:["a","b","c"]})]}});var el=document.createElement("form");document.body.appendChild(el);var form=new Form({el:el}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"ampersand-form-view": "2.4.0", | |
"ampersand-input-view": "4.0.5", | |
"ampersand-select-view": "3.0.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment