/*! * packery layout mode packaged v2.0.1 * sub-classes packery */ !function(a,b){"function"==typeof define&&define.amd?define("packery/js/rect",b):"object"==typeof module&&module.exports?module.exports=b():(a.packery=a.packery||{},a.packery.rect=b())}(window,function(){function a(b){for(var c in a.defaults)this[c]=a.defaults[c];for(c in b)this[c]=b[c]}a.defaults={x:0,y:0,width:0,height:0};var b=a.prototype;return b.contains=function(a){var b=a.width||0,c=a.height||0;return this.x<=a.x&&this.y<=a.y&&this.x+this.width>=a.x+b&&this.y+this.height>=a.y+c},b.overlaps=function(a){var b=this.x+this.width,c=this.y+this.height,d=a.x+a.width,e=a.y+a.height;return this.xa.x&&this.ya.y},b.getmaximalfreerects=function(b){if(!this.overlaps(b))return!1;var c,d=[],e=this.x+this.width,f=this.y+this.height,g=b.x+b.width,h=b.y+b.height;return this.yg&&(c=new a({x:g,y:this.y,width:e-g,height:this.height}),d.push(c)),f>h&&(c=new a({x:this.x,y:h,width:this.width,height:f-h}),d.push(c)),this.x=a.width&&this.height>=a.height},a}),function(a,b){if("function"==typeof define&&define.amd)define("packery/js/packer",["./rect"],b);else if("object"==typeof module&&module.exports)module.exports=b(require("./rect"));else{var c=a.packery=a.packery||{};c.packer=b(c.rect)}}(window,function(a){function b(a,b,c){this.width=a||0,this.height=b||0,this.sortdirection=c||"downwardlefttoright",this.reset()}var c=b.prototype;c.reset=function(){this.spaces=[];var b=new a({x:0,y:0,width:this.width,height:this.height});this.spaces.push(b),this.sorter=d[this.sortdirection]||d.downwardlefttoright},c.pack=function(a){for(var b=0;b=a.x+a.width&&c.height>=a.height-.01;if(d){a.y=c.y,this.placed(a);break}}},c.rowpack=function(a){for(var b=0;b=a.y+a.height&&c.width>=a.width-.01;if(d){a.x=c.x,this.placed(a);break}}},c.placeinspace=function(a,b){a.x=b.x,a.y=b.y,this.placed(a)},c.placed=function(a){for(var b=[],c=0;cc&&1>d;return e?void this.goto(a,b):void h.apply(this,arguments)},f.enableplacing=function(){this.removetransitionstyles(),this.istransitioning&&d&&(this.element.style[d]="none"),this.istransitioning=!1,this.getsize(),this.layout._setrectsize(this.element,this.rect),this.isplacing=!0},f.disableplacing=function(){this.isplacing=!1},f.removeelem=function(){this.element.parentnode.removechild(this.element),this.layout.packer.addspace(this.rect),this.emitevent("remove",[this])},f.showdropplaceholder=function(){var a=this.dropplaceholder;a||(a=this.dropplaceholder=document.createelement("div"),a.classname="packery-drop-placeholder",a.style.position="absolute"),a.style.width=this.size.width+"px",a.style.height=this.size.height+"px",this.positiondropplaceholder(),this.layout.element.appendchild(a)},f.positiondropplaceholder=function(){this.dropplaceholder.style[d]="translate("+this.rect.x+"px, "+this.rect.y+"px)"},f.hidedropplaceholder=function(){this.layout.element.removechild(this.dropplaceholder)},e}),function(a,b){"function"==typeof define&&define.amd?define("packery/js/packery",["get-size/get-size","outlayer/outlayer","./rect","./packer","./item"],b):"object"==typeof module&&module.exports?module.exports=b(require("get-size"),require("outlayer"),require("./rect"),require("./packer"),require("./item")):a.packery=b(a.getsize,a.outlayer,a.packery.rect,a.packery.packer,a.packery.item)}(window,function(a,b,c,d,e){function f(a,b){return a.position.y-b.position.y||a.position.x-b.position.x}function g(a,b){return a.position.x-b.position.x||a.position.y-b.position.y}function h(a,b){var c=b.x-a.x,d=b.y-a.y;return math.sqrt(c*c+d*d)}c.prototype.canfit=function(a){return this.width>=a.width-1&&this.height>=a.height-1};var i=b.create("packery");i.item=e;var j=i.prototype;j._create=function(){b.prototype._create.call(this),this.packer=new d,this.shiftpacker=new d,this.isenabled=!0,this.dragitemcount=0;var a=this;this.handledraggabilly={dragstart:function(){a.itemdragstart(this.element)},dragmove:function(){a.itemdragmove(this.element,this.position.x,this.position.y)},dragend:function(){a.itemdragend(this.element)}},this.handleuidraggable={start:function(b,c){c&&a.itemdragstart(b.currenttarget)},drag:function(b,c){c&&a.itemdragmove(b.currenttarget,c.position.left,c.position.top)},stop:function(b,c){c&&a.itemdragend(b.currenttarget)}}},j._resetlayout=function(){this.getsize(),this._getmeasurements();var a,b,c;this._getoption("horizontal")?(a=1/0,b=this.size.innerheight+this.gutter,c="rightwardtoptobottom"):(a=this.size.innerwidth+this.gutter,b=1/0,c="downwardlefttoright"),this.packer.width=this.shiftpacker.width=a,this.packer.height=this.shiftpacker.height=b,this.packer.sortdirection=this.shiftpacker.sortdirection=c,this.packer.reset(),this.maxy=0,this.maxx=0},j._getmeasurements=function(){this._getmeasurement("columnwidth","width"),this._getmeasurement("rowheight","height"),this._getmeasurement("gutter","width")},j._getitemlayoutposition=function(a){if(this._setrectsize(a.element,a.rect),this.isshifting||this.dragitemcount>0){var b=this._getpackmethod();this.packer[b](a.rect)}else this.packer.pack(a.rect);return this._setmaxxy(a.rect),a.rect},j.shiftlayout=function(){this.isshifting=!0,this.layout(),delete this.isshifting},j._getpackmethod=function(){return this._getoption("horizontal")?"rowpack":"columnpack"},j._setmaxxy=function(a){this.maxx=math.max(a.x+a.width,this.maxx),this.maxy=math.max(a.y+a.height,this.maxy)},j._setrectsize=function(b,c){var d=a(b),e=d.outerwidth,f=d.outerheight;(e||f)&&(e=this._applygridgutter(e,this.columnwidth),f=this._applygridgutter(f,this.rowheight)),c.width=math.min(e,this.packer.width),c.height=math.min(f,this.packer.height)},j._applygridgutter=function(a,b){if(!b)return a+this.gutter;b+=this.gutter;var c=a%b,d=c&&1>c?"round":"ceil";return a=math[d](a/b)*b},j._getcontainersize=function(){return this._getoption("horizontal")?{width:this.maxx-this.gutter}:{height:this.maxy-this.gutter}},j._managestamp=function(a){var b,d=this.getitem(a);if(d&&d.isplacing)b=d.rect;else{var e=this._getelementoffset(a);b=new c({x:this._getoption("originleft")?e.left:e.right,y:this._getoption("origintop")?e.top:e.bottom})}this._setrectsize(a,b),this.packer.placed(b),this._setmaxxy(b)},j.sortitemsbyposition=function(){var a=this._getoption("horizontal")?g:f;this.items.sort(a)},j.fit=function(a,b,c){var d=this.getitem(a);d&&(this.stamp(d.element),d.enableplacing(),this.updateshifttargets(d),b=void 0===b?d.rect.x:b,c=void 0===c?d.rect.y:c,this.shift(d,b,c),this._bindfitevents(d),d.moveto(d.rect.x,d.rect.y),this.shiftlayout(),this.unstamp(d.element),this.sortitemsbyposition(),d.disableplacing())},j._bindfitevents=function(a){function b(){d++,2==d&&c.dispatchevent("fitcomplete",null,[a])}var c=this,d=0;a.once("layout",b),this.once("layoutcomplete",b)},j.resize=function(){this.isresizebound&&this.needsresizelayout()&&(this.options.shiftpercentresize?this.resizeshiftpercentlayout():this.layout())},j.needsresizelayout=function(){var b=a(this.element),c=this._getoption("horizontal")?"innerheight":"innerwidth";return b[c]!=this.size[c]},j.resizeshiftpercentlayout=function(){var b=this._getitemsforlayout(this.items),c=this._getoption("horizontal"),d=c?"y":"x",e=c?"height":"width",f=c?"rowheight":"columnwidth",g=c?"innerheight":"innerwidth",h=this[f];if(h=h&&h+this.gutter){this._getmeasurements();var i=this[f]+this.gutter;b.foreach(function(a){var b=math.round(a.rect[d]/h);a.rect[d]=b*i})}else{var j=a(this.element)[g]+this.gutter,k=this.packer[e];b.foreach(function(a){a.rect[d]=a.rect[d]/k*j})}this.shiftlayout()},j.itemdragstart=function(a){if(this.isenabled){this.stamp(a);var b=this.getitem(a);b&&(b.enableplacing(),b.showdropplaceholder(),this.dragitemcount++,this.updateshifttargets(b))}},j.updateshifttargets=function(a){this.shiftpacker.reset(),this._getboundingrect();var b=this._getoption("originleft"),d=this._getoption("origintop");this.stamps.foreach(function(a){var e=this.getitem(a);if(!e||!e.isplacing){var f=this._getelementoffset(a),g=new c({x:b?f.left:f.right,y:d?f.top:f.bottom});this._setrectsize(a,g),this.shiftpacker.placed(g)}},this);var e=this._getoption("horizontal"),f=e?"rowheight":"columnwidth",g=e?"height":"width";this.shifttargetkeys=[],this.shifttargets=[];var h,i=this[f];if(i=i&&i+this.gutter){var j=math.ceil(a.rect[g]/i),k=math.floor((this.shiftpacker[g]+this.gutter)/i);h=(k-j)*i;for(var l=0;k>l;l++)this._addshifttarget(l*i,0,h)}else h=this.shiftpacker[g]+this.gutter-a.rect[g],this._addshifttarget(0,0,h);var m=this._getitemsforlayout(this.items),n=this._getpackmethod();m.foreach(function(a){var b=a.rect;this._setrectsize(a.element,b),this.shiftpacker[n](b),this._addshifttarget(b.x,b.y,h);var c=e?b.x+b.width:b.x,d=e?b.y:b.y+b.height;if(this._addshifttarget(c,d,h),i)for(var f=math.round(b[g]/i),j=1;f>j;j++){var k=e?c:b.x+i*j,l=e?b.y+i*j:d;this._addshifttarget(k,l,h)}},this)},j._addshifttarget=function(a,b,c){var d=this._getoption("horizontal")?b:a;if(!(0!==d&&d>c)){var e=a+","+b,f=-1!=this.shifttargetkeys.indexof(e);f||(this.shifttargetkeys.push(e),this.shifttargets.push({x:a,y:b}))}},j.shift=function(a,b,c){var d,e=1/0,f={x:b,y:c};this.shifttargets.foreach(function(a){var b=h(a,f);e>b&&(d=a,e=b)}),a.rect.x=d.x,a.rect.y=d.y};var k=120;j.itemdragmove=function(a,b,c){function d(){f.shift(e,b,c),e.positiondropplaceholder(),f.layout()}var e=this.isenabled&&this.getitem(a);if(e){b-=this.size.paddingleft,c-=this.size.paddingtop;var f=this,g=new date;this._itemdragtime&&g-this._itemdragtime