/*!
* Draggabilly PACKAGED v1.0.7
* Make that shiz draggable
* http://draggabilly.desandro.com
*/
(function(t){"use strict";function e(t){return RegExp("(^|\\s+)"+t+"(\\s+|$)")}function n(t,e){var n=i(t,e)?r:o;n(t,e)}var i,o,r;"classList"in document.documentElement?(i=function(t,e){return t.classList.contains(e)},o=function(t,e){t.classList.add(e)},r=function(t,e){t.classList.remove(e)}):(i=function(t,n){return e(n).test(t.className)},o=function(t,e){i(t,e)||(t.className=t.className+" "+e)},r=function(t,n){t.className=t.className.replace(e(n)," ")});var s={hasClass:i,addClass:o,removeClass:r,toggleClass:n,has:i,add:o,remove:r,toggle:n};"function"==typeof define&&define.amd?define(s):t.classie=s})(window),function(t){"use strict";var e=document.documentElement,n=function(){};e.addEventListener?n=function(t,e,n){t.addEventListener(e,n,!1)}:e.attachEvent&&(n=function(e,n,i){e[n+i]=i.handleEvent?function(){var e=t.event;e.target=e.target||e.srcElement,i.handleEvent.call(i,e)}:function(){var n=t.event;n.target=n.target||n.srcElement,i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var i=function(){};e.removeEventListener?i=function(t,e,n){t.removeEventListener(e,n,!1)}:e.detachEvent&&(i=function(t,e,n){t.detachEvent("on"+e,t[e+n]);try{delete t[e+n]}catch(i){t[e+n]=void 0}});var o={bind:n,unbind:i};"function"==typeof define&&define.amd?define(o):t.eventie=o}(this),function(){"use strict";function t(){}function e(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var i=t.prototype;i.getListeners=function(t){var e,n,i=this._getEvents();if("object"==typeof t){e={};for(n in i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n])}else e=i[t]||(i[t]=[]);return e},i.flattenListeners=function(t){var e,n=[];for(e=0;t.length>e;e+=1)n.push(t[e].listener);return n},i.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&(e={},e[t]=n),e||n},i.addListener=function(t,n){var i,o=this.getListenersAsObject(t),r="object"==typeof n;for(i in o)o.hasOwnProperty(i)&&-1===e(o[i],n)&&o[i].push(r?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(t){return this.getListeners(t),this},i.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},i.removeListener=function(t,n){var i,o,r=this.getListenersAsObject(t);for(o in r)r.hasOwnProperty(o)&&(i=e(r[o],n),-1!==i&&r[o].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},i.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},i.manipulateListeners=function(t,e,n){var i,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(i=n.length;i--;)r.call(this,e,n[i]);else for(i in e)e.hasOwnProperty(i)&&(o=e[i])&&("function"==typeof o?r.call(this,i,o):s.call(this,i,o));return this},i.removeEvent=function(t){var e,n=typeof t,i=this._getEvents();if("string"===n)delete i[t];else if("object"===n)for(e in i)i.hasOwnProperty(e)&&t.test(e)&&delete i[e];else delete this._events;return this},i.emitEvent=function(t,e){var n,i,o,r,s=this.getListenersAsObject(t);for(o in s)if(s.hasOwnProperty(o))for(i=s[o].length;i--;)n=s[o][i],r=n.listener.apply(this,e||[]),(r===this._getOnceReturnValue()||n.once===!0)&&this.removeListener(t,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},i.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}.call(this),function(t){"use strict";function e(t){if(t){if("string"==typeof i[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e,o=0,r=n.length;r>o;o++)if(e=n[o]+t,"string"==typeof i[e])return e}}var n="Webkit Moz ms Ms O".split(" "),i=document.documentElement.style;"function"==typeof define&&define.amd?define(function(){return e}):t.getStyleProperty=e}(window),function(t){"use strict";function e(t){var e=parseFloat(t),n=-1===t.indexOf("%")&&!isNaN(e);return n&&e}function n(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0,n=s.length;n>e;e++){var i=s[e];t[i]=0}return t}function i(t){function i(t){if("string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var i=r(t);if("none"===i.display)return n();var h={};h.width=t.offsetWidth,h.height=t.offsetHeight;for(var d=h.isBorderBox=!(!a||!i[a]||"border-box"!==i[a]),u=0,c=s.length;c>u;u++){var f=s[u],p=i[f],l=parseFloat(p);h[f]=isNaN(l)?0:l}var g=h.paddingLeft+h.paddingRight,v=h.paddingTop+h.paddingBottom,m=h.marginLeft+h.marginRight,y=h.marginTop+h.marginBottom,E=h.borderLeftWidth+h.borderRightWidth,b=h.borderTopWidth+h.borderBottomWidth,x=d&&o,L=e(i.width);L!==!1&&(h.width=L+(x?0:g+E));var P=e(i.height);return P!==!1&&(h.height=P+(x?0:v+b)),h.innerWidth=h.width-(g+E),h.innerHeight=h.height-(v+b),h.outerWidth=h.width+m,h.outerHeight=h.height+y,h}}var o,a=t("boxSizing");return function(){if(a){var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style[a]="border-box";var n=document.body||document.documentElement;n.appendChild(t);var i=r(t);o=200===e(i.width),n.removeChild(t)}}(),i}var o=document.defaultView,r=o&&o.getComputedStyle?function(t){return o.getComputedStyle(t,null)}:function(t){return t.currentStyle},s=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define(["get-style-property/get-style-property"],i):t.getSize=i(t.getStyleProperty)}(window),function(t){"use strict";function e(t,e){for(var n in e)t[n]=e[n];return t}function n(){}function i(i,o,s,d,u){function f(t,n){this.element=t,this.options=e({},this.options),e(this.options,n),this._create()}function p(){return!1}function l(t,e){t.x=void 0!==e.pageX?e.pageX:e.clientX,t.y=void 0!==e.pageY?e.pageY:e.clientY}var g=d("transform"),v=!!d("perspective");e(f.prototype,o.prototype),f.prototype.options={},f.prototype._create=function(){this.position={},this._getPosition(),this.startPoint={x:0,y:0},this.dragPoint={x:0,y:0},this.startPosition=e({},this.position);var t=a(this.element);"relative"!==t.position&&"absolute"!==t.position&&(this.element.style.position="relative"),this.enable(),this.setHandles()},f.prototype.setHandles=function(){this.handles=this.options.handle?this.element.querySelectorAll(this.options.handle):[this.element];for(var t=0,e=this.handles.length;e>t;t++){var n=this.handles[t];s.bind(n,"mousedown",this),s.bind(n,"touchstart",this),y(n)}};var m="attachEvent"in r.documentElement,y=m?function(t){"IMG"===t.nodeName&&(t.ondragstart=p);for(var e=t.querySelectorAll("img"),n=0,i=e.length;i>n;n++){var o=e[n];o.ondragstart=p}}:n;f.prototype._getPosition=function(){var t=a(this.element),e=parseInt(t.left,10),n=parseInt(t.top,10);this.position.x=isNaN(e)?0:e,this.position.y=isNaN(n)?0:n,this._addTransformPosition(t)},f.prototype._addTransformPosition=function(t){if(g){var e=t[g];if(0===e.indexOf("matrix")){var n=e.split(","),i=0===e.indexOf("matrix3d")?12:4,o=parseInt(n[i],10),r=parseInt(n[i+1],10);this.position.x+=o,this.position.y+=r}}},f.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},f.prototype.getTouch=function(t){for(var e=0,n=t.length;n>e;e++){var i=t[e];if(i.identifier===this.pointerIdentifier)return i}},f.prototype.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this.dragStart(t,t)},f.prototype.ontouchstart=function(t){this.isDragging||this.dragStart(t,t.changedTouches[0])},f.prototype.dragStart=function(e,n){if(this.isEnabled){e.preventDefault?e.preventDefault():e.returnValue=!1;var o="touchstart"===e.type;this.pointerIdentifier=n.identifier,this._getPosition(),this.measureContainment(),l(this.startPoint,n),this.startPosition.x=this.position.x,this.startPosition.y=this.position.y,this.setLeftTop(),this.dragPoint.x=0,this.dragPoint.y=0,this._bindEvents({events:o?["touchmove","touchend","touchcancel"]:["mousemove","mouseup"],node:e.preventDefault?t:r}),i.add(this.element,"is-dragging"),this.isDragging=!0,this.emitEvent("dragStart",[this,e,n]),this.animate()}},f.prototype._bindEvents=function(t){for(var e=0,n=t.events.length;n>e;e++){var i=t.events[e];s.bind(t.node,i,this)}this._boundEvents=t},f.prototype._unbindEvents=function(){var t=this._boundEvents;if(t&&t.events){for(var e=0,n=t.events.length;n>e;e++){var i=t.events[e];s.unbind(t.node,i,this)}delete this._boundEvents}},f.prototype.measureContainment=function(){var t=this.options.containment;if(t){this.size=u(this.element);var e=this.element.getBoundingClientRect(),n=h(t)?t:"string"==typeof t?r.querySelector(t):this.element.parentNode;this.containerSize=u(n);var i=n.getBoundingClientRect();this.relativeStartPosition={x:e.left-i.left,y:e.top-i.top}}},f.prototype.onmousemove=function(t){this.dragMove(t,t)},f.prototype.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this.dragMove(t,e)},f.prototype.dragMove=function(t,e){if(l(this.dragPoint,e),this.dragPoint.x-=this.startPoint.x,this.dragPoint.y-=this.startPoint.y,this.options.containment){var n=this.relativeStartPosition.x,i=this.relativeStartPosition.y;this.dragPoint.x=Math.max(this.dragPoint.x,-n),this.dragPoint.y=Math.max(this.dragPoint.y,-i),this.dragPoint.x=Math.min(this.dragPoint.x,this.containerSize.width-n-this.size.width),this.dragPoint.y=Math.min(this.dragPoint.y,this.containerSize.height-i-this.size.height)}this.position.x=this.startPosition.x+this.dragPoint.x,this.position.y=this.startPosition.y+this.dragPoint.y,this.emitEvent("dragMove",[this,t,e])},f.prototype.onmouseup=function(t){this.dragEnd(t,t)},f.prototype.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this.dragEnd(t,e)},f.prototype.dragEnd=function(t,e){this.isDragging=!1,delete this.pointerIdentifier,g&&(this.element.style[g]="",this.setLeftTop()),this._unbindEvents(),i.remove(this.element,"is-dragging"),this.emitEvent("dragEnd",[this,t,e])},f.prototype.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);this.dragEnd(t,e)},f.prototype.animate=function(){if(this.isDragging){this.positionDrag();var t=this;c(function(){t.animate()})}};var E=v?function(t,e){return"translate3d( "+t+"px, "+e+"px, 0)"}:function(t,e){return"translate( "+t+"px, "+e+"px)"};return f.prototype.setLeftTop=function(){this.element.style.left=this.position.x+"px",this.element.style.top=this.position.y+"px"},f.prototype.positionDrag=g?function(){this.element.style[g]=E(this.dragPoint.x,this.dragPoint.y)}:f.prototype.setLeftTop,f.prototype.enable=function(){this.isEnabled=!0},f.prototype.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},f}for(var o,r=t.document,s=r.defaultView,a=s&&s.getComputedStyle?function(t){return s.getComputedStyle(t,null)}:function(t){return t.currentStyle},h="object"==typeof HTMLElement?function(t){return t instanceof HTMLElement}:function(t){return t&&"object"==typeof t&&1===t.nodeType&&"string"==typeof t.nodeName},d=0,u="webkit moz ms o".split(" "),c=t.requestAnimationFrame,f=t.cancelAnimationFrame,p=0;u.length>p&&(!c||!f);p++)o=u[p],c=c||t[o+"RequestAnimationFrame"],f=f||t[o+"CancelAnimationFrame"]||t[o+"CancelRequestAnimationFrame"];c&&f||(c=function(e){var n=(new Date).getTime(),i=Math.max(0,16-(n-d)),o=t.setTimeout(function(){e(n+i)},i);return d=n+i,o},f=function(e){t.clearTimeout(e)}),"function"==typeof define&&define.amd?define(["classie/classie","eventEmitter/EventEmitter","eventie/eventie","get-style-property/get-style-property","get-size/get-size"],i):t.Draggabilly=i(t.classie,t.EventEmitter,t.eventie,t.getStyleProperty,t.getSize)}(window); |