-
Notifications
You must be signed in to change notification settings - Fork 0
/
dou-min.js
2 lines (2 loc) · 14.8 KB
/
dou-min.js
1
2
/*! Dou v0.0.11 | (c) Hatio, Lab. | MIT License */
!function(t){function n(){var t,n,e=Array.prototype.slice.call(arguments),r=[];"string"==typeof e[0]&&(t=e.shift()),o(e[0])&&(r=e.shift()),n=e.shift(),i[t]=[r,n]}function e(t){function n(n){var e=t.split("/"),i=n.split("/"),r=!1;for(e.pop();".."==i[0]&&e.length;)e.pop(),i.shift(),r=!0;return"."==i[0]&&(i.shift(),r=!0),r&&(i=e.concat(i)),i.join("/")}var o,c,l;return"undefined"==typeof r[t]&&(o=i[t],o&&(l=o[0],c=o[1],r[t]=c.apply(void 0,s(l,function(t){return e(n(t))})))),r[t]}var i={},r={},o=Array.isArray||function(t){return t.constructor==Array},s=Array.map||function(t,n,e){for(var i=0,r=t.length,o=[];r>i;i++)o.push(n.call(e,t[i]));return o};!function(){var t=[].slice,e={}.hasOwnProperty;n("build/js/utils",[],function(){"use strict";var n,i;return n=100,i=0,{merge:function(){var n,i,r,o,s,c,l;for(o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],o&&typeof o!==!1||(o={}),c=0,l=n.length;l>c;c++){r=n[c];for(i in r)e.call(r,i)&&(s=r[i],o[i]="object"!=typeof s?s:this.merge(o[i],s))}return o},shallow_merge:function(){var n,i,r,o,s,c,l;for(i=1<=arguments.length?t.call(arguments,0):[],o={},c=0,l=i.length;l>c;c++){n=i[c];for(r in n)e.call(n,r)&&(s=n[r],o[r]=s)}return o},push:function(t,n,i){var r,o;if(!t||!n)return t;for(r in n)if(e.call(n,r)){if(o=n[r],t[r]&&i)throw new Error('utils.push attempted to overwrite "'+r+'" while running in protected mode');"object"==typeof t[r]&&"object"==typeof n[r]?this.push(t[r],n[r]):t[r]=n[r]}return t},isEnumerable:function(t,n){return Object.keys(t).indexOf(n)>-1},compose:function(){var t;return t=arguments,function(){var n,e,i,r;for(n=arguments,e=i=r=t.length-1;0>=r?0>=i:i>=0;e=0>=r?++i:--i)n=t[e].apply(this,n);return n[0]}},uniqueArray:function(t){var n,e,i,r,o;for(i={},n=[],r=0,o=t.length;o>r;r++)e=t[r],i.hasOwnProperty(e)||(n.push(e),i[e]=1);return n},debounce:function(t,e,i){var r,o;return"number"!=typeof e&&(e=n),o=0,r=null,function(){var n,s,c,l;return c=this,n=arguments,l=function(){return o=null,i?void 0:r=t.apply(c,n)},s=i&&!o,clearTimeout(o),o=setTimeout(l,e),s&&(r=t.apply(c,n)),r}},throttle:function(t,e){var i,r,o,s,c,l,u;return"number"!=typeof e&&(e=n),r=i=l=c=o=s=null,u=this.debounce(function(){return o=c=!1},e),function(){var n;return r=this,i=arguments,n=function(){return l=null,o&&(s=t.apply(r,i)),u()},l||(l=setTimeout(n,e)),c?o=!0:(c=!0,s=t.apply(r,i)),u(),s}},countThen:function(t,n){return function(){return--t?void 0:n.apply(this,arguments)}},delegate:function(t){return function(n,i){var r,o,s;s=$(n.target),r=null;for(o in t)if(e.call(t,o)&&!n.isPropagationStopped()&&(r=s.closest(o)).length)return i=i||{},i.el=r[0],t[o].apply(this,[n,i])}},once:function(t){var n,e;return n=!1,e=null,function(){return n?e:(e=t.apply(this,arguments),n=!0,e)}},uniqueId:function(t){var n;return n=++i+"",t?t+n:n},clone:function(t){return null==t||"object"!=typeof t?t:t instanceof Array?t.slice():this.shallow_merge(t)}}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/debug",[],function(){"use strict";var n,e,i,r,o,s,c,l,u,a,h,f,p,_,g,d,m,v,y,b;return f="undefined"==typeof window?{}:window,b=function(n,e,i){var r,o,s,c;i=i||{},r=i.obj||f,o=i.path||(r===f?"global":""),c=[];for(s in r)t.call(r,s)&&((y[n]||n)(e,r,s)&&console.log(""+o+"."+s+" -> ("+typeof r[s]+")",r[s]),r[s]&&"object"==typeof r[s]&&r[s]!==r?c.push(b(n,e,{obj:r[s],path:""+o+"."+s})):c.push(void 0));return c},m=function(t,n,e,i){return n&&typeof e!==n?console.error(""+e+" must be "+n):b(t,e,i)},y={name:function(t,n,e){return t===e},nameContains:function(t,n,e){return e.indexOf(t)>-1},type:function(t,n,e){return n[e]instanceof t},value:function(t,n,e){return n[e]===t},valueCoerced:function(t,n,e){return n[e]==t}},e=function(t,n){return m("name","string",t,n)},i=function(t,n){return m("nameContains","string",t,n)},r=function(t,n){return m("type","function",t,n)},o=function(t,n){return m("value",null,t,n)},s=function(t,n){return m("valueCoerced",null,t,n)},c=function(t,n){return b(t,null,n)},a=function(){var t;return t=[].slice.call(arguments),_.eventNames.length||(_.eventNames=n),_.actions=t.length?t:n,d()},h=function(){var t;return t=[].slice.call(arguments),_.actions.length||(_.actions=n),_.eventNames=t.length?t:n,d()},p=function(){return _.actions=[],_.eventNames=[],d()},v=function(){return _.actions=n,_.eventNames=n,d()},d=function(){return f.localStorage?(f.localStorage.setItem("logFilter_eventNames",_.eventNames),f.localStorage.setItem("logFilter_actions",_.actions)):void 0},g=function(){var e,i,r;i={eventNames:f.localStorage&&f.localStorage.getItem("logFilter_eventNames")||u,actions:f.localStorage&&f.localStorage.getItem("logFilter_actions")||l};for(e in i)t.call(i,e)&&(r=i[e],"string"==typeof r&&r!==n&&(i[e]=r.split(".")));return i},n="all",u=[],l=[],_=g(),{enable:function(t){return this.enabled=!!t,t&&f.console&&(console.info("Booting in DEBUG mode"),console.info("You can configure event logging with DEBUG.events.logAll()/logNone()/logByName()/logByAction()")),f.DEBUG=this},find:{byName:e,byNameContains:i,byType:r,byValue:o,byValueCoerced:s,custom:c},events:{logFilter:_,logByAction:a,logByName:h,logAll:v,logNone:p}}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/compose",["./utils","./debug"],function(n,e){"use strict";var i,r,o,s,c,l;if(i=e.enabled&&!n.isEnumerable(Object,"getOwnPropertyDescriptor"),r=["mixedIn","mixingIn"],i)try{Object.getOwnPropertyDescriptor(Object,"keys")}catch(u){o=u,i=!1}return c=function(n,e){var o,s,c;if(i){c=Object.create(null);for(s in n)t.call(n,s)&&r.indexOf(0>s)&&(o=Object.getOwnPropertyDescriptor(n,s),o.writable=e,c[s]=o);return Object.defineProperties(n,c)}},l=function(t,n,e){var r;return i&&t.hasOwnProperty(n)?(r=Object.getOwnPropertyDescriptor(t,n).writable,Object.defineProperties(t,n,{writable:!0}),e.call(t),Object.defineProperties(t,n,{writable:r})):e.call(t)},s=function(t,n){var e,i;if(!(n instanceof Array))return this.mixin(t,[n]);for(t.mixedIn=t.hasOwnProperty("mixedIn")?t.mixedIn:[],t.mixingIn=t.hasOwnProperty("mixingIn")?t.mixingIn:[],c(t,!1),e=0,i=n.length;i>e;e++)if(s=n[e],-1===t.mixedIn.indexOf(s)){if(t.mixingIn.indexOf(s)>-1)throw new Error("found cyclic dependencies between "+t.mixingIn);t.mixingIn.push(s),s.call(t),t.mixingIn.pop(),t.mixedIn.push(s)}return c(t,!0),t},{mixin:s,unlockProperty:l}})}.call(this),function(){n("build/js/advice",["./compose"],function(t){"use strict";var n;return n={around:function(t,n){return function(){var e,i,r,o,s,c;for(o=arguments.length,e=new Array(o+1),e[0]=t.bind(this),r=s=0,c=e.length;c>s;r=++s)i=e[r],e[r+1]=arguments[r];return n.apply(this,e)}},before:function(t,n){var e;return e="function"==typeof n?n:n.obj[n.fnName],function(){return e.apply(this,arguments),t.apply(this,arguments)}},after:function(t,n){var e;return e="function"==typeof n?n:n.obj[n.fnName],function(){var n;return n=(t.unbound||t).apply(this,arguments),e.apply(this,arguments),n}},withAdvice:function(){return["before","after","around"].forEach(function(e){return this[e]=function(i,r){return t.unlockProperty(this,i,function(){return this[i]="function"==typeof this[i]?n[e](this[i],r):r,this[i]})}},this)}}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/collection",[],function(){"use strict";var n,e,i,r,o;return r={insertAt:function(t,n){return this.__collection__?(t=this.__collection__.indexOf(n),-1===this.__collection__.indexOf(n)&&this.__collection__.splice(t,0,n),this):this},append:function(t){return this.__collection__||(this.__collection__=[]),-1===this.__collection__.indexOf(t)&&this.__collection__.push(t),this},prepend:function(t){return this.__collection__||(this.__collection__=[]),-1===this.__collection__.indexOf(t)&&this.__collection__.unshift(t),this},remove:function(t){var n;return this.__collection__?(n=this.__collection__.indexOf(t),n>-1&&this.__collection__.splice(n,1),this):this},getAt:function(t){return this.__collection__?this.__collection__[t]:void 0},forEach:function(t,n){return this.__collection__?this.__collection__.forEach(t,n):this},indexOf:function(t){return(this.__collection__||[]).indexOf(t)},size:function(){return(this.__collection__||[]).length},clear:function(){return this.__collection__=[]},moveForward:function(t){var n;return n=this.indexOf(t),-1!==n&&0!==n?(this.__collection__[n]=this.__collection__[n-1],this.__collection__[n-1]=t):void 0},moveBackward:function(t){var n;return n=this.indexOf(t),-1!==n&&n!==this.size()-1?(this.__collection__[n]=this.__collection__[n+1],this.__collection__[n+1]=t):void 0},moveToHead:function(t){var n,e,i;return e=this.indexOf(t),-1!==e&&0!==e?(n=this.__collection__.splice(0,e),i=this.__collection__.splice(1),this.__collection__=this.__collection__.concat(n,i)):void 0},moveToTail:function(t){var n,e,i;return e=this.indexOf(t),-1!==e&&e!==this.size()-1?(n=this.__collection__.splice(0,e),i=this.__collection__.splice(1),this.__collection__=n.concat(i,this.__collection__)):void 0}},o={push:function(){throw new Error("Not Implemented Yet")},pop:function(){throw new Error("Not Implemented Yet")}},n=function(){},n.prototype=r,e=function(){},e.prototype=o,i={List:n,Stack:e,withList:function(){var n,e,i;i=[];for(n in r)t.call(r,n)&&(e=r[n],i.push(this[n]=e));return i},withStack:function(){var n,e,i;i=[];for(n in o)t.call(o,n)&&(e=o[n],i.push(this[n]=e));return i}}})}.call(this),function(){n("build/js/event",["./utils","./collection"],function(t,n){"use strict";var e,i,r,o,s,c,l,u;e={withEvent:function(){var t,n,i,r,o;for(r=["on","off","once","delegate_on","delegate_off","trigger"],o=[],n=0,i=r.length;i>n;n++)t=r[n],o.push(this[t]=e[t]);return o},on:function(t,n,e){var i;return o(this,"on",t,[n,e])&&n?(this._listeners||(this._listeners={}),i=this._listeners[t]||(this._listeners[t]=[]),i.push({callback:n,context:e,ctx:e||this}),this):this},once:function(n,e,i){var r,s;return o(this,"once",n,[e,i])&&e?(s=this,r=t.once(function(){return s.off(n,r),e.apply(this,arguments)}),r._callback=e,this.on(n,r,i)):this},off:function(t,n,e){var i,r,s,c,l,u,a,h,f,p;if(!this._listeners||!o(this,"off",t,[n,e]))return this;if(!t&&!n&&!e)return this._listeners=void 0,this;for(l=t?[t]:Object.keys(this._listeners),s=a=0,f=l.length;f>a;s=++a)if(t=l[s],r=this._listeners[t]){if(this._listeners[t]=u=[],n||e)for(c=h=0,p=r.length;p>h;c=++h)i=r[c],(n&&n!==i.callback&&n!==i.callback._callback||e&&e!==i.context)&&u.push(i);u.length||delete this._listeners[t]}return this},delegate_on:function(t){return this._delegators||(this._delegators=new n.List),this._delegators.append(t),this},delegate_off:function(t){return this._delegators?(this._delegators.remove(t),this):this},delegate:function(){var t,n,e;return this._delegators&&this._delegators.size()>0&&i(this._delegators,arguments),this._listeners?(t=arguments[arguments.length-1],t.deliverer=this,n=this._listeners[t.name],e=this._listeners.all,n&&u(n,arguments),e&&u(e,arguments),this):this},trigger:function(t){var n,e,r;return n=[].slice.call(arguments,1),n.push({origin:this,name:t,deliverer:this}),this._delegators&&this._delegators.size()>0&&i(this._delegators,n),this._listeners?o(this,"trigger",t,n)?(e=this._listeners[t],r=this._listeners.all,e&&u(e,n),r&&u(r,n),this):this:this},stopListening:function(t,n,e){var i,r,o;if(r=this._listeningTo,!r)return this;o=!n&&!e,e||"object"!=typeof n||(e=this),t&&((r={})[t._listenId]=t);for(i in r)t=r[i],t.off(n,e,this),(o||_.isEmpty(t._events))&&delete this._listeningTo[i];return this}},r=/\s+/,o=function(t,n,e,i){var o,s,c,l,u;if(!e)return!0;if("object"==typeof e){for(o in e)c=e[o],t[n].apply(t,[o,c].concat(i));return!1}if(r.test(e)){for(s=e.split(r),l=0,u=s.length;u>l;l++)c=s[l],t[n].apply(t,[c].concat(i));return!1}return!0},u=function(t,n){var e,i,r,o;for(o=[],i=0,r=t.length;r>i;i++)e=t[i],o.push(e.callback.apply(e.ctx,n));return o},i=function(t,n){return t.forEach(function(t){return e.delegate.apply(t,n)})},c={listenTo:"on",listenToOnce:"once"};for(l in c)s=c[l],e[l]=function(n,e,i){var r,o;return o=this._listeningTo||(this._listeningTo={}),r=n._listenId||(n._listenId=t.uniqueId("l")),o[r]=n,i||"object"!=typeof e||(i=this),n[s](e,i,this),this};return e})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/property",["./utils","./compose","./event"],function(n,e,i){"use strict";var r,o,s;return s=function(e,i){var r,o,s,c,l;if(!e)return this;if(arguments.length>1&&"string"==typeof arguments[0])return o={},o[e]=i,this.set(o);this.attrs||(this.attrs={}),o=e,r={},s={},c=this.attrs;for(e in c)t.call(c,e)&&(i=c[e],s[e]=i);n.push(this.attrs,o),l=this.attrs;for(e in l)t.call(l,e)&&(i=l[e],i!==s[e]?r[e]=i:delete s[e]);return 0!==Object.keys(r).length&&this.trigger("change",this,s,r),this},r=function(t){return this.attrs?this.attrs[t]:void 0},o=function(){return this.attrs?n.clone(this.attrs):{}},function(){return e.mixin(this,i.withEvent),this.set=s,this.get=r,this.getAll=o}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/lifecycle",["./compose","./property"],function(n,e){"use strict";var i,r;return r=function(n){var e,i,r,o;n||(n={}),e={};for(i in n)t.call(n,i)&&(r=n[i],e[i]=r);o=this.defaults;for(i in o)t.call(o,i)&&(r=o[i],e.hasOwnProperty(i)||(e[i]=r));return this.set(e),this},i=function(){},function(){return n.mixin(this,e),this.initialize=r,this.despose=i}})}.call(this),function(){n("build/js/serialize",["./compose","./property"],function(t,n){"use strict";var e,i;return i=function(){return["type: "+this.name,"id: "+this.id,"props: "+JSON.stringify(this.attrs)].join(",")},e=function(){},function(){return t.mixin(this,n),this.serialize||(this.serialize=i),this.deserialize?void 0:this.deserialize=e}})}.call(this),function(){n("build/js/disposer",["./compose","./advice"],function(t,n){"use strict";var e,i;return e=function(t){return this.__disposers||(this.__disposers=[]),this.__disposers.push(t)},i=function(){var t,n,e,i,r;if(this.__disposers&&this.__disposers){for(i=this.__disposers,r=[],n=0,e=i.length;e>n;n++)t=i[n],r.push(t.call(this));return r}},function(){return this.addDisposer=e,this.dispose?(t.mixin(this,n.withAdvice),this.after("dispose",i)):this.dispose=i}})}.call(this),function(){var t={}.hasOwnProperty,e=function(n,e){function i(){this.constructor=n}for(var r in e)t.call(e,r)&&(n[r]=e[r]);return i.prototype=e.prototype,n.prototype=new i,n.__super__=e.prototype,n};n("build/js/dou",["./compose","./advice","./lifecycle","./property","./serialize","./event","./utils","./collection","./disposer"],function(n,i,r,o,s,c,l,u,a){"use strict";var h,f;return h=function(i,r,o){var s,c,l,u;if(r||(r=function(){}),s=i["extends"]?function(t){function n(){return i.apply(this,arguments)}var i;return e(n,t),i=r,n}(i["extends"]):function(){function t(){return n.apply(this,arguments)}var n;return n=r,t}(),i.members){u=i.members;for(c in u)t.call(u,c)&&(l=u[c],s.prototype[c]=l)}if(o)for(c in o)t.call(o,c)&&(l=o[c],s.prototype[c]=l);return i.mixins&&n.mixin(s.prototype,i.mixins),i.name&&(s.name=i.name),s},f=function(t,e){return n.mixin("function"==typeof t?t.prototype:t,e),t},{define:h,mixin:f,"with":{advice:i.withAdvice,property:o,disposer:a,lifecycle:r,event:c.withEvent,serialize:s,collection:u},util:l}})}.call(this),t.dou=e("build/js/dou")}(this);