You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chukwa.apache.org by ey...@apache.org on 2016/05/01 06:00:47 UTC

[1/8] chukwa git commit: CHUKWA-806. Replace gridster with gridstack. (Eric Yang)

Repository: chukwa
Updated Branches:
  refs/heads/master e0bf3c0ef -> 6f6e4399e


http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/js/lodash.min.js
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/js/lodash.min.js b/src/main/web/hicc/home/js/lodash.min.js
new file mode 100644
index 0000000..8e2e7c3
--- /dev/null
+++ b/src/main/web/hicc/home/js/lodash.min.js
@@ -0,0 +1,89 @@
+/**
+ * @license
+ * lodash 3.5.0 (Custom Build) lodash.com/license | Underscore.js 1.8.2 underscorejs.org/LICENSE
+ * Build: `lodash modern -o ./lodash.js`
+ */
+;(function(){function n(n,t){if(n!==t){var r=n===n,e=t===t;if(n>t||!r||typeof n=="undefined"&&e)return 1;if(n<t||!e||typeof t=="undefined"&&r)return-1}return 0}function t(n,t,r){if(t!==t)return s(n,r);r-=1;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function r(n){return typeof n=="function"||false}function e(n){return typeof n=="string"?n:null==n?"":n+""}function u(n){return n.charCodeAt(0)}function o(n,t){for(var r=-1,e=n.length;++r<e&&-1<t.indexOf(n.charAt(r)););return r}function i(n,t){for(var r=n.length;r--&&-1<t.indexOf(n.charAt(r)););return r
+}function f(t,r){return n(t.a,r.a)||t.b-r.b}function a(n){return Tt[n]}function c(n){return St[n]}function l(n){return"\\"+Ft[n]}function s(n,t,r){var e=n.length;for(t+=r?0:-1;r?t--:++t<e;){var u=n[t];if(u!==u)return t}return-1}function p(n){return n&&typeof n=="object"||false}function h(n){return 160>=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)}function _(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;)n[r]===t&&(n[r]=L,o[++u]=r);
+return o}function g(n){for(var t=-1,r=n.length;++t<r&&h(n.charCodeAt(t)););return t}function v(n){for(var t=n.length;t--&&h(n.charCodeAt(t)););return t}function y(n){return Nt[n]}function d(h){function Tt(n){if(p(n)&&!(Uo(n)||n instanceof Ut)){if(n instanceof Nt)return n;if(Lu.call(n,"__chain__")&&Lu.call(n,"__wrapped__"))return ve(n)}return new Nt(n)}function St(){}function Nt(n,t,r){this.__wrapped__=n,this.__actions__=r||[],this.__chain__=!!t}function Ut(n){this.__wrapped__=n,this.__actions__=null,this.__dir__=1,this.__filtered__=false,this.__iteratees__=null,this.__takeCount__=_o,this.__views__=null
+}function Ft(){this.__data__={}}function $t(n){var t=n?n.length:0;for(this.data={hash:uo(null),set:new Xu};t--;)this.push(n[t])}function Lt(n,t){var r=n.data;return(typeof t=="string"||Qe(t)?r.set.has(t):r.hash[t])?0:-1}function Bt(n,t){var r=-1,e=n.length;for(t||(t=xu(e));++r<e;)t[r]=n[r];return t}function Mt(n,t){for(var r=-1,e=n.length;++r<e&&false!==t(n[r],r,n););return n}function qt(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return false;return true}function Pt(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;){var i=n[r];
+t(i,r,n)&&(o[++u]=i)}return o}function Kt(n,t){for(var r=-1,e=n.length,u=xu(e);++r<e;)u[r]=t(n[r],r,n);return u}function Vt(n){for(var t=-1,r=n.length,e=ho;++t<r;){var u=n[t];u>e&&(e=u)}return e}function Yt(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++u<o;)r=t(r,n[u],u,n);return r}function Zt(n,t,r,e){var u=n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function Gt(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return true;return false}function Jt(n,t){return typeof n=="undefined"?t:n
+}function Xt(n,t,r,e){return typeof n!="undefined"&&Lu.call(e,r)?n:t}function Ht(n,t,r){var e=zo(t);if(!r)return nr(t,n,e);for(var u=-1,o=e.length;++u<o;){var i=e[u],f=n[i],a=r(f,t[i],i,n,t);(a===a?a===f:f!==f)&&(typeof f!="undefined"||i in n)||(n[i]=a)}return n}function Qt(n,t){for(var r=-1,e=n.length,u=ae(e),o=t.length,i=xu(o);++r<o;){var f=t[r];u?(f=parseFloat(f),i[r]=ie(f,e)?n[f]:m):i[r]=n[f]}return i}function nr(n,t,r){r||(r=t,t={});for(var e=-1,u=r.length;++e<u;){var o=r[e];t[o]=n[o]}return t
+}function tr(n,t,r){var e=typeof n;if("function"==e){if(e=typeof t!="undefined"){var e=Tt.support,u=!(e.funcNames?n.name:e.funcDecomp);if(!u){var o=Fu.call(n);e.funcNames||(u=!yt.test(o)),u||(u=jt.test(o)||nu(n),jo(n,u))}e=u}n=e?Fr(n,t,r):n}else n=null==n?du:"object"==e?wr(n):typeof t=="undefined"?jr(n+""):xr(n+"",t);return n}function rr(n,t,r,e,u,o,i){var f;if(r&&(f=u?r(n,e,u):r(n)),typeof f!="undefined")return f;if(!Qe(n))return n;if(e=Uo(n)){if(f=ee(n),!t)return Bt(n,f)}else{var a=zu.call(n),c=a==P;
+if(a!=V&&a!=B&&(!c||u))return Ct[a]?oe(n,a,t):u?n:{};if(f=ue(c?{}:n),!t)return nr(n,f,zo(n))}for(o||(o=[]),i||(i=[]),u=o.length;u--;)if(o[u]==n)return i[u];return o.push(n),i.push(f),(e?Mt:_r)(n,function(e,u){f[u]=rr(e,t,r,u,n,o,i)}),f}function er(n,t,r,e){if(typeof n!="function")throw new Wu($);return Hu(function(){n.apply(m,Rr(r,e))},t)}function ur(n,r){var e=n?n.length:0,u=[];if(!e)return u;var o=-1,i=re(),f=i==t,a=f&&200<=r.length?ko(r):null,c=r.length;a&&(i=Lt,f=false,r=a);n:for(;++o<e;)if(a=n[o],f&&a===a){for(var l=c;l--;)if(r[l]===a)continue n;
+u.push(a)}else 0>i(r,a,0)&&u.push(a);return u}function or(n,t){var r=n?n.length:0;if(!ae(r))return _r(n,t);for(var e=-1,u=ge(n);++e<r&&false!==t(u[e],e,u););return n}function ir(n,t){var r=n?n.length:0;if(!ae(r))return gr(n,t);for(var e=ge(n);r--&&false!==t(e[r],r,e););return n}function fr(n,t){var r=true;return or(n,function(n,e,u){return r=!!t(n,e,u)}),r}function ar(n,t){var r=[];return or(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function cr(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0
+}),u}function lr(n,t,r,e){e-=1;for(var u=n.length,o=-1,i=[];++e<u;){var f=n[e];if(p(f)&&ae(f.length)&&(Uo(f)||Je(f))){t&&(f=lr(f,t,r,0));var a=-1,c=f.length;for(i.length+=c;++a<c;)i[++o]=f[a]}else r||(i[++o]=f)}return i}function sr(n,t,r){var e=-1,u=ge(n);r=r(n);for(var o=r.length;++e<o;){var i=r[e];if(false===t(u[i],i,u))break}return n}function pr(n,t,r){var e=ge(n);r=r(n);for(var u=r.length;u--;){var o=r[u];if(false===t(e[o],o,e))break}return n}function hr(n,t){sr(n,t,fu)}function _r(n,t){return sr(n,t,zo)
+}function gr(n,t){return pr(n,t,zo)}function vr(n,t){for(var r=-1,e=t.length,u=-1,o=[];++r<e;){var i=t[r];$o(n[i])&&(o[++u]=i)}return o}function yr(n,t,r){var e=-1,u=typeof t=="function",o=n?n.length:0,i=ae(o)?xu(o):[];return or(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):m}),i}function dr(n,t,r,e,u,o){if(n===t)return 0!==n||1/n==1/t;var i=typeof n,f=typeof t;if("function"!=i&&"object"!=i&&"function"!=f&&"object"!=f||null==n||null==t)n=n!==n&&t!==t;else n:{var i=dr,f=Uo(n),a=Uo(t),c=z,l=z;
+f||(c=zu.call(n),c==B?c=V:c!=V&&(f=uu(n))),a||(l=zu.call(t),l==B?l=V:l!=V&&uu(t));var s=c==V,a=l==V,l=c==l;if(!l||f||s)if(c=s&&Lu.call(n,"__wrapped__"),a=a&&Lu.call(t,"__wrapped__"),c||a)n=i(c?n.value():n,a?t.value():t,r,e,u,o);else if(l){for(u||(u=[]),o||(o=[]),c=u.length;c--;)if(u[c]==n){n=o[c]==t;break n}u.push(n),o.push(t),n=(f?Xr:Qr)(n,t,i,r,e,u,o),u.pop(),o.pop()}else n=false;else n=Hr(n,t,c)}return n}function mr(n,t,r,e,u){var o=t.length;if(null==n)return!o;for(var i=-1,f=!u;++i<o;)if(f&&e[i]?r[i]!==n[t[i]]:!Lu.call(n,t[i]))return false;
+for(i=-1;++i<o;){var a=t[i];if(f&&e[i])a=Lu.call(n,a);else{var c=n[a],l=r[i],a=u?u(c,l,a):m;typeof a=="undefined"&&(a=dr(l,c,u,true))}if(!a)return false}return true}function br(n,t){var r=[];return or(n,function(n,e,u){r.push(t(n,e,u))}),r}function wr(n){var t=zo(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(ce(u))return function(n){return null!=n&&n[e]===u&&Lu.call(n,e)}}for(var o=xu(r),i=xu(r);r--;)u=n[t[r]],o[r]=u,i[r]=ce(u);return function(n){return mr(n,t,o,i)}}function xr(n,t){return ce(t)?function(r){return null!=r&&r[n]===t
+}:function(r){return null!=r&&dr(t,r[n],null,true)}}function Ar(n,t,r,e,u){if(!Qe(n))return n;var o=ae(t.length)&&(Uo(t)||uu(t));return(o?Mt:_r)(t,function(t,i,f){if(p(t)){e||(e=[]),u||(u=[]);n:{t=e;for(var a=u,c=t.length,l=f[i];c--;)if(t[c]==l){n[i]=a[c],i=void 0;break n}c=n[i],f=r?r(c,l,i,n,f):m;var s=typeof f=="undefined";s&&(f=l,ae(l.length)&&(Uo(l)||uu(l))?f=Uo(c)?c:c?Bt(c):[]:Lo(l)||Je(l)?f=Je(c)?ou(c):Lo(c)?c:{}:s=false),t.push(l),a.push(f),s?n[i]=Ar(f,l,r,t,a):(f===f?f!==c:c===c)&&(n[i]=f),i=void 0
+}return i}a=n[i],f=r?r(a,t,i,n,f):m,(l=typeof f=="undefined")&&(f=t),!o&&typeof f=="undefined"||!l&&(f===f?f===a:a!==a)||(n[i]=f)}),n}function jr(n){return function(t){return null==t?m:t[n]}}function kr(n,t){return n+Yu(po()*(t-n+1))}function Er(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function Rr(n,t,r){var e=-1,u=n.length;for(t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r=typeof r=="undefined"||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=xu(u);++e<u;)r[e]=n[e+t];return r}function Ir(n,t){var r;
+return or(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function Or(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function Cr(t,r,e){var u=-1,o=t.length,i=ae(o)?xu(o):[];return or(t,function(n){for(var t=r.length,e=xu(t);t--;)e[t]=null==n?m:n[r[t]];i[++u]={a:e,b:u,c:n}}),Or(i,function(t,r){var u;n:{u=-1;for(var o=t.a,i=r.a,f=o.length,a=e.length;++u<f;){var c=n(o[u],i[u]);if(c){u=u<a?c*(e[u]?1:-1):c;break n}}u=t.b-r.b}return u})}function Wr(n,r){var e=-1,u=re(),o=n.length,i=u==t,f=i&&200<=o,a=f?ko():null,c=[];
+a?(u=Lt,i=false):(f=false,a=r?[]:c);n:for(;++e<o;){var l=n[e],s=r?r(l,e,n):l;if(i&&l===l){for(var p=a.length;p--;)if(a[p]===s)continue n;r&&a.push(s),c.push(l)}else 0>u(a,s,0)&&((r||f)&&a.push(s),c.push(l))}return c}function Tr(n,t){for(var r=-1,e=t.length,u=xu(e);++r<e;)u[r]=n[t[r]];return u}function Sr(n,t){var r=n;r instanceof Ut&&(r=r.value());for(var e=-1,u=t.length;++e<u;){var r=[r],o=t[e];Gu.apply(r,o.args),r=o.func.apply(o.thisArg,r)}return r}function Nr(n,t,r){var e=0,u=n?n.length:e;if(typeof t=="number"&&t===t&&u<=yo){for(;e<u;){var o=e+u>>>1,i=n[o];
+(r?i<=t:i<t)?e=o+1:u=o}return u}return Ur(n,t,du,r)}function Ur(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!==t,f=typeof t=="undefined";u<o;){var a=Yu((u+o)/2),c=r(n[a]),l=c===c;(i?l||e:f?l&&(e||typeof c!="undefined"):e?c<=t:c<t)?u=a+1:o=a}return ao(o,vo)}function Fr(n,t,r){if(typeof n!="function")return du;if(typeof t=="undefined")return n;switch(r){case 1:return function(r){return n.call(t,r)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,o){return n.call(t,r,e,u,o)
+};case 5:return function(r,e,u,o,i){return n.call(t,r,e,u,o,i)}}return function(){return n.apply(t,arguments)}}function $r(n){return Pu.call(n,0)}function Lr(n,t,r){for(var e=r.length,u=-1,o=fo(n.length-e,0),i=-1,f=t.length,a=xu(o+f);++i<f;)a[i]=t[i];for(;++u<e;)a[r[u]]=n[u];for(;o--;)a[i++]=n[u++];return a}function Br(n,t,r){for(var e=-1,u=r.length,o=-1,i=fo(n.length-u,0),f=-1,a=t.length,c=xu(i+a);++o<i;)c[o]=n[o];for(i=o;++f<a;)c[i+f]=t[f];for(;++e<u;)c[i+r[e]]=n[o++];return c}function zr(n,t){return function(r,e,u){var o=t?t():{};
+if(e=te(e,u,3),Uo(r)){u=-1;for(var i=r.length;++u<i;){var f=r[u];n(o,f,e(f,u,r),r)}}else or(r,function(t,r,u){n(o,t,e(t,r,u),u)});return o}}function Dr(n){return function(){var t=arguments,r=t.length,e=t[0];if(2>r||null==e)return e;var u=t[r-2],o=t[r-1],i=t[3];for(3<r&&typeof u=="function"?(u=Fr(u,o,5),r-=2):(u=2<r&&typeof o=="function"?o:null,r-=u?1:0),i&&fe(t[1],t[2],i)&&(u=3==r?null:u,r=2),o=0;++o<r;)(i=t[o])&&n(e,i,u);return e}}function Mr(n,t){function r(){return(this&&this!==zt&&this instanceof r?e:n).apply(t,arguments)
+}var e=Kr(n);return r}function qr(n){return function(){var t=arguments.length,r=t,e=n?t-1:0;if(!t)return function(n){return n};for(var u=xu(t);r--;)if(u[r]=arguments[r],"function"!=typeof u[r])throw new Wu($);return function(){for(var r=e,o=u[r].apply(this,arguments);n?r--:++r<t;)o=u[r].call(this,o);return o}}}function Pr(n){return function(t){var r=-1;t=_u(cu(t));for(var e=t.length,u="";++r<e;)u=n(u,t[r],r);return u}}function Kr(n){return function(){var t=Ao(n.prototype),r=n.apply(t,arguments);return Qe(r)?r:t
+}}function Vr(n,t){return function(r,e,o){o&&fe(r,e,o)&&(e=null);var i=te(),f=null==e;if(i===tr&&f||(f=false,e=i(e,o,3)),f){if(e=Uo(r),e||!eu(r))return n(e?r:_e(r));e=u}return ne(r,e,t)}}function Yr(n,t,r,e,u,o,i,f,a,c){function l(){for(var A=arguments.length,j=A,k=xu(A);j--;)k[j]=arguments[j];if(e&&(k=Lr(k,e,u)),o&&(k=Br(k,o,i)),g||y){var j=l.placeholder,I=_(k,j),A=A-I.length;if(A<c){var O=f?Bt(f):null,A=fo(c-A,0),C=g?I:null,I=g?null:I,W=g?k:null,k=g?null:k;return t|=g?E:R,t&=~(g?R:E),v||(t&=~(w|x)),k=Yr(n,t,r,W,C,k,I,O,a,A),k.placeholder=j,k
+}}if(j=p?r:this,h&&(n=j[b]),f)for(O=k.length,A=ao(f.length,O),C=Bt(k);A--;)I=f[A],k[A]=ie(I,O)?C[I]:m;return s&&a<k.length&&(k.length=a),(this&&this!==zt&&this instanceof l?d||Kr(n):n).apply(j,k)}var s=t&O,p=t&w,h=t&x,g=t&j,v=t&A,y=t&k,d=!h&&Kr(n),b=n;return l}function Zr(n,t,r){return n=n.length,t=+t,n<t&&oo(t)?(t-=n,r=null==r?" ":r+"",pu(r,Ku(t/r.length)).slice(0,t)):""}function Gr(n,t,r,e){function u(){for(var t=-1,f=arguments.length,a=-1,c=e.length,l=xu(f+c);++a<c;)l[a]=e[a];for(;f--;)l[a++]=arguments[++t];
+return(this&&this!==zt&&this instanceof u?i:n).apply(o?r:this,l)}var o=t&w,i=Kr(n);return u}function Jr(n,t,r,e,u,o,i,f){var a=t&x;if(!a&&typeof n!="function")throw new Wu($);var c=e?e.length:0;if(c||(t&=~(E|R),e=u=null),c-=u?u.length:0,t&R){var l=e,s=u;e=u=null}var p=!a&&Eo(n);if(r=[n,t,r,e,u,l,s,o,i,f],p&&true!==p){e=r[1],t=p[1],f=e|t,o=O|I,u=w|x,i=o|u|A|k;var l=e&O&&!(t&O),s=e&I&&!(t&I),h=(s?r:p)[7],g=(l?r:p)[8];o=f>=o&&f<=i&&(e<I||(s||l)&&h.length<=g),(!(e>=I&&t>u||e>u&&t>=I)||o)&&(t&w&&(r[2]=p[2],f|=e&w?0:A),(e=p[3])&&(u=r[3],r[3]=u?Lr(u,e,p[4]):Bt(e),r[4]=u?_(r[3],L):Bt(p[4])),(e=p[5])&&(u=r[5],r[5]=u?Br(u,e,p[6]):Bt(e),r[6]=u?_(r[5],L):Bt(p[6])),(e=p[7])&&(r[7]=Bt(e)),t&O&&(r[8]=null==r[8]?p[8]:ao(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=f),t=r[1],f=r[9]
+}return r[9]=null==f?a?0:n.length:fo(f-c,0)||0,(p?jo:Ro)(t==w?Mr(r[0],r[2]):t!=E&&t!=(w|E)||r[4].length?Yr.apply(m,r):Gr.apply(m,r),r)}function Xr(n,t,r,e,u,o,i){var f=-1,a=n.length,c=t.length,l=true;if(a!=c&&(!u||c<=a))return false;for(;l&&++f<a;){var s=n[f],p=t[f],l=m;if(e&&(l=u?e(p,s,f):e(s,p,f)),typeof l=="undefined")if(u)for(var h=c;h--&&(p=t[h],!(l=s&&s===p||r(s,p,e,u,o,i))););else l=s&&s===p||r(s,p,e,u,o,i)}return!!l}function Hr(n,t,r){switch(r){case D:case M:return+n==+t;case q:return n.name==t.name&&n.message==t.message;
+case K:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case Y:case Z:return n==t+""}return false}function Qr(n,t,r,e,u,o,i){var f=zo(n),a=f.length,c=zo(t).length;if(a!=c&&!u)return false;for(var l,c=-1;++c<a;){var s=f[c],p=Lu.call(t,s);if(p){var h=n[s],_=t[s],p=m;e&&(p=u?e(_,h,s):e(h,_,s)),typeof p=="undefined"&&(p=h&&h===_||r(h,_,e,u,o,i))}if(!p)return false;l||(l="constructor"==s)}return l||(r=n.constructor,e=t.constructor,!(r!=e&&"constructor"in n&&"constructor"in t)||typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)?true:false
+}function ne(n,t,r){var e=r?_o:ho,u=e,o=u;return or(n,function(n,i,f){i=t(n,i,f),((r?i<u:i>u)||i===e&&i===o)&&(u=i,o=n)}),o}function te(n,t,r){var e=Tt.callback||vu,e=e===vu?tr:e;return r?e(n,t,r):e}function re(n,r,e){var u=Tt.indexOf||we,u=u===we?t:u;return n?u(n,r,e):u}function ee(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&Lu.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function ue(n){return n=n.constructor,typeof n=="function"&&n instanceof n||(n=Iu),new n
+}function oe(n,t,r){var e=n.constructor;switch(t){case G:return $r(n);case D:case M:return new e(+n);case J:case X:case H:case Q:case nt:case tt:case rt:case et:case ut:return t=n.buffer,new e(r?$r(t):t,n.byteOffset,n.length);case K:case Z:return new e(n);case Y:var u=new e(n.source,vt.exec(n));u.lastIndex=n.lastIndex}return u}function ie(n,t){return n=+n,t=null==t?bo:t,-1<n&&0==n%1&&n<t}function fe(n,t,r){if(!Qe(r))return false;var e=typeof t;return"number"==e?(e=r.length,e=ae(e)&&ie(t,e)):e="string"==e&&t in r,e?(t=r[t],n===n?n===t:t!==t):false
+}function ae(n){return typeof n=="number"&&-1<n&&0==n%1&&n<=bo}function ce(n){return n===n&&(0===n?0<1/n:!Qe(n))}function le(n,t){n=ge(n);for(var r=-1,e=t.length,u={};++r<e;){var o=t[r];o in n&&(u[o]=n[o])}return u}function se(n,t){var r={};return hr(n,function(n,e,u){t(n,e,u)&&(r[e]=n)}),r}function pe(n){var t;if(!p(n)||zu.call(n)!=V||!(Lu.call(n,"constructor")||(t=n.constructor,typeof t!="function"||t instanceof t)))return false;var r;return hr(n,function(n,t){r=t}),typeof r=="undefined"||Lu.call(n,r)
+}function he(n){for(var t=fu(n),r=t.length,e=r&&n.length,u=Tt.support,u=e&&ae(e)&&(Uo(n)||u.nonEnumArgs&&Je(n)),o=-1,i=[];++o<r;){var f=t[o];(u&&ie(f,e)||Lu.call(n,f))&&i.push(f)}return i}function _e(n){return null==n?[]:ae(n.length)?Qe(n)?n:Iu(n):au(n)}function ge(n){return Qe(n)?n:Iu(n)}function ve(n){return n instanceof Ut?n.clone():new Nt(n.__wrapped__,n.__chain__,Bt(n.__actions__))}function ye(n,t,r){return n&&n.length?((r?fe(n,t,r):null==t)&&(t=1),Rr(n,0>t?0:t)):[]}function de(n,t,r){var e=n?n.length:0;
+return e?((r?fe(n,t,r):null==t)&&(t=1),t=e-(+t||0),Rr(n,0,0>t?0:t)):[]}function me(n,t,r){var e=-1,u=n?n.length:0;for(t=te(t,r,3);++e<u;)if(t(n[e],e,n))return e;return-1}function be(n){return n?n[0]:m}function we(n,r,e){var u=n?n.length:0;if(!u)return-1;if(typeof e=="number")e=0>e?fo(u+e,0):e;else if(e)return e=Nr(n,r),n=n[e],(r===r?r===n:n!==n)?e:-1;return t(n,r,e||0)}function xe(n){var t=n?n.length:0;return t?n[t-1]:m}function Ae(n){return ye(n,1)}function je(n,r,e,u){if(!n||!n.length)return[];
+null!=r&&typeof r!="boolean"&&(u=e,e=fe(n,r,u)?null:r,r=false);var o=te();if((o!==tr||null!=e)&&(e=o(e,u,3)),r&&re()==t){r=e;var i;e=-1,u=n.length;for(var o=-1,f=[];++e<u;){var a=n[e],c=r?r(a,e,n):a;e&&i===c||(i=c,f[++o]=a)}n=f}else n=Wr(n,e);return n}function ke(n){for(var t=-1,r=(n&&n.length&&Vt(Kt(n,$u)))>>>0,e=xu(r);++t<r;)e[t]=Kt(n,jr(t));return e}function Ee(n,t){var r=-1,e=n?n.length:0,u={};for(!e||t||Uo(n[0])||(t=[]);++r<e;){var o=n[r];t?u[o]=t[r]:o&&(u[o[0]]=o[1])}return u}function Re(n){return n=Tt(n),n.__chain__=true,n
+}function Ie(n,t,r){return t.call(r,n)}function Oe(n,t,r){var e=Uo(n)?qt:fr;return(typeof t!="function"||typeof r!="undefined")&&(t=te(t,r,3)),e(n,t)}function Ce(n,t,r){var e=Uo(n)?Pt:ar;return t=te(t,r,3),e(n,t)}function We(n,t,r){return Uo(n)?(t=me(n,t,r),-1<t?n[t]:m):(t=te(t,r,3),cr(n,t,or))}function Te(n,t,r){return typeof t=="function"&&typeof r=="undefined"&&Uo(n)?Mt(n,t):or(n,Fr(t,r,3))}function Se(n,t,r){if(typeof t=="function"&&typeof r=="undefined"&&Uo(n))for(r=n.length;r--&&false!==t(n[r],r,n););else n=ir(n,Fr(t,r,3));
+return n}function Ne(n,t,r){var e=n?n.length:0;return ae(e)||(n=au(n),e=n.length),e?(r=typeof r=="number"?0>r?fo(e+r,0):r||0:0,typeof n=="string"||!Uo(n)&&eu(n)?r<e&&-1<n.indexOf(t,r):-1<re(n,t,r)):false}function Ue(n,t,r){var e=Uo(n)?Kt:br;return t=te(t,r,3),e(n,t)}function Fe(n,t,r,e){return(Uo(n)?Yt:Er)(n,te(t,e,4),r,3>arguments.length,or)}function $e(n,t,r,e){return(Uo(n)?Zt:Er)(n,te(t,e,4),r,3>arguments.length,ir)}function Le(n,t,r){return(r?fe(n,t,r):null==t)?(n=_e(n),t=n.length,0<t?n[kr(0,t-1)]:m):(n=Be(n),n.length=ao(0>t?0:+t||0,n.length),n)
+}function Be(n){n=_e(n);for(var t=-1,r=n.length,e=xu(r);++t<r;){var u=kr(0,t);t!=u&&(e[t]=e[u]),e[u]=n[t]}return e}function ze(n,t,r){var e=Uo(n)?Gt:Ir;return(typeof t!="function"||typeof r!="undefined")&&(t=te(t,r,3)),e(n,t)}function De(n,t){var r;if(typeof t!="function"){if(typeof n!="function")throw new Wu($);var e=n;n=t,t=e}return function(){return 0<--n?r=t.apply(this,arguments):t=null,r}}function Me(n,t){var r=w;if(2<arguments.length)var e=Rr(arguments,2),u=_(e,Me.placeholder),r=r|E;return Jr(n,r,t,e,u)
+}function qe(n,t){var r=w|x;if(2<arguments.length)var e=Rr(arguments,2),u=_(e,qe.placeholder),r=r|E;return Jr(t,r,n,e,u)}function Pe(n,t,r){return r&&fe(n,t,r)&&(t=null),n=Jr(n,j,null,null,null,null,null,t),n.placeholder=Pe.placeholder,n}function Ke(n,t,r){return r&&fe(n,t,r)&&(t=null),n=Jr(n,k,null,null,null,null,null,t),n.placeholder=Ke.placeholder,n}function Ve(n,t,r){function e(){var r=t-(To()-c);0>=r||r>t?(f&&Vu(f),r=p,f=s=p=m,r&&(h=To(),a=n.apply(l,i),s||f||(i=l=null))):s=Hu(e,r)}function u(){s&&Vu(s),f=s=p=m,(g||_!==t)&&(h=To(),a=n.apply(l,i),s||f||(i=l=null))
+}function o(){if(i=arguments,c=To(),l=this,p=g&&(s||!v),false===_)var r=v&&!s;else{f||v||(h=c);var o=_-(c-h),y=0>=o||o>_;y?(f&&(f=Vu(f)),h=c,a=n.apply(l,i)):f||(f=Hu(u,o))}return y&&s?s=Vu(s):s||t===_||(s=Hu(e,t)),r&&(y=true,a=n.apply(l,i)),!y||s||f||(i=l=null),a}var i,f,a,c,l,s,p,h=0,_=false,g=true;if(typeof n!="function")throw new Wu($);if(t=0>t?0:+t||0,true===r)var v=true,g=false;else Qe(r)&&(v=r.leading,_="maxWait"in r&&fo(+r.maxWait||0,t),g="trailing"in r?r.trailing:g);return o.cancel=function(){s&&Vu(s),f&&Vu(f),f=s=p=m
+},o}function Ye(n,t){function r(){var e=arguments,u=r.cache,o=t?t.apply(this,e):e[0];return u.has(o)?u.get(o):(e=n.apply(this,e),u.set(o,e),e)}if(typeof n!="function"||t&&typeof t!="function")throw new Wu($);return r.cache=new Ye.Cache,r}function Ze(n){var t=Rr(arguments,1),r=_(t,Ze.placeholder);return Jr(n,E,null,t,r)}function Ge(n){var t=Rr(arguments,1),r=_(t,Ge.placeholder);return Jr(n,R,null,t,r)}function Je(n){return ae(p(n)?n.length:m)&&zu.call(n)==B||false}function Xe(n){return n&&1===n.nodeType&&p(n)&&-1<zu.call(n).indexOf("Element")||false
+}function He(n){return p(n)&&typeof n.message=="string"&&zu.call(n)==q||false}function Qe(n){var t=typeof n;return"function"==t||n&&"object"==t||false}function nu(n){return null==n?false:zu.call(n)==P?Mu.test(Fu.call(n)):p(n)&&mt.test(n)||false}function tu(n){return typeof n=="number"||p(n)&&zu.call(n)==K||false}function ru(n){return p(n)&&zu.call(n)==Y||false}function eu(n){return typeof n=="string"||p(n)&&zu.call(n)==Z||false}function uu(n){return p(n)&&ae(n.length)&&Ot[zu.call(n)]||false}function ou(n){return nr(n,fu(n))
+}function iu(n){return vr(n,fu(n))}function fu(n){if(null==n)return[];Qe(n)||(n=Iu(n));for(var t=n.length,t=t&&ae(t)&&(Uo(n)||xo.nonEnumArgs&&Je(n))&&t||0,r=n.constructor,e=-1,r=typeof r=="function"&&r.prototype===n,u=xu(t),o=0<t;++e<t;)u[e]=e+"";for(var i in n)o&&ie(i,t)||"constructor"==i&&(r||!Lu.call(n,i))||u.push(i);return u}function au(n){return Tr(n,zo(n))}function cu(n){return(n=e(n))&&n.replace(bt,a)}function lu(n){return(n=e(n))&&At.test(n)?n.replace(xt,"\\$&"):n}function su(n,t,r){return r&&fe(n,t,r)&&(t=0),so(n,t)
+}function pu(n,t){var r="";if(n=e(n),t=+t,1>t||!n||!oo(t))return r;do t%2&&(r+=n),t=Yu(t/2),n+=n;while(t);return r}function hu(n,t,r){var u=n;return(n=e(n))?(r?fe(u,t,r):null==t)?n.slice(g(n),v(n)+1):(t+="",n.slice(o(n,t),i(n,t)+1)):n}function _u(n,t,r){return r&&fe(n,t,r)&&(t=null),n=e(n),n.match(t||Et)||[]}function gu(){for(var n=arguments[0],t=arguments.length,r=xu(t?t-1:0);0<--t;)r[t-1]=arguments[t];try{return n.apply(m,r)}catch(e){return He(e)?e:new ju(e)}}function vu(n,t,r){return r&&fe(n,t,r)&&(t=null),p(n)?mu(n):tr(n,t)
+}function yu(n){return function(){return n}}function du(n){return n}function mu(n){return wr(rr(n,true))}function bu(n,t,r){if(null==r){var e=Qe(t),u=e&&zo(t);((u=u&&u.length&&vr(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=vr(t,zo(t)));var o=true,e=-1,i=$o(n),f=u.length;false===r?o=false:Qe(r)&&"chain"in r&&(o=r.chain);for(;++e<f;){r=u[e];var a=t[r];n[r]=a,i&&(n.prototype[r]=function(t){return function(){var r=this.__chain__;if(o||r){var e=n(this.__wrapped__);return(e.__actions__=Bt(this.__actions__)).push({func:t,args:arguments,thisArg:n}),e.__chain__=r,e
+}return r=[this.value()],Gu.apply(r,arguments),t.apply(n,r)}}(a))}return n}function wu(){}h=h?Dt.defaults(zt.Object(),h,Dt.pick(zt,It)):zt;var xu=h.Array,Au=h.Date,ju=h.Error,ku=h.Function,Eu=h.Math,Ru=h.Number,Iu=h.Object,Ou=h.RegExp,Cu=h.String,Wu=h.TypeError,Tu=xu.prototype,Su=Iu.prototype,Nu=Cu.prototype,Uu=(Uu=h.window)&&Uu.document,Fu=ku.prototype.toString,$u=jr("length"),Lu=Su.hasOwnProperty,Bu=0,zu=Su.toString,Du=h._,Mu=Ou("^"+lu(zu).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qu=nu(qu=h.ArrayBuffer)&&qu,Pu=nu(Pu=qu&&new qu(0).slice)&&Pu,Ku=Eu.ceil,Vu=h.clearTimeout,Yu=Eu.floor,Zu=nu(Zu=Iu.getPrototypeOf)&&Zu,Gu=Tu.push,Ju=Su.propertyIsEnumerable,Xu=nu(Xu=h.Set)&&Xu,Hu=h.setTimeout,Qu=Tu.splice,no=nu(no=h.Uint8Array)&&no,to=nu(to=h.WeakMap)&&to,ro=function(){try{var n=nu(n=h.Float64Array)&&n,t=new n(new qu(10),0,1)&&n
+}catch(r){}return t}(),eo=nu(eo=xu.isArray)&&eo,uo=nu(uo=Iu.create)&&uo,oo=h.isFinite,io=nu(io=Iu.keys)&&io,fo=Eu.max,ao=Eu.min,co=nu(co=Au.now)&&co,lo=nu(lo=Ru.isFinite)&&lo,so=h.parseInt,po=Eu.random,ho=Ru.NEGATIVE_INFINITY,_o=Ru.POSITIVE_INFINITY,go=Eu.pow(2,32)-1,vo=go-1,yo=go>>>1,mo=ro?ro.BYTES_PER_ELEMENT:0,bo=Eu.pow(2,53)-1,wo=to&&new to,xo=Tt.support={};!function(n){xo.funcDecomp=!nu(h.WinRTError)&&jt.test(d),xo.funcNames=typeof ku.name=="string";try{xo.dom=11===Uu.createDocumentFragment().nodeType
+}catch(t){xo.dom=false}try{xo.nonEnumArgs=!Ju.call(arguments,1)}catch(r){xo.nonEnumArgs=true}}(0,0),Tt.templateSettings={escape:pt,evaluate:ht,interpolate:_t,variable:"",imports:{_:Tt}};var Ao=function(){function n(){}return function(t){if(Qe(t)){n.prototype=t;var r=new n;n.prototype=null}return r||h.Object()}}(),jo=wo?function(n,t){return wo.set(n,t),n}:du;Pu||($r=qu&&no?function(n){var t=n.byteLength,r=ro?Yu(t/mo):0,e=r*mo,u=new qu(t);if(r){var o=new ro(u,0,r);o.set(new ro(n,0,r))}return t!=e&&(o=new no(u,e),o.set(new no(n,e))),u
+}:yu(null));var ko=uo&&Xu?function(n){return new $t(n)}:yu(null),Eo=wo?function(n){return wo.get(n)}:wu,Ro=function(){var n=0,t=0;return function(r,e){var u=To(),o=S-(u-t);if(t=u,0<o){if(++n>=T)return r}else n=0;return jo(r,e)}}(),Io=zr(function(n,t,r){Lu.call(n,r)?++n[r]:n[r]=1}),Oo=zr(function(n,t,r){Lu.call(n,r)?n[r].push(t):n[r]=[t]}),Co=zr(function(n,t,r){n[r]=t}),Wo=zr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),To=co||function(){return(new Au).getTime()},So=qr(),No=qr(true),Uo=eo||function(n){return p(n)&&ae(n.length)&&zu.call(n)==z||false
+};xo.dom||(Xe=function(n){return n&&1===n.nodeType&&p(n)&&!Lo(n)||false});var Fo=lo||function(n){return typeof n=="number"&&oo(n)},$o=r(/x/)||no&&!r(no)?function(n){return zu.call(n)==P}:r,Lo=Zu?function(n){if(!n||zu.call(n)!=V)return false;var t=n.valueOf,r=nu(t)&&(r=Zu(t))&&Zu(r);return r?n==r||Zu(n)==r:pe(n)}:pe,Bo=Dr(Ht),zo=io?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof n!="function"&&r&&ae(r)?he(n):Qe(n)?io(n):[]}:he,Do=Dr(Ar),Mo=Pr(function(n,t,r){return t=t.toLowerCase(),n+(r?t.charAt(0).toUpperCase()+t.slice(1):t)
+}),qo=Pr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()});8!=so(Rt+"08")&&(su=function(n,t,r){return(r?fe(n,t,r):null==t)?t=0:t&&(t=+t),n=hu(n),so(n,t||(dt.test(n)?16:10))});var Po=Pr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Ko=Pr(function(n,t,r){return n+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))}),Vo=Vr(Vt),Yo=Vr(function(n){for(var t=-1,r=n.length,e=_o;++t<r;){var u=n[t];u<e&&(e=u)}return e},true);return Tt.prototype=St.prototype,Nt.prototype=Ao(St.prototype),Nt.prototype.constructor=Nt,Ut.prototype=Ao(St.prototype),Ut.prototype.constructor=Ut,Ft.prototype["delete"]=function(n){return this.has(n)&&delete this.__data__[n]
+},Ft.prototype.get=function(n){return"__proto__"==n?m:this.__data__[n]},Ft.prototype.has=function(n){return"__proto__"!=n&&Lu.call(this.__data__,n)},Ft.prototype.set=function(n,t){return"__proto__"!=n&&(this.__data__[n]=t),this},$t.prototype.push=function(n){var t=this.data;typeof n=="string"||Qe(n)?t.set.add(n):t.hash[n]=true},Ye.Cache=Ft,Tt.after=function(n,t){if(typeof t!="function"){if(typeof n!="function")throw new Wu($);var r=n;n=t,t=r}return n=oo(n=+n)?n:0,function(){return 1>--n?t.apply(this,arguments):void 0
+}},Tt.ary=function(n,t,r){return r&&fe(n,t,r)&&(t=null),t=n&&null==t?n.length:fo(+t||0,0),Jr(n,O,null,null,null,null,t)},Tt.assign=Bo,Tt.at=function(n){return ae(n?n.length:0)&&(n=_e(n)),Qt(n,lr(arguments,false,false,1))},Tt.before=De,Tt.bind=Me,Tt.bindAll=function(n){for(var t=n,r=1<arguments.length?lr(arguments,false,false,1):iu(n),e=-1,u=r.length;++e<u;){var o=r[e];t[o]=Jr(t[o],w,t)}return t},Tt.bindKey=qe,Tt.callback=vu,Tt.chain=Re,Tt.chunk=function(n,t,r){t=(r?fe(n,t,r):null==t)?1:fo(+t||1,1),r=0;for(var e=n?n.length:0,u=-1,o=xu(Ku(e/t));r<e;)o[++u]=Rr(n,r,r+=t);
+return o},Tt.compact=function(n){for(var t=-1,r=n?n.length:0,e=-1,u=[];++t<r;){var o=n[t];o&&(u[++e]=o)}return u},Tt.constant=yu,Tt.countBy=Io,Tt.create=function(n,t,r){var e=Ao(n);return r&&fe(n,t,r)&&(t=null),t?nr(t,e,zo(t)):e},Tt.curry=Pe,Tt.curryRight=Ke,Tt.debounce=Ve,Tt.defaults=function(n){if(null==n)return n;var t=Bt(arguments);return t.push(Jt),Bo.apply(m,t)},Tt.defer=function(n){return er(n,1,arguments,1)},Tt.delay=function(n,t){return er(n,t,arguments,2)},Tt.difference=function(){for(var n=arguments,t=-1,r=n.length;++t<r;){var e=n[t];
+if(Uo(e)||Je(e))break}return ur(e,lr(n,false,true,++t))},Tt.drop=ye,Tt.dropRight=de,Tt.dropRightWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];for(t=te(t,r,3);e--&&t(n[e],e,n););return Rr(n,0,e+1)},Tt.dropWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];var u=-1;for(t=te(t,r,3);++u<e&&t(n[u],u,n););return Rr(n,u)},Tt.fill=function(n,t,r,e){var u=n?n.length:0;if(!u)return[];for(r&&typeof r!="number"&&fe(n,t,r)&&(r=0,e=u),u=n.length,r=null==r?0:+r||0,0>r&&(r=-r>u?0:u+r),e=typeof e=="undefined"||e>u?u:+e||0,0>e&&(e+=u),u=r>e?0:e>>>0,r>>>=0;r<u;)n[r++]=t;
+return n},Tt.filter=Ce,Tt.flatten=function(n,t,r){var e=n?n.length:0;return r&&fe(n,t,r)&&(t=false),e?lr(n,t,false,0):[]},Tt.flattenDeep=function(n){return n&&n.length?lr(n,true,false,0):[]},Tt.flow=So,Tt.flowRight=No,Tt.forEach=Te,Tt.forEachRight=Se,Tt.forIn=function(n,t,r){return(typeof t!="function"||typeof r!="undefined")&&(t=Fr(t,r,3)),sr(n,t,fu)},Tt.forInRight=function(n,t,r){return t=Fr(t,r,3),pr(n,t,fu)},Tt.forOwn=function(n,t,r){return(typeof t!="function"||typeof r!="undefined")&&(t=Fr(t,r,3)),_r(n,t)
+},Tt.forOwnRight=function(n,t,r){return t=Fr(t,r,3),pr(n,t,zo)},Tt.functions=iu,Tt.groupBy=Oo,Tt.indexBy=Co,Tt.initial=function(n){return de(n,1)},Tt.intersection=function(){for(var n=[],r=-1,e=arguments.length,u=[],o=re(),i=o==t;++r<e;){var f=arguments[r];(Uo(f)||Je(f))&&(n.push(f),u.push(i&&120<=f.length?ko(r&&f):null))}var e=n.length,i=n[0],a=-1,c=i?i.length:0,l=[],s=u[0];n:for(;++a<c;)if(f=i[a],0>(s?Lt(s,f):o(l,f,0))){for(r=e;--r;){var p=u[r];if(0>(p?Lt(p,f):o(n[r],f,0)))continue n}s&&s.push(f),l.push(f)
+}return l},Tt.invert=function(n,t,r){r&&fe(n,t,r)&&(t=null),r=-1;for(var e=zo(n),u=e.length,o={};++r<u;){var i=e[r],f=n[i];t?Lu.call(o,f)?o[f].push(i):o[f]=[i]:o[f]=i}return o},Tt.invoke=function(n,t){return yr(n,t,Rr(arguments,2))},Tt.keys=zo,Tt.keysIn=fu,Tt.map=Ue,Tt.mapValues=function(n,t,r){var e={};return t=te(t,r,3),_r(n,function(n,r,u){e[r]=t(n,r,u)}),e},Tt.matches=mu,Tt.matchesProperty=function(n,t){return xr(n+"",rr(t,true))},Tt.memoize=Ye,Tt.merge=Do,Tt.mixin=bu,Tt.negate=function(n){if(typeof n!="function")throw new Wu($);
+return function(){return!n.apply(this,arguments)}},Tt.omit=function(n,t,r){if(null==n)return{};if(typeof t!="function"){var e=Kt(lr(arguments,false,false,1),Cu);return le(n,ur(fu(n),e))}return t=Fr(t,r,3),se(n,function(n,r,e){return!t(n,r,e)})},Tt.once=function(n){return De(n,2)},Tt.pairs=function(n){for(var t=-1,r=zo(n),e=r.length,u=xu(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},Tt.partial=Ze,Tt.partialRight=Ge,Tt.partition=Wo,Tt.pick=function(n,t,r){return null==n?{}:typeof t=="function"?se(n,Fr(t,r,3)):le(n,lr(arguments,false,false,1))
+},Tt.pluck=function(n,t){return Ue(n,jr(t))},Tt.property=function(n){return jr(n+"")},Tt.propertyOf=function(n){return function(t){return null==n?m:n[t]}},Tt.pull=function(){var n=arguments,t=n[0];if(!t||!t.length)return t;for(var r=0,e=re(),u=n.length;++r<u;)for(var o=0,i=n[r];-1<(o=e(t,i,o));)Qu.call(t,o,1);return t},Tt.pullAt=function(t){var r=t||[],e=lr(arguments,false,false,1),u=e.length,o=Qt(r,e);for(e.sort(n);u--;){var i=parseFloat(e[u]);if(i!=f&&ie(i)){var f=i;Qu.call(r,i,1)}}return o},Tt.range=function(n,t,r){r&&fe(n,t,r)&&(t=r=null),n=+n||0,r=null==r?1:+r||0,null==t?(t=n,n=0):t=+t||0;
+var e=-1;t=fo(Ku((t-n)/(r||1)),0);for(var u=xu(t);++e<t;)u[e]=n,n+=r;return u},Tt.rearg=function(n){var t=lr(arguments,false,false,1);return Jr(n,I,null,null,null,t)},Tt.reject=function(n,t,r){var e=Uo(n)?Pt:ar;return t=te(t,r,3),e(n,function(n,r,e){return!t(n,r,e)})},Tt.remove=function(n,t,r){var e=-1,u=n?n.length:0,o=[];for(t=te(t,r,3);++e<u;)r=n[e],t(r,e,n)&&(o.push(r),Qu.call(n,e--,1),u--);return o},Tt.rest=Ae,Tt.shuffle=Be,Tt.slice=function(n,t,r){var e=n?n.length:0;return e?(r&&typeof r!="number"&&fe(n,t,r)&&(t=0,r=e),Rr(n,t,r)):[]
+},Tt.sortBy=function(n,t,r){if(null==n)return[];var e=-1,u=n.length,o=ae(u)?xu(u):[];return r&&fe(n,t,r)&&(t=null),t=te(t,r,3),or(n,function(n,r,u){o[++e]={a:t(n,r,u),b:e,c:n}}),Or(o,f)},Tt.sortByAll=function(n){if(null==n)return[];var t=arguments,r=t[3];return r&&fe(t[1],t[2],r)&&(t=[n,t[1]]),Cr(n,lr(t,false,false,1),[])},Tt.sortByOrder=function(n,t,r,e){return null==n?[]:(e&&fe(t,r,e)&&(r=null),Uo(t)||(t=null==t?[]:[t]),Uo(r)||(r=null==r?[]:[r]),Cr(n,t,r))},Tt.spread=function(n){if(typeof n!="function")throw new Wu($);
+return function(t){return n.apply(this,t)}},Tt.take=function(n,t,r){return n&&n.length?((r?fe(n,t,r):null==t)&&(t=1),Rr(n,0,0>t?0:t)):[]},Tt.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?fe(n,t,r):null==t)&&(t=1),t=e-(+t||0),Rr(n,0>t?0:t)):[]},Tt.takeRightWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];for(t=te(t,r,3);e--&&t(n[e],e,n););return Rr(n,e+1)},Tt.takeWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];var u=-1;for(t=te(t,r,3);++u<e&&t(n[u],u,n););return Rr(n,0,u)
+},Tt.tap=function(n,t,r){return t.call(r,n),n},Tt.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new Wu($);return false===r?e=false:Qe(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),Wt.leading=e,Wt.maxWait=+t,Wt.trailing=u,Ve(n,t,Wt)},Tt.thru=Ie,Tt.times=function(n,t,r){if(n=+n,1>n||!oo(n))return[];var e=-1,u=xu(ao(n,go));for(t=Fr(t,r,1);++e<n;)e<go?u[e]=t(e):t(e);return u},Tt.toArray=function(n){var t=n?n.length:0;return ae(t)?t?Bt(n):[]:au(n)},Tt.toPlainObject=ou,Tt.transform=function(n,t,r,e){var u=Uo(n)||uu(n);
+return t=te(t,e,4),null==r&&(u||Qe(n)?(e=n.constructor,r=u?Uo(n)?new e:[]:Ao($o(e)&&e.prototype)):r={}),(u?Mt:_r)(n,function(n,e,u){return t(r,n,e,u)}),r},Tt.union=function(){return Wr(lr(arguments,false,true,0))},Tt.uniq=je,Tt.unzip=ke,Tt.values=au,Tt.valuesIn=function(n){return Tr(n,fu(n))},Tt.where=function(n,t){return Ce(n,wr(t))},Tt.without=function(n){return ur(n,Rr(arguments,1))},Tt.wrap=function(n,t){return t=null==t?du:t,Jr(t,E,null,[n],[])},Tt.xor=function(){for(var n=-1,t=arguments.length;++n<t;){var r=arguments[n];
+if(Uo(r)||Je(r))var e=e?ur(e,r).concat(ur(r,e)):r}return e?Wr(e):[]},Tt.zip=function(){for(var n=arguments.length,t=xu(n);n--;)t[n]=arguments[n];return ke(t)},Tt.zipObject=Ee,Tt.backflow=No,Tt.collect=Ue,Tt.compose=No,Tt.each=Te,Tt.eachRight=Se,Tt.extend=Bo,Tt.iteratee=vu,Tt.methods=iu,Tt.object=Ee,Tt.select=Ce,Tt.tail=Ae,Tt.unique=je,bu(Tt,Tt),Tt.add=function(n,t){return n+t},Tt.attempt=gu,Tt.camelCase=Mo,Tt.capitalize=function(n){return(n=e(n))&&n.charAt(0).toUpperCase()+n.slice(1)},Tt.clone=function(n,t,r,e){return t&&typeof t!="boolean"&&fe(n,t,r)?t=false:typeof t=="function"&&(e=r,r=t,t=false),r=typeof r=="function"&&Fr(r,e,1),rr(n,t,r)
+},Tt.cloneDeep=function(n,t,r){return t=typeof t=="function"&&Fr(t,r,1),rr(n,true,t)},Tt.deburr=cu,Tt.endsWith=function(n,t,r){n=e(n),t+="";var u=n.length;return r=typeof r=="undefined"?u:ao(0>r?0:+r||0,u),r-=t.length,0<=r&&n.indexOf(t,r)==r},Tt.escape=function(n){return(n=e(n))&&st.test(n)?n.replace(ct,c):n},Tt.escapeRegExp=lu,Tt.every=Oe,Tt.find=We,Tt.findIndex=me,Tt.findKey=function(n,t,r){return t=te(t,r,3),cr(n,t,_r,true)},Tt.findLast=function(n,t,r){return t=te(t,r,3),cr(n,t,ir)},Tt.findLastIndex=function(n,t,r){var e=n?n.length:0;
+for(t=te(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Tt.findLastKey=function(n,t,r){return t=te(t,r,3),cr(n,t,gr,true)},Tt.findWhere=function(n,t){return We(n,wr(t))},Tt.first=be,Tt.has=function(n,t){return n?Lu.call(n,t):false},Tt.identity=du,Tt.includes=Ne,Tt.indexOf=we,Tt.inRange=function(n,t,r){return t=+t||0,"undefined"===typeof r?(r=t,t=0):r=+r||0,n>=t&&n<r},Tt.isArguments=Je,Tt.isArray=Uo,Tt.isBoolean=function(n){return true===n||false===n||p(n)&&zu.call(n)==D||false},Tt.isDate=function(n){return p(n)&&zu.call(n)==M||false
+},Tt.isElement=Xe,Tt.isEmpty=function(n){if(null==n)return true;var t=n.length;return ae(t)&&(Uo(n)||eu(n)||Je(n)||p(n)&&$o(n.splice))?!t:!zo(n).length},Tt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Fr(r,e,3),!r&&ce(n)&&ce(t)?n===t:(e=r?r(n,t):m,typeof e=="undefined"?dr(n,t,r):!!e)},Tt.isError=He,Tt.isFinite=Fo,Tt.isFunction=$o,Tt.isMatch=function(n,t,r,e){var u=zo(t),o=u.length;if(r=typeof r=="function"&&Fr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],ce(e))return null!=n&&e===n[i]&&Lu.call(n,i)
+}for(var i=xu(o),f=xu(o);o--;)e=i[o]=t[u[o]],f[o]=ce(e);return mr(n,u,i,f,r)},Tt.isNaN=function(n){return tu(n)&&n!=+n},Tt.isNative=nu,Tt.isNull=function(n){return null===n},Tt.isNumber=tu,Tt.isObject=Qe,Tt.isPlainObject=Lo,Tt.isRegExp=ru,Tt.isString=eu,Tt.isTypedArray=uu,Tt.isUndefined=function(n){return typeof n=="undefined"},Tt.kebabCase=qo,Tt.last=xe,Tt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?fo(e+r,0):ao(r||0,e-1))+1;else if(r)return u=Nr(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;
+if(t!==t)return s(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Tt.max=Vo,Tt.min=Yo,Tt.noConflict=function(){return h._=Du,this},Tt.noop=wu,Tt.now=To,Tt.pad=function(n,t,r){n=e(n),t=+t;var u=n.length;return u<t&&oo(t)?(u=(t-u)/2,t=Yu(u),u=Ku(u),r=Zr("",u,r),r.slice(0,t)+n+r):n},Tt.padLeft=function(n,t,r){return(n=e(n))&&Zr(n,t,r)+n},Tt.padRight=function(n,t,r){return(n=e(n))&&n+Zr(n,t,r)},Tt.parseInt=su,Tt.random=function(n,t,r){r&&fe(n,t,r)&&(t=r=null);var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=po(),ao(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):kr(n,t)
+},Tt.reduce=Fe,Tt.reduceRight=$e,Tt.repeat=pu,Tt.result=function(n,t,r){return t=null==n?m:n[t],typeof t=="undefined"&&(t=r),$o(t)?t.call(n):t},Tt.runInContext=d,Tt.size=function(n){var t=n?n.length:0;return ae(t)?t:zo(n).length},Tt.snakeCase=Po,Tt.some=ze,Tt.sortedIndex=function(n,t,r,e){var u=te(r);return u===tr&&null==r?Nr(n,t):Ur(n,t,u(r,e,1))},Tt.sortedLastIndex=function(n,t,r,e){var u=te(r);return u===tr&&null==r?Nr(n,t,true):Ur(n,t,u(r,e,1),true)},Tt.startCase=Ko,Tt.startsWith=function(n,t,r){return n=e(n),r=null==r?0:ao(0>r?0:+r||0,n.length),n.lastIndexOf(t,r)==r
+},Tt.sum=function(n){Uo(n)||(n=_e(n));for(var t=n.length,r=0;t--;)r+=+n[t]||0;return r},Tt.template=function(n,t,r){var u=Tt.templateSettings;r&&fe(n,t,r)&&(t=r=null),n=e(n),t=Ht(Ht({},r||t),u,Xt),r=Ht(Ht({},t.imports),u.imports,Xt);var o,i,f=zo(r),a=Tr(r,f),c=0;r=t.interpolate||wt;var s="__p+='";r=Ou((t.escape||wt).source+"|"+r.source+"|"+(r===_t?gt:wt).source+"|"+(t.evaluate||wt).source+"|$","g");var p="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,u,f,a){return e||(e=u),s+=n.slice(c,a).replace(kt,l),r&&(o=true,s+="'+__e("+r+")+'"),f&&(i=true,s+="';"+f+";\n__p+='"),e&&(s+="'+((__t=("+e+"))==null?'':__t)+'"),c=a+t.length,t
+}),s+="';",(t=t.variable)||(s="with(obj){"+s+"}"),s=(i?s.replace(ot,""):s).replace(it,"$1").replace(ft,"$1;"),s="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+s+"return __p}",t=gu(function(){return ku(f,p+"return "+s).apply(m,a)}),t.source=s,He(t))throw t;return t},Tt.trim=hu,Tt.trimLeft=function(n,t,r){var u=n;return(n=e(n))?n.slice((r?fe(u,t,r):null==t)?g(n):o(n,t+"")):n
+},Tt.trimRight=function(n,t,r){var u=n;return(n=e(n))?(r?fe(u,t,r):null==t)?n.slice(0,v(n)+1):n.slice(0,i(n,t+"")+1):n},Tt.trunc=function(n,t,r){r&&fe(n,t,r)&&(t=null);var u=C;if(r=W,null!=t)if(Qe(t)){var o="separator"in t?t.separator:o,u="length"in t?+t.length||0:u;r="omission"in t?e(t.omission):r}else u=+t||0;if(n=e(n),u>=n.length)return n;if(u-=r.length,1>u)return r;if(t=n.slice(0,u),null==o)return t+r;if(ru(o)){if(n.slice(u).search(o)){var i,f=n.slice(0,u);for(o.global||(o=Ou(o.source,(vt.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(f);)i=n.index;
+t=t.slice(0,null==i?u:i)}}else n.indexOf(o,u)!=u&&(o=t.lastIndexOf(o),-1<o&&(t=t.slice(0,o)));return t+r},Tt.unescape=function(n){return(n=e(n))&&lt.test(n)?n.replace(at,y):n},Tt.uniqueId=function(n){var t=++Bu;return e(n)+t},Tt.words=_u,Tt.all=Oe,Tt.any=ze,Tt.contains=Ne,Tt.detect=We,Tt.foldl=Fe,Tt.foldr=$e,Tt.head=be,Tt.include=Ne,Tt.inject=Fe,bu(Tt,function(){var n={};return _r(Tt,function(t,r){Tt.prototype[r]||(n[r]=t)}),n}(),false),Tt.sample=Le,Tt.prototype.sample=function(n){return this.__chain__||null!=n?this.thru(function(t){return Le(t,n)
+}):Le(this.value())},Tt.VERSION=b,Mt("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Tt[n].placeholder=Tt}),Mt(["dropWhile","filter","map","takeWhile"],function(n,t){var r=t!=F,e=t==N;Ut.prototype[n]=function(n,u){var o=this.__filtered__,i=o&&e?new Ut(this):this.clone();return(i.__iteratees__||(i.__iteratees__=[])).push({done:false,count:0,index:0,iteratee:te(n,u,1),limit:-1,type:t}),i.__filtered__=o||r,i}}),Mt(["drop","take"],function(n,t){var r=n+"While";Ut.prototype[n]=function(r){var e=this.__filtered__,u=e&&!t?this.dropWhile():this.clone();
+return r=null==r?1:fo(Yu(r)||0,0),e?t?u.__takeCount__=ao(u.__takeCount__,r):xe(u.__iteratees__).limit=r:(u.__views__||(u.__views__=[])).push({size:r,type:n+(0>u.__dir__?"Right":"")}),u},Ut.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},Ut.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[r](n,t).reverse()}}),Mt(["first","last"],function(n,t){var r="take"+(t?"Right":"");Ut.prototype[n]=function(){return this[r](1).value()[0]}}),Mt(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");
+Ut.prototype[n]=function(){return this[r](1)}}),Mt(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?wr:jr;Ut.prototype[n]=function(n){return this[r](e(n))}}),Ut.prototype.compact=function(){return this.filter(du)},Ut.prototype.reject=function(n,t){return n=te(n,t,1),this.filter(function(t){return!n(t)})},Ut.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},Ut.prototype.toArray=function(){return this.drop(0)
+},_r(Ut.prototype,function(n,t){var r=Tt[t],e=/^(?:filter|map|reject)|While$/.test(t),u=/^(?:first|last)$/.test(t);Tt.prototype[t]=function(){function t(n){return n=[n],Gu.apply(n,o),r.apply(Tt,n)}var o=arguments,i=this.__chain__,f=this.__wrapped__,a=!!this.__actions__.length,c=f instanceof Ut,l=o[0],s=c||Uo(f);return s&&e&&typeof l=="function"&&1!=l.length&&(c=s=false),c=c&&!a,u&&!i?c?n.call(f):r.call(Tt,this.value()):s?(f=n.apply(c?f:new Ut(this),o),u||!a&&!f.__actions__||(f.__actions__||(f.__actions__=[])).push({func:Ie,args:[t],thisArg:Tt}),new Nt(f,i)):this.thru(t)
+}}),Mt("concat join pop push replace shift sort splice split unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?Nu:Tu)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|replace|shift)$/.test(n);Tt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),Ut.prototype.clone=function(){var n=this.__actions__,t=this.__iteratees__,r=this.__views__,e=new Ut(this.__wrapped__);return e.__actions__=n?Bt(n):null,e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=t?Bt(t):null,e.__takeCount__=this.__takeCount__,e.__views__=r?Bt(r):null,e
+},Ut.prototype.reverse=function(){if(this.__filtered__){var n=new Ut(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Ut.prototype.value=function(){var n=this.__wrapped__.value();if(!Uo(n))return Sr(n,this.__actions__);var t,r=this.__dir__,e=0>r;t=n.length;for(var u=this.__views__,o=0,i=-1,f=u?u.length:0;++i<f;){var a=u[i],c=a.size;switch(a.type){case"drop":o+=c;break;case"dropRight":t-=c;break;case"take":t=ao(t,o+c);break;case"takeRight":o=fo(o,t-c)}}t={start:o,end:t},u=t.start,o=t.end,t=o-u,u=e?o:u-1,o=ao(t,this.__takeCount__),f=(i=this.__iteratees__)?i.length:0,a=0,c=[];
+n:for(;t--&&a<o;){for(var u=u+r,l=-1,s=n[u];++l<f;){var p=i[l],h=p.iteratee,_=p.type;if(_==N){if(p.done&&(e?u>p.index:u<p.index)&&(p.count=0,p.done=false),p.index=u,!(p.done||(_=p.limit,p.done=-1<_?p.count++>=_:!h(s))))continue n}else if(p=h(s),_==F)s=p;else if(!p){if(_==U)continue n;break n}}c[a++]=s}return c},Tt.prototype.chain=function(){return Re(this)},Tt.prototype.commit=function(){return new Nt(this.value(),this.__chain__)},Tt.prototype.plant=function(n){for(var t,r=this;r instanceof St;){var e=ve(r);
+t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},Tt.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Ut?(this.__actions__.length&&(n=new Ut(this)),new Nt(n.reverse(),this.__chain__)):this.thru(function(n){return n.reverse()})},Tt.prototype.toString=function(){return this.value()+""},Tt.prototype.run=Tt.prototype.toJSON=Tt.prototype.valueOf=Tt.prototype.value=function(){return Sr(this.__wrapped__,this.__actions__)},Tt.prototype.collect=Tt.prototype.map,Tt.prototype.head=Tt.prototype.first,Tt.prototype.select=Tt.prototype.filter,Tt.prototype.tail=Tt.prototype.rest,Tt
+}var m,b="3.5.0",w=1,x=2,A=4,j=8,k=16,E=32,R=64,I=128,O=256,C=30,W="...",T=150,S=16,N=0,U=1,F=2,$="Expected a function",L="__lodash_placeholder__",B="[object Arguments]",z="[object Array]",D="[object Boolean]",M="[object Date]",q="[object Error]",P="[object Function]",K="[object Number]",V="[object Object]",Y="[object RegExp]",Z="[object String]",G="[object ArrayBuffer]",J="[object Float32Array]",X="[object Float64Array]",H="[object Int8Array]",Q="[object Int16Array]",nt="[object Int32Array]",tt="[object Uint8Array]",rt="[object Uint8ClampedArray]",et="[object Uint16Array]",ut="[object Uint32Array]",ot=/\b__p\+='';/g,it=/\b(__p\+=)''\+/g,ft=/(__e\(.*?\)|\b__t\))\+'';/g,at=/&(?:amp|lt|gt|quot|#39|#96);/g,ct=/[&<>"'`]/g,lt=RegExp(at.source),st=RegExp(ct.source),pt=/<%-([\s\S]+?)%>/g,ht=/<%([\s\S]+?)%>/g,_t=/<%=([\s\S]+?)%>/g,gt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vt=/\w*$/,yt=/^\s*function[ \n\r\t]+\w/,dt=/^0[xX]/,mt=/^\[object .+?Constructor\]$/,bt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xf
 f]/g,wt=/($^)/,xt=/[.*+?^${}()|[\]\/\\]/g,At=RegExp(xt.source),jt=/\bthis\b/,kt=/['\n\r\u2028\u2029\\]/g,Et=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),Rt=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",It="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),Ot={};
+Ot[J]=Ot[X]=Ot[H]=Ot[Q]=Ot[nt]=Ot[tt]=Ot[rt]=Ot[et]=Ot[ut]=true,Ot[B]=Ot[z]=Ot[G]=Ot[D]=Ot[M]=Ot[q]=Ot[P]=Ot["[object Map]"]=Ot[K]=Ot[V]=Ot[Y]=Ot["[object Set]"]=Ot[Z]=Ot["[object WeakMap]"]=false;var Ct={};Ct[B]=Ct[z]=Ct[G]=Ct[D]=Ct[M]=Ct[J]=Ct[X]=Ct[H]=Ct[Q]=Ct[nt]=Ct[K]=Ct[V]=Ct[Y]=Ct[Z]=Ct[tt]=Ct[rt]=Ct[et]=Ct[ut]=true,Ct[q]=Ct[P]=Ct["[object Map]"]=Ct["[object Set]"]=Ct["[object WeakMap]"]=false;var Wt={leading:false,maxWait:0,trailing:false},Tt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\
 xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},St={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},Nt={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},Ut={"function":true,object:true},Ft={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$t=Ut[typeof exports]&&exports&&!exports.nodeType&&exports,Lt=Ut[typeof module]&&module&&!module.nodeType&&module,Ut=Ut[typeof window]&&window,Bt=Lt&&Lt.exports===$t&&$t,zt=$t&&Lt&&typeof global=="object"&&global||Ut!==(this&&this.window)&&Ut||this,Dt=d();
+typeof define=="function"&&typeof define.amd=="object"&&define.amd?(zt._=Dt, define(function(){return Dt})):$t&&Lt?Bt?(Lt.exports=Dt)._=Dt:$t._=Dt:zt._=Dt}).call(this);
\ No newline at end of file


[3/8] chukwa git commit: CHUKWA-806. Replace gridster with gridstack. (Eric Yang)

Posted by ey...@apache.org.
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/js/jquery.gridster.with-extras.js
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/js/jquery.gridster.with-extras.js b/src/main/web/hicc/home/js/jquery.gridster.with-extras.js
deleted file mode 100755
index d8e8e1f..0000000
--- a/src/main/web/hicc/home/js/jquery.gridster.with-extras.js
+++ /dev/null
@@ -1,4163 +0,0 @@
-/*! gridster.js - v0.5.6 - 2014-09-25
-* http://gridster.net/
-* Copyright (c) 2014 ducksboard; Licensed MIT */
-
-;(function(root, factory) {
-
-    if (typeof define === 'function' && define.amd) {
-        define('gridster-coords', ['jquery'], factory);
-    } else {
-       root.GridsterCoords = factory(root.$ || root.jQuery);
-    }
-
-}(this, function($) {
-    /**
-    * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)
-    * to simulate DOM elements on the screen.
-    * Coords is used by Gridster to create a faux grid with any DOM element can
-    * collide.
-    *
-    * @class Coords
-    * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left,
-    * top, width and height properties.
-    * @return {Object} Coords instance.
-    * @constructor
-    */
-    function Coords(obj) {
-        if (obj[0] && $.isPlainObject(obj[0])) {
-            this.data = obj[0];
-        }else {
-            this.el = obj;
-        }
-
-        this.isCoords = true;
-        this.coords = {};
-        this.init();
-        return this;
-    }
-
-
-    var fn = Coords.prototype;
-
-
-    fn.init = function(){
-        this.set();
-        this.original_coords = this.get();
-    };
-
-
-    fn.set = function(update, not_update_offsets) {
-        var el = this.el;
-
-        if (el && !update) {
-            this.data = el.offset();
-            this.data.width = el.width();
-            this.data.height = el.height();
-        }
-
-        if (el && update && !not_update_offsets) {
-            var offset = el.offset();
-            this.data.top = offset.top;
-            this.data.left = offset.left;
-        }
-
-        var d = this.data;
-
-        typeof d.left === 'undefined' && (d.left = d.x1);
-        typeof d.top === 'undefined' && (d.top = d.y1);
-
-        this.coords.x1 = d.left;
-        this.coords.y1 = d.top;
-        this.coords.x2 = d.left + d.width;
-        this.coords.y2 = d.top + d.height;
-        this.coords.cx = d.left + (d.width / 2);
-        this.coords.cy = d.top + (d.height / 2);
-        this.coords.width  = d.width;
-        this.coords.height = d.height;
-        this.coords.el  = el || false ;
-
-        return this;
-    };
-
-
-    fn.update = function(data){
-        if (!data && !this.el) {
-            return this;
-        }
-
-        if (data) {
-            var new_data = $.extend({}, this.data, data);
-            this.data = new_data;
-            return this.set(true, true);
-        }
-
-        this.set(true);
-        return this;
-    };
-
-
-    fn.get = function(){
-        return this.coords;
-    };
-
-    fn.destroy = function() {
-        this.el.removeData('coords');
-        delete this.el;
-    };
-
-    //jQuery adapter
-    $.fn.coords = function() {
-        if (this.data('coords') ) {
-            return this.data('coords');
-        }
-
-        var ins = new Coords(this, arguments[0]);
-        this.data('coords', ins);
-        return ins;
-    };
-
-    return Coords;
-
-}));
-
-;(function(root, factory) {
-
-    if (typeof define === 'function' && define.amd) {
-        define('gridster-collision', ['jquery', 'gridster-coords'], factory);
-    } else {
-        root.GridsterCollision = factory(root.$ || root.jQuery,
-            root.GridsterCoords);
-    }
-
-}(this, function($, Coords) {
-
-    var defaults = {
-        colliders_context: document.body,
-        overlapping_region: 'C'
-        // ,on_overlap: function(collider_data){},
-        // on_overlap_start : function(collider_data){},
-        // on_overlap_stop : function(collider_data){}
-    };
-
-
-    /**
-    * Detects collisions between a DOM element against other DOM elements or
-    * Coords objects.
-    *
-    * @class Collision
-    * @uses Coords
-    * @param {HTMLElement} el The jQuery wrapped HTMLElement.
-    * @param {HTMLElement|Array} colliders Can be a jQuery collection
-    *  of HTMLElements or an Array of Coords instances.
-    * @param {Object} [options] An Object with all options you want to
-    *        overwrite:
-    *   @param {String} [options.overlapping_region] Determines when collision
-    *    is valid, depending on the overlapped area. Values can be: 'N', 'S',
-    *    'W', 'E', 'C' or 'all'. Default is 'C'.
-    *   @param {Function} [options.on_overlap_start] Executes a function the first
-    *    time each `collider ` is overlapped.
-    *   @param {Function} [options.on_overlap_stop] Executes a function when a
-    *    `collider` is no longer collided.
-    *   @param {Function} [options.on_overlap] Executes a function when the
-    * mouse is moved during the collision.
-    * @return {Object} Collision instance.
-    * @constructor
-    */
-    function Collision(el, colliders, options) {
-        this.options = $.extend(defaults, options);
-        this.$element = el;
-        this.last_colliders = [];
-        this.last_colliders_coords = [];
-        this.set_colliders(colliders);
-
-        this.init();
-    }
-
-    Collision.defaults = defaults;
-
-    var fn = Collision.prototype;
-
-
-    fn.init = function() {
-        this.find_collisions();
-    };
-
-
-    fn.overlaps = function(a, b) {
-        var x = false;
-        var y = false;
-
-        if ((b.x1 >= a.x1 && b.x1 <= a.x2) ||
-            (b.x2 >= a.x1 && b.x2 <= a.x2) ||
-            (a.x1 >= b.x1 && a.x2 <= b.x2)
-        ) { x = true; }
-
-        if ((b.y1 >= a.y1 && b.y1 <= a.y2) ||
-            (b.y2 >= a.y1 && b.y2 <= a.y2) ||
-            (a.y1 >= b.y1 && a.y2 <= b.y2)
-        ) { y = true; }
-
-        return (x && y);
-    };
-
-
-    fn.detect_overlapping_region = function(a, b){
-        var regionX = '';
-        var regionY = '';
-
-        if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; }
-        if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; }
-        if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; }
-        if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; }
-
-        return (regionX + regionY) || 'C';
-    };
-
-
-    fn.calculate_overlapped_area_coords = function(a, b){
-        var x1 = Math.max(a.x1, b.x1);
-        var y1 = Math.max(a.y1, b.y1);
-        var x2 = Math.min(a.x2, b.x2);
-        var y2 = Math.min(a.y2, b.y2);
-
-        return $({
-            left: x1,
-            top: y1,
-             width : (x2 - x1),
-            height: (y2 - y1)
-          }).coords().get();
-    };
-
-
-    fn.calculate_overlapped_area = function(coords){
-        return (coords.width * coords.height);
-    };
-
-
-    fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){
-        var last = this.last_colliders_coords;
-
-        for (var i = 0, il = last.length; i < il; i++) {
-            if ($.inArray(last[i], new_colliders_coords) === -1) {
-                start_callback.call(this, last[i]);
-            }
-        }
-
-        for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) {
-            if ($.inArray(new_colliders_coords[j], last) === -1) {
-                stop_callback.call(this, new_colliders_coords[j]);
-            }
-
-        }
-    };
-
-
-    fn.find_collisions = function(player_data_coords){
-        var self = this;
-        var overlapping_region = this.options.overlapping_region;
-        var colliders_coords = [];
-        var colliders_data = [];
-        var $colliders = (this.colliders || this.$colliders);
-        var count = $colliders.length;
-        var player_coords = self.$element.coords()
-                             .update(player_data_coords || false).get();
-
-        while(count--){
-          var $collider = self.$colliders ?
-                           $($colliders[count]) : $colliders[count];
-          var $collider_coords_ins = ($collider.isCoords) ?
-                  $collider : $collider.coords();
-          var collider_coords = $collider_coords_ins.get();
-          var overlaps = self.overlaps(player_coords, collider_coords);
-
-          if (!overlaps) {
-            continue;
-          }
-
-          var region = self.detect_overlapping_region(
-              player_coords, collider_coords);
-
-            //todo: make this an option
-            if (region === overlapping_region || overlapping_region === 'all') {
-
-                var area_coords = self.calculate_overlapped_area_coords(
-                    player_coords, collider_coords);
-                var area = self.calculate_overlapped_area(area_coords);
-                var collider_data = {
-                    area: area,
-                    area_coords : area_coords,
-                    region: region,
-                    coords: collider_coords,
-                    player_coords: player_coords,
-                    el: $collider
-                };
-
-                if (self.options.on_overlap) {
-                    self.options.on_overlap.call(this, collider_data);
-                }
-                colliders_coords.push($collider_coords_ins);
-                colliders_data.push(collider_data);
-            }
-        }
-
-        if (self.options.on_overlap_stop || self.options.on_overlap_start) {
-            this.manage_colliders_start_stop(colliders_coords,
-                self.options.on_overlap_start, self.options.on_overlap_stop);
-        }
-
-        this.last_colliders_coords = colliders_coords;
-
-        return colliders_data;
-    };
-
-
-    fn.get_closest_colliders = function(player_data_coords){
-        var colliders = this.find_collisions(player_data_coords);
-
-        colliders.sort(function(a, b) {
-            /* if colliders are being overlapped by the "C" (center) region,
-             * we have to set a lower index in the array to which they are placed
-             * above in the grid. */
-            if (a.region === 'C' && b.region === 'C') {
-                if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) {
-                    return - 1;
-                }else{
-                    return 1;
-                }
-            }
-
-            if (a.area < b.area) {
-                return 1;
-            }
-
-            return 1;
-        });
-        return colliders;
-    };
-
-
-    fn.set_colliders = function(colliders) {
-        if (typeof colliders === 'string' || colliders instanceof $) {
-            this.$colliders = $(colliders,
-                 this.options.colliders_context).not(this.$element);
-        }else{
-            this.colliders = $(colliders);
-        }
-    };
-
-
-    //jQuery adapter
-    $.fn.collision = function(collider, options) {
-          return new Collision( this, collider, options );
-    };
-
-    return Collision;
-
-}));
-
-;(function(window, undefined) {
-
-    /* Delay, debounce and throttle functions taken from underscore.js
-     *
-     * Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and
-     * Investigative Reporters & Editors
-     *
-     * Permission is hereby granted, free of charge, to any person
-     * obtaining a copy of this software and associated documentation
-     * files (the "Software"), to deal in the Software without
-     * restriction, including without limitation the rights to use,
-     * copy, modify, merge, publish, distribute, sublicense, and/or sell
-     * copies of the Software, and to permit persons to whom the
-     * Software is furnished to do so, subject to the following
-     * conditions:
-     *
-     * The above copyright notice and this permission notice shall be
-     * included in all copies or substantial portions of the Software.
-     *
-     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-     * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-     * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-     * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-     * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-     * OTHER DEALINGS IN THE SOFTWARE.
-     */
-
-    window.delay = function(func, wait) {
-        var args = Array.prototype.slice.call(arguments, 2);
-        return setTimeout(function(){ return func.apply(null, args); }, wait);
-    };
-
-    window.debounce = function(func, wait, immediate) {
-        var timeout;
-        return function() {
-          var context = this, args = arguments;
-          var later = function() {
-            timeout = null;
-            if (!immediate) func.apply(context, args);
-          };
-          if (immediate && !timeout) func.apply(context, args);
-          clearTimeout(timeout);
-          timeout = setTimeout(later, wait);
-        };
-    };
-
-    window.throttle = function(func, wait) {
-        var context, args, timeout, throttling, more, result;
-        var whenDone = debounce(
-            function(){ more = throttling = false; }, wait);
-        return function() {
-          context = this; args = arguments;
-          var later = function() {
-            timeout = null;
-            if (more) func.apply(context, args);
-            whenDone();
-          };
-          if (!timeout) timeout = setTimeout(later, wait);
-          if (throttling) {
-            more = true;
-          } else {
-            result = func.apply(context, args);
-          }
-          whenDone();
-          throttling = true;
-          return result;
-        };
-    };
-
-})(window);
-
-;(function(root, factory) {
-
-    if (typeof define === 'function' && define.amd) {
-        define('gridster-draggable', ['jquery'], factory);
-    } else {
-        root.GridsterDraggable = factory(root.$ || root.jQuery);
-    }
-
-}(this, function($) {
-
-    var defaults = {
-        items: 'li',
-        distance: 1,
-        limit: true,
-        offset_left: 0,
-        autoscroll: true,
-        ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'], // or function
-        handle: null,
-        container_width: 0,  // 0 == auto
-        move_element: true,
-        helper: false,  // or 'clone'
-        remove_helper: true
-        // drag: function(e) {},
-        // start : function(e, ui) {},
-        // stop : function(e) {}
-    };
-
-    var $window = $(window);
-    var dir_map = { x : 'left', y : 'top' };
-    var isTouch = !!('ontouchstart' in window);
-
-    var capitalize = function(str) {
-        return str.charAt(0).toUpperCase() + str.slice(1);
-    };
-
-    var idCounter = 0;
-    var uniqId = function() {
-        return ++idCounter + '';
-    }
-
-    /**
-    * Basic drag implementation for DOM elements inside a container.
-    * Provide start/stop/drag callbacks.
-    *
-    * @class Draggable
-    * @param {HTMLElement} el The HTMLelement that contains all the widgets
-    *  to be dragged.
-    * @param {Object} [options] An Object with all options you want to
-    *        overwrite:
-    *    @param {HTMLElement|String} [options.items] Define who will
-    *     be the draggable items. Can be a CSS Selector String or a
-    *     collection of HTMLElements.
-    *    @param {Number} [options.distance] Distance in pixels after mousedown
-    *     the mouse must move before dragging should start.
-    *    @param {Boolean} [options.limit] Constrains dragging to the width of
-    *     the container
-    *    @param {Object|Function} [options.ignore_dragging] Array of node names
-    *      that sould not trigger dragging, by default is `['INPUT', 'TEXTAREA',
-    *      'SELECT', 'BUTTON']`. If a function is used return true to ignore dragging.
-    *    @param {offset_left} [options.offset_left] Offset added to the item
-    *     that is being dragged.
-    *    @param {Number} [options.drag] Executes a callback when the mouse is
-    *     moved during the dragging.
-    *    @param {Number} [options.start] Executes a callback when the drag
-    *     starts.
-    *    @param {Number} [options.stop] Executes a callback when the drag stops.
-    * @return {Object} Returns `el`.
-    * @constructor
-    */
-    function Draggable(el, options) {
-      this.options = $.extend({}, defaults, options);
-      this.$document = $(document);
-      this.$container = $(el);
-      this.$dragitems = $(this.options.items, this.$container);
-      this.is_dragging = false;
-      this.player_min_left = 0 + this.options.offset_left;
-      this.id = uniqId();
-      this.ns = '.gridster-draggable-' + this.id;
-      this.init();
-    }
-
-    Draggable.defaults = defaults;
-
-    var fn = Draggable.prototype;
-
-    fn.init = function() {
-        var pos = this.$container.css('position');
-        this.calculate_dimensions();
-        this.$container.css('position', pos === 'static' ? 'relative' : pos);
-        this.disabled = false;
-        this.events();
-
-        $(window).bind(this.nsEvent('resize'),
-            throttle($.proxy(this.calculate_dimensions, this), 200));
-    };
-
-    fn.nsEvent = function(ev) {
-        return (ev || '') + this.ns;
-    };
-
-    fn.events = function() {
-        this.pointer_events = {
-            start: this.nsEvent('touchstart') + ' ' + this.nsEvent('mousedown'),
-            move: this.nsEvent('touchmove') + ' ' + this.nsEvent('mousemove'),
-            end: this.nsEvent('touchend') + ' ' + this.nsEvent('mouseup'),
-        };
-
-        this.$container.on(this.nsEvent('selectstart'),
-            $.proxy(this.on_select_start, this));
-
-        this.$container.on(this.pointer_events.start, this.options.items,
-            $.proxy(this.drag_handler, this));
-
-        this.$document.on(this.pointer_events.end, $.proxy(function(e) {
-            this.is_dragging = false;
-            if (this.disabled) { return; }
-            this.$document.off(this.pointer_events.move);
-            if (this.drag_start) {
-                this.on_dragstop(e);
-            }
-        }, this));
-    };
-
-    fn.get_actual_pos = function($el) {
-        var pos = $el.position();
-        return pos;
-    };
-
-
-    fn.get_mouse_pos = function(e) {
-        if (e.originalEvent && e.originalEvent.touches) {
-            var oe = e.originalEvent;
-            e = oe.touches.length ? oe.touches[0] : oe.changedTouches[0];
-        }
-
-        return {
-            left: e.clientX,
-            top: e.clientY
-        };
-    };
-
-
-    fn.get_offset = function(e) {
-        e.preventDefault();
-        var mouse_actual_pos = this.get_mouse_pos(e);
-        var diff_x = Math.round(
-            mouse_actual_pos.left - this.mouse_init_pos.left);
-        var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top);
-
-        var left = Math.round(this.el_init_offset.left +
-            diff_x - this.baseX + $(window).scrollLeft() - this.win_offset_x);
-        var top = Math.round(this.el_init_offset.top +
-            diff_y - this.baseY + $(window).scrollTop() - this.win_offset_y);
-
-        if (this.options.limit) {
-            if (left > this.player_max_left) {
-                left = this.player_max_left;
-            } else if(left < this.player_min_left) {
-                left = this.player_min_left;
-            }
-        }
-
-        return {
-            position: {
-                left: left,
-                top: top
-            },
-            pointer: {
-                left: mouse_actual_pos.left,
-                top: mouse_actual_pos.top,
-                diff_left: diff_x + ($(window).scrollLeft() - this.win_offset_x),
-                diff_top: diff_y + ($(window).scrollTop() - this.win_offset_y)
-            }
-        };
-    };
-
-
-    fn.get_drag_data = function(e) {
-        var offset = this.get_offset(e);
-        offset.$player = this.$player;
-        offset.$helper = this.helper ? this.$helper : this.$player;
-
-        return offset;
-    };
-
-
-    fn.set_limits = function(container_width) {
-        container_width || (container_width = this.$container.width());
-        this.player_max_left = (container_width - this.player_width +
-            - this.options.offset_left);
-
-        this.options.container_width = container_width;
-
-        return this;
-    };
-
-
-    fn.scroll_in = function(axis, data) {
-        var dir_prop = dir_map[axis];
-
-        var area_size = 50;
-        var scroll_inc = 30;
-
-        var is_x = axis === 'x';
-        var window_size = is_x ? this.window_width : this.window_height;
-        var doc_size = is_x ? $(document).width() : $(document).height();
-        var player_size = is_x ? this.$player.width() : this.$player.height();
-
-        var next_scroll;
-        var scroll_offset = $window['scroll' + capitalize(dir_prop)]();
-        var min_window_pos = scroll_offset;
-        var max_window_pos = min_window_pos + window_size;
-
-        var mouse_next_zone = max_window_pos - area_size;  // down/right
-        var mouse_prev_zone = min_window_pos + area_size;  // up/left
-
-        var abs_mouse_pos = min_window_pos + data.pointer[dir_prop];
-
-        var max_player_pos = (doc_size - window_size + player_size);
-
-        if (abs_mouse_pos >= mouse_next_zone) {
-            next_scroll = scroll_offset + scroll_inc;
-            if (next_scroll < max_player_pos) {
-                $window['scroll' + capitalize(dir_prop)](next_scroll);
-                this['scroll_offset_' + axis] += scroll_inc;
-            }
-        }
-
-        if (abs_mouse_pos <= mouse_prev_zone) {
-            next_scroll = scroll_offset - scroll_inc;
-            if (next_scroll > 0) {
-                $window['scroll' + capitalize(dir_prop)](next_scroll);
-                this['scroll_offset_' + axis] -= scroll_inc;
-            }
-        }
-
-        return this;
-    };
-
-
-    fn.manage_scroll = function(data) {
-        this.scroll_in('x', data);
-        this.scroll_in('y', data);
-    };
-
-
-    fn.calculate_dimensions = function(e) {
-        this.window_height = $window.height();
-        this.window_width = $window.width();
-    };
-
-
-    fn.drag_handler = function(e) {
-        var node = e.target.nodeName;
-        // skip if drag is disabled, or click was not done with the mouse primary button
-        if (this.disabled || e.which !== 1 && !isTouch) {
-            return;
-        }
-
-        if (this.ignore_drag(e)) {
-            return;
-        }
-
-        var self = this;
-        var first = true;
-        this.$player = $(e.currentTarget);
-
-        this.el_init_pos = this.get_actual_pos(this.$player);
-        this.mouse_init_pos = this.get_mouse_pos(e);
-        this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;
-
-        this.$document.on(this.pointer_events.move, function(mme) {
-            var mouse_actual_pos = self.get_mouse_pos(mme);
-            var diff_x = Math.abs(
-                mouse_actual_pos.left - self.mouse_init_pos.left);
-            var diff_y = Math.abs(
-                mouse_actual_pos.top - self.mouse_init_pos.top);
-            if (!(diff_x > self.options.distance ||
-                diff_y > self.options.distance)
-                ) {
-                return false;
-            }
-
-            if (first) {
-                first = false;
-                self.on_dragstart.call(self, mme);
-                return false;
-            }
-
-            if (self.is_dragging === true) {
-                self.on_dragmove.call(self, mme);
-            }
-
-            return false;
-        });
-
-        if (!isTouch) { return false; }
-    };
-
-
-    fn.on_dragstart = function(e) {
-        e.preventDefault();
-
-        if (this.is_dragging) { return this; }
-
-        this.drag_start = this.is_dragging = true;
-        var offset = this.$container.offset();
-        this.baseX = Math.round(offset.left);
-        this.baseY = Math.round(offset.top);
-        this.initial_container_width = this.options.container_width || this.$container.width();
-
-        if (this.options.helper === 'clone') {
-            this.$helper = this.$player.clone()
-                .appendTo(this.$container).addClass('helper');
-            this.helper = true;
-        } else {
-            this.helper = false;
-        }
-
-        this.win_offset_y = $(window).scrollTop();
-        this.win_offset_x = $(window).scrollLeft();
-        this.scroll_offset_y = 0;
-        this.scroll_offset_x = 0;
-        this.el_init_offset = this.$player.offset();
-        this.player_width = this.$player.width();
-        this.player_height = this.$player.height();
-
-        this.set_limits(this.options.container_width);
-
-        if (this.options.start) {
-            this.options.start.call(this.$player, e, this.get_drag_data(e));
-        }
-        return false;
-    };
-
-
-    fn.on_dragmove = function(e) {
-        var data = this.get_drag_data(e);
-
-        this.options.autoscroll && this.manage_scroll(data);
-
-        if (this.options.move_element) {
-            (this.helper ? this.$helper : this.$player).css({
-                'position': 'absolute',
-                'left' : data.position.left,
-                'top' : data.position.top
-            });
-        }
-
-        var last_position = this.last_position || data.position;
-        data.prev_position = last_position;
-
-        if (this.options.drag) {
-            this.options.drag.call(this.$player, e, data);
-        }
-
-        this.last_position = data.position;
-        return false;
-    };
-
-
-    fn.on_dragstop = function(e) {
-        var data = this.get_drag_data(e);
-        this.drag_start = false;
-
-        if (this.options.stop) {
-            this.options.stop.call(this.$player, e, data);
-        }
-
-        if (this.helper && this.options.remove_helper) {
-            this.$helper.remove();
-        }
-
-        return false;
-    };
-
-    fn.on_select_start = function(e) {
-        if (this.disabled) { return; }
-
-        if (this.ignore_drag(e)) {
-            return;
-        }
-
-        return false;
-    };
-
-    fn.enable = function() {
-        this.disabled = false;
-    };
-
-    fn.disable = function() {
-        this.disabled = true;
-    };
-
-    fn.destroy = function() {
-        this.disable();
-
-        this.$container.off(this.ns);
-        this.$document.off(this.ns);
-        $(window).off(this.ns);
-
-        $.removeData(this.$container, 'drag');
-    };
-
-    fn.ignore_drag = function(event) {
-        if (this.options.handle) {
-            return !$(event.target).is(this.options.handle);
-        }
-
-        if ($.isFunction(this.options.ignore_dragging)) {
-            return this.options.ignore_dragging(event);
-        }
-
-        return $(event.target).is(this.options.ignore_dragging.join(', '));
-    };
-
-    //jQuery adapter
-    $.fn.drag = function ( options ) {
-        return new Draggable(this, options);
-    };
-
-    return Draggable;
-
-}));
-
-;(function(root, factory) {
-
-    if (typeof define === 'function' && define.amd) {
-        define(['jquery', 'gridster-draggable', 'gridster-collision'], factory);
-    } else {
-        root.Gridster = factory(root.$ || root.jQuery, root.GridsterDraggable,
-            root.GridsterCollision);
-    }
-
- }(this, function($, Draggable, Collision) {
-
-    var defaults = {
-        namespace: '',
-        widget_selector: 'li',
-        widget_margins: [10, 10],
-        widget_base_dimensions: [400, 225],
-        extra_rows: 0,
-        extra_cols: 0,
-        min_cols: 1,
-        max_cols: Infinity,
-        min_rows: 15,
-        max_size_x: false,
-        autogrow_cols: false,
-        autogenerate_stylesheet: true,
-        avoid_overlapped_widgets: true,
-        auto_init: true,
-        serialize_params: function($w, wgd) {
-            return {
-                col: wgd.col,
-                row: wgd.row,
-                size_x: wgd.size_x,
-                size_y: wgd.size_y
-            };
-        },
-        collision: {},
-        draggable: {
-            items: '.gs-w',
-            distance: 4,
-            ignore_dragging: Draggable.defaults.ignore_dragging.slice(0)
-        },
-        resize: {
-            enabled: false,
-            axes: ['both'],
-            handle_append_to: '',
-            handle_class: 'gs-resize-handle',
-            max_size: [Infinity, Infinity],
-            min_size: [1, 1]
-        }
-    };
-
-    /**
-    * @class Gridster
-    * @uses Draggable
-    * @uses Collision
-    * @param {HTMLElement} el The HTMLelement that contains all the widgets.
-    * @param {Object} [options] An Object with all options you want to
-    *        overwrite:
-    *    @param {HTMLElement|String} [options.widget_selector] Define who will
-    *     be the draggable widgets. Can be a CSS Selector String or a
-    *     collection of HTMLElements
-    *    @param {Array} [options.widget_margins] Margin between widgets.
-    *     The first index for the horizontal margin (left, right) and
-    *     the second for the vertical margin (top, bottom).
-    *    @param {Array} [options.widget_base_dimensions] Base widget dimensions
-    *     in pixels. The first index for the width and the second for the
-    *     height.
-    *    @param {Number} [options.extra_cols] Add more columns in addition to
-    *     those that have been calculated.
-    *    @param {Number} [options.extra_rows] Add more rows in addition to
-    *     those that have been calculated.
-    *    @param {Number} [options.min_cols] The minimum required columns.
-    *    @param {Number} [options.max_cols] The maximum columns possible (set to null
-    *     for no maximum).
-    *    @param {Number} [options.min_rows] The minimum required rows.
-    *    @param {Number} [options.max_size_x] The maximum number of columns
-    *     that a widget can span.
-    *    @param {Boolean} [options.autogenerate_stylesheet] If true, all the
-    *     CSS required to position all widgets in their respective columns
-    *     and rows will be generated automatically and injected to the
-    *     `<head>` of the document. You can set this to false, and write
-    *     your own CSS targeting rows and cols via data-attributes like so:
-    *     `[data-col="1"] { left: 10px; }`
-    *    @param {Boolean} [options.avoid_overlapped_widgets] Avoid that widgets loaded
-    *     from the DOM can be overlapped. It is helpful if the positions were
-    *     bad stored in the database or if there was any conflict.
-    *    @param {Boolean} [options.auto_init] Automatically call gridster init
-    *     method or not when the plugin is instantiated.
-    *    @param {Function} [options.serialize_params] Return the data you want
-    *     for each widget in the serialization. Two arguments are passed:
-    *     `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid
-    *     coords object (`col`, `row`, `size_x`, `size_y`).
-    *    @param {Object} [options.collision] An Object with all options for
-    *     Collision class you want to overwrite. See Collision docs for
-    *     more info.
-    *    @param {Object} [options.draggable] An Object with all options for
-    *     Draggable class you want to overwrite. See Draggable docs for more
-    *     info.
-    *       @param {Object|Function} [options.draggable.ignore_dragging] Note that
-    *        if you use a Function, and resize is enabled, you should ignore the
-    *        resize handlers manually (options.resize.handle_class).
-    *    @param {Object} [options.resize] An Object with resize config options.
-    *       @param {Boolean} [options.resize.enabled] Set to true to enable
-    *        resizing.
-    *       @param {Array} [options.resize.axes] Axes in which widgets can be
-    *        resized. Possible values: ['x', 'y', 'both'].
-    *       @param {String} [options.resize.handle_append_to] Set a valid CSS
-    *        selector to append resize handles to.
-    *       @param {String} [options.resize.handle_class] CSS class name used
-    *        by resize handles.
-    *       @param {Array} [options.resize.max_size] Limit widget dimensions
-    *        when resizing. Array values should be integers:
-    *        `[max_cols_occupied, max_rows_occupied]`
-    *       @param {Array} [options.resize.min_size] Limit widget dimensions
-    *        when resizing. Array values should be integers:
-    *        `[min_cols_occupied, min_rows_occupied]`
-    *       @param {Function} [options.resize.start] Function executed
-    *        when resizing starts.
-    *       @param {Function} [otions.resize.resize] Function executed
-    *        during the resizing.
-    *       @param {Function} [options.resize.stop] Function executed
-    *        when resizing stops.
-    *
-    * @constructor
-    */
-    function Gridster(el, options) {
-        this.options = $.extend(true, {}, defaults, options);
-        this.$el = $(el);
-        this.$wrapper = this.$el.parent();
-        this.$widgets = this.$el.children(
-            this.options.widget_selector).addClass('gs-w');
-        this.widgets = [];
-        this.$changed = $([]);
-        this.wrapper_width = this.$wrapper.width();
-        this.min_widget_width = (this.options.widget_margins[0] * 2) +
-          this.options.widget_base_dimensions[0];
-        this.min_widget_height = (this.options.widget_margins[1] * 2) +
-          this.options.widget_base_dimensions[1];
-
-        this.generated_stylesheets = [];
-        this.$style_tags = $([]);
-
-        this.options.auto_init && this.init();
-    }
-
-    Gridster.defaults = defaults;
-    Gridster.generated_stylesheets = [];
-
-
-    /**
-    * Sorts an Array of grid coords objects (representing the grid coords of
-    * each widget) in ascending way.
-    *
-    * @method sort_by_row_asc
-    * @param {Array} widgets Array of grid coords objects
-    * @return {Array} Returns the array sorted.
-    */
-    Gridster.sort_by_row_asc = function(widgets) {
-        widgets = widgets.sort(function(a, b) {
-            if (!a.row) {
-                a = $(a).coords().grid;
-                b = $(b).coords().grid;
-            }
-
-           if (a.row > b.row) {
-               return 1;
-           }
-           return -1;
-        });
-
-        return widgets;
-    };
-
-
-    /**
-    * Sorts an Array of grid coords objects (representing the grid coords of
-    * each widget) placing first the empty cells upper left.
-    *
-    * @method sort_by_row_and_col_asc
-    * @param {Array} widgets Array of grid coords objects
-    * @return {Array} Returns the array sorted.
-    */
-    Gridster.sort_by_row_and_col_asc = function(widgets) {
-        widgets = widgets.sort(function(a, b) {
-           if (a.row > b.row || a.row === b.row && a.col > b.col) {
-               return 1;
-           }
-           return -1;
-        });
-
-        return widgets;
-    };
-
-
-    /**
-    * Sorts an Array of grid coords objects by column (representing the grid
-    * coords of each widget) in ascending way.
-    *
-    * @method sort_by_col_asc
-    * @param {Array} widgets Array of grid coords objects
-    * @return {Array} Returns the array sorted.
-    */
-    Gridster.sort_by_col_asc = function(widgets) {
-        widgets = widgets.sort(function(a, b) {
-           if (a.col > b.col) {
-               return 1;
-           }
-           return -1;
-        });
-
-        return widgets;
-    };
-
-
-    /**
-    * Sorts an Array of grid coords objects (representing the grid coords of
-    * each widget) in descending way.
-    *
-    * @method sort_by_row_desc
-    * @param {Array} widgets Array of grid coords objects
-    * @return {Array} Returns the array sorted.
-    */
-    Gridster.sort_by_row_desc = function(widgets) {
-        widgets = widgets.sort(function(a, b) {
-            if (a.row + a.size_y < b.row + b.size_y) {
-                return 1;
-            }
-           return -1;
-        });
-        return widgets;
-    };
-
-
-
-    /** Instance Methods **/
-
-    var fn = Gridster.prototype;
-
-    fn.init = function() {
-        this.options.resize.enabled && this.setup_resize();
-        this.generate_grid_and_stylesheet();
-        this.get_widgets_from_DOM();
-        this.set_dom_grid_height();
-        this.set_dom_grid_width();
-        this.$wrapper.addClass('ready');
-        this.draggable();
-        this.options.resize.enabled && this.resizable();
-
-        $(window).bind('resize.gridster', throttle(
-            $.proxy(this.recalculate_faux_grid, this), 200));
-    };
-
-
-    /**
-    * Disables dragging.
-    *
-    * @method disable
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.disable = function() {
-        this.$wrapper.find('.player-revert').removeClass('player-revert');
-        this.drag_api.disable();
-        return this;
-    };
-
-
-    /**
-    * Enables dragging.
-    *
-    * @method enable
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.enable = function() {
-        this.drag_api.enable();
-        return this;
-    };
-
-
-
-    /**
-    * Disables drag-and-drop widget resizing.
-    *
-    * @method disable
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.disable_resize = function() {
-        this.$el.addClass('gs-resize-disabled');
-        this.resize_api.disable();
-        return this;
-    };
-
-
-    /**
-    * Enables drag-and-drop widget resizing.
-    *
-    * @method enable
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.enable_resize = function() {
-        this.$el.removeClass('gs-resize-disabled');
-        this.resize_api.enable();
-        return this;
-    };
-
-
-    /**
-    * Add a new widget to the grid.
-    *
-    * @method add_widget
-    * @param {String|HTMLElement} html The string representing the HTML of the widget
-    *  or the HTMLElement.
-    * @param {Number} [size_x] The n� of rows the widget occupies horizontally.
-    * @param {Number} [size_y] The n� of columns the widget occupies vertically.
-    * @param {Number} [col] The column the widget should start in.
-    * @param {Number} [row] The row the widget should start in.
-    * @param {Array} [max_size] max_size Maximun size (in units) for width and height.
-    * @param {Array} [min_size] min_size Minimum size (in units) for width and height.
-    * @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing.
-    *  the widget that was just created.
-    */
-    fn.add_widget = function(html, size_x, size_y, col, row, max_size, min_size) {
-        var pos;
-        size_x || (size_x = 1);
-        size_y || (size_y = 1);
-
-        if (!col & !row) {
-            pos = this.next_position(size_x, size_y);
-        } else {
-            pos = {
-                col: col,
-                row: row,
-                size_x: size_x,
-                size_y: size_y
-            };
-
-            this.empty_cells(col, row, size_x, size_y);
-        }
-
-        var $w = $(html).attr({
-                'data-col': pos.col,
-                'data-row': pos.row,
-                'data-sizex' : size_x,
-                'data-sizey' : size_y
-            }).addClass('gs-w').appendTo(this.$el).hide();
-
-        this.$widgets = this.$widgets.add($w);
-
-        this.register_widget($w);
-
-        this.add_faux_rows(pos.size_y);
-        //this.add_faux_cols(pos.size_x);
-
-        if (max_size) {
-            this.set_widget_max_size($w, max_size);
-        }
-
-        if (min_size) {
-            this.set_widget_min_size($w, min_size);
-        }
-
-        this.set_dom_grid_width();
-        this.set_dom_grid_height();
-
-        this.drag_api.set_limits(this.cols * this.min_widget_width);
-
-        return $w.fadeIn();
-    };
-
-
-    /**
-    * Change widget size limits.
-    *
-    * @method set_widget_min_size
-    * @param {HTMLElement|Number} $widget The jQuery wrapped HTMLElement
-    *  representing the widget or an index representing the desired widget.
-    * @param {Array} min_size Minimum size (in units) for width and height.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.set_widget_min_size = function($widget, min_size) {
-        $widget = typeof $widget === 'number' ?
-            this.$widgets.eq($widget) : $widget;
-
-        if (!$widget.length) { return this; }
-
-        var wgd = $widget.data('coords').grid;
-        wgd.min_size_x = min_size[0];
-        wgd.min_size_y = min_size[1];
-
-        return this;
-    };
-
-
-    /**
-    * Change widget size limits.
-    *
-    * @method set_widget_max_size
-    * @param {HTMLElement|Number} $widget The jQuery wrapped HTMLElement
-    *  representing the widget or an index representing the desired widget.
-    * @param {Array} max_size Maximun size (in units) for width and height.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.set_widget_max_size = function($widget, max_size) {
-        $widget = typeof $widget === 'number' ?
-            this.$widgets.eq($widget) : $widget;
-
-        if (!$widget.length) { return this; }
-
-        var wgd = $widget.data('coords').grid;
-        wgd.max_size_x = max_size[0];
-        wgd.max_size_y = max_size[1];
-
-        return this;
-    };
-
-
-    /**
-    * Append the resize handle into a widget.
-    *
-    * @method add_resize_handle
-    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement
-    *  representing the widget.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.add_resize_handle = function($w) {
-        var append_to = this.options.resize.handle_append_to;
-        $(this.resize_handle_tpl).appendTo( append_to ? $(append_to, $w) : $w);
-
-        return this;
-    };
-
-
-    /**
-    * Change the size of a widget. Width is limited to the current grid width.
-    *
-    * @method resize_widget
-    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement
-    *  representing the widget.
-    * @param {Number} size_x The number of columns that will occupy the widget.
-    *  By default <code>size_x</code> is limited to the space available from
-    *  the column where the widget begins, until the last column to the right.
-    * @param {Number} size_y The number of rows that will occupy the widget.
-    * @param {Function} [callback] Function executed when the widget is removed.
-    * @return {HTMLElement} Returns $widget.
-    */
-    fn.resize_widget = function($widget, size_x, size_y, callback) {
-        var wgd = $widget.coords().grid;
-        var col = wgd.col;
-        var max_cols = this.options.max_cols;
-        var old_size_y = wgd.size_y;
-        var old_col = wgd.col;
-        var new_col = old_col;
-
-        size_x || (size_x = wgd.size_x);
-        size_y || (size_y = wgd.size_y);
-
-        if (max_cols !== Infinity) {
-            size_x = Math.min(size_x, max_cols - col + 1);
-        }
-
-        if (size_y > old_size_y) {
-            this.add_faux_rows(Math.max(size_y - old_size_y, 0));
-        }
-
-        var player_rcol = (col + size_x - 1);
-        if (player_rcol > this.cols) {
-            this.add_faux_cols(player_rcol - this.cols);
-        }
-
-        var new_grid_data = {
-            col: new_col,
-            row: wgd.row,
-            size_x: size_x,
-            size_y: size_y
-        };
-
-        this.mutate_widget_in_gridmap($widget, wgd, new_grid_data);
-
-        this.set_dom_grid_height();
-        this.set_dom_grid_width();
-
-        if (callback) {
-            callback.call(this, new_grid_data.size_x, new_grid_data.size_y);
-        }
-
-        return $widget;
-    };
-
-
-    /**
-    * Mutate widget dimensions and position in the grid map.
-    *
-    * @method mutate_widget_in_gridmap
-    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement
-    *  representing the widget to mutate.
-    * @param {Object} wgd Current widget grid data (col, row, size_x, size_y).
-    * @param {Object} new_wgd New widget grid data.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.mutate_widget_in_gridmap = function($widget, wgd, new_wgd) {
-        var old_size_x = wgd.size_x;
-        var old_size_y = wgd.size_y;
-
-        var old_cells_occupied = this.get_cells_occupied(wgd);
-        var new_cells_occupied = this.get_cells_occupied(new_wgd);
-
-        var empty_cols = [];
-        $.each(old_cells_occupied.cols, function(i, col) {
-            if ($.inArray(col, new_cells_occupied.cols) === -1) {
-                empty_cols.push(col);
-            }
-        });
-
-        var occupied_cols = [];
-        $.each(new_cells_occupied.cols, function(i, col) {
-            if ($.inArray(col, old_cells_occupied.cols) === -1) {
-                occupied_cols.push(col);
-            }
-        });
-
-        var empty_rows = [];
-        $.each(old_cells_occupied.rows, function(i, row) {
-            if ($.inArray(row, new_cells_occupied.rows) === -1) {
-                empty_rows.push(row);
-            }
-        });
-
-        var occupied_rows = [];
-        $.each(new_cells_occupied.rows, function(i, row) {
-            if ($.inArray(row, old_cells_occupied.rows) === -1) {
-                occupied_rows.push(row);
-            }
-        });
-
-        this.remove_from_gridmap(wgd);
-
-        if (occupied_cols.length) {
-            var cols_to_empty = [
-                new_wgd.col, new_wgd.row, new_wgd.size_x, Math.min(old_size_y, new_wgd.size_y), $widget
-            ];
-            this.empty_cells.apply(this, cols_to_empty);
-        }
-
-        if (occupied_rows.length) {
-            var rows_to_empty = [new_wgd.col, new_wgd.row, new_wgd.size_x, new_wgd.size_y, $widget];
-            this.empty_cells.apply(this, rows_to_empty);
-        }
-
-        // not the same that wgd = new_wgd;
-        wgd.col = new_wgd.col;
-        wgd.row = new_wgd.row;
-        wgd.size_x = new_wgd.size_x;
-        wgd.size_y = new_wgd.size_y;
-
-        this.add_to_gridmap(new_wgd, $widget);
-
-        $widget.removeClass('player-revert');
-
-        //update coords instance attributes
-        $widget.data('coords').update({
-            width: (new_wgd.size_x * this.options.widget_base_dimensions[0] +
-                ((new_wgd.size_x - 1) * this.options.widget_margins[0]) * 2),
-            height: (new_wgd.size_y * this.options.widget_base_dimensions[1] +
-                ((new_wgd.size_y - 1) * this.options.widget_margins[1]) * 2)
-        });
-
-        $widget.attr({
-            'data-col': new_wgd.col,
-            'data-row': new_wgd.row,
-            'data-sizex': new_wgd.size_x,
-            'data-sizey': new_wgd.size_y
-        });
-
-        if (empty_cols.length) {
-            var cols_to_remove_holes = [
-                empty_cols[0], new_wgd.row,
-                empty_cols.length,
-                Math.min(old_size_y, new_wgd.size_y),
-                $widget
-            ];
-
-            this.remove_empty_cells.apply(this, cols_to_remove_holes);
-        }
-
-        if (empty_rows.length) {
-            var rows_to_remove_holes = [
-                new_wgd.col, new_wgd.row, new_wgd.size_x, new_wgd.size_y, $widget
-            ];
-            this.remove_empty_cells.apply(this, rows_to_remove_holes);
-        }
-
-        this.move_widget_up($widget);
-
-        return this;
-    };
-
-
-    /**
-    * Move down widgets in cells represented by the arguments col, row, size_x,
-    * size_y
-    *
-    * @method empty_cells
-    * @param {Number} col The column where the group of cells begin.
-    * @param {Number} row The row where the group of cells begin.
-    * @param {Number} size_x The number of columns that the group of cells
-    * occupy.
-    * @param {Number} size_y The number of rows that the group of cells
-    * occupy.
-    * @param {HTMLElement} $exclude Exclude widgets from being moved.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.empty_cells = function(col, row, size_x, size_y, $exclude) {
-        var $nexts = this.widgets_below({
-                col: col,
-                row: row - size_y,
-                size_x: size_x,
-                size_y: size_y
-            });
-
-        $nexts.not($exclude).each($.proxy(function(i, w) {
-            var wgd = $(w).coords().grid;
-            if ( !(wgd.row <= (row + size_y - 1))) { return; }
-            var diff =  (row + size_y) - wgd.row;
-            this.move_widget_down($(w), diff);
-        }, this));
-
-        this.set_dom_grid_height();
-
-        return this;
-    };
-
-
-    /**
-    * Move up widgets below cells represented by the arguments col, row, size_x,
-    * size_y.
-    *
-    * @method remove_empty_cells
-    * @param {Number} col The column where the group of cells begin.
-    * @param {Number} row The row where the group of cells begin.
-    * @param {Number} size_x The number of columns that the group of cells
-    * occupy.
-    * @param {Number} size_y The number of rows that the group of cells
-    * occupy.
-    * @param {HTMLElement} exclude Exclude widgets from being moved.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.remove_empty_cells = function(col, row, size_x, size_y, exclude) {
-        var $nexts = this.widgets_below({
-            col: col,
-            row: row,
-            size_x: size_x,
-            size_y: size_y
-        });
-
-        $nexts.not(exclude).each($.proxy(function(i, widget) {
-            this.move_widget_up( $(widget), size_y );
-        }, this));
-
-        this.set_dom_grid_height();
-
-        return this;
-    };
-
-
-    /**
-    * Get the most left column below to add a new widget.
-    *
-    * @method next_position
-    * @param {Number} size_x The n� of rows the widget occupies horizontally.
-    * @param {Number} size_y The n� of columns the widget occupies vertically.
-    * @return {Object} Returns a grid coords object representing the future
-    *  widget coords.
-    */
-    fn.next_position = function(size_x, size_y) {
-        size_x || (size_x = 1);
-        size_y || (size_y = 1);
-        var ga = this.gridmap;
-        var cols_l = ga.length;
-        var valid_pos = [];
-        var rows_l;
-
-        for (var c = 1; c < cols_l; c++) {
-            rows_l = ga[c].length;
-            for (var r = 1; r <= rows_l; r++) {
-                var can_move_to = this.can_move_to({
-                    size_x: size_x,
-                    size_y: size_y
-                }, c, r);
-
-                if (can_move_to) {
-                    valid_pos.push({
-                        col: c,
-                        row: r,
-                        size_y: size_y,
-                        size_x: size_x
-                    });
-                }
-            }
-        }
-
-        if (valid_pos.length) {
-            return Gridster.sort_by_row_and_col_asc(valid_pos)[0];
-        }
-        return false;
-    };
-
-
-    /**
-    * Remove a widget from the grid.
-    *
-    * @method remove_widget
-    * @param {HTMLElement} el The jQuery wrapped HTMLElement you want to remove.
-    * @param {Boolean|Function} silent If true, widgets below the removed one
-    * will not move up. If a Function is passed it will be used as callback.
-    * @param {Function} callback Function executed when the widget is removed.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.remove_widget = function(el, silent, callback) {
-        var $el = el instanceof $ ? el : $(el);
-        var wgd = $el.coords().grid;
-
-        // if silent is a function assume it's a callback
-        if ($.isFunction(silent)) {
-            callback = silent;
-            silent = false;
-        }
-
-        this.cells_occupied_by_placeholder = {};
-        this.$widgets = this.$widgets.not($el);
-
-        var $nexts = this.widgets_below($el);
-
-        this.remove_from_gridmap(wgd);
-
-        $el.fadeOut($.proxy(function() {
-            $el.remove();
-
-            if (!silent) {
-                $nexts.each($.proxy(function(i, widget) {
-                    this.move_widget_up( $(widget), wgd.size_y );
-                }, this));
-            }
-
-            this.set_dom_grid_height();
-
-            if (callback) {
-                callback.call(this, el);
-            }
-        }, this));
-
-        return this;
-    };
-
-
-    /**
-    * Remove all widgets from the grid.
-    *
-    * @method remove_all_widgets
-    * @param {Function} callback Function executed for each widget removed.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.remove_all_widgets = function(callback) {
-        this.$widgets.each($.proxy(function(i, el){
-              this.remove_widget(el, true, callback);
-        }, this));
-
-        return this;
-    };
-
-
-    /**
-    * Returns a serialized array of the widgets in the grid.
-    *
-    * @method serialize
-    * @param {HTMLElement} [$widgets] The collection of jQuery wrapped
-    *  HTMLElements you want to serialize. If no argument is passed all widgets
-    *  will be serialized.
-    * @return {Array} Returns an Array of Objects with the data specified in
-    *  the serialize_params option.
-    */
-    fn.serialize = function($widgets) {
-        $widgets || ($widgets = this.$widgets);
-
-        return $widgets.map($.proxy(function(i, widget) {
-            var $w = $(widget);
-            return this.options.serialize_params($w, $w.coords().grid);
-        }, this)).get();
-    };
-
-
-    /**
-    * Returns a serialized array of the widgets that have changed their
-    *  position.
-    *
-    * @method serialize_changed
-    * @return {Array} Returns an Array of Objects with the data specified in
-    *  the serialize_params option.
-    */
-    fn.serialize_changed = function() {
-        return this.serialize(this.$changed);
-    };
-
-
-    /**
-    * Convert widgets from DOM elements to "widget grid data" Objects.
-    *
-    * @method dom_to_coords
-    * @param {HTMLElement} $widget The widget to be converted.
-    */
-    fn.dom_to_coords = function($widget) {
-        return {
-            'col': parseInt($widget.attr('data-col'), 10),
-            'row': parseInt($widget.attr('data-row'), 10),
-            'size_x': parseInt($widget.attr('data-sizex'), 10) || 1,
-            'size_y': parseInt($widget.attr('data-sizey'), 10) || 1,
-            'max_size_x': parseInt($widget.attr('data-max-sizex'), 10) || false,
-            'max_size_y': parseInt($widget.attr('data-max-sizey'), 10) || false,
-            'min_size_x': parseInt($widget.attr('data-min-sizex'), 10) || false,
-            'min_size_y': parseInt($widget.attr('data-min-sizey'), 10) || false,
-            'el': $widget
-        };
-    };
-
-
-    /**
-    * Creates the grid coords object representing the widget an add it to the
-    * mapped array of positions.
-    *
-    * @method register_widget
-    * @param {HTMLElement|Object} $el jQuery wrapped HTMLElement representing
-    *  the widget, or an "widget grid data" Object with (col, row, el ...).
-    * @return {Boolean} Returns true if the widget final position is different
-    *  than the original.
-    */
-    fn.register_widget = function($el) {
-        var isDOM = $el instanceof jQuery;
-        var wgd = isDOM ? this.dom_to_coords($el) : $el;
-        var posChanged = false;
-        isDOM || ($el = wgd.el);
-
-        var empty_upper_row = this.can_go_widget_up(wgd);
-        if (empty_upper_row) {
-            wgd.row = empty_upper_row;
-            $el.attr('data-row', empty_upper_row);
-            this.$el.trigger('gridster:positionchanged', [wgd]);
-            posChanged = true;
-        }
-
-        if (this.options.avoid_overlapped_widgets &&
-            !this.can_move_to(
-             {size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row)
-        ) {
-            $.extend(wgd, this.next_position(wgd.size_x, wgd.size_y));
-            $el.attr({
-                'data-col': wgd.col,
-                'data-row': wgd.row,
-                'data-sizex': wgd.size_x,
-                'data-sizey': wgd.size_y
-            });
-            posChanged = true;
-        }
-
-        // attach Coord object to player data-coord attribute
-        $el.data('coords', $el.coords());
-        // Extend Coord object with grid position info
-        $el.data('coords').grid = wgd;
-
-        this.add_to_gridmap(wgd, $el);
-
-        this.options.resize.enabled && this.add_resize_handle($el);
-
-        return posChanged;
-    };
-
-
-    /**
-    * Update in the mapped array of positions the value of cells represented by
-    * the grid coords object passed in the `grid_data` param.
-    *
-    * @param {Object} grid_data The grid coords object representing the cells
-    *  to update in the mapped array.
-    * @param {HTMLElement|Boolean} value Pass `false` or the jQuery wrapped
-    *  HTMLElement, depends if you want to delete an existing position or add
-    *  a new one.
-    * @method update_widget_position
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.update_widget_position = function(grid_data, value) {
-        this.for_each_cell_occupied(grid_data, function(col, row) {
-            if (!this.gridmap[col]) { return this; }
-            this.gridmap[col][row] = value;
-        });
-        return this;
-    };
-
-
-    /**
-    * Remove a widget from the mapped array of positions.
-    *
-    * @method remove_from_gridmap
-    * @param {Object} grid_data The grid coords object representing the cells
-    *  to update in the mapped array.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.remove_from_gridmap = function(grid_data) {
-        return this.update_widget_position(grid_data, false);
-    };
-
-
-    /**
-    * Add a widget to the mapped array of positions.
-    *
-    * @method add_to_gridmap
-    * @param {Object} grid_data The grid coords object representing the cells
-    *  to update in the mapped array.
-    * @param {HTMLElement|Boolean} value The value to set in the specified
-    *  position .
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.add_to_gridmap = function(grid_data, value) {
-        this.update_widget_position(grid_data, value || grid_data.el);
-
-        if (grid_data.el) {
-            var $widgets = this.widgets_below(grid_data.el);
-            $widgets.each($.proxy(function(i, widget) {
-                this.move_widget_up( $(widget));
-            }, this));
-        }
-    };
-
-
-    /**
-    * Make widgets draggable.
-    *
-    * @uses Draggable
-    * @method draggable
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.draggable = function() {
-        var self = this;
-        var draggable_options = $.extend(true, {}, this.options.draggable, {
-            offset_left: this.options.widget_margins[0],
-            offset_top: this.options.widget_margins[1],
-            container_width: this.cols * this.min_widget_width,
-            limit: true,
-            start: function(event, ui) {
-                self.$widgets.filter('.player-revert')
-                    .removeClass('player-revert');
-
-                self.$player = $(this);
-                self.$helper = $(ui.$helper);
-
-                self.helper = !self.$helper.is(self.$player);
-
-                self.on_start_drag.call(self, event, ui);
-                self.$el.trigger('gridster:dragstart');
-            },
-            stop: function(event, ui) {
-                self.on_stop_drag.call(self, event, ui);
-                self.$el.trigger('gridster:dragstop');
-            },
-            drag: throttle(function(event, ui) {
-                self.on_drag.call(self, event, ui);
-                self.$el.trigger('gridster:drag');
-            }, 60)
-          });
-
-        this.drag_api = this.$el.drag(draggable_options);
-        return this;
-    };
-
-
-    /**
-    * Bind resize events to get resize working.
-    *
-    * @method resizable
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.resizable = function() {
-        this.resize_api = this.$el.drag({
-            items: '.' + this.options.resize.handle_class,
-            offset_left: this.options.widget_margins[0],
-            container_width: this.container_width,
-            move_element: false,
-            resize: true,
-            limit: this.options.autogrow_cols ? false : true,
-            start: $.proxy(this.on_start_resize, this),
-            stop: $.proxy(function(event, ui) {
-                delay($.proxy(function() {
-                    this.on_stop_resize(event, ui);
-                }, this), 120);
-            }, this),
-            drag: throttle($.proxy(this.on_resize, this), 60)
-        });
-
-        return this;
-    };
-
-
-    /**
-    * Setup things required for resizing. Like build templates for drag handles.
-    *
-    * @method setup_resize
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.setup_resize = function() {
-        this.resize_handle_class = this.options.resize.handle_class;
-        var axes = this.options.resize.axes;
-        var handle_tpl = '<span class="' + this.resize_handle_class + ' ' +
-            this.resize_handle_class + '-{type}" />';
-
-        this.resize_handle_tpl = $.map(axes, function(type) {
-            return handle_tpl.replace('{type}', type);
-        }).join('');
-
-        if ($.isArray(this.options.draggable.ignore_dragging)) {
-            this.options.draggable.ignore_dragging.push(
-                '.' + this.resize_handle_class);
-        }
-
-        return this;
-    };
-
-
-    /**
-    * This function is executed when the player begins to be dragged.
-    *
-    * @method on_start_drag
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_start_drag = function(event, ui) {
-        this.$helper.add(this.$player).add(this.$wrapper).addClass('dragging');
-
-        this.highest_col = this.get_highest_occupied_cell().col;
-
-        this.$player.addClass('player');
-        this.player_grid_data = this.$player.coords().grid;
-        this.placeholder_grid_data = $.extend({}, this.player_grid_data);
-
-        this.set_dom_grid_height(this.$el.height() +
-            (this.player_grid_data.size_y * this.min_widget_height));
-
-        this.set_dom_grid_width(this.cols);
-
-        var pgd_sizex = this.player_grid_data.size_x;
-        var cols_diff = this.cols - this.highest_col;
-
-        if (this.options.autogrow_cols && cols_diff <= pgd_sizex) {
-            this.add_faux_cols(Math.min(pgd_sizex - cols_diff, 1));
-        }
-
-        var colliders = this.faux_grid;
-        var coords = this.$player.data('coords').coords;
-
-        this.cells_occupied_by_player = this.get_cells_occupied(
-            this.player_grid_data);
-        this.cells_occupied_by_placeholder = this.get_cells_occupied(
-            this.placeholder_grid_data);
-
-        this.last_cols = [];
-        this.last_rows = [];
-
-        // see jquery.collision.js
-        this.collision_api = this.$helper.collision(
-            colliders, this.options.collision);
-
-        this.$preview_holder = $('<' + this.$player.get(0).tagName + ' />', {
-              'class': 'preview-holder',
-              'data-row': this.$player.attr('data-row'),
-              'data-col': this.$player.attr('data-col'),
-              css: {
-                  width: coords.width,
-                  height: coords.height
-              }
-        }).appendTo(this.$el);
-
-        if (this.options.draggable.start) {
-          this.options.draggable.start.call(this, event, ui);
-        }
-    };
-
-
-    /**
-    * This function is executed when the player is being dragged.
-    *
-    * @method on_drag
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_drag = function(event, ui) {
-        //break if dragstop has been fired
-        if (this.$player === null) {
-            return false;
-        }
-
-        var abs_offset = {
-            left: ui.position.left + this.baseX,
-            top: ui.position.top + this.baseY
-        };
-
-        // auto grow cols
-        if (this.options.autogrow_cols) {
-            var prcol = this.placeholder_grid_data.col +
-                this.placeholder_grid_data.size_x - 1;
-
-            // "- 1" due to adding at least 1 column in on_start_drag
-            if (prcol >= this.cols - 1 && this.options.max_cols >= this.cols + 1) {
-                this.add_faux_cols(1);
-                this.set_dom_grid_width(this.cols + 1);
-                this.drag_api.set_limits(this.container_width);
-            }
-
-            this.collision_api.set_colliders(this.faux_grid);
-        }
-
-        this.colliders_data = this.collision_api.get_closest_colliders(
-            abs_offset);
-
-        this.on_overlapped_column_change(
-            this.on_start_overlapping_column, this.on_stop_overlapping_column);
-
-        this.on_overlapped_row_change(
-            this.on_start_overlapping_row, this.on_stop_overlapping_row);
-
-
-        if (this.helper && this.$player) {
-            this.$player.css({
-                'left': ui.position.left,
-                'top': ui.position.top
-            });
-        }
-
-        if (this.options.draggable.drag) {
-            this.options.draggable.drag.call(this, event, ui);
-        }
-    };
-
-
-    /**
-    * This function is executed when the player stops being dragged.
-    *
-    * @method on_stop_drag
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_stop_drag = function(event, ui) {
-        this.$helper.add(this.$player).add(this.$wrapper)
-            .removeClass('dragging');
-
-        ui.position.left = ui.position.left + this.baseX;
-        ui.position.top = ui.position.top + this.baseY;
-        this.colliders_data = this.collision_api.get_closest_colliders(
-            ui.position);
-
-        this.on_overlapped_column_change(
-            this.on_start_overlapping_column,
-            this.on_stop_overlapping_column
-        );
-
-        this.on_overlapped_row_change(
-            this.on_start_overlapping_row,
-            this.on_stop_overlapping_row
-        );
-
-        this.$player.addClass('player-revert').removeClass('player')
-            .attr({
-                'data-col': this.placeholder_grid_data.col,
-                'data-row': this.placeholder_grid_data.row
-            }).css({
-                'left': '',
-                'top': ''
-            });
-
-        this.$changed = this.$changed.add(this.$player);
-
-        this.cells_occupied_by_player = this.get_cells_occupied(
-            this.placeholder_grid_data);
-        this.set_cells_player_occupies(
-            this.placeholder_grid_data.col, this.placeholder_grid_data.row);
-
-        this.$player.coords().grid.row = this.placeholder_grid_data.row;
-        this.$player.coords().grid.col = this.placeholder_grid_data.col;
-
-        if (this.options.draggable.stop) {
-          this.options.draggable.stop.call(this, event, ui);
-        }
-
-        this.$preview_holder.remove();
-
-        this.$player = null;
-        this.$helper = null;
-        this.placeholder_grid_data = {};
-        this.player_grid_data = {};
-        this.cells_occupied_by_placeholder = {};
-        this.cells_occupied_by_player = {};
-
-        this.set_dom_grid_height();
-        this.set_dom_grid_width();
-
-        if (this.options.autogrow_cols) {
-            this.drag_api.set_limits(this.cols * this.min_widget_width);
-        }
-    };
-
-
-    /**
-    * This function is executed every time a widget starts to be resized.
-    *
-    * @method on_start_resize
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_start_resize = function(event, ui) {
-        this.$resized_widget = ui.$player.closest('.gs-w');
-        this.resize_coords = this.$resized_widget.coords();
-        this.resize_wgd = this.resize_coords.grid;
-        this.resize_initial_width = this.resize_coords.coords.width;
-        this.resize_initial_height = this.resize_coords.coords.height;
-        this.resize_initial_sizex = this.resize_coords.grid.size_x;
-        this.resize_initial_sizey = this.resize_coords.grid.size_y;
-        this.resize_initial_col = this.resize_coords.grid.col;
-        this.resize_last_sizex = this.resize_initial_sizex;
-        this.resize_last_sizey = this.resize_initial_sizey;
-
-        this.resize_max_size_x = Math.min(this.resize_wgd.max_size_x ||
-            this.options.resize.max_size[0],
-            this.options.max_cols - this.resize_initial_col + 1);
-        this.resize_max_size_y = this.resize_wgd.max_size_y ||
-            this.options.resize.max_size[1];
-
-        this.resize_min_size_x = (this.resize_wgd.min_size_x ||
-            this.options.resize.min_size[0] || 1);
-        this.resize_min_size_y = (this.resize_wgd.min_size_y ||
-            this.options.resize.min_size[1] || 1);
-
-        this.resize_initial_last_col = this.get_highest_occupied_cell().col;
-
-        this.set_dom_grid_width(this.cols);
-
-        this.resize_dir = {
-            right: ui.$player.is('.' + this.resize_handle_class + '-x'),
-            bottom: ui.$player.is('.' + this.resize_handle_class + '-y')
-        };
-
-        this.$resized_widget.css({
-            'min-width': this.options.widget_base_dimensions[0],
-            'min-height': this.options.widget_base_dimensions[1]
-        });
-
-        var nodeName = this.$resized_widget.get(0).tagName;
-        this.$resize_preview_holder = $('<' + nodeName + ' />', {
-              'class': 'preview-holder resize-preview-holder',
-              'data-row': this.$resized_widget.attr('data-row'),
-              'data-col': this.$resized_widget.attr('data-col'),
-              'css': {
-                  'width': this.resize_initial_width,
-                  'height': this.resize_initial_height
-              }
-        }).appendTo(this.$el);
-
-        this.$resized_widget.addClass('resizing');
-
-		if (this.options.resize.start) {
-            this.options.resize.start.call(this, event, ui, this.$resized_widget);
-        }
-
-        this.$el.trigger('gridster:resizestart');
-    };
-
-
-    /**
-    * This function is executed every time a widget stops being resized.
-    *
-    * @method on_stop_resize
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_stop_resize = function(event, ui) {
-        this.$resized_widget
-            .removeClass('resizing')
-            .css({
-                'width': '',
-                'height': ''
-            });
-
-        delay($.proxy(function() {
-            this.$resize_preview_holder
-                .remove()
-                .css({
-                    'min-width': '',
-                    'min-height': ''
-                });
-
-            if (this.options.resize.stop) {
-                this.options.resize.stop.call(this, event, ui, this.$resized_widget);
-            }
-
-            this.$el.trigger('gridster:resizestop');
-        }, this), 300);
-
-        this.set_dom_grid_width();
-
-        if (this.options.autogrow_cols) {
-            this.drag_api.set_limits(this.cols * this.min_widget_width);
-        }
-    };
-
-
-    /**
-    * This function is executed when a widget is being resized.
-    *
-    * @method on_resize
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_resize = function(event, ui) {
-        var rel_x = (ui.pointer.diff_left);
-        var rel_y = (ui.pointer.diff_top);
-        var wbd_x = this.options.widget_base_dimensions[0];
-        var wbd_y = this.options.widget_base_dimensions[1];
-        var margin_x = this.options.widget_margins[0];
-        var margin_y = this.options.widget_margins[1];
-        var max_size_x = this.resize_max_size_x;
-        var min_size_x = this.resize_min_size_x;
-        var max_size_y = this.resize_max_size_y;
-        var min_size_y = this.resize_min_size_y;
-        var autogrow = this.options.autogrow_cols;
-        var width;
-        var max_width = Infinity;
-        var max_height = Infinity;
-
-        var inc_units_x = Math.ceil((rel_x / (wbd_x + margin_x * 2)) - 0.2);
-        var inc_units_y = Math.ceil((rel_y / (wbd_y + margin_y * 2)) - 0.2);
-
-        var size_x = Math.max(1, this.resize_initial_sizex + inc_units_x);
-        var size_y = Math.max(1, this.resize_initial_sizey + inc_units_y);
-
-        var max_cols = (this.container_width / this.min_widget_width) -
-            this.resize_initial_col + 1;
-        var limit_width = ((max_cols * this.min_widget_width) - margin_x * 2);
-
-        size_x = Math.max(Math.min(size_x, max_size_x), min_size_x);
-        size_x = Math.min(max_cols, size_x);
-        width = (max_size_x * wbd_x) + ((size_x - 1) * margin_x * 2);
-        max_width = Math.min(width, limit_width);
-        min_width = (min_size_x * wbd_x) + ((size_x - 1) * margin_x * 2);
-
-        size_y = Math.max(Math.min(size_y, max_size_y), min_size_y);
-        max_height = (max_size_y * wbd_y) + ((size_y - 1) * margin_y * 2);
-        min_height = (min_size_y * wbd_y) + ((size_y - 1) * margin_y * 2);
-
-        if (this.resize_dir.right) {
-            size_y = this.resize_initial_sizey;
-        } else if (this.resize_dir.bottom) {
-            size_x = this.resize_initial_sizex;
-        }
-
-        if (autogrow) {
-            var last_widget_col = this.resize_initial_col + size_x - 1;
-            if (autogrow && this.resize_initial_last_col <= last_widget_col) {
-                this.set_dom_grid_width(Math.max(last_widget_col + 1, this.cols));
-
-                if (this.cols < last_widget_col) {
-                    this.add_faux_cols(last_widget_col - this.cols);
-                }
-            }
-        }
-
-        var css_props = {};
-        !this.resize_dir.bottom && (css_props.width = Math.max(Math.min(
-            this.resize_initial_width + rel_x, max_width), min_width));
-        !this.resize_dir.right && (css_props.height = Math.max(Math.min(
-            this.resize_initial_height + rel_y, max_height), min_height));
-
-        this.$resized_widget.css(css_props);
-
-        if (size_x !== this.resize_last_sizex ||
-            size_y !== this.resize_last_sizey) {
-
-            this.resize_widget(this.$resized_widget, size_x, size_y);
-            this.set_dom_grid_width(this.cols);
-
-            this.$resize_preview_holder.css({
-                'width': '',
-                'height': ''
-            }).attr({
-                'data-row': this.$resized_widget.attr('data-row'),
-                'data-sizex': size_x,
-                'data-sizey': size_y
-            });
-        }
-
-        if (this.options.resize.resize) {
-            this.options.resize.resize.call(this, event, ui, this.$resized_widget);
-        }
-
-        this.$el.trigger('gridster:resize');
-
-        this.resize_last_sizex = size_x;
-        this.resize_last_sizey = size_y;
-    };
-
-
-    /**
-    * Executes the callbacks passed as arguments when a column begins to be
-    * overlapped or stops being overlapped.
-    *
-    * @param {Function} start_callback Function executed when a new column
-    *  begins to be overlapped. The column is passed as first argument.
-    * @param {Function} stop_callback Function executed when a column stops
-    *  being overlapped. The column is passed as first argument.
-    * @method on_overlapped_column_change
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.on_overlapped_column_change = function(start_callback, stop_callback) {
-        if (!this.colliders_data.length) {
-            return this;
-        }
-        var cols = this.get_targeted_columns(
-            this.colliders_data[0].el.data.col);
-
-        var last_n_cols = this.last_cols.length;
-        var n_cols = cols.length;
-        var i;
-
-        for (i = 0; i < n_cols; i++) {
-            if ($.inArray(cols[i], this.last_cols) === -1) {
-                (start_callback || $.noop).call(this, cols[i]);
-            }
-        }
-
-        for (i = 0; i< last_n_cols; i++) {
-            if ($.inArray(this.last_cols[i], cols) === -1) {
-                (stop_callback || $.noop).call(this, this.last_cols[i]);
-            }
-        }
-
-        this.last_cols = cols;
-
-        return this;
-    };
-
-
-    /**
-    * Executes the callbacks passed as arguments when a row starts to be
-    * overlapped or stops being overlapped.
-    *
-    * @param {Function} start_callback Function executed when a new row begins
-    *  to be overlapped. The row is passed as first argument.
-    * @param {Function} end_callback Function executed when a row stops being
-    *  overlapped. The row is passed as first argument.
-    * @method on_overlapped_row_change
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.on_overlapped_row_change = function(start_callback, end_callback) {
-        if (!this.colliders_data.length) {
-            return this;
-        }
-        var rows = this.get_targeted_rows(this.colliders_data[0].el.data.row);
-        var last_n_rows = this.last_rows.length;
-        var n_rows = rows.length;
-        var i;
-
-        for (i = 0; i < n_rows; i++) {
-            if ($.inArray(rows[i], this.last_rows) === -1) {
-                (start_callback || $.noop).call(this, rows[i]);
-            }
-        }
-
-        for (i = 0; i < last_n_rows; i++) {
-            if ($.inArray(this.last_rows[i], rows) === -1) {
-                (end_callback || $.noop).call(this, this.last_rows[i]);
-            }
-        }
-
-        this.last_rows = rows;
-    };
-
-
-    /**
-    * Sets the current position of the player
-    *
-    * @param {Number} col
-    * @param {Number} row
-    * @param {Boolean} no_player
-    * @method set_player
-    * @return {object}
-    */
-    fn.set_player = function(col, row, no_player) {
-        var self = this;
-        if (!no_player) {
-            this.empty_cells_player_occupies();
-        }
-        var cell = !no_player ? self.colliders_data[0].el.data : {col: col};
-        var to_col = cell.col;
-        var to_row = row || cell.row;
-
-        this.player_grid_data = {
-            col: to_col,
-            row: to_row,
-            size_y : this.player_grid_data.size_y,
-            size_x : this.player_grid_data.size_x
-        };
-
-        this.cells_occupied_by_player = this.get_cells_occupied(
-            this.player_grid_data);
-
-        var $overlapped_widgets = this.get_widgets_overlapped(
-            this.player_grid_data);
-
-        var constraints = this.widgets_constraints($overlapped_widgets);
-
-        this.manage_movements(constraints.can_go_up, to_col, to_row);
-        this.manage_movements(constraints.can_not_go_up, to_col, to_row);
-
-        /* if there is not widgets overlapping in the new player position,
-         * update the new placeholder position. */
-        if (!$overlapped_widgets.length) {
-            var pp = this.can_go_player_up(this.player_grid_data);
-            if (pp !== false) {
-                to_row = pp;
-            }
-            this.set_placeholder(to_col, to_row);
-        }
-
-        return {
-            col: to_col,
-            row: to_row
-        };
-    };
-
-
-    /**
-    * See which of the widgets in the $widgets param collection can go to
-    * a upper row and which not.
-    *
-    * @method widgets_contraints
-    * @param {jQuery} $widgets A jQuery wrapped collection of
-    * HTMLElements.
-    * @return {object} Returns a literal Object with two keys: `can_go_up` &
-    * `can_not_go_up`. Each contains a set of HTMLElements.
-    */
-    fn.widgets_constraints = function($widgets) {
-        var $widgets_can_go_up = $([]);
-        var $widgets_can_not_go_up;
-        var wgd_can_go_up = [];
-        var wgd_can_not_go_up = [];
-
-        $widgets.each($.proxy(function(i, w) {
-            var $w = $(w);
-            var wgd = $w.coords().grid;
-            if (this.can_go_widget_up(wgd)) {
-                $widgets_can_go_up = $widgets_can_go_up.add($w);
-                wgd_can_go_up.push(wgd);
-            } else {
-                wgd_can_not_go_up.push(wgd);
-            }
-        }, this));
-
-        $widgets_can_not_go_up = $widgets.not($widgets_can_go_up);
-
-        return {
-            can_go_up: Gridster.sort_by_row_asc(wgd_can_go_up),
-            can_not_go_up: Gridster.sort_by_row_desc(wgd_can_not_go_up)
-        };
-    };
-
-
-    /**
-    * Sorts an Array of grid coords objects (representing the grid coords of
-    * each widget) in descending way.
-    *
-    * @method manage_movements
-    * @param {jQuery} $widgets A jQuery collection of HTMLElements
-    *  representing the widgets you want to move.
-    * @param {Number} to_col The column to which we want to move the widgets.
-    * @param {Number} to_row The row to which we want to move the widgets.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.manage_movements = function($widgets, to_col, to_row) {
-        $.each($widgets, $.proxy(function(i, w) {
-            var wgd = w;
-            var $w = wgd.el;
-
-            var can_go_widget_up = this.can_go_widget_up(wgd);
-
-            if (can_go_widget_up) {
-                //target CAN go up
-                //so move widget up
-                this.move_widget_to($w, can_go_widget_up);
-                this.set_placeholder(to_col, can_go_widget_up + wgd.size_y);
-
-            } else {
-                //target can't go up
-                var can_go_player_up = this.can_go_player_up(
-                    this.player_grid_data);
-
-                if (!can_go_player_up) {
-                    // target can't go up
-                    // player cant't go up
-                    // so we need to move widget down to a position that dont
-                    // overlaps player
-                    var y = (to_row + this.player_grid_data.size_y) - wgd.row;
-
-                    this.move_widget_down($w, y);
-                    this.set_placeholder(to_col, to_row);
-                }
-            }
-        }, this));
-
-        return this;
-    };
-
-    /**
-    * Determines if there is a widget in the row and col given. Or if the
-    * HTMLElement passed as first argument is the player.
-    *
-    * @method is_player
-    * @param {Number|HTMLElement} col_or_el A jQuery wrapped collection of
-    * HTMLElements.
-    * @param {Number} [row] The column to which we want to move the widgets.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_player = function(col_or_el, row) {
-        if (row && !this.gridmap[col_or_el]) { return false; }
-        var $w = row ? this.gridmap[col_or_el][row] : col_or_el;
-        return $w && ($w.is(this.$player) || $w.is(this.$helper));
-    };
-
-
-    /**
-    * Determines if the widget that is being dragged is currently over the row
-    * and col given.
-    *
-    * @method is_player_in
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_player_in = function(col, row) {
-        var c = this.cells_occupied_by_player || {};
-        return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0;
-    };
-
-
-    /**
-    * Determines if the placeholder is currently over the row and col given.
-    *
-    * @method is_placeholder_in
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_placeholder_in = function(col, row) {
-        var c = this.cells_occupied_by_placeholder || {};
-        return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0;
-    };
-
-
-    /**
-    * Determines if the placeholder is currently over the column given.
-    *
-    * @method is_placeholder_in_col
-    * @param {Number} col The column to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_placeholder_in_col = function(col) {
-        var c = this.cells_occupied_by_placeholder || [];
-        return $.inArray(col, c.cols) >= 0;
-    };
-
-
-    /**
-    * Determines if the cell represented by col and row params is empty.
-    *
-    * @method is_empty
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_empty = function(col, row) {
-        if (typeof this.gridmap[col] !== 'undefined') {
-			if(typeof this.gridmap[col][row] !== 'undefined' &&
-				 this.gridmap[col][row] === false
-			) {
-				return true;
-			}
-			return false;
-		}
-		return true;
-    };
-
-
-    /**
-    * Determines if the cell represented by col and row params is occupied.
-    *
-    * @method is_occupied
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_occupied = function(col, row) {
-        if (!this.gridmap[col]) {
-            return false;
-        }
-
-        if (this.gridmap[col][row]) {
-            return true;
-        }
-        return false;
-    };
-
-
-    /**
-    * Determines if there is a widget in the cell represented by col/row params.
-    *
-    * @method is_widget
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean|HTMLElement} Returns false if there is no widget,
-    * else returns the jQuery HTMLElement
-    */
-    fn.is_widget = function(col, row) {
-        var cell = this.gridmap[col];
-        if (!cell) {
-            return false;
-        }
-
-        cell = cell[row];
-
-        if (cell) {
-            return cell;
-        }
-
-        return false;
-    };
-
-
-    /**
-    * Determines if there is a widget in the cell represented by col/row
-    * params and if this is under the widget that is being dragged.
-    *
-    * @method is_widget_under_player
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_widget_under_player = function(col, row) {
-        if (this.is_widget(col, row)) {
-            return this.is_player_in(col, row);
-        }
-        return false;
-    };
-
-
-    /**
-    * Get widgets overlapping with the player or with the object passed
-    * representing the grid cells.
-    *
-    * @method get_widgets_under_player
-    * @return {HTMLElement} Returns a jQuery collection of HTMLElements
-    */
-    fn.get_widgets_under_player = function(cells) {
-        cells || (cells = this.cells_occupied_by_player || {cols: [], rows: []});
-        var $widgets = $([]);
-
-        $.each(cells.cols, $.proxy(function(i, col) {
-            $.each(cells.rows, $.proxy(function(i, row) {
-                if(this.is_widget(col, row)) {
-                    $widgets = $widgets.add(this.gridmap[col][row]);
-                }
-            }, this));
-        }, this));
-
-        return $widgets;
-    };
-
-
-    /**
-    * Put placeholder at the row and column specified.
-    *
-    * @method set_placeholder
-    * @param {Number} col The column to which we want to move the
-    *  placeholder.
-    * @param {Number} row The row to which we want to move the
-    *  placeholder.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.set_placeholder = function(col, row) {
-        var phgd = $.extend({}, this.placeholder_grid_data);
-        var $nexts = this.widgets_below({
-                col: phgd.col,
-                row: phgd.row,
-                size_y: phgd.size_y,
-                size_x: phgd.size_x
-            });
-
-        // Prevents widgets go out of the grid
-        var right_col = (col + phgd.size_x - 1);
-        if (right_col > this.cols) {
-            col = col - (right_col - col);
-        }
-
-        var moved_down = this.placeholder_grid_data.row < row;
-        var changed_column = this.placeholder_grid_data.col !== col;
-
-        this.placeholder_grid_data.col = col;
-        this.placeholder_gri

<TRUNCATED>

[2/8] chukwa git commit: CHUKWA-806. Replace gridster with gridstack. (Eric Yang)

Posted by ey...@apache.org.
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/js/jquery.gridster.with-extras.min.js
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/js/jquery.gridster.with-extras.min.js b/src/main/web/hicc/home/js/jquery.gridster.with-extras.min.js
deleted file mode 100755
index 1ebb2b2..0000000
--- a/src/main/web/hicc/home/js/jquery.gridster.with-extras.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! gridster.js - v0.5.6 - 2014-09-25 - * http://gridster.net/ - Copyright (c) 2014 ducksboard; Licensed MIT */ (function(t,i){"function"==typeof define&&define.amd?define("gridster-coords",["jquery"],i):t.GridsterCoords=i(t.$||t.jQuery)})(this,function(t){function i(i){return i[0]&&t.isPlainObject(i[0])?this.data=i[0]:this.el=i,this.isCoords=!0,this.coords={},this.init(),this}var e=i.prototype;return e.init=function(){this.set(),this.original_coords=this.get()},e.set=function(t,i){var e=this.el;if(e&&!t&&(this.data=e.offset(),this.data.width=e.width(),this.data.height=e.height()),e&&t&&!i){var s=e.offset();this.data.top=s.top,this.data.left=s.left}var r=this.data;return r.left===void 0&&(r.left=r.x1),r.top===void 0&&(r.top=r.y1),this.coords.x1=r.left,this.coords.y1=r.top,this.coords.x2=r.left+r.width,this.coords.y2=r.top+r.height,this.coords.cx=r.left+r.width/2,this.coords.cy=r.top+r.height/2,this.coords.width=r.width,this.coords.height=r.height,this.coords.el=e||!1,this},e.update=
 function(i){if(!i&&!this.el)return this;if(i){var e=t.extend({},this.data,i);return this.data=e,this.set(!0,!0)}return this.set(!0),this},e.get=function(){return this.coords},e.destroy=function(){this.el.removeData("coords"),delete this.el},t.fn.coords=function(){if(this.data("coords"))return this.data("coords");var t=new i(this,arguments[0]);return this.data("coords",t),t},i}),function(t,i){"function"==typeof define&&define.amd?define("gridster-collision",["jquery","gridster-coords"],i):t.GridsterCollision=i(t.$||t.jQuery,t.GridsterCoords)}(this,function(t){function i(i,s,r){this.options=t.extend(e,r),this.$element=i,this.last_colliders=[],this.last_colliders_coords=[],this.set_colliders(s),this.init()}var e={colliders_context:document.body,overlapping_region:"C"};i.defaults=e;var s=i.prototype;return s.init=function(){this.find_collisions()},s.overlaps=function(t,i){var e=!1,s=!1;return(i.x1>=t.x1&&i.x1<=t.x2||i.x2>=t.x1&&i.x2<=t.x2||t.x1>=i.x1&&t.x2<=i.x2)&&(e=!0),(i.y1>=t.y1&&i.
 y1<=t.y2||i.y2>=t.y1&&i.y2<=t.y2||t.y1>=i.y1&&t.y2<=i.y2)&&(s=!0),e&&s},s.detect_overlapping_region=function(t,i){var e="",s="";return t.y1>i.cy&&t.y1<i.y2&&(e="N"),t.y2>i.y1&&t.y2<i.cy&&(e="S"),t.x1>i.cx&&t.x1<i.x2&&(s="W"),t.x2>i.x1&&t.x2<i.cx&&(s="E"),e+s||"C"},s.calculate_overlapped_area_coords=function(i,e){var s=Math.max(i.x1,e.x1),r=Math.max(i.y1,e.y1),o=Math.min(i.x2,e.x2),a=Math.min(i.y2,e.y2);return t({left:s,top:r,width:o-s,height:a-r}).coords().get()},s.calculate_overlapped_area=function(t){return t.width*t.height},s.manage_colliders_start_stop=function(i,e,s){for(var r=this.last_colliders_coords,o=0,a=r.length;a>o;o++)-1===t.inArray(r[o],i)&&e.call(this,r[o]);for(var n=0,h=i.length;h>n;n++)-1===t.inArray(i[n],r)&&s.call(this,i[n])},s.find_collisions=function(i){for(var e=this,s=this.options.overlapping_region,r=[],o=[],a=this.colliders||this.$colliders,n=a.length,h=e.$element.coords().update(i||!1).get();n--;){var _=e.$colliders?t(a[n]):a[n],d=_.isCoords?_:_.coords(),l=
 d.get(),c=e.overlaps(h,l);if(c){var p=e.detect_overlapping_region(h,l);if(p===s||"all"===s){var g=e.calculate_overlapped_area_coords(h,l),u=e.calculate_overlapped_area(g),f={area:u,area_coords:g,region:p,coords:l,player_coords:h,el:_};e.options.on_overlap&&e.options.on_overlap.call(this,f),r.push(d),o.push(f)}}}return(e.options.on_overlap_stop||e.options.on_overlap_start)&&this.manage_colliders_start_stop(r,e.options.on_overlap_start,e.options.on_overlap_stop),this.last_colliders_coords=r,o},s.get_closest_colliders=function(t){var i=this.find_collisions(t);return i.sort(function(t,i){return"C"===t.region&&"C"===i.region?t.coords.y1<i.coords.y1||t.coords.x1<i.coords.x1?-1:1:t.area<i.area?1:1}),i},s.set_colliders=function(i){"string"==typeof i||i instanceof t?this.$colliders=t(i,this.options.colliders_context).not(this.$element):this.colliders=t(i)},t.fn.collision=function(t,e){return new i(this,t,e)},i}),function(t){t.delay=function(t,i){var e=Array.prototype.slice.call(arguments,2);
 return setTimeout(function(){return t.apply(null,e)},i)},t.debounce=function(t,i,e){var s;return function(){var r=this,o=arguments,a=function(){s=null,e||t.apply(r,o)};e&&!s&&t.apply(r,o),clearTimeout(s),s=setTimeout(a,i)}},t.throttle=function(t,i){var e,s,r,o,a,n,h=debounce(function(){a=o=!1},i);return function(){e=this,s=arguments;var _=function(){r=null,a&&t.apply(e,s),h()};return r||(r=setTimeout(_,i)),o?a=!0:n=t.apply(e,s),h(),o=!0,n}}}(window),function(t,i){"function"==typeof define&&define.amd?define("gridster-draggable",["jquery"],i):t.GridsterDraggable=i(t.$||t.jQuery)}(this,function(t){function i(i,s){this.options=t.extend({},e,s),this.$document=t(document),this.$container=t(i),this.$dragitems=t(this.options.items,this.$container),this.is_dragging=!1,this.player_min_left=0+this.options.offset_left,this.id=h(),this.ns=".gridster-draggable-"+this.id,this.init()}var e={items:"li",distance:1,limit:!0,offset_left:0,autoscroll:!0,ignore_dragging:["INPUT","TEXTAREA","SELECT","BUT
 TON"],handle:null,container_width:0,move_element:!0,helper:!1,remove_helper:!0},s=t(window),r={x:"left",y:"top"},o=!!("ontouchstart"in window),a=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},n=0,h=function(){return++n+""};i.defaults=e;var _=i.prototype;return _.init=function(){var i=this.$container.css("position");this.calculate_dimensions(),this.$container.css("position","static"===i?"relative":i),this.disabled=!1,this.events(),t(window).bind(this.nsEvent("resize"),throttle(t.proxy(this.calculate_dimensions,this),200))},_.nsEvent=function(t){return(t||"")+this.ns},_.events=function(){this.pointer_events={start:this.nsEvent("touchstart")+" "+this.nsEvent("mousedown"),move:this.nsEvent("touchmove")+" "+this.nsEvent("mousemove"),end:this.nsEvent("touchend")+" "+this.nsEvent("mouseup")},this.$container.on(this.nsEvent("selectstart"),t.proxy(this.on_select_start,this)),this.$container.on(this.pointer_events.start,this.options.items,t.proxy(this.drag_handler,this)),this.$docum
 ent.on(this.pointer_events.end,t.proxy(function(t){this.is_dragging=!1,this.disabled||(this.$document.off(this.pointer_events.move),this.drag_start&&this.on_dragstop(t))},this))},_.get_actual_pos=function(t){var i=t.position();return i},_.get_mouse_pos=function(t){if(t.originalEvent&&t.originalEvent.touches){var i=t.originalEvent;t=i.touches.length?i.touches[0]:i.changedTouches[0]}return{left:t.clientX,top:t.clientY}},_.get_offset=function(i){i.preventDefault();var e=this.get_mouse_pos(i),s=Math.round(e.left-this.mouse_init_pos.left),r=Math.round(e.top-this.mouse_init_pos.top),o=Math.round(this.el_init_offset.left+s-this.baseX+t(window).scrollLeft()-this.win_offset_x),a=Math.round(this.el_init_offset.top+r-this.baseY+t(window).scrollTop()-this.win_offset_y);return this.options.limit&&(o>this.player_max_left?o=this.player_max_left:this.player_min_left>o&&(o=this.player_min_left)),{position:{left:o,top:a},pointer:{left:e.left,top:e.top,diff_left:s+(t(window).scrollLeft()-this.win_offs
 et_x),diff_top:r+(t(window).scrollTop()-this.win_offset_y)}}},_.get_drag_data=function(t){var i=this.get_offset(t);return i.$player=this.$player,i.$helper=this.helper?this.$helper:this.$player,i},_.set_limits=function(t){return t||(t=this.$container.width()),this.player_max_left=t-this.player_width+-this.options.offset_left,this.options.container_width=t,this},_.scroll_in=function(i,e){var o,n=r[i],h=50,_=30,d="x"===i,l=d?this.window_width:this.window_height,c=d?t(document).width():t(document).height(),p=d?this.$player.width():this.$player.height(),g=s["scroll"+a(n)](),u=g,f=u+l,w=f-h,m=u+h,y=u+e.pointer[n],v=c-l+p;return y>=w&&(o=g+_,v>o&&(s["scroll"+a(n)](o),this["scroll_offset_"+i]+=_)),m>=y&&(o=g-_,o>0&&(s["scroll"+a(n)](o),this["scroll_offset_"+i]-=_)),this},_.manage_scroll=function(t){this.scroll_in("x",t),this.scroll_in("y",t)},_.calculate_dimensions=function(){this.window_height=s.height(),this.window_width=s.width()},_.drag_handler=function(i){if(i.target.nodeName,!this.dis
 abled&&(1===i.which||o)&&!this.ignore_drag(i)){var e=this,s=!0;return this.$player=t(i.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(i),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,this.$document.on(this.pointer_events.move,function(t){var i=e.get_mouse_pos(t),r=Math.abs(i.left-e.mouse_init_pos.left),o=Math.abs(i.top-e.mouse_init_pos.top);return r>e.options.distance||o>e.options.distance?s?(s=!1,e.on_dragstart.call(e,t),!1):(e.is_dragging===!0&&e.on_dragmove.call(e,t),!1):!1}),o?void 0:!1}},_.on_dragstart=function(i){if(i.preventDefault(),this.is_dragging)return this;this.drag_start=this.is_dragging=!0;var e=this.$container.offset();return this.baseX=Math.round(e.left),this.baseY=Math.round(e.top),this.initial_container_width=this.options.container_width||this.$container.width(),"clone"===this.options.helper?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.help
 er=!1,this.win_offset_y=t(window).scrollTop(),this.win_offset_x=t(window).scrollLeft(),this.scroll_offset_y=0,this.scroll_offset_x=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.set_limits(this.options.container_width),this.options.start&&this.options.start.call(this.$player,i,this.get_drag_data(i)),!1},_.on_dragmove=function(t){var i=this.get_drag_data(t);this.options.autoscroll&&this.manage_scroll(i),this.options.move_element&&(this.helper?this.$helper:this.$player).css({position:"absolute",left:i.position.left,top:i.position.top});var e=this.last_position||i.position;return i.prev_position=e,this.options.drag&&this.options.drag.call(this.$player,t,i),this.last_position=i.position,!1},_.on_dragstop=function(t){var i=this.get_drag_data(t);return this.drag_start=!1,this.options.stop&&this.options.stop.call(this.$player,t,i),this.helper&&this.options.remove_helper&&this.$helper.remove(),!1},_.on_select_
 start=function(t){return this.disabled||this.ignore_drag(t)?void 0:!1},_.enable=function(){this.disabled=!1},_.disable=function(){this.disabled=!0},_.destroy=function(){this.disable(),this.$container.off(this.ns),this.$document.off(this.ns),t(window).off(this.ns),t.removeData(this.$container,"drag")},_.ignore_drag=function(i){return this.options.handle?!t(i.target).is(this.options.handle):t.isFunction(this.options.ignore_dragging)?this.options.ignore_dragging(i):t(i.target).is(this.options.ignore_dragging.join(", "))},t.fn.drag=function(t){return new i(this,t)},i}),function(t,i){"function"==typeof define&&define.amd?define(["jquery","gridster-draggable","gridster-collision"],i):t.Gridster=i(t.$||t.jQuery,t.GridsterDraggable,t.GridsterCollision)}(this,function(t,i){function e(i,e){this.options=t.extend(!0,{},s,e),this.$el=t(i),this.$wrapper=this.$el.parent(),this.$widgets=this.$el.children(this.options.widget_selector).addClass("gs-w"),this.widgets=[],this.$changed=t([]),this.wrapper
 _width=this.$wrapper.width(),this.min_widget_width=2*this.options.widget_margins[0]+this.options.widget_base_dimensions[0],this.min_widget_height=2*this.options.widget_margins[1]+this.options.widget_base_dimensions[1],this.generated_stylesheets=[],this.$style_tags=t([]),this.options.auto_init&&this.init()}var s={namespace:"",widget_selector:"li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,max_cols:1/0,min_rows:15,max_size_x:!1,autogrow_cols:!1,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,auto_init:!0,serialize_params:function(t,i){return{col:i.col,row:i.row,size_x:i.size_x,size_y:i.size_y}},collision:{},draggable:{items:".gs-w",distance:4,ignore_dragging:i.defaults.ignore_dragging.slice(0)},resize:{enabled:!1,axes:["both"],handle_append_to:"",handle_class:"gs-resize-handle",max_size:[1/0,1/0],min_size:[1,1]}};e.defaults=s,e.generated_stylesheets=[],e.sort_by_row_asc=function(i){return i=i.sort(function(i,e){return i.row||(i=
 t(i).coords().grid,e=t(e).coords().grid),i.row>e.row?1:-1})},e.sort_by_row_and_col_asc=function(t){return t=t.sort(function(t,i){return t.row>i.row||t.row===i.row&&t.col>i.col?1:-1})},e.sort_by_col_asc=function(t){return t=t.sort(function(t,i){return t.col>i.col?1:-1})},e.sort_by_row_desc=function(t){return t=t.sort(function(t,i){return t.row+t.size_y<i.row+i.size_y?1:-1})};var r=e.prototype;return r.init=function(){this.options.resize.enabled&&this.setup_resize(),this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.set_dom_grid_width(),this.$wrapper.addClass("ready"),this.draggable(),this.options.resize.enabled&&this.resizable(),t(window).bind("resize.gridster",throttle(t.proxy(this.recalculate_faux_grid,this),200))},r.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},r.enable=function(){return this.drag_api.enable(),this},r.disable_resize=function(){return this.$el.ad
 dClass("gs-resize-disabled"),this.resize_api.disable(),this},r.enable_resize=function(){return this.$el.removeClass("gs-resize-disabled"),this.resize_api.enable(),this},r.add_widget=function(i,e,s,r,o,a,n){var h;e||(e=1),s||(s=1),!r&!o?h=this.next_position(e,s):(h={col:r,row:o,size_x:e,size_y:s},this.empty_cells(r,o,e,s));var _=t(i).attr({"data-col":h.col,"data-row":h.row,"data-sizex":e,"data-sizey":s}).addClass("gs-w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(_),this.register_widget(_),this.add_faux_rows(h.size_y),a&&this.set_widget_max_size(_,a),n&&this.set_widget_min_size(_,n),this.set_dom_grid_width(),this.set_dom_grid_height(),this.drag_api.set_limits(this.cols*this.min_widget_width),_.fadeIn()},r.set_widget_min_size=function(t,i){if(t="number"==typeof t?this.$widgets.eq(t):t,!t.length)return this;var e=t.data("coords").grid;return e.min_size_x=i[0],e.min_size_y=i[1],this},r.set_widget_max_size=function(t,i){if(t="number"==typeof t?this.$widgets.eq(t):t,
 !t.length)return this;var e=t.data("coords").grid;return e.max_size_x=i[0],e.max_size_y=i[1],this},r.add_resize_handle=function(i){var e=this.options.resize.handle_append_to;return t(this.resize_handle_tpl).appendTo(e?t(e,i):i),this},r.resize_widget=function(t,i,e,s){var r=t.coords().grid,o=r.col,a=this.options.max_cols,n=r.size_y,h=r.col,_=h;i||(i=r.size_x),e||(e=r.size_y),1/0!==a&&(i=Math.min(i,a-o+1)),e>n&&this.add_faux_rows(Math.max(e-n,0));var d=o+i-1;d>this.cols&&this.add_faux_cols(d-this.cols);var l={col:_,row:r.row,size_x:i,size_y:e};return this.mutate_widget_in_gridmap(t,r,l),this.set_dom_grid_height(),this.set_dom_grid_width(),s&&s.call(this,l.size_x,l.size_y),t},r.mutate_widget_in_gridmap=function(i,e,s){e.size_x;var r=e.size_y,o=this.get_cells_occupied(e),a=this.get_cells_occupied(s),n=[];t.each(o.cols,function(i,e){-1===t.inArray(e,a.cols)&&n.push(e)});var h=[];t.each(a.cols,function(i,e){-1===t.inArray(e,o.cols)&&h.push(e)});var _=[];t.each(o.rows,function(i,e){-1===t.
 inArray(e,a.rows)&&_.push(e)});var d=[];if(t.each(a.rows,function(i,e){-1===t.inArray(e,o.rows)&&d.push(e)}),this.remove_from_gridmap(e),h.length){var l=[s.col,s.row,s.size_x,Math.min(r,s.size_y),i];this.empty_cells.apply(this,l)}if(d.length){var c=[s.col,s.row,s.size_x,s.size_y,i];this.empty_cells.apply(this,c)}if(e.col=s.col,e.row=s.row,e.size_x=s.size_x,e.size_y=s.size_y,this.add_to_gridmap(s,i),i.removeClass("player-revert"),i.data("coords").update({width:s.size_x*this.options.widget_base_dimensions[0]+2*(s.size_x-1)*this.options.widget_margins[0],height:s.size_y*this.options.widget_base_dimensions[1]+2*(s.size_y-1)*this.options.widget_margins[1]}),i.attr({"data-col":s.col,"data-row":s.row,"data-sizex":s.size_x,"data-sizey":s.size_y}),n.length){var p=[n[0],s.row,n.length,Math.min(r,s.size_y),i];this.remove_empty_cells.apply(this,p)}if(_.length){var g=[s.col,s.row,s.size_x,s.size_y,i];this.remove_empty_cells.apply(this,g)}return this.move_widget_up(i),this},r.empty_cells=function
 (i,e,s,r,o){var a=this.widgets_below({col:i,row:e-r,size_x:s,size_y:r});return a.not(o).each(t.proxy(function(i,s){var o=t(s).coords().grid;if(e+r-1>=o.row){var a=e+r-o.row;this.move_widget_down(t(s),a)}},this)),this.set_dom_grid_height(),this},r.remove_empty_cells=function(i,e,s,r,o){var a=this.widgets_below({col:i,row:e,size_x:s,size_y:r});return a.not(o).each(t.proxy(function(i,e){this.move_widget_up(t(e),r)},this)),this.set_dom_grid_height(),this},r.next_position=function(t,i){t||(t=1),i||(i=1);for(var s,r=this.gridmap,o=r.length,a=[],n=1;o>n;n++){s=r[n].length;for(var h=1;s>=h;h++){var _=this.can_move_to({size_x:t,size_y:i},n,h);_&&a.push({col:n,row:h,size_y:i,size_x:t})}}return a.length?e.sort_by_row_and_col_asc(a)[0]:!1},r.remove_widget=function(i,e,s){var r=i instanceof t?i:t(i),o=r.coords().grid;t.isFunction(e)&&(s=e,e=!1),this.cells_occupied_by_placeholder={},this.$widgets=this.$widgets.not(r);var a=this.widgets_below(r);return this.remove_from_gridmap(o),r.fadeOut(t.proxy
 (function(){r.remove(),e||a.each(t.proxy(function(i,e){this.move_widget_up(t(e),o.size_y)},this)),this.set_dom_grid_height(),s&&s.call(this,i)},this)),this},r.remove_all_widgets=function(i){return this.$widgets.each(t.proxy(function(t,e){this.remove_widget(e,!0,i)},this)),this},r.serialize=function(i){return i||(i=this.$widgets),i.map(t.proxy(function(i,e){var s=t(e);return this.options.serialize_params(s,s.coords().grid)},this)).get()},r.serialize_changed=function(){return this.serialize(this.$changed)},r.dom_to_coords=function(t){return{col:parseInt(t.attr("data-col"),10),row:parseInt(t.attr("data-row"),10),size_x:parseInt(t.attr("data-sizex"),10)||1,size_y:parseInt(t.attr("data-sizey"),10)||1,max_size_x:parseInt(t.attr("data-max-sizex"),10)||!1,max_size_y:parseInt(t.attr("data-max-sizey"),10)||!1,min_size_x:parseInt(t.attr("data-min-sizex"),10)||!1,min_size_y:parseInt(t.attr("data-min-sizey"),10)||!1,el:t}},r.register_widget=function(i){var e=i instanceof jQuery,s=e?this.dom_to_c
 oords(i):i,r=!1;e||(i=s.el);var o=this.can_go_widget_up(s);return o&&(s.row=o,i.attr("data-row",o),this.$el.trigger("gridster:positionchanged",[s]),r=!0),this.options.avoid_overlapped_widgets&&!this.can_move_to({size_x:s.size_x,size_y:s.size_y},s.col,s.row)&&(t.extend(s,this.next_position(s.size_x,s.size_y)),i.attr({"data-col":s.col,"data-row":s.row,"data-sizex":s.size_x,"data-sizey":s.size_y}),r=!0),i.data("coords",i.coords()),i.data("coords").grid=s,this.add_to_gridmap(s,i),this.options.resize.enabled&&this.add_resize_handle(i),r},r.update_widget_position=function(t,i){return this.for_each_cell_occupied(t,function(t,e){return this.gridmap[t]?(this.gridmap[t][e]=i,void 0):this}),this},r.remove_from_gridmap=function(t){return this.update_widget_position(t,!1)},r.add_to_gridmap=function(i,e){if(this.update_widget_position(i,e||i.el),i.el){var s=this.widgets_below(i.el);s.each(t.proxy(function(i,e){this.move_widget_up(t(e))},this))}},r.draggable=function(){var i=this,e=t.extend(!0,{},
 this.options.draggable,{offset_left:this.options.widget_margins[0],offset_top:this.options.widget_margins[1],container_width:this.cols*this.min_widget_width,limit:!0,start:function(e,s){i.$widgets.filter(".player-revert").removeClass("player-revert"),i.$player=t(this),i.$helper=t(s.$helper),i.helper=!i.$helper.is(i.$player),i.on_start_drag.call(i,e,s),i.$el.trigger("gridster:dragstart")},stop:function(t,e){i.on_stop_drag.call(i,t,e),i.$el.trigger("gridster:dragstop")},drag:throttle(function(t,e){i.on_drag.call(i,t,e),i.$el.trigger("gridster:drag")},60)});return this.drag_api=this.$el.drag(e),this},r.resizable=function(){return this.resize_api=this.$el.drag({items:"."+this.options.resize.handle_class,offset_left:this.options.widget_margins[0],container_width:this.container_width,move_element:!1,resize:!0,limit:this.options.autogrow_cols?!1:!0,start:t.proxy(this.on_start_resize,this),stop:t.proxy(function(i,e){delay(t.proxy(function(){this.on_stop_resize(i,e)},this),120)},this),drag:t
 hrottle(t.proxy(this.on_resize,this),60)}),this},r.setup_resize=function(){this.resize_handle_class=this.options.resize.handle_class;var i=this.options.resize.axes,e='<span class="'+this.resize_handle_class+" "+this.resize_handle_class+'-{type}" />';return this.resize_handle_tpl=t.map(i,function(t){return e.replace("{type}",t)}).join(""),t.isArray(this.options.draggable.ignore_dragging)&&this.options.draggable.ignore_dragging.push("."+this.resize_handle_class),this},r.on_start_drag=function(i,e){this.$helper.add(this.$player).add(this.$wrapper).addClass("dragging"),this.highest_col=this.get_highest_occupied_cell().col,this.$player.addClass("player"),this.player_grid_data=this.$player.coords().grid,this.placeholder_grid_data=t.extend({},this.player_grid_data),this.set_dom_grid_height(this.$el.height()+this.player_grid_data.size_y*this.min_widget_height),this.set_dom_grid_width(this.cols);var s=this.player_grid_data.size_x,r=this.cols-this.highest_col;this.options.autogrow_cols&&s>=r&
 &this.add_faux_cols(Math.min(s-r,1));var o=this.faux_grid,a=this.$player.data("coords").coords;this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data),this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.last_cols=[],this.last_rows=[],this.collision_api=this.$helper.collision(o,this.options.collision),this.$preview_holder=t("<"+this.$player.get(0).tagName+" />",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:a.width,height:a.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,i,e)},r.on_drag=function(t,i){if(null===this.$player)return!1;var e={left:i.position.left+this.baseX,top:i.position.top+this.baseY};if(this.options.autogrow_cols){var s=this.placeholder_grid_data.col+this.placeholder_grid_data.size_x-1;s>=this.cols-1&&this.options.max_cols>=this.cols+1&&(this.add_faux_cols(1),this.set_dom_grid_width(this
 .cols+1),this.drag_api.set_limits(this.container_width)),this.collision_api.set_colliders(this.faux_grid)}this.colliders_data=this.collision_api.get_closest_colliders(e),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:i.position.left,top:i.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,t,i)},r.on_stop_drag=function(t,i){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),i.position.left=i.position.left+this.baseX,i.position.top=i.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(i.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player
 -revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.options.draggable.stop&&this.options.draggable.stop.call(this,t,i),this.$preview_holder.remove(),this.$player=null,this.$helper=null,this.placeholder_grid_data={},this.player_grid_data={},this.cells_occupied_by_placeholder={},this.cells_occupied_by_player={},this.set_dom_grid_height(),this.set_dom_grid_width(),this.options.autogrow_cols&&this.drag_api.set_limits(this.cols*this.min_widget_width)},r.on_start_resize=function(i,e){this.$resized_widget=e.$player.closest(".gs-w"),this.resize_coords=th
 is.$resized_widget.coords(),this.resize_wgd=this.resize_coords.grid,this.resize_initial_width=this.resize_coords.coords.width,this.resize_initial_height=this.resize_coords.coords.height,this.resize_initial_sizex=this.resize_coords.grid.size_x,this.resize_initial_sizey=this.resize_coords.grid.size_y,this.resize_initial_col=this.resize_coords.grid.col,this.resize_last_sizex=this.resize_initial_sizex,this.resize_last_sizey=this.resize_initial_sizey,this.resize_max_size_x=Math.min(this.resize_wgd.max_size_x||this.options.resize.max_size[0],this.options.max_cols-this.resize_initial_col+1),this.resize_max_size_y=this.resize_wgd.max_size_y||this.options.resize.max_size[1],this.resize_min_size_x=this.resize_wgd.min_size_x||this.options.resize.min_size[0]||1,this.resize_min_size_y=this.resize_wgd.min_size_y||this.options.resize.min_size[1]||1,this.resize_initial_last_col=this.get_highest_occupied_cell().col,this.set_dom_grid_width(this.cols),this.resize_dir={right:e.$player.is("."+this.resiz
 e_handle_class+"-x"),bottom:e.$player.is("."+this.resize_handle_class+"-y")},this.$resized_widget.css({"min-width":this.options.widget_base_dimensions[0],"min-height":this.options.widget_base_dimensions[1]});var s=this.$resized_widget.get(0).tagName;this.$resize_preview_holder=t("<"+s+" />",{"class":"preview-holder resize-preview-holder","data-row":this.$resized_widget.attr("data-row"),"data-col":this.$resized_widget.attr("data-col"),css:{width:this.resize_initial_width,height:this.resize_initial_height}}).appendTo(this.$el),this.$resized_widget.addClass("resizing"),this.options.resize.start&&this.options.resize.start.call(this,i,e,this.$resized_widget),this.$el.trigger("gridster:resizestart")},r.on_stop_resize=function(i,e){this.$resized_widget.removeClass("resizing").css({width:"",height:""}),delay(t.proxy(function(){this.$resize_preview_holder.remove().css({"min-width":"","min-height":""}),this.options.resize.stop&&this.options.resize.stop.call(this,i,e,this.$resized_widget),this
 .$el.trigger("gridster:resizestop")},this),300),this.set_dom_grid_width(),this.options.autogrow_cols&&this.drag_api.set_limits(this.cols*this.min_widget_width)},r.on_resize=function(t,i){var e,s=i.pointer.diff_left,r=i.pointer.diff_top,o=this.options.widget_base_dimensions[0],a=this.options.widget_base_dimensions[1],n=this.options.widget_margins[0],h=this.options.widget_margins[1],_=this.resize_max_size_x,d=this.resize_min_size_x,l=this.resize_max_size_y,c=this.resize_min_size_y,p=this.options.autogrow_cols,g=1/0,u=1/0,f=Math.ceil(s/(o+2*n)-.2),w=Math.ceil(r/(a+2*h)-.2),m=Math.max(1,this.resize_initial_sizex+f),y=Math.max(1,this.resize_initial_sizey+w),v=this.container_width/this.min_widget_width-this.resize_initial_col+1,z=v*this.min_widget_width-2*n;if(m=Math.max(Math.min(m,_),d),m=Math.min(v,m),e=_*o+2*(m-1)*n,g=Math.min(e,z),min_width=d*o+2*(m-1)*n,y=Math.max(Math.min(y,l),c),u=l*a+2*(y-1)*h,min_height=c*a+2*(y-1)*h,this.resize_dir.right?y=this.resize_initial_sizey:this.resize_d
 ir.bottom&&(m=this.resize_initial_sizex),p){var x=this.resize_initial_col+m-1;p&&x>=this.resize_initial_last_col&&(this.set_dom_grid_width(Math.max(x+1,this.cols)),x>this.cols&&this.add_faux_cols(x-this.cols))}var $={};!this.resize_dir.bottom&&($.width=Math.max(Math.min(this.resize_initial_width+s,g),min_width)),!this.resize_dir.right&&($.height=Math.max(Math.min(this.resize_initial_height+r,u),min_height)),this.$resized_widget.css($),(m!==this.resize_last_sizex||y!==this.resize_last_sizey)&&(this.resize_widget(this.$resized_widget,m,y),this.set_dom_grid_width(this.cols),this.$resize_preview_holder.css({width:"",height:""}).attr({"data-row":this.$resized_widget.attr("data-row"),"data-sizex":m,"data-sizey":y})),this.options.resize.resize&&this.options.resize.resize.call(this,t,i,this.$resized_widget),this.$el.trigger("gridster:resize"),this.resize_last_sizex=m,this.resize_last_sizey=y},r.on_overlapped_column_change=function(i,e){if(!this.colliders_data.length)return this;var s,r=this
 .get_targeted_columns(this.colliders_data[0].el.data.col),o=this.last_cols.length,a=r.length;for(s=0;a>s;s++)-1===t.inArray(r[s],this.last_cols)&&(i||t.noop).call(this,r[s]);for(s=0;o>s;s++)-1===t.inArray(this.last_cols[s],r)&&(e||t.noop).call(this,this.last_cols[s]);return this.last_cols=r,this},r.on_overlapped_row_change=function(i,e){if(!this.colliders_data.length)return this;var s,r=this.get_targeted_rows(this.colliders_data[0].el.data.row),o=this.last_rows.length,a=r.length;for(s=0;a>s;s++)-1===t.inArray(r[s],this.last_rows)&&(i||t.noop).call(this,r[s]);for(s=0;o>s;s++)-1===t.inArray(this.last_rows[s],r)&&(e||t.noop).call(this,this.last_rows[s]);this.last_rows=r},r.set_player=function(t,i,e){var s=this;e||this.empty_cells_player_occupies();var r=e?{col:t}:s.colliders_data[0].el.data,o=r.col,a=i||r.row;this.player_grid_data={col:o,row:a,size_y:this.player_grid_data.size_y,size_x:this.player_grid_data.size_x},this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_
 data);var n=this.get_widgets_overlapped(this.player_grid_data),h=this.widgets_constraints(n);if(this.manage_movements(h.can_go_up,o,a),this.manage_movements(h.can_not_go_up,o,a),!n.length){var _=this.can_go_player_up(this.player_grid_data);_!==!1&&(a=_),this.set_placeholder(o,a)}return{col:o,row:a}},r.widgets_constraints=function(i){var s,r=t([]),o=[],a=[];return i.each(t.proxy(function(i,e){var s=t(e),n=s.coords().grid;this.can_go_widget_up(n)?(r=r.add(s),o.push(n)):a.push(n)},this)),s=i.not(r),{can_go_up:e.sort_by_row_asc(o),can_not_go_up:e.sort_by_row_desc(a)}},r.manage_movements=function(i,e,s){return t.each(i,t.proxy(function(t,i){var r=i,o=r.el,a=this.can_go_widget_up(r);if(a)this.move_widget_to(o,a),this.set_placeholder(e,a+r.size_y);else{var n=this.can_go_player_up(this.player_grid_data);if(!n){var h=s+this.player_grid_data.size_y-r.row;this.move_widget_down(o,h),this.set_placeholder(e,s)}}},this)),this},r.is_player=function(t,i){if(i&&!this.gridmap[t])return!1;var e=i?this.
 gridmap[t][i]:t;return e&&(e.is(this.$player)||e.is(this.$helper))},r.is_player_in=function(i,e){var s=this.cells_occupied_by_player||{};return t.inArray(i,s.cols)>=0&&t.inArray(e,s.rows)>=0},r.is_placeholder_in=function(i,e){var s=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(i)&&t.inArray(e,s.rows)>=0},r.is_placeholder_in_col=function(i){var e=this.cells_occupied_by_placeholder||[];return t.inArray(i,e.cols)>=0},r.is_empty=function(t,i){return this.gridmap[t]!==void 0?this.gridmap[t][i]!==void 0&&this.gridmap[t][i]===!1?!0:!1:!0},r.is_occupied=function(t,i){return this.gridmap[t]?this.gridmap[t][i]?!0:!1:!1},r.is_widget=function(t,i){var e=this.gridmap[t];return e?(e=e[i],e?e:!1):!1},r.is_widget_under_player=function(t,i){return this.is_widget(t,i)?this.is_player_in(t,i):!1},r.get_widgets_under_player=function(i){i||(i=this.cells_occupied_by_player||{cols:[],rows:[]});var e=t([]);return t.each(i.cols,t.proxy(function(s,r){t.each(i.rows,t.proxy(function(t
 ,i){this.is_widget(r,i)&&(e=e.add(this.gridmap[r][i]))},this))},this)),e},r.set_placeholder=function(i,e){var s=t.extend({},this.placeholder_grid_data),r=this.widgets_below({col:s.col,row:s.row,size_y:s.size_y,size_x:s.size_x}),o=i+s.size_x-1;o>this.cols&&(i-=o-i);var a=e>this.placeholder_grid_data.row,n=this.placeholder_grid_data.col!==i;this.placeholder_grid_data.col=i,this.placeholder_grid_data.row=e,this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.$preview_holder.attr({"data-row":e,"data-col":i}),(a||n)&&r.each(t.proxy(function(e,r){this.move_widget_up(t(r),this.placeholder_grid_data.col-i+s.size_y)},this));var h=this.get_widgets_under_player(this.cells_occupied_by_placeholder);h.length&&h.each(t.proxy(function(i,r){var o=t(r);this.move_widget_down(o,e+s.size_y-o.data("coords").grid.row)},this))},r.can_go_player_up=function(t){var i=t.row+t.size_y-1,e=!0,s=[],r=1e4,o=this.get_widgets_under_player();return this.for_each_column_occupied(t
 ,function(t){var a=this.gridmap[t],n=i+1;for(s[t]=[];--n>0&&(this.is_empty(t,n)||this.is_player(t,n)||this.is_widget(t,n)&&a[n].is(o));)s[t].push(n),r=r>n?n:r;return 0===s[t].length?(e=!1,!0):(s[t].sort(function(t,i){return t-i
-}),void 0)}),e?this.get_valid_rows(t,s,r):!1},r.can_go_widget_up=function(t){var i=t.row+t.size_y-1,e=!0,s=[],r=1e4;return this.for_each_column_occupied(t,function(o){var a=this.gridmap[o];s[o]=[];for(var n=i+1;--n>0&&(!this.is_widget(o,n)||this.is_player_in(o,n)||a[n].is(t.el));)this.is_player(o,n)||this.is_placeholder_in(o,n)||this.is_player_in(o,n)||s[o].push(n),r>n&&(r=n);return 0===s[o].length?(e=!1,!0):(s[o].sort(function(t,i){return t-i}),void 0)}),e?this.get_valid_rows(t,s,r):!1},r.get_valid_rows=function(i,e,s){for(var r=i.row,o=i.row+i.size_y-1,a=i.size_y,n=s-1,h=[];o>=++n;){var _=!0;if(t.each(e,function(i,e){t.isArray(e)&&-1===t.inArray(n,e)&&(_=!1)}),_===!0&&(h.push(n),h.length===a))break}var d=!1;return 1===a?h[0]!==r&&(d=h[0]||!1):h[0]!==r&&(d=this.get_consecutive_numbers_index(h,a)),d},r.get_consecutive_numbers_index=function(t,i){for(var e=t.length,s=[],r=!0,o=-1,a=0;e>a;a++){if(r||t[a]===o+1){if(s.push(a),s.length===i)break;r=!1}else s=[],r=!0;o=t[a]}return s.length
 >=i?t[s[0]]:!1},r.get_widgets_overlapped=function(){var i=t([]),e=[],s=this.cells_occupied_by_player.rows.slice(0);return s.reverse(),t.each(this.cells_occupied_by_player.cols,t.proxy(function(r,o){t.each(s,t.proxy(function(s,r){if(!this.gridmap[o])return!0;var a=this.gridmap[o][r];this.is_occupied(o,r)&&!this.is_player(a)&&-1===t.inArray(a,e)&&(i=i.add(a),e.push(a))},this))},this)),i},r.on_start_overlapping_column=function(t){this.set_player(t,!1)},r.on_start_overlapping_row=function(t){this.set_player(!1,t)},r.on_stop_overlapping_column=function(t){this.set_player(t,!1);var i=this;this.for_each_widget_below(t,this.cells_occupied_by_player.rows[0],function(){i.move_widget_up(this,i.player_grid_data.size_y)})},r.on_stop_overlapping_row=function(t){this.set_player(!1,t);for(var i=this,e=this.cells_occupied_by_player.cols,s=0,r=e.length;r>s;s++)this.for_each_widget_below(e[s],t,function(){i.move_widget_up(this,i.player_grid_data.size_y)})},r.move_widget_to=function(i,e){var s=this,r=i
 .coords().grid;e-r.row;var o=this.widgets_below(i),a=this.can_move_to(r,r.col,e,i);return a===!1?!1:(this.remove_from_gridmap(r),r.row=e,this.add_to_gridmap(r),i.attr("data-row",e),this.$changed=this.$changed.add(i),o.each(function(i,e){var r=t(e),o=r.coords().grid,a=s.can_go_widget_up(o);a&&a!==o.row&&s.move_widget_to(r,a)}),this)},r.move_widget_up=function(i,e){var s=i.coords().grid,r=s.row,o=[];return e||(e=1),this.can_go_up(i)?(this.for_each_column_occupied(s,function(s){if(-1===t.inArray(i,o)){var a=i.coords().grid,n=r-e;if(n=this.can_go_up_to_row(a,s,n),!n)return!0;var h=this.widgets_below(i);this.remove_from_gridmap(a),a.row=n,this.add_to_gridmap(a),i.attr("data-row",a.row),this.$changed=this.$changed.add(i),o.push(i),h.each(t.proxy(function(i,s){this.move_widget_up(t(s),e)},this))}}),void 0):!1},r.move_widget_down=function(i,e){var s,r,o,a;if(0>=e)return!1;if(s=i.coords().grid,r=s.row,o=[],a=e,!i)return!1;if(-1===t.inArray(i,o)){var n=i.coords().grid,h=r+e,_=this.widgets_bel
 ow(i);this.remove_from_gridmap(n),_.each(t.proxy(function(i,e){var s=t(e),r=s.coords().grid,o=this.displacement_diff(r,n,a);o>0&&this.move_widget_down(s,o)},this)),n.row=h,this.update_widget_position(n,i),i.attr("data-row",n.row),this.$changed=this.$changed.add(i),o.push(i)}},r.can_go_up_to_row=function(i,e,s){var r,o=this.gridmap,a=!0,n=[],h=i.row;if(this.for_each_column_occupied(i,function(t){for(o[t],n[t]=[],r=h;r--&&this.is_empty(t,r)&&!this.is_placeholder_in(t,r);)n[t].push(r);return n[t].length?void 0:(a=!1,!0)}),!a)return!1;for(r=s,r=1;h>r;r++){for(var _=!0,d=0,l=n.length;l>d;d++)n[d]&&-1===t.inArray(r,n[d])&&(_=!1);if(_===!0){a=r;break}}return a},r.displacement_diff=function(t,i,e){var s=t.row,r=[],o=i.row+i.size_y;this.for_each_column_occupied(t,function(t){for(var i=0,e=o;s>e;e++)this.is_empty(t,e)&&(i+=1);r.push(i)});var a=Math.max.apply(Math,r);return e-=a,e>0?e:0},r.widgets_below=function(i){var s=t.isPlainObject(i)?i:i.coords().grid,r=this;this.gridmap;var o=s.row+s.si
 ze_y-1,a=t([]);return this.for_each_column_occupied(s,function(i){r.for_each_widget_below(i,o,function(){return r.is_player(this)||-1!==t.inArray(this,a)?void 0:(a=a.add(this),!0)})}),e.sort_by_row_asc(a)},r.set_cells_player_occupies=function(t,i){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=t,this.placeholder_grid_data.row=i,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},r.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},r.can_go_up=function(t){var i=t.coords().grid,e=i.row,s=e-1;this.gridmap;var r=!0;return 1===e?!1:(this.for_each_column_occupied(i,function(t){return this.is_widget(t,s),this.is_occupied(t,s)||this.is_player(t,s)||this.is_placeholder_in(t,s)||this.is_player_in(t,s)?(r=!1,!0):void 0}),r)},r.can_move_to=function(t,i,e,s){this.gridmap;var r=t.el,o={size_y:t.size_y,size_x:t.size_x,col:i,row:e},a=!0,n=i+t.size_x-1;return n>this.cols?!1:s&&e+t.size_y-
 1>s?!1:(this.for_each_cell_occupied(o,function(i,e){var s=this.is_widget(i,e);!s||t.el&&!s.is(r)||(a=!1)}),a)},r.get_targeted_columns=function(t){for(var i=(t||this.player_grid_data.col)+(this.player_grid_data.size_x-1),e=[],s=t;i>=s;s++)e.push(s);return e},r.get_targeted_rows=function(t){for(var i=(t||this.player_grid_data.row)+(this.player_grid_data.size_y-1),e=[],s=t;i>=s;s++)e.push(s);return e},r.get_cells_occupied=function(i){var e,s={cols:[],rows:[]};for(arguments[1]instanceof t&&(i=arguments[1].coords().grid),e=0;i.size_x>e;e++){var r=i.col+e;s.cols.push(r)}for(e=0;i.size_y>e;e++){var o=i.row+e;s.rows.push(o)}return s},r.for_each_cell_occupied=function(t,i){return this.for_each_column_occupied(t,function(e){this.for_each_row_occupied(t,function(t){i.call(this,e,t)})}),this},r.for_each_column_occupied=function(t,i){for(var e=0;t.size_x>e;e++){var s=t.col+e;i.call(this,s,t)}},r.for_each_row_occupied=function(t,i){for(var e=0;t.size_y>e;e++){var s=t.row+e;i.call(this,s,t)}},r._t
 raversing_widgets=function(i,e,s,r,o){var a=this.gridmap;if(a[s]){var n,h,_=i+"/"+e;if(arguments[2]instanceof t){var d=arguments[2].coords().grid;s=d.col,r=d.row,o=arguments[3]}var l=[],c=r,p={"for_each/above":function(){for(;c--&&!(c>0&&this.is_widget(s,c)&&-1===t.inArray(a[s][c],l)&&(n=o.call(a[s][c],s,c),l.push(a[s][c]),n)););},"for_each/below":function(){for(c=r+1,h=a[s].length;h>c&&(!this.is_widget(s,c)||-1!==t.inArray(a[s][c],l)||(n=o.call(a[s][c],s,c),l.push(a[s][c]),!n));c++);}};p[_]&&p[_].call(this)}},r.for_each_widget_above=function(t,i,e){return this._traversing_widgets("for_each","above",t,i,e),this},r.for_each_widget_below=function(t,i,e){return this._traversing_widgets("for_each","below",t,i,e),this},r.get_highest_occupied_cell=function(){for(var t,i=this.gridmap,e=i[1].length,s=[],r=[],o=i.length-1;o>=1;o--)for(t=e-1;t>=1;t--)if(this.is_widget(o,t)){s.push(t),r.push(o);break}return{col:Math.max.apply(Math,r),row:Math.max.apply(Math,s)}},r.get_widgets_from=function(i,e
 ){this.gridmap;var s=t();return i&&(s=s.add(this.$widgets.filter(function(){var e=t(this).attr("data-col");return e===i||e>i}))),e&&(s=s.add(this.$widgets.filter(function(){var i=t(this).attr("data-row");return i===e||i>e}))),s},r.set_dom_grid_height=function(t){if(t===void 0){var i=this.get_highest_occupied_cell().row;t=i*this.min_widget_height}return this.container_height=t,this.$el.css("height",this.container_height),this},r.set_dom_grid_width=function(t){t===void 0&&(t=this.get_highest_occupied_cell().col);var i=this.options.autogrow_cols?this.options.max_cols:this.cols;return t=Math.min(i,Math.max(t,this.options.min_cols)),this.container_width=t*this.min_widget_width,this.$el.css("width",this.container_width),this},r.generate_stylesheet=function(i){var s,r="",o=this.options.max_size_x||this.cols;i||(i={}),i.cols||(i.cols=this.cols),i.rows||(i.rows=this.rows),i.namespace||(i.namespace=this.options.namespace),i.widget_base_dimensions||(i.widget_base_dimensions=this.options.widget
 _base_dimensions),i.widget_margins||(i.widget_margins=this.options.widget_margins),i.min_widget_width=2*i.widget_margins[0]+i.widget_base_dimensions[0],i.min_widget_height=2*i.widget_margins[1]+i.widget_base_dimensions[1];var a=t.param(i);if(t.inArray(a,e.generated_stylesheets)>=0)return!1;for(this.generated_stylesheets.push(a),e.generated_stylesheets.push(a),s=i.cols;s>=0;s--)r+=i.namespace+' [data-col="'+(s+1)+'"] { left:'+(s*i.widget_base_dimensions[0]+s*i.widget_margins[0]+(s+1)*i.widget_margins[0])+"px; }\n";for(s=i.rows;s>=0;s--)r+=i.namespace+' [data-row="'+(s+1)+'"] { top:'+(s*i.widget_base_dimensions[1]+s*i.widget_margins[1]+(s+1)*i.widget_margins[1])+"px; }\n";for(var n=1;i.rows>=n;n++)r+=i.namespace+' [data-sizey="'+n+'"] { height:'+(n*i.widget_base_dimensions[1]+(n-1)*2*i.widget_margins[1])+"px; }\n";for(var h=1;o>=h;h++)r+=i.namespace+' [data-sizex="'+h+'"] { width:'+(h*i.widget_base_dimensions[0]+(h-1)*2*i.widget_margins[0])+"px; }\n";return this.remove_style_tags(),th
 is.add_style_tag(r)},r.add_style_tag=function(t){var i=document,e=i.createElement("style");return i.getElementsByTagName("head")[0].appendChild(e),e.setAttribute("type","text/css"),e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),this.$style_tags=this.$style_tags.add(e),this},r.remove_style_tags=function(){var i=e.generated_stylesheets,s=this.generated_stylesheets;this.$style_tags.remove(),e.generated_stylesheets=t.map(i,function(i){return-1===t.inArray(i,s)?i:void 0})},r.generate_faux_grid=function(t,i){this.faux_grid=[],this.gridmap=[];var e,s;for(e=i;e>0;e--)for(this.gridmap[e]=[],s=t;s>0;s--)this.add_faux_cell(s,e);return this},r.add_faux_cell=function(i,e){var s=t({left:this.baseX+(e-1)*this.min_widget_width,top:this.baseY+(i-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:e,row:i,original_col:e,original_row:i}).coords();return t.isArray(this.gridmap[e])||(this.gridmap[e]=[]),this.gridmap[e][i]=!1,this.faux_gr
 id.push(s),this},r.add_faux_rows=function(t){for(var i=this.rows,e=i+(t||1),s=e;s>i;s--)for(var r=this.cols;r>=1;r--)this.add_faux_cell(s,r);return this.rows=e,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},r.add_faux_cols=function(t){var i=this.cols,e=i+(t||1);e=Math.min(e,this.options.max_cols);for(var s=i+1;e>=s;s++)for(var r=this.rows;r>=1;r--)this.add_faux_cell(r,s);return this.cols=e,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},r.recalculate_faux_grid=function(){var i=this.$wrapper.width();return this.baseX=(t(window).width()-i)/2,this.baseY=this.$wrapper.offset().top,t.each(this.faux_grid,t.proxy(function(t,i){this.faux_grid[t]=i.update({left:this.baseX+(i.data.col-1)*this.min_widget_width,top:this.baseY+(i.data.row-1)*this.min_widget_height})},this)),this},r.get_widgets_from_DOM=function(){var i=this.$widgets.map(t.proxy(function(i,e){var s=t(e);return this.dom_to_coords(s)},this));i=e.sort_by_row_and_col_asc(i);var s=t(i).ma
 p(t.proxy(function(t,i){return this.register_widget(i)||null},this));return s.length&&this.$el.trigger("gridster:positionschanged"),this},r.generate_grid_and_stylesheet=function(){var i=this.$wrapper.width(),e=this.options.max_cols,s=Math.floor(i/this.min_widget_width)+this.options.extra_cols,r=this.$widgets.map(function(){return t(this).attr("data-col")}).get();r.length||(r=[0]);var o=Math.max.apply(Math,r);this.cols=Math.max(o,s,this.options.min_cols),1/0!==e&&e>=o&&this.cols>e&&(this.cols=e);var a=this.options.extra_rows;return this.$widgets.each(function(i,e){a+=+t(e).attr("data-sizey")}),this.rows=Math.max(a,this.options.min_rows),this.baseX=(t(window).width()-i)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},r.destroy=function(i){return this.$el.removeData("gridster"),t(window).unbind(".gridster"),this.drag_api&&this.drag_api.destroy(),this.remove_style_tags(),i&&this.$el.re
 move(),this},t.fn.gridster=function(i){return this.each(function(){t(this).data("gridster")||t(this).data("gridster",new e(this,i))})},e}),function(t,i){"function"==typeof define&&define.amd?define(["jquery","gridster"],i):t.Gridster=i(t.$||t.jQuery,t.Gridster)}(this,function(t,i){var e=i.prototype;return e.widgets_in_col=function(t){if(!this.gridmap[t])return!1;for(var i=this.gridmap[t].length-1;i>=0;i--)if(this.is_widget(t,i)!==!1)return!0;return!1},e.widgets_in_row=function(t){for(var i=this.gridmap.length;i>=1;i--)if(this.is_widget(i,t)!==!1)return!0;return!1},e.widgets_in_range=function(i,e,s,r){var o,a,n,h,_=t([]);for(o=s;o>=i;o--)for(a=r;a>=e;a--)n=this.is_widget(o,a),n!==!1&&(h=n.data("coords").grid,h.col>=i&&s>=h.col&&h.row>=e&&r>=h.row&&(_=_.add(n)));return _},e.get_bottom_most_occupied_cell=function(){var t=0,i=0;return this.for_each_cell(function(e,s,r){e&&r>t&&(t=r,i=s)}),{col:i,row:t}},e.get_right_most_occupied_cell=function(){var t=0,i=0;return this.for_each_cell(func
 tion(e,s,r){return e?(t=r,i=s,!1):void 0}),{col:i,row:t}},e.for_each_cell=function(t,i){i||(i=this.gridmap);var e=i.length,s=i[1].length;t:for(var r=e-1;r>=1;r--)for(var o=s-1;o>=1;o--){var a=i[r]&&i[r][o];if(t){if(t.call(this,a,r,o)===!1)break t}else;}},e.next_position_in_range=function(t,e,s){t||(t=1),e||(e=1);for(var r,o=this.gridmap,a=o.length,n=[],h=1;a>h;h++){r=s||o[h].length;for(var _=1;r>=_;_++){var d=this.can_move_to({size_x:t,size_y:e},h,_,s);d&&n.push({col:h,row:_,size_y:e,size_x:t})}}return n.length>=1?i.sort_by_col_asc(n)[0]:!1},e.closest_to_right=function(t,i){if(!this.gridmap[t])return!1;for(var e=this.gridmap.length-1,s=t;e>=s;s++)if(this.gridmap[s][i])return{col:s,row:i};return!1},e.closest_to_left=function(t,i){if(this.gridmap.length-1,!this.gridmap[t])return!1;for(var e=t;e>=1;e--)if(this.gridmap[e][i])return{col:e,row:i};return!1},i});
\ No newline at end of file


[4/8] chukwa git commit: CHUKWA-806. Replace gridster with gridstack. (Eric Yang)

Posted by ey...@apache.org.
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/js/jquery.gridster.min.js
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/js/jquery.gridster.min.js b/src/main/web/hicc/home/js/jquery.gridster.min.js
deleted file mode 100755
index a256947..0000000
--- a/src/main/web/hicc/home/js/jquery.gridster.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! gridster.js - v0.5.6 - 2014-09-25 - * http://gridster.net/ - Copyright (c) 2014 ducksboard; Licensed MIT */ (function(t,i){"function"==typeof define&&define.amd?define("gridster-coords",["jquery"],i):t.GridsterCoords=i(t.$||t.jQuery)})(this,function(t){function i(i){return i[0]&&t.isPlainObject(i[0])?this.data=i[0]:this.el=i,this.isCoords=!0,this.coords={},this.init(),this}var e=i.prototype;return e.init=function(){this.set(),this.original_coords=this.get()},e.set=function(t,i){var e=this.el;if(e&&!t&&(this.data=e.offset(),this.data.width=e.width(),this.data.height=e.height()),e&&t&&!i){var s=e.offset();this.data.top=s.top,this.data.left=s.left}var r=this.data;return r.left===void 0&&(r.left=r.x1),r.top===void 0&&(r.top=r.y1),this.coords.x1=r.left,this.coords.y1=r.top,this.coords.x2=r.left+r.width,this.coords.y2=r.top+r.height,this.coords.cx=r.left+r.width/2,this.coords.cy=r.top+r.height/2,this.coords.width=r.width,this.coords.height=r.height,this.coords.el=e||!1,this},e.update=
 function(i){if(!i&&!this.el)return this;if(i){var e=t.extend({},this.data,i);return this.data=e,this.set(!0,!0)}return this.set(!0),this},e.get=function(){return this.coords},e.destroy=function(){this.el.removeData("coords"),delete this.el},t.fn.coords=function(){if(this.data("coords"))return this.data("coords");var t=new i(this,arguments[0]);return this.data("coords",t),t},i}),function(t,i){"function"==typeof define&&define.amd?define("gridster-collision",["jquery","gridster-coords"],i):t.GridsterCollision=i(t.$||t.jQuery,t.GridsterCoords)}(this,function(t){function i(i,s,r){this.options=t.extend(e,r),this.$element=i,this.last_colliders=[],this.last_colliders_coords=[],this.set_colliders(s),this.init()}var e={colliders_context:document.body,overlapping_region:"C"};i.defaults=e;var s=i.prototype;return s.init=function(){this.find_collisions()},s.overlaps=function(t,i){var e=!1,s=!1;return(i.x1>=t.x1&&i.x1<=t.x2||i.x2>=t.x1&&i.x2<=t.x2||t.x1>=i.x1&&t.x2<=i.x2)&&(e=!0),(i.y1>=t.y1&&i.
 y1<=t.y2||i.y2>=t.y1&&i.y2<=t.y2||t.y1>=i.y1&&t.y2<=i.y2)&&(s=!0),e&&s},s.detect_overlapping_region=function(t,i){var e="",s="";return t.y1>i.cy&&t.y1<i.y2&&(e="N"),t.y2>i.y1&&t.y2<i.cy&&(e="S"),t.x1>i.cx&&t.x1<i.x2&&(s="W"),t.x2>i.x1&&t.x2<i.cx&&(s="E"),e+s||"C"},s.calculate_overlapped_area_coords=function(i,e){var s=Math.max(i.x1,e.x1),r=Math.max(i.y1,e.y1),o=Math.min(i.x2,e.x2),a=Math.min(i.y2,e.y2);return t({left:s,top:r,width:o-s,height:a-r}).coords().get()},s.calculate_overlapped_area=function(t){return t.width*t.height},s.manage_colliders_start_stop=function(i,e,s){for(var r=this.last_colliders_coords,o=0,a=r.length;a>o;o++)-1===t.inArray(r[o],i)&&e.call(this,r[o]);for(var n=0,h=i.length;h>n;n++)-1===t.inArray(i[n],r)&&s.call(this,i[n])},s.find_collisions=function(i){for(var e=this,s=this.options.overlapping_region,r=[],o=[],a=this.colliders||this.$colliders,n=a.length,h=e.$element.coords().update(i||!1).get();n--;){var _=e.$colliders?t(a[n]):a[n],d=_.isCoords?_:_.coords(),l=
 d.get(),c=e.overlaps(h,l);if(c){var p=e.detect_overlapping_region(h,l);if(p===s||"all"===s){var g=e.calculate_overlapped_area_coords(h,l),u=e.calculate_overlapped_area(g),f={area:u,area_coords:g,region:p,coords:l,player_coords:h,el:_};e.options.on_overlap&&e.options.on_overlap.call(this,f),r.push(d),o.push(f)}}}return(e.options.on_overlap_stop||e.options.on_overlap_start)&&this.manage_colliders_start_stop(r,e.options.on_overlap_start,e.options.on_overlap_stop),this.last_colliders_coords=r,o},s.get_closest_colliders=function(t){var i=this.find_collisions(t);return i.sort(function(t,i){return"C"===t.region&&"C"===i.region?t.coords.y1<i.coords.y1||t.coords.x1<i.coords.x1?-1:1:t.area<i.area?1:1}),i},s.set_colliders=function(i){"string"==typeof i||i instanceof t?this.$colliders=t(i,this.options.colliders_context).not(this.$element):this.colliders=t(i)},t.fn.collision=function(t,e){return new i(this,t,e)},i}),function(t){t.delay=function(t,i){var e=Array.prototype.slice.call(arguments,2);
 return setTimeout(function(){return t.apply(null,e)},i)},t.debounce=function(t,i,e){var s;return function(){var r=this,o=arguments,a=function(){s=null,e||t.apply(r,o)};e&&!s&&t.apply(r,o),clearTimeout(s),s=setTimeout(a,i)}},t.throttle=function(t,i){var e,s,r,o,a,n,h=debounce(function(){a=o=!1},i);return function(){e=this,s=arguments;var _=function(){r=null,a&&t.apply(e,s),h()};return r||(r=setTimeout(_,i)),o?a=!0:n=t.apply(e,s),h(),o=!0,n}}}(window),function(t,i){"function"==typeof define&&define.amd?define("gridster-draggable",["jquery"],i):t.GridsterDraggable=i(t.$||t.jQuery)}(this,function(t){function i(i,s){this.options=t.extend({},e,s),this.$document=t(document),this.$container=t(i),this.$dragitems=t(this.options.items,this.$container),this.is_dragging=!1,this.player_min_left=0+this.options.offset_left,this.id=h(),this.ns=".gridster-draggable-"+this.id,this.init()}var e={items:"li",distance:1,limit:!0,offset_left:0,autoscroll:!0,ignore_dragging:["INPUT","TEXTAREA","SELECT","BUT
 TON"],handle:null,container_width:0,move_element:!0,helper:!1,remove_helper:!0},s=t(window),r={x:"left",y:"top"},o=!!("ontouchstart"in window),a=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},n=0,h=function(){return++n+""};i.defaults=e;var _=i.prototype;return _.init=function(){var i=this.$container.css("position");this.calculate_dimensions(),this.$container.css("position","static"===i?"relative":i),this.disabled=!1,this.events(),t(window).bind(this.nsEvent("resize"),throttle(t.proxy(this.calculate_dimensions,this),200))},_.nsEvent=function(t){return(t||"")+this.ns},_.events=function(){this.pointer_events={start:this.nsEvent("touchstart")+" "+this.nsEvent("mousedown"),move:this.nsEvent("touchmove")+" "+this.nsEvent("mousemove"),end:this.nsEvent("touchend")+" "+this.nsEvent("mouseup")},this.$container.on(this.nsEvent("selectstart"),t.proxy(this.on_select_start,this)),this.$container.on(this.pointer_events.start,this.options.items,t.proxy(this.drag_handler,this)),this.$docum
 ent.on(this.pointer_events.end,t.proxy(function(t){this.is_dragging=!1,this.disabled||(this.$document.off(this.pointer_events.move),this.drag_start&&this.on_dragstop(t))},this))},_.get_actual_pos=function(t){var i=t.position();return i},_.get_mouse_pos=function(t){if(t.originalEvent&&t.originalEvent.touches){var i=t.originalEvent;t=i.touches.length?i.touches[0]:i.changedTouches[0]}return{left:t.clientX,top:t.clientY}},_.get_offset=function(i){i.preventDefault();var e=this.get_mouse_pos(i),s=Math.round(e.left-this.mouse_init_pos.left),r=Math.round(e.top-this.mouse_init_pos.top),o=Math.round(this.el_init_offset.left+s-this.baseX+t(window).scrollLeft()-this.win_offset_x),a=Math.round(this.el_init_offset.top+r-this.baseY+t(window).scrollTop()-this.win_offset_y);return this.options.limit&&(o>this.player_max_left?o=this.player_max_left:this.player_min_left>o&&(o=this.player_min_left)),{position:{left:o,top:a},pointer:{left:e.left,top:e.top,diff_left:s+(t(window).scrollLeft()-this.win_offs
 et_x),diff_top:r+(t(window).scrollTop()-this.win_offset_y)}}},_.get_drag_data=function(t){var i=this.get_offset(t);return i.$player=this.$player,i.$helper=this.helper?this.$helper:this.$player,i},_.set_limits=function(t){return t||(t=this.$container.width()),this.player_max_left=t-this.player_width+-this.options.offset_left,this.options.container_width=t,this},_.scroll_in=function(i,e){var o,n=r[i],h=50,_=30,d="x"===i,l=d?this.window_width:this.window_height,c=d?t(document).width():t(document).height(),p=d?this.$player.width():this.$player.height(),g=s["scroll"+a(n)](),u=g,f=u+l,w=f-h,m=u+h,y=u+e.pointer[n],v=c-l+p;return y>=w&&(o=g+_,v>o&&(s["scroll"+a(n)](o),this["scroll_offset_"+i]+=_)),m>=y&&(o=g-_,o>0&&(s["scroll"+a(n)](o),this["scroll_offset_"+i]-=_)),this},_.manage_scroll=function(t){this.scroll_in("x",t),this.scroll_in("y",t)},_.calculate_dimensions=function(){this.window_height=s.height(),this.window_width=s.width()},_.drag_handler=function(i){if(i.target.nodeName,!this.dis
 abled&&(1===i.which||o)&&!this.ignore_drag(i)){var e=this,s=!0;return this.$player=t(i.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(i),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,this.$document.on(this.pointer_events.move,function(t){var i=e.get_mouse_pos(t),r=Math.abs(i.left-e.mouse_init_pos.left),o=Math.abs(i.top-e.mouse_init_pos.top);return r>e.options.distance||o>e.options.distance?s?(s=!1,e.on_dragstart.call(e,t),!1):(e.is_dragging===!0&&e.on_dragmove.call(e,t),!1):!1}),o?void 0:!1}},_.on_dragstart=function(i){if(i.preventDefault(),this.is_dragging)return this;this.drag_start=this.is_dragging=!0;var e=this.$container.offset();return this.baseX=Math.round(e.left),this.baseY=Math.round(e.top),this.initial_container_width=this.options.container_width||this.$container.width(),"clone"===this.options.helper?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.help
 er=!1,this.win_offset_y=t(window).scrollTop(),this.win_offset_x=t(window).scrollLeft(),this.scroll_offset_y=0,this.scroll_offset_x=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.set_limits(this.options.container_width),this.options.start&&this.options.start.call(this.$player,i,this.get_drag_data(i)),!1},_.on_dragmove=function(t){var i=this.get_drag_data(t);this.options.autoscroll&&this.manage_scroll(i),this.options.move_element&&(this.helper?this.$helper:this.$player).css({position:"absolute",left:i.position.left,top:i.position.top});var e=this.last_position||i.position;return i.prev_position=e,this.options.drag&&this.options.drag.call(this.$player,t,i),this.last_position=i.position,!1},_.on_dragstop=function(t){var i=this.get_drag_data(t);return this.drag_start=!1,this.options.stop&&this.options.stop.call(this.$player,t,i),this.helper&&this.options.remove_helper&&this.$helper.remove(),!1},_.on_select_
 start=function(t){return this.disabled||this.ignore_drag(t)?void 0:!1},_.enable=function(){this.disabled=!1},_.disable=function(){this.disabled=!0},_.destroy=function(){this.disable(),this.$container.off(this.ns),this.$document.off(this.ns),t(window).off(this.ns),t.removeData(this.$container,"drag")},_.ignore_drag=function(i){return this.options.handle?!t(i.target).is(this.options.handle):t.isFunction(this.options.ignore_dragging)?this.options.ignore_dragging(i):t(i.target).is(this.options.ignore_dragging.join(", "))},t.fn.drag=function(t){return new i(this,t)},i}),function(t,i){"function"==typeof define&&define.amd?define(["jquery","gridster-draggable","gridster-collision"],i):t.Gridster=i(t.$||t.jQuery,t.GridsterDraggable,t.GridsterCollision)}(this,function(t,i){function e(i,e){this.options=t.extend(!0,{},s,e),this.$el=t(i),this.$wrapper=this.$el.parent(),this.$widgets=this.$el.children(this.options.widget_selector).addClass("gs-w"),this.widgets=[],this.$changed=t([]),this.wrapper
 _width=this.$wrapper.width(),this.min_widget_width=2*this.options.widget_margins[0]+this.options.widget_base_dimensions[0],this.min_widget_height=2*this.options.widget_margins[1]+this.options.widget_base_dimensions[1],this.generated_stylesheets=[],this.$style_tags=t([]),this.options.auto_init&&this.init()}var s={namespace:"",widget_selector:"li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,max_cols:1/0,min_rows:15,max_size_x:!1,autogrow_cols:!1,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,auto_init:!0,serialize_params:function(t,i){return{col:i.col,row:i.row,size_x:i.size_x,size_y:i.size_y}},collision:{},draggable:{items:".gs-w",distance:4,ignore_dragging:i.defaults.ignore_dragging.slice(0)},resize:{enabled:!1,axes:["both"],handle_append_to:"",handle_class:"gs-resize-handle",max_size:[1/0,1/0],min_size:[1,1]}};e.defaults=s,e.generated_stylesheets=[],e.sort_by_row_asc=function(i){return i=i.sort(function(i,e){return i.row||(i=
 t(i).coords().grid,e=t(e).coords().grid),i.row>e.row?1:-1})},e.sort_by_row_and_col_asc=function(t){return t=t.sort(function(t,i){return t.row>i.row||t.row===i.row&&t.col>i.col?1:-1})},e.sort_by_col_asc=function(t){return t=t.sort(function(t,i){return t.col>i.col?1:-1})},e.sort_by_row_desc=function(t){return t=t.sort(function(t,i){return t.row+t.size_y<i.row+i.size_y?1:-1})};var r=e.prototype;return r.init=function(){this.options.resize.enabled&&this.setup_resize(),this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.set_dom_grid_width(),this.$wrapper.addClass("ready"),this.draggable(),this.options.resize.enabled&&this.resizable(),t(window).bind("resize.gridster",throttle(t.proxy(this.recalculate_faux_grid,this),200))},r.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},r.enable=function(){return this.drag_api.enable(),this},r.disable_resize=function(){return this.$el.ad
 dClass("gs-resize-disabled"),this.resize_api.disable(),this},r.enable_resize=function(){return this.$el.removeClass("gs-resize-disabled"),this.resize_api.enable(),this},r.add_widget=function(i,e,s,r,o,a,n){var h;e||(e=1),s||(s=1),!r&!o?h=this.next_position(e,s):(h={col:r,row:o,size_x:e,size_y:s},this.empty_cells(r,o,e,s));var _=t(i).attr({"data-col":h.col,"data-row":h.row,"data-sizex":e,"data-sizey":s}).addClass("gs-w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(_),this.register_widget(_),this.add_faux_rows(h.size_y),a&&this.set_widget_max_size(_,a),n&&this.set_widget_min_size(_,n),this.set_dom_grid_width(),this.set_dom_grid_height(),this.drag_api.set_limits(this.cols*this.min_widget_width),_.fadeIn()},r.set_widget_min_size=function(t,i){if(t="number"==typeof t?this.$widgets.eq(t):t,!t.length)return this;var e=t.data("coords").grid;return e.min_size_x=i[0],e.min_size_y=i[1],this},r.set_widget_max_size=function(t,i){if(t="number"==typeof t?this.$widgets.eq(t):t,
 !t.length)return this;var e=t.data("coords").grid;return e.max_size_x=i[0],e.max_size_y=i[1],this},r.add_resize_handle=function(i){var e=this.options.resize.handle_append_to;return t(this.resize_handle_tpl).appendTo(e?t(e,i):i),this},r.resize_widget=function(t,i,e,s){var r=t.coords().grid,o=r.col,a=this.options.max_cols,n=r.size_y,h=r.col,_=h;i||(i=r.size_x),e||(e=r.size_y),1/0!==a&&(i=Math.min(i,a-o+1)),e>n&&this.add_faux_rows(Math.max(e-n,0));var d=o+i-1;d>this.cols&&this.add_faux_cols(d-this.cols);var l={col:_,row:r.row,size_x:i,size_y:e};return this.mutate_widget_in_gridmap(t,r,l),this.set_dom_grid_height(),this.set_dom_grid_width(),s&&s.call(this,l.size_x,l.size_y),t},r.mutate_widget_in_gridmap=function(i,e,s){e.size_x;var r=e.size_y,o=this.get_cells_occupied(e),a=this.get_cells_occupied(s),n=[];t.each(o.cols,function(i,e){-1===t.inArray(e,a.cols)&&n.push(e)});var h=[];t.each(a.cols,function(i,e){-1===t.inArray(e,o.cols)&&h.push(e)});var _=[];t.each(o.rows,function(i,e){-1===t.
 inArray(e,a.rows)&&_.push(e)});var d=[];if(t.each(a.rows,function(i,e){-1===t.inArray(e,o.rows)&&d.push(e)}),this.remove_from_gridmap(e),h.length){var l=[s.col,s.row,s.size_x,Math.min(r,s.size_y),i];this.empty_cells.apply(this,l)}if(d.length){var c=[s.col,s.row,s.size_x,s.size_y,i];this.empty_cells.apply(this,c)}if(e.col=s.col,e.row=s.row,e.size_x=s.size_x,e.size_y=s.size_y,this.add_to_gridmap(s,i),i.removeClass("player-revert"),i.data("coords").update({width:s.size_x*this.options.widget_base_dimensions[0]+2*(s.size_x-1)*this.options.widget_margins[0],height:s.size_y*this.options.widget_base_dimensions[1]+2*(s.size_y-1)*this.options.widget_margins[1]}),i.attr({"data-col":s.col,"data-row":s.row,"data-sizex":s.size_x,"data-sizey":s.size_y}),n.length){var p=[n[0],s.row,n.length,Math.min(r,s.size_y),i];this.remove_empty_cells.apply(this,p)}if(_.length){var g=[s.col,s.row,s.size_x,s.size_y,i];this.remove_empty_cells.apply(this,g)}return this.move_widget_up(i),this},r.empty_cells=function
 (i,e,s,r,o){var a=this.widgets_below({col:i,row:e-r,size_x:s,size_y:r});return a.not(o).each(t.proxy(function(i,s){var o=t(s).coords().grid;if(e+r-1>=o.row){var a=e+r-o.row;this.move_widget_down(t(s),a)}},this)),this.set_dom_grid_height(),this},r.remove_empty_cells=function(i,e,s,r,o){var a=this.widgets_below({col:i,row:e,size_x:s,size_y:r});return a.not(o).each(t.proxy(function(i,e){this.move_widget_up(t(e),r)},this)),this.set_dom_grid_height(),this},r.next_position=function(t,i){t||(t=1),i||(i=1);for(var s,r=this.gridmap,o=r.length,a=[],n=1;o>n;n++){s=r[n].length;for(var h=1;s>=h;h++){var _=this.can_move_to({size_x:t,size_y:i},n,h);_&&a.push({col:n,row:h,size_y:i,size_x:t})}}return a.length?e.sort_by_row_and_col_asc(a)[0]:!1},r.remove_widget=function(i,e,s){var r=i instanceof t?i:t(i),o=r.coords().grid;t.isFunction(e)&&(s=e,e=!1),this.cells_occupied_by_placeholder={},this.$widgets=this.$widgets.not(r);var a=this.widgets_below(r);return this.remove_from_gridmap(o),r.fadeOut(t.proxy
 (function(){r.remove(),e||a.each(t.proxy(function(i,e){this.move_widget_up(t(e),o.size_y)},this)),this.set_dom_grid_height(),s&&s.call(this,i)},this)),this},r.remove_all_widgets=function(i){return this.$widgets.each(t.proxy(function(t,e){this.remove_widget(e,!0,i)},this)),this},r.serialize=function(i){return i||(i=this.$widgets),i.map(t.proxy(function(i,e){var s=t(e);return this.options.serialize_params(s,s.coords().grid)},this)).get()},r.serialize_changed=function(){return this.serialize(this.$changed)},r.dom_to_coords=function(t){return{col:parseInt(t.attr("data-col"),10),row:parseInt(t.attr("data-row"),10),size_x:parseInt(t.attr("data-sizex"),10)||1,size_y:parseInt(t.attr("data-sizey"),10)||1,max_size_x:parseInt(t.attr("data-max-sizex"),10)||!1,max_size_y:parseInt(t.attr("data-max-sizey"),10)||!1,min_size_x:parseInt(t.attr("data-min-sizex"),10)||!1,min_size_y:parseInt(t.attr("data-min-sizey"),10)||!1,el:t}},r.register_widget=function(i){var e=i instanceof jQuery,s=e?this.dom_to_c
 oords(i):i,r=!1;e||(i=s.el);var o=this.can_go_widget_up(s);return o&&(s.row=o,i.attr("data-row",o),this.$el.trigger("gridster:positionchanged",[s]),r=!0),this.options.avoid_overlapped_widgets&&!this.can_move_to({size_x:s.size_x,size_y:s.size_y},s.col,s.row)&&(t.extend(s,this.next_position(s.size_x,s.size_y)),i.attr({"data-col":s.col,"data-row":s.row,"data-sizex":s.size_x,"data-sizey":s.size_y}),r=!0),i.data("coords",i.coords()),i.data("coords").grid=s,this.add_to_gridmap(s,i),this.options.resize.enabled&&this.add_resize_handle(i),r},r.update_widget_position=function(t,i){return this.for_each_cell_occupied(t,function(t,e){return this.gridmap[t]?(this.gridmap[t][e]=i,void 0):this}),this},r.remove_from_gridmap=function(t){return this.update_widget_position(t,!1)},r.add_to_gridmap=function(i,e){if(this.update_widget_position(i,e||i.el),i.el){var s=this.widgets_below(i.el);s.each(t.proxy(function(i,e){this.move_widget_up(t(e))},this))}},r.draggable=function(){var i=this,e=t.extend(!0,{},
 this.options.draggable,{offset_left:this.options.widget_margins[0],offset_top:this.options.widget_margins[1],container_width:this.cols*this.min_widget_width,limit:!0,start:function(e,s){i.$widgets.filter(".player-revert").removeClass("player-revert"),i.$player=t(this),i.$helper=t(s.$helper),i.helper=!i.$helper.is(i.$player),i.on_start_drag.call(i,e,s),i.$el.trigger("gridster:dragstart")},stop:function(t,e){i.on_stop_drag.call(i,t,e),i.$el.trigger("gridster:dragstop")},drag:throttle(function(t,e){i.on_drag.call(i,t,e),i.$el.trigger("gridster:drag")},60)});return this.drag_api=this.$el.drag(e),this},r.resizable=function(){return this.resize_api=this.$el.drag({items:"."+this.options.resize.handle_class,offset_left:this.options.widget_margins[0],container_width:this.container_width,move_element:!1,resize:!0,limit:this.options.autogrow_cols?!1:!0,start:t.proxy(this.on_start_resize,this),stop:t.proxy(function(i,e){delay(t.proxy(function(){this.on_stop_resize(i,e)},this),120)},this),drag:t
 hrottle(t.proxy(this.on_resize,this),60)}),this},r.setup_resize=function(){this.resize_handle_class=this.options.resize.handle_class;var i=this.options.resize.axes,e='<span class="'+this.resize_handle_class+" "+this.resize_handle_class+'-{type}" />';return this.resize_handle_tpl=t.map(i,function(t){return e.replace("{type}",t)}).join(""),t.isArray(this.options.draggable.ignore_dragging)&&this.options.draggable.ignore_dragging.push("."+this.resize_handle_class),this},r.on_start_drag=function(i,e){this.$helper.add(this.$player).add(this.$wrapper).addClass("dragging"),this.highest_col=this.get_highest_occupied_cell().col,this.$player.addClass("player"),this.player_grid_data=this.$player.coords().grid,this.placeholder_grid_data=t.extend({},this.player_grid_data),this.set_dom_grid_height(this.$el.height()+this.player_grid_data.size_y*this.min_widget_height),this.set_dom_grid_width(this.cols);var s=this.player_grid_data.size_x,r=this.cols-this.highest_col;this.options.autogrow_cols&&s>=r&
 &this.add_faux_cols(Math.min(s-r,1));var o=this.faux_grid,a=this.$player.data("coords").coords;this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data),this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.last_cols=[],this.last_rows=[],this.collision_api=this.$helper.collision(o,this.options.collision),this.$preview_holder=t("<"+this.$player.get(0).tagName+" />",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:a.width,height:a.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,i,e)},r.on_drag=function(t,i){if(null===this.$player)return!1;var e={left:i.position.left+this.baseX,top:i.position.top+this.baseY};if(this.options.autogrow_cols){var s=this.placeholder_grid_data.col+this.placeholder_grid_data.size_x-1;s>=this.cols-1&&this.options.max_cols>=this.cols+1&&(this.add_faux_cols(1),this.set_dom_grid_width(this
 .cols+1),this.drag_api.set_limits(this.container_width)),this.collision_api.set_colliders(this.faux_grid)}this.colliders_data=this.collision_api.get_closest_colliders(e),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:i.position.left,top:i.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,t,i)},r.on_stop_drag=function(t,i){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),i.position.left=i.position.left+this.baseX,i.position.top=i.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(i.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player
 -revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.options.draggable.stop&&this.options.draggable.stop.call(this,t,i),this.$preview_holder.remove(),this.$player=null,this.$helper=null,this.placeholder_grid_data={},this.player_grid_data={},this.cells_occupied_by_placeholder={},this.cells_occupied_by_player={},this.set_dom_grid_height(),this.set_dom_grid_width(),this.options.autogrow_cols&&this.drag_api.set_limits(this.cols*this.min_widget_width)},r.on_start_resize=function(i,e){this.$resized_widget=e.$player.closest(".gs-w"),this.resize_coords=th
 is.$resized_widget.coords(),this.resize_wgd=this.resize_coords.grid,this.resize_initial_width=this.resize_coords.coords.width,this.resize_initial_height=this.resize_coords.coords.height,this.resize_initial_sizex=this.resize_coords.grid.size_x,this.resize_initial_sizey=this.resize_coords.grid.size_y,this.resize_initial_col=this.resize_coords.grid.col,this.resize_last_sizex=this.resize_initial_sizex,this.resize_last_sizey=this.resize_initial_sizey,this.resize_max_size_x=Math.min(this.resize_wgd.max_size_x||this.options.resize.max_size[0],this.options.max_cols-this.resize_initial_col+1),this.resize_max_size_y=this.resize_wgd.max_size_y||this.options.resize.max_size[1],this.resize_min_size_x=this.resize_wgd.min_size_x||this.options.resize.min_size[0]||1,this.resize_min_size_y=this.resize_wgd.min_size_y||this.options.resize.min_size[1]||1,this.resize_initial_last_col=this.get_highest_occupied_cell().col,this.set_dom_grid_width(this.cols),this.resize_dir={right:e.$player.is("."+this.resiz
 e_handle_class+"-x"),bottom:e.$player.is("."+this.resize_handle_class+"-y")},this.$resized_widget.css({"min-width":this.options.widget_base_dimensions[0],"min-height":this.options.widget_base_dimensions[1]});var s=this.$resized_widget.get(0).tagName;this.$resize_preview_holder=t("<"+s+" />",{"class":"preview-holder resize-preview-holder","data-row":this.$resized_widget.attr("data-row"),"data-col":this.$resized_widget.attr("data-col"),css:{width:this.resize_initial_width,height:this.resize_initial_height}}).appendTo(this.$el),this.$resized_widget.addClass("resizing"),this.options.resize.start&&this.options.resize.start.call(this,i,e,this.$resized_widget),this.$el.trigger("gridster:resizestart")},r.on_stop_resize=function(i,e){this.$resized_widget.removeClass("resizing").css({width:"",height:""}),delay(t.proxy(function(){this.$resize_preview_holder.remove().css({"min-width":"","min-height":""}),this.options.resize.stop&&this.options.resize.stop.call(this,i,e,this.$resized_widget),this
 .$el.trigger("gridster:resizestop")},this),300),this.set_dom_grid_width(),this.options.autogrow_cols&&this.drag_api.set_limits(this.cols*this.min_widget_width)},r.on_resize=function(t,i){var e,s=i.pointer.diff_left,r=i.pointer.diff_top,o=this.options.widget_base_dimensions[0],a=this.options.widget_base_dimensions[1],n=this.options.widget_margins[0],h=this.options.widget_margins[1],_=this.resize_max_size_x,d=this.resize_min_size_x,l=this.resize_max_size_y,c=this.resize_min_size_y,p=this.options.autogrow_cols,g=1/0,u=1/0,f=Math.ceil(s/(o+2*n)-.2),w=Math.ceil(r/(a+2*h)-.2),m=Math.max(1,this.resize_initial_sizex+f),y=Math.max(1,this.resize_initial_sizey+w),v=this.container_width/this.min_widget_width-this.resize_initial_col+1,z=v*this.min_widget_width-2*n;if(m=Math.max(Math.min(m,_),d),m=Math.min(v,m),e=_*o+2*(m-1)*n,g=Math.min(e,z),min_width=d*o+2*(m-1)*n,y=Math.max(Math.min(y,l),c),u=l*a+2*(y-1)*h,min_height=c*a+2*(y-1)*h,this.resize_dir.right?y=this.resize_initial_sizey:this.resize_d
 ir.bottom&&(m=this.resize_initial_sizex),p){var x=this.resize_initial_col+m-1;p&&x>=this.resize_initial_last_col&&(this.set_dom_grid_width(Math.max(x+1,this.cols)),x>this.cols&&this.add_faux_cols(x-this.cols))}var $={};!this.resize_dir.bottom&&($.width=Math.max(Math.min(this.resize_initial_width+s,g),min_width)),!this.resize_dir.right&&($.height=Math.max(Math.min(this.resize_initial_height+r,u),min_height)),this.$resized_widget.css($),(m!==this.resize_last_sizex||y!==this.resize_last_sizey)&&(this.resize_widget(this.$resized_widget,m,y),this.set_dom_grid_width(this.cols),this.$resize_preview_holder.css({width:"",height:""}).attr({"data-row":this.$resized_widget.attr("data-row"),"data-sizex":m,"data-sizey":y})),this.options.resize.resize&&this.options.resize.resize.call(this,t,i,this.$resized_widget),this.$el.trigger("gridster:resize"),this.resize_last_sizex=m,this.resize_last_sizey=y},r.on_overlapped_column_change=function(i,e){if(!this.colliders_data.length)return this;var s,r=this
 .get_targeted_columns(this.colliders_data[0].el.data.col),o=this.last_cols.length,a=r.length;for(s=0;a>s;s++)-1===t.inArray(r[s],this.last_cols)&&(i||t.noop).call(this,r[s]);for(s=0;o>s;s++)-1===t.inArray(this.last_cols[s],r)&&(e||t.noop).call(this,this.last_cols[s]);return this.last_cols=r,this},r.on_overlapped_row_change=function(i,e){if(!this.colliders_data.length)return this;var s,r=this.get_targeted_rows(this.colliders_data[0].el.data.row),o=this.last_rows.length,a=r.length;for(s=0;a>s;s++)-1===t.inArray(r[s],this.last_rows)&&(i||t.noop).call(this,r[s]);for(s=0;o>s;s++)-1===t.inArray(this.last_rows[s],r)&&(e||t.noop).call(this,this.last_rows[s]);this.last_rows=r},r.set_player=function(t,i,e){var s=this;e||this.empty_cells_player_occupies();var r=e?{col:t}:s.colliders_data[0].el.data,o=r.col,a=i||r.row;this.player_grid_data={col:o,row:a,size_y:this.player_grid_data.size_y,size_x:this.player_grid_data.size_x},this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_
 data);var n=this.get_widgets_overlapped(this.player_grid_data),h=this.widgets_constraints(n);if(this.manage_movements(h.can_go_up,o,a),this.manage_movements(h.can_not_go_up,o,a),!n.length){var _=this.can_go_player_up(this.player_grid_data);_!==!1&&(a=_),this.set_placeholder(o,a)}return{col:o,row:a}},r.widgets_constraints=function(i){var s,r=t([]),o=[],a=[];return i.each(t.proxy(function(i,e){var s=t(e),n=s.coords().grid;this.can_go_widget_up(n)?(r=r.add(s),o.push(n)):a.push(n)},this)),s=i.not(r),{can_go_up:e.sort_by_row_asc(o),can_not_go_up:e.sort_by_row_desc(a)}},r.manage_movements=function(i,e,s){return t.each(i,t.proxy(function(t,i){var r=i,o=r.el,a=this.can_go_widget_up(r);if(a)this.move_widget_to(o,a),this.set_placeholder(e,a+r.size_y);else{var n=this.can_go_player_up(this.player_grid_data);if(!n){var h=s+this.player_grid_data.size_y-r.row;this.move_widget_down(o,h),this.set_placeholder(e,s)}}},this)),this},r.is_player=function(t,i){if(i&&!this.gridmap[t])return!1;var e=i?this.
 gridmap[t][i]:t;return e&&(e.is(this.$player)||e.is(this.$helper))},r.is_player_in=function(i,e){var s=this.cells_occupied_by_player||{};return t.inArray(i,s.cols)>=0&&t.inArray(e,s.rows)>=0},r.is_placeholder_in=function(i,e){var s=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(i)&&t.inArray(e,s.rows)>=0},r.is_placeholder_in_col=function(i){var e=this.cells_occupied_by_placeholder||[];return t.inArray(i,e.cols)>=0},r.is_empty=function(t,i){return this.gridmap[t]!==void 0?this.gridmap[t][i]!==void 0&&this.gridmap[t][i]===!1?!0:!1:!0},r.is_occupied=function(t,i){return this.gridmap[t]?this.gridmap[t][i]?!0:!1:!1},r.is_widget=function(t,i){var e=this.gridmap[t];return e?(e=e[i],e?e:!1):!1},r.is_widget_under_player=function(t,i){return this.is_widget(t,i)?this.is_player_in(t,i):!1},r.get_widgets_under_player=function(i){i||(i=this.cells_occupied_by_player||{cols:[],rows:[]});var e=t([]);return t.each(i.cols,t.proxy(function(s,r){t.each(i.rows,t.proxy(function(t
 ,i){this.is_widget(r,i)&&(e=e.add(this.gridmap[r][i]))},this))},this)),e},r.set_placeholder=function(i,e){var s=t.extend({},this.placeholder_grid_data),r=this.widgets_below({col:s.col,row:s.row,size_y:s.size_y,size_x:s.size_x}),o=i+s.size_x-1;o>this.cols&&(i-=o-i);var a=e>this.placeholder_grid_data.row,n=this.placeholder_grid_data.col!==i;this.placeholder_grid_data.col=i,this.placeholder_grid_data.row=e,this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.$preview_holder.attr({"data-row":e,"data-col":i}),(a||n)&&r.each(t.proxy(function(e,r){this.move_widget_up(t(r),this.placeholder_grid_data.col-i+s.size_y)},this));var h=this.get_widgets_under_player(this.cells_occupied_by_placeholder);h.length&&h.each(t.proxy(function(i,r){var o=t(r);this.move_widget_down(o,e+s.size_y-o.data("coords").grid.row)},this))},r.can_go_player_up=function(t){var i=t.row+t.size_y-1,e=!0,s=[],r=1e4,o=this.get_widgets_under_player();return this.for_each_column_occupied(t
 ,function(t){var a=this.gridmap[t],n=i+1;for(s[t]=[];--n>0&&(this.is_empty(t,n)||this.is_player(t,n)||this.is_widget(t,n)&&a[n].is(o));)s[t].push(n),r=r>n?n:r;return 0===s[t].length?(e=!1,!0):(s[t].sort(function(t,i){return t-i
-}),void 0)}),e?this.get_valid_rows(t,s,r):!1},r.can_go_widget_up=function(t){var i=t.row+t.size_y-1,e=!0,s=[],r=1e4;return this.for_each_column_occupied(t,function(o){var a=this.gridmap[o];s[o]=[];for(var n=i+1;--n>0&&(!this.is_widget(o,n)||this.is_player_in(o,n)||a[n].is(t.el));)this.is_player(o,n)||this.is_placeholder_in(o,n)||this.is_player_in(o,n)||s[o].push(n),r>n&&(r=n);return 0===s[o].length?(e=!1,!0):(s[o].sort(function(t,i){return t-i}),void 0)}),e?this.get_valid_rows(t,s,r):!1},r.get_valid_rows=function(i,e,s){for(var r=i.row,o=i.row+i.size_y-1,a=i.size_y,n=s-1,h=[];o>=++n;){var _=!0;if(t.each(e,function(i,e){t.isArray(e)&&-1===t.inArray(n,e)&&(_=!1)}),_===!0&&(h.push(n),h.length===a))break}var d=!1;return 1===a?h[0]!==r&&(d=h[0]||!1):h[0]!==r&&(d=this.get_consecutive_numbers_index(h,a)),d},r.get_consecutive_numbers_index=function(t,i){for(var e=t.length,s=[],r=!0,o=-1,a=0;e>a;a++){if(r||t[a]===o+1){if(s.push(a),s.length===i)break;r=!1}else s=[],r=!0;o=t[a]}return s.length
 >=i?t[s[0]]:!1},r.get_widgets_overlapped=function(){var i=t([]),e=[],s=this.cells_occupied_by_player.rows.slice(0);return s.reverse(),t.each(this.cells_occupied_by_player.cols,t.proxy(function(r,o){t.each(s,t.proxy(function(s,r){if(!this.gridmap[o])return!0;var a=this.gridmap[o][r];this.is_occupied(o,r)&&!this.is_player(a)&&-1===t.inArray(a,e)&&(i=i.add(a),e.push(a))},this))},this)),i},r.on_start_overlapping_column=function(t){this.set_player(t,!1)},r.on_start_overlapping_row=function(t){this.set_player(!1,t)},r.on_stop_overlapping_column=function(t){this.set_player(t,!1);var i=this;this.for_each_widget_below(t,this.cells_occupied_by_player.rows[0],function(){i.move_widget_up(this,i.player_grid_data.size_y)})},r.on_stop_overlapping_row=function(t){this.set_player(!1,t);for(var i=this,e=this.cells_occupied_by_player.cols,s=0,r=e.length;r>s;s++)this.for_each_widget_below(e[s],t,function(){i.move_widget_up(this,i.player_grid_data.size_y)})},r.move_widget_to=function(i,e){var s=this,r=i
 .coords().grid;e-r.row;var o=this.widgets_below(i),a=this.can_move_to(r,r.col,e,i);return a===!1?!1:(this.remove_from_gridmap(r),r.row=e,this.add_to_gridmap(r),i.attr("data-row",e),this.$changed=this.$changed.add(i),o.each(function(i,e){var r=t(e),o=r.coords().grid,a=s.can_go_widget_up(o);a&&a!==o.row&&s.move_widget_to(r,a)}),this)},r.move_widget_up=function(i,e){var s=i.coords().grid,r=s.row,o=[];return e||(e=1),this.can_go_up(i)?(this.for_each_column_occupied(s,function(s){if(-1===t.inArray(i,o)){var a=i.coords().grid,n=r-e;if(n=this.can_go_up_to_row(a,s,n),!n)return!0;var h=this.widgets_below(i);this.remove_from_gridmap(a),a.row=n,this.add_to_gridmap(a),i.attr("data-row",a.row),this.$changed=this.$changed.add(i),o.push(i),h.each(t.proxy(function(i,s){this.move_widget_up(t(s),e)},this))}}),void 0):!1},r.move_widget_down=function(i,e){var s,r,o,a;if(0>=e)return!1;if(s=i.coords().grid,r=s.row,o=[],a=e,!i)return!1;if(-1===t.inArray(i,o)){var n=i.coords().grid,h=r+e,_=this.widgets_bel
 ow(i);this.remove_from_gridmap(n),_.each(t.proxy(function(i,e){var s=t(e),r=s.coords().grid,o=this.displacement_diff(r,n,a);o>0&&this.move_widget_down(s,o)},this)),n.row=h,this.update_widget_position(n,i),i.attr("data-row",n.row),this.$changed=this.$changed.add(i),o.push(i)}},r.can_go_up_to_row=function(i,e,s){var r,o=this.gridmap,a=!0,n=[],h=i.row;if(this.for_each_column_occupied(i,function(t){for(o[t],n[t]=[],r=h;r--&&this.is_empty(t,r)&&!this.is_placeholder_in(t,r);)n[t].push(r);return n[t].length?void 0:(a=!1,!0)}),!a)return!1;for(r=s,r=1;h>r;r++){for(var _=!0,d=0,l=n.length;l>d;d++)n[d]&&-1===t.inArray(r,n[d])&&(_=!1);if(_===!0){a=r;break}}return a},r.displacement_diff=function(t,i,e){var s=t.row,r=[],o=i.row+i.size_y;this.for_each_column_occupied(t,function(t){for(var i=0,e=o;s>e;e++)this.is_empty(t,e)&&(i+=1);r.push(i)});var a=Math.max.apply(Math,r);return e-=a,e>0?e:0},r.widgets_below=function(i){var s=t.isPlainObject(i)?i:i.coords().grid,r=this;this.gridmap;var o=s.row+s.si
 ze_y-1,a=t([]);return this.for_each_column_occupied(s,function(i){r.for_each_widget_below(i,o,function(){return r.is_player(this)||-1!==t.inArray(this,a)?void 0:(a=a.add(this),!0)})}),e.sort_by_row_asc(a)},r.set_cells_player_occupies=function(t,i){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=t,this.placeholder_grid_data.row=i,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},r.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},r.can_go_up=function(t){var i=t.coords().grid,e=i.row,s=e-1;this.gridmap;var r=!0;return 1===e?!1:(this.for_each_column_occupied(i,function(t){return this.is_widget(t,s),this.is_occupied(t,s)||this.is_player(t,s)||this.is_placeholder_in(t,s)||this.is_player_in(t,s)?(r=!1,!0):void 0}),r)},r.can_move_to=function(t,i,e,s){this.gridmap;var r=t.el,o={size_y:t.size_y,size_x:t.size_x,col:i,row:e},a=!0,n=i+t.size_x-1;return n>this.cols?!1:s&&e+t.size_y-
 1>s?!1:(this.for_each_cell_occupied(o,function(i,e){var s=this.is_widget(i,e);!s||t.el&&!s.is(r)||(a=!1)}),a)},r.get_targeted_columns=function(t){for(var i=(t||this.player_grid_data.col)+(this.player_grid_data.size_x-1),e=[],s=t;i>=s;s++)e.push(s);return e},r.get_targeted_rows=function(t){for(var i=(t||this.player_grid_data.row)+(this.player_grid_data.size_y-1),e=[],s=t;i>=s;s++)e.push(s);return e},r.get_cells_occupied=function(i){var e,s={cols:[],rows:[]};for(arguments[1]instanceof t&&(i=arguments[1].coords().grid),e=0;i.size_x>e;e++){var r=i.col+e;s.cols.push(r)}for(e=0;i.size_y>e;e++){var o=i.row+e;s.rows.push(o)}return s},r.for_each_cell_occupied=function(t,i){return this.for_each_column_occupied(t,function(e){this.for_each_row_occupied(t,function(t){i.call(this,e,t)})}),this},r.for_each_column_occupied=function(t,i){for(var e=0;t.size_x>e;e++){var s=t.col+e;i.call(this,s,t)}},r.for_each_row_occupied=function(t,i){for(var e=0;t.size_y>e;e++){var s=t.row+e;i.call(this,s,t)}},r._t
 raversing_widgets=function(i,e,s,r,o){var a=this.gridmap;if(a[s]){var n,h,_=i+"/"+e;if(arguments[2]instanceof t){var d=arguments[2].coords().grid;s=d.col,r=d.row,o=arguments[3]}var l=[],c=r,p={"for_each/above":function(){for(;c--&&!(c>0&&this.is_widget(s,c)&&-1===t.inArray(a[s][c],l)&&(n=o.call(a[s][c],s,c),l.push(a[s][c]),n)););},"for_each/below":function(){for(c=r+1,h=a[s].length;h>c&&(!this.is_widget(s,c)||-1!==t.inArray(a[s][c],l)||(n=o.call(a[s][c],s,c),l.push(a[s][c]),!n));c++);}};p[_]&&p[_].call(this)}},r.for_each_widget_above=function(t,i,e){return this._traversing_widgets("for_each","above",t,i,e),this},r.for_each_widget_below=function(t,i,e){return this._traversing_widgets("for_each","below",t,i,e),this},r.get_highest_occupied_cell=function(){for(var t,i=this.gridmap,e=i[1].length,s=[],r=[],o=i.length-1;o>=1;o--)for(t=e-1;t>=1;t--)if(this.is_widget(o,t)){s.push(t),r.push(o);break}return{col:Math.max.apply(Math,r),row:Math.max.apply(Math,s)}},r.get_widgets_from=function(i,e
 ){this.gridmap;var s=t();return i&&(s=s.add(this.$widgets.filter(function(){var e=t(this).attr("data-col");return e===i||e>i}))),e&&(s=s.add(this.$widgets.filter(function(){var i=t(this).attr("data-row");return i===e||i>e}))),s},r.set_dom_grid_height=function(t){if(t===void 0){var i=this.get_highest_occupied_cell().row;t=i*this.min_widget_height}return this.container_height=t,this.$el.css("height",this.container_height),this},r.set_dom_grid_width=function(t){t===void 0&&(t=this.get_highest_occupied_cell().col);var i=this.options.autogrow_cols?this.options.max_cols:this.cols;return t=Math.min(i,Math.max(t,this.options.min_cols)),this.container_width=t*this.min_widget_width,this.$el.css("width",this.container_width),this},r.generate_stylesheet=function(i){var s,r="",o=this.options.max_size_x||this.cols;i||(i={}),i.cols||(i.cols=this.cols),i.rows||(i.rows=this.rows),i.namespace||(i.namespace=this.options.namespace),i.widget_base_dimensions||(i.widget_base_dimensions=this.options.widget
 _base_dimensions),i.widget_margins||(i.widget_margins=this.options.widget_margins),i.min_widget_width=2*i.widget_margins[0]+i.widget_base_dimensions[0],i.min_widget_height=2*i.widget_margins[1]+i.widget_base_dimensions[1];var a=t.param(i);if(t.inArray(a,e.generated_stylesheets)>=0)return!1;for(this.generated_stylesheets.push(a),e.generated_stylesheets.push(a),s=i.cols;s>=0;s--)r+=i.namespace+' [data-col="'+(s+1)+'"] { left:'+(s*i.widget_base_dimensions[0]+s*i.widget_margins[0]+(s+1)*i.widget_margins[0])+"px; }\n";for(s=i.rows;s>=0;s--)r+=i.namespace+' [data-row="'+(s+1)+'"] { top:'+(s*i.widget_base_dimensions[1]+s*i.widget_margins[1]+(s+1)*i.widget_margins[1])+"px; }\n";for(var n=1;i.rows>=n;n++)r+=i.namespace+' [data-sizey="'+n+'"] { height:'+(n*i.widget_base_dimensions[1]+(n-1)*2*i.widget_margins[1])+"px; }\n";for(var h=1;o>=h;h++)r+=i.namespace+' [data-sizex="'+h+'"] { width:'+(h*i.widget_base_dimensions[0]+(h-1)*2*i.widget_margins[0])+"px; }\n";return this.remove_style_tags(),th
 is.add_style_tag(r)},r.add_style_tag=function(t){var i=document,e=i.createElement("style");return i.getElementsByTagName("head")[0].appendChild(e),e.setAttribute("type","text/css"),e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),this.$style_tags=this.$style_tags.add(e),this},r.remove_style_tags=function(){var i=e.generated_stylesheets,s=this.generated_stylesheets;this.$style_tags.remove(),e.generated_stylesheets=t.map(i,function(i){return-1===t.inArray(i,s)?i:void 0})},r.generate_faux_grid=function(t,i){this.faux_grid=[],this.gridmap=[];var e,s;for(e=i;e>0;e--)for(this.gridmap[e]=[],s=t;s>0;s--)this.add_faux_cell(s,e);return this},r.add_faux_cell=function(i,e){var s=t({left:this.baseX+(e-1)*this.min_widget_width,top:this.baseY+(i-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:e,row:i,original_col:e,original_row:i}).coords();return t.isArray(this.gridmap[e])||(this.gridmap[e]=[]),this.gridmap[e][i]=!1,this.faux_gr
 id.push(s),this},r.add_faux_rows=function(t){for(var i=this.rows,e=i+(t||1),s=e;s>i;s--)for(var r=this.cols;r>=1;r--)this.add_faux_cell(s,r);return this.rows=e,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},r.add_faux_cols=function(t){var i=this.cols,e=i+(t||1);e=Math.min(e,this.options.max_cols);for(var s=i+1;e>=s;s++)for(var r=this.rows;r>=1;r--)this.add_faux_cell(r,s);return this.cols=e,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},r.recalculate_faux_grid=function(){var i=this.$wrapper.width();return this.baseX=(t(window).width()-i)/2,this.baseY=this.$wrapper.offset().top,t.each(this.faux_grid,t.proxy(function(t,i){this.faux_grid[t]=i.update({left:this.baseX+(i.data.col-1)*this.min_widget_width,top:this.baseY+(i.data.row-1)*this.min_widget_height})},this)),this},r.get_widgets_from_DOM=function(){var i=this.$widgets.map(t.proxy(function(i,e){var s=t(e);return this.dom_to_coords(s)},this));i=e.sort_by_row_and_col_asc(i);var s=t(i).ma
 p(t.proxy(function(t,i){return this.register_widget(i)||null},this));return s.length&&this.$el.trigger("gridster:positionschanged"),this},r.generate_grid_and_stylesheet=function(){var i=this.$wrapper.width(),e=this.options.max_cols,s=Math.floor(i/this.min_widget_width)+this.options.extra_cols,r=this.$widgets.map(function(){return t(this).attr("data-col")}).get();r.length||(r=[0]);var o=Math.max.apply(Math,r);this.cols=Math.max(o,s,this.options.min_cols),1/0!==e&&e>=o&&this.cols>e&&(this.cols=e);var a=this.options.extra_rows;return this.$widgets.each(function(i,e){a+=+t(e).attr("data-sizey")}),this.rows=Math.max(a,this.options.min_rows),this.baseX=(t(window).width()-i)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},r.destroy=function(i){return this.$el.removeData("gridster"),t(window).unbind(".gridster"),this.drag_api&&this.drag_api.destroy(),this.remove_style_tags(),i&&this.$el.re
 move(),this},t.fn.gridster=function(i){return this.each(function(){t(this).data("gridster")||t(this).data("gridster",new e(this,i))})},e});
\ No newline at end of file


[7/8] chukwa git commit: CHUKWA-806. Replace gridster with gridstack. (Eric Yang)

Posted by ey...@apache.org.
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/js/gridstack.min.map
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/js/gridstack.min.map b/src/main/web/hicc/home/js/gridstack.min.map
new file mode 100644
index 0000000..d0cbd6d
--- /dev/null
+++ b/src/main/web/hicc/home/js/gridstack.min.map
@@ -0,0 +1 @@
+{"version":3,"sources":["../src/gridstack.js"],"names":["factory","define","amd","exports","jQuery","require","e","_","$","scope","window","obsolete","f","oldName","newName","wrapper","console","warn","apply","this","arguments","prototype","obsoleteOpts","Utils","isIntercepted","a","b","x","width","y","height","sort","nodes","dir","chain","map","node","max","value","sortBy","n","createStylesheet","id","style","document","createElement","setAttribute","styleSheet","cssText","appendChild","createTextNode","getElementsByTagName","sheet","removeStylesheet","remove","insertCSSRule","selector","rules","index","insertRule","addRule","toBool","v","toLowerCase","Boolean","_collisionNodeCheck","nn","_didCollide","bn","newY","_isAddNodeIntercepted","parseHeight","val","heightUnit","isString","match","Error","parseFloat","unit","is_intercepted","create_stylesheet","remove_stylesheet","insert_css_rule","idSeq","GridStackEngine","onchange","floatMode","items","_updateCounter","_float","_addedNode
 s","_removedNodes","batchUpdate","commit","_packNodes","_notify","getNodeDataByDOMEl","el","find","get","_fixCollisions","_sortNodes","hasLocked","locked","collisionNode","bind","moveNode","isAreaEmpty","each","i","_updating","_origY","_dirty","canBeMoved","take","_prepareNode","resizing","defaults","parseInt","autoPosition","noResize","noMove","deletedNodes","Array","slice","call","concat","getDirtyNodes","cleanNodes","filter","addNode","triggerAddEvent","maxWidth","Math","min","maxHeight","minWidth","minHeight","_id","floor","push","clone","removeNode","detachNode","without","canMoveNode","clonedNode","extend","res","getGridHeight","canBePlacedWithRespectToHeight","noPack","reduce","memo","beginUpdate","endUpdate","GridStack","opts","oneColumnMode","isAutoCellHeight","self","container","handle_class","handleClass","item_class","itemClass","placeholder_class","placeholderClass","placeholder_text","placeholderText","cell_height","cellHeight","vertical_margin","verticalMargin","min_w
 idth","static_grid","staticGrid","is_nested","isNested","always_show_resize_handle","alwaysShowResizeHandle","closest","size","attr","handle","auto","float","_class","random","toFixed","animate","resizable","autoHide","handles","draggable","scroll","appendTo","disableDrag","disableResize","rtl","removable","removeTimeout","verticalMarginUnit","cellHeightUnit","css","addClass","cellWidth","_setStaticClass","_initStyles","grid","_updateStyles","elements","_this","children","_prepareElement","setAnimation","placeholder","hide","_updateContainerHeight","_updateHeightsOnResize","throttle","onResizeHandler","_isOneColumnMode","append","trigger","resize","trashZone","data","droppable","accept","on","event","ui","_grid","_setupRemovingTimeout","_clearRemovingTimeout","acceptWidgets","draggingElement","onDrag","pos","getCellFromPixel","offset","_added","show","_beforeDragX","_beforeDragY","is","over","origNode","ceil","outerWidth","outerHeight","_temporary","out","unbind","detach","drop","re
 moveAttr","enableSelection","removeData","removeClass","_prepareElementsByNode","_triggerChangeEvent","forceTrigger","hasChanges","eventParams","length","_triggerAddEvent","_triggerRemoveEvent","_stylesId","_styles","_max","getHeight","prefix","nbRows","nbMargins","innerWidth","documentElement","clientWidth","body","_removeTimeout","setTimeout","_isAboutToRemove","clearTimeout","dragOrResize","round","position","left","top","type","_temporaryRemoved","onStartMoving","o","strictCellHeight","onEndMoving","forceNotify","nestedGrids","containment","parent","start","stop","drag","enable","addWidget","makeWidget","willItFit","removeWidget","removeAll","destroy","detachGrid","off","disable","movable","enableMove","doEnable","includeNewWidgets","enableResize","isNaN","_updateElement","callback","first","move","update","noUpdate","heightData","useOffset","containerPos","relativeLeft","relativeTop","columnWidth","rowHeight","setStatic","staticValue","staticClassName","_updateNodeWidths","oldW
 idth","newWidth","undefined","setGridWidth","gridWidth","doNotPropagate","batch_update","_fix_collisions","is_area_empty","_sort_nodes","_pack_nodes","_prepare_node","clean_nodes","get_dirty_nodes","add_node","remove_node","can_move_node","move_node","get_grid_height","begin_update","end_update","can_be_placed_with_respect_to_height","_trigger_change_event","_init_styles","_update_styles","_update_container_height","_is_one_column_mode","_prepare_element","set_animation","add_widget","make_widget","will_it_fit","remove_widget","remove_all","min_height","_update_element","cell_width","get_cell_from_pixel","set_static","_set_static_class","GridStackUI","Engine","fn","gridstack"],"mappings":";;;;;;;CAOA,SAAUA,GACN,GAAsB,kBAAXC,SAAyBA,OAAOC,IACvCD,QAAQ,SAAU,SAAU,iBAAkB,mBAAoB,kBAAmB,sBACjF,uBAAwBD,OACzB,IAAuB,mBAAZG,SAAyB,CACvC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


[5/8] chukwa git commit: CHUKWA-806. Replace gridster with gridstack. (Eric Yang)

Posted by ey...@apache.org.
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/js/jquery.gridster.js
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/js/jquery.gridster.js b/src/main/web/hicc/home/js/jquery.gridster.js
deleted file mode 100755
index 0f61c44..0000000
--- a/src/main/web/hicc/home/js/jquery.gridster.js
+++ /dev/null
@@ -1,4051 +0,0 @@
-/*! gridster.js - v0.5.6 - 2014-09-25
-* http://gridster.net/
-* Copyright (c) 2014 ducksboard; Licensed MIT */
-
-;(function(root, factory) {
-
-    if (typeof define === 'function' && define.amd) {
-        define('gridster-coords', ['jquery'], factory);
-    } else {
-       root.GridsterCoords = factory(root.$ || root.jQuery);
-    }
-
-}(this, function($) {
-    /**
-    * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)
-    * to simulate DOM elements on the screen.
-    * Coords is used by Gridster to create a faux grid with any DOM element can
-    * collide.
-    *
-    * @class Coords
-    * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left,
-    * top, width and height properties.
-    * @return {Object} Coords instance.
-    * @constructor
-    */
-    function Coords(obj) {
-        if (obj[0] && $.isPlainObject(obj[0])) {
-            this.data = obj[0];
-        }else {
-            this.el = obj;
-        }
-
-        this.isCoords = true;
-        this.coords = {};
-        this.init();
-        return this;
-    }
-
-
-    var fn = Coords.prototype;
-
-
-    fn.init = function(){
-        this.set();
-        this.original_coords = this.get();
-    };
-
-
-    fn.set = function(update, not_update_offsets) {
-        var el = this.el;
-
-        if (el && !update) {
-            this.data = el.offset();
-            this.data.width = el.width();
-            this.data.height = el.height();
-        }
-
-        if (el && update && !not_update_offsets) {
-            var offset = el.offset();
-            this.data.top = offset.top;
-            this.data.left = offset.left;
-        }
-
-        var d = this.data;
-
-        typeof d.left === 'undefined' && (d.left = d.x1);
-        typeof d.top === 'undefined' && (d.top = d.y1);
-
-        this.coords.x1 = d.left;
-        this.coords.y1 = d.top;
-        this.coords.x2 = d.left + d.width;
-        this.coords.y2 = d.top + d.height;
-        this.coords.cx = d.left + (d.width / 2);
-        this.coords.cy = d.top + (d.height / 2);
-        this.coords.width  = d.width;
-        this.coords.height = d.height;
-        this.coords.el  = el || false ;
-
-        return this;
-    };
-
-
-    fn.update = function(data){
-        if (!data && !this.el) {
-            return this;
-        }
-
-        if (data) {
-            var new_data = $.extend({}, this.data, data);
-            this.data = new_data;
-            return this.set(true, true);
-        }
-
-        this.set(true);
-        return this;
-    };
-
-
-    fn.get = function(){
-        return this.coords;
-    };
-
-    fn.destroy = function() {
-        this.el.removeData('coords');
-        delete this.el;
-    };
-
-    //jQuery adapter
-    $.fn.coords = function() {
-        if (this.data('coords') ) {
-            return this.data('coords');
-        }
-
-        var ins = new Coords(this, arguments[0]);
-        this.data('coords', ins);
-        return ins;
-    };
-
-    return Coords;
-
-}));
-
-;(function(root, factory) {
-
-    if (typeof define === 'function' && define.amd) {
-        define('gridster-collision', ['jquery', 'gridster-coords'], factory);
-    } else {
-        root.GridsterCollision = factory(root.$ || root.jQuery,
-            root.GridsterCoords);
-    }
-
-}(this, function($, Coords) {
-
-    var defaults = {
-        colliders_context: document.body,
-        overlapping_region: 'C'
-        // ,on_overlap: function(collider_data){},
-        // on_overlap_start : function(collider_data){},
-        // on_overlap_stop : function(collider_data){}
-    };
-
-
-    /**
-    * Detects collisions between a DOM element against other DOM elements or
-    * Coords objects.
-    *
-    * @class Collision
-    * @uses Coords
-    * @param {HTMLElement} el The jQuery wrapped HTMLElement.
-    * @param {HTMLElement|Array} colliders Can be a jQuery collection
-    *  of HTMLElements or an Array of Coords instances.
-    * @param {Object} [options] An Object with all options you want to
-    *        overwrite:
-    *   @param {String} [options.overlapping_region] Determines when collision
-    *    is valid, depending on the overlapped area. Values can be: 'N', 'S',
-    *    'W', 'E', 'C' or 'all'. Default is 'C'.
-    *   @param {Function} [options.on_overlap_start] Executes a function the first
-    *    time each `collider ` is overlapped.
-    *   @param {Function} [options.on_overlap_stop] Executes a function when a
-    *    `collider` is no longer collided.
-    *   @param {Function} [options.on_overlap] Executes a function when the
-    * mouse is moved during the collision.
-    * @return {Object} Collision instance.
-    * @constructor
-    */
-    function Collision(el, colliders, options) {
-        this.options = $.extend(defaults, options);
-        this.$element = el;
-        this.last_colliders = [];
-        this.last_colliders_coords = [];
-        this.set_colliders(colliders);
-
-        this.init();
-    }
-
-    Collision.defaults = defaults;
-
-    var fn = Collision.prototype;
-
-
-    fn.init = function() {
-        this.find_collisions();
-    };
-
-
-    fn.overlaps = function(a, b) {
-        var x = false;
-        var y = false;
-
-        if ((b.x1 >= a.x1 && b.x1 <= a.x2) ||
-            (b.x2 >= a.x1 && b.x2 <= a.x2) ||
-            (a.x1 >= b.x1 && a.x2 <= b.x2)
-        ) { x = true; }
-
-        if ((b.y1 >= a.y1 && b.y1 <= a.y2) ||
-            (b.y2 >= a.y1 && b.y2 <= a.y2) ||
-            (a.y1 >= b.y1 && a.y2 <= b.y2)
-        ) { y = true; }
-
-        return (x && y);
-    };
-
-
-    fn.detect_overlapping_region = function(a, b){
-        var regionX = '';
-        var regionY = '';
-
-        if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; }
-        if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; }
-        if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; }
-        if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; }
-
-        return (regionX + regionY) || 'C';
-    };
-
-
-    fn.calculate_overlapped_area_coords = function(a, b){
-        var x1 = Math.max(a.x1, b.x1);
-        var y1 = Math.max(a.y1, b.y1);
-        var x2 = Math.min(a.x2, b.x2);
-        var y2 = Math.min(a.y2, b.y2);
-
-        return $({
-            left: x1,
-            top: y1,
-             width : (x2 - x1),
-            height: (y2 - y1)
-          }).coords().get();
-    };
-
-
-    fn.calculate_overlapped_area = function(coords){
-        return (coords.width * coords.height);
-    };
-
-
-    fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){
-        var last = this.last_colliders_coords;
-
-        for (var i = 0, il = last.length; i < il; i++) {
-            if ($.inArray(last[i], new_colliders_coords) === -1) {
-                start_callback.call(this, last[i]);
-            }
-        }
-
-        for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) {
-            if ($.inArray(new_colliders_coords[j], last) === -1) {
-                stop_callback.call(this, new_colliders_coords[j]);
-            }
-
-        }
-    };
-
-
-    fn.find_collisions = function(player_data_coords){
-        var self = this;
-        var overlapping_region = this.options.overlapping_region;
-        var colliders_coords = [];
-        var colliders_data = [];
-        var $colliders = (this.colliders || this.$colliders);
-        var count = $colliders.length;
-        var player_coords = self.$element.coords()
-                             .update(player_data_coords || false).get();
-
-        while(count--){
-          var $collider = self.$colliders ?
-                           $($colliders[count]) : $colliders[count];
-          var $collider_coords_ins = ($collider.isCoords) ?
-                  $collider : $collider.coords();
-          var collider_coords = $collider_coords_ins.get();
-          var overlaps = self.overlaps(player_coords, collider_coords);
-
-          if (!overlaps) {
-            continue;
-          }
-
-          var region = self.detect_overlapping_region(
-              player_coords, collider_coords);
-
-            //todo: make this an option
-            if (region === overlapping_region || overlapping_region === 'all') {
-
-                var area_coords = self.calculate_overlapped_area_coords(
-                    player_coords, collider_coords);
-                var area = self.calculate_overlapped_area(area_coords);
-                var collider_data = {
-                    area: area,
-                    area_coords : area_coords,
-                    region: region,
-                    coords: collider_coords,
-                    player_coords: player_coords,
-                    el: $collider
-                };
-
-                if (self.options.on_overlap) {
-                    self.options.on_overlap.call(this, collider_data);
-                }
-                colliders_coords.push($collider_coords_ins);
-                colliders_data.push(collider_data);
-            }
-        }
-
-        if (self.options.on_overlap_stop || self.options.on_overlap_start) {
-            this.manage_colliders_start_stop(colliders_coords,
-                self.options.on_overlap_start, self.options.on_overlap_stop);
-        }
-
-        this.last_colliders_coords = colliders_coords;
-
-        return colliders_data;
-    };
-
-
-    fn.get_closest_colliders = function(player_data_coords){
-        var colliders = this.find_collisions(player_data_coords);
-
-        colliders.sort(function(a, b) {
-            /* if colliders are being overlapped by the "C" (center) region,
-             * we have to set a lower index in the array to which they are placed
-             * above in the grid. */
-            if (a.region === 'C' && b.region === 'C') {
-                if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) {
-                    return - 1;
-                }else{
-                    return 1;
-                }
-            }
-
-            if (a.area < b.area) {
-                return 1;
-            }
-
-            return 1;
-        });
-        return colliders;
-    };
-
-
-    fn.set_colliders = function(colliders) {
-        if (typeof colliders === 'string' || colliders instanceof $) {
-            this.$colliders = $(colliders,
-                 this.options.colliders_context).not(this.$element);
-        }else{
-            this.colliders = $(colliders);
-        }
-    };
-
-
-    //jQuery adapter
-    $.fn.collision = function(collider, options) {
-          return new Collision( this, collider, options );
-    };
-
-    return Collision;
-
-}));
-
-;(function(window, undefined) {
-
-    /* Delay, debounce and throttle functions taken from underscore.js
-     *
-     * Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and
-     * Investigative Reporters & Editors
-     *
-     * Permission is hereby granted, free of charge, to any person
-     * obtaining a copy of this software and associated documentation
-     * files (the "Software"), to deal in the Software without
-     * restriction, including without limitation the rights to use,
-     * copy, modify, merge, publish, distribute, sublicense, and/or sell
-     * copies of the Software, and to permit persons to whom the
-     * Software is furnished to do so, subject to the following
-     * conditions:
-     *
-     * The above copyright notice and this permission notice shall be
-     * included in all copies or substantial portions of the Software.
-     *
-     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-     * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-     * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-     * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-     * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-     * OTHER DEALINGS IN THE SOFTWARE.
-     */
-
-    window.delay = function(func, wait) {
-        var args = Array.prototype.slice.call(arguments, 2);
-        return setTimeout(function(){ return func.apply(null, args); }, wait);
-    };
-
-    window.debounce = function(func, wait, immediate) {
-        var timeout;
-        return function() {
-          var context = this, args = arguments;
-          var later = function() {
-            timeout = null;
-            if (!immediate) func.apply(context, args);
-          };
-          if (immediate && !timeout) func.apply(context, args);
-          clearTimeout(timeout);
-          timeout = setTimeout(later, wait);
-        };
-    };
-
-    window.throttle = function(func, wait) {
-        var context, args, timeout, throttling, more, result;
-        var whenDone = debounce(
-            function(){ more = throttling = false; }, wait);
-        return function() {
-          context = this; args = arguments;
-          var later = function() {
-            timeout = null;
-            if (more) func.apply(context, args);
-            whenDone();
-          };
-          if (!timeout) timeout = setTimeout(later, wait);
-          if (throttling) {
-            more = true;
-          } else {
-            result = func.apply(context, args);
-          }
-          whenDone();
-          throttling = true;
-          return result;
-        };
-    };
-
-})(window);
-
-;(function(root, factory) {
-
-    if (typeof define === 'function' && define.amd) {
-        define('gridster-draggable', ['jquery'], factory);
-    } else {
-        root.GridsterDraggable = factory(root.$ || root.jQuery);
-    }
-
-}(this, function($) {
-
-    var defaults = {
-        items: 'li',
-        distance: 1,
-        limit: true,
-        offset_left: 0,
-        autoscroll: true,
-        ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'], // or function
-        handle: null,
-        container_width: 0,  // 0 == auto
-        move_element: true,
-        helper: false,  // or 'clone'
-        remove_helper: true
-        // drag: function(e) {},
-        // start : function(e, ui) {},
-        // stop : function(e) {}
-    };
-
-    var $window = $(window);
-    var dir_map = { x : 'left', y : 'top' };
-    var isTouch = !!('ontouchstart' in window);
-
-    var capitalize = function(str) {
-        return str.charAt(0).toUpperCase() + str.slice(1);
-    };
-
-    var idCounter = 0;
-    var uniqId = function() {
-        return ++idCounter + '';
-    }
-
-    /**
-    * Basic drag implementation for DOM elements inside a container.
-    * Provide start/stop/drag callbacks.
-    *
-    * @class Draggable
-    * @param {HTMLElement} el The HTMLelement that contains all the widgets
-    *  to be dragged.
-    * @param {Object} [options] An Object with all options you want to
-    *        overwrite:
-    *    @param {HTMLElement|String} [options.items] Define who will
-    *     be the draggable items. Can be a CSS Selector String or a
-    *     collection of HTMLElements.
-    *    @param {Number} [options.distance] Distance in pixels after mousedown
-    *     the mouse must move before dragging should start.
-    *    @param {Boolean} [options.limit] Constrains dragging to the width of
-    *     the container
-    *    @param {Object|Function} [options.ignore_dragging] Array of node names
-    *      that sould not trigger dragging, by default is `['INPUT', 'TEXTAREA',
-    *      'SELECT', 'BUTTON']`. If a function is used return true to ignore dragging.
-    *    @param {offset_left} [options.offset_left] Offset added to the item
-    *     that is being dragged.
-    *    @param {Number} [options.drag] Executes a callback when the mouse is
-    *     moved during the dragging.
-    *    @param {Number} [options.start] Executes a callback when the drag
-    *     starts.
-    *    @param {Number} [options.stop] Executes a callback when the drag stops.
-    * @return {Object} Returns `el`.
-    * @constructor
-    */
-    function Draggable(el, options) {
-      this.options = $.extend({}, defaults, options);
-      this.$document = $(document);
-      this.$container = $(el);
-      this.$dragitems = $(this.options.items, this.$container);
-      this.is_dragging = false;
-      this.player_min_left = 0 + this.options.offset_left;
-      this.id = uniqId();
-      this.ns = '.gridster-draggable-' + this.id;
-      this.init();
-    }
-
-    Draggable.defaults = defaults;
-
-    var fn = Draggable.prototype;
-
-    fn.init = function() {
-        var pos = this.$container.css('position');
-        this.calculate_dimensions();
-        this.$container.css('position', pos === 'static' ? 'relative' : pos);
-        this.disabled = false;
-        this.events();
-
-        $(window).bind(this.nsEvent('resize'),
-            throttle($.proxy(this.calculate_dimensions, this), 200));
-    };
-
-    fn.nsEvent = function(ev) {
-        return (ev || '') + this.ns;
-    };
-
-    fn.events = function() {
-        this.pointer_events = {
-            start: this.nsEvent('touchstart') + ' ' + this.nsEvent('mousedown'),
-            move: this.nsEvent('touchmove') + ' ' + this.nsEvent('mousemove'),
-            end: this.nsEvent('touchend') + ' ' + this.nsEvent('mouseup'),
-        };
-
-        this.$container.on(this.nsEvent('selectstart'),
-            $.proxy(this.on_select_start, this));
-
-        this.$container.on(this.pointer_events.start, this.options.items,
-            $.proxy(this.drag_handler, this));
-
-        this.$document.on(this.pointer_events.end, $.proxy(function(e) {
-            this.is_dragging = false;
-            if (this.disabled) { return; }
-            this.$document.off(this.pointer_events.move);
-            if (this.drag_start) {
-                this.on_dragstop(e);
-            }
-        }, this));
-    };
-
-    fn.get_actual_pos = function($el) {
-        var pos = $el.position();
-        return pos;
-    };
-
-
-    fn.get_mouse_pos = function(e) {
-        if (e.originalEvent && e.originalEvent.touches) {
-            var oe = e.originalEvent;
-            e = oe.touches.length ? oe.touches[0] : oe.changedTouches[0];
-        }
-
-        return {
-            left: e.clientX,
-            top: e.clientY
-        };
-    };
-
-
-    fn.get_offset = function(e) {
-        e.preventDefault();
-        var mouse_actual_pos = this.get_mouse_pos(e);
-        var diff_x = Math.round(
-            mouse_actual_pos.left - this.mouse_init_pos.left);
-        var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top);
-
-        var left = Math.round(this.el_init_offset.left +
-            diff_x - this.baseX + $(window).scrollLeft() - this.win_offset_x);
-        var top = Math.round(this.el_init_offset.top +
-            diff_y - this.baseY + $(window).scrollTop() - this.win_offset_y);
-
-        if (this.options.limit) {
-            if (left > this.player_max_left) {
-                left = this.player_max_left;
-            } else if(left < this.player_min_left) {
-                left = this.player_min_left;
-            }
-        }
-
-        return {
-            position: {
-                left: left,
-                top: top
-            },
-            pointer: {
-                left: mouse_actual_pos.left,
-                top: mouse_actual_pos.top,
-                diff_left: diff_x + ($(window).scrollLeft() - this.win_offset_x),
-                diff_top: diff_y + ($(window).scrollTop() - this.win_offset_y)
-            }
-        };
-    };
-
-
-    fn.get_drag_data = function(e) {
-        var offset = this.get_offset(e);
-        offset.$player = this.$player;
-        offset.$helper = this.helper ? this.$helper : this.$player;
-
-        return offset;
-    };
-
-
-    fn.set_limits = function(container_width) {
-        container_width || (container_width = this.$container.width());
-        this.player_max_left = (container_width - this.player_width +
-            - this.options.offset_left);
-
-        this.options.container_width = container_width;
-
-        return this;
-    };
-
-
-    fn.scroll_in = function(axis, data) {
-        var dir_prop = dir_map[axis];
-
-        var area_size = 50;
-        var scroll_inc = 30;
-
-        var is_x = axis === 'x';
-        var window_size = is_x ? this.window_width : this.window_height;
-        var doc_size = is_x ? $(document).width() : $(document).height();
-        var player_size = is_x ? this.$player.width() : this.$player.height();
-
-        var next_scroll;
-        var scroll_offset = $window['scroll' + capitalize(dir_prop)]();
-        var min_window_pos = scroll_offset;
-        var max_window_pos = min_window_pos + window_size;
-
-        var mouse_next_zone = max_window_pos - area_size;  // down/right
-        var mouse_prev_zone = min_window_pos + area_size;  // up/left
-
-        var abs_mouse_pos = min_window_pos + data.pointer[dir_prop];
-
-        var max_player_pos = (doc_size - window_size + player_size);
-
-        if (abs_mouse_pos >= mouse_next_zone) {
-            next_scroll = scroll_offset + scroll_inc;
-            if (next_scroll < max_player_pos) {
-                $window['scroll' + capitalize(dir_prop)](next_scroll);
-                this['scroll_offset_' + axis] += scroll_inc;
-            }
-        }
-
-        if (abs_mouse_pos <= mouse_prev_zone) {
-            next_scroll = scroll_offset - scroll_inc;
-            if (next_scroll > 0) {
-                $window['scroll' + capitalize(dir_prop)](next_scroll);
-                this['scroll_offset_' + axis] -= scroll_inc;
-            }
-        }
-
-        return this;
-    };
-
-
-    fn.manage_scroll = function(data) {
-        this.scroll_in('x', data);
-        this.scroll_in('y', data);
-    };
-
-
-    fn.calculate_dimensions = function(e) {
-        this.window_height = $window.height();
-        this.window_width = $window.width();
-    };
-
-
-    fn.drag_handler = function(e) {
-        var node = e.target.nodeName;
-        // skip if drag is disabled, or click was not done with the mouse primary button
-        if (this.disabled || e.which !== 1 && !isTouch) {
-            return;
-        }
-
-        if (this.ignore_drag(e)) {
-            return;
-        }
-
-        var self = this;
-        var first = true;
-        this.$player = $(e.currentTarget);
-
-        this.el_init_pos = this.get_actual_pos(this.$player);
-        this.mouse_init_pos = this.get_mouse_pos(e);
-        this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;
-
-        this.$document.on(this.pointer_events.move, function(mme) {
-            var mouse_actual_pos = self.get_mouse_pos(mme);
-            var diff_x = Math.abs(
-                mouse_actual_pos.left - self.mouse_init_pos.left);
-            var diff_y = Math.abs(
-                mouse_actual_pos.top - self.mouse_init_pos.top);
-            if (!(diff_x > self.options.distance ||
-                diff_y > self.options.distance)
-                ) {
-                return false;
-            }
-
-            if (first) {
-                first = false;
-                self.on_dragstart.call(self, mme);
-                return false;
-            }
-
-            if (self.is_dragging === true) {
-                self.on_dragmove.call(self, mme);
-            }
-
-            return false;
-        });
-
-        if (!isTouch) { return false; }
-    };
-
-
-    fn.on_dragstart = function(e) {
-        e.preventDefault();
-
-        if (this.is_dragging) { return this; }
-
-        this.drag_start = this.is_dragging = true;
-        var offset = this.$container.offset();
-        this.baseX = Math.round(offset.left);
-        this.baseY = Math.round(offset.top);
-        this.initial_container_width = this.options.container_width || this.$container.width();
-
-        if (this.options.helper === 'clone') {
-            this.$helper = this.$player.clone()
-                .appendTo(this.$container).addClass('helper');
-            this.helper = true;
-        } else {
-            this.helper = false;
-        }
-
-        this.win_offset_y = $(window).scrollTop();
-        this.win_offset_x = $(window).scrollLeft();
-        this.scroll_offset_y = 0;
-        this.scroll_offset_x = 0;
-        this.el_init_offset = this.$player.offset();
-        this.player_width = this.$player.width();
-        this.player_height = this.$player.height();
-
-        this.set_limits(this.options.container_width);
-
-        if (this.options.start) {
-            this.options.start.call(this.$player, e, this.get_drag_data(e));
-        }
-        return false;
-    };
-
-
-    fn.on_dragmove = function(e) {
-        var data = this.get_drag_data(e);
-
-        this.options.autoscroll && this.manage_scroll(data);
-
-        if (this.options.move_element) {
-            (this.helper ? this.$helper : this.$player).css({
-                'position': 'absolute',
-                'left' : data.position.left,
-                'top' : data.position.top
-            });
-        }
-
-        var last_position = this.last_position || data.position;
-        data.prev_position = last_position;
-
-        if (this.options.drag) {
-            this.options.drag.call(this.$player, e, data);
-        }
-
-        this.last_position = data.position;
-        return false;
-    };
-
-
-    fn.on_dragstop = function(e) {
-        var data = this.get_drag_data(e);
-        this.drag_start = false;
-
-        if (this.options.stop) {
-            this.options.stop.call(this.$player, e, data);
-        }
-
-        if (this.helper && this.options.remove_helper) {
-            this.$helper.remove();
-        }
-
-        return false;
-    };
-
-    fn.on_select_start = function(e) {
-        if (this.disabled) { return; }
-
-        if (this.ignore_drag(e)) {
-            return;
-        }
-
-        return false;
-    };
-
-    fn.enable = function() {
-        this.disabled = false;
-    };
-
-    fn.disable = function() {
-        this.disabled = true;
-    };
-
-    fn.destroy = function() {
-        this.disable();
-
-        this.$container.off(this.ns);
-        this.$document.off(this.ns);
-        $(window).off(this.ns);
-
-        $.removeData(this.$container, 'drag');
-    };
-
-    fn.ignore_drag = function(event) {
-        if (this.options.handle) {
-            return !$(event.target).is(this.options.handle);
-        }
-
-        if ($.isFunction(this.options.ignore_dragging)) {
-            return this.options.ignore_dragging(event);
-        }
-
-        return $(event.target).is(this.options.ignore_dragging.join(', '));
-    };
-
-    //jQuery adapter
-    $.fn.drag = function ( options ) {
-        return new Draggable(this, options);
-    };
-
-    return Draggable;
-
-}));
-
-;(function(root, factory) {
-
-    if (typeof define === 'function' && define.amd) {
-        define(['jquery', 'gridster-draggable', 'gridster-collision'], factory);
-    } else {
-        root.Gridster = factory(root.$ || root.jQuery, root.GridsterDraggable,
-            root.GridsterCollision);
-    }
-
- }(this, function($, Draggable, Collision) {
-
-    var defaults = {
-        namespace: '',
-        widget_selector: 'li',
-        widget_margins: [10, 10],
-        widget_base_dimensions: [400, 225],
-        extra_rows: 0,
-        extra_cols: 0,
-        min_cols: 1,
-        max_cols: Infinity,
-        min_rows: 15,
-        max_size_x: false,
-        autogrow_cols: false,
-        autogenerate_stylesheet: true,
-        avoid_overlapped_widgets: true,
-        auto_init: true,
-        serialize_params: function($w, wgd) {
-            var url = $w.find('iframe').contents().get(0).location.href;
-            return {
-                col: wgd.col,
-                row: wgd.row,
-                size_x: wgd.size_x,
-                size_y: wgd.size_y,
-                src: url,
-            };
-        },
-        collision: {},
-        draggable: {
-            items: '.gs-w',
-            distance: 4,
-            ignore_dragging: Draggable.defaults.ignore_dragging.slice(0)
-        },
-        resize: {
-            enabled: false,
-            axes: ['both'],
-            handle_append_to: '',
-            handle_class: 'gs-resize-handle',
-            max_size: [Infinity, Infinity],
-            min_size: [1, 1]
-        },
-        header: {
-            enabled: true,
-            axes: ['both'],
-            handle_append_to: '',
-            handle_class: 'gs-header'
-        }
-    };
-
-    /**
-    * @class Gridster
-    * @uses Draggable
-    * @uses Collision
-    * @param {HTMLElement} el The HTMLelement that contains all the widgets.
-    * @param {Object} [options] An Object with all options you want to
-    *        overwrite:
-    *    @param {HTMLElement|String} [options.widget_selector] Define who will
-    *     be the draggable widgets. Can be a CSS Selector String or a
-    *     collection of HTMLElements
-    *    @param {Array} [options.widget_margins] Margin between widgets.
-    *     The first index for the horizontal margin (left, right) and
-    *     the second for the vertical margin (top, bottom).
-    *    @param {Array} [options.widget_base_dimensions] Base widget dimensions
-    *     in pixels. The first index for the width and the second for the
-    *     height.
-    *    @param {Number} [options.extra_cols] Add more columns in addition to
-    *     those that have been calculated.
-    *    @param {Number} [options.extra_rows] Add more rows in addition to
-    *     those that have been calculated.
-    *    @param {Number} [options.min_cols] The minimum required columns.
-    *    @param {Number} [options.max_cols] The maximum columns possible (set to null
-    *     for no maximum).
-    *    @param {Number} [options.min_rows] The minimum required rows.
-    *    @param {Number} [options.max_size_x] The maximum number of columns
-    *     that a widget can span.
-    *    @param {Boolean} [options.autogenerate_stylesheet] If true, all the
-    *     CSS required to position all widgets in their respective columns
-    *     and rows will be generated automatically and injected to the
-    *     `<head>` of the document. You can set this to false, and write
-    *     your own CSS targeting rows and cols via data-attributes like so:
-    *     `[data-col="1"] { left: 10px; }`
-    *    @param {Boolean} [options.avoid_overlapped_widgets] Avoid that widgets loaded
-    *     from the DOM can be overlapped. It is helpful if the positions were
-    *     bad stored in the database or if there was any conflict.
-    *    @param {Boolean} [options.auto_init] Automatically call gridster init
-    *     method or not when the plugin is instantiated.
-    *    @param {Function} [options.serialize_params] Return the data you want
-    *     for each widget in the serialization. Two arguments are passed:
-    *     `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid
-    *     coords object (`col`, `row`, `size_x`, `size_y`).
-    *    @param {Object} [options.collision] An Object with all options for
-    *     Collision class you want to overwrite. See Collision docs for
-    *     more info.
-    *    @param {Object} [options.draggable] An Object with all options for
-    *     Draggable class you want to overwrite. See Draggable docs for more
-    *     info.
-    *       @param {Object|Function} [options.draggable.ignore_dragging] Note that
-    *        if you use a Function, and resize is enabled, you should ignore the
-    *        resize handlers manually (options.resize.handle_class).
-    *    @param {Object} [options.resize] An Object with resize config options.
-    *       @param {Boolean} [options.resize.enabled] Set to true to enable
-    *        resizing.
-    *       @param {Array} [options.resize.axes] Axes in which widgets can be
-    *        resized. Possible values: ['x', 'y', 'both'].
-    *       @param {String} [options.resize.handle_append_to] Set a valid CSS
-    *        selector to append resize handles to.
-    *       @param {String} [options.resize.handle_class] CSS class name used
-    *        by resize handles.
-    *       @param {Array} [options.resize.max_size] Limit widget dimensions
-    *        when resizing. Array values should be integers:
-    *        `[max_cols_occupied, max_rows_occupied]`
-    *       @param {Array} [options.resize.min_size] Limit widget dimensions
-    *        when resizing. Array values should be integers:
-    *        `[min_cols_occupied, min_rows_occupied]`
-    *       @param {Function} [options.resize.start] Function executed
-    *        when resizing starts.
-    *       @param {Function} [otions.resize.resize] Function executed
-    *        during the resizing.
-    *       @param {Function} [options.resize.stop] Function executed
-    *        when resizing stops.
-    *
-    * @constructor
-    */
-    function Gridster(el, options) {
-        this.options = $.extend(true, {}, defaults, options);
-        this.$el = $(el);
-        this.$wrapper = this.$el.parent();
-        this.$widgets = this.$el.children(
-            this.options.widget_selector).addClass('gs-w');
-        this.widgets = [];
-        this.$changed = $([]);
-        this.wrapper_width = this.$wrapper.width();
-        this.min_widget_width = (this.options.widget_margins[0] * 2) +
-          this.options.widget_base_dimensions[0];
-        this.min_widget_height = (this.options.widget_margins[1] * 2) +
-          this.options.widget_base_dimensions[1];
-
-        this.generated_stylesheets = [];
-        this.$style_tags = $([]);
-
-        this.options.auto_init && this.init();
-    }
-
-    Gridster.defaults = defaults;
-    Gridster.generated_stylesheets = [];
-
-
-    /**
-    * Sorts an Array of grid coords objects (representing the grid coords of
-    * each widget) in ascending way.
-    *
-    * @method sort_by_row_asc
-    * @param {Array} widgets Array of grid coords objects
-    * @return {Array} Returns the array sorted.
-    */
-    Gridster.sort_by_row_asc = function(widgets) {
-        widgets = widgets.sort(function(a, b) {
-            if (!a.row) {
-                a = $(a).coords().grid;
-                b = $(b).coords().grid;
-            }
-
-           if (a.row > b.row) {
-               return 1;
-           }
-           return -1;
-        });
-
-        return widgets;
-    };
-
-
-    /**
-    * Sorts an Array of grid coords objects (representing the grid coords of
-    * each widget) placing first the empty cells upper left.
-    *
-    * @method sort_by_row_and_col_asc
-    * @param {Array} widgets Array of grid coords objects
-    * @return {Array} Returns the array sorted.
-    */
-    Gridster.sort_by_row_and_col_asc = function(widgets) {
-        widgets = widgets.sort(function(a, b) {
-           if (a.row > b.row || a.row === b.row && a.col > b.col) {
-               return 1;
-           }
-           return -1;
-        });
-
-        return widgets;
-    };
-
-
-    /**
-    * Sorts an Array of grid coords objects by column (representing the grid
-    * coords of each widget) in ascending way.
-    *
-    * @method sort_by_col_asc
-    * @param {Array} widgets Array of grid coords objects
-    * @return {Array} Returns the array sorted.
-    */
-    Gridster.sort_by_col_asc = function(widgets) {
-        widgets = widgets.sort(function(a, b) {
-           if (a.col > b.col) {
-               return 1;
-           }
-           return -1;
-        });
-
-        return widgets;
-    };
-
-
-    /**
-    * Sorts an Array of grid coords objects (representing the grid coords of
-    * each widget) in descending way.
-    *
-    * @method sort_by_row_desc
-    * @param {Array} widgets Array of grid coords objects
-    * @return {Array} Returns the array sorted.
-    */
-    Gridster.sort_by_row_desc = function(widgets) {
-        widgets = widgets.sort(function(a, b) {
-            if (a.row + a.size_y < b.row + b.size_y) {
-                return 1;
-            }
-           return -1;
-        });
-        return widgets;
-    };
-
-
-
-    /** Instance Methods **/
-
-    var fn = Gridster.prototype;
-
-    fn.init = function() {
-        this.options.resize.enabled && this.setup_resize();
-        this.options.header.enabled && this.setup_header();
-        this.generate_grid_and_stylesheet();
-        this.get_widgets_from_DOM();
-        this.set_dom_grid_height();
-        this.set_dom_grid_width();
-        this.$wrapper.addClass('ready');
-        this.draggable();
-        this.options.resize.enabled && this.resizable();
-
-        $(window).bind('resize.gridster', throttle(
-            $.proxy(this.recalculate_faux_grid, this), 200));
-    };
-
-
-    /**
-    * Disables dragging.
-    *
-    * @method disable
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.disable = function() {
-        this.$wrapper.find('.player-revert').removeClass('player-revert');
-        this.drag_api.disable();
-        return this;
-    };
-
-
-    /**
-    * Enables dragging.
-    *
-    * @method enable
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.enable = function() {
-        this.drag_api.enable();
-        return this;
-    };
-
-
-
-    /**
-    * Disables drag-and-drop widget resizing.
-    *
-    * @method disable
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.disable_resize = function() {
-        this.$el.addClass('gs-resize-disabled');
-        this.resize_api.disable();
-        return this;
-    };
-
-
-    /**
-    * Enables drag-and-drop widget resizing.
-    *
-    * @method enable
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.enable_resize = function() {
-        this.$el.removeClass('gs-resize-disabled');
-        this.resize_api.enable();
-        return this;
-    };
-
-
-    /**
-    * Add a new widget to the grid.
-    *
-    * @method add_widget
-    * @param {URI} url of the widget
-    *  or the HTMLElement.
-    * @param {Number} [size_x] The n� of rows the widget occupies horizontally.
-    * @param {Number} [size_y] The n� of columns the widget occupies vertically.
-    * @param {Number} [col] The column the widget should start in.
-    * @param {Number} [row] The row the widget should start in.
-    * @param {Array} [max_size] max_size Maximun size (in units) for width and height.
-    * @param {Array} [min_size] min_size Minimum size (in units) for width and height.
-    * @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing.
-    *  the widget that was just created.
-    */
-    fn.add_widget = function(url, size_x, size_y, col, row, max_size, min_size) {
-        var pos;
-        size_x || (size_x = 1);
-        size_y || (size_y = 1);
-
-        if (!col & !row) {
-            pos = this.next_position(size_x, size_y);
-        } else {
-            pos = {
-                col: col,
-                row: row,
-                size_x: size_x,
-                size_y: size_y
-            };
-
-            this.empty_cells(col, row, size_x, size_y);
-        }
-        var html = '<li><iframe src="'+url+'" seamless /></li>';
-        var $w = $(html).attr({
-                'data-col': pos.col,
-                'data-row': pos.row,
-                'data-sizex' : size_x,
-                'data-sizey' : size_y
-            }).addClass('gs-w').appendTo(this.$el).hide();
-
-        this.$widgets = this.$widgets.add($w);
-
-        this.register_widget($w);
-
-        this.add_faux_rows(pos.size_y);
-        //this.add_faux_cols(pos.size_x);
-
-        if (max_size) {
-            this.set_widget_max_size($w, max_size);
-        }
-
-        if (min_size) {
-            this.set_widget_min_size($w, min_size);
-        }
-
-        this.set_dom_grid_width();
-        this.set_dom_grid_height();
-
-        this.drag_api.set_limits(this.cols * this.min_widget_width);
-
-        return $w.fadeIn();
-    };
-
-
-    /**
-    * Change widget size limits.
-    *
-    * @method set_widget_min_size
-    * @param {HTMLElement|Number} $widget The jQuery wrapped HTMLElement
-    *  representing the widget or an index representing the desired widget.
-    * @param {Array} min_size Minimum size (in units) for width and height.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.set_widget_min_size = function($widget, min_size) {
-        $widget = typeof $widget === 'number' ?
-            this.$widgets.eq($widget) : $widget;
-
-        if (!$widget.length) { return this; }
-
-        var wgd = $widget.data('coords').grid;
-        wgd.min_size_x = min_size[0];
-        wgd.min_size_y = min_size[1];
-
-        return this;
-    };
-
-
-    /**
-    * Change widget size limits.
-    *
-    * @method set_widget_max_size
-    * @param {HTMLElement|Number} $widget The jQuery wrapped HTMLElement
-    *  representing the widget or an index representing the desired widget.
-    * @param {Array} max_size Maximun size (in units) for width and height.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.set_widget_max_size = function($widget, max_size) {
-        $widget = typeof $widget === 'number' ?
-            this.$widgets.eq($widget) : $widget;
-
-        if (!$widget.length) { return this; }
-
-        var wgd = $widget.data('coords').grid;
-        wgd.max_size_x = max_size[0];
-        wgd.max_size_y = max_size[1];
-
-        return this;
-    };
-
-
-    /**
-    * Append the resize handle into a widget.
-    *
-    * @method add_resize_handle
-    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement
-    *  representing the widget.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.add_resize_handle = function($w) {
-        var append_to = this.options.resize.handle_append_to;
-        $(this.resize_handle_tpl).appendTo( append_to ? $(append_to, $w) : $w);
-
-        return this;
-    };
-
-
-    /**
-    * Append the header handle into a widget.
-    *
-    * @method add_header_handle
-    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement
-    *  representing the widget.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.add_header_handle = function($w) {
-        var append_to = this.options.header.handle_append_to;
-        $(this.header_handle_tpl).appendTo( append_to ? $(append_to, $w) : $w);
-
-        return this;
-    };
-
-
-    /**
-    * Change the size of a widget. Width is limited to the current grid width.
-    *
-    * @method resize_widget
-    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement
-    *  representing the widget.
-    * @param {Number} size_x The number of columns that will occupy the widget.
-    *  By default <code>size_x</code> is limited to the space available from
-    *  the column where the widget begins, until the last column to the right.
-    * @param {Number} size_y The number of rows that will occupy the widget.
-    * @param {Function} [callback] Function executed when the widget is removed.
-    * @return {HTMLElement} Returns $widget.
-    */
-    fn.resize_widget = function($widget, size_x, size_y, callback) {
-        var wgd = $widget.coords().grid;
-        var col = wgd.col;
-        var max_cols = this.options.max_cols;
-        var old_size_y = wgd.size_y;
-        var old_col = wgd.col;
-        var new_col = old_col;
-
-        size_x || (size_x = wgd.size_x);
-        size_y || (size_y = wgd.size_y);
-
-        if (max_cols !== Infinity) {
-            size_x = Math.min(size_x, max_cols - col + 1);
-        }
-
-        if (size_y > old_size_y) {
-            this.add_faux_rows(Math.max(size_y - old_size_y, 0));
-        }
-
-        var player_rcol = (col + size_x - 1);
-        if (player_rcol > this.cols) {
-            this.add_faux_cols(player_rcol - this.cols);
-        }
-
-        var new_grid_data = {
-            col: new_col,
-            row: wgd.row,
-            size_x: size_x,
-            size_y: size_y
-        };
-
-        this.mutate_widget_in_gridmap($widget, wgd, new_grid_data);
-
-        this.set_dom_grid_height();
-        this.set_dom_grid_width();
-
-        if (callback) {
-            callback.call(this, new_grid_data.size_x, new_grid_data.size_y);
-        }
-
-        return $widget;
-    };
-
-
-    /**
-    * Mutate widget dimensions and position in the grid map.
-    *
-    * @method mutate_widget_in_gridmap
-    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement
-    *  representing the widget to mutate.
-    * @param {Object} wgd Current widget grid data (col, row, size_x, size_y).
-    * @param {Object} new_wgd New widget grid data.
-    * @return {HTMLElement} Returns instance of gridster Class.
-    */
-    fn.mutate_widget_in_gridmap = function($widget, wgd, new_wgd) {
-        var old_size_x = wgd.size_x;
-        var old_size_y = wgd.size_y;
-
-        var old_cells_occupied = this.get_cells_occupied(wgd);
-        var new_cells_occupied = this.get_cells_occupied(new_wgd);
-
-        var empty_cols = [];
-        $.each(old_cells_occupied.cols, function(i, col) {
-            if ($.inArray(col, new_cells_occupied.cols) === -1) {
-                empty_cols.push(col);
-            }
-        });
-
-        var occupied_cols = [];
-        $.each(new_cells_occupied.cols, function(i, col) {
-            if ($.inArray(col, old_cells_occupied.cols) === -1) {
-                occupied_cols.push(col);
-            }
-        });
-
-        var empty_rows = [];
-        $.each(old_cells_occupied.rows, function(i, row) {
-            if ($.inArray(row, new_cells_occupied.rows) === -1) {
-                empty_rows.push(row);
-            }
-        });
-
-        var occupied_rows = [];
-        $.each(new_cells_occupied.rows, function(i, row) {
-            if ($.inArray(row, old_cells_occupied.rows) === -1) {
-                occupied_rows.push(row);
-            }
-        });
-
-        this.remove_from_gridmap(wgd);
-
-        if (occupied_cols.length) {
-            var cols_to_empty = [
-                new_wgd.col, new_wgd.row, new_wgd.size_x, Math.min(old_size_y, new_wgd.size_y), $widget
-            ];
-            this.empty_cells.apply(this, cols_to_empty);
-        }
-
-        if (occupied_rows.length) {
-            var rows_to_empty = [new_wgd.col, new_wgd.row, new_wgd.size_x, new_wgd.size_y, $widget];
-            this.empty_cells.apply(this, rows_to_empty);
-        }
-
-        // not the same that wgd = new_wgd;
-        wgd.col = new_wgd.col;
-        wgd.row = new_wgd.row;
-        wgd.size_x = new_wgd.size_x;
-        wgd.size_y = new_wgd.size_y;
-
-        this.add_to_gridmap(new_wgd, $widget);
-
-        $widget.removeClass('player-revert');
-
-        //update coords instance attributes
-        $widget.data('coords').update({
-            width: (new_wgd.size_x * this.options.widget_base_dimensions[0] +
-                ((new_wgd.size_x - 1) * this.options.widget_margins[0]) * 2),
-            height: (new_wgd.size_y * this.options.widget_base_dimensions[1] +
-                ((new_wgd.size_y - 1) * this.options.widget_margins[1]) * 2)
-        });
-
-        $widget.attr({
-            'data-col': new_wgd.col,
-            'data-row': new_wgd.row,
-            'data-sizex': new_wgd.size_x,
-            'data-sizey': new_wgd.size_y
-        });
-
-        if (empty_cols.length) {
-            var cols_to_remove_holes = [
-                empty_cols[0], new_wgd.row,
-                empty_cols.length,
-                Math.min(old_size_y, new_wgd.size_y),
-                $widget
-            ];
-
-            this.remove_empty_cells.apply(this, cols_to_remove_holes);
-        }
-
-        if (empty_rows.length) {
-            var rows_to_remove_holes = [
-                new_wgd.col, new_wgd.row, new_wgd.size_x, new_wgd.size_y, $widget
-            ];
-            this.remove_empty_cells.apply(this, rows_to_remove_holes);
-        }
-
-        this.move_widget_up($widget);
-
-        return this;
-    };
-
-
-    /**
-    * Move down widgets in cells represented by the arguments col, row, size_x,
-    * size_y
-    *
-    * @method empty_cells
-    * @param {Number} col The column where the group of cells begin.
-    * @param {Number} row The row where the group of cells begin.
-    * @param {Number} size_x The number of columns that the group of cells
-    * occupy.
-    * @param {Number} size_y The number of rows that the group of cells
-    * occupy.
-    * @param {HTMLElement} $exclude Exclude widgets from being moved.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.empty_cells = function(col, row, size_x, size_y, $exclude) {
-        var $nexts = this.widgets_below({
-                col: col,
-                row: row - size_y,
-                size_x: size_x,
-                size_y: size_y
-            });
-
-        $nexts.not($exclude).each($.proxy(function(i, w) {
-            var wgd = $(w).coords().grid;
-            if ( !(wgd.row <= (row + size_y - 1))) { return; }
-            var diff =  (row + size_y) - wgd.row;
-            this.move_widget_down($(w), diff);
-        }, this));
-
-        this.set_dom_grid_height();
-
-        return this;
-    };
-
-
-    /**
-    * Move up widgets below cells represented by the arguments col, row, size_x,
-    * size_y.
-    *
-    * @method remove_empty_cells
-    * @param {Number} col The column where the group of cells begin.
-    * @param {Number} row The row where the group of cells begin.
-    * @param {Number} size_x The number of columns that the group of cells
-    * occupy.
-    * @param {Number} size_y The number of rows that the group of cells
-    * occupy.
-    * @param {HTMLElement} exclude Exclude widgets from being moved.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.remove_empty_cells = function(col, row, size_x, size_y, exclude) {
-        var $nexts = this.widgets_below({
-            col: col,
-            row: row,
-            size_x: size_x,
-            size_y: size_y
-        });
-
-        $nexts.not(exclude).each($.proxy(function(i, widget) {
-            this.move_widget_up( $(widget), size_y );
-        }, this));
-
-        this.set_dom_grid_height();
-
-        return this;
-    };
-
-
-    /**
-    * Get the most left column below to add a new widget.
-    *
-    * @method next_position
-    * @param {Number} size_x The n� of rows the widget occupies horizontally.
-    * @param {Number} size_y The n� of columns the widget occupies vertically.
-    * @return {Object} Returns a grid coords object representing the future
-    *  widget coords.
-    */
-    fn.next_position = function(size_x, size_y) {
-        size_x || (size_x = 1);
-        size_y || (size_y = 1);
-        var ga = this.gridmap;
-        var cols_l = ga.length;
-        var valid_pos = [];
-        var rows_l;
-
-        for (var c = 1; c < cols_l; c++) {
-            rows_l = ga[c].length;
-            for (var r = 1; r <= rows_l; r++) {
-                var can_move_to = this.can_move_to({
-                    size_x: size_x,
-                    size_y: size_y
-                }, c, r);
-
-                if (can_move_to) {
-                    valid_pos.push({
-                        col: c,
-                        row: r,
-                        size_y: size_y,
-                        size_x: size_x
-                    });
-                }
-            }
-        }
-
-        if (valid_pos.length) {
-            return Gridster.sort_by_row_and_col_asc(valid_pos)[0];
-        }
-        return false;
-    };
-
-
-    /**
-    * Remove a widget from the grid.
-    *
-    * @method remove_widget
-    * @param {HTMLElement} el The jQuery wrapped HTMLElement you want to remove.
-    * @param {Boolean|Function} silent If true, widgets below the removed one
-    * will not move up. If a Function is passed it will be used as callback.
-    * @param {Function} callback Function executed when the widget is removed.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.remove_widget = function(el, silent, callback) {
-        var $el = el instanceof $ ? el : $(el);
-        var wgd = $el.coords().grid;
-
-        // if silent is a function assume it's a callback
-        if ($.isFunction(silent)) {
-            callback = silent;
-            silent = false;
-        }
-
-        this.cells_occupied_by_placeholder = {};
-        this.$widgets = this.$widgets.not($el);
-
-        var $nexts = this.widgets_below($el);
-
-        this.remove_from_gridmap(wgd);
-
-        $el.fadeOut($.proxy(function() {
-            $el.remove();
-
-            if (!silent) {
-                $nexts.each($.proxy(function(i, widget) {
-                    this.move_widget_up( $(widget), wgd.size_y );
-                }, this));
-            }
-
-            this.set_dom_grid_height();
-
-            if (callback) {
-                callback.call(this, el);
-            }
-        }, this));
-
-        return this;
-    };
-
-
-    /**
-    * Remove all widgets from the grid.
-    *
-    * @method remove_all_widgets
-    * @param {Function} callback Function executed for each widget removed.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.remove_all_widgets = function(callback) {
-        this.$widgets.each($.proxy(function(i, el){
-              this.remove_widget(el, true, callback);
-        }, this));
-
-        return this;
-    };
-
-
-    /**
-    * Returns a serialized array of the widgets in the grid.
-    *
-    * @method serialize
-    * @param {HTMLElement} [$widgets] The collection of jQuery wrapped
-    *  HTMLElements you want to serialize. If no argument is passed all widgets
-    *  will be serialized.
-    * @return {Array} Returns an Array of Objects with the data specified in
-    *  the serialize_params option.
-    */
-    fn.serialize = function($widgets) {
-        $widgets || ($widgets = this.$widgets);
-
-        return $widgets.map($.proxy(function(i, widget) {
-            var $w = $(widget);
-            return this.options.serialize_params($w, $w.coords().grid);
-        }, this)).get();
-    };
-
-
-    /**
-    * Returns a serialized array of the widgets that have changed their
-    *  position.
-    *
-    * @method serialize_changed
-    * @return {Array} Returns an Array of Objects with the data specified in
-    *  the serialize_params option.
-    */
-    fn.serialize_changed = function() {
-        return this.serialize(this.$changed);
-    };
-
-
-    /**
-    * Convert widgets from DOM elements to "widget grid data" Objects.
-    *
-    * @method dom_to_coords
-    * @param {HTMLElement} $widget The widget to be converted.
-    */
-    fn.dom_to_coords = function($widget) {
-        return {
-            'col': parseInt($widget.attr('data-col'), 10),
-            'row': parseInt($widget.attr('data-row'), 10),
-            'size_x': parseInt($widget.attr('data-sizex'), 10) || 1,
-            'size_y': parseInt($widget.attr('data-sizey'), 10) || 1,
-            'max_size_x': parseInt($widget.attr('data-max-sizex'), 10) || false,
-            'max_size_y': parseInt($widget.attr('data-max-sizey'), 10) || false,
-            'min_size_x': parseInt($widget.attr('data-min-sizex'), 10) || false,
-            'min_size_y': parseInt($widget.attr('data-min-sizey'), 10) || false,
-            'el': $widget
-        };
-    };
-
-
-    /**
-    * Creates the grid coords object representing the widget an add it to the
-    * mapped array of positions.
-    *
-    * @method register_widget
-    * @param {HTMLElement|Object} $el jQuery wrapped HTMLElement representing
-    *  the widget, or an "widget grid data" Object with (col, row, el ...).
-    * @return {Boolean} Returns true if the widget final position is different
-    *  than the original.
-    */
-    fn.register_widget = function($el) {
-        var isDOM = $el instanceof jQuery;
-        var wgd = isDOM ? this.dom_to_coords($el) : $el;
-        var posChanged = false;
-        isDOM || ($el = wgd.el);
-
-        var empty_upper_row = this.can_go_widget_up(wgd);
-        if (empty_upper_row) {
-            wgd.row = empty_upper_row;
-            $el.attr('data-row', empty_upper_row);
-            this.$el.trigger('gridster:positionchanged', [wgd]);
-            posChanged = true;
-        }
-
-        if (this.options.avoid_overlapped_widgets &&
-            !this.can_move_to(
-             {size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row)
-        ) {
-            $.extend(wgd, this.next_position(wgd.size_x, wgd.size_y));
-            $el.attr({
-                'data-col': wgd.col,
-                'data-row': wgd.row,
-                'data-sizex': wgd.size_x,
-                'data-sizey': wgd.size_y
-            });
-            posChanged = true;
-        }
-
-        // attach Coord object to player data-coord attribute
-        $el.data('coords', $el.coords());
-        // Extend Coord object with grid position info
-        $el.data('coords').grid = wgd;
-
-        this.add_to_gridmap(wgd, $el);
-
-        this.options.resize.enabled && this.add_resize_handle($el);
-        this.options.header.enabled && this.add_header_handle($el);
-
-        return posChanged;
-    };
-
-
-    /**
-    * Update in the mapped array of positions the value of cells represented by
-    * the grid coords object passed in the `grid_data` param.
-    *
-    * @param {Object} grid_data The grid coords object representing the cells
-    *  to update in the mapped array.
-    * @param {HTMLElement|Boolean} value Pass `false` or the jQuery wrapped
-    *  HTMLElement, depends if you want to delete an existing position or add
-    *  a new one.
-    * @method update_widget_position
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.update_widget_position = function(grid_data, value) {
-        this.for_each_cell_occupied(grid_data, function(col, row) {
-            if (!this.gridmap[col]) { return this; }
-            this.gridmap[col][row] = value;
-        });
-        return this;
-    };
-
-
-    /**
-    * Remove a widget from the mapped array of positions.
-    *
-    * @method remove_from_gridmap
-    * @param {Object} grid_data The grid coords object representing the cells
-    *  to update in the mapped array.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.remove_from_gridmap = function(grid_data) {
-        return this.update_widget_position(grid_data, false);
-    };
-
-
-    /**
-    * Add a widget to the mapped array of positions.
-    *
-    * @method add_to_gridmap
-    * @param {Object} grid_data The grid coords object representing the cells
-    *  to update in the mapped array.
-    * @param {HTMLElement|Boolean} value The value to set in the specified
-    *  position .
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.add_to_gridmap = function(grid_data, value) {
-        this.update_widget_position(grid_data, value || grid_data.el);
-
-        if (grid_data.el) {
-            var $widgets = this.widgets_below(grid_data.el);
-            $widgets.each($.proxy(function(i, widget) {
-                this.move_widget_up( $(widget));
-            }, this));
-        }
-    };
-
-
-    /**
-    * Make widgets draggable.
-    *
-    * @uses Draggable
-    * @method draggable
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.draggable = function() {
-        var self = this;
-        var draggable_options = $.extend(true, {}, this.options.draggable, {
-            offset_left: this.options.widget_margins[0],
-            offset_top: this.options.widget_margins[1],
-            container_width: this.cols * this.min_widget_width,
-            limit: true,
-            start: function(event, ui) {
-                self.$widgets.filter('.player-revert')
-                    .removeClass('player-revert');
-
-                self.$player = $(this);
-                self.$helper = $(ui.$helper);
-
-                self.helper = !self.$helper.is(self.$player);
-
-                self.on_start_drag.call(self, event, ui);
-                self.$el.trigger('gridster:dragstart');
-            },
-            stop: function(event, ui) {
-                self.on_stop_drag.call(self, event, ui);
-                self.$el.trigger('gridster:dragstop');
-            },
-            drag: throttle(function(event, ui) {
-                self.on_drag.call(self, event, ui);
-                self.$el.trigger('gridster:drag');
-            }, 60)
-          });
-
-        this.drag_api = this.$el.drag(draggable_options);
-        return this;
-    };
-
-
-    /**
-    * Bind resize events to get resize working.
-    *
-    * @method resizable
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.resizable = function() {
-        this.resize_api = this.$el.drag({
-            items: '.' + this.options.resize.handle_class,
-            offset_left: this.options.widget_margins[0],
-            container_width: this.container_width,
-            move_element: false,
-            resize: true,
-            limit: this.options.autogrow_cols ? false : true,
-            start: $.proxy(this.on_start_resize, this),
-            stop: $.proxy(function(event, ui) {
-                delay($.proxy(function() {
-                    this.on_stop_resize(event, ui);
-                }, this), 120);
-            }, this),
-            drag: throttle($.proxy(this.on_resize, this), 60)
-        });
-
-        return this;
-    };
-
-
-    /**
-    * Setup things required for resizing. Like build templates for drag handles.
-    *
-    * @method setup_resize
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.setup_resize = function() {
-        this.resize_handle_class = this.options.resize.handle_class;
-        var axes = this.options.resize.axes;
-        var handle_tpl = '<span class="' + this.resize_handle_class + ' ' +
-            this.resize_handle_class + '-{type}" />';
-
-        this.resize_handle_tpl = $.map(axes, function(type) {
-            return handle_tpl.replace('{type}', type);
-        }).join('');
-
-        if ($.isArray(this.options.draggable.ignore_dragging)) {
-            this.options.draggable.ignore_dragging.push(
-                '.' + this.resize_handle_class);
-        }
-
-        return this;
-    };
-
-
-    /**
-    * Setup header required for dragging, zoom, and close handles.
-    *
-    * @method setup_header
-    * @return {Class} Returns instance of gridster Class.
-    */
-    fn.setup_header = function() {
-        this.header_handle_class = this.options.header.handle_class;
-        var axes = this.options.header.axes;
-        var handle_tpl = '<header class="gs-header">'+
-            '<span class="gs-icon gs-close-handle" onClick="remove_widget(this);"></span>' +
-            '<span class="gs-icon gs-zoom-handle" onClick="zoom_widget(this);"></span>' +
-            '</header><div class="overlay_fix"/>';
-
-        this.header_handle_tpl = $.map(axes, function(type) {
-            return handle_tpl;
-        }).join('');
-
-        return this;
-    };
-
-    /**
-    * This function is executed when the player begins to be dragged.
-    *
-    * @method on_start_drag
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_start_drag = function(event, ui) {
-        this.$helper.add(this.$player).add(this.$wrapper).addClass('dragging');
-
-        this.highest_col = this.get_highest_occupied_cell().col;
-
-        this.$player.addClass('player');
-        this.player_grid_data = this.$player.coords().grid;
-        this.placeholder_grid_data = $.extend({}, this.player_grid_data);
-
-        this.set_dom_grid_height(this.$el.height() +
-            (this.player_grid_data.size_y * this.min_widget_height));
-
-        this.set_dom_grid_width(this.cols);
-
-        var pgd_sizex = this.player_grid_data.size_x;
-        var cols_diff = this.cols - this.highest_col;
-
-        if (this.options.autogrow_cols && cols_diff <= pgd_sizex) {
-            this.add_faux_cols(Math.min(pgd_sizex - cols_diff, 1));
-        }
-
-        var colliders = this.faux_grid;
-        var coords = this.$player.data('coords').coords;
-
-        this.cells_occupied_by_player = this.get_cells_occupied(
-            this.player_grid_data);
-        this.cells_occupied_by_placeholder = this.get_cells_occupied(
-            this.placeholder_grid_data);
-
-        this.last_cols = [];
-        this.last_rows = [];
-
-        // see jquery.collision.js
-        this.collision_api = this.$helper.collision(
-            colliders, this.options.collision);
-
-        this.$preview_holder = $('<' + this.$player.get(0).tagName + ' />', {
-              'class': 'preview-holder',
-              'data-row': this.$player.attr('data-row'),
-              'data-col': this.$player.attr('data-col'),
-              css: {
-                  width: coords.width,
-                  height: coords.height
-              }
-        }).appendTo(this.$el);
-
-        if (this.options.draggable.start) {
-          this.options.draggable.start.call(this, event, ui);
-        }
-    };
-
-
-    /**
-    * This function is executed when the player is being dragged.
-    *
-    * @method on_drag
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_drag = function(event, ui) {
-        //break if dragstop has been fired
-        if (this.$player === null) {
-            return false;
-        }
-
-        var abs_offset = {
-            left: ui.position.left + this.baseX,
-            top: ui.position.top + this.baseY
-        };
-
-        // auto grow cols
-        if (this.options.autogrow_cols) {
-            var prcol = this.placeholder_grid_data.col +
-                this.placeholder_grid_data.size_x - 1;
-
-            // "- 1" due to adding at least 1 column in on_start_drag
-            if (prcol >= this.cols - 1 && this.options.max_cols >= this.cols + 1) {
-                this.add_faux_cols(1);
-                this.set_dom_grid_width(this.cols + 1);
-                this.drag_api.set_limits(this.container_width);
-            }
-
-            this.collision_api.set_colliders(this.faux_grid);
-        }
-
-        this.colliders_data = this.collision_api.get_closest_colliders(
-            abs_offset);
-
-        this.on_overlapped_column_change(
-            this.on_start_overlapping_column, this.on_stop_overlapping_column);
-
-        this.on_overlapped_row_change(
-            this.on_start_overlapping_row, this.on_stop_overlapping_row);
-
-
-        if (this.helper && this.$player) {
-            this.$player.css({
-                'left': ui.position.left,
-                'top': ui.position.top
-            });
-        }
-
-        if (this.options.draggable.drag) {
-            this.options.draggable.drag.call(this, event, ui);
-        }
-    };
-
-
-    /**
-    * This function is executed when the player stops being dragged.
-    *
-    * @method on_stop_drag
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_stop_drag = function(event, ui) {
-        this.$helper.add(this.$player).add(this.$wrapper)
-            .removeClass('dragging');
-
-        ui.position.left = ui.position.left + this.baseX;
-        ui.position.top = ui.position.top + this.baseY;
-        this.colliders_data = this.collision_api.get_closest_colliders(
-            ui.position);
-
-        this.on_overlapped_column_change(
-            this.on_start_overlapping_column,
-            this.on_stop_overlapping_column
-        );
-
-        this.on_overlapped_row_change(
-            this.on_start_overlapping_row,
-            this.on_stop_overlapping_row
-        );
-
-        this.$player.addClass('player-revert').removeClass('player')
-            .attr({
-                'data-col': this.placeholder_grid_data.col,
-                'data-row': this.placeholder_grid_data.row
-            }).css({
-                'left': '',
-                'top': ''
-            });
-
-        this.$changed = this.$changed.add(this.$player);
-
-        this.cells_occupied_by_player = this.get_cells_occupied(
-            this.placeholder_grid_data);
-        this.set_cells_player_occupies(
-            this.placeholder_grid_data.col, this.placeholder_grid_data.row);
-
-        this.$player.coords().grid.row = this.placeholder_grid_data.row;
-        this.$player.coords().grid.col = this.placeholder_grid_data.col;
-
-        if (this.options.draggable.stop) {
-          this.options.draggable.stop.call(this, event, ui);
-        }
-
-        this.$preview_holder.remove();
-
-        this.$player = null;
-        this.$helper = null;
-        this.placeholder_grid_data = {};
-        this.player_grid_data = {};
-        this.cells_occupied_by_placeholder = {};
-        this.cells_occupied_by_player = {};
-
-        this.set_dom_grid_height();
-        this.set_dom_grid_width();
-
-        if (this.options.autogrow_cols) {
-            this.drag_api.set_limits(this.cols * this.min_widget_width);
-        }
-    };
-
-
-    /**
-    * This function is executed every time a widget starts to be resized.
-    *
-    * @method on_start_resize
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_start_resize = function(event, ui) {
-        this.$resized_widget = ui.$player.closest('.gs-w');
-        this.resize_coords = this.$resized_widget.coords();
-        this.resize_wgd = this.resize_coords.grid;
-        this.resize_initial_width = this.resize_coords.coords.width;
-        this.resize_initial_height = this.resize_coords.coords.height;
-        this.resize_initial_sizex = this.resize_coords.grid.size_x;
-        this.resize_initial_sizey = this.resize_coords.grid.size_y;
-        this.resize_initial_col = this.resize_coords.grid.col;
-        this.resize_last_sizex = this.resize_initial_sizex;
-        this.resize_last_sizey = this.resize_initial_sizey;
-
-        this.resize_max_size_x = Math.min(this.resize_wgd.max_size_x ||
-            this.options.resize.max_size[0],
-            this.options.max_cols - this.resize_initial_col + 1);
-        this.resize_max_size_y = this.resize_wgd.max_size_y ||
-            this.options.resize.max_size[1];
-
-        this.resize_min_size_x = (this.resize_wgd.min_size_x ||
-            this.options.resize.min_size[0] || 1);
-        this.resize_min_size_y = (this.resize_wgd.min_size_y ||
-            this.options.resize.min_size[1] || 1);
-
-        this.resize_initial_last_col = this.get_highest_occupied_cell().col;
-
-        this.set_dom_grid_width(this.cols);
-
-        this.resize_dir = {
-            right: ui.$player.is('.' + this.resize_handle_class + '-x'),
-            bottom: ui.$player.is('.' + this.resize_handle_class + '-y')
-        };
-
-        this.$resized_widget.css({
-            'min-width': this.options.widget_base_dimensions[0],
-            'min-height': this.options.widget_base_dimensions[1]
-        });
-
-        var nodeName = this.$resized_widget.get(0).tagName;
-        this.$resize_preview_holder = $('<' + nodeName + ' />', {
-              'class': 'preview-holder resize-preview-holder',
-              'data-row': this.$resized_widget.attr('data-row'),
-              'data-col': this.$resized_widget.attr('data-col'),
-              'css': {
-                  'width': this.resize_initial_width,
-                  'height': this.resize_initial_height
-              }
-        }).appendTo(this.$el);
-
-        this.$resized_widget.addClass('resizing');
-
-        if (this.options.resize.start) {
-            this.options.resize.start.call(this, event, ui, this.$resized_widget);
-        }
-
-        this.$el.trigger('gridster:resizestart');
-    };
-
-
-    /**
-    * This function is executed every time a widget stops being resized.
-    *
-    * @method on_stop_resize
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_stop_resize = function(event, ui) {
-        this.$resized_widget
-            .removeClass('resizing')
-            .css({
-                'width': '',
-                'height': ''
-            });
-
-        delay($.proxy(function() {
-            this.$resize_preview_holder
-                .remove()
-                .css({
-                    'min-width': '',
-                    'min-height': ''
-                });
-
-            if (this.options.resize.stop) {
-                this.options.resize.stop.call(this, event, ui, this.$resized_widget);
-            }
-
-            this.$el.trigger('gridster:resizestop');
-        }, this), 300);
-
-        this.set_dom_grid_width();
-
-        if (this.options.autogrow_cols) {
-            this.drag_api.set_limits(this.cols * this.min_widget_width);
-        }
-    };
-
-
-    /**
-    * This function is executed when a widget is being resized.
-    *
-    * @method on_resize
-    * @param {Event} event The original browser event
-    * @param {Object} ui A prepared ui object with useful drag-related data
-    */
-    fn.on_resize = function(event, ui) {
-        var rel_x = (ui.pointer.diff_left);
-        var rel_y = (ui.pointer.diff_top);
-        var wbd_x = this.options.widget_base_dimensions[0];
-        var wbd_y = this.options.widget_base_dimensions[1];
-        var margin_x = this.options.widget_margins[0];
-        var margin_y = this.options.widget_margins[1];
-        var max_size_x = this.resize_max_size_x;
-        var min_size_x = this.resize_min_size_x;
-        var max_size_y = this.resize_max_size_y;
-        var min_size_y = this.resize_min_size_y;
-        var autogrow = this.options.autogrow_cols;
-        var width;
-        var max_width = Infinity;
-        var max_height = Infinity;
-
-        var inc_units_x = Math.ceil((rel_x / (wbd_x + margin_x * 2)) - 0.2);
-        var inc_units_y = Math.ceil((rel_y / (wbd_y + margin_y * 2)) - 0.2);
-
-        var size_x = Math.max(1, this.resize_initial_sizex + inc_units_x);
-        var size_y = Math.max(1, this.resize_initial_sizey + inc_units_y);
-
-        var max_cols = (this.container_width / this.min_widget_width) -
-            this.resize_initial_col + 1;
-        var limit_width = ((max_cols * this.min_widget_width) - margin_x * 2);
-
-        size_x = Math.max(Math.min(size_x, max_size_x), min_size_x);
-        size_x = Math.min(max_cols, size_x);
-        width = (max_size_x * wbd_x) + ((size_x - 1) * margin_x * 2);
-        max_width = Math.min(width, limit_width);
-        min_width = (min_size_x * wbd_x) + ((size_x - 1) * margin_x * 2);
-
-        size_y = Math.max(Math.min(size_y, max_size_y), min_size_y);
-        max_height = (max_size_y * wbd_y) + ((size_y - 1) * margin_y * 2);
-        min_height = (min_size_y * wbd_y) + ((size_y - 1) * margin_y * 2);
-
-        if (this.resize_dir.right) {
-            size_y = this.resize_initial_sizey;
-        } else if (this.resize_dir.bottom) {
-            size_x = this.resize_initial_sizex;
-        }
-
-        if (autogrow) {
-            var last_widget_col = this.resize_initial_col + size_x - 1;
-            if (autogrow && this.resize_initial_last_col <= last_widget_col) {
-                this.set_dom_grid_width(Math.max(last_widget_col + 1, this.cols));
-
-                if (this.cols < last_widget_col) {
-                    this.add_faux_cols(last_widget_col - this.cols);
-                }
-            }
-        }
-
-        var css_props = {};
-        !this.resize_dir.bottom && (css_props.width = Math.max(Math.min(
-            this.resize_initial_width + rel_x, max_width), min_width));
-        !this.resize_dir.right && (css_props.height = Math.max(Math.min(
-            this.resize_initial_height + rel_y, max_height), min_height));
-
-        this.$resized_widget.css(css_props);
-
-        if (size_x !== this.resize_last_sizex ||
-            size_y !== this.resize_last_sizey) {
-
-            this.resize_widget(this.$resized_widget, size_x, size_y);
-            this.set_dom_grid_width(this.cols);
-
-            this.$resize_preview_holder.css({
-                'width': '',
-                'height': ''
-            }).attr({
-                'data-row': this.$resized_widget.attr('data-row'),
-                'data-sizex': size_x,
-                'data-sizey': size_y
-            });
-        }
-
-        if (this.options.resize.resize) {
-            this.options.resize.resize.call(this, event, ui, this.$resized_widget);
-        }
-
-        this.$el.trigger('gridster:resize');
-
-        this.resize_last_sizex = size_x;
-        this.resize_last_sizey = size_y;
-    };
-
-
-    /**
-    * Executes the callbacks passed as arguments when a column begins to be
-    * overlapped or stops being overlapped.
-    *
-    * @param {Function} start_callback Function executed when a new column
-    *  begins to be overlapped. The column is passed as first argument.
-    * @param {Function} stop_callback Function executed when a column stops
-    *  being overlapped. The column is passed as first argument.
-    * @method on_overlapped_column_change
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.on_overlapped_column_change = function(start_callback, stop_callback) {
-        if (!this.colliders_data.length) {
-            return this;
-        }
-        var cols = this.get_targeted_columns(
-            this.colliders_data[0].el.data.col);
-
-        var last_n_cols = this.last_cols.length;
-        var n_cols = cols.length;
-        var i;
-
-        for (i = 0; i < n_cols; i++) {
-            if ($.inArray(cols[i], this.last_cols) === -1) {
-                (start_callback || $.noop).call(this, cols[i]);
-            }
-        }
-
-        for (i = 0; i< last_n_cols; i++) {
-            if ($.inArray(this.last_cols[i], cols) === -1) {
-                (stop_callback || $.noop).call(this, this.last_cols[i]);
-            }
-        }
-
-        this.last_cols = cols;
-
-        return this;
-    };
-
-
-    /**
-    * Executes the callbacks passed as arguments when a row starts to be
-    * overlapped or stops being overlapped.
-    *
-    * @param {Function} start_callback Function executed when a new row begins
-    *  to be overlapped. The row is passed as first argument.
-    * @param {Function} end_callback Function executed when a row stops being
-    *  overlapped. The row is passed as first argument.
-    * @method on_overlapped_row_change
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.on_overlapped_row_change = function(start_callback, end_callback) {
-        if (!this.colliders_data.length) {
-            return this;
-        }
-        var rows = this.get_targeted_rows(this.colliders_data[0].el.data.row);
-        var last_n_rows = this.last_rows.length;
-        var n_rows = rows.length;
-        var i;
-
-        for (i = 0; i < n_rows; i++) {
-            if ($.inArray(rows[i], this.last_rows) === -1) {
-                (start_callback || $.noop).call(this, rows[i]);
-            }
-        }
-
-        for (i = 0; i < last_n_rows; i++) {
-            if ($.inArray(this.last_rows[i], rows) === -1) {
-                (end_callback || $.noop).call(this, this.last_rows[i]);
-            }
-        }
-
-        this.last_rows = rows;
-    };
-
-
-    /**
-    * Sets the current position of the player
-    *
-    * @param {Number} col
-    * @param {Number} row
-    * @param {Boolean} no_player
-    * @method set_player
-    * @return {object}
-    */
-    fn.set_player = function(col, row, no_player) {
-        var self = this;
-        if (!no_player) {
-            this.empty_cells_player_occupies();
-        }
-        var cell = !no_player ? self.colliders_data[0].el.data : {col: col};
-        var to_col = cell.col;
-        var to_row = row || cell.row;
-
-        this.player_grid_data = {
-            col: to_col,
-            row: to_row,
-            size_y : this.player_grid_data.size_y,
-            size_x : this.player_grid_data.size_x
-        };
-
-        this.cells_occupied_by_player = this.get_cells_occupied(
-            this.player_grid_data);
-
-        var $overlapped_widgets = this.get_widgets_overlapped(
-            this.player_grid_data);
-
-        var constraints = this.widgets_constraints($overlapped_widgets);
-
-        this.manage_movements(constraints.can_go_up, to_col, to_row);
-        this.manage_movements(constraints.can_not_go_up, to_col, to_row);
-
-        /* if there is not widgets overlapping in the new player position,
-         * update the new placeholder position. */
-        if (!$overlapped_widgets.length) {
-            var pp = this.can_go_player_up(this.player_grid_data);
-            if (pp !== false) {
-                to_row = pp;
-            }
-            this.set_placeholder(to_col, to_row);
-        }
-
-        return {
-            col: to_col,
-            row: to_row
-        };
-    };
-
-
-    /**
-    * See which of the widgets in the $widgets param collection can go to
-    * a upper row and which not.
-    *
-    * @method widgets_contraints
-    * @param {jQuery} $widgets A jQuery wrapped collection of
-    * HTMLElements.
-    * @return {object} Returns a literal Object with two keys: `can_go_up` &
-    * `can_not_go_up`. Each contains a set of HTMLElements.
-    */
-    fn.widgets_constraints = function($widgets) {
-        var $widgets_can_go_up = $([]);
-        var $widgets_can_not_go_up;
-        var wgd_can_go_up = [];
-        var wgd_can_not_go_up = [];
-
-        $widgets.each($.proxy(function(i, w) {
-            var $w = $(w);
-            var wgd = $w.coords().grid;
-            if (this.can_go_widget_up(wgd)) {
-                $widgets_can_go_up = $widgets_can_go_up.add($w);
-                wgd_can_go_up.push(wgd);
-            } else {
-                wgd_can_not_go_up.push(wgd);
-            }
-        }, this));
-
-        $widgets_can_not_go_up = $widgets.not($widgets_can_go_up);
-
-        return {
-            can_go_up: Gridster.sort_by_row_asc(wgd_can_go_up),
-            can_not_go_up: Gridster.sort_by_row_desc(wgd_can_not_go_up)
-        };
-    };
-
-
-    /**
-    * Sorts an Array of grid coords objects (representing the grid coords of
-    * each widget) in descending way.
-    *
-    * @method manage_movements
-    * @param {jQuery} $widgets A jQuery collection of HTMLElements
-    *  representing the widgets you want to move.
-    * @param {Number} to_col The column to which we want to move the widgets.
-    * @param {Number} to_row The row to which we want to move the widgets.
-    * @return {Class} Returns the instance of the Gridster Class.
-    */
-    fn.manage_movements = function($widgets, to_col, to_row) {
-        $.each($widgets, $.proxy(function(i, w) {
-            var wgd = w;
-            var $w = wgd.el;
-
-            var can_go_widget_up = this.can_go_widget_up(wgd);
-
-            if (can_go_widget_up) {
-                //target CAN go up
-                //so move widget up
-                this.move_widget_to($w, can_go_widget_up);
-                this.set_placeholder(to_col, can_go_widget_up + wgd.size_y);
-
-            } else {
-                //target can't go up
-                var can_go_player_up = this.can_go_player_up(
-                    this.player_grid_data);
-
-                if (!can_go_player_up) {
-                    // target can't go up
-                    // player cant't go up
-                    // so we need to move widget down to a position that dont
-                    // overlaps player
-                    var y = (to_row + this.player_grid_data.size_y) - wgd.row;
-
-                    this.move_widget_down($w, y);
-                    this.set_placeholder(to_col, to_row);
-                }
-            }
-        }, this));
-
-        return this;
-    };
-
-    /**
-    * Determines if there is a widget in the row and col given. Or if the
-    * HTMLElement passed as first argument is the player.
-    *
-    * @method is_player
-    * @param {Number|HTMLElement} col_or_el A jQuery wrapped collection of
-    * HTMLElements.
-    * @param {Number} [row] The column to which we want to move the widgets.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_player = function(col_or_el, row) {
-        if (row && !this.gridmap[col_or_el]) { return false; }
-        var $w = row ? this.gridmap[col_or_el][row] : col_or_el;
-        return $w && ($w.is(this.$player) || $w.is(this.$helper));
-    };
-
-
-    /**
-    * Determines if the widget that is being dragged is currently over the row
-    * and col given.
-    *
-    * @method is_player_in
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_player_in = function(col, row) {
-        var c = this.cells_occupied_by_player || {};
-        return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0;
-    };
-
-
-    /**
-    * Determines if the placeholder is currently over the row and col given.
-    *
-    * @method is_placeholder_in
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_placeholder_in = function(col, row) {
-        var c = this.cells_occupied_by_placeholder || {};
-        return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0;
-    };
-
-
-    /**
-    * Determines if the placeholder is currently over the column given.
-    *
-    * @method is_placeholder_in_col
-    * @param {Number} col The column to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_placeholder_in_col = function(col) {
-        var c = this.cells_occupied_by_placeholder || [];
-        return $.inArray(col, c.cols) >= 0;
-    };
-
-
-    /**
-    * Determines if the cell represented by col and row params is empty.
-    *
-    * @method is_empty
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_empty = function(col, row) {
-        if (typeof this.gridmap[col] !== 'undefined') {
-			if(typeof this.gridmap[col][row] !== 'undefined' &&
-				 this.gridmap[col][row] === false
-			) {
-				return true;
-			}
-			return false;
-		}
-		return true;
-    };
-
-
-    /**
-    * Determines if the cell represented by col and row params is occupied.
-    *
-    * @method is_occupied
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_occupied = function(col, row) {
-        if (!this.gridmap[col]) {
-            return false;
-        }
-
-        if (this.gridmap[col][row]) {
-            return true;
-        }
-        return false;
-    };
-
-
-    /**
-    * Determines if there is a widget in the cell represented by col/row params.
-    *
-    * @method is_widget
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean|HTMLElement} Returns false if there is no widget,
-    * else returns the jQuery HTMLElement
-    */
-    fn.is_widget = function(col, row) {
-        var cell = this.gridmap[col];
-        if (!cell) {
-            return false;
-        }
-
-        cell = cell[row];
-
-        if (cell) {
-            return cell;
-        }
-
-        return false;
-    };
-
-
-    /**
-    * Determines if there is a widget in the cell represented by col/row
-    * params and if this is under the widget that is being dragged.
-    *
-    * @method is_widget_under_player
-    * @param {Number} col The column to check.
-    * @param {Number} row The row to check.
-    * @return {Boolean} Returns true or false.
-    */
-    fn.is_widget_under_player = function(col, row) {
-        if (this.is_widget(col, row)) {
-            return this.is_player_in(col, row);
-        }
-        return false;
-    };
-
-
-    /**
-    * Get widgets overlapping with the player or with the object passed
-    * representing the grid cells.
-    *
-    * @method get_widgets_under_player
-    * @return {

<TRUNCATED>

[6/8] chukwa git commit: CHUKWA-806. Replace gridster with gridstack. (Eric Yang)

Posted by ey...@apache.org.
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/js/jquery-ui.js
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/js/jquery-ui.js b/src/main/web/hicc/home/js/jquery-ui.js
new file mode 100644
index 0000000..670e39a
--- /dev/null
+++ b/src/main/web/hicc/home/js/jquery-ui.js
@@ -0,0 +1,16150 @@
+/*! jQuery UI - v1.11.0 - 2014-06-26
+* http://jqueryui.com
+* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js
+* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
+
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([ "jquery" ], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+/*!
+ * jQuery UI Core 1.11.0
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/category/ui-core/
+ */
+
+
+// $.ui might exist from components with no dependencies, e.g., $.ui.position
+$.ui = $.ui || {};
+
+$.extend( $.ui, {
+	version: "1.11.0",
+
+	keyCode: {
+		BACKSPACE: 8,
+		COMMA: 188,
+		DELETE: 46,
+		DOWN: 40,
+		END: 35,
+		ENTER: 13,
+		ESCAPE: 27,
+		HOME: 36,
+		LEFT: 37,
+		PAGE_DOWN: 34,
+		PAGE_UP: 33,
+		PERIOD: 190,
+		RIGHT: 39,
+		SPACE: 32,
+		TAB: 9,
+		UP: 38
+	}
+});
+
+// plugins
+$.fn.extend({
+	scrollParent: function() {
+		var position = this.css( "position" ),
+			excludeStaticParent = position === "absolute",
+			scrollParent = this.parents().filter( function() {
+				var parent = $( this );
+				if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
+					return false;
+				}
+				return (/(auto|scroll)/).test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
+			}).eq( 0 );
+
+		return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
+	},
+
+	uniqueId: (function() {
+		var uuid = 0;
+
+		return function() {
+			return this.each(function() {
+				if ( !this.id ) {
+					this.id = "ui-id-" + ( ++uuid );
+				}
+			});
+		};
+	})(),
+
+	removeUniqueId: function() {
+		return this.each(function() {
+			if ( /^ui-id-\d+$/.test( this.id ) ) {
+				$( this ).removeAttr( "id" );
+			}
+		});
+	}
+});
+
+// selectors
+function focusable( element, isTabIndexNotNaN ) {
+	var map, mapName, img,
+		nodeName = element.nodeName.toLowerCase();
+	if ( "area" === nodeName ) {
+		map = element.parentNode;
+		mapName = map.name;
+		if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+			return false;
+		}
+		img = $( "img[usemap=#" + mapName + "]" )[0];
+		return !!img && visible( img );
+	}
+	return ( /input|select|textarea|button|object/.test( nodeName ) ?
+		!element.disabled :
+		"a" === nodeName ?
+			element.href || isTabIndexNotNaN :
+			isTabIndexNotNaN) &&
+		// the element and all of its ancestors must be visible
+		visible( element );
+}
+
+function visible( element ) {
+	return $.expr.filters.visible( element ) &&
+		!$( element ).parents().addBack().filter(function() {
+			return $.css( this, "visibility" ) === "hidden";
+		}).length;
+}
+
+$.extend( $.expr[ ":" ], {
+	data: $.expr.createPseudo ?
+		$.expr.createPseudo(function( dataName ) {
+			return function( elem ) {
+				return !!$.data( elem, dataName );
+			};
+		}) :
+		// support: jQuery <1.8
+		function( elem, i, match ) {
+			return !!$.data( elem, match[ 3 ] );
+		},
+
+	focusable: function( element ) {
+		return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
+	},
+
+	tabbable: function( element ) {
+		var tabIndex = $.attr( element, "tabindex" ),
+			isTabIndexNaN = isNaN( tabIndex );
+		return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
+	}
+});
+
+// support: jQuery <1.8
+if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
+	$.each( [ "Width", "Height" ], function( i, name ) {
+		var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+			type = name.toLowerCase(),
+			orig = {
+				innerWidth: $.fn.innerWidth,
+				innerHeight: $.fn.innerHeight,
+				outerWidth: $.fn.outerWidth,
+				outerHeight: $.fn.outerHeight
+			};
+
+		function reduce( elem, size, border, margin ) {
+			$.each( side, function() {
+				size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
+				if ( border ) {
+					size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
+				}
+				if ( margin ) {
+					size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
+				}
+			});
+			return size;
+		}
+
+		$.fn[ "inner" + name ] = function( size ) {
+			if ( size === undefined ) {
+				return orig[ "inner" + name ].call( this );
+			}
+
+			return this.each(function() {
+				$( this ).css( type, reduce( this, size ) + "px" );
+			});
+		};
+
+		$.fn[ "outer" + name] = function( size, margin ) {
+			if ( typeof size !== "number" ) {
+				return orig[ "outer" + name ].call( this, size );
+			}
+
+			return this.each(function() {
+				$( this).css( type, reduce( this, size, true, margin ) + "px" );
+			});
+		};
+	});
+}
+
+// support: jQuery <1.8
+if ( !$.fn.addBack ) {
+	$.fn.addBack = function( selector ) {
+		return this.add( selector == null ?
+			this.prevObject : this.prevObject.filter( selector )
+		);
+	};
+}
+
+// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
+if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
+	$.fn.removeData = (function( removeData ) {
+		return function( key ) {
+			if ( arguments.length ) {
+				return removeData.call( this, $.camelCase( key ) );
+			} else {
+				return removeData.call( this );
+			}
+		};
+	})( $.fn.removeData );
+}
+
+// deprecated
+$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
+
+$.fn.extend({
+	focus: (function( orig ) {
+		return function( delay, fn ) {
+			return typeof delay === "number" ?
+				this.each(function() {
+					var elem = this;
+					setTimeout(function() {
+						$( elem ).focus();
+						if ( fn ) {
+							fn.call( elem );
+						}
+					}, delay );
+				}) :
+				orig.apply( this, arguments );
+		};
+	})( $.fn.focus ),
+
+	disableSelection: (function() {
+		var eventType = "onselectstart" in document.createElement( "div" ) ?
+			"selectstart" :
+			"mousedown";
+
+		return function() {
+			return this.bind( eventType + ".ui-disableSelection", function( event ) {
+				event.preventDefault();
+			});
+		};
+	})(),
+
+	enableSelection: function() {
+		return this.unbind( ".ui-disableSelection" );
+	},
+
+	zIndex: function( zIndex ) {
+		if ( zIndex !== undefined ) {
+			return this.css( "zIndex", zIndex );
+		}
+
+		if ( this.length ) {
+			var elem = $( this[ 0 ] ), position, value;
+			while ( elem.length && elem[ 0 ] !== document ) {
+				// Ignore z-index if position is set to a value where z-index is ignored by the browser
+				// This makes behavior of this function consistent across browsers
+				// WebKit always returns auto if the element is positioned
+				position = elem.css( "position" );
+				if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+					// IE returns 0 when zIndex is not specified
+					// other browsers return a string
+					// we ignore the case of nested elements with an explicit value of 0
+					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+					value = parseInt( elem.css( "zIndex" ), 10 );
+					if ( !isNaN( value ) && value !== 0 ) {
+						return value;
+					}
+				}
+				elem = elem.parent();
+			}
+		}
+
+		return 0;
+	}
+});
+
+// $.ui.plugin is deprecated. Use $.widget() extensions instead.
+$.ui.plugin = {
+	add: function( module, option, set ) {
+		var i,
+			proto = $.ui[ module ].prototype;
+		for ( i in set ) {
+			proto.plugins[ i ] = proto.plugins[ i ] || [];
+			proto.plugins[ i ].push( [ option, set[ i ] ] );
+		}
+	},
+	call: function( instance, name, args, allowDisconnected ) {
+		var i,
+			set = instance.plugins[ name ];
+
+		if ( !set ) {
+			return;
+		}
+
+		if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
+			return;
+		}
+
+		for ( i = 0; i < set.length; i++ ) {
+			if ( instance.options[ set[ i ][ 0 ] ] ) {
+				set[ i ][ 1 ].apply( instance.element, args );
+			}
+		}
+	}
+};
+
+
+/*!
+ * jQuery UI Widget 1.11.0
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/jQuery.widget/
+ */
+
+
+var widget_uuid = 0,
+	widget_slice = Array.prototype.slice;
+
+$.cleanData = (function( orig ) {
+	return function( elems ) {
+		for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+			try {
+				$( elem ).triggerHandler( "remove" );
+			// http://bugs.jquery.com/ticket/8235
+			} catch( e ) {}
+		}
+		orig( elems );
+	};
+})( $.cleanData );
+
+$.widget = function( name, base, prototype ) {
+	var fullName, existingConstructor, constructor, basePrototype,
+		// proxiedPrototype allows the provided prototype to remain unmodified
+		// so that it can be used as a mixin for multiple widgets (#8876)
+		proxiedPrototype = {},
+		namespace = name.split( "." )[ 0 ];
+
+	name = name.split( "." )[ 1 ];
+	fullName = namespace + "-" + name;
+
+	if ( !prototype ) {
+		prototype = base;
+		base = $.Widget;
+	}
+
+	// create selector for plugin
+	$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
+		return !!$.data( elem, fullName );
+	};
+
+	$[ namespace ] = $[ namespace ] || {};
+	existingConstructor = $[ namespace ][ name ];
+	constructor = $[ namespace ][ name ] = function( options, element ) {
+		// allow instantiation without "new" keyword
+		if ( !this._createWidget ) {
+			return new constructor( options, element );
+		}
+
+		// allow instantiation without initializing for simple inheritance
+		// must use "new" keyword (the code above always passes args)
+		if ( arguments.length ) {
+			this._createWidget( options, element );
+		}
+	};
+	// extend with the existing constructor to carry over any static properties
+	$.extend( constructor, existingConstructor, {
+		version: prototype.version,
+		// copy the object used to create the prototype in case we need to
+		// redefine the widget later
+		_proto: $.extend( {}, prototype ),
+		// track widgets that inherit from this widget in case this widget is
+		// redefined after a widget inherits from it
+		_childConstructors: []
+	});
+
+	basePrototype = new base();
+	// we need to make the options hash a property directly on the new instance
+	// otherwise we'll modify the options hash on the prototype that we're
+	// inheriting from
+	basePrototype.options = $.widget.extend( {}, basePrototype.options );
+	$.each( prototype, function( prop, value ) {
+		if ( !$.isFunction( value ) ) {
+			proxiedPrototype[ prop ] = value;
+			return;
+		}
+		proxiedPrototype[ prop ] = (function() {
+			var _super = function() {
+					return base.prototype[ prop ].apply( this, arguments );
+				},
+				_superApply = function( args ) {
+					return base.prototype[ prop ].apply( this, args );
+				};
+			return function() {
+				var __super = this._super,
+					__superApply = this._superApply,
+					returnValue;
+
+				this._super = _super;
+				this._superApply = _superApply;
+
+				returnValue = value.apply( this, arguments );
+
+				this._super = __super;
+				this._superApply = __superApply;
+
+				return returnValue;
+			};
+		})();
+	});
+	constructor.prototype = $.widget.extend( basePrototype, {
+		// TODO: remove support for widgetEventPrefix
+		// always use the name + a colon as the prefix, e.g., draggable:start
+		// don't prefix for widgets that aren't DOM-based
+		widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
+	}, proxiedPrototype, {
+		constructor: constructor,
+		namespace: namespace,
+		widgetName: name,
+		widgetFullName: fullName
+	});
+
+	// If this widget is being redefined then we need to find all widgets that
+	// are inheriting from it and redefine all of them so that they inherit from
+	// the new version of this widget. We're essentially trying to replace one
+	// level in the prototype chain.
+	if ( existingConstructor ) {
+		$.each( existingConstructor._childConstructors, function( i, child ) {
+			var childPrototype = child.prototype;
+
+			// redefine the child widget using the same prototype that was
+			// originally used, but inherit from the new version of the base
+			$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
+		});
+		// remove the list of existing child constructors from the old constructor
+		// so the old child constructors can be garbage collected
+		delete existingConstructor._childConstructors;
+	} else {
+		base._childConstructors.push( constructor );
+	}
+
+	$.widget.bridge( name, constructor );
+
+	return constructor;
+};
+
+$.widget.extend = function( target ) {
+	var input = widget_slice.call( arguments, 1 ),
+		inputIndex = 0,
+		inputLength = input.length,
+		key,
+		value;
+	for ( ; inputIndex < inputLength; inputIndex++ ) {
+		for ( key in input[ inputIndex ] ) {
+			value = input[ inputIndex ][ key ];
+			if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+				// Clone objects
+				if ( $.isPlainObject( value ) ) {
+					target[ key ] = $.isPlainObject( target[ key ] ) ?
+						$.widget.extend( {}, target[ key ], value ) :
+						// Don't extend strings, arrays, etc. with objects
+						$.widget.extend( {}, value );
+				// Copy everything else by reference
+				} else {
+					target[ key ] = value;
+				}
+			}
+		}
+	}
+	return target;
+};
+
+$.widget.bridge = function( name, object ) {
+	var fullName = object.prototype.widgetFullName || name;
+	$.fn[ name ] = function( options ) {
+		var isMethodCall = typeof options === "string",
+			args = widget_slice.call( arguments, 1 ),
+			returnValue = this;
+
+		// allow multiple hashes to be passed on init
+		options = !isMethodCall && args.length ?
+			$.widget.extend.apply( null, [ options ].concat(args) ) :
+			options;
+
+		if ( isMethodCall ) {
+			this.each(function() {
+				var methodValue,
+					instance = $.data( this, fullName );
+				if ( options === "instance" ) {
+					returnValue = instance;
+					return false;
+				}
+				if ( !instance ) {
+					return $.error( "cannot call methods on " + name + " prior to initialization; " +
+						"attempted to call method '" + options + "'" );
+				}
+				if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+					return $.error( "no such method '" + options + "' for " + name + " widget instance" );
+				}
+				methodValue = instance[ options ].apply( instance, args );
+				if ( methodValue !== instance && methodValue !== undefined ) {
+					returnValue = methodValue && methodValue.jquery ?
+						returnValue.pushStack( methodValue.get() ) :
+						methodValue;
+					return false;
+				}
+			});
+		} else {
+			this.each(function() {
+				var instance = $.data( this, fullName );
+				if ( instance ) {
+					instance.option( options || {} );
+					if ( instance._init ) {
+						instance._init();
+					}
+				} else {
+					$.data( this, fullName, new object( options, this ) );
+				}
+			});
+		}
+
+		return returnValue;
+	};
+};
+
+$.Widget = function( /* options, element */ ) {};
+$.Widget._childConstructors = [];
+
+$.Widget.prototype = {
+	widgetName: "widget",
+	widgetEventPrefix: "",
+	defaultElement: "<div>",
+	options: {
+		disabled: false,
+
+		// callbacks
+		create: null
+	},
+	_createWidget: function( options, element ) {
+		element = $( element || this.defaultElement || this )[ 0 ];
+		this.element = $( element );
+		this.uuid = widget_uuid++;
+		this.eventNamespace = "." + this.widgetName + this.uuid;
+		this.options = $.widget.extend( {},
+			this.options,
+			this._getCreateOptions(),
+			options );
+
+		this.bindings = $();
+		this.hoverable = $();
+		this.focusable = $();
+
+		if ( element !== this ) {
+			$.data( element, this.widgetFullName, this );
+			this._on( true, this.element, {
+				remove: function( event ) {
+					if ( event.target === element ) {
+						this.destroy();
+					}
+				}
+			});
+			this.document = $( element.style ?
+				// element within the document
+				element.ownerDocument :
+				// element is window or document
+				element.document || element );
+			this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
+		}
+
+		this._create();
+		this._trigger( "create", null, this._getCreateEventData() );
+		this._init();
+	},
+	_getCreateOptions: $.noop,
+	_getCreateEventData: $.noop,
+	_create: $.noop,
+	_init: $.noop,
+
+	destroy: function() {
+		this._destroy();
+		// we can probably remove the unbind calls in 2.0
+		// all event bindings should go through this._on()
+		this.element
+			.unbind( this.eventNamespace )
+			.removeData( this.widgetFullName )
+			// support: jquery <1.6.3
+			// http://bugs.jquery.com/ticket/9413
+			.removeData( $.camelCase( this.widgetFullName ) );
+		this.widget()
+			.unbind( this.eventNamespace )
+			.removeAttr( "aria-disabled" )
+			.removeClass(
+				this.widgetFullName + "-disabled " +
+				"ui-state-disabled" );
+
+		// clean up events and states
+		this.bindings.unbind( this.eventNamespace );
+		this.hoverable.removeClass( "ui-state-hover" );
+		this.focusable.removeClass( "ui-state-focus" );
+	},
+	_destroy: $.noop,
+
+	widget: function() {
+		return this.element;
+	},
+
+	option: function( key, value ) {
+		var options = key,
+			parts,
+			curOption,
+			i;
+
+		if ( arguments.length === 0 ) {
+			// don't return a reference to the internal hash
+			return $.widget.extend( {}, this.options );
+		}
+
+		if ( typeof key === "string" ) {
+			// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
+			options = {};
+			parts = key.split( "." );
+			key = parts.shift();
+			if ( parts.length ) {
+				curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
+				for ( i = 0; i < parts.length - 1; i++ ) {
+					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
+					curOption = curOption[ parts[ i ] ];
+				}
+				key = parts.pop();
+				if ( arguments.length === 1 ) {
+					return curOption[ key ] === undefined ? null : curOption[ key ];
+				}
+				curOption[ key ] = value;
+			} else {
+				if ( arguments.length === 1 ) {
+					return this.options[ key ] === undefined ? null : this.options[ key ];
+				}
+				options[ key ] = value;
+			}
+		}
+
+		this._setOptions( options );
+
+		return this;
+	},
+	_setOptions: function( options ) {
+		var key;
+
+		for ( key in options ) {
+			this._setOption( key, options[ key ] );
+		}
+
+		return this;
+	},
+	_setOption: function( key, value ) {
+		this.options[ key ] = value;
+
+		if ( key === "disabled" ) {
+			this.widget()
+				.toggleClass( this.widgetFullName + "-disabled", !!value );
+
+			// If the widget is becoming disabled, then nothing is interactive
+			if ( value ) {
+				this.hoverable.removeClass( "ui-state-hover" );
+				this.focusable.removeClass( "ui-state-focus" );
+			}
+		}
+
+		return this;
+	},
+
+	enable: function() {
+		return this._setOptions({ disabled: false });
+	},
+	disable: function() {
+		return this._setOptions({ disabled: true });
+	},
+
+	_on: function( suppressDisabledCheck, element, handlers ) {
+		var delegateElement,
+			instance = this;
+
+		// no suppressDisabledCheck flag, shuffle arguments
+		if ( typeof suppressDisabledCheck !== "boolean" ) {
+			handlers = element;
+			element = suppressDisabledCheck;
+			suppressDisabledCheck = false;
+		}
+
+		// no element argument, shuffle and use this.element
+		if ( !handlers ) {
+			handlers = element;
+			element = this.element;
+			delegateElement = this.widget();
+		} else {
+			element = delegateElement = $( element );
+			this.bindings = this.bindings.add( element );
+		}
+
+		$.each( handlers, function( event, handler ) {
+			function handlerProxy() {
+				// allow widgets to customize the disabled handling
+				// - disabled as an array instead of boolean
+				// - disabled class as method for disabling individual parts
+				if ( !suppressDisabledCheck &&
+						( instance.options.disabled === true ||
+							$( this ).hasClass( "ui-state-disabled" ) ) ) {
+					return;
+				}
+				return ( typeof handler === "string" ? instance[ handler ] : handler )
+					.apply( instance, arguments );
+			}
+
+			// copy the guid so direct unbinding works
+			if ( typeof handler !== "string" ) {
+				handlerProxy.guid = handler.guid =
+					handler.guid || handlerProxy.guid || $.guid++;
+			}
+
+			var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
+				eventName = match[1] + instance.eventNamespace,
+				selector = match[2];
+			if ( selector ) {
+				delegateElement.delegate( selector, eventName, handlerProxy );
+			} else {
+				element.bind( eventName, handlerProxy );
+			}
+		});
+	},
+
+	_off: function( element, eventName ) {
+		eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
+		element.unbind( eventName ).undelegate( eventName );
+	},
+
+	_delay: function( handler, delay ) {
+		function handlerProxy() {
+			return ( typeof handler === "string" ? instance[ handler ] : handler )
+				.apply( instance, arguments );
+		}
+		var instance = this;
+		return setTimeout( handlerProxy, delay || 0 );
+	},
+
+	_hoverable: function( element ) {
+		this.hoverable = this.hoverable.add( element );
+		this._on( element, {
+			mouseenter: function( event ) {
+				$( event.currentTarget ).addClass( "ui-state-hover" );
+			},
+			mouseleave: function( event ) {
+				$( event.currentTarget ).removeClass( "ui-state-hover" );
+			}
+		});
+	},
+
+	_focusable: function( element ) {
+		this.focusable = this.focusable.add( element );
+		this._on( element, {
+			focusin: function( event ) {
+				$( event.currentTarget ).addClass( "ui-state-focus" );
+			},
+			focusout: function( event ) {
+				$( event.currentTarget ).removeClass( "ui-state-focus" );
+			}
+		});
+	},
+
+	_trigger: function( type, event, data ) {
+		var prop, orig,
+			callback = this.options[ type ];
+
+		data = data || {};
+		event = $.Event( event );
+		event.type = ( type === this.widgetEventPrefix ?
+			type :
+			this.widgetEventPrefix + type ).toLowerCase();
+		// the original event may come from any element
+		// so we need to reset the target on the new event
+		event.target = this.element[ 0 ];
+
+		// copy original event properties over to the new event
+		orig = event.originalEvent;
+		if ( orig ) {
+			for ( prop in orig ) {
+				if ( !( prop in event ) ) {
+					event[ prop ] = orig[ prop ];
+				}
+			}
+		}
+
+		this.element.trigger( event, data );
+		return !( $.isFunction( callback ) &&
+			callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
+			event.isDefaultPrevented() );
+	}
+};
+
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
+	$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+		if ( typeof options === "string" ) {
+			options = { effect: options };
+		}
+		var hasOptions,
+			effectName = !options ?
+				method :
+				options === true || typeof options === "number" ?
+					defaultEffect :
+					options.effect || defaultEffect;
+		options = options || {};
+		if ( typeof options === "number" ) {
+			options = { duration: options };
+		}
+		hasOptions = !$.isEmptyObject( options );
+		options.complete = callback;
+		if ( options.delay ) {
+			element.delay( options.delay );
+		}
+		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
+			element[ method ]( options );
+		} else if ( effectName !== method && element[ effectName ] ) {
+			element[ effectName ]( options.duration, options.easing, callback );
+		} else {
+			element.queue(function( next ) {
+				$( this )[ method ]();
+				if ( callback ) {
+					callback.call( element[ 0 ] );
+				}
+				next();
+			});
+		}
+	};
+});
+
+var widget = $.widget;
+
+
+/*!
+ * jQuery UI Mouse 1.11.0
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/mouse/
+ */
+
+
+var mouseHandled = false;
+$( document ).mouseup( function() {
+	mouseHandled = false;
+});
+
+var mouse = $.widget("ui.mouse", {
+	version: "1.11.0",
+	options: {
+		cancel: "input,textarea,button,select,option",
+		distance: 1,
+		delay: 0
+	},
+	_mouseInit: function() {
+		var that = this;
+
+		this.element
+			.bind("mousedown." + this.widgetName, function(event) {
+				return that._mouseDown(event);
+			})
+			.bind("click." + this.widgetName, function(event) {
+				if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
+					$.removeData(event.target, that.widgetName + ".preventClickEvent");
+					event.stopImmediatePropagation();
+					return false;
+				}
+			});
+
+		this.started = false;
+	},
+
+	// TODO: make sure destroying one instance of mouse doesn't mess with
+	// other instances of mouse
+	_mouseDestroy: function() {
+		this.element.unbind("." + this.widgetName);
+		if ( this._mouseMoveDelegate ) {
+			this.document
+				.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
+				.unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
+		}
+	},
+
+	_mouseDown: function(event) {
+		// don't let more than one widget handle mouseStart
+		if ( mouseHandled ) {
+			return;
+		}
+
+		// we may have missed mouseup (out of window)
+		(this._mouseStarted && this._mouseUp(event));
+
+		this._mouseDownEvent = event;
+
+		var that = this,
+			btnIsLeft = (event.which === 1),
+			// event.target.nodeName works around a bug in IE 8 with
+			// disabled inputs (#7620)
+			elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
+			return true;
+		}
+
+		this.mouseDelayMet = !this.options.delay;
+		if (!this.mouseDelayMet) {
+			this._mouseDelayTimer = setTimeout(function() {
+				that.mouseDelayMet = true;
+			}, this.options.delay);
+		}
+
+		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+			this._mouseStarted = (this._mouseStart(event) !== false);
+			if (!this._mouseStarted) {
+				event.preventDefault();
+				return true;
+			}
+		}
+
+		// Click event may never have fired (Gecko & Opera)
+		if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
+			$.removeData(event.target, this.widgetName + ".preventClickEvent");
+		}
+
+		// these delegates are required to keep context
+		this._mouseMoveDelegate = function(event) {
+			return that._mouseMove(event);
+		};
+		this._mouseUpDelegate = function(event) {
+			return that._mouseUp(event);
+		};
+
+		this.document
+			.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
+			.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
+
+		event.preventDefault();
+
+		mouseHandled = true;
+		return true;
+	},
+
+	_mouseMove: function(event) {
+		// IE mouseup check - mouseup happened when mouse was out of window
+		if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
+			return this._mouseUp(event);
+
+		// Iframe mouseup check - mouseup occurred in another document
+		} else if ( !event.which ) {
+			return this._mouseUp( event );
+		}
+
+		if (this._mouseStarted) {
+			this._mouseDrag(event);
+			return event.preventDefault();
+		}
+
+		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+			this._mouseStarted =
+				(this._mouseStart(this._mouseDownEvent, event) !== false);
+			(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
+		}
+
+		return !this._mouseStarted;
+	},
+
+	_mouseUp: function(event) {
+		this.document
+			.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
+			.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
+
+		if (this._mouseStarted) {
+			this._mouseStarted = false;
+
+			if (event.target === this._mouseDownEvent.target) {
+				$.data(event.target, this.widgetName + ".preventClickEvent", true);
+			}
+
+			this._mouseStop(event);
+		}
+
+		mouseHandled = false;
+		return false;
+	},
+
+	_mouseDistanceMet: function(event) {
+		return (Math.max(
+				Math.abs(this._mouseDownEvent.pageX - event.pageX),
+				Math.abs(this._mouseDownEvent.pageY - event.pageY)
+			) >= this.options.distance
+		);
+	},
+
+	_mouseDelayMet: function(/* event */) {
+		return this.mouseDelayMet;
+	},
+
+	// These are placeholder methods, to be overriden by extending plugin
+	_mouseStart: function(/* event */) {},
+	_mouseDrag: function(/* event */) {},
+	_mouseStop: function(/* event */) {},
+	_mouseCapture: function(/* event */) { return true; }
+});
+
+
+/*!
+ * jQuery UI Position 1.11.0
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/position/
+ */
+
+(function() {
+
+$.ui = $.ui || {};
+
+var cachedScrollbarWidth, supportsOffsetFractions,
+	max = Math.max,
+	abs = Math.abs,
+	round = Math.round,
+	rhorizontal = /left|center|right/,
+	rvertical = /top|center|bottom/,
+	roffset = /[\+\-]\d+(\.[\d]+)?%?/,
+	rposition = /^\w+/,
+	rpercent = /%$/,
+	_position = $.fn.position;
+
+function getOffsets( offsets, width, height ) {
+	return [
+		parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
+		parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
+	];
+}
+
+function parseCss( element, property ) {
+	return parseInt( $.css( element, property ), 10 ) || 0;
+}
+
+function getDimensions( elem ) {
+	var raw = elem[0];
+	if ( raw.nodeType === 9 ) {
+		return {
+			width: elem.width(),
+			height: elem.height(),
+			offset: { top: 0, left: 0 }
+		};
+	}
+	if ( $.isWindow( raw ) ) {
+		return {
+			width: elem.width(),
+			height: elem.height(),
+			offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
+		};
+	}
+	if ( raw.preventDefault ) {
+		return {
+			width: 0,
+			height: 0,
+			offset: { top: raw.pageY, left: raw.pageX }
+		};
+	}
+	return {
+		width: elem.outerWidth(),
+		height: elem.outerHeight(),
+		offset: elem.offset()
+	};
+}
+
+$.position = {
+	scrollbarWidth: function() {
+		if ( cachedScrollbarWidth !== undefined ) {
+			return cachedScrollbarWidth;
+		}
+		var w1, w2,
+			div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
+			innerDiv = div.children()[0];
+
+		$( "body" ).append( div );
+		w1 = innerDiv.offsetWidth;
+		div.css( "overflow", "scroll" );
+
+		w2 = innerDiv.offsetWidth;
+
+		if ( w1 === w2 ) {
+			w2 = div[0].clientWidth;
+		}
+
+		div.remove();
+
+		return (cachedScrollbarWidth = w1 - w2);
+	},
+	getScrollInfo: function( within ) {
+		var overflowX = within.isWindow || within.isDocument ? "" :
+				within.element.css( "overflow-x" ),
+			overflowY = within.isWindow || within.isDocument ? "" :
+				within.element.css( "overflow-y" ),
+			hasOverflowX = overflowX === "scroll" ||
+				( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
+			hasOverflowY = overflowY === "scroll" ||
+				( overflowY === "auto" && within.height < within.element[0].scrollHeight );
+		return {
+			width: hasOverflowY ? $.position.scrollbarWidth() : 0,
+			height: hasOverflowX ? $.position.scrollbarWidth() : 0
+		};
+	},
+	getWithinInfo: function( element ) {
+		var withinElement = $( element || window ),
+			isWindow = $.isWindow( withinElement[0] ),
+			isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
+		return {
+			element: withinElement,
+			isWindow: isWindow,
+			isDocument: isDocument,
+			offset: withinElement.offset() || { left: 0, top: 0 },
+			scrollLeft: withinElement.scrollLeft(),
+			scrollTop: withinElement.scrollTop(),
+			width: isWindow ? withinElement.width() : withinElement.outerWidth(),
+			height: isWindow ? withinElement.height() : withinElement.outerHeight()
+		};
+	}
+};
+
+$.fn.position = function( options ) {
+	if ( !options || !options.of ) {
+		return _position.apply( this, arguments );
+	}
+
+	// make a copy, we don't want to modify arguments
+	options = $.extend( {}, options );
+
+	var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
+		target = $( options.of ),
+		within = $.position.getWithinInfo( options.within ),
+		scrollInfo = $.position.getScrollInfo( within ),
+		collision = ( options.collision || "flip" ).split( " " ),
+		offsets = {};
+
+	dimensions = getDimensions( target );
+	if ( target[0].preventDefault ) {
+		// force left top to allow flipping
+		options.at = "left top";
+	}
+	targetWidth = dimensions.width;
+	targetHeight = dimensions.height;
+	targetOffset = dimensions.offset;
+	// clone to reuse original targetOffset later
+	basePosition = $.extend( {}, targetOffset );
+
+	// force my and at to have valid horizontal and vertical positions
+	// if a value is missing or invalid, it will be converted to center
+	$.each( [ "my", "at" ], function() {
+		var pos = ( options[ this ] || "" ).split( " " ),
+			horizontalOffset,
+			verticalOffset;
+
+		if ( pos.length === 1) {
+			pos = rhorizontal.test( pos[ 0 ] ) ?
+				pos.concat( [ "center" ] ) :
+				rvertical.test( pos[ 0 ] ) ?
+					[ "center" ].concat( pos ) :
+					[ "center", "center" ];
+		}
+		pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
+		pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
+
+		// calculate offsets
+		horizontalOffset = roffset.exec( pos[ 0 ] );
+		verticalOffset = roffset.exec( pos[ 1 ] );
+		offsets[ this ] = [
+			horizontalOffset ? horizontalOffset[ 0 ] : 0,
+			verticalOffset ? verticalOffset[ 0 ] : 0
+		];
+
+		// reduce to just the positions without the offsets
+		options[ this ] = [
+			rposition.exec( pos[ 0 ] )[ 0 ],
+			rposition.exec( pos[ 1 ] )[ 0 ]
+		];
+	});
+
+	// normalize collision option
+	if ( collision.length === 1 ) {
+		collision[ 1 ] = collision[ 0 ];
+	}
+
+	if ( options.at[ 0 ] === "right" ) {
+		basePosition.left += targetWidth;
+	} else if ( options.at[ 0 ] === "center" ) {
+		basePosition.left += targetWidth / 2;
+	}
+
+	if ( options.at[ 1 ] === "bottom" ) {
+		basePosition.top += targetHeight;
+	} else if ( options.at[ 1 ] === "center" ) {
+		basePosition.top += targetHeight / 2;
+	}
+
+	atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
+	basePosition.left += atOffset[ 0 ];
+	basePosition.top += atOffset[ 1 ];
+
+	return this.each(function() {
+		var collisionPosition, using,
+			elem = $( this ),
+			elemWidth = elem.outerWidth(),
+			elemHeight = elem.outerHeight(),
+			marginLeft = parseCss( this, "marginLeft" ),
+			marginTop = parseCss( this, "marginTop" ),
+			collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
+			collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
+			position = $.extend( {}, basePosition ),
+			myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
+
+		if ( options.my[ 0 ] === "right" ) {
+			position.left -= elemWidth;
+		} else if ( options.my[ 0 ] === "center" ) {
+			position.left -= elemWidth / 2;
+		}
+
+		if ( options.my[ 1 ] === "bottom" ) {
+			position.top -= elemHeight;
+		} else if ( options.my[ 1 ] === "center" ) {
+			position.top -= elemHeight / 2;
+		}
+
+		position.left += myOffset[ 0 ];
+		position.top += myOffset[ 1 ];
+
+		// if the browser doesn't support fractions, then round for consistent results
+		if ( !supportsOffsetFractions ) {
+			position.left = round( position.left );
+			position.top = round( position.top );
+		}
+
+		collisionPosition = {
+			marginLeft: marginLeft,
+			marginTop: marginTop
+		};
+
+		$.each( [ "left", "top" ], function( i, dir ) {
+			if ( $.ui.position[ collision[ i ] ] ) {
+				$.ui.position[ collision[ i ] ][ dir ]( position, {
+					targetWidth: targetWidth,
+					targetHeight: targetHeight,
+					elemWidth: elemWidth,
+					elemHeight: elemHeight,
+					collisionPosition: collisionPosition,
+					collisionWidth: collisionWidth,
+					collisionHeight: collisionHeight,
+					offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
+					my: options.my,
+					at: options.at,
+					within: within,
+					elem: elem
+				});
+			}
+		});
+
+		if ( options.using ) {
+			// adds feedback as second argument to using callback, if present
+			using = function( props ) {
+				var left = targetOffset.left - position.left,
+					right = left + targetWidth - elemWidth,
+					top = targetOffset.top - position.top,
+					bottom = top + targetHeight - elemHeight,
+					feedback = {
+						target: {
+							element: target,
+							left: targetOffset.left,
+							top: targetOffset.top,
+							width: targetWidth,
+							height: targetHeight
+						},
+						element: {
+							element: elem,
+							left: position.left,
+							top: position.top,
+							width: elemWidth,
+							height: elemHeight
+						},
+						horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
+						vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
+					};
+				if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
+					feedback.horizontal = "center";
+				}
+				if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
+					feedback.vertical = "middle";
+				}
+				if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
+					feedback.important = "horizontal";
+				} else {
+					feedback.important = "vertical";
+				}
+				options.using.call( this, props, feedback );
+			};
+		}
+
+		elem.offset( $.extend( position, { using: using } ) );
+	});
+};
+
+$.ui.position = {
+	fit: {
+		left: function( position, data ) {
+			var within = data.within,
+				withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
+				outerWidth = within.width,
+				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+				overLeft = withinOffset - collisionPosLeft,
+				overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
+				newOverRight;
+
+			// element is wider than within
+			if ( data.collisionWidth > outerWidth ) {
+				// element is initially over the left side of within
+				if ( overLeft > 0 && overRight <= 0 ) {
+					newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
+					position.left += overLeft - newOverRight;
+				// element is initially over right side of within
+				} else if ( overRight > 0 && overLeft <= 0 ) {
+					position.left = withinOffset;
+				// element is initially over both left and right sides of within
+				} else {
+					if ( overLeft > overRight ) {
+						position.left = withinOffset + outerWidth - data.collisionWidth;
+					} else {
+						position.left = withinOffset;
+					}
+				}
+			// too far left -> align with left edge
+			} else if ( overLeft > 0 ) {
+				position.left += overLeft;
+			// too far right -> align with right edge
+			} else if ( overRight > 0 ) {
+				position.left -= overRight;
+			// adjust based on position and margin
+			} else {
+				position.left = max( position.left - collisionPosLeft, position.left );
+			}
+		},
+		top: function( position, data ) {
+			var within = data.within,
+				withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
+				outerHeight = data.within.height,
+				collisionPosTop = position.top - data.collisionPosition.marginTop,
+				overTop = withinOffset - collisionPosTop,
+				overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
+				newOverBottom;
+
+			// element is taller than within
+			if ( data.collisionHeight > outerHeight ) {
+				// element is initially over the top of within
+				if ( overTop > 0 && overBottom <= 0 ) {
+					newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
+					position.top += overTop - newOverBottom;
+				// element is initially over bottom of within
+				} else if ( overBottom > 0 && overTop <= 0 ) {
+					position.top = withinOffset;
+				// element is initially over both top and bottom of within
+				} else {
+					if ( overTop > overBottom ) {
+						position.top = withinOffset + outerHeight - data.collisionHeight;
+					} else {
+						position.top = withinOffset;
+					}
+				}
+			// too far up -> align with top
+			} else if ( overTop > 0 ) {
+				position.top += overTop;
+			// too far down -> align with bottom edge
+			} else if ( overBottom > 0 ) {
+				position.top -= overBottom;
+			// adjust based on position and margin
+			} else {
+				position.top = max( position.top - collisionPosTop, position.top );
+			}
+		}
+	},
+	flip: {
+		left: function( position, data ) {
+			var within = data.within,
+				withinOffset = within.offset.left + within.scrollLeft,
+				outerWidth = within.width,
+				offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
+				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+				overLeft = collisionPosLeft - offsetLeft,
+				overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
+				myOffset = data.my[ 0 ] === "left" ?
+					-data.elemWidth :
+					data.my[ 0 ] === "right" ?
+						data.elemWidth :
+						0,
+				atOffset = data.at[ 0 ] === "left" ?
+					data.targetWidth :
+					data.at[ 0 ] === "right" ?
+						-data.targetWidth :
+						0,
+				offset = -2 * data.offset[ 0 ],
+				newOverRight,
+				newOverLeft;
+
+			if ( overLeft < 0 ) {
+				newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
+				if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
+					position.left += myOffset + atOffset + offset;
+				}
+			} else if ( overRight > 0 ) {
+				newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
+				if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
+					position.left += myOffset + atOffset + offset;
+				}
+			}
+		},
+		top: function( position, data ) {
+			var within = data.within,
+				withinOffset = within.offset.top + within.scrollTop,
+				outerHeight = within.height,
+				offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
+				collisionPosTop = position.top - data.collisionPosition.marginTop,
+				overTop = collisionPosTop - offsetTop,
+				overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
+				top = data.my[ 1 ] === "top",
+				myOffset = top ?
+					-data.elemHeight :
+					data.my[ 1 ] === "bottom" ?
+						data.elemHeight :
+						0,
+				atOffset = data.at[ 1 ] === "top" ?
+					data.targetHeight :
+					data.at[ 1 ] === "bottom" ?
+						-data.targetHeight :
+						0,
+				offset = -2 * data.offset[ 1 ],
+				newOverTop,
+				newOverBottom;
+			if ( overTop < 0 ) {
+				newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
+				if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
+					position.top += myOffset + atOffset + offset;
+				}
+			} else if ( overBottom > 0 ) {
+				newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
+				if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
+					position.top += myOffset + atOffset + offset;
+				}
+			}
+		}
+	},
+	flipfit: {
+		left: function() {
+			$.ui.position.flip.left.apply( this, arguments );
+			$.ui.position.fit.left.apply( this, arguments );
+		},
+		top: function() {
+			$.ui.position.flip.top.apply( this, arguments );
+			$.ui.position.fit.top.apply( this, arguments );
+		}
+	}
+};
+
+// fraction support test
+(function() {
+	var testElement, testElementParent, testElementStyle, offsetLeft, i,
+		body = document.getElementsByTagName( "body" )[ 0 ],
+		div = document.createElement( "div" );
+
+	//Create a "fake body" for testing based on method used in jQuery.support
+	testElement = document.createElement( body ? "div" : "body" );
+	testElementStyle = {
+		visibility: "hidden",
+		width: 0,
+		height: 0,
+		border: 0,
+		margin: 0,
+		background: "none"
+	};
+	if ( body ) {
+		$.extend( testElementStyle, {
+			position: "absolute",
+			left: "-1000px",
+			top: "-1000px"
+		});
+	}
+	for ( i in testElementStyle ) {
+		testElement.style[ i ] = testElementStyle[ i ];
+	}
+	testElement.appendChild( div );
+	testElementParent = body || document.documentElement;
+	testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+	div.style.cssText = "position: absolute; left: 10.7432222px;";
+
+	offsetLeft = $( div ).offset().left;
+	supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
+
+	testElement.innerHTML = "";
+	testElementParent.removeChild( testElement );
+})();
+
+})();
+
+var position = $.ui.position;
+
+
+/*!
+ * jQuery UI Accordion 1.11.0
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/accordion/
+ */
+
+
+var accordion = $.widget( "ui.accordion", {
+	version: "1.11.0",
+	options: {
+		active: 0,
+		animate: {},
+		collapsible: false,
+		event: "click",
+		header: "> li > :first-child,> :not(li):even",
+		heightStyle: "auto",
+		icons: {
+			activeHeader: "ui-icon-triangle-1-s",
+			header: "ui-icon-triangle-1-e"
+		},
+
+		// callbacks
+		activate: null,
+		beforeActivate: null
+	},
+
+	hideProps: {
+		borderTopWidth: "hide",
+		borderBottomWidth: "hide",
+		paddingTop: "hide",
+		paddingBottom: "hide",
+		height: "hide"
+	},
+
+	showProps: {
+		borderTopWidth: "show",
+		borderBottomWidth: "show",
+		paddingTop: "show",
+		paddingBottom: "show",
+		height: "show"
+	},
+
+	_create: function() {
+		var options = this.options;
+		this.prevShow = this.prevHide = $();
+		this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
+			// ARIA
+			.attr( "role", "tablist" );
+
+		// don't allow collapsible: false and active: false / null
+		if ( !options.collapsible && (options.active === false || options.active == null) ) {
+			options.active = 0;
+		}
+
+		this._processPanels();
+		// handle negative values
+		if ( options.active < 0 ) {
+			options.active += this.headers.length;
+		}
+		this._refresh();
+	},
+
+	_getCreateEventData: function() {
+		return {
+			header: this.active,
+			panel: !this.active.length ? $() : this.active.next()
+		};
+	},
+
+	_createIcons: function() {
+		var icons = this.options.icons;
+		if ( icons ) {
+			$( "<span>" )
+				.addClass( "ui-accordion-header-icon ui-icon " + icons.header )
+				.prependTo( this.headers );
+			this.active.children( ".ui-accordion-header-icon" )
+				.removeClass( icons.header )
+				.addClass( icons.activeHeader );
+			this.headers.addClass( "ui-accordion-icons" );
+		}
+	},
+
+	_destroyIcons: function() {
+		this.headers
+			.removeClass( "ui-accordion-icons" )
+			.children( ".ui-accordion-header-icon" )
+				.remove();
+	},
+
+	_destroy: function() {
+		var contents;
+
+		// clean up main element
+		this.element
+			.removeClass( "ui-accordion ui-widget ui-helper-reset" )
+			.removeAttr( "role" );
+
+		// clean up headers
+		this.headers
+			.removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
+				"ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-expanded" )
+			.removeAttr( "aria-selected" )
+			.removeAttr( "aria-controls" )
+			.removeAttr( "tabIndex" )
+			.removeUniqueId();
+
+		this._destroyIcons();
+
+		// clean up content panels
+		contents = this.headers.next()
+			.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
+				"ui-accordion-content ui-accordion-content-active ui-state-disabled" )
+			.css( "display", "" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-hidden" )
+			.removeAttr( "aria-labelledby" )
+			.removeUniqueId();
+
+		if ( this.options.heightStyle !== "content" ) {
+			contents.css( "height", "" );
+		}
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "active" ) {
+			// _activate() will handle invalid values and update this.options
+			this._activate( value );
+			return;
+		}
+
+		if ( key === "event" ) {
+			if ( this.options.event ) {
+				this._off( this.headers, this.options.event );
+			}
+			this._setupEvents( value );
+		}
+
+		this._super( key, value );
+
+		// setting collapsible: false while collapsed; open first panel
+		if ( key === "collapsible" && !value && this.options.active === false ) {
+			this._activate( 0 );
+		}
+
+		if ( key === "icons" ) {
+			this._destroyIcons();
+			if ( value ) {
+				this._createIcons();
+			}
+		}
+
+		// #5332 - opacity doesn't cascade to positioned elements in IE
+		// so we need to add the disabled class to the headers and panels
+		if ( key === "disabled" ) {
+			this.element
+				.toggleClass( "ui-state-disabled", !!value )
+				.attr( "aria-disabled", value );
+			this.headers.add( this.headers.next() )
+				.toggleClass( "ui-state-disabled", !!value );
+		}
+	},
+
+	_keydown: function( event ) {
+		if ( event.altKey || event.ctrlKey ) {
+			return;
+		}
+
+		var keyCode = $.ui.keyCode,
+			length = this.headers.length,
+			currentIndex = this.headers.index( event.target ),
+			toFocus = false;
+
+		switch ( event.keyCode ) {
+			case keyCode.RIGHT:
+			case keyCode.DOWN:
+				toFocus = this.headers[ ( currentIndex + 1 ) % length ];
+				break;
+			case keyCode.LEFT:
+			case keyCode.UP:
+				toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
+				break;
+			case keyCode.SPACE:
+			case keyCode.ENTER:
+				this._eventHandler( event );
+				break;
+			case keyCode.HOME:
+				toFocus = this.headers[ 0 ];
+				break;
+			case keyCode.END:
+				toFocus = this.headers[ length - 1 ];
+				break;
+		}
+
+		if ( toFocus ) {
+			$( event.target ).attr( "tabIndex", -1 );
+			$( toFocus ).attr( "tabIndex", 0 );
+			toFocus.focus();
+			event.preventDefault();
+		}
+	},
+
+	_panelKeyDown: function( event ) {
+		if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
+			$( event.currentTarget ).prev().focus();
+		}
+	},
+
+	refresh: function() {
+		var options = this.options;
+		this._processPanels();
+
+		// was collapsed or no panel
+		if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
+			options.active = false;
+			this.active = $();
+		// active false only when collapsible is true
+		} else if ( options.active === false ) {
+			this._activate( 0 );
+		// was active, but active panel is gone
+		} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+			// all remaining panel are disabled
+			if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
+				options.active = false;
+				this.active = $();
+			// activate previous panel
+			} else {
+				this._activate( Math.max( 0, options.active - 1 ) );
+			}
+		// was active, active panel still exists
+		} else {
+			// make sure active index is correct
+			options.active = this.headers.index( this.active );
+		}
+
+		this._destroyIcons();
+
+		this._refresh();
+	},
+
+	_processPanels: function() {
+		this.headers = this.element.find( this.options.header )
+			.addClass( "ui-accordion-header ui-state-default ui-corner-all" );
+
+		this.headers.next()
+			.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
+			.filter( ":not(.ui-accordion-content-active)" )
+			.hide();
+	},
+
+	_refresh: function() {
+		var maxHeight,
+			options = this.options,
+			heightStyle = options.heightStyle,
+			parent = this.element.parent();
+
+		this.active = this._findActive( options.active )
+			.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
+			.removeClass( "ui-corner-all" );
+		this.active.next()
+			.addClass( "ui-accordion-content-active" )
+			.show();
+
+		this.headers
+			.attr( "role", "tab" )
+			.each(function() {
+				var header = $( this ),
+					headerId = header.uniqueId().attr( "id" ),
+					panel = header.next(),
+					panelId = panel.uniqueId().attr( "id" );
+				header.attr( "aria-controls", panelId );
+				panel.attr( "aria-labelledby", headerId );
+			})
+			.next()
+				.attr( "role", "tabpanel" );
+
+		this.headers
+			.not( this.active )
+			.attr({
+				"aria-selected": "false",
+				"aria-expanded": "false",
+				tabIndex: -1
+			})
+			.next()
+				.attr({
+					"aria-hidden": "true"
+				})
+				.hide();
+
+		// make sure at least one header is in the tab order
+		if ( !this.active.length ) {
+			this.headers.eq( 0 ).attr( "tabIndex", 0 );
+		} else {
+			this.active.attr({
+				"aria-selected": "true",
+				"aria-expanded": "true",
+				tabIndex: 0
+			})
+			.next()
+				.attr({
+					"aria-hidden": "false"
+				});
+		}
+
+		this._createIcons();
+
+		this._setupEvents( options.event );
+
+		if ( heightStyle === "fill" ) {
+			maxHeight = parent.height();
+			this.element.siblings( ":visible" ).each(function() {
+				var elem = $( this ),
+					position = elem.css( "position" );
+
+				if ( position === "absolute" || position === "fixed" ) {
+					return;
+				}
+				maxHeight -= elem.outerHeight( true );
+			});
+
+			this.headers.each(function() {
+				maxHeight -= $( this ).outerHeight( true );
+			});
+
+			this.headers.next()
+				.each(function() {
+					$( this ).height( Math.max( 0, maxHeight -
+						$( this ).innerHeight() + $( this ).height() ) );
+				})
+				.css( "overflow", "auto" );
+		} else if ( heightStyle === "auto" ) {
+			maxHeight = 0;
+			this.headers.next()
+				.each(function() {
+					maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
+				})
+				.height( maxHeight );
+		}
+	},
+
+	_activate: function( index ) {
+		var active = this._findActive( index )[ 0 ];
+
+		// trying to activate the already active panel
+		if ( active === this.active[ 0 ] ) {
+			return;
+		}
+
+		// trying to collapse, simulate a click on the currently active header
+		active = active || this.active[ 0 ];
+
+		this._eventHandler({
+			target: active,
+			currentTarget: active,
+			preventDefault: $.noop
+		});
+	},
+
+	_findActive: function( selector ) {
+		return typeof selector === "number" ? this.headers.eq( selector ) : $();
+	},
+
+	_setupEvents: function( event ) {
+		var events = {
+			keydown: "_keydown"
+		};
+		if ( event ) {
+			$.each( event.split( " " ), function( index, eventName ) {
+				events[ eventName ] = "_eventHandler";
+			});
+		}
+
+		this._off( this.headers.add( this.headers.next() ) );
+		this._on( this.headers, events );
+		this._on( this.headers.next(), { keydown: "_panelKeyDown" });
+		this._hoverable( this.headers );
+		this._focusable( this.headers );
+	},
+
+	_eventHandler: function( event ) {
+		var options = this.options,
+			active = this.active,
+			clicked = $( event.currentTarget ),
+			clickedIsActive = clicked[ 0 ] === active[ 0 ],
+			collapsing = clickedIsActive && options.collapsible,
+			toShow = collapsing ? $() : clicked.next(),
+			toHide = active.next(),
+			eventData = {
+				oldHeader: active,
+				oldPanel: toHide,
+				newHeader: collapsing ? $() : clicked,
+				newPanel: toShow
+			};
+
+		event.preventDefault();
+
+		if (
+				// click on active header, but not collapsible
+				( clickedIsActive && !options.collapsible ) ||
+				// allow canceling activation
+				( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+			return;
+		}
+
+		options.active = collapsing ? false : this.headers.index( clicked );
+
+		// when the call to ._toggle() comes after the class changes
+		// it causes a very odd bug in IE 8 (see #6720)
+		this.active = clickedIsActive ? $() : clicked;
+		this._toggle( eventData );
+
+		// switch classes
+		// corner classes on the previously active header stay after the animation
+		active.removeClass( "ui-accordion-header-active ui-state-active" );
+		if ( options.icons ) {
+			active.children( ".ui-accordion-header-icon" )
+				.removeClass( options.icons.activeHeader )
+				.addClass( options.icons.header );
+		}
+
+		if ( !clickedIsActive ) {
+			clicked
+				.removeClass( "ui-corner-all" )
+				.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
+			if ( options.icons ) {
+				clicked.children( ".ui-accordion-header-icon" )
+					.removeClass( options.icons.header )
+					.addClass( options.icons.activeHeader );
+			}
+
+			clicked
+				.next()
+				.addClass( "ui-accordion-content-active" );
+		}
+	},
+
+	_toggle: function( data ) {
+		var toShow = data.newPanel,
+			toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
+
+		// handle activating a panel during the animation for another activation
+		this.prevShow.add( this.prevHide ).stop( true, true );
+		this.prevShow = toShow;
+		this.prevHide = toHide;
+
+		if ( this.options.animate ) {
+			this._animate( toShow, toHide, data );
+		} else {
+			toHide.hide();
+			toShow.show();
+			this._toggleComplete( data );
+		}
+
+		toHide.attr({
+			"aria-hidden": "true"
+		});
+		toHide.prev().attr( "aria-selected", "false" );
+		// if we're switching panels, remove the old header from the tab order
+		// if we're opening from collapsed state, remove the previous header from the tab order
+		// if we're collapsing, then keep the collapsing header in the tab order
+		if ( toShow.length && toHide.length ) {
+			toHide.prev().attr({
+				"tabIndex": -1,
+				"aria-expanded": "false"
+			});
+		} else if ( toShow.length ) {
+			this.headers.filter(function() {
+				return $( this ).attr( "tabIndex" ) === 0;
+			})
+			.attr( "tabIndex", -1 );
+		}
+
+		toShow
+			.attr( "aria-hidden", "false" )
+			.prev()
+				.attr({
+					"aria-selected": "true",
+					tabIndex: 0,
+					"aria-expanded": "true"
+				});
+	},
+
+	_animate: function( toShow, toHide, data ) {
+		var total, easing, duration,
+			that = this,
+			adjust = 0,
+			down = toShow.length &&
+				( !toHide.length || ( toShow.index() < toHide.index() ) ),
+			animate = this.options.animate || {},
+			options = down && animate.down || animate,
+			complete = function() {
+				that._toggleComplete( data );
+			};
+
+		if ( typeof options === "number" ) {
+			duration = options;
+		}
+		if ( typeof options === "string" ) {
+			easing = options;
+		}
+		// fall back from options to animation in case of partial down settings
+		easing = easing || options.easing || animate.easing;
+		duration = duration || options.duration || animate.duration;
+
+		if ( !toHide.length ) {
+			return toShow.animate( this.showProps, duration, easing, complete );
+		}
+		if ( !toShow.length ) {
+			return toHide.animate( this.hideProps, duration, easing, complete );
+		}
+
+		total = toShow.show().outerHeight();
+		toHide.animate( this.hideProps, {
+			duration: duration,
+			easing: easing,
+			step: function( now, fx ) {
+				fx.now = Math.round( now );
+			}
+		});
+		toShow
+			.hide()
+			.animate( this.showProps, {
+				duration: duration,
+				easing: easing,
+				complete: complete,
+				step: function( now, fx ) {
+					fx.now = Math.round( now );
+					if ( fx.prop !== "height" ) {
+						adjust += fx.now;
+					} else if ( that.options.heightStyle !== "content" ) {
+						fx.now = Math.round( total - toHide.outerHeight() - adjust );
+						adjust = 0;
+					}
+				}
+			});
+	},
+
+	_toggleComplete: function( data ) {
+		var toHide = data.oldPanel;
+
+		toHide
+			.removeClass( "ui-accordion-content-active" )
+			.prev()
+				.removeClass( "ui-corner-top" )
+				.addClass( "ui-corner-all" );
+
+		// Work around for rendering bug in IE (#5421)
+		if ( toHide.length ) {
+			toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
+		}
+		this._trigger( "activate", null, data );
+	}
+});
+
+
+/*!
+ * jQuery UI Menu 1.11.0
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/menu/
+ */
+
+
+var menu = $.widget( "ui.menu", {
+	version: "1.11.0",
+	defaultElement: "<ul>",
+	delay: 300,
+	options: {
+		icons: {
+			submenu: "ui-icon-carat-1-e"
+		},
+		items: "> *",
+		menus: "ul",
+		position: {
+			my: "left-1 top",
+			at: "right top"
+		},
+		role: "menu",
+
+		// callbacks
+		blur: null,
+		focus: null,
+		select: null
+	},
+
+	_create: function() {
+		this.activeMenu = this.element;
+
+		// Flag used to prevent firing of the click handler
+		// as the event bubbles up through nested menus
+		this.mouseHandled = false;
+		this.element
+			.uniqueId()
+			.addClass( "ui-menu ui-widget ui-widget-content" )
+			.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
+			.attr({
+				role: this.options.role,
+				tabIndex: 0
+			});
+
+		if ( this.options.disabled ) {
+			this.element
+				.addClass( "ui-state-disabled" )
+				.attr( "aria-disabled", "true" );
+		}
+
+		this._on({
+			// Prevent focus from sticking to links inside menu after clicking
+			// them (focus should always stay on UL during navigation).
+			"mousedown .ui-menu-item": function( event ) {
+				event.preventDefault();
+			},
+			"click .ui-menu-item": function( event ) {
+				var target = $( event.target );
+				if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+					this.select( event );
+
+					// Only set the mouseHandled flag if the event will bubble, see #9469.
+					if ( !event.isPropagationStopped() ) {
+						this.mouseHandled = true;
+					}
+
+					// Open submenu on click
+					if ( target.has( ".ui-menu" ).length ) {
+						this.expand( event );
+					} else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
+
+						// Redirect focus to the menu
+						this.element.trigger( "focus", [ true ] );
+
+						// If the active item is on the top level, let it stay active.
+						// Otherwise, blur the active item since it is no longer visible.
+						if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
+							clearTimeout( this.timer );
+						}
+					}
+				}
+			},
+			"mouseenter .ui-menu-item": function( event ) {
+				var target = $( event.currentTarget );
+				// Remove ui-state-active class from siblings of the newly focused menu item
+				// to avoid a jump caused by adjacent elements both having a class with a border
+				target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
+				this.focus( event, target );
+			},
+			mouseleave: "collapseAll",
+			"mouseleave .ui-menu": "collapseAll",
+			focus: function( event, keepActiveItem ) {
+				// If there's already an active item, keep it active
+				// If not, activate the first item
+				var item = this.active || this.element.find( this.options.items ).eq( 0 );
+
+				if ( !keepActiveItem ) {
+					this.focus( event, item );
+				}
+			},
+			blur: function( event ) {
+				this._delay(function() {
+					if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
+						this.collapseAll( event );
+					}
+				});
+			},
+			keydown: "_keydown"
+		});
+
+		this.refresh();
+
+		// Clicks outside of a menu collapse any open menus
+		this._on( this.document, {
+			click: function( event ) {
+				if ( this._closeOnDocumentClick( event ) ) {
+					this.collapseAll( event );
+				}
+
+				// Reset the mouseHandled flag
+				this.mouseHandled = false;
+			}
+		});
+	},
+
+	_destroy: function() {
+		// Destroy (sub)menus
+		this.element
+			.removeAttr( "aria-activedescendant" )
+			.find( ".ui-menu" ).addBack()
+				.removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
+				.removeAttr( "role" )
+				.removeAttr( "tabIndex" )
+				.removeAttr( "aria-labelledby" )
+				.removeAttr( "aria-expanded" )
+				.removeAttr( "aria-hidden" )
+				.removeAttr( "aria-disabled" )
+				.removeUniqueId()
+				.show();
+
+		// Destroy menu items
+		this.element.find( ".ui-menu-item" )
+			.removeClass( "ui-menu-item" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-disabled" )
+			.removeUniqueId()
+			.removeClass( "ui-state-hover" )
+			.removeAttr( "tabIndex" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-haspopup" )
+			.children().each( function() {
+				var elem = $( this );
+				if ( elem.data( "ui-menu-submenu-carat" ) ) {
+					elem.remove();
+				}
+			});
+
+		// Destroy menu dividers
+		this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
+	},
+
+	_keydown: function( event ) {
+		var match, prev, character, skip, regex,
+			preventDefault = true;
+
+		function escape( value ) {
+			return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
+		}
+
+		switch ( event.keyCode ) {
+		case $.ui.keyCode.PAGE_UP:
+			this.previousPage( event );
+			break;
+		case $.ui.keyCode.PAGE_DOWN:
+			this.nextPage( event );
+			break;
+		case $.ui.keyCode.HOME:
+			this._move( "first", "first", event );
+			break;
+		case $.ui.keyCode.END:
+			this._move( "last", "last", event );
+			break;
+		case $.ui.keyCode.UP:
+			this.previous( event );
+			break;
+		case $.ui.keyCode.DOWN:
+			this.next( event );
+			break;
+		case $.ui.keyCode.LEFT:
+			this.collapse( event );
+			break;
+		case $.ui.keyCode.RIGHT:
+			if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
+				this.expand( event );
+			}
+			break;
+		case $.ui.keyCode.ENTER:
+		case $.ui.keyCode.SPACE:
+			this._activate( event );
+			break;
+		case $.ui.keyCode.ESCAPE:
+			this.collapse( event );
+			break;
+		default:
+			preventDefault = false;
+			prev = this.previousFilter || "";
+			character = String.fromCharCode( event.keyCode );
+			skip = false;
+
+			clearTimeout( this.filterTimer );
+
+			if ( character === prev ) {
+				skip = true;
+			} else {
+				character = prev + character;
+			}
+
+			regex = new RegExp( "^" + escape( character ), "i" );
+			match = this.activeMenu.find( this.options.items ).filter(function() {
+				return regex.test( $( this ).text() );
+			});
+			match = skip && match.index( this.active.next() ) !== -1 ?
+				this.active.nextAll( ".ui-menu-item" ) :
+				match;
+
+			// If no matches on the current filter, reset to the last character pressed
+			// to move down the menu to the first item that starts with that character
+			if ( !match.length ) {
+				character = String.fromCharCode( event.keyCode );
+				regex = new RegExp( "^" + escape( character ), "i" );
+				match = this.activeMenu.find( this.options.items ).filter(function() {
+					return regex.test( $( this ).text() );
+				});
+			}
+
+			if ( match.length ) {
+				this.focus( event, match );
+				if ( match.length > 1 ) {
+					this.previousFilter = character;
+					this.filterTimer = this._delay(function() {
+						delete this.previousFilter;
+					}, 1000 );
+				} else {
+					delete this.previousFilter;
+				}
+			} else {
+				delete this.previousFilter;
+			}
+		}
+
+		if ( preventDefault ) {
+			event.preventDefault();
+		}
+	},
+
+	_activate: function( event ) {
+		if ( !this.active.is( ".ui-state-disabled" ) ) {
+			if ( this.active.is( "[aria-haspopup='true']" ) ) {
+				this.expand( event );
+			} else {
+				this.select( event );
+			}
+		}
+	},
+
+	refresh: function() {
+		var menus, items,
+			that = this,
+			icon = this.options.icons.submenu,
+			submenus = this.element.find( this.options.menus );
+
+		this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
+
+		// Initialize nested menus
+		submenus.filter( ":not(.ui-menu)" )
+			.addClass( "ui-menu ui-widget ui-widget-content ui-front" )
+			.hide()
+			.attr({
+				role: this.options.role,
+				"aria-hidden": "true",
+				"aria-expanded": "false"
+			})
+			.each(function() {
+				var menu = $( this ),
+					item = menu.parent(),
+					submenuCarat = $( "<span>" )
+						.addClass( "ui-menu-icon ui-icon " + icon )
+						.data( "ui-menu-submenu-carat", true );
+
+				item
+					.attr( "aria-haspopup", "true" )
+					.prepend( submenuCarat );
+				menu.attr( "aria-labelledby", item.attr( "id" ) );
+			});
+
+		menus = submenus.add( this.element );
+		items = menus.find( this.options.items );
+
+		// Initialize menu-items containing spaces and/or dashes only as dividers
+		items.not( ".ui-menu-item" ).each(function() {
+			var item = $( this );
+			if ( that._isDivider( item ) ) {
+				item.addClass( "ui-widget-content ui-menu-divider" );
+			}
+		});
+
+		// Don't refresh list items that are already adapted
+		items.not( ".ui-menu-item, .ui-menu-divider" )
+			.addClass( "ui-menu-item" )
+			.uniqueId()
+			.attr({
+				tabIndex: -1,
+				role: this._itemRole()
+			});
+
+		// Add aria-disabled attribute to any disabled menu item
+		items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
+
+		// If the active item has been removed, blur the menu
+		if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+			this.blur();
+		}
+	},
+
+	_itemRole: function() {
+		return {
+			menu: "menuitem",
+			listbox: "option"
+		}[ this.options.role ];
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "icons" ) {
+			this.element.find( ".ui-menu-icon" )
+				.removeClass( this.options.icons.submenu )
+				.addClass( value.submenu );
+		}
+		if ( key === "disabled" ) {
+			this.element
+				.toggleClass( "ui-state-disabled", !!value )
+				.attr( "aria-disabled", value );
+		}
+		this._super( key, value );
+	},
+
+	focus: function( event, item ) {
+		var nested, focused;
+		this.blur( event, event && event.type === "focus" );
+
+		this._scrollIntoView( item );
+
+		this.active = item.first();
+		focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
+		// Only update aria-activedescendant if there's a role
+		// otherwise we assume focus is managed elsewhere
+		if ( this.options.role ) {
+			this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
+		}
+
+		// Highlight active parent menu item, if any
+		this.active
+			.parent()
+			.closest( ".ui-menu-item" )
+			.addClass( "ui-state-active" );
+
+		if ( event && event.type === "keydown" ) {
+			this._close();
+		} else {
+			this.timer = this._delay(function() {
+				this._close();
+			}, this.delay );
+		}
+
+		nested = item.children( ".ui-menu" );
+		if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
+			this._startOpening(nested);
+		}
+		this.activeMenu = item.parent();
+
+		this._trigger( "focus", event, { item: item } );
+	},
+
+	_scrollIntoView: function( item ) {
+		var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
+		if ( this._hasScroll() ) {
+			borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+			paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+			offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+			scroll = this.activeMenu.scrollTop();
+			elementHeight = this.activeMenu.height();
+			itemHeight = item.outerHeight();
+
+			if ( offset < 0 ) {
+				this.activeMenu.scrollTop( scroll + offset );
+			} else if ( offset + itemHeight > elementHeight ) {
+				this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
+			}
+		}
+	},
+
+	blur: function( event, fromFocus ) {
+		if ( !fromFocus ) {
+			clearTimeout( this.timer );
+		}
+
+		if ( !this.active ) {
+			return;
+		}
+
+		this.active.removeClass( "ui-state-focus" );
+		this.active = null;
+
+		this._trigger( "blur", event, { item: this.active } );
+	},
+
+	_startOpening: function( submenu ) {
+		clearTimeout( this.timer );
+
+		// Don't open if already open fixes a Firefox bug that caused a .5 pixel
+		// shift in the submenu position when mousing over the carat icon
+		if ( submenu.attr( "aria-hidden" ) !== "true" ) {
+			return;
+		}
+
+		this.timer = this._delay(function() {
+			this._close();
+			this._open( submenu );
+		}, this.delay );
+	},
+
+	_open: function( submenu ) {
+		var position = $.extend({
+			of: this.active
+		}, this.options.position );
+
+		clearTimeout( this.timer );
+		this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
+			.hide()
+			.attr( "aria-hidden", "true" );
+
+		submenu
+			.show()
+			.removeAttr( "aria-hidden" )
+			.attr( "aria-expanded", "true" )
+			.position( position );
+	},
+
+	collapseAll: function( event, all ) {
+		clearTimeout( this.timer );
+		this.timer = this._delay(function() {
+			// If we were passed an event, look for the submenu that contains the event
+			var currentMenu = all ? this.element :
+				$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
+
+			// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+			if ( !currentMenu.length ) {
+				currentMenu = this.element;
+			}
+
+			this._close( currentMenu );
+
+			this.blur( event );
+			this.activeMenu = currentMenu;
+		}, this.delay );
+	},
+
+	// With no arguments, closes the currently active menu - if nothing is active
+	// it closes all menus.  If passed an argument, it will search for menus BELOW
+	_close: function( startMenu ) {
+		if ( !startMenu ) {
+			startMenu = this.active ? this.active.parent() : this.element;
+		}
+
+		startMenu
+			.find( ".ui-menu" )
+				.hide()
+				.attr( "aria-hidden", "true" )
+				.attr( "aria-expanded", "false" )
+			.end()
+			.find( ".ui-state-active" ).not( ".ui-state-focus" )
+				.removeClass( "ui-state-active" );
+	},
+
+	_closeOnDocumentClick: function( event ) {
+		return !$( event.target ).closest( ".ui-menu" ).length;
+	},
+
+	_isDivider: function( item ) {
+
+		// Match hyphen, em dash, en dash
+		return !/[^\-\u2014\u2013\s]/.test( item.text() );
+	},
+
+	collapse: function( event ) {
+		var newItem = this.active &&
+			this.active.parent().closest( ".ui-menu-item", this.element );
+		if ( newItem && newItem.length ) {
+			this._close();
+			this.focus( event, newItem );
+		}
+	},
+
+	expand: function( event ) {
+		var newItem = this.active &&
+			this.active
+				.children( ".ui-menu " )
+				.find( this.options.items )
+				.first();
+
+		if ( newItem && newItem.length ) {
+			this._open( newItem.parent() );
+
+			// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
+			this._delay(function() {
+				this.focus( event, newItem );
+			});
+		}
+	},
+
+	next: function( event ) {
+		this._move( "next", "first", event );
+	},
+
+	previous: function( event ) {
+		this._move( "prev", "last", event );
+	},
+
+	isFirstItem: function() {
+		return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
+	},
+
+	isLastItem: function() {
+		return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
+	},
+
+	_move: function( direction, filter, event ) {
+		var next;
+		if ( this.active ) {
+			if ( direction === "first" || direction === "last" ) {
+				next = this.active
+					[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
+					.eq( -1 );
+			} else {
+				next = this.active
+					[ direction + "All" ]( ".ui-menu-item" )
+					.eq( 0 );
+			}
+		}
+		if ( !next || !next.length || !this.active ) {
+			next = this.activeMenu.find( this.options.items )[ filter ]();
+		}
+
+		this.focus( event, next );
+	},
+
+	nextPage: function( event ) {
+		var item, base, height;
+
+		if ( !this.active ) {
+			this.next( event );
+			return;
+		}
+		if ( this.isLastItem() ) {
+			return;
+		}
+		if ( this._hasScroll() ) {
+			base = this.active.offset().top;
+			height = this.element.height();
+			this.active.nextAll( ".ui-menu-item" ).each(function() {
+				item = $( this );
+				return item.offset().top - base - height < 0;
+			});
+
+			this.focus( event, item );
+		} else {
+			this.focus( event, this.activeMenu.find( this.options.items )
+				[ !this.active ? "first" : "last" ]() );
+		}
+	},
+
+	previousPage: function( event ) {
+		var item, base, height;
+		if ( !this.active ) {
+			this.next( event );
+			return;
+		}
+		if ( this.isFirstItem() ) {
+			return;
+		}
+		if ( this._hasScroll() ) {
+			base = this.active.offset().top;
+			height = this.element.height();
+			this.active.prevAll( ".ui-menu-item" ).each(function() {
+				item = $( this );
+				return item.offset().top - base + height > 0;
+			});
+
+			this.focus( event, item );
+		} else {
+			this.focus( event, this.activeMenu.find( this.options.items ).first() );
+		}
+	},
+
+	_hasScroll: function() {
+		return this.element.outerHeight() < this.element.prop( "scrollHeight" );
+	},
+
+	select: function( event ) {
+		// TODO: It should never be possible to not have an active item at this
+		// point, but the tests don't trigger mouseenter before click.
+		this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
+		var ui = { item: this.active };
+		if ( !this.active.has( ".ui-menu" ).length ) {
+			this.collapseAll( event, true );
+		}
+		this._trigger( "select", event, ui );
+	}
+});
+
+
+/*!
+ * jQuery UI Autocomplete 1.11.0
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/autocomplete/
+ */
+
+
+$.widget( "ui.autocomplete", {
+	version: "1.11.0",
+	defaultElement: "<input>",
+	options: {
+		appendTo: null,
+		autoFocus: false,
+		delay: 300,
+		minLength: 1,
+		position: {
+			my: "left top",
+			at: "left bottom",
+			collision: "none"
+		},
+		source: null,
+
+		// callbacks
+		change: null,
+		close: null,
+		focus: null,
+		open: null,
+		response: null,
+		search: null,
+		select: null
+	},
+
+	requestIndex: 0,
+	pending: 0,
+
+	_create: function() {
+		// Some browsers only repeat keydown events, not keypress events,
+		// so we use the suppressKeyPress flag to determine if we've already
+		// handled the keydown event. #7269
+		// Unfortunately the code for & in keypress is the same as the up arrow,
+		// so we use the suppressKeyPressRepeat flag to avoid handling keypress
+		// events when we know the keydown event was used to modify the
+		// search term. #7799
+		var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
+			nodeName = this.element[ 0 ].nodeName.toLowerCase(),
+			isTextarea = nodeName === "textarea",
+			isInput = nodeName === "input";
+
+		this.isMultiLine =
+			// Textareas are always multi-line
+			isTextarea ? true :
+			// Inputs are always single-line, even if inside a contentEditable element
+			// IE also treats inputs as contentEditable
+			isInput ? false :
+			// All other element types are determined by whether or not they're contentEditable
+			this.element.prop( "isContentEditable" );
+
+		this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
+		this.isNewMenu = true;
+
+		this.element
+			.addClass( "ui-autocomplete-input" )
+			.attr( "autocomplete", "off" );
+
+		this._on( this.element, {
+			keydown: function( event ) {
+				if ( this.element.prop( "readOnly" ) ) {
+					suppressKeyPress = true;
+					suppressInput = true;
+					suppressKeyPressRepeat = true;
+					return;
+				}
+
+				suppressKeyPress = false;
+				suppressInput = false;
+				suppressKeyPressRepeat = false;
+				var keyCode = $.ui.keyCode;
+				switch ( event.keyCode ) {
+				case keyCode.PAGE_UP:
+					suppressKeyPress = true;
+					this._move( "previousPage", event );
+					break;
+				case keyCode.PAGE_DOWN:
+					suppressKeyPress = true;
+					this._move( "nextPage", event );
+					break;
+				case keyCode.UP:
+					suppressKeyPress = true;
+					this._keyEvent( "previous", event );
+					break;
+				case keyCode.DOWN:
+					suppressKeyPress = true;
+					this._keyEvent( "next", event );
+					break;
+				case keyCode.ENTER:
+					// when menu is open and has focus
+					if ( this.menu.active ) {
+						// #6055 - Opera still allows the keypress to occur
+						// which causes forms to submit
+						suppressKeyPress = true;
+						event.preventDefault();
+						this.menu.select( event );
+					}
+					break;
+				case keyCode.TAB:
+					if ( this.menu.active ) {
+						this.menu.select( event );
+					}
+					break;
+				case keyCode.ESCAPE:
+					if ( this.menu.element.is( ":visible" ) ) {
+						this._value( this.term );
+						this.close( event );
+						// Different browsers have different default behavior for escape
+						// Single press can mean undo or clear
+						// Double press in IE means clear the whole form
+						event.preventDefault();
+					}
+					break;
+				default:
+					suppressKeyPressRepeat = true;
+					// search timeout should be triggered before the input value is changed
+					this._searchTimeout( event );
+					break;
+				}
+			},
+			keypress: function( event ) {
+				if ( suppressKeyPress ) {
+					suppressKeyPress = false;
+					if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+						event.preventDefault();
+					}
+					return;
+				}
+				if ( suppressKeyPressRepeat ) {
+					return;
+				}
+
+				// replicate some key handlers to allow them to repeat in Firefox and Opera
+				var keyCode = $.ui.keyCode;
+				switch ( event.keyCode ) {
+				case keyCode.PAGE_UP:
+					this._move( "previousPage", event );
+					break;
+				case keyCode.PAGE_DOWN:
+					this._move( "nextPage", event );
+					break;
+				case keyCode.UP:
+					this._keyEvent( "previous", event );
+					break;
+				case keyCode.DOWN:
+					this._keyEvent( "next", event );
+					break;
+				}
+			},
+			input: function( event ) {
+				if ( suppressInput ) {
+					suppressInput = false;
+					event.preventDefault();
+					return;
+				}
+				this._searchTimeout( event );
+			},
+			focus: function() {
+				this.selectedItem = null;
+				this.previous = this._value();
+			},
+			blur: function( event ) {
+				if ( this.cancelBlur ) {
+					delete this.cancelBlur;
+					return;
+				}
+
+				clearTimeout( this.searching );
+				this.close( event );
+				this._change( event );
+			}
+		});
+
+		this._initSource();
+		this.menu = $( "<ul>" )
+			.addClass( "ui-autocomplete ui-front" )
+			.appendTo( this._appendTo() )
+			.menu({
+				// disable ARIA support, the live region takes care of that
+				role: null
+			})
+			.hide()
+			.menu( "instance" );
+
+		this._on( this.menu.element, {
+			mousedown: function( event ) {
+				// prevent moving focus out of the text field
+				event.preventDefault();
+
+				// IE doesn't prevent moving focus even with event.preventDefault()
+				// so we set a flag to know when we should ignore the blur event
+				this.cancelBlur = true;
+				this._delay(function() {
+					delete this.cancelBlur;
+				});
+
+				// clicking on the scrollbar causes focus to shift to the body
+				// but we can't detect a mouseup or a click immediately afterward
+				// so we have to track the next mousedown and close the menu if
+				// the user clicks somewhere outside of the autocomplete
+				var menuElement = this.menu.element[ 0 ];
+				if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+					this._delay(function() {
+						var that = this;
+						this.document.one( "mousedown", function( event ) {
+							if ( event.target !== that.element[ 0 ] &&
+									event.target !== menuElement &&
+									!$.contains( menuElement, event.target ) ) {
+								that.close();
+							}
+						});
+					});
+				}
+			},
+			menufocus: function( event, ui ) {
+				var label, item;
+				// support: Firefox
+				// Prevent accidental activation of menu items in Firefox (#7024 #9118)
+				if ( this.isNewMenu ) {
+					this.isNewMenu = false;
+					if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
+						this.menu.blur();
+
+						this.document.one( "mousemove", function() {
+							$( event.target ).trigger( event.originalEvent );
+						});
+
+						return;
+					}
+				}
+
+				item = ui.item.data( "ui-autocomplete-item" );
+				if ( false !== this._trigger( "focus", event, { item: item } ) ) {
+					// use value to match what will end up in the input, if it was a key event
+					if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
+						this._value( item.value );
+					}
+				}
+
+				// Announce the value in the liveRegion
+				label = ui.item.attr( "aria-label" ) || item.value;
+				if ( label && jQuery.trim( label ).length ) {
+					this.liveRegion.children().hide();
+					$( "<div>" ).text( label ).appendTo( this.liveRegion );
+				}
+			},
+			menuselect: function( event, ui ) {
+				var item = ui.item.data( "ui-autocomplete-item" ),
+					previous = this.previous;
+
+				// only trigger when focus was lost (click on menu)
+				if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
+					this.element.focus();
+					this.previous = previous;
+					// #6109 - IE triggers two focus events and the second
+					// is asynchronous, so we need to reset the previous
+					// term synchronously and asynchronously :-(
+					this._delay(function() {
+						this.previous = previous;
+						this.selectedItem = item;
+					});
+				}
+
+				if ( false !== this._trigger( "select", event, { item: item } ) ) {
+					this._value( item.value );
+				}
+				// reset the term after the select event
+				// this allows custom select handling to work properly
+				this.term = this._value();
+
+				this.close( event );
+				this.selectedItem = item;
+			}
+		});
+
+		this.liveRegion = $( "<span>", {
+				role: "status",
+				"aria-live": "assertive",
+				"aria-relevant": "additions"
+			})
+			.addClass( "ui-helper-hidden-accessible" )
+			.appendTo( this.document[ 0 ].body );
+
+		// turning off autocomplete prevents the browser from remembering the
+		// value when navigating through history, so we re-enable autocomplete
+		// if the page is unloaded before the widget is destroyed. #7790
+		this._on( this.window, {
+			beforeunload: function() {
+				this.element.removeAttr( "autocomplete" );
+			}
+		});
+	},
+
+	_destroy: function() {
+		clearTimeout( this.searching );
+		this.element
+			.removeClass( "ui-autocomplete-input" )
+			.removeAttr( "autocomplete" );
+		this.menu.element.remove();
+		this.liveRegion.remove();
+	},
+
+	_setOption: function( key, value ) {
+		this._super( key, value );
+		if ( key === "source" ) {
+			this._initSource();
+		}
+		if ( key === "appendTo" ) {
+			this.menu.element.appendTo( this._appendTo() );
+		}
+		if ( key === "disabled" && value && this.xhr ) {
+			this.xhr.abort();
+		}
+	},
+
+	_appendTo: function() {
+		var element = this.options.appendTo;
+
+		if ( element ) {
+			element = element.jquery || element.nodeType ?
+				$( element ) :
+				this.document.find( element ).eq( 0 );
+		}
+
+		if ( !element || !element[ 0 ] ) {
+			element = this.element.closest( ".ui-front" );
+		}
+
+		if ( !element.length ) {
+			element = this.document[ 0 ].body;
+		}
+
+		return element;
+	},
+
+	_initSource: function() {
+		var array, url,
+			that = this;
+		if ( $.isArray( this.options.source ) ) {
+			array = this.options.source;
+			this.source = function( request, response ) {
+				response( $.ui.autocomplete.filter( array, request.term ) );
+			};
+		} else if ( typeof this.options.source === "string" ) {
+			url = this.options.source;
+			this.source = function( request, response ) {
+				if ( that.xhr ) {
+					that.xhr.abort();
+				}
+				that.xhr = $.ajax({
+					url: url,
+					data: request,
+					dataType: "json",
+					success: function( data ) {
+						response( data );
+					},
+					error: function() {
+						response([]);
+					}
+				});
+			};
+		} else {
+			this.source = this.options.source;
+		}
+	},
+
+	_searchTimeout: function( event ) {
+		clearTimeout( this.searching );
+		this.searching = this._delay(function() {
+
+			// Search if the value has changed, or if the user retypes the same value (see #7434)
+			var equalValues = this.term === this._value(),
+				menuVisible = this.menu.element.is( ":visible" ),
+				modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
+
+			if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
+				this.selectedItem = null;
+				this.search( null, event );
+			}
+		}, this.options.delay );
+	},
+
+	search: function( value, event ) {
+		value = value != null ? value : this._value();
+
+		// always save the actual value, not the one passed as an argument
+		this.term = this._value();
+
+		if ( value.length < this.options.minLength ) {
+			return this.close( event );


<TRUNCATED>

[8/8] chukwa git commit: CHUKWA-806. Replace gridster with gridstack. (Eric Yang)

Posted by ey...@apache.org.
CHUKWA-806. Replace gridster with gridstack.  (Eric Yang)


Project: http://git-wip-us.apache.org/repos/asf/chukwa/repo
Commit: http://git-wip-us.apache.org/repos/asf/chukwa/commit/6f6e4399
Tree: http://git-wip-us.apache.org/repos/asf/chukwa/tree/6f6e4399
Diff: http://git-wip-us.apache.org/repos/asf/chukwa/diff/6f6e4399

Branch: refs/heads/master
Commit: 6f6e4399eb10f11814b2d478527d88b6ad351a99
Parents: e0bf3c0
Author: Eric Yang <ey...@apache.org>
Authored: Sat Apr 30 21:00:33 2016 -0700
Committer: Eric Yang <ey...@apache.org>
Committed: Sat Apr 30 21:00:33 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |     2 +
 LICENSE.txt                                     |    76 +
 NOTICE.txt                                      |     9 +-
 .../hadoop/chukwa/hicc/rest/Examples.java       |     8 +-
 src/main/web/hicc/WEB-INF/vm/circles.vm         |     2 +-
 src/main/web/hicc/home/css/component.css        |   349 +
 src/main/web/hicc/home/css/gridstack.min.css    |     1 +
 .../web/hicc/home/css/jquery.gridster.min.css   |     2 -
 src/main/web/hicc/home/index.html               |   132 +-
 src/main/web/hicc/home/js/gridstack.min.js      |    20 +
 src/main/web/hicc/home/js/gridstack.min.map     |     1 +
 src/main/web/hicc/home/js/jquery-ui.js          | 16150 +++++++++++++++++
 src/main/web/hicc/home/js/jquery.gridster.js    |  4051 -----
 .../web/hicc/home/js/jquery.gridster.min.js     |     2 -
 .../hicc/home/js/jquery.gridster.with-extras.js |  4163 -----
 .../home/js/jquery.gridster.with-extras.min.js  |     2 -
 src/main/web/hicc/home/js/lodash.min.js         |    89 +
 17 files changed, 16782 insertions(+), 8277 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ec869f8..fa9f7db 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,8 @@ Trunk (unreleased changes)
 
   IMPROVEMENTS
 
+    CHUKWA-806. Replace gridster with gridstack.  (Eric Yang)
+
     CHUKWA-805. Added examples to HICC rest api.  (Eric Yang)
 
     CHUKWA-804.  Update user documents to match current code base. (Eric Yang)

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index 734b897..01d13c0 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1267,3 +1267,79 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. You just DO WHAT THE FUCK YOU WANT TO.
+
+------
+grid-stack.js
+
+The MIT License (MIT)
+
+Copyright (c) 2014-2016 Pavel Reznikov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+------
+lodash
+
+Copyright jQuery Foundation and other contributors <https://jquery.org/>
+
+Based on Underscore.js, copyright Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/lodash/lodash
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code displayed within the prose of the
+documentation.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+Files located in the node_modules and vendor directories are externally
+maintained libraries used by this software which have their own
+licenses; we recommend you read them, as their terms may differ from the
+terms above.

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index 9990966..782b76d 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -79,9 +79,6 @@ Copyright (c) 2011-2015 Twitter, Inc.
 This product includes typeahead.js
 Copyright (c) 2011-2015 Twitter, Inc.
 
-This product includes gridster.js
-Copyright (c) 2014 ducksboard, http://gridster.net/
-
 This product includes Modernizr
 Copyright (c) 2009-2015 modernizr.com
 
@@ -102,3 +99,9 @@ Copyright (c) 2014-2015, https://github.com/pguso/jquery-plugin-circliful
 
 This product includes chartist.js
 Copyright (c) 2014-2015, https://gionkunz.github.io/chartist-js/
+
+This product includes gridstack.js
+Copyright (c) 2014-2016 Pavel Reznikov
+
+This product includes lodash
+Public Domain

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java
index 4c2de0a..bc1c596 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java
@@ -186,8 +186,8 @@ public class Examples {
       widget.setSrc(new URI("/hicc/welcome.html"));
       widget.setCol(1);
       widget.setRow(1);
-      widget.setSize_x(10);
-      widget.setSize_y(5);
+      widget.setSize_x(12);
+      widget.setSize_y(7);
       WELCOME_PAGE_WIDGET = widget;
       dashboard.add(WELCOME_PAGE_WIDGET);
       DEFAULT_DASHBOARD = dashboard;
@@ -281,8 +281,8 @@ public class Examples {
       widget.setSrc(new URI("/hicc/v1/dashboard/quicklinks"));
       widget.setCol(1);
       widget.setRow(1);
-      widget.setSize_x(10);
-      widget.setSize_y(5);
+      widget.setSize_x(12);
+      widget.setSize_y(7);
       QUICK_LINKS_WIDGET = widget;
       dashboard.add(QUICK_LINKS_WIDGET);
 

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/WEB-INF/vm/circles.vm
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/WEB-INF/vm/circles.vm b/src/main/web/hicc/WEB-INF/vm/circles.vm
index 65e38ff..c53450a 100644
--- a/src/main/web/hicc/WEB-INF/vm/circles.vm
+++ b/src/main/web/hicc/WEB-INF/vm/circles.vm
@@ -103,7 +103,7 @@ function render(result) {
         color = "#f7d254";
       }
     #end
-    if(radius < 200) {
+    if(radius < 180) {
       width=10;
       fontsize = 12;
     }

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/css/component.css
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/css/component.css b/src/main/web/hicc/home/css/component.css
index 1d4d53e..497e20b 100755
--- a/src/main/web/hicc/home/css/component.css
+++ b/src/main/web/hicc/home/css/component.css
@@ -27,6 +27,309 @@
 	font-style: normal;
 }
 
+/* =============================================================================
+   NORMALIZATION
+========================================================================== */
+
+/* *  {
+  margin: 0;
+  padding: 0;
+} */
+
+article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
+[hidden] { display: none; }
+
+ul, ol {
+    list-style: none;
+}
+
+/* =============================================================================
+   COMMONS
+========================================================================== */
+
+* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
+
+@font-face {
+    font-family:'Glyphicons Halflings';
+    src:url(../../fonts/glyphicons-halflings-regular.eot);
+    src:url(../../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),
+        url(../../fonts/glyphicons-halflings-regular.woff2) format('woff2'),
+        url(../../fonts/glyphicons-halflings-regular.woff) format('woff'),
+        url(../../fonts/glyphicons-halflings-regular.ttf) format('truetype'),
+        url(../../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')
+}
+
+body {
+    background-color: #ffffff;
+    font-family: 'Helvetica Neue', Arial, sans-serif;
+    -webkit-font-smoothing: antialiased;
+    font-size: x-small;
+    color: #666666;
+}
+
+.gs-w {
+    background: #FFF;
+    cursor: pointer;
+    //-webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3);
+    //box-shadow: 0 0 5px rgba(0,0,0,0.3);
+    z-index: 2;
+    position: absolute;
+    min-width: 140px;
+    min-height: 140px;
+}
+
+.ready .gs-w:not(.preview-holder) {
+    -webkit-transition: opacity .3s, left .3s, top .3s;
+    -moz-transition: opacity .3s, left .3s, top .3s;
+    -o-transition: opacity .3s, left .3s, top .3s;
+    transition: opacity .3s, left .3s, top .3s;
+}
+
+.ready .gs-w:not(.preview-holder),
+.ready .resize-preview-holder {
+    -webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+    -moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+    -o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+    transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+}
+
+.gs-resize-handle {
+    position: absolute;
+    z-index: 1;
+}
+
+.gs-resize-handle-both {
+    width: 20px;
+    height: 20px;
+    bottom: -8px;
+    right: -8px;
+    background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg08IS0tIEdlbmVyYXRvcjogQWRvYmUgRmlyZXdvcmtzIENTNiwgRXhwb3J0IFNWRyBFeHRlbnNpb24gYnkgQWFyb24gQmVhbGwgKGh0dHA6Ly9maXJld29ya3MuYWJlYWxsLmNvbSkgLiBWZXJzaW9uOiAwLjYuMSAgLS0+DTwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DTxzdmcgaWQ9IlVudGl0bGVkLVBhZ2UlMjAxIiB2aWV3Qm94PSIwIDAgNiA2IiBzdHlsZT0iYmFja2dyb3VuZC1jb2xvcjojZmZmZmZmMDAiIHZlcnNpb249IjEuMSINCXhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiDQl4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiDT4NCTxnIG9wYWNpdHk9IjAuMzAyIj4NCQk8cGF0aCBkPSJNIDYgNiBMIDAgNiBMIDAgNC4yIEwgNCA0LjIgTCA0LjIgNC4yIEwgNC4yIDAgTCA2IDAgTCA2IDYgTCA2IDYgWiIgZmlsbD0iIzAwMDAwMCIvPg0JPC9nPg08L3N2Zz4=');
+    background-position: top left;
+    background-repeat: no-repeat;
+    cursor: se-resize;
+    z-index: 20;
+}
+
+.gs-resize-handle-x {
+    top: 0;
+    bottom: 13px;
+    right: -5px;
+    width: 10px;
+    cursor: e-resize;
+}
+
+.gs-resize-handle-y {
+    left: 0;
+    right: 13px;
+    bottom: -5px;
+    height: 10px;
+    cursor: s-resize;
+}
+
+.gs-w:hover {
+    -webkit-box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
+    box-shadow: 3px 3px 5px rgba(0,0,0,0.3);    
+    z-index: 10;
+}
+
+.gs-w:hover .gs-resize-handle,
+.resizing .gs-resize-handle {
+    opacity: 1;
+}
+
+.gs-resize-handle,
+.gs-w.dragging .gs-resize-handle {
+    opacity: 0;
+}
+
+.gs-resize-disabled .gs-resize-handle {
+    display: none!important;
+}
+
+[data-max-sizex="1"] .gs-resize-handle-x,
+[data-max-sizey="1"] .gs-resize-handle-y,
+[data-max-sizey="1"][data-max-sizex="1"] .gs-resize-handle {
+    display: none !important;
+}
+
+.gs-w:hover .gs-header {
+    opacity: .3;
+    //filter: blur(5px);
+}
+
+.gs-header {
+    color: #555555;
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 30px;
+    background-color: #eeeeee;
+    opacity: 0;
+    z-index: 20;
+}
+
+.gs-icon {
+    display:inline-block;
+    font-family:'Glyphicons Halflings';
+    font-style:normal;
+    font-weight:400;
+    font-size: 18px;
+    line-height:30px;
+    -webkit-font-smoothing:antialiased;
+    -moz-osx-font-smoothing:grayscale;
+    padding-left: 2px;
+    padding-right: 2px;
+}
+
+.gs-close-handle:before {
+    content:"\e014"
+}
+
+.gs-close-handle {
+    position: absolute;
+    left: 0;
+    width: 24px;
+    height: 30px;
+}
+
+.gs-zoom-handle:before {
+    content:"\e164"
+}
+
+.gs-zoom-handle {
+    position: absolute;
+    right: 0;
+    width: 24px;
+    height: 30px;
+}
+
+
+.overlay_fix {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    z-index: 100000;
+    opacity: 0;
+    display: none;
+}
+
+.wrapper {
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  width: 100%;
+  height: 100%;
+}
+
+li iframe {
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  width: 100%;
+  height: 100%;
+  border: 0px;
+  overflow: hidden;
+}
+
+.tt-dropdown-menu {
+  width: 355px;
+  margin-top: 0px;
+  background-color: #fff;
+  height: 100%;
+}
+
+.typeahead {
+  height: 60px;
+}
+
+.tt-dataset-widgets {
+  width: 355px;
+  margin-top: 0px;
+  background-color: #fff;
+  height: 100%;
+}
+
+.tt-input {
+  position: absolute;
+  top: 0px;
+  width: 240px;
+  height: 38px; 
+  padding: 11px 12px;
+  border: 2px solid #ccc;
+  outline: none;
+}
+
+.tt-hint {
+  position: absolute;
+  top: 0px;
+  width: 240px;
+  height: 60px; 
+  padding: 0px 12px;
+  border: 2px solid #ccc;
+  outline: none;
+}
+
+.tt-suggestions {
+  width: 100%;
+  height: 100%;
+  background-color: #496274;
+  display: block;
+}
+
+.tt-suggestion {
+  clear: both;
+  display: block;
+  box-shadow: inset 0 1px #c6d0da;
+  font-size: 18px;
+  font-weight: bold;
+  height: 60px;
+  color: #fff;
+  background-color: #496274;
+  overflow: hidden;
+  cursor: pointer;
+}
+
+.tt-suggestion > p {
+  margin: 0px;
+  padding: 0px 60px;
+}
+
+.tt-suggestion > p:hover,
+.tt-suggestion > p:focus {
+}
+
+.tt-suggestion.tt-cursor {
+  color: #496274;
+  background-color: white;
+}
+
+.input-group span.twitter-typeahead {
+  display: block !important;
+}
+
+.input-group span.twitter-typeahead .tt-dropdown-menu {
+  top: 32px !important;
+}
+
+.input-group.input-group-lg span.twitter-typeahead .tt-dropdown-menu {
+  top: 44px !important;
+}
+
+.input-group.input-group-sm span.twitter-typeahead .tt-dropdown-menu {
+  top: 28px !important;
+}
+
+#the-basics {
+  text-align: center;
+}
+
 .container > header,
 .codrops-top {
 	color: #fff;
@@ -631,3 +934,49 @@ input.gn-search:focus {
     height: 100%;
 }
 
+.grid-stack {
+    top: 60px;
+}
+
+.grid-stack-item:hover {
+    -webkit-box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
+    box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
+    z-index: 10;
+}
+
+.grid-stack-item > div {
+    display: none
+}
+
+.grid-stack-item:hover > div {
+    display: block;
+    z-index: 20;
+    opacity: 0.3;
+}
+
+.grid-stack-item iframe {
+    border: none;
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    height: 100%;
+    width: 100%;
+}
+
+.widget-header {
+    color: #555555;
+    background-color: #eeeeee;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    width: 100%;
+    height: 30px;
+}
+
+.grid-stack>.grid-stack-item>.ui-resizable-se {
+    right: 0;
+}

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/css/gridstack.min.css
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/css/gridstack.min.css b/src/main/web/hicc/home/css/gridstack.min.css
new file mode 100644
index 0000000..5fb6602
--- /dev/null
+++ b/src/main/web/hicc/home/css/gridstack.min.css
@@ -0,0 +1 @@
+:root .grid-stack-item>.ui-resizable-handle{filter:none}.grid-stack{position:relative}.grid-stack.grid-stack-rtl{direction:ltr}.grid-stack.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack .grid-stack-placeholder>.placeholder-content{border:1px dashed #d3d3d3;margin:0;position:absolute;top:0;left:10px;right:10px;bottom:0;width:auto;z-index:0!important;text-align:center}.grid-stack>.grid-stack-item{min-width:8.3333333333%;position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;top:0;left:10px;right:10px;bottom:0;width:auto;z-index:0!important;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack>.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack>.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack>.grid-stack-item.ui-draggable-dragging,.grid-sta
 ck>.grid-stack-item.ui-resizable-resizing{z-index:100}.grid-stack>.grid-stack-item.ui-draggable-dragging>.grid-stack-item-content,.grid-stack>.grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px rgba(0,0,0,.2);opacity:.8}.grid-stack>.grid-stack-item>.ui-resizable-se,.grid-stack>.grid-stack-item>.ui-resizable-sw{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE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MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45
 MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);background-repeat:no-repeat;background-position:center;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.grid-stack>.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;left:10px;top:0}.grid-stack>.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack>.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;right:10px;top:0}.grid-stack>.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;right:10px;top:15px;bottom:15px}.grid-stack>.grid-stack-item>.ui-resizable-se{-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rota
 te(-45deg);transform:rotate(-45deg);cursor:se-resize;width:20px;height:20px;right:10px;bottom:0}.grid-stack>.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack>.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;left:10px;bottom:0}.grid-stack>.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;left:10px;top:15px;bottom:15px}.grid-stack>.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack>.grid-stack-item[data-gs-width='1']{width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='1']{left:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='1']{min-width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='1']{max-width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='2']{width:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='2']{left:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='2']{min-width:16.6666666667%}.g
 rid-stack>.grid-stack-item[data-gs-max-width='2']{max-width:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='3']{width:25%}.grid-stack>.grid-stack-item[data-gs-x='3']{left:25%}.grid-stack>.grid-stack-item[data-gs-min-width='3']{min-width:25%}.grid-stack>.grid-stack-item[data-gs-max-width='3']{max-width:25%}.grid-stack>.grid-stack-item[data-gs-width='4']{width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='4']{left:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='4']{min-width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='4']{max-width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='5']{width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='5']{left:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='5']{min-width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='5']{max-width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='6']{width:50%}.grid-stack>.grid-stack-item[data-gs-x='6']{lef
 t:50%}.grid-stack>.grid-stack-item[data-gs-min-width='6']{min-width:50%}.grid-stack>.grid-stack-item[data-gs-max-width='6']{max-width:50%}.grid-stack>.grid-stack-item[data-gs-width='7']{width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='7']{left:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='7']{min-width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='7']{max-width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='8']{width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='8']{left:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='8']{min-width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='8']{max-width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='9']{width:75%}.grid-stack>.grid-stack-item[data-gs-x='9']{left:75%}.grid-stack>.grid-stack-item[data-gs-min-width='9']{min-width:75%}.grid-stack>.grid-stack-item[data-gs-max-width='9']{max-width:75%}.grid-stack>.grid-stack-item[data-gs-width
 ='10']{width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='10']{left:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='10']{min-width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='10']{max-width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='11']{width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='11']{left:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='11']{min-width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='11']{max-width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='12']{width:100%}.grid-stack>.grid-stack-item[data-gs-x='12']{left:100%}.grid-stack>.grid-stack-item[data-gs-min-width='12']{min-width:100%}.grid-stack>.grid-stack-item[data-gs-max-width='12']{max-width:100%}.grid-stack.grid-stack-animate,.grid-stack.grid-stack-animate .grid-stack-item{-webkit-transition:left .3s,top .3s,height .3s,width .3s;-moz-transition:left .3s,top .3s,height .3s,width .3s;-ms-transition:l
 eft .3s,top .3s,height .3s,width .3s;-o-transition:left .3s,top .3s,height .3s,width .3s;transition:left .3s,top .3s,height .3s,width .3s}.grid-stack.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack.grid-stack-animate .grid-stack-item.ui-resizable-resizing{-webkit-transition:left 0s,top 0s,height 0s,width 0s;-moz-transition:left 0s,top 0s,height 0s,width 0s;-ms-transition:left 0s,top 0s,height 0s,width 0s;-o-transition:left 0s,top 0s,height 0s,width 0s;transition:left 0s,top 0s,height 0s,width 0s}@media (max-width:768px){.grid-stack-item{position:relative!important;width:auto!important;left:0!important;top:auto!important;margin-bottom:20px}.grid-stack-item .ui-resizable-handle{display:none}.grid-stack{height:auto!important}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/css/jquery.gridster.min.css
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/css/jquery.gridster.min.css b/src/main/web/hicc/home/css/jquery.gridster.min.css
deleted file mode 100755
index 9d9fe84..0000000
--- a/src/main/web/hicc/home/css/jquery.gridster.min.css
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! gridster.js - v0.5.6 - 2014-09-25 - * http://gridster.net/ - Copyright (c) 2014 ducksboard; Licensed MIT */ 
-.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s,width .4s;-moz-transition:height .4s,width .4s;-o-transition:height .4s,width .4s;-ms-transition:height .4s,width .4s;transition:height .4s,width .4s}.gridster .gs-w{z-index:2;position:absolute}.ready .gs-w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.ready .gs-w:not(.preview-holder),.ready .resize-preview-holder{-webkit-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;-moz-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;-o-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;transition:opacity .3s,left .3s,top .3s,width .3s,height .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3
 s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging,.gridster .resizing{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important}.gs-resize-handle{position:absolute;z-index:1}.gs-resize-handle-both{width:20px;height:20px;bottom:-8px;right:-8px;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg08IS0tIEdlbmVyYXRvcjogQWRvYmUgRmlyZXdvcmtzIENTNiwgRXhwb3J0IFNWRyBFeHRlbnNpb24gYnkgQWFyb24gQmVhbGwgKGh0dHA6Ly9maXJld29ya3MuYWJlYWxsLmNvbSkgLiBWZXJzaW9uOiAwLjYuMSAgLS0+DTwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DTxzdmcgaWQ9IlVudGl0bGVkLVBhZ2UlMjAxIiB2aWV3Qm94PSIwIDAgNiA2IiBzdHlsZT0iYmFja2dyb3VuZC1jb2xvcjojZmZmZmZmMDAiIHZlcnNpb249IjEuMSINCXhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8y
 MDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiDQl4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiDT4NCTxnIG9wYWNpdHk9IjAuMzAyIj4NCQk8cGF0aCBkPSJNIDYgNiBMIDAgNiBMIDAgNC4yIEwgNCA0LjIgTCA0LjIgNC4yIEwgNC4yIDAgTCA2IDAgTCA2IDYgTCA2IDYgWiIgZmlsbD0iIzAwMDAwMCIvPg0JPC9nPg08L3N2Zz4=);background-position:top left;background-repeat:no-repeat;cursor:se-resize;z-index:20}.gs-resize-handle-x{top:0;bottom:13px;right:-5px;width:10px;cursor:e-resize}.gs-resize-handle-y{left:0;right:13px;bottom:-5px;height:10px;cursor:s-resize}.gs-w:hover .gs-resize-handle,.resizing .gs-resize-handle{opacity:1}.gs-resize-handle,.gs-w.dragging .gs-resize-handle{opacity:0}.gs-resize-disabled .gs-resize-handle{display:none!important}[data-max-sizex="1"] .gs-resize-handle-x,[data-max-sizey="1"] .gs-resize-handle-y,[data-max-sizey="1"][data-max-sizex="1"] .gs-resize-handle{display:none!important}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/index.html
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/index.html b/src/main/web/hicc/home/index.html
index 828c291..aefe260 100755
--- a/src/main/web/hicc/home/index.html
+++ b/src/main/web/hicc/home/index.html
@@ -27,11 +27,14 @@
     <title>Chukwa</title>
     <link rel="shortcut icon" href="../favicon.ico">
     <link rel="stylesheet" type="text/css" href="css/normalize.css" />
-    <link rel="stylesheet" type="text/css" href="css/jquery.gridster.css" />
+    <!-- link rel="stylesheet" type="text/css" href="css/jquery.gridster.css" / -->
+    <link rel="stylesheet" type="text/css" href="css/gridstack.min.css" />
     <link rel="stylesheet" type="text/css" href="css/component.css" />
     <script src="js/modernizr.custom.js"></script>
     <script src="js/jquery.js" type="text/javascript"></script>
-    <script src="js/jquery.gridster.js" type="text/javascript" charset="utf-8"></script>
+    <script src="js/jquery-ui.js"></script>
+    <script src="js/lodash.min.js" type="text/javascript"></script>
+    <script src="js/gridstack.min.js" type="text/javascript"></script>
     <script src="js/typeahead.bundle.js" type="text/javascript"></script>
   </head>
   <body>
@@ -75,9 +78,8 @@
         <li><a class="gn-icon-fullscreen" onclick="toggleFullScreen()"><span> </span></a></li>
       </ul>
     </div><!-- /container -->
-    <div class="gridster">
-      <ul/>
-    </div>
+
+    <div class="grid-stack"></div>
 
     <script src="js/classie.js"></script>
     <script src="js/gnmenu.js"></script>
@@ -142,48 +144,73 @@ function toggleGlass() {
   $('#glass').toggle();
 }
 
+function buildWidget(src) {
+  var html = '<div class="grid-stack-item-content">' +
+             '<div class="widget-header">' +
+             '<span class="gs-icon gs-close-handle" onClick="remove_widget(this);"></span>' +
+             '<span class="gs-icon gs-zoom-handle" onClick="zoom_widget(this);"></span>' +
+             '</div>' +
+             '<iframe src="'+src+'"></iframe>' +
+             '<div class="overlay_fix" style="display: none"></div></div>';
+  return html
+}
+
+function remove_widget(target) {
+  el = $(target).closest('.grid-stack-item')
+  var gridstack = $(".grid-stack").data('gridstack');
+  gridstack.removeWidget(el);
+  save();
+}
+
+function zoom_widget(button) {
+  var url = $(button).parent().parent().find('iframe').contents().get(0).location.href;
+  window.location.href = url;
+}
+
 // Load dashboard
 function load() {
   $.getJSON('/hicc/v1/dashboard/load/'+dashboard,
     function(data) {
       grid_data = data.grid;
-      grid_data = Gridster.sort_by_row_and_col_asc(grid_data);
-      var overlay_fix_start = function() {
-        $('.overlay_fix').show();
-      }
 
-      var overlay_fix_stop = function() {
-        $('.overlay_fix').hide();
-        save();
+      var options = {
+        cellHeight: 110,
+        verticalMargin: 10,
+        handle: '.widget-header'
       };
-      var gridster = $(".gridster ul").gridster({
-        widget_margins: [0, 0],
-        widget_base_dimensions: [140, 140],
-        autogrow_cols: true,
-	max_cols: 10,
-        limit: true,
-        draggable: {
-          handle: 'header',
-          start: overlay_fix_start,
-          stop: overlay_fix_stop
-        },
-        resize: {
-          enabled: true,
-          start: overlay_fix_start,
-          stop: overlay_fix_stop
-        },
-        header: {
-          enabled: true
-        }
-      });
+      $('.grid-stack').gridstack(options);
+      var gridstack = $(".grid-stack").data('gridstack');
+      gridstack.removeAll();
 
+      $('.grid-stack').on('dragstart', function(event, ui) {
+        var grid = this;
+        var element = event.target;
+        $('.overlay_fix').show();
+      });
+      $('.grid-stack').on('dragstop', function(event, ui) {
+        var grid = this;
+        var element = event.target;
+        $('.overlay_fix').hide();
+      });
+      $('.grid-stack').on('resizestart', function(event, ui) {
+        var grid = this;
+        var element = event.target;
+        $('.overlay_fix').show();
+      });
+      $('.grid-stack').on('resizestop', function(event, ui) {
+        var grid = this;
+        var element = event.target;
+        $('.overlay_fix').hide();
+      });
       $.each(grid_data, function() {
-        var gridster = $(".gridster ul").gridster().data('gridster');
-        gridster.add_widget(this.src,
-          this.size_x,
-          this.size_y,
-          this.col,
-          this.row);
+        var gridstack = $(".grid-stack").data('gridstack');
+        gridstack.addWidget(buildWidget(this.src), this.col, this.row, this.size_x, this.size_y);
+
+      });
+      // Bind save operation only after load operation has been
+      // completed to avoid race conditions.
+      $('.grid-stack').on('change', function(event, ui) {
+        save();
       });
     }
   );
@@ -214,9 +241,20 @@ function load() {
 
 // Save Dashboard
 function save() {
-  var gridster = $(".gridster ul").gridster().data('gridster');
-  var s = gridster.serialize();
-  var data = { "grid" : s };
+  var items = [];
+  $('.grid-stack-item.ui-draggable').each(function () {
+        var $this = $(this);
+        var iframe = $this.find('iframe')[0];
+        items.push({
+            col: parseInt($this.attr('data-gs-x')),
+            row: parseInt($this.attr('data-gs-y')),
+            size_x: parseInt($this.attr('data-gs-width')),
+            size_y: parseInt($this.attr('data-gs-height')),
+            src: iframe.src,
+        });
+    });
+
+  var data = { "grid" : items };
   $.ajax({
     url: '/hicc/v1/dashboard/save/'+dashboard,
     type: 'PUT',
@@ -234,21 +272,19 @@ function setDashboard(value) {
     contentType: 'application/json',
     data: JSON.stringify(data)
   });
-  var gridster = $(".gridster ul").gridster().data('gridster');
-  gridster.remove_all_widgets();
   load();
   showGrid();
 }
 
 function showGrid() {
   $(".frame").hide();
-  $(".gridster ul").show();
+  $(".grid-stack").show();
 }
 
 function showFrame(target) {
   $("#frame").attr("src", target);
   $(".frame").show();
-  $(".gridster ul").hide();
+  $(".grid-stack").hide();
   gnMenu._closeMenu();
 }
 
@@ -284,9 +320,8 @@ $(function(){ //DOM Ready
       var title = $('#url').val();
       if(title in widgetsToUrl) {
         var url = widgetsToUrl[title];
-        var gridster = $(".gridster ul").gridster().data('gridster');
-        gridster.add_widget(url, 1, 1, 1, 1);
-        setTimeout(function(){ save(); }, 3000);
+        var gridstack = $(".grid-stack").data('gridstack');
+        gridstack.addWidget(buildWidget(url), 0, 0, 1, 1);
       }
     }
   });
@@ -313,7 +348,6 @@ $(function(){ //DOM Ready
 function setTime() {
   var data = {};
   data['period'] = $('input[name=period]:checked').val();
-  console.log(data);
   $.ajax({
     url: '/hicc/v1/session/save',
     type: 'PUT',

http://git-wip-us.apache.org/repos/asf/chukwa/blob/6f6e4399/src/main/web/hicc/home/js/gridstack.min.js
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/home/js/gridstack.min.js b/src/main/web/hicc/home/js/gridstack.min.js
new file mode 100644
index 0000000..a369610
--- /dev/null
+++ b/src/main/web/hicc/home/js/gridstack.min.js
@@ -0,0 +1,20 @@
+/**
+ * gridstack.js 0.2.5
+ * http://troolee.github.io/gridstack.js/
+ * (c) 2014-2016 Pavel Reznikov
+ * gridstack.js may be freely distributed under the MIT license.
+ * @preserve
+*/
+!function(a){if("function"==typeof define&&define.amd)define(["jquery","lodash","jquery-ui/core","jquery-ui/widget","jquery-ui/mouse","jquery-ui/draggable","jquery-ui/resizable"],a);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(b){}try{_=require("lodash")}catch(b){}a(jQuery,_)}else a(jQuery,_)}(function(a,b){var c=window,d=function(a,b,c){var d=function(){return console.warn("gridstack.js: Function `"+b+"` is deprecated as of v0.2.5 and has been replaced with `"+c+"`. It will be **completely** removed in v1.0."),a.apply(this,arguments)};return d.prototype=a.prototype,d},e=function(a,b){console.warn("gridstack.js: Option `"+a+"` is deprecated as of v0.2.5 and has been replaced with `"+b+"`. It will be **completely** removed in v1.0.")},f={isIntercepted:function(a,b){return!(a.x+a.width<=b.x||b.x+b.width<=a.x||a.y+a.height<=b.y||b.y+b.height<=a.y)},sort:function(a,c,d){return d=d||b.chain(a).map(function(a){return a.x+a.width}).max().value(),c=-1!=c?1:-1,b.so
 rtBy(a,function(a){return c*(a.x+a.y*d)})},createStylesheet:function(a){var b=document.createElement("style");return b.setAttribute("type","text/css"),b.setAttribute("data-gs-style-id",a),b.styleSheet?b.styleSheet.cssText="":b.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(b),b.sheet},removeStylesheet:function(b){a("STYLE[data-gs-style-id="+b+"]").remove()},insertCSSRule:function(a,b,c,d){"function"==typeof a.insertRule?a.insertRule(b+"{"+c+"}",d):"function"==typeof a.addRule&&a.addRule(b,c,d)},toBool:function(a){return"boolean"==typeof a?a:"string"==typeof a?(a=a.toLowerCase(),!(""===a||"no"==a||"false"==a||"0"==a)):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&f.isIntercepted(a,this.nn)},_didCollide:function(a){return f.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return f.isIntercepted({x:this.x,y:this.y,width:this.node.width,height:this.node.h
 eight},a)},parseHeight:function(a){var c=a,d="px";if(c&&b.isString(c)){var e=c.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/);if(!e)throw new Error("Invalid height");d=e[2]||"px",c=parseFloat(e[1])}return{height:c,unit:d}}};
+// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
+f.is_intercepted=d(f.isIntercepted,"is_intercepted","isIntercepted"),f.create_stylesheet=d(f.createStylesheet,"create_stylesheet","createStylesheet"),f.remove_stylesheet=d(f.removeStylesheet,"remove_stylesheet","removeStylesheet"),f.insert_css_rule=d(f.insertCSSRule,"insert_css_rule","insertCSSRule");
+// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
+var g=0,h=function(a,b,c,d,e){this.width=a,this["float"]=c||!1,this.height=d||0,this.nodes=e||[],this.onchange=b||function(){},this._updateCounter=0,this._float=this["float"],this._addedNodes=[],this._removedNodes=[]};h.prototype.batchUpdate=function(){this._updateCounter=1,this["float"]=!0},h.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this["float"]=this._float,this._packNodes(),this._notify())},
+// For Meteor support: https://github.com/troolee/gridstack.js/pull/272
+h.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},h.prototype._fixCollisions=function(a){this._sortNodes(-1);var c=a,d=Boolean(b.find(this.nodes,function(a){return a.locked}));for(this["float"]||d||(c={x:0,y:a.y,width:this.width,height:a.height});;){var e=b.find(this.nodes,b.bind(f._collisionNodeCheck,{node:a,nn:c}));if("undefined"==typeof e)return;this.moveNode(e,e.x,a.y+a.height,e.width,e.height,!0)}},h.prototype.isAreaEmpty=function(a,c,d,e){var g={x:a||0,y:c||0,width:d||1,height:e||1},h=b.find(this.nodes,b.bind(function(a){return f.isIntercepted(a,g)},this));return null===h||"undefined"==typeof h},h.prototype._sortNodes=function(a){this.nodes=f.sort(this.nodes,a,this.width)},h.prototype._packNodes=function(){this._sortNodes(),this["float"]?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&"undefined"!=typeof a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(f._didCollide,
 {n:a,newY:d})).value();e||(a._dirty=!0,a.y=d),--d}},this)):b.each(this.nodes,b.bind(function(a,c){if(!a.locked)for(;a.y>0;){var d=a.y-1,e=0===c;if(c>0){var g=b.chain(this.nodes).take(c).find(b.bind(f._didCollide,{n:a,newY:d})).value();e="undefined"==typeof g}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},h.prototype._prepareNode=function(a,c){return a=b.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(c?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},h.prototype._notify=function(){if(!this._updateCounter){var a=Array.prototype.slice.call(arguments,0);a=a.concat(this.getDirtyNodes()),this.onchange(a)}},h.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nod
 es,function(a){a._dirty=!1})},h.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},h.prototype.addNode=function(a,c){if(a=this._prepareNode(a),"undefined"!=typeof a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),"undefined"!=typeof a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),"undefined"!=typeof a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++g,a._dirty=!0,a.autoPosition){this._sortNodes();for(var d=0;;++d){var e=d%this.width,h=Math.floor(d/this.width);if(!(e+a.width>this.width||b.find(this.nodes,b.bind(f._isAddNodeIntercepted,{x:e,y:h,node:a})))){a.x=e,a.y=h;break}}}return this.nodes.push(a),"undefined"!=typeof c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},h.prototype.removeNode=function(a,c){c="undefined"==typeof c?!0:c,this._removedNodes.push(b.clone(a)),a._id=null,this.nodes=b.without(this
 .nodes,a),this._packNodes(),c&&this._notify(a)},h.prototype.canMoveNode=function(c,d,e,f,g){var i=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!i)return!0;var j,k=new h(this.width,null,this["float"],0,b.map(this.nodes,function(b){return b==c?j=a.extend({},b):a.extend({},b)}));if("undefined"==typeof j)return!0;k.moveNode(j,d,e,f,g);var l=!0;return i&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=j&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height),l},h.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new h(this.width,null,this["float"],0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},h.prototype.moveNode=function(a,b,c,d,e,f){if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=t
 ypeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;var g=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},h.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},h.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},h.prototype.endUpdate=function(){b.each(this.nodes,function(a){a._origY=a.y});var a=b.find(this.nodes,function(a){return a._updating});a&&(a._updating=!1)};var i=function(c,d){var f,g,i=this;d=d||{},this.container=a(c),"undefined"!=typeof d.handle_class&&(d.handleClass=d.handle_class,e("handle_class","handleClass")),"undefined"!=typeof d.item_class&&(d.itemClass=d.item_class,e("item_class","itemClass")),"und
 efined"!=typeof d.placeholder_class&&(d.placeholderClass=d.placeholder_class,e("placeholder_class","placeholderClass")),"undefined"!=typeof d.placeholder_text&&(d.placeholderText=d.placeholder_text,e("placeholder_text","placeholderText")),"undefined"!=typeof d.cell_height&&(d.cellHeight=d.cell_height,e("cell_height","cellHeight")),"undefined"!=typeof d.vertical_margin&&(d.verticalMargin=d.vertical_margin,e("vertical_margin","verticalMargin")),"undefined"!=typeof d.min_width&&(d.minWidth=d.min_width,e("min_width","minWidth")),"undefined"!=typeof d.static_grid&&(d.staticGrid=d.static_grid,e("static_grid","staticGrid")),"undefined"!=typeof d.is_nested&&(d.isNested=d.is_nested,e("is_nested","isNested")),"undefined"!=typeof d.always_show_resize_handle&&(d.alwaysShowResizeHandle=d.always_show_resize_handle,e("always_show_resize_handle","alwaysShowResizeHandle")),d.itemClass=d.itemClass||"grid-stack-item";var j=this.container.closest("."+d.itemClass).size()>0;if(this.opts=b.defaults(d||{},
 {width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,"float":!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:d.alwaysShowResizeHandle||!1,resizable:b.defaults(d.resizable||{},{autoHide:!d.alwaysShowResizeHandle,handles:"se"}),draggable:b.defaults(d.draggable||{},{handle:(d.handleClass?"."+d.handleClass:d.handle?d.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:d.disableDrag||!1,disableResize:d.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px"}),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&
 &this.container.addClass("grid-stack-rtl"),this.opts.isNested=j,g="auto"===this.opts.cellHeight,g?i.cellHeight(i.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),j&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new h(this.opts.width,function(a){var c=0;b.each(a,function(a){null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),c=Math.max(c,a.y+a.height))}),i._updateStyles(c+10)},this.opts["float"],this.opts.height),this.opts.auto){var k=[],l=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),k.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*l.opts.width})}),b.chain(k).sortBy(function(a){return a.i}).each(function(a){i._prepareElement(a.el)}).value()}if(th
 is.setAnimation(this.opts.animate),this.placeholder=a('<div class="'+this.opts.placeholderClass+" "+this.opts.itemClass+'"><div class="placeholder-content">'+this.opts.placeholderText+"</div></div>").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){i.cellHeight(i.cellWidth(),!1)},100),this.onResizeHandler=function(){if(g&&i._updateHeightsOnResize(),i._isOneColumnMode()){if(f)return;f=!0,i.grid._sortNodes(),b.each(i.grid.nodes,function(a){i.container.append(a.el),i.opts.staticGrid||((a.noMove||i.opts.disableDrag)&&a.el.draggable("disable"),(a.noResize||i.opts.disableResize)&&a.el.resizable("disable"),a.el.trigger("resize"))})}else{if(!f)return;if(f=!1,i.opts.staticGrid)return;b.each(i.grid.nodes,function(a){a.noMove||i.opts.disableDrag||a.el.draggable("enable"),a.noResize||i.opts.disableResize||a.el.resizable("enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!i.opts.staticGrid&&"string"==typeof i.o
 pts.removable){var m=a(i.opts.removable);m.data("droppable")||m.droppable({accept:"."+i.opts.itemClass}),m.on("dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._setupRemovingTimeout(d)}).on("dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._clearRemovingTimeout(d)})}if(!i.opts.staticGrid&&i.opts.acceptWidgets){var n=null,o=function(a,b){var c=n,d=c.data("_gridstack_node"),e=i.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!i.grid.canMoveNode(d,f,g))return;i.grid.moveNode(d,f,g),i._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,i.grid.cleanNodes(),i.grid.beginUpdate(d),i.grid.addNode(d),i.container.append(i.placeholder),i.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=i.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,i._updateContainerHeight()};a(i.container).droppable({accept:
 function(b){b=a(b);var c=b.data("_gridstack_node");return c&&c._grid===i?!1:b.is(i.opts.acceptWidgets===!0?".grid-stack-item":i.opts.acceptWidgets)},over:function(b,c){var d=(i.container.offset(),a(c.draggable)),e=i.cellWidth(),f=i.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),j=g?g.height:Math.ceil(d.outerHeight()/f);n=d;var k=i.grid._prepareNode({width:h,height:j,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",o)},out:function(b,c){var d=a(c.draggable);d.unbind("drag",o);var e=d.data("_gridstack_node");e.el=null,i.grid.removeNode(e),i.placeholder.detach(),i._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))},drop:function(b,c){i.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=i;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,i.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("da
 ta-gs-width",d.width).attr("data-gs-height",d.height).addClass(i.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",o),i.container.append(e),i._prepareElementsByNode(e,d),i._updateContainerHeight(),i._triggerChangeEvent(),i.grid.endUpdate()}})}};
+// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
+// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
+return i.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||a===!0)&&this.container.trigger("change",d)},i.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[b.map(this.grid._addedNodes,b.clone)]),this.grid._addedNodes=[])},i.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[b.map(this.grid._removedNodes,b.clone)]),this.grid._removedNodes=[])},i.prototype._initStyles=function(){this._stylesId&&f.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=f.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},i.prototype._updateStyles=function(a){if(null!==this._styles&&"undefined"!=typeof this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if("undefined"==typeof a&
 &(a=this._styles._max,this._initStyles(),this._updateContainerHeight()),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&f.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;a>e;++e)f.insertCSSRule(this._styles,c+'[data-gs-height="'+(e+1)+'"]',"height: "+b(e+1,e)+";",e),f.insertCSSRule(this._styles,c+'[data-gs-min-height="'+(e+1)+'"]',"min-height: "+b(e+1,e)+";",e),f.insertCSSRule(this._styles,c+'[data-gs-max-height="'+(e+1)+'"]',"max-height: "+b(e+1,e)+";",e),f.insertCSSRule(this._styles,c+'[data-gs-y="'+e+'"]
 ',"top: "+b(e,e)+";",e);this._styles._max=a}}},i.prototype._updateContainerHeight=function(){if(!this.grid._updateCounter){var a=this.grid.getGridHeight();this.container.attr("data-gs-current-height",a),this.opts.cellHeight&&(this.opts.verticalMargin?this.opts.cellHeightUnit===this.opts.verticalMarginUnit?this.container.css("height",a*(this.opts.cellHeight+this.opts.verticalMargin)-this.opts.verticalMargin+this.opts.cellHeightUnit):this.container.css("height","calc("+(a*this.opts.cellHeight+this.opts.cellHeightUnit)+" + "+(a*(this.opts.verticalMargin-1)+this.opts.verticalMarginUnit)+")"):this.container.css("height",a*this.opts.cellHeight+this.opts.cellHeightUnit))}},i.prototype._isOneColumnMode=function(){return(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)<=this.opts.minWidth},i.prototype._setupRemovingTimeout=function(b){var c=this,d=a(b).data("_gridstack_node");!d._removeTimeout&&c.opts.removable&&(d._removeTimeout=setTimeout(function(){b.add
 Class("grid-stack-item-removing"),d._isAboutToRemove=!0},c.opts.removeTimeout))},i.prototype._clearRemovingTimeout=function(b){var c=a(b).data("_gridstack_node");c._removeTimeout&&(clearTimeout(c._removeTimeout),c._removeTimeout=null,b.removeClass("grid-stack-item-removing"),c._isAboutToRemove=!1)},i.prototype._prepareElementsByNode=function(c,d){var e,f,g=this,h=function(a,b){var h,i,j=Math.round(b.position.left/e),k=Math.floor((b.position.top+f/2)/f);if("drag"!=a.type&&(h=Math.round(b.size.width/e),i=Math.round(b.size.height/f)),"drag"==a.type)0>j||j>=g.grid.width||0>k?(g.opts.removable===!0&&g._setupRemovingTimeout(c),j=d._beforeDragX,k=d._beforeDragY,g.placeholder.detach(),g.placeholder.hide(),g.grid.removeNode(d),g._updateContainerHeight(),d._temporaryRemoved=!0):(g._clearRemovingTimeout(c),d._temporaryRemoved&&(g.grid.addNode(d),g.placeholder.attr("data-gs-x",j).attr("data-gs-y",k).attr("data-gs-width",h).attr("data-gs-height",i).show(),g.container.append(g.placeholder),d.el=g
 .placeholder,d._temporaryRemoved=!1));else if("resize"==a.type&&0>j)return;g.grid.canMoveNode(d,j,k,h,i)&&(g.grid.moveNode(d,j,k,h,i),g._updateContainerHeight())},i=function(b,h){g.container.append(g.placeholder);var i=a(this);g.grid.cleanNodes(),g.grid.beginUpdate(d),e=Math.ceil(i.outerWidth()/i.attr("data-gs-width"));var j=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));f=g.container.height()/parseInt(g.container.attr("data-gs-current-height")),g.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),d.el=g.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,c.resizable("option","minWidth",e*(d.minWidth||1)),c.resizable("option","minHeight",j*(d.minHeight||1)),"resizestart"==b.type&&i.find(".grid-stack-item").trigger("resizestart")},j=function(b,e){var f=a(this);if(f.data("_gridstack_node")){var h=!1;g.placeholder.detach(),d.el=f,g.placeholder.hid
 e(),d._isAboutToRemove?(h=!0,c.removeData("_gridstack_node"),c.remove()):(g._clearRemovingTimeout(c),d._temporaryRemoved?(f.attr("data-gs-x",d._beforeDragX).attr("data-gs-y",d._beforeDragY).attr("data-gs-width",d.width).attr("data-gs-height",d.height).removeAttr("style"),d.x=d._beforeDragX,d.y=d._beforeDragY,g.grid.addNode(d)):f.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).removeAttr("style")),g._updateContainerHeight(),g._triggerChangeEvent(h),g.grid.endUpdate();var i=f.find(".grid-stack");i.length&&"resizestop"==b.type&&(i.each(function(b,c){a(c).data("gridstack").onResizeHandler()}),f.find(".grid-stack-item").trigger("resizestop"))}};c.draggable(b.extend(this.opts.draggable,{containment:this.opts.isNested?this.container.parent():null,start:i,stop:j,drag:h})).resizable(b.extend(this.opts.resizable,{start:i,stop:j,resize:h})),(d.noMove||this._isOneColumnMode()||this.opts.disableDrag)&&c.draggable("disable"),(d.noResize||t
 his._isOneColumnMode()||this.opts.disableResize)&&c.resizable("disable"),c.attr("data-gs-locked",d.locked?"yes":null)},i.prototype._prepareElement=function(b,c){c="undefined"!=typeof c?c:!1;var d=this;b=a(b),b.addClass(this.opts.itemClass);var e=d.grid.addNode({x:b.attr("data-gs-x"),y:b.attr("data-gs-y"),width:b.attr("data-gs-width"),height:b.attr("data-gs-height"),maxWidth:b.attr("data-gs-max-width"),minWidth:b.attr("data-gs-min-width"),maxHeight:b.attr("data-gs-max-height"),minHeight:b.attr("data-gs-min-height"),autoPosition:f.toBool(b.attr("data-gs-auto-position")),noResize:f.toBool(b.attr("data-gs-no-resize")),noMove:f.toBool(b.attr("data-gs-no-move")),locked:f.toBool(b.attr("data-gs-locked")),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this.opts.staticGrid||this._prepareElementsByNode(b,e)},i.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},i.prototype.addWidget=function
 (b,c,d,e,f,g,h,i,j,k,l){return b=a(b),"undefined"!=typeof c&&b.attr("data-gs-x",c),"undefined"!=typeof d&&b.attr("data-gs-y",d),"undefined"!=typeof e&&b.attr("data-gs-width",e),"undefined"!=typeof f&&b.attr("data-gs-height",f),"undefined"!=typeof g&&b.attr("data-gs-auto-position",g?"yes":null),"undefined"!=typeof h&&b.attr("data-gs-min-width",h),"undefined"!=typeof i&&b.attr("data-gs-max-width",i),"undefined"!=typeof j&&b.attr("data-gs-min-height",j),"undefined"!=typeof k&&b.attr("data-gs-max-height",k),"undefined"!=typeof l&&b.attr("data-gs-id",l),this.container.append(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},i.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},i.prototype.willItFit=function(a,b,c,d,e){var f={x:a,y:b,width:c,height:d,autoPosition:e};return this.grid.canBePlacedWithRespectToHeight(f)},
 i.prototype.removeWidget=function(b,c){c="undefined"==typeof c?!0:c,b=a(b);var d=b.data("_gridstack_node");
+// For Meteor support: https://github.com/troolee/gridstack.js/pull/272
+d||(d=this.grid.getNodeDataByDOMEl(b)),this.grid.removeNode(d,c),b.removeData("_gridstack_node"),this._updateContainerHeight(),c&&b.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},i.prototype.removeAll=function(a){b.each(this.grid.nodes,b.bind(function(b){this.removeWidget(b.el,a)},this)),this.grid.nodes=[],this._updateContainerHeight()},i.prototype.destroy=function(b){a(window).off("resize",this.onResizeHandler),this.disable(),"undefined"==typeof b||b?this.container.remove():this.removeAll(!1),f.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},i.prototype.resizable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");d.opts.staticGrid||"undefined"==typeof f||null===f||(f.noResize=!c,f.noResize||d._isOneColumnMode()?e.resizable("disable"):e.resizable("enable"))}),this},i.prototype.movable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");d.opts.staticGrid||"u
 ndefined"==typeof f||null===f||(f.noMove=!c,f.noMove||d._isOneColumnMode()?(e.draggable("disable"),e.removeClass("ui-draggable-handle")):(e.draggable("enable"),e.addClass("ui-draggable-handle")))}),this},i.prototype.enableMove=function(a,b){this.movable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableDrag=!a)},i.prototype.enableResize=function(a,b){this.resizable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableResize=!a)},i.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},i.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},i.prototype.locked=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typ
 eof e&&null!==e&&(e.locked=c||!1,d.attr("data-gs-locked",e.locked?"yes":null))}),this},i.prototype.maxHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.maxHeight=c||!1,d.attr("data-gs-max-height",c)))}),this},i.prototype.minHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.minHeight=c||!1,d.attr("data-gs-min-height",c)))}),this},i.prototype.maxWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.maxWidth=c||!1,d.attr("data-gs-max-width",c)))}),this},i.prototype.minWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.minWidth=c||!1,d.attr("data-gs-min-width",c)))}),this},i.prototype._updateElement=function(b,c){b=a(b).first();var 
 d=b.data("_gridstack_node");if("undefined"!=typeof d&&null!==d){var e=this;e.grid.cleanNodes(),e.grid.beginUpdate(d),c.call(this,b,d),e._updateContainerHeight(),e._triggerChangeEvent(),e.grid.endUpdate()}},i.prototype.resize=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&"undefined"!=typeof b?b:d.width,c=null!==c&&"undefined"!=typeof c?c:d.height,this.grid.moveNode(d,d.x,d.y,b,c)})},i.prototype.move=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&"undefined"!=typeof b?b:d.x,c=null!==c&&"undefined"!=typeof c?c:d.y,this.grid.moveNode(d,b,c,d.width,d.height)})},i.prototype.update=function(a,b,c,d,e){this._updateElement(a,function(a,f){b=null!==b&&"undefined"!=typeof b?b:f.x,c=null!==c&&"undefined"!=typeof c?c:f.y,d=null!==d&&"undefined"!=typeof d?d:f.width,e=null!==e&&"undefined"!=typeof e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},i.prototype.verticalMargin=function(a,b){if("undefined"==typeof a)return this.opts.verticalMargin;var c=f.parseHeight(a);t
 his.opts.verticalMarginUnit===c.unit&&this.opts.height===c.height||(this.opts.verticalMarginUnit=c.unit,this.opts.verticalMargin=c.height,b||this._updateStyles())},i.prototype.cellHeight=function(a,b){if("undefined"==typeof a){if(this.opts.cellHeight)return this.opts.cellHeight;var c=this.container.children("."+this.opts.itemClass).first();return Math.ceil(c.outerHeight()/c.attr("data-gs-height"))}var d=f.parseHeight(a);this.opts.cellHeightUnit===d.heightUnit&&this.opts.height===d.height||(this.opts.cellHeightUnit=d.unit,this.opts.cellHeight=d.height,b||this._updateStyles())},i.prototype.cellWidth=function(){var a=this.container.children("."+this.opts.itemClass).first();return Math.ceil(a.outerWidth()/parseInt(a.attr("data-gs-width"),10))},i.prototype.getCellFromPixel=function(a,b){var c="undefined"!=typeof b&&b?this.container.offset():this.container.position(),d=a.left-c.left,e=a.top-c.top,f=Math.floor(this.container.width()/this.opts.width),g=Math.floor(this.container.height()/par
 seInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(d/f),y:Math.floor(e/g)}},i.prototype.batchUpdate=function(){this.grid.batchUpdate()},i.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},i.prototype.isAreaEmpty=function(a,b,c,d){return this.grid.isAreaEmpty(a,b,c,d)},i.prototype.setStatic=function(a){this.opts.staticGrid=a===!0,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},i.prototype._setStaticClass=function(){var a="grid-stack-static";this.opts.staticGrid===!0?this.container.addClass(a):this.container.removeClass(a)},i.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;d<this.grid.nodes.length;d++)c=this.grid.nodes[d],this.update(c.el,Math.round(c.x*b/a),void 0,Math.round(c.width*b/a),void 0);this.grid.commit()},i.prototype.setGridWidth=function(a,b){this.container.removeClass("grid-stack-"+this.opts.width),b!==!0&&this._updateNodeWidths(this.opts.width,a)
 ,this.opts.width=a,this.grid.width=a,this.container.addClass("grid-stack-"+a)},h.prototype.batch_update=d(h.prototype.batchUpdate),h.prototype._fix_collisions=d(h.prototype._fixCollisions,"_fix_collisions","_fixCollisions"),h.prototype.is_area_empty=d(h.prototype.isAreaEmpty,"is_area_empty","isAreaEmpty"),h.prototype._sort_nodes=d(h.prototype._sortNodes,"_sort_nodes","_sortNodes"),h.prototype._pack_nodes=d(h.prototype._packNodes,"_pack_nodes","_packNodes"),h.prototype._prepare_node=d(h.prototype._prepareNode,"_prepare_node","_prepareNode"),h.prototype.clean_nodes=d(h.prototype.cleanNodes,"clean_nodes","cleanNodes"),h.prototype.get_dirty_nodes=d(h.prototype.getDirtyNodes,"get_dirty_nodes","getDirtyNodes"),h.prototype.add_node=d(h.prototype.addNode,"add_node","addNode, "),h.prototype.remove_node=d(h.prototype.removeNode,"remove_node","removeNode"),h.prototype.can_move_node=d(h.prototype.canMoveNode,"can_move_node","canMoveNode"),h.prototype.move_node=d(h.prototype.moveNode,"move_node"
 ,"moveNode"),h.prototype.get_grid_height=d(h.prototype.getGridHeight,"get_grid_height","getGridHeight"),h.prototype.begin_update=d(h.prototype.beginUpdate,"begin_update","beginUpdate"),h.prototype.end_update=d(h.prototype.endUpdate,"end_update","endUpdate"),h.prototype.can_be_placed_with_respect_to_height=d(h.prototype.canBePlacedWithRespectToHeight,"can_be_placed_with_respect_to_height","canBePlacedWithRespectToHeight"),i.prototype._trigger_change_event=d(i.prototype._triggerChangeEvent,"_trigger_change_event","_triggerChangeEvent"),i.prototype._init_styles=d(i.prototype._initStyles,"_init_styles","_initStyles"),i.prototype._update_styles=d(i.prototype._updateStyles,"_update_styles","_updateStyles"),i.prototype._update_container_height=d(i.prototype._updateContainerHeight,"_update_container_height","_updateContainerHeight"),i.prototype._is_one_column_mode=d(i.prototype._isOneColumnMode,"_is_one_column_mode","_isOneColumnMode"),i.prototype._prepare_element=d(i.prototype._prepareElem
 ent,"_prepare_element","_prepareElement"),i.prototype.set_animation=d(i.prototype.setAnimation,"set_animation","setAnimation"),i.prototype.add_widget=d(i.prototype.addWidget,"add_widget","addWidget"),i.prototype.make_widget=d(i.prototype.makeWidget,"make_widget","makeWidget"),i.prototype.will_it_fit=d(i.prototype.willItFit,"will_it_fit","willItFit"),i.prototype.remove_widget=d(i.prototype.removeWidget,"remove_widget","removeWidget"),i.prototype.remove_all=d(i.prototype.removeAll,"remove_all","removeAll"),i.prototype.min_height=d(i.prototype.minHeight,"min_height","minHeight"),i.prototype.min_width=d(i.prototype.minWidth,"min_width","minWidth"),i.prototype._update_element=d(i.prototype._updateElement,"_update_element","_updateElement"),i.prototype.cell_height=d(i.prototype.cellHeight,"cell_height","cellHeight"),i.prototype.cell_width=d(i.prototype.cellWidth,"cell_width","cellWidth"),i.prototype.get_cell_from_pixel=d(i.prototype.getCellFromPixel,"get_cell_from_pixel","getCellFromPixel
 "),i.prototype.batch_update=d(i.prototype.batchUpdate,"batch_update","batchUpdate"),i.prototype.is_area_empty=d(i.prototype.isAreaEmpty,"is_area_empty","isAreaEmpty"),i.prototype.set_static=d(i.prototype.setStatic,"set_static","setStatic"),i.prototype._set_static_class=d(i.prototype._setStaticClass,"_set_static_class","_setStaticClass"),c.GridStackUI=i,c.GridStackUI.Utils=f,c.GridStackUI.Engine=h,a.fn.gridstack=function(b){return this.each(function(){var c=a(this);c.data("gridstack")||c.data("gridstack",new i(this,b))})},c.GridStackUI});
+//# sourceMappingURL=gridstack.min.map
\ No newline at end of file