@egjs/grid
Advanced tools
Comparing version 1.7.0-beta.5 to 1.7.0-beta.6
import { GridOptions } from "./types"; | ||
export declare const DEFAULT_GRID_OPTIONS: Required<GridOptions>; | ||
export declare const INVISIBLE_POS = -9999; | ||
export declare const MINIMUM_NUMBER = 0.000001; | ||
export declare enum PROPERTY_TYPE { | ||
@@ -4,0 +6,0 @@ PROPERTY = 1, |
@@ -18,2 +18,3 @@ import { GRID_METHODS } from "./consts"; | ||
useTransform?: boolean; | ||
hideBeforeLoading?: boolean; | ||
renderOnPropertyChange?: boolean; | ||
@@ -35,2 +36,3 @@ preserveUIOnDestroy?: boolean; | ||
useResize?: boolean; | ||
useOrgResize?: boolean; | ||
} | ||
@@ -37,0 +39,0 @@ export interface GridStatus { |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-grid | ||
version: 1.7.0-beta.5 | ||
version: 1.7.0-beta.6 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Grid=e()}(this,function(){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var f=function(){return(f=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function o(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;0<=a;a--)(r=t[a])&&(s=(o<3?r(s):3<o?r(e,n,s):r(e,n))||s);return 3<o&&s&&Object.defineProperty(e,n,s),s}function g(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}function c(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&i>=t.length?void 0:t)&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,o=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(i=o.next()).done;)s.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}(arguments[e]));return t}function l(t){return void 0===t}var a,h,d,u=function(){function t(t,e){var n,i;if(this.eventType=t,this._canceled=!1,e)try{for(var r=c(Object.keys(e)),o=r.next();!o.done;o=r.next()){var s=o.value;this[s]=e[s]}}catch(t){n={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}}var e=t.prototype;return e.stop=function(){this._canceled=!0},e.isCanceled=function(){return this._canceled},t}(),t=function(){function t(){this._eventHandler={}}var e=t.prototype;return e.trigger=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=e instanceof u?e.eventType:e,i=s(this._eventHandler[i]||[]);return i.length<=0||(e instanceof u?(e.currentTarget=this,i.forEach(function(t){t(e)})):i.forEach(function(t){t.apply(void 0,s(n))})),this},e.once=function(n,i){var r,o=this;if("object"==typeof n&&l(i)){var t,e=n;for(t in e)this.once(t,e[t]);return this}return"string"==typeof n&&"function"==typeof i&&this.on(n,r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(void 0,s(t)),o.off(n,r)}),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&l(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}var r;return"string"==typeof t&&"function"==typeof e&&(r=this._eventHandler[t],l(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)),this},e.off=function(t,e){var n,i;if(l(t))return this._eventHandler={},this;if(l(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var r,o=t;for(r in o)this.off(r,o[r]);return this}var s=this._eventHandler[t];if(s){var a=0;try{for(var u=c(s),h=u.next();!h.done;h=u.next()){if(h.value===e){s.splice(a,1),s.length<=0&&delete this._eventHandler[t];break}a++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="3.0.1",t}(),p={horizontal:!1,useTransform:!1,percentage:!1,isEqualSize:!1,isConstantSize:!1,gap:0,attributePrefix:"data-grid-",resizeDebounce:100,maxResizeDebounce:0,autoResize:!0,preserveUIOnDestroy:!1,defaultDirection:"end",externalContainerManager:null,externalItemRenderer:null,renderOnPropertyChange:!0,useFit:!0,outlineLength:0,outlineSize:0};(R=a=a||{})[R.PROPERTY=1]="PROPERTY",R[R.RENDER_PROPERTY=2]="RENDER_PROPERTY",(P=h=h||{})[P.UNCHECKED=1]="UNCHECKED",P[P.UNMOUNTED=2]="UNMOUNTED",P[P.MOUNTED=3]="MOUNTED",(_=d=d||{})[_.NEED_UPDATE=1]="NEED_UPDATE",_[_.WAIT_LOADING=2]="WAIT_LOADING",_[_.UPDATED=3]="UPDATED";var n={gap:a.RENDER_PROPERTY,defaultDirection:a.PROPERTY,renderOnPropertyChange:a.PROPERTY,preserveUIOnDestroy:a.PROPERTY,useFit:a.PROPERTY,outlineSize:a.RENDER_PROPERTY,outlineLength:a.RENDER_PROPERTY},e=["syncElements","updateItems","getItems","setItems","renderItems","getContainerInlineSize","getContainerElement"],m={horizontal:{inlinePos:"top",contentPos:"left",inlineSize:"height",contentSize:"width"},vertical:{inlinePos:"left",contentPos:"top",inlineSize:"width",contentSize:"height"}},v=function(i){function t(t,e){var n=i.call(this)||this;return n.container=t,n._resizeTimer=0,n._maxResizeDebounceTimer=0,n._onResize=function(){clearTimeout(n._resizeTimer),clearTimeout(n._maxResizeDebounceTimer),n._maxResizeDebounceTimer=0,n._resizeTimer=0,n.trigger("resize")},n._scheduleResize=function(){var t=n.options,e=t.resizeDebounce,t=t.maxResizeDebounce;!n._maxResizeDebounceTimer&&e<=t&&(n._maxResizeDebounceTimer=window.setTimeout(n._onResize,t)),n._resizeTimer&&(clearTimeout(n._resizeTimer),n._resizeTimer=0),n._resizeTimer=window.setTimeout(n._onResize,e)},n.options=f({horizontal:p.horizontal,autoResize:p.autoResize,resizeDebounce:p.resizeDebounce,maxResizeDebounce:p.maxResizeDebounce},e),n._init(),n}r(t,i);var e=t.prototype;return e.resize=function(){var t=this.container;this.setRect({width:t.clientWidth,height:t.clientHeight})},e.getRect=function(){return this.rect},e.setRect=function(t){this.rect=f({},t)},e.getInlineSize=function(){return this.rect[this.options.horizontal?"height":"width"]},e.getContentSize=function(){return this.rect[this.options.horizontal?"width":"height"]},e.getStatus=function(){return{rect:f({},this.rect)}},e.setStatus=function(t){this.rect=f({},t.rect),this.setContentSize(this.getContentSize())},e.setContentSize=function(t){var e=this.options.horizontal?"width":"height";this.rect[e]=t,this.container.style[e]=t+"px"},e.destroy=function(t){void 0===t&&(t={}),window.removeEventListener("resize",this._scheduleResize),t.preserveUI||(this.container.style.cssText=this.orgCSSText)},e._init=function(){var t=this.container,e=window.getComputedStyle(t);this.orgCSSText=t.style.cssText,"static"===e.position&&(t.style.position="relative"),this.options.autoResize&&window.addEventListener("resize",this._scheduleResize)},t}(t);function y(t){return void 0===t}var R=function(){function t(){this.options={},this._eventHandler={}}var e=t.prototype;return e.trigger=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(!(0<(s=this._eventHandler[t]||[]).length))return!0;var r=n[0]||{},o=n.slice(1),s=s.concat(),a=!1;r.eventType=t,r.stop=function(){a=!0},r.currentTarget=this;var u=[r];return 1<=o.length&&(u=u.concat(o)),s.forEach(function(t){t.apply(e,u)}),!a},e.once=function(n,i){var r,o=this;if("object"==typeof n&&y(i)){var t,e=n;for(t in e)this.once(t,e[t]);return this}return"string"==typeof n&&"function"==typeof i&&this.on(n,r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(o,t),o.off(n,r)}),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&y(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}var r;return"string"==typeof t&&"function"==typeof e&&(y(r=this._eventHandler[t])&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)),this},e.off=function(t,e){var n,i;if(y(t))return this._eventHandler={},this;if(y(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var r,o=t;for(r in o)this.off(r,o[r]);return this}var s=this._eventHandler[t];if(s){var a=0;try{for(var u=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&i>=t.length?void 0:t)&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(s),h=u.next();!h.done;h=u.next()){if(h.value===e){s.splice(a,1);break}a++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="2.2.2",t}(),S=function(t,e){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function z(t,e){function n(){this.constructor=t}S(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var E=function(){return(E=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};var P="undefined"!=typeof window,_=P?window.navigator.userAgent:"",C=P&&!!("getComputedStyle"in window),O=/MSIE|Trident|Windows Phone|Edge/.test(_),T=P&&!!("addEventListener"in document),b="width",I="height";function w(t,e){return t.getAttribute(e)||""}function D(t){return[].slice.call(t)}function x(t){return"loading"in t&&"lazy"===t.getAttribute("loading")}function M(t,e,n){T?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}function k(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent?t.detachEvent("on"+e,n):t["on"+e]=null}function N(t,e){var n=t["client"+e]||t["offset"+e];return parseFloat(n||(t=t,((C?window.getComputedStyle(t):t.currentStyle)||{})[e.toLowerCase()]))||0}function A(t,e,n){var i=D(t.querySelectorAll(function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}(["["+n+"skip] ["+n+"width]"],e.map(function(t){return["["+n+"skip] "+t,t+"["+n+"skip]","["+n+"width] "+t].join(", ")})).join(", ")));return D(t.querySelectorAll("["+n+"width], "+e.join(", "))).filter(function(t){return-1===i.indexOf(t)})}var L=[];function F(t,e){L.length||M(window,"resize",U),t.__PREFIX__=e,L.push(t),j(t)}function j(t,e){void 0===e&&(e="data-");var n,i=t.__PREFIX__||e,r=parseInt(w(t,""+i+b),10)||0,e=parseInt(w(t,""+i+I),10)||0;w(t,i+"fixed")===I?(n=N(t,"Height")||e,t.style[b]=r/e*n+"px"):(n=N(t,"Width")||r,t.style[I]=e/r*n+"px")}function U(){L.forEach(function(t){j(t)})}var _=function(o){function t(t,e){void 0===e&&(e={});var n,i,r=o.call(this)||this;return r.isReady=!1,r.isPreReady=!1,r.hasDataSize=!1,r.hasLoading=!1,r.isSkip=!1,r.onCheck=function(t){r.clear(),t&&"error"===t.type&&r.onError(r.element);t=!r.hasDataSize&&!r.hasLoading;r.onReady(t)},r.options=E({prefix:"data-"},e),r.element=t,r.hasDataSize=(n=t,e=r.options.prefix,!!n.getAttribute((e=void 0===e?"data-":e)+"width")),r.hasLoading=x(t),r.isSkip=!!r.element.getAttribute((i=void 0===i?"data-":i)+"skip"),r}z(t,o);var e=t.prototype;return e.check=function(){return this.isSkip||!this.checkElement()?(this.onAlreadyReady(!0),!1):(this.hasDataSize&&F(this.element,this.options.prefix),(this.hasDataSize||this.hasLoading)&&this.onAlreadyPreReady(),!0)},e.addEvents=function(){var e=this,n=this.element;this.constructor.EVENTS.forEach(function(t){M(n,t,e.onCheck)})},e.clear=function(){var e=this,n=this.element;this.constructor.EVENTS.forEach(function(t){k(n,t,e.onCheck)}),this.removeAutoSizer()},e.destroy=function(){this.clear(),this.off()},e.removeAutoSizer=function(){var t,e,n;this.hasDataSize&&(n=this.options.prefix,t=this.element,e=n,(n=L.indexOf(t))<0||(e=w(t,e+"fixed"),delete t.__PREFIX__,t.style[e===I?b:I]="",L.splice(n,1),L.length||k(window,"resize",U)))},e.onError=function(t){this.trigger("error",{element:this.element,target:t})},e.onPreReady=function(){this.isPreReady||(this.isPreReady=!0,this.trigger("preReady",{element:this.element,hasLoading:this.hasLoading,isSkip:this.isSkip}))},e.onReady=function(t){this.isReady||((t=!this.isPreReady&&t)&&(this.isPreReady=!0),this.removeAutoSizer(),this.isReady=!0,this.trigger("ready",{element:this.element,withPreReady:t,hasLoading:this.hasLoading,isSkip:this.isSkip}))},e.onAlreadyError=function(t){var e=this;setTimeout(function(){e.onError(t)})},e.onAlreadyPreReady=function(){var t=this;setTimeout(function(){t.onPreReady()})},e.onAlreadyReady=function(t){var e=this;setTimeout(function(){e.onReady(t)})},t.EVENTS=[],t}(R),Y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}z(e,t);var n=e.prototype;return n.setHasLoading=function(t){this.hasLoading=t},n.check=function(){return this.isSkip?(this.onAlreadyReady(!0),!1):(this.hasDataSize?(F(this.element,this.options.prefix),this.onAlreadyPreReady()):this.trigger("requestChildren"),!0)},n.checkElement=function(){return!0},n.destroy=function(){this.clear(),this.trigger("requestDestroy"),this.off()},n.onAlreadyPreReady=function(){t.prototype.onAlreadyPreReady.call(this),this.trigger("reqeustReadyChildren")},e.EVENTS=[],e}(_),P=function(n){function t(t){void 0===t&&(t={});var e=n.call(this)||this;return e.readyCount=0,e.preReadyCount=0,e.totalCount=0,e.totalErrorCount=0,e.isPreReadyOver=!0,e.elementInfos=[],e.options=E({loaders:{},prefix:"data-"},t),e}z(t,n);var e=t.prototype;return e.check=function(t){var o=this,n=this.options.prefix;this.clear(),this.elementInfos=D(t).map(function(t,r){var e=o.getLoader(t,{prefix:n});return e.check(),e.on("error",function(t){o.onError(r,t.target)}).on("preReady",function(t){var e=o.elementInfos[r];e.hasLoading=t.hasLoading,e.isSkip=t.isSkip;t=o.checkPreReady(r);o.onPreReadyElement(r),t&&o.onPreReady()}).on("ready",function(t){var e=t.withPreReady,n=t.hasLoading,i=t.isSkip,t=o.elementInfos[r];t.hasLoading=n,t.isSkip=i;t=e&&o.checkPreReady(r),i=o.checkReady(r);e&&o.onPreReadyElement(r),o.onReadyElement(r),t&&o.onPreReady(),i&&o.onReady()}),{loader:e,element:t,hasLoading:!1,hasError:!1,isPreReady:!1,isReady:!1,isSkip:!1}});t=this.elementInfos.length;return(this.totalCount=t)||setTimeout(function(){o.onPreReady(),o.onReady()}),this},e.getTotalCount=function(){return this.totalCount},e.isPreReady=function(){return this.elementInfos.every(function(t){return t.isPreReady})},e.isReady=function(){return this.elementInfos.every(function(t){return t.isReady})},e.hasError=function(){return 0<this.totalErrorCount},e.clear=function(){this.isPreReadyOver=!1,this.totalCount=0,this.preReadyCount=0,this.readyCount=0,this.totalErrorCount=0,this.elementInfos.forEach(function(t){!t.isReady&&t.loader&&t.loader.destroy()}),this.elementInfos=[]},e.destroy=function(){this.clear(),this.off()},e.getLoader=function(e,t){var n=this,i=e.tagName.toLowerCase(),r=this.options.loaders,o=Object.keys(r);if(r[i])return new r[i](e,t);var s=new Y(e,t),a=D(e.querySelectorAll(o.join(", ")));s.setHasLoading(a.some(x));var u=!1,h=this.clone().on("error",function(t){s.onError(t.target)}).on("ready",function(){s.onReady(u)});return s.on("requestChildren",function(){var t=A(e,o,n.options.prefix);h.check(t).on("preReady",function(t){(u=t.isReady)||s.onPreReady()})}).on("reqeustReadyChildren",function(){h.check(a)}).on("requestDestroy",function(){h.destroy()}),s},e.clone=function(){return new t(E({},this.options))},e.checkPreReady=function(t){return this.elementInfos[t].isPreReady=!0,++this.preReadyCount,!(this.preReadyCount<this.totalCount)},e.checkReady=function(t){return this.elementInfos[t].isReady=!0,++this.readyCount,!(this.readyCount<this.totalCount)},e.onError=function(t,e){var n=this.elementInfos[t];n.hasError=!0,this.trigger("error",{element:n.element,index:t,target:e,errorCount:this.getErrorCount(),totalErrorCount:++this.totalErrorCount})},e.onPreReadyElement=function(t){var e=this.elementInfos[t];this.trigger("preReadyElement",{element:e.element,index:t,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:e.hasLoading,isSkip:e.isSkip})},e.onPreReady=function(){this.isPreReadyOver=!0,this.trigger("preReady",{readyCount:this.readyCount,totalCount:this.totalCount,isReady:this.isReady(),hasLoading:this.hasLoading()})},e.onReadyElement=function(t){var e=this.elementInfos[t];this.trigger("readyElement",{index:t,element:e.element,hasError:e.hasError,errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:e.hasLoading,isPreReadyOver:this.isPreReadyOver,isSkip:e.isSkip})},e.onReady=function(){this.trigger("ready",{errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,totalCount:this.totalCount})},e.getErrorCount=function(){return this.elementInfos.filter(function(t){return t.hasError}).length},e.hasLoading=function(){return this.elementInfos.some(function(t){return t.hasLoading})},t}(R),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return z(e,t),e.prototype.checkElement=function(){var t=this.element,e=t.getAttribute("src");if(t.complete){if(e)return t.naturalWidth||this.onAlreadyError(t),!1;this.onAlreadyPreReady()}return this.addEvents(),O&&t.setAttribute("src",e),!0},e.EVENTS=["load","error"],e}(_),G=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return z(e,t),e.prototype.checkElement=function(){var t=this.element;return!(1<=t.readyState)&&(t.error?(this.onAlreadyError(t),!1):(this.addEvents(),!0))},e.EVENTS=["loadedmetadata","error"],e}(_),W=function(e){function t(t){return e.call(this,E({loaders:{img:H,video:G}},t=void 0===t?{}:t))||this}return z(t,e),t}(P);function q(t){return"object"==typeof t}function V(t){var e,r=t.prototype,o=t.propertyTypes;for(e in o)!function(n){var i=o[n]===a.RENDER_PROPERTY,t=Object.getOwnPropertyDescriptor(r,n)||{};Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:t.get||function(){return this.options[n]},set:t.set||function(t){var e=this.options;e[n]!==t&&(e[n]=t,i&&e.renderOnPropertyChange&&this.scheduleRender())}})}(e)}function K(e){return function(t,r){e.forEach(function(i){i in t||(t[i]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=(n=this[r])[i].apply(n,t);return n===this[r]?this:n})})}}function B(t){for(var e=[],n=0;n<t;++n)e.push(n);return e}function X(t,e){return Math.max(t-e[1],e[0]-t,0)+1}var R=K(e),J=function(){function t(t){this.initialRect=null,this.sizePercetage=!1,this.posPercetage=!1,this.options=f({attributePrefix:p.attributePrefix,useTransform:p.useTransform,horizontal:p.horizontal,percentage:p.percentage,isEqualSize:p.isEqualSize,isConstantSize:p.isConstantSize},t),this._init()}var e=t.prototype;return e.resize=function(){this.initialRect=null},e.renderItems=function(t){var e=this;t.forEach(function(t){e._renderItem(t)})},e.getInlineSize=function(){return this.containerRect[this.options.horizontal?"height":"width"]},e.setContainerRect=function(t){this.containerRect=t},e.updateItems=function(t){var e=this;t.forEach(function(t){e._updateItem(t)})},e.getStatus=function(){return{initialRect:this.initialRect}},e.setStatus=function(t){this.initialRect=t.initialRect},e._init=function(){var t=this.options.percentage,e=!1,n=!1;!0===t?n=e=!0:t&&(-1<t.indexOf("position")&&(n=!0),-1<t.indexOf("size")&&(e=!0)),this.posPercetage=n,this.sizePercetage=e},e._updateItem=function(t){var e,n=this.options,i=n.isEqualSize,r=n.isConstantSize,o=this.initialRect,s=t.orgRect,a=t.element,u=t.updateState===d.WAIT_LOADING,n=s&&s.width&&s.height;if(i&&o)e=o;else if(r&&n&&!u)e=s;else{if(!a)return;e={left:a.offsetLeft,top:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}}return t.isFirstUpdate||(t.orgRect=f({},e)),t.rect=f({},e),t.element&&(t.mountState=h.MOUNTED),t.updateState===d.NEED_UPDATE&&(t.updateState=d.UPDATED,t.isFirstUpdate=!0),t.attributes=a?function(t,e){for(var n={},i=t.attributes,r=i.length,o=0;o<r;++o){var s=i[o],a=s.name,s=s.value;-1!==a.indexOf(e)&&(n[a.replace(e,"").replace(/[\s-_]([a-z])/g,function(t,e){return e.toUpperCase()})]=s)}return n}(a,this.options.attributePrefix):{},u||(this.initialRect=f({},e)),e},e._renderItem=function(t){var n,i,e,r,o,s,a,u=t.element,h=t.cssRect;u&&h&&(a=(e=this.options).horizontal,t=e.useTransform,n=this.posPercetage,i=this.sizePercetage,e=["position: absolute;"],r=(a=m[a?"horizontal":"vertical"]).inlineSize,o=a.inlinePos,s=this.getInlineSize(),a=h,a=Object.keys(a),t&&(a=a.filter(function(t){return"top"!==t&&"left"!==t}),e.push("transform: translate("+(h.left||0)+"px, "+(h.top||0)+"px);")),e.push.apply(e,a.map(function(t){var e=h[t];return t===r&&i||t===o&&n?t+": "+e/s*100+"%;":t+": "+e+"px;"})),u.style.cssText+=e.join(""))},t}(),Q=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,i=this.values,r=n.indexOf(t),r=-1===r?n.length:r;n[r]=t,i[r]=e},t}(),Z=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),$="function"==typeof Map,tt=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var et=function(){function t(t,e,n,i,r,o,s,a){this.prevList=t,this.list=e,this.added=n,this.removed=i,this.changed=r,this.maintained=o,this.changedBeforeAdded=s,this.fixed=a}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t,n,r,o,t=(t=this.changedBeforeAdded,n=this.fixed,r=[],o=[],t.forEach(function(t){var e=t[0],n=t[1],t=new tt;r[e]=t,o[n]=t}),r.forEach(function(t,e){t.connect(r[e-1])}),t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],i=t[1];if(n===i)return[0,0];t=r[n],n=o[i-1],i=t.getIndex();return t.disconnect(),n?t.connect(n,n.next):t.connect(void 0,r[0]),[i,t.getIndex()]})),s=this.changed,a=[];this.cacheOrdered=t.filter(function(t,e){var n=t[0],i=t[1],t=s[e],e=t[0],t=t[1];if(n!==i)return a.push([e,t]),!0}),this.cachePureChanged=a},t}();var nt,it="function"==typeof Map?void 0:(nt=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++nt)});function rt(t,e){return n=t,i=e,r=it,t=$?Map:r?Z:Q,e=r||function(t){return t},o=[],s=[],a=[],r=n.map(e),e=i.map(e),u=new t,h=new t,c=[],l=[],f={},d=[],g=p=0,r.forEach(function(t,e){u.set(t,e)}),e.forEach(function(t,e){h.set(t,e)}),r.forEach(function(t,e){t=h.get(t);void 0===t?(++g,s.push(e)):f[t]=g}),e.forEach(function(t,e){t=u.get(t);void 0===t?(o.push(e),++p):(a.push([t,e]),g=f[e]||0,c.push([t-g,e-p]),l.push(e===t),t!==e&&d.push([t,e]))}),s.reverse(),new et(n,i,o,s,d,a,c,l);var n,i,r,o,s,a,u,h,c,l,f,d,p,g}var ot=function(){function t(t,e){void 0===e&&(e={}),this.horizontal=t,this.isUpdate=!1,this.hasTransition=!1,this.transitionDuration="";var n,t=e.element,i=f({key:"",orgRect:{left:0,top:0,width:0,height:0},rect:{left:0,top:0,width:0,height:0},cssRect:{},attributes:{},data:{},isFirstUpdate:!1,mountState:h.UNCHECKED,updateState:d.NEED_UPDATE,element:t||null,orgCSSText:null!==(t=null==t?void 0:t.style.cssText)&&void 0!==t?t:"",gridData:{}},e);for(n in i)this[n]=i[n]}var e=t.prototype;return Object.defineProperty(e,"orgInlineSize",{get:function(){var t=this.orgRect||this.rect;return this.horizontal?t.height:t.width},enumerable:!1,configurable:!0}),Object.defineProperty(e,"orgContentSize",{get:function(){var t=this.orgRect||this.rect;return this.horizontal?t.width:t.height},enumerable:!1,configurable:!0}),Object.defineProperty(e,"inlineSize",{get:function(){var t=this.rect;return this.horizontal?t.height:t.width},enumerable:!1,configurable:!0}),Object.defineProperty(e,"contentSize",{get:function(){var t=this.rect;return this.horizontal?t.width:t.height},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssInlineSize",{get:function(){var t=this.cssRect;return this.horizontal?t.height:t.width},set:function(t){this.cssRect[this.horizontal?"height":"width"]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssContentSize",{get:function(){var t=this.cssRect;return this.horizontal?t.width:t.height},set:function(t){this.cssRect[this.horizontal?"width":"height"]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssInlinePos",{get:function(){var t=this.cssRect;return this.horizontal?t.top:t.left},set:function(t){this.cssRect[this.horizontal?"top":"left"]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssContentPos",{get:function(){var t=this.cssRect;return this.horizontal?t.left:t.top},set:function(t){this.cssRect[this.horizontal?"left":"top"]=t},enumerable:!1,configurable:!0}),e.setCSSGridRect=function(t){var e,n=m[this.horizontal?"horizontal":"vertical"],i={};for(e in t)i[n[e]]=t[e];this.cssRect=i},e.getStatus=function(){return{mountState:this.mountState,updateState:this.updateState,attributes:this.attributes,orgCSSText:this.orgCSSText,isFirstUpdate:this.isFirstUpdate,element:null,key:this.key,orgRect:this.orgRect,rect:this.rect,cssRect:this.cssRect,gridData:this.gridData,data:this.data}},e.getMinimizedStatus=function(){var t={orgRect:this.orgRect,rect:this.rect,cssRect:this.cssRect,attributes:this.attributes,gridData:this.gridData};return void 0!==this.key&&(t.key=this.key),this.mountState!==h.UNCHECKED&&(t.mountState=this.mountState),this.updateState!==d.NEED_UPDATE&&(t.updateState=this.updateState),this.isFirstUpdate&&(t.isFirstUpdate=!0),this.orgCSSText&&(t.orgCSSText=this.orgCSSText),t},t}(),st=function(l){function t(t,e){void 0===e&&(e={});var n=l.call(this)||this;n.items=[],n.outlines={start:[],end:[]},n._renderTimer=0,n._onResize=function(){n.renderItems({useResize:!0})},n.options=f(f({},n.constructor.defaultOptions),e),n.containerElement="string"==typeof t?document.querySelector(t):t;var i=n.options,r=i.isEqualSize,o=i.isConstantSize,s=i.useTransform,a=i.horizontal,u=i.percentage,h=i.externalContainerManager,c=i.externalItemRenderer,e=i.resizeDebounce,t=i.maxResizeDebounce,i=i.autoResize;return n.containerManager=h||new v(n.containerElement,{horizontal:a,resizeDebounce:e,maxResizeDebounce:t,autoResize:i}).on("resize",n._onResize),n.itemRenderer=c||new J({useTransform:s,isEqualSize:r,isConstantSize:o,percentage:u}),n._init(),n}r(t,l);var e=t.prototype;return e.getContainerElement=function(){return this.containerElement},e.getItems=function(){return this.items},e.getChildren=function(){return[].slice.call(this.containerElement.children)},e.setItems=function(t){return this.items=t,this},e.getContainerInlineSize=function(){return this.containerManager.getInlineSize()},e.getOutlines=function(){return this.outlines},e.setOutlines=function(t){return this.outlines=t,this},e.syncElements=function(t){void 0===t&&(t={});var n=this.items,e=this.options.horizontal,i=this.getChildren(),r=rt(this.items.map(function(t){return t.element}),i),o=r.added,s=r.maintained,a=r.changed,r=r.removed,u=[];return s.forEach(function(t){var e=t[0],t=t[1];u[t]=n[e]}),o.forEach(function(t){u[t]=new ot(e,{element:i[t]})}),this.setItems(u),(o.length||r.length||a.length)&&this.renderItems(t),this},e.updateItems=function(t,e){return void 0===e&&(e={}),(t=void 0===t?this.items:t).forEach(function(t){t.updateState=d.NEED_UPDATE}),this.checkReady(e),this},e.renderItems=function(t){return void 0===t&&(t={}),this._clearRenderTimer(),!this.getItems().length&&this.getChildren().length?this.syncElements(t):t.useResize?(this._resizeContainer(),this.updateItems(this.items,t)):this.checkReady(t),this},e.getStatus=function(e){return{outlines:this.outlines,items:this.items.map(function(t){return e?t.getMinimizedStatus():t.getStatus()}),containerManager:this.containerManager.getStatus(),itemRenderer:this.itemRenderer.getStatus()}},e.setStatus=function(t){var e=this,n=this.options.horizontal,i=this.containerManager,r=i.getInlineSize(),o=this.getChildren();return this.itemRenderer.setStatus(t.itemRenderer),i.setStatus(t.containerManager),this.outlines=t.outlines,this.items=t.items.map(function(t,e){return new ot(n,f(f({},t),{element:o[e]}))}),this.itemRenderer.renderItems(this.items),r!==i.getInlineSize()?this.renderItems({useResize:!0}):window.setTimeout(function(){e._renderComplete({direction:e.defaultDirection,mounted:e.items,updated:[],isResize:!1})}),this},e.getComputedOutlineSize=function(t){return void 0===t&&(t=this.items),this.options.outlineSize||this.getContainerInlineSize()},e.getComputedOutlineLength=function(t){return void 0===t&&(t=this.items),this.options.outlineLength||1},e.destroy=function(t){var t=(t=void 0===t?{}:t).preserveUI,t=void 0===t?this.options.preserveUIOnDestroy:t;this.containerManager.destroy({preserveUI:t}),t||this.items.forEach(function(t){var e=t.element,t=t.orgCSSText;e&&(e.style.cssText=t)}),null!==(t=this._im)&&void 0!==t&&t.destroy()},e.checkReady=function(n){var t,i=this;void 0===n&&(n={});var r=this.items,o=r.filter(function(t){var e;return(null===(e=t.element)||void 0===e?void 0:e.parentNode)&&t.updateState!==d.UPDATED}),e=o.filter(function(t){return t.mountState!==h.MOUNTED}),s=[];e.filter(function(t){if(t.hasTransition)return!0;var e=t.element;return 0<parseFloat(getComputedStyle(e).transitionDuration)&&(t.hasTransition=!0,t.transitionDuration=e.style.transitionDuration,!0)}).forEach(function(t){t.element.style.transitionDuration="0s"}),null!==(t=this._im)&&void 0!==t&&t.destroy(),this._im=new W({prefix:this.options.attributePrefix}).on("preReadyElement",function(t){o[t.index].updateState=d.WAIT_LOADING}).on("preReady",function(){i.itemRenderer.updateItems(o),i.readyItems(e,o,n)}).on("readyElement",function(t){var e=o[t.index];e.updateState=d.NEED_UPDATE,t.isPreReadyOver&&(e.element.style.cssText=e.orgCSSText,i.itemRenderer.updateItems([e]),i.readyItems([],[e],n))}).on("error",function(t){var e=r[t.index];i.trigger("contentError",{element:t.element,target:t.target,item:e,update:function(){s.push(e)}})}).on("ready",function(){s.length&&i.updateItems(s)}).check(o.map(function(t){return t.element}))},e.scheduleRender=function(){var t=this;this._clearRenderTimer(),this._renderTimer=window.setTimeout(function(){t.renderItems()})},e.fitOutlines=function(t){void 0===t&&(t=this.useFit);var e=this.outlines,n=e.start,i=e.end,r=n.length?Math.min.apply(Math,n):0;!t&&0<r||(e.start=n.map(function(t){return t-r}),e.end=i.map(function(t){return t-r}),this.items.forEach(function(t){var e=t.cssContentPos;"number"==typeof e&&(t.cssContentPos=e-r)}))},e.readyItems=function(t,e,n){var i=this.outlines,r=n.direction||this.options.defaultDirection,o=n.outline||i["end"===r?"start":"end"],s=this.items,i={start:g(o),end:g(o)};e.forEach(function(t){t.isUpdate=!0}),s.length&&(i=this.applyGrid(this.items,r,o)),e.forEach(function(t){t.isUpdate=!1}),this.setOutlines(i),this.fitOutlines(),this.itemRenderer.renderItems(this.items),this._refreshContainerContentSize();i=t.filter(function(t){return t.hasTransition});i.length&&(this.containerManager.resize(),i.forEach(function(t){t.element.style.transitionDuration=t.transitionDuration})),this._renderComplete({direction:r,mounted:t,updated:e,isResize:!!n.useResize})},e._renderComplete=function(t){this.trigger("renderComplete",t)},e._clearRenderTimer=function(){clearTimeout(this._renderTimer),this._renderTimer=0},e._refreshContainerContentSize=function(){var t=this.outlines,e=t.start,n=t.end,t=this.options.gap,n=n.length?Math.max.apply(Math,n):0,e=e.length?Math.max.apply(Math,e):0,t=Math.max(e,n-t);this.containerManager.setContentSize(t)},e._resizeContainer=function(){this.containerManager.resize(),this.itemRenderer.setContainerRect(this.containerManager.getRect())},e._init=function(){this._resizeContainer()},t.defaultOptions=p,t.propertyTypes=n,o([V],t)}(t);function at(t,e,n,i){return Math[i].apply(Math,t.slice(e,e+n))}_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.applyGrid=function(v,t,e){for(var n,y=this.getComputedOutlineSize(v),R=this.getComputedOutlineLength(v),i=this.options,S=i.gap,r=i.align,z=i.columnSizeRatio,E=i.columnSize,i=e.length,P=v.length,_=this._getAlignPoses(R,y),C="end"===t,O=C?"min":"max",T=C?"max":"min",t=[0],b=(t=i===R?e.slice():(n=i?Math[T].apply(Math,e):0,B(R).map(function(){return n}))).slice(),I=1<R?_[1]-_[0]:0,w="stretch"===r,o=function(t){for(var e,n,i,r,o=v[C?t:P-1-t],s=parseInt(o.attributes.column||"1",10),a=parseInt(o.attributes.maxColumn||"1",10),u=o.inlineSize,h=o.contentSize,c=Math.min(R,s||Math.max(1,Math.ceil((u+S)/I))),l=Math.min(R,Math.max(c,a)),f=(n=c,i=O,t=(e=b).length-n+1,r="max"===i?"min":"max",a="max"===i?"lastIndexOf":"indexOf",(t=B(t).map(function(t){return at(e,t,n,r)}))[a](Math[i].apply(Math,t))),d=at(b,f,c,T);c<l;){var p=f+c,g=f-1;if(C&&(R<=p||b[p]>d))break;if(!C&&(g<0||b[g])<d)break;C||--f,++c}f=Math.max(0,f),c=Math.min(R-f,c),0<s&&(1<c||w||E)&&(o.cssInlineSize=u=(c-1)*I+y),0<z&&(o.cssContentSize=h=u/z);u=_[f],d=C?d:d-S-h;o.cssInlinePos=u,o.cssContentPos=d;var m=C?d+h+S:d;B(c).forEach(function(t){b[f+t]=m})},s=0;s<P;++s)o(s);return{start:C?t:b,end:C?b:t}},n.getComputedOutlineSize=function(t){void 0===t&&(t=this.items);var e=this.options,n=e.gap,i=e.align,r=this.columnSize||this.outlineSize,o=this.column||this.outlineLength||1,e=0;if("stretch"===i)e=(this.getContainerInlineSize()+n)/(o||1)-n;else if(r)e=r;else if(t.length){for(var s=t[0],a=0,u=t;a<u.length;a++){var h=u[a],c=h.attributes;if(h.updateState===d.UPDATED&&h.inlineSize&&!c.column&&!c.maxColumnCount){s=h;break}}e=s.inlineSize||0}else e=this.getContainerInlineSize();return e||0},n.getComputedOutlineLength=function(t){void 0===t&&(t=this.items);var e=this.gap,n=this.column||this.outlineLength;return n||(n=this.getComputedOutlineSize(t),Math.min(t.length,Math.max(1,Math.floor((this.getContainerInlineSize()+e)/(n+e)))))},n._getAlignPoses=function(t,e){var n=this.options,i=n.align,r=n.gap,o=this.getContainerInlineSize(),s=B(t),a=0,u=0;return"justify"===i||"stretch"===i?(u=(n=t-1)?Math.max((o-e)/n,e+r):0,a=Math.min(0,o/2-(n*u+e)/2)):(e=(t-1)*(u=e+r)+e,"center"===i?a=(o-e)/2:"end"===i&&(a=o-e)),s.map(function(t){return a+t*u})},e.propertyTypes=f(f({},st.propertyTypes),{column:a.RENDER_PROPERTY,columnSize:a.RENDER_PROPERTY,columnSizeRatio:a.RENDER_PROPERTY,align:a.RENDER_PROPERTY}),e.defaultOptions=f(f({},st.defaultOptions),{align:"justify",column:0,columnSize:0,columnSizeRatio:0}),o([V],e)}(st);function ut(t,e,n){return function(t,e){for(var n=[],i=e;i;)n.push(i),i=t[i];return n.reverse(),n}(function(t,e,n){var i={},r={};r[e]=0;var o,s,a,u,h,c,l=new ht(function(t){return t.cost});for(l.push({value:e,cost:0});l.size();)for(var f in s=(o=l.pop()).value,a=o.cost,u=t(s)||{})h=a+u[f],c=r[f],(void 0===r[f]||h<c)&&(r[f]=h,l.push({value:f,cost:h}),i[f]=s);if(void 0!==r[n])return i;throw n=["Could not find a path from ",e," to ",n,"."].join(""),new Error(n)}(t,e,n),n)}var ht=function(){function t(t){this.content=[],this.scoreFunction=t}var e=t.prototype;return e.push=function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},e.pop=function(){var t=this.content[0],e=this.content.pop();return 0<this.content.length&&(this.content[0]=e,this.sinkDown(0)),t},e.size=function(){return this.content.length},e.bubbleUp=function(t){for(var e=t,n=this.content[e];0<e;){var i=Math.floor((e+1)/2)-1,r=this.content[i];if(!(this.scoreFunction(n)<this.scoreFunction(r)))break;this.content[i]=n,this.content[e]=r,e=i}},e.sinkDown=function(t){for(var e=this.content.length,n=this.content[t],i=this.scoreFunction(n);;){var r,o=2*(t+1),s=o-1,a=null;if(s<e&&(r=this.content[s],(r=this.scoreFunction(r))<i&&(a=s)),o<e&&(s=this.content[o],this.scoreFunction(s)<(null==a?i:r)&&(a=o)),null===a)break;this.content[t]=this.content[a],this.content[a]=n,t=a}},t}();function ct(t,e){var n=t.orgInlineSize,i=t.orgContentSize;if(!n||!i)return 0;var r=parseFloat(t.gridData.inlineOffset)||0,t=parseFloat(t.gridData.contentOffset)||0;return(n-r)/(i-t)*(e-t)+r}P=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.applyGrid=function(t,e,n){var i=this.options,s=i.attributePrefix,a=i.horizontal;t.forEach(function(t){var e,n,i,r,o;t.isUpdate&&(e=t.element,r=t.attributes,n=t.gridData,i=parseFloat(r.inlineOffset)||n.inlineOffset||0,o=parseFloat(r.contentOffset)||0|n.contentOffset,!e||"inlineOffset"in r||"contentOffset"in r||t.mountState!==h.MOUNTED||(r=e.querySelector("["+s+"maintained-target]"))&&(t=e.offsetWidth-e.clientWidth+e.scrollWidth-r.clientWidth,r=e.offsetHeight-e.clientHeight+e.scrollHeight-r.clientHeight,o=a?(i=r,t):(i=t,r)),n.inlineOffset=i,n.contentOffset=o)});var r=this.options.rowRange,i=[];return t.length&&(i=r?this._getRowPath(t):this._getPath(t)),this._setStyle(t,i,n,"end"===e)},n._getRowPath=function(t){var e=this._getColumnRange(),n=this._getRowRange(),n=this._getRowLink(t,{path:[0],cost:0,length:0,currentNode:0},e,n);return null!==(n=null==n?void 0:n.path.map(function(t){return""+t}))&&void 0!==n?n:[]},n._getRowLink=function(t,e,n,i){var r=n[0],o=i[0],s=i[1],a=t.length,u=e.path,h=e.length,c=e.cost,l=e.currentNode;if(l<a&&(s<=h||a<l+r)){r=X(a-l,n)*Math.abs(this._getCost(t,l,a));return f(f({},e),{length:h+1,path:g(u,[a]),currentNode:a,cost:c+r,isOver:!0})}return a<=l?f(f({},e),{currentNode:a,isOver:h<o||s<h}):this._searchRowLink(t,e,a,n,i)},n._searchRowLink=function(t,e,n,i,r){for(var o,s=i[0],a=i[1],u=e.currentNode,h=e.path,c=e.length,l=e.cost,f=Math.min(n,u+a),d=[],p=u+s;p<=f;++p)p!==u&&(o=Math.abs(this._getCost(t,u,p)),(o=this._getRowLink(t,{path:g(h,[p]),length:c+1,cost:l+o,currentNode:p},i,r))&&d.push(o));return d.sort(function(t,e){var n=t.isOver;return n!==e.isOver?n?1:-1:X(t.length,r)-X(e.length,r)||t.cost-e.cost}),d[0]},n._getExpectedRowSize=function(t){var e=this.options.gap,r=this.getContainerInlineSize()-e*(t.length-1),o=0,s=0;return t.forEach(function(t){var e,n=t.orgInlineSize,i=t.orgContentSize;n&&i&&(e=parseFloat(t.gridData.inlineOffset)||0,t=parseFloat(t.gridData.contentOffset)||0,o+=i=(n-e)/(i-t),s+=t*i,r-=e)}),o?(r+s)/o:0},n._getExpectedInlineSize=function(t,n){var e=this.options.gap,i=t.reduce(function(t,e){return t+ct(e,n)},0);return i?i+e*(t.length-1):0},n._getCost=function(t,e,n){var i=t.slice(e,n),t=this._getExpectedRowSize(i),e=this._getSizeRange(),n=e[0],e=e[1];if(this.isCroppedSize){if(n<=t&&t<=e)return 0;i=this._getExpectedInlineSize(i,t<n?n:e);return Math.pow(i-this.getContainerInlineSize(),2)}if(isFinite(e)){if(t<n)return Math.pow(t-n,2)+Math.pow(e,2);if(e<t)return Math.pow(t-e,2)+Math.pow(e,2)}else if(t<n)return Math.max(Math.pow(n,2),Math.pow(t,2))+Math.pow(e,2);return t-n},n._getPath=function(o){var s=this,a=o.length,t=this.options.columnRange,t=q(t)?t:[t,t],u=t[0],h=t[1];return ut(function(t){for(var e={},n=parseInt(t,10),i=Math.min(n+u,a);i<=a&&!(h<i-n);++i){var r=s._getCost(o,n,i);r<0&&i===a&&(r=0),e[""+i]=Math.pow(r,2)}return e},"0",""+a)},n._setStyle=function(t,e,n,i){var s=this;void 0===n&&(n=[]);var r=this.options,a=r.gap,u=r.isCroppedSize,h=r.displayedRow,c=this._getSizeRange(),n=n[0]||0,l=this.getContainerInlineSize(),e=function(t,e){for(var n=e.length,i=[],r=0;r<n-1;++r){var o=parseInt(e[r],10),s=parseInt(e[r+1],10);i.push(t.slice(o,s))}return i}(t,e),f=n,d=0;if(e.forEach(function(i,t){var e=i.length,r=s._getExpectedRowSize(i);u&&(r=Math.max(c[0],Math.min(r,c[1])));var n=s._getExpectedInlineSize(i,r),e=a*(e-1),o=(l-e)/(n-e);i.forEach(function(t,e){var n=ct(t,r),e=i[e-1],e=e?e.cssInlinePos+e.cssInlineSize+a:0;u&&(n*=o),t.setCSSGridRect({inlinePos:e,contentPos:f,inlineSize:n,contentSize:r})}),f+=a+r,(h<0||t<h)&&(d=f)}),i)return{start:[n],end:[d]};var o=f-n;return t.forEach(function(t){t.cssContentPos-=o}),{start:[n-o],end:[n]}},n.getComputedOutlineLength=function(){return 1},n.getComputedOutlineSize=function(){return this.getContainerInlineSize()},n._getRowRange=function(){var t=this.rowRange;return q(t)?t:[t,t]},n._getColumnRange=function(){var t=this.columnRange;return q(t)?t:[t,t]},n._getSizeRange=function(){var t=this.sizeRange;return q(t)?t:[t,t]},e.propertyTypes=f(f({},st.propertyTypes),{columnRange:a.RENDER_PROPERTY,rowRange:a.RENDER_PROPERTY,sizeRange:a.RENDER_PROPERTY,isCroppedSize:a.RENDER_PROPERTY,displayedRow:a.RENDER_PROPERTY}),e.defaultOptions=f(f({},st.defaultOptions),{columnRange:[1,8],rowRange:0,sizeRange:[0,1/0],displayedRow:-1,isCroppedSize:!1}),o([V],e)}(st);function lt(t){var e=-1/0;return t.forEach(function(t){isFinite(t)&&(e=Math.max(e,t))}),isFinite(e)?e:0}function ft(t,e,n){return lt(t)+function(t,e,n){var i=t.length;if(!i)return 0;var r=function(t){var e=1/0;return t.forEach(function(t){isFinite(t)&&(e=Math.min(e,t))}),isFinite(e)?e:0}(e),o=lt(t),s=0;if(!n)return 0;for(var a=0;a<i;++a){var u=t[a],h=e[a];isFinite(u)&&isFinite(h)&&(u=u-o,h=h-r,s=a?Math.max(s,s+u-h):u-h)}return s}(t,e,n)}function dt(t,e,n){for(var i=n.inlinePos,r=n.inlineSize,o=n.contentPos,s=n.contentSize,a=i;a<i+r;++a)t[a]=Math.min(t[a],o),e[a]=Math.max(e[a],o+s)}var t=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.applyGrid=function(t,e,n){var i=this._getFrame(),r=i.inlineSize,o=i.contentSize,s=i.rects,a=this.options,u=a.gap,h=a.useFrameFill,a=this.getRectSize(r),c=a.inlineSize,l=a.contentSize,f=t.length;if(!f||!r||!o)return{start:n,end:n};for(var d=s.length,p=B(r).map(function(){return 1/0}),g=B(r).map(function(){return-1/0}),m=i.outline.map(function(t){return t*(l+u)}),v=0;v<f;v+=d)for(var y=ft(g,m,h),R=0;R<d&&v+R<f;++R){var S=t[v+R],z=s[R],E=z.contentPos,P=z.inlinePos,_=z.contentSize,C=z.inlineSize,O=y+E*(l+u),z=P*(c+u),E=_*(l+u)-u,_=C*(c+u)-u;dt(p,g,{inlinePos:P,inlineSize:C,contentPos:O,contentSize:E+u}),S.setCSSGridRect({inlinePos:z,contentPos:O,inlineSize:_,contentSize:E})}var T,e="end"===e,n=n.length?n:[0];n.length!==r&&(T=(e?Math.max:Math.min).apply(Math,n),n=B(r).map(function(){return T}));var p=p.map(function(t){return isFinite(t)?t:0}),g=g.map(function(t){return isFinite(t)?t:0}),b=e?ft(n,p,h):ft(g,n,h);return t.forEach(function(t){t.cssContentPos+=b}),{start:p.map(function(t){return t+b}),end:g.map(function(t){return t+b})}},n.getComputedOutlineLength=function(){var t=this.options.frame;return t.length?t[0].length:0},n.getComputedOutlineSize=function(){var t=this.options,e=t.gap,t=t.rectSize;return"object"==typeof t?t.inlineSize:t||(this.getContainerInlineSize()+e)/this.getComputedOutlineLength()-e},n.getRectSize=function(t){var e=this.options,n=e.gap,e=e.rectSize;if("object"==typeof e)return e;n=e||(this.getContainerInlineSize()+n)/t-n;return{inlineSize:n,contentSize:n}},n._getFrame=function(){for(var t=this.options.frame,e=t.length,n=e?t[0].length:0,i=[],r={},o=B(n).map(function(){return 1/0}),s=B(n).map(function(){return-1/0}),a=0;a<e;++a)for(var u=0;u<n;++u){var h=t[a][u];h&&(r[a+","+u]||(dt(o,s,h=this._findRect(r,h,a,u,n,e)),i.push(h)))}return i.sort(function(t,e){return t.type<e.type?-1:1}),{rects:i,inlineSize:n,contentSize:e,outline:o}},n._findRect=function(t,e,n,i,r,o){for(var s=this.options.frame,a=1,u=1,h=i;h<r&&s[n][h]===e;++h)u=h-i+1;for(var c=n;c<o&&s[c][i]===e;++c)a=c-n+1;for(var l=n;l<n+a;++l)for(var f=i;f<i+u;++f)t[l+","+f]=!0;return{type:e,inlinePos:i,contentPos:n,inlineSize:u,contentSize:a}},e.propertyTypes=f(f({},st.propertyTypes),{frame:a.RENDER_PROPERTY,useFrameFill:a.RENDER_PROPERTY,rectSize:a.RENDER_PROPERTY}),e.defaultOptions=f(f({},st.defaultOptions),{frame:[],rectSize:0,useFrameFill:!0}),o([V],e)}(st),pt=function(){function t(t){var e,n=f({orgInlineSize:0,orgContentSize:0,inlineSize:0,contentSize:0,inlinePos:0,contentPos:0,items:[]},t);for(e in n)this[e]=n[e]}var e=t.prototype;return e.scaleTo=function(t,e){var n=this.inlineSize?t/this.inlineSize:0,i=this.contentSize?e/this.contentSize:0;this.items.forEach(function(t){0!=n&&(t.inlinePos*=n,t.inlineSize*=n),0!=i&&(t.contentPos*=i,t.contentSize*=i)}),this.inlineSize=t,this.contentSize=e},e.push=function(t){this.items.push(t)},e.getOrgSizeWeight=function(){return this.orgInlineSize*this.orgContentSize},e.getSize=function(){return this.inlineSize*this.contentSize},e.getOrgRatio=function(){return 0===this.orgContentSize?0:this.orgInlineSize/this.orgContentSize},e.getRatio=function(){return 0===this.contentSize?0:this.inlineSize/this.contentSize},t}();function gt(t,e){e=t/e;return(e=e<1?1/e:e)-1}var mt,vt={__proto__:null,default:st,GetterSetter:V,withGridMethods:R,withMethods:K,MasonryGrid:_,JustifiedGrid:P,FrameGrid:t,PackingGrid:function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.applyGrid=function(t,e,n){var i=this,r=this.options,o=r.aspectRatio,s=r.gap,a=this.getContainerInlineSize(),u=a/o,n=n.length?n:[0],h="end"===e?Math.max.apply(Math,n):Math.min.apply(Math,n)-u-s,n=h+u+s,c=new pt({});return t.forEach(function(t){t=new pt({inlineSize:t.orgInlineSize,contentSize:t.orgContentSize,orgInlineSize:t.orgInlineSize,orgContentSize:t.orgContentSize});i._findBestFitArea(c,t),c.push(t),c.scaleTo(a+s,u+s)}),t.forEach(function(t,e){var n=c.items[e],i=n.inlineSize-s,r=n.contentSize-s,e=h+n.contentPos,n=n.inlinePos;t.setCSSGridRect({inlinePos:n,contentPos:e,inlineSize:i,contentSize:r})}),{start:[h],end:[n]}},n._findBestFitArea=function(t,p){if(0===t.getRatio())return t.orgInlineSize=p.inlineSize,t.orgContentSize=p.contentSize,t.inlineSize=p.inlineSize,void(t.contentSize=p.contentSize);var g,e,n,i,r,m=1/0,v=!1,y={inlineSize:0,contentSize:0},R={inlineSize:0,contentSize:0},S=this._getWeight("size"),z=this._getWeight("ratio");t.items.forEach(function(t){for(var e=gt(t.getOrgSizeWeight(),t.getSize())*S,n=gt(t.getOrgRatio(),t.getRatio())*z,i=t.inlineSize,r=t.contentSize,o=0;o<2;++o){var s=void 0,a=void 0,u=void 0,h=void 0;0===o?(u=s=i,h=r-(a=r*(p.contentSize/(t.orgContentSize+p.contentSize)))):(h=a=r,u=i-(s=i*(p.inlineSize/(t.orgInlineSize+p.inlineSize))));var c=s*a,l=s/a,f=u*h,d=h/h,c=gt(p.getSize(),c)*S;c+=gt(p.getRatio(),l)*z,c+=gt(t.getOrgSizeWeight(),f)*S-e,(c+=gt(t.getOrgRatio(),d)*z-n)===Math.min(c,m)&&(m=c,g=t,v=0===o,y.inlineSize=s,y.contentSize=a,R.inlineSize=u,R.contentSize=h)}}),e=g,n=y,i=R,r=v,(t=p).contentSize=n.contentSize,t.inlineSize=n.inlineSize,e.contentSize=i.contentSize,e.inlineSize=i.inlineSize,r?(t.contentPos=e.contentPos+e.contentSize,t.inlinePos=e.inlinePos):(t.inlinePos=e.inlinePos+e.inlineSize,t.contentPos=e.contentPos)},n.getComputedOutlineLength=function(){return 1},n.getComputedOutlineSize=function(){return this.getContainerInlineSize()},n._getWeight=function(t){var e=this.options,n=e.weightPriority;return n===t?100:"custom"===n?e[t+"Weight"]:1},e.propertyTypes=f(f({},st.propertyTypes),{aspectRatio:a.RENDER_PROPERTY,sizeWeight:a.RENDER_PROPERTY,ratioWeight:a.RENDER_PROPERTY,weightPriority:a.RENDER_PROPERTY}),e.defaultOptions=f(f({},st.defaultOptions),{aspectRatio:1,sizeWeight:1,ratioWeight:1,weightPriority:"custom"}),o([V],e)}(st),ItemRenderer:J,GridItem:ot,ContainerManager:v,DEFAULT_GRID_OPTIONS:p,get PROPERTY_TYPE(){return a},get MOUNT_STATE(){return h},get UPDATE_STATE(){return d},GRID_PROPERTY_TYPES:n,GRID_METHODS:e,GRID_EVENTS:["renderComplete","contentError"],RECT_NAMES:m};for(mt in vt)st[mt]=vt[mt];return st}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Grid=e()}(this,function(){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var f=function(){return(f=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function o(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;0<=a;a--)(r=t[a])&&(s=(o<3?r(s):3<o?r(e,n,s):r(e,n))||s);return 3<o&&s&&Object.defineProperty(e,n,s),s}function g(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}function c(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&i>=t.length?void 0:t)&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,o=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(i=o.next()).done;)s.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}(arguments[e]));return t}function l(t){return void 0===t}var a,h,d,u=function(){function t(t,e){var n,i;if(this.eventType=t,this._canceled=!1,e)try{for(var r=c(Object.keys(e)),o=r.next();!o.done;o=r.next()){var s=o.value;this[s]=e[s]}}catch(t){n={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}}var e=t.prototype;return e.stop=function(){this._canceled=!0},e.isCanceled=function(){return this._canceled},t}(),t=function(){function t(){this._eventHandler={}}var e=t.prototype;return e.trigger=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=e instanceof u?e.eventType:e,i=s(this._eventHandler[i]||[]);return i.length<=0||(e instanceof u?(e.currentTarget=this,i.forEach(function(t){t(e)})):i.forEach(function(t){t.apply(void 0,s(n))})),this},e.once=function(n,i){var r,o=this;if("object"==typeof n&&l(i)){var t,e=n;for(t in e)this.once(t,e[t]);return this}return"string"==typeof n&&"function"==typeof i&&this.on(n,r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(void 0,s(t)),o.off(n,r)}),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&l(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}var r;return"string"==typeof t&&"function"==typeof e&&(r=this._eventHandler[t],l(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)),this},e.off=function(t,e){var n,i;if(l(t))return this._eventHandler={},this;if(l(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var r,o=t;for(r in o)this.off(r,o[r]);return this}var s=this._eventHandler[t];if(s){var a=0;try{for(var u=c(s),h=u.next();!h.done;h=u.next()){if(h.value===e){s.splice(a,1),s.length<=0&&delete this._eventHandler[t];break}a++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="3.0.1",t}(),p={horizontal:!1,useTransform:!1,percentage:!1,isEqualSize:!1,isConstantSize:!1,gap:0,attributePrefix:"data-grid-",resizeDebounce:100,maxResizeDebounce:0,autoResize:!0,preserveUIOnDestroy:!1,defaultDirection:"end",hideBeforeLoading:!1,externalContainerManager:null,externalItemRenderer:null,renderOnPropertyChange:!0,useFit:!0,outlineLength:0,outlineSize:0},m=-9999,v=1e-6;(z=a=a||{})[z.PROPERTY=1]="PROPERTY",z[z.RENDER_PROPERTY=2]="RENDER_PROPERTY",(C=h=h||{})[C.UNCHECKED=1]="UNCHECKED",C[C.UNMOUNTED=2]="UNMOUNTED",C[C.MOUNTED=3]="MOUNTED",(O=d=d||{})[O.NEED_UPDATE=1]="NEED_UPDATE",O[O.WAIT_LOADING=2]="WAIT_LOADING",O[O.UPDATED=3]="UPDATED";var n={gap:a.RENDER_PROPERTY,defaultDirection:a.PROPERTY,renderOnPropertyChange:a.PROPERTY,preserveUIOnDestroy:a.PROPERTY,useFit:a.PROPERTY,outlineSize:a.RENDER_PROPERTY,outlineLength:a.RENDER_PROPERTY},e=["syncElements","updateItems","getItems","setItems","renderItems","getContainerInlineSize","getContainerElement"],y={horizontal:{inlinePos:"top",contentPos:"left",inlineSize:"height",contentSize:"width"},vertical:{inlinePos:"left",contentPos:"top",inlineSize:"width",contentSize:"height"}},R=function(i){function t(t,e){var n=i.call(this)||this;return n.container=t,n._resizeTimer=0,n._maxResizeDebounceTimer=0,n._onResize=function(){clearTimeout(n._resizeTimer),clearTimeout(n._maxResizeDebounceTimer),n._maxResizeDebounceTimer=0,n._resizeTimer=0,n.trigger("resize")},n._scheduleResize=function(){var t=n.options,e=t.resizeDebounce,t=t.maxResizeDebounce;!n._maxResizeDebounceTimer&&e<=t&&(n._maxResizeDebounceTimer=window.setTimeout(n._onResize,t)),n._resizeTimer&&(clearTimeout(n._resizeTimer),n._resizeTimer=0),n._resizeTimer=window.setTimeout(n._onResize,e)},n.options=f({horizontal:p.horizontal,autoResize:p.autoResize,resizeDebounce:p.resizeDebounce,maxResizeDebounce:p.maxResizeDebounce},e),n._init(),n}r(t,i);var e=t.prototype;return e.resize=function(){var t=this.container;this.setRect({width:t.clientWidth,height:t.clientHeight})},e.getRect=function(){return this.rect},e.setRect=function(t){this.rect=f({},t)},e.getInlineSize=function(){return this.rect[this.options.horizontal?"height":"width"]},e.getContentSize=function(){return this.rect[this.options.horizontal?"width":"height"]},e.getStatus=function(){return{rect:f({},this.rect)}},e.setStatus=function(t){this.rect=f({},t.rect),this.setContentSize(this.getContentSize())},e.setContentSize=function(t){var e=this.options.horizontal?"width":"height";this.rect[e]=t,this.container.style[e]=t+"px"},e.destroy=function(t){void 0===t&&(t={}),window.removeEventListener("resize",this._scheduleResize),t.preserveUI||(this.container.style.cssText=this.orgCSSText)},e._init=function(){var t=this.container,e=window.getComputedStyle(t);this.orgCSSText=t.style.cssText,"static"===e.position&&(t.style.position="relative"),this.options.autoResize&&window.addEventListener("resize",this._scheduleResize)},t}(t);function S(t){return void 0===t}var z=function(){function t(){this.options={},this._eventHandler={}}var e=t.prototype;return e.trigger=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(!(0<(s=this._eventHandler[t]||[]).length))return!0;var r=n[0]||{},o=n.slice(1),s=s.concat(),a=!1;r.eventType=t,r.stop=function(){a=!0},r.currentTarget=this;var u=[r];return 1<=o.length&&(u=u.concat(o)),s.forEach(function(t){t.apply(e,u)}),!a},e.once=function(n,i){var r,o=this;if("object"==typeof n&&S(i)){var t,e=n;for(t in e)this.once(t,e[t]);return this}return"string"==typeof n&&"function"==typeof i&&this.on(n,r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(o,t),o.off(n,r)}),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&S(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}var r;return"string"==typeof t&&"function"==typeof e&&(S(r=this._eventHandler[t])&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)),this},e.off=function(t,e){var n,i;if(S(t))return this._eventHandler={},this;if(S(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var r,o=t;for(r in o)this.off(r,o[r]);return this}var s=this._eventHandler[t];if(s){var a=0;try{for(var u=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&i>=t.length?void 0:t)&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(s),h=u.next();!h.done;h=u.next()){if(h.value===e){s.splice(a,1);break}a++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="2.2.2",t}(),E=function(t,e){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function P(t,e){function n(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var _=function(){return(_=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};var C="undefined"!=typeof window,O=C?window.navigator.userAgent:"",T=C&&!!("getComputedStyle"in window),I=/MSIE|Trident|Windows Phone|Edge/.test(O),b=C&&!!("addEventListener"in document),w="width",x="height";function D(t,e){return t.getAttribute(e)||""}function M(t){return[].slice.call(t)}function k(t){return"loading"in t&&"lazy"===t.getAttribute("loading")}function N(t,e,n){b?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}function L(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent?t.detachEvent("on"+e,n):t["on"+e]=null}function A(t,e){var n=t["client"+e]||t["offset"+e];return parseFloat(n||(t=t,((T?window.getComputedStyle(t):t.currentStyle)||{})[e.toLowerCase()]))||0}function F(t,e,n){var i=M(t.querySelectorAll(function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}(["["+n+"skip] ["+n+"width]"],e.map(function(t){return["["+n+"skip] "+t,t+"["+n+"skip]","["+n+"width] "+t].join(", ")})).join(", ")));return M(t.querySelectorAll("["+n+"width], "+e.join(", "))).filter(function(t){return-1===i.indexOf(t)})}var U=[];function j(t,e){U.length||N(window,"resize",H),t.__PREFIX__=e,U.push(t),Y(t)}function Y(t,e){void 0===e&&(e="data-");var n,i=t.__PREFIX__||e,r=parseInt(D(t,""+i+w),10)||0,e=parseInt(D(t,""+i+x),10)||0;D(t,i+"fixed")===x?(n=A(t,"Height")||e,t.style[w]=r/e*n+"px"):(n=A(t,"Width")||r,t.style[x]=e/r*n+"px")}function H(){U.forEach(function(t){Y(t)})}var O=function(o){function t(t,e){void 0===e&&(e={});var n,i,r=o.call(this)||this;return r.isReady=!1,r.isPreReady=!1,r.hasDataSize=!1,r.hasLoading=!1,r.isSkip=!1,r.onCheck=function(t){r.clear(),t&&"error"===t.type&&r.onError(r.element);t=!r.hasDataSize&&!r.hasLoading;r.onReady(t)},r.options=_({prefix:"data-"},e),r.element=t,r.hasDataSize=(n=t,e=r.options.prefix,!!n.getAttribute((e=void 0===e?"data-":e)+"width")),r.hasLoading=k(t),r.isSkip=!!r.element.getAttribute((i=void 0===i?"data-":i)+"skip"),r}P(t,o);var e=t.prototype;return e.check=function(){return this.isSkip||!this.checkElement()?(this.onAlreadyReady(!0),!1):(this.hasDataSize&&j(this.element,this.options.prefix),(this.hasDataSize||this.hasLoading)&&this.onAlreadyPreReady(),!0)},e.addEvents=function(){var e=this,n=this.element;this.constructor.EVENTS.forEach(function(t){N(n,t,e.onCheck)})},e.clear=function(){var e=this,n=this.element;this.constructor.EVENTS.forEach(function(t){L(n,t,e.onCheck)}),this.removeAutoSizer()},e.destroy=function(){this.clear(),this.off()},e.removeAutoSizer=function(){var t,e,n;this.hasDataSize&&(n=this.options.prefix,t=this.element,e=n,(n=U.indexOf(t))<0||(e=D(t,e+"fixed"),delete t.__PREFIX__,t.style[e===x?w:x]="",U.splice(n,1),U.length||L(window,"resize",H)))},e.onError=function(t){this.trigger("error",{element:this.element,target:t})},e.onPreReady=function(){this.isPreReady||(this.isPreReady=!0,this.trigger("preReady",{element:this.element,hasLoading:this.hasLoading,isSkip:this.isSkip}))},e.onReady=function(t){this.isReady||((t=!this.isPreReady&&t)&&(this.isPreReady=!0),this.removeAutoSizer(),this.isReady=!0,this.trigger("ready",{element:this.element,withPreReady:t,hasLoading:this.hasLoading,isSkip:this.isSkip}))},e.onAlreadyError=function(t){var e=this;setTimeout(function(){e.onError(t)})},e.onAlreadyPreReady=function(){var t=this;setTimeout(function(){t.onPreReady()})},e.onAlreadyReady=function(t){var e=this;setTimeout(function(){e.onReady(t)})},t.EVENTS=[],t}(z),G=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}P(e,t);var n=e.prototype;return n.setHasLoading=function(t){this.hasLoading=t},n.check=function(){return this.isSkip?(this.onAlreadyReady(!0),!1):(this.hasDataSize?(j(this.element,this.options.prefix),this.onAlreadyPreReady()):this.trigger("requestChildren"),!0)},n.checkElement=function(){return!0},n.destroy=function(){this.clear(),this.trigger("requestDestroy"),this.off()},n.onAlreadyPreReady=function(){t.prototype.onAlreadyPreReady.call(this),this.trigger("reqeustReadyChildren")},e.EVENTS=[],e}(O),C=function(n){function t(t){void 0===t&&(t={});var e=n.call(this)||this;return e.readyCount=0,e.preReadyCount=0,e.totalCount=0,e.totalErrorCount=0,e.isPreReadyOver=!0,e.elementInfos=[],e.options=_({loaders:{},prefix:"data-"},t),e}P(t,n);var e=t.prototype;return e.check=function(t){var o=this,n=this.options.prefix;this.clear(),this.elementInfos=M(t).map(function(t,r){var e=o.getLoader(t,{prefix:n});return e.check(),e.on("error",function(t){o.onError(r,t.target)}).on("preReady",function(t){var e=o.elementInfos[r];e.hasLoading=t.hasLoading,e.isSkip=t.isSkip;t=o.checkPreReady(r);o.onPreReadyElement(r),t&&o.onPreReady()}).on("ready",function(t){var e=t.withPreReady,n=t.hasLoading,i=t.isSkip,t=o.elementInfos[r];t.hasLoading=n,t.isSkip=i;t=e&&o.checkPreReady(r),i=o.checkReady(r);e&&o.onPreReadyElement(r),o.onReadyElement(r),t&&o.onPreReady(),i&&o.onReady()}),{loader:e,element:t,hasLoading:!1,hasError:!1,isPreReady:!1,isReady:!1,isSkip:!1}});t=this.elementInfos.length;return(this.totalCount=t)||setTimeout(function(){o.onPreReady(),o.onReady()}),this},e.getTotalCount=function(){return this.totalCount},e.isPreReady=function(){return this.elementInfos.every(function(t){return t.isPreReady})},e.isReady=function(){return this.elementInfos.every(function(t){return t.isReady})},e.hasError=function(){return 0<this.totalErrorCount},e.clear=function(){this.isPreReadyOver=!1,this.totalCount=0,this.preReadyCount=0,this.readyCount=0,this.totalErrorCount=0,this.elementInfos.forEach(function(t){!t.isReady&&t.loader&&t.loader.destroy()}),this.elementInfos=[]},e.destroy=function(){this.clear(),this.off()},e.getLoader=function(e,t){var n=this,i=e.tagName.toLowerCase(),r=this.options.loaders,o=Object.keys(r);if(r[i])return new r[i](e,t);var s=new G(e,t),a=M(e.querySelectorAll(o.join(", ")));s.setHasLoading(a.some(k));var u=!1,h=this.clone().on("error",function(t){s.onError(t.target)}).on("ready",function(){s.onReady(u)});return s.on("requestChildren",function(){var t=F(e,o,n.options.prefix);h.check(t).on("preReady",function(t){(u=t.isReady)||s.onPreReady()})}).on("reqeustReadyChildren",function(){h.check(a)}).on("requestDestroy",function(){h.destroy()}),s},e.clone=function(){return new t(_({},this.options))},e.checkPreReady=function(t){return this.elementInfos[t].isPreReady=!0,++this.preReadyCount,!(this.preReadyCount<this.totalCount)},e.checkReady=function(t){return this.elementInfos[t].isReady=!0,++this.readyCount,!(this.readyCount<this.totalCount)},e.onError=function(t,e){var n=this.elementInfos[t];n.hasError=!0,this.trigger("error",{element:n.element,index:t,target:e,errorCount:this.getErrorCount(),totalErrorCount:++this.totalErrorCount})},e.onPreReadyElement=function(t){var e=this.elementInfos[t];this.trigger("preReadyElement",{element:e.element,index:t,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:e.hasLoading,isSkip:e.isSkip})},e.onPreReady=function(){this.isPreReadyOver=!0,this.trigger("preReady",{readyCount:this.readyCount,totalCount:this.totalCount,isReady:this.isReady(),hasLoading:this.hasLoading()})},e.onReadyElement=function(t){var e=this.elementInfos[t];this.trigger("readyElement",{index:t,element:e.element,hasError:e.hasError,errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:e.hasLoading,isPreReadyOver:this.isPreReadyOver,isSkip:e.isSkip})},e.onReady=function(){this.trigger("ready",{errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,totalCount:this.totalCount})},e.getErrorCount=function(){return this.elementInfos.filter(function(t){return t.hasError}).length},e.hasLoading=function(){return this.elementInfos.some(function(t){return t.hasLoading})},t}(z),W=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.checkElement=function(){var t=this.element,e=t.getAttribute("src");if(t.complete){if(e)return t.naturalWidth||this.onAlreadyError(t),!1;this.onAlreadyPreReady()}return this.addEvents(),I&&t.setAttribute("src",e),!0},e.EVENTS=["load","error"],e}(O),q=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.checkElement=function(){var t=this.element;return!(1<=t.readyState)&&(t.error?(this.onAlreadyError(t),!1):(this.addEvents(),!0))},e.EVENTS=["loadedmetadata","error"],e}(O),V=function(e){function t(t){return e.call(this,_({loaders:{img:W,video:q}},t=void 0===t?{}:t))||this}return P(t,e),t}(C);function B(t){return"object"==typeof t}function K(t){var e,r=t.prototype,o=t.propertyTypes;for(e in o)!function(n){var i=o[n]===a.RENDER_PROPERTY,t=Object.getOwnPropertyDescriptor(r,n)||{};Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:t.get||function(){return this.options[n]},set:t.set||function(t){var e=this.options;e[n]!==t&&(e[n]=t,i&&e.renderOnPropertyChange&&this.scheduleRender())}})}(e)}function X(e){return function(t,r){e.forEach(function(i){i in t||(t[i]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=(n=this[r])[i].apply(n,t);return n===this[r]?this:n})})}}function J(t){for(var e=[],n=0;n<t;++n)e.push(n);return e}function Q(t,e){return Math.max(t-e[1],e[0]-t,0)+1}var z=X(e),Z=function(){function t(t){this.initialRect=null,this.sizePercetage=!1,this.posPercetage=!1,this.options=f({attributePrefix:p.attributePrefix,useTransform:p.useTransform,horizontal:p.horizontal,percentage:p.percentage,isEqualSize:p.isEqualSize,isConstantSize:p.isConstantSize},t),this._init()}var e=t.prototype;return e.resize=function(){this.initialRect=null},e.renderItems=function(t){var e=this;t.forEach(function(t){e._renderItem(t)})},e.getInlineSize=function(){return this.containerRect[this.options.horizontal?"height":"width"]},e.setContainerRect=function(t){this.containerRect=t},e.updateItems=function(t){var e=this;t.forEach(function(t){e._updateItem(t)})},e.getStatus=function(){return{initialRect:this.initialRect}},e.setStatus=function(t){this.initialRect=t.initialRect},e._init=function(){var t=this.options.percentage,e=!1,n=!1;!0===t?n=e=!0:t&&(-1<t.indexOf("position")&&(n=!0),-1<t.indexOf("size")&&(e=!0)),this.posPercetage=n,this.sizePercetage=e},e._updateItem=function(t){var e,n=this.options,i=n.isEqualSize,r=n.isConstantSize,o=this.initialRect,s=t.orgRect,a=t.element,u=t.updateState===d.WAIT_LOADING,n=s&&s.width&&s.height;if(i&&o)e=o;else if(r&&n&&!u)e=s;else{if(!a)return;e={left:a.offsetLeft,top:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}}return t.isFirstUpdate||(t.orgRect=f({},e)),t.rect=f({},e),t.element&&(t.mountState=h.MOUNTED),t.updateState===d.NEED_UPDATE&&(t.updateState=d.UPDATED,t.isFirstUpdate=!0),t.attributes=a?function(t,e){for(var n={},i=t.attributes,r=i.length,o=0;o<r;++o){var s=i[o],a=s.name,s=s.value;-1!==a.indexOf(e)&&(n[a.replace(e,"").replace(/[\s-_]([a-z])/g,function(t,e){return e.toUpperCase()})]=s)}return n}(a,this.options.attributePrefix):{},u||(this.initialRect=f({},e)),e},e._renderItem=function(t){var n,i,e,r,o,s,a,u=t.element,h=t.cssRect;u&&h&&(a=(e=this.options).horizontal,t=e.useTransform,n=this.posPercetage,i=this.sizePercetage,e=["position: absolute;"],r=(a=y[a?"horizontal":"vertical"]).inlineSize,o=a.inlinePos,s=this.getInlineSize(),a=h,a=Object.keys(a),t&&(a=a.filter(function(t){return"top"!==t&&"left"!==t}),e.push("transform: translate("+(h.left||0)+"px, "+(h.top||0)+"px);")),e.push.apply(e,a.map(function(t){var e=h[t];return t===r&&i||t===o&&n?t+": "+e/s*100+"%;":t+": "+e+"px;"})),u.style.cssText+=e.join(""))},t}(),$=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,i=this.values,r=n.indexOf(t),r=-1===r?n.length:r;n[r]=t,i[r]=e},t}(),tt=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),et="function"==typeof Map,nt=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var it=function(){function t(t,e,n,i,r,o,s,a){this.prevList=t,this.list=e,this.added=n,this.removed=i,this.changed=r,this.maintained=o,this.changedBeforeAdded=s,this.fixed=a}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t,n,r,o,t=(t=this.changedBeforeAdded,n=this.fixed,r=[],o=[],t.forEach(function(t){var e=t[0],n=t[1],t=new nt;r[e]=t,o[n]=t}),r.forEach(function(t,e){t.connect(r[e-1])}),t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],i=t[1];if(n===i)return[0,0];t=r[n],n=o[i-1],i=t.getIndex();return t.disconnect(),n?t.connect(n,n.next):t.connect(void 0,r[0]),[i,t.getIndex()]})),s=this.changed,a=[];this.cacheOrdered=t.filter(function(t,e){var n=t[0],i=t[1],t=s[e],e=t[0],t=t[1];if(n!==i)return a.push([e,t]),!0}),this.cachePureChanged=a},t}();var rt,ot="function"==typeof Map?void 0:(rt=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++rt)});function st(t,e){return n=t,i=e,r=ot,t=et?Map:r?tt:$,e=r||function(t){return t},o=[],s=[],a=[],r=n.map(e),e=i.map(e),u=new t,h=new t,c=[],l=[],f={},d=[],g=p=0,r.forEach(function(t,e){u.set(t,e)}),e.forEach(function(t,e){h.set(t,e)}),r.forEach(function(t,e){t=h.get(t);void 0===t?(++g,s.push(e)):f[t]=g}),e.forEach(function(t,e){t=u.get(t);void 0===t?(o.push(e),++p):(a.push([t,e]),g=f[e]||0,c.push([t-g,e-p]),l.push(e===t),t!==e&&d.push([t,e]))}),s.reverse(),new it(n,i,o,s,d,a,c,l);var n,i,r,o,s,a,u,h,c,l,f,d,p,g}var at=function(){function t(t,e){void 0===e&&(e={}),this.horizontal=t,this.isUpdate=!1,this.hasTransition=!1,this.transitionDuration="";var n,t=e.element,i=f({key:"",orgRect:{left:0,top:0,width:0,height:0},rect:{left:0,top:0,width:0,height:0},cssRect:{},attributes:{},data:{},isFirstUpdate:!1,mountState:h.UNCHECKED,updateState:d.NEED_UPDATE,element:t||null,orgCSSText:null!==(t=null==t?void 0:t.style.cssText)&&void 0!==t?t:"",gridData:{}},e);for(n in i)this[n]=i[n]}var e=t.prototype;return Object.defineProperty(e,"orgInlineSize",{get:function(){var t=this.orgRect,e=this.rect;return this.horizontal?t.height||e.height:t.width||e.width},enumerable:!1,configurable:!0}),Object.defineProperty(e,"orgContentSize",{get:function(){var t=this.orgRect,e=this.rect;return this.horizontal?t.width||e.width:t.height||e.height},enumerable:!1,configurable:!0}),Object.defineProperty(e,"inlineSize",{get:function(){var t=this.rect;return this.horizontal?t.height:t.width},enumerable:!1,configurable:!0}),Object.defineProperty(e,"contentSize",{get:function(){var t=this.rect;return this.horizontal?t.width:t.height},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssInlineSize",{get:function(){var t=this.cssRect;return this.horizontal?t.height:t.width},set:function(t){this.cssRect[this.horizontal?"height":"width"]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssContentSize",{get:function(){var t=this.cssRect;return this.horizontal?t.width:t.height},set:function(t){this.cssRect[this.horizontal?"width":"height"]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssInlinePos",{get:function(){var t=this.cssRect;return this.horizontal?t.top:t.left},set:function(t){this.cssRect[this.horizontal?"top":"left"]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssContentPos",{get:function(){var t=this.cssRect;return this.horizontal?t.left:t.top},set:function(t){this.cssRect[this.horizontal?"left":"top"]=t},enumerable:!1,configurable:!0}),e.setCSSGridRect=function(t){var e,n=y[this.horizontal?"horizontal":"vertical"],i={};for(e in t)i[n[e]]=t[e];this.cssRect=i},e.getStatus=function(){return{mountState:this.mountState,updateState:this.updateState,attributes:this.attributes,orgCSSText:this.orgCSSText,isFirstUpdate:this.isFirstUpdate,element:null,key:this.key,orgRect:this.orgRect,rect:this.rect,cssRect:this.cssRect,gridData:this.gridData,data:this.data}},e.getMinimizedStatus=function(){var t={orgRect:this.orgRect,rect:this.rect,cssRect:this.cssRect,attributes:this.attributes,gridData:this.gridData},e=this,n=e.key,i=e.mountState,r=e.updateState,o=e.isFirstUpdate,e=e.orgCSSText;return void 0!==n&&(t.key=n),i!==h.UNCHECKED&&(t.mountState=i),r!==d.NEED_UPDATE&&(t.updateState=r),o&&(t.isFirstUpdate=!0),e&&(t.orgCSSText=e),t},t}(),ut=function(l){function t(t,e){void 0===e&&(e={});var n=l.call(this)||this;n.items=[],n.outlines={start:[],end:[]},n._renderTimer=0,n._onResize=function(){n.renderItems({useResize:!0})},n.options=f(f({},n.constructor.defaultOptions),e),n.containerElement="string"==typeof t?document.querySelector(t):t;var i=n.options,r=i.isEqualSize,o=i.isConstantSize,s=i.useTransform,a=i.horizontal,u=i.percentage,h=i.externalContainerManager,c=i.externalItemRenderer,e=i.resizeDebounce,t=i.maxResizeDebounce,i=i.autoResize;return n.containerManager=h||new R(n.containerElement,{horizontal:a,resizeDebounce:e,maxResizeDebounce:t,autoResize:i}).on("resize",n._onResize),n.itemRenderer=c||new Z({useTransform:s,isEqualSize:r,isConstantSize:o,percentage:u}),n._init(),n}r(t,l);var e=t.prototype;return e.getContainerElement=function(){return this.containerElement},e.getItems=function(){return this.items},e.getChildren=function(){return[].slice.call(this.containerElement.children)},e.setItems=function(t){return this.items=t,this},e.getContainerInlineSize=function(){return this.containerManager.getInlineSize()},e.getOutlines=function(){return this.outlines},e.setOutlines=function(t){return this.outlines=t,this},e.syncElements=function(t){void 0===t&&(t={});var n=this.items,e=this.options,i=e.hideBeforeLoading,r=e.horizontal,o=this.getChildren(),s=st(this.items.map(function(t){return t.element}),o),a=s.added,u=s.maintained,e=s.changed,s=s.removed,h=[];return u.forEach(function(t){var e=t[0],t=t[1];h[t]=n[e]}),a.forEach(function(t){h[t]=new at(r,{element:o[t],cssRect:i?{top:m,left:m}:{}})}),i&&a.length&&(this.itemRenderer.renderItems(a.map(function(t){return h[t]})),this._refreshContainerContentSize()),this.setItems(h),(a.length||s.length||e.length)&&this.renderItems(t),this},e.updateItems=function(t,e){void 0===t&&(t=this.items);var n=(e=void 0===e?{}:e).useOrgResize;return t.forEach(function(t){var e;n&&((e=t.orgRect).width=0,e.height=0),t.updateState=d.NEED_UPDATE}),this.checkReady(e),this},e.renderItems=function(t){return void 0===t&&(t={}),this._clearRenderTimer(),!this.getItems().length&&this.getChildren().length?this.syncElements(t):t.useResize?(this._resizeContainer(),this.updateItems(this.items,t)):this.checkReady(t),this},e.getStatus=function(e){return{outlines:this.outlines,items:this.items.map(function(t){return e?t.getMinimizedStatus():t.getStatus()}),containerManager:this.containerManager.getStatus(),itemRenderer:this.itemRenderer.getStatus()}},e.setStatus=function(t){var e=this,n=this.options.horizontal,i=this.containerManager,r=i.getInlineSize(),o=this.getChildren();return this.itemRenderer.setStatus(t.itemRenderer),i.setStatus(t.containerManager),this.outlines=t.outlines,this.items=t.items.map(function(t,e){return new at(n,f(f({},t),{element:o[e]}))}),this.itemRenderer.renderItems(this.items),r!==i.getInlineSize()?this.renderItems({useResize:!0}):window.setTimeout(function(){e._renderComplete({direction:e.defaultDirection,mounted:e.items,updated:[],isResize:!1})}),this},e.getComputedOutlineSize=function(t){return void 0===t&&(t=this.items),this.options.outlineSize||this.getContainerInlineSize()},e.getComputedOutlineLength=function(t){return void 0===t&&(t=this.items),this.options.outlineLength||1},e.destroy=function(t){var t=(t=void 0===t?{}:t).preserveUI,t=void 0===t?this.options.preserveUIOnDestroy:t;this.containerManager.destroy({preserveUI:t}),t||this.items.forEach(function(t){var e=t.element,t=t.orgCSSText;e&&(e.style.cssText=t)}),null!==(t=this._im)&&void 0!==t&&t.destroy()},e.checkReady=function(n){var t,i=this;void 0===n&&(n={});var r=this.items,o=r.filter(function(t){var e;return(null===(e=t.element)||void 0===e?void 0:e.parentNode)&&t.updateState!==d.UPDATED}),e=o.filter(function(t){return t.mountState!==h.MOUNTED}),s=[];e.filter(function(t){if(t.hasTransition)return!0;var e=t.element;return 0<parseFloat(getComputedStyle(e).transitionDuration)&&(t.hasTransition=!0,t.transitionDuration=e.style.transitionDuration,!0)}).forEach(function(t){t.element.style.transitionDuration="0s"}),null!==(t=this._im)&&void 0!==t&&t.destroy(),this._im=new V({prefix:this.options.attributePrefix}).on("preReadyElement",function(t){o[t.index].updateState=d.WAIT_LOADING}).on("preReady",function(){o.forEach(function(t){!t.orgRect.width&&t.rect.width&&(t.element.style.cssText=t.orgCSSText)}),i.itemRenderer.updateItems(o),i.readyItems(e,o,n)}).on("readyElement",function(t){var e=o[t.index];e.updateState=d.NEED_UPDATE,t.isPreReadyOver&&(e.element.style.cssText=e.orgCSSText,i.itemRenderer.updateItems([e]),i.readyItems([],[e],n))}).on("error",function(t){var e=r[t.index];i.trigger("contentError",{element:t.element,target:t.target,item:e,update:function(){s.push(e)}})}).on("ready",function(){s.length&&i.updateItems(s)}).check(o.map(function(t){return t.element}))},e.scheduleRender=function(){var t=this;this._clearRenderTimer(),this._renderTimer=window.setTimeout(function(){t.renderItems()})},e.fitOutlines=function(t){void 0===t&&(t=this.useFit);var e=this.outlines,n=e.start,i=e.end,r=n.length?Math.min.apply(Math,n):0;!t&&0<r||(e.start=n.map(function(t){return t-r}),e.end=i.map(function(t){return t-r}),this.items.forEach(function(t){var e=t.cssContentPos;"number"==typeof e&&(t.cssContentPos=e-r)}))},e.readyItems=function(t,e,n){var i=this.outlines,r=n.direction||this.options.defaultDirection,o=n.outline||i["end"===r?"start":"end"],s=this.items,i={start:g(o),end:g(o)};e.forEach(function(t){t.isUpdate=!0}),s.length&&(i=this.applyGrid(this.items,r,o)),e.forEach(function(t){t.isUpdate=!1}),this.setOutlines(i),this.fitOutlines(),this.itemRenderer.renderItems(this.items),this._refreshContainerContentSize();i=t.filter(function(t){return t.hasTransition});i.length&&(this.containerManager.resize(),i.forEach(function(t){t.element.style.transitionDuration=t.transitionDuration})),this._renderComplete({direction:r,mounted:t,updated:e,isResize:!!n.useResize})},e._renderComplete=function(t){this.trigger("renderComplete",t)},e._clearRenderTimer=function(){clearTimeout(this._renderTimer),this._renderTimer=0},e._refreshContainerContentSize=function(){var t=this.outlines,e=t.start,n=t.end,t=this.options.gap,n=n.length?Math.max.apply(Math,n):0,e=e.length?Math.max.apply(Math,e):0,t=Math.max(e,n-t);this.containerManager.setContentSize(t)},e._resizeContainer=function(){this.containerManager.resize(),this.itemRenderer.setContainerRect(this.containerManager.getRect())},e._init=function(){this._resizeContainer()},t.defaultOptions=p,t.propertyTypes=n,o([K],t)}(t);function ht(t,e,n,i){return Math[i].apply(Math,t.slice(e,e+n))}O=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.applyGrid=function(v,t,e){for(var n,y=this.getComputedOutlineSize(v),R=this.getComputedOutlineLength(v),i=this.options,S=i.gap,r=i.align,z=i.columnSizeRatio,E=i.columnSize,i=e.length,P=v.length,_=this._getAlignPoses(R,y),C="end"===t,O=C?"min":"max",T=C?"max":"min",t=[0],I=(t=i===R?e.slice():(n=i?Math[T].apply(Math,e):0,J(R).map(function(){return n}))).slice(),b=1<R?_[1]-_[0]:0,w="stretch"===r,o=function(t){for(var e,n,i,r,o=v[C?t:P-1-t],s=parseInt(o.attributes.column||"1",10),a=parseInt(o.attributes.maxColumn||"1",10),u=o.inlineSize,h=o.contentSize,c=Math.min(R,s||Math.max(1,Math.ceil((u+S)/b))),l=Math.min(R,Math.max(c,a)),f=(n=c,i=O,t=(e=I).length-n+1,r="max"===i?"min":"max",a="max"===i?"lastIndexOf":"indexOf",(t=J(t).map(function(t){return ht(e,t,n,r)}))[a](Math[i].apply(Math,t))),d=ht(I,f,c,T);c<l;){var p=f+c,g=f-1;if(C&&(R<=p||I[p]>d))break;if(!C&&(g<0||I[g])<d)break;C||--f,++c}f=Math.max(0,f),c=Math.min(R-f,c),0<s&&(1<c||w||E)&&(o.cssInlineSize=u=(c-1)*b+y),0<z&&(o.cssContentSize=h=u/z);u=_[f],d=C?d:d-S-h;o.cssInlinePos=u,o.cssContentPos=d;var m=C?d+h+S:d;J(c).forEach(function(t){I[f+t]=m})},s=0;s<P;++s)o(s);return{start:C?t:I,end:C?I:t}},n.getComputedOutlineSize=function(t){void 0===t&&(t=this.items);var e=this.options,n=e.gap,i=e.align,r=this.columnSize||this.outlineSize,o=this.column||this.outlineLength||1,e=0;if("stretch"===i)e=(this.getContainerInlineSize()+n)/(o||1)-n;else if(r)e=r;else if(t.length){for(var s=t[0],a=0,u=t;a<u.length;a++){var h=u[a],c=h.attributes;if(h.updateState===d.UPDATED&&h.inlineSize&&!c.column&&!c.maxColumnCount){s=h;break}}e=s.inlineSize||0}else e=this.getContainerInlineSize();return e||0},n.getComputedOutlineLength=function(t){void 0===t&&(t=this.items);var e=this.gap,n=this.column||this.outlineLength;return n||(n=this.getComputedOutlineSize(t),Math.min(t.length,Math.max(1,Math.floor((this.getContainerInlineSize()+e)/(n+e)))))},n._getAlignPoses=function(t,e){var n=this.options,i=n.align,r=n.gap,o=this.getContainerInlineSize(),s=J(t),a=0,u=0;return"justify"===i||"stretch"===i?(u=(n=t-1)?Math.max((o-e)/n,e+r):0,a=Math.min(0,o/2-(n*u+e)/2)):(e=(t-1)*(u=e+r)+e,"center"===i?a=(o-e)/2:"end"===i&&(a=o-e)),s.map(function(t){return a+t*u})},e.propertyTypes=f(f({},ut.propertyTypes),{column:a.RENDER_PROPERTY,columnSize:a.RENDER_PROPERTY,columnSizeRatio:a.RENDER_PROPERTY,align:a.RENDER_PROPERTY}),e.defaultOptions=f(f({},ut.defaultOptions),{align:"justify",column:0,columnSize:0,columnSizeRatio:0}),o([K],e)}(ut);function ct(t,e,n){return function(t,e){for(var n=[],i=e;i;)n.push(i),i=t[i];return n.reverse(),n}(function(t,e,n){var i={},r={};r[e]=0;var o,s,a,u,h,c,l=new lt(function(t){return t.cost});for(l.push({value:e,cost:0});l.size();)for(var f in s=(o=l.pop()).value,a=o.cost,u=t(s)||{})h=a+u[f],c=r[f],(void 0===r[f]||h<c)&&(r[f]=h,l.push({value:f,cost:h}),i[f]=s);if(void 0!==r[n])return i;throw n=["Could not find a path from ",e," to ",n,"."].join(""),new Error(n)}(t,e,n),n)}var lt=function(){function t(t){this.content=[],this.scoreFunction=t}var e=t.prototype;return e.push=function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},e.pop=function(){var t=this.content[0],e=this.content.pop();return 0<this.content.length&&(this.content[0]=e,this.sinkDown(0)),t},e.size=function(){return this.content.length},e.bubbleUp=function(t){for(var e=t,n=this.content[e];0<e;){var i=Math.floor((e+1)/2)-1,r=this.content[i];if(!(this.scoreFunction(n)<this.scoreFunction(r)))break;this.content[i]=n,this.content[e]=r,e=i}},e.sinkDown=function(t){for(var e=this.content.length,n=this.content[t],i=this.scoreFunction(n);;){var r,o=2*(t+1),s=o-1,a=null;if(s<e&&(r=this.content[s],(r=this.scoreFunction(r))<i&&(a=s)),o<e&&(s=this.content[o],this.scoreFunction(s)<(null==a?i:r)&&(a=o)),null===a)break;this.content[t]=this.content[a],this.content[a]=n,t=a}},t}();function ft(t,e){var n=t.orgInlineSize,i=t.orgContentSize;if(!n||!i)return 0;var r=parseFloat(t.gridData.inlineOffset)||0,t=parseFloat(t.gridData.contentOffset)||0;return(n-r)/Math.max(v,i-t)*(e-t)+r}C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.applyGrid=function(t,e,n){var i=this.options,s=i.attributePrefix,a=i.horizontal;t.forEach(function(t){var e,n,i,r,o;t.isUpdate&&(e=t.element,r=t.attributes,n=t.gridData,i=parseFloat(r.inlineOffset)||n.inlineOffset||0,o=parseFloat(r.contentOffset)||0|n.contentOffset,!e||"inlineOffset"in r||"contentOffset"in r||t.mountState!==h.MOUNTED||(r=e.querySelector("["+s+"maintained-target]"))&&(t=e.offsetWidth-e.clientWidth+e.scrollWidth-r.clientWidth,r=e.offsetHeight-e.clientHeight+e.scrollHeight-r.clientHeight,o=a?(i=r,t):(i=t,r)),n.inlineOffset=i,n.contentOffset=o)});var r=this.options.rowRange,i=[];return t.length&&(i=r?this._getRowPath(t):this._getPath(t)),this._setStyle(t,i,n,"end"===e)},n._getRowPath=function(t){var e=this._getColumnRange(),n=this._getRowRange(),n=this._getRowLink(t,{path:[0],cost:0,length:0,currentNode:0},e,n);return null!==(n=null==n?void 0:n.path.map(function(t){return""+t}))&&void 0!==n?n:[]},n._getRowLink=function(t,e,n,i){var r=n[0],o=i[0],s=i[1],a=t.length,u=e.path,h=e.length,c=e.cost,l=e.currentNode;if(l<a&&(s<=h||a<l+r)){r=Q(a-l,n)*Math.abs(this._getCost(t,l,a));return f(f({},e),{length:h+1,path:g(u,[a]),currentNode:a,cost:c+r,isOver:!0})}return a<=l?f(f({},e),{currentNode:a,isOver:h<o||s<h}):this._searchRowLink(t,e,a,n,i)},n._searchRowLink=function(t,e,n,i,r){for(var o,s=i[0],a=i[1],u=e.currentNode,h=e.path,c=e.length,l=e.cost,f=Math.min(n,u+a),d=[],p=u+s;p<=f;++p)p!==u&&(o=Math.abs(this._getCost(t,u,p)),(o=this._getRowLink(t,{path:g(h,[p]),length:c+1,cost:l+o,currentNode:p},i,r))&&d.push(o));return d.sort(function(t,e){var n=t.isOver;return n!==e.isOver?n?1:-1:Q(t.length,r)-Q(e.length,r)||t.cost-e.cost}),d[0]},n._getExpectedRowSize=function(t){var e=this.options.gap,r=this.getContainerInlineSize()-e*(t.length-1),o=0,s=0;return t.forEach(function(t){var e,n=t.orgInlineSize,i=t.orgContentSize;n&&i&&(e=parseFloat(t.gridData.inlineOffset)||0,t=parseFloat(t.gridData.contentOffset)||0,i=(n-e)/Math.max(v,i-t),o+=i,s+=t*i,r-=e)}),o?(r+s)/o:0},n._getExpectedInlineSize=function(t,n){var e=this.options.gap,i=t.reduce(function(t,e){return t+ft(e,n)},0);return i?i+e*(t.length-1):0},n._getCost=function(t,e,n){var i=t.slice(e,n),t=this._getExpectedRowSize(i),e=this._getSizeRange(),n=e[0],e=e[1];if(this.isCroppedSize){if(n<=t&&t<=e)return 0;i=this._getExpectedInlineSize(i,t<n?n:e);return Math.pow(i-this.getContainerInlineSize(),2)}if(isFinite(e)){if(t<n)return Math.pow(t-n,2)+Math.pow(e,2);if(e<t)return Math.pow(t-e,2)+Math.pow(e,2)}else if(t<n)return Math.max(Math.pow(n,2),Math.pow(t,2))+Math.pow(e,2);return t-n},n._getPath=function(o){var s=this,a=o.length,t=this.options.columnRange,t=B(t)?t:[t,t],u=t[0],h=t[1];return ct(function(t){for(var e={},n=parseInt(t,10),i=Math.min(n+u,a);i<=a&&!(h<i-n);++i){var r=s._getCost(o,n,i);r<0&&i===a&&(r=0),e[""+i]=Math.pow(r,2)}return e},"0",""+a)},n._setStyle=function(t,e,n,i){var s=this;void 0===n&&(n=[]);var r=this.options,a=r.gap,u=r.isCroppedSize,h=r.displayedRow,c=this._getSizeRange(),n=n[0]||0,l=this.getContainerInlineSize(),e=function(t,e){for(var n=e.length,i=[],r=0;r<n-1;++r){var o=parseInt(e[r],10),s=parseInt(e[r+1],10);i.push(t.slice(o,s))}return i}(t,e),f=n,d=0;if(e.forEach(function(i,t){var e=i.length,r=s._getExpectedRowSize(i);u&&(r=Math.max(c[0],Math.min(r,c[1])));var n=s._getExpectedInlineSize(i,r),e=a*(e-1),o=(l-e)/(n-e);i.forEach(function(t,e){var n=ft(t,r),e=i[e-1],e=e?e.cssInlinePos+e.cssInlineSize+a:0;u&&(n*=o),t.setCSSGridRect({inlinePos:e,contentPos:f,inlineSize:n,contentSize:r})}),f+=a+r,(h<0||t<h)&&(d=f)}),i)return{start:[n],end:[d]};var o=f-n;return t.forEach(function(t){t.cssContentPos-=o}),{start:[n-o],end:[n]}},n.getComputedOutlineLength=function(){return 1},n.getComputedOutlineSize=function(){return this.getContainerInlineSize()},n._getRowRange=function(){var t=this.rowRange;return B(t)?t:[t,t]},n._getColumnRange=function(){var t=this.columnRange;return B(t)?t:[t,t]},n._getSizeRange=function(){var t=this.sizeRange;return B(t)?t:[t,t]},e.propertyTypes=f(f({},ut.propertyTypes),{columnRange:a.RENDER_PROPERTY,rowRange:a.RENDER_PROPERTY,sizeRange:a.RENDER_PROPERTY,isCroppedSize:a.RENDER_PROPERTY,displayedRow:a.RENDER_PROPERTY}),e.defaultOptions=f(f({},ut.defaultOptions),{columnRange:[1,8],rowRange:0,sizeRange:[0,1/0],displayedRow:-1,isCroppedSize:!1}),o([K],e)}(ut);function dt(t){var e=-1/0;return t.forEach(function(t){isFinite(t)&&(e=Math.max(e,t))}),isFinite(e)?e:0}function pt(t,e,n){return dt(t)+function(t,e,n){var i=t.length;if(!i)return 0;var r=function(t){var e=1/0;return t.forEach(function(t){isFinite(t)&&(e=Math.min(e,t))}),isFinite(e)?e:0}(e),o=dt(t),s=0;if(!n)return 0;for(var a=0;a<i;++a){var u=t[a],h=e[a];isFinite(u)&&isFinite(h)&&(u=u-o,h=h-r,s=a?Math.max(s,s+u-h):u-h)}return s}(t,e,n)}function gt(t,e,n){for(var i=n.inlinePos,r=n.inlineSize,o=n.contentPos,s=n.contentSize,a=i;a<i+r;++a)t[a]=Math.min(t[a],o),e[a]=Math.max(e[a],o+s)}var t=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.applyGrid=function(t,e,n){var i=this._getFrame(),r=i.inlineSize,o=i.contentSize,s=i.rects,a=this.options,u=a.gap,h=a.useFrameFill,a=this.getRectSize(r),c=a.inlineSize,l=a.contentSize,f=t.length;if(!f||!r||!o)return{start:n,end:n};for(var d=s.length,p=J(r).map(function(){return 1/0}),g=J(r).map(function(){return-1/0}),m=i.outline.map(function(t){return t*(l+u)}),v=0;v<f;v+=d)for(var y=pt(g,m,h),R=0;R<d&&v+R<f;++R){var S=t[v+R],z=s[R],E=z.contentPos,P=z.inlinePos,_=z.contentSize,C=z.inlineSize,O=y+E*(l+u),z=P*(c+u),E=_*(l+u)-u,_=C*(c+u)-u;gt(p,g,{inlinePos:P,inlineSize:C,contentPos:O,contentSize:E+u}),S.setCSSGridRect({inlinePos:z,contentPos:O,inlineSize:_,contentSize:E})}var T,e="end"===e,n=n.length?n:[0];n.length!==r&&(T=(e?Math.max:Math.min).apply(Math,n),n=J(r).map(function(){return T}));var p=p.map(function(t){return isFinite(t)?t:0}),g=g.map(function(t){return isFinite(t)?t:0}),I=e?pt(n,p,h):pt(g,n,h);return t.forEach(function(t){t.cssContentPos+=I}),{start:p.map(function(t){return t+I}),end:g.map(function(t){return t+I})}},n.getComputedOutlineLength=function(){var t=this.options.frame;return t.length?t[0].length:0},n.getComputedOutlineSize=function(){var t=this.options,e=t.gap,t=t.rectSize;return"object"==typeof t?t.inlineSize:t||(this.getContainerInlineSize()+e)/this.getComputedOutlineLength()-e},n.getRectSize=function(t){var e=this.options,n=e.gap,e=e.rectSize;if("object"==typeof e)return e;n=e||(this.getContainerInlineSize()+n)/t-n;return{inlineSize:n,contentSize:n}},n._getFrame=function(){for(var t=this.options.frame,e=t.length,n=e?t[0].length:0,i=[],r={},o=J(n).map(function(){return 1/0}),s=J(n).map(function(){return-1/0}),a=0;a<e;++a)for(var u=0;u<n;++u){var h=t[a][u];h&&(r[a+","+u]||(gt(o,s,h=this._findRect(r,h,a,u,n,e)),i.push(h)))}return i.sort(function(t,e){return t.type<e.type?-1:1}),{rects:i,inlineSize:n,contentSize:e,outline:o}},n._findRect=function(t,e,n,i,r,o){for(var s=this.options.frame,a=1,u=1,h=i;h<r&&s[n][h]===e;++h)u=h-i+1;for(var c=n;c<o&&s[c][i]===e;++c)a=c-n+1;for(var l=n;l<n+a;++l)for(var f=i;f<i+u;++f)t[l+","+f]=!0;return{type:e,inlinePos:i,contentPos:n,inlineSize:u,contentSize:a}},e.propertyTypes=f(f({},ut.propertyTypes),{frame:a.RENDER_PROPERTY,useFrameFill:a.RENDER_PROPERTY,rectSize:a.RENDER_PROPERTY}),e.defaultOptions=f(f({},ut.defaultOptions),{frame:[],rectSize:0,useFrameFill:!0}),o([K],e)}(ut),mt=function(){function t(t){var e,n=f({orgInlineSize:0,orgContentSize:0,inlineSize:0,contentSize:0,inlinePos:0,contentPos:0,items:[]},t);for(e in n)this[e]=n[e]}var e=t.prototype;return e.scaleTo=function(t,e){var n=this.inlineSize?t/this.inlineSize:0,i=this.contentSize?e/this.contentSize:0;this.items.forEach(function(t){0!=n&&(t.inlinePos*=n,t.inlineSize*=n),0!=i&&(t.contentPos*=i,t.contentSize*=i)}),this.inlineSize=t,this.contentSize=e},e.push=function(t){this.items.push(t)},e.getOrgSizeWeight=function(){return this.orgInlineSize*this.orgContentSize},e.getSize=function(){return this.inlineSize*this.contentSize},e.getOrgRatio=function(){return 0===this.orgContentSize?0:this.orgInlineSize/this.orgContentSize},e.getRatio=function(){return 0===this.contentSize?0:this.inlineSize/this.contentSize},t}();function vt(t,e){e=t/e;return(e=e<1?1/e:e)-1}var yt,Rt={__proto__:null,default:ut,GetterSetter:K,withGridMethods:z,withMethods:X,MasonryGrid:O,JustifiedGrid:C,FrameGrid:t,PackingGrid:function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.applyGrid=function(t,e,n){var i=this,r=this.options,o=r.aspectRatio,s=r.gap,a=this.getContainerInlineSize(),u=a/o,n=n.length?n:[0],h="end"===e?Math.max.apply(Math,n):Math.min.apply(Math,n)-u-s,n=h+u+s,c=new mt({});return t.forEach(function(t){t=new mt({inlineSize:t.orgInlineSize,contentSize:t.orgContentSize,orgInlineSize:t.orgInlineSize,orgContentSize:t.orgContentSize});i._findBestFitArea(c,t),c.push(t),c.scaleTo(a+s,u+s)}),t.forEach(function(t,e){var n=c.items[e],i=n.inlineSize-s,r=n.contentSize-s,e=h+n.contentPos,n=n.inlinePos;t.setCSSGridRect({inlinePos:n,contentPos:e,inlineSize:i,contentSize:r})}),{start:[h],end:[n]}},n._findBestFitArea=function(t,p){if(0===t.getRatio())return t.orgInlineSize=p.inlineSize,t.orgContentSize=p.contentSize,t.inlineSize=p.inlineSize,void(t.contentSize=p.contentSize);var g,e,n,i,r,m=1/0,v=!1,y={inlineSize:0,contentSize:0},R={inlineSize:0,contentSize:0},S=this._getWeight("size"),z=this._getWeight("ratio");t.items.forEach(function(t){for(var e=vt(t.getOrgSizeWeight(),t.getSize())*S,n=vt(t.getOrgRatio(),t.getRatio())*z,i=t.inlineSize,r=t.contentSize,o=0;o<2;++o){var s=void 0,a=void 0,u=void 0,h=void 0;0===o?(u=s=i,h=r-(a=r*(p.contentSize/(t.orgContentSize+p.contentSize)))):(h=a=r,u=i-(s=i*(p.inlineSize/(t.orgInlineSize+p.inlineSize))));var c=s*a,l=s/a,f=u*h,d=h/h,c=vt(p.getSize(),c)*S;c+=vt(p.getRatio(),l)*z,c+=vt(t.getOrgSizeWeight(),f)*S-e,(c+=vt(t.getOrgRatio(),d)*z-n)===Math.min(c,m)&&(m=c,g=t,v=0===o,y.inlineSize=s,y.contentSize=a,R.inlineSize=u,R.contentSize=h)}}),e=g,n=y,i=R,r=v,(t=p).contentSize=n.contentSize,t.inlineSize=n.inlineSize,e.contentSize=i.contentSize,e.inlineSize=i.inlineSize,r?(t.contentPos=e.contentPos+e.contentSize,t.inlinePos=e.inlinePos):(t.inlinePos=e.inlinePos+e.inlineSize,t.contentPos=e.contentPos)},n.getComputedOutlineLength=function(){return 1},n.getComputedOutlineSize=function(){return this.getContainerInlineSize()},n._getWeight=function(t){var e=this.options,n=e.weightPriority;return n===t?100:"custom"===n?e[t+"Weight"]:1},e.propertyTypes=f(f({},ut.propertyTypes),{aspectRatio:a.RENDER_PROPERTY,sizeWeight:a.RENDER_PROPERTY,ratioWeight:a.RENDER_PROPERTY,weightPriority:a.RENDER_PROPERTY}),e.defaultOptions=f(f({},ut.defaultOptions),{aspectRatio:1,sizeWeight:1,ratioWeight:1,weightPriority:"custom"}),o([K],e)}(ut),ItemRenderer:Z,GridItem:at,ContainerManager:R,DEFAULT_GRID_OPTIONS:p,INVISIBLE_POS:m,MINIMUM_NUMBER:v,get PROPERTY_TYPE(){return a},get MOUNT_STATE(){return h},get UPDATE_STATE(){return d},GRID_PROPERTY_TYPES:n,GRID_METHODS:e,GRID_EVENTS:["renderComplete","contentError"],RECT_NAMES:y};for(yt in Rt)ut[yt]=Rt[yt];return ut}); | ||
//# sourceMappingURL=grid.min.js.map |
{ | ||
"name": "@egjs/grid", | ||
"version": "1.7.0-beta.5", | ||
"version": "1.7.0-beta.6", | ||
"description": "A component that can arrange items according to the type of grids", | ||
@@ -5,0 +5,0 @@ "main": "dist/grid.cjs.js", |
@@ -21,2 +21,3 @@ /** | ||
defaultDirection: "end", | ||
hideBeforeLoading: false, | ||
externalContainerManager: null, | ||
@@ -30,2 +31,5 @@ externalItemRenderer: null, | ||
export const INVISIBLE_POS = -9999; | ||
export const MINIMUM_NUMBER = 0.000001; | ||
export enum PROPERTY_TYPE { | ||
@@ -32,0 +36,0 @@ PROPERTY = 1, |
@@ -7,3 +7,3 @@ /** | ||
import Component from "@egjs/component"; | ||
import { DEFAULT_GRID_OPTIONS, GRID_PROPERTY_TYPES, MOUNT_STATE, UPDATE_STATE } from "./consts"; | ||
import { DEFAULT_GRID_OPTIONS, GRID_PROPERTY_TYPES, INVISIBLE_POS, MOUNT_STATE, UPDATE_STATE } from "./consts"; | ||
import { ContainerManager } from "./ContainerManager"; | ||
@@ -158,3 +158,3 @@ import { | ||
const items = this.items; | ||
const horizontal = this.options.horizontal; | ||
const { hideBeforeLoading, horizontal } = this.options; | ||
const elements: HTMLElement[] = this.getChildren(); | ||
@@ -171,5 +171,11 @@ const { added, maintained, changed, removed } = diff(this.items.map((item) => item.element!), elements); | ||
element: elements[index], | ||
cssRect: hideBeforeLoading ? { top: INVISIBLE_POS, left: INVISIBLE_POS } : {}, | ||
}); | ||
}); | ||
if (hideBeforeLoading && added.length) { | ||
this.itemRenderer.renderItems(added.map((index) => nextItems[index])); | ||
this._refreshContainerContentSize(); | ||
} | ||
this.setItems(nextItems); | ||
@@ -189,3 +195,11 @@ | ||
public updateItems(items: GridItem[] = this.items, options: RenderOptions = {}) { | ||
const useOrgResize = options.useOrgResize; | ||
items.forEach((item) => { | ||
if (useOrgResize) { | ||
const orgRect = item.orgRect; | ||
orgRect.width = 0; | ||
orgRect.height = 0; | ||
} | ||
item.updateState = UPDATE_STATE.NEED_UPDATE; | ||
@@ -348,2 +362,7 @@ }); | ||
}).on("preReady", () => { | ||
updated.forEach((item) => { | ||
if (!item.orgRect.width && item.rect.width) { | ||
item.element!.style.cssText = item.orgCSSText; | ||
} | ||
}); | ||
this.itemRenderer.updateItems(updated); | ||
@@ -517,2 +536,3 @@ this.readyItems(mounted, updated, options); | ||
* @type {$ts:Grid.GridOptions["gap"]} | ||
* @default 0 | ||
* @example | ||
@@ -535,2 +555,3 @@ * ```js | ||
* @type {$ts:Grid.GridOptions["defaultDirection"]} | ||
* @default "end" | ||
* @example | ||
@@ -554,2 +575,3 @@ * ```js | ||
* @type {$ts:Grid.GridOptions["useFit"]} | ||
* @default true | ||
* @example | ||
@@ -572,2 +594,3 @@ * ```js | ||
* @type {$ts:Grid.GridOptions["preserveUIOnDestroy"]} | ||
* @default false | ||
* @example | ||
@@ -587,6 +610,7 @@ * ```js | ||
/** | ||
* The number of outlines. If the number of outlines is 0, it is calculated according to the type of grid. (default: 0) | ||
* @ko outline의 개수. 아웃라인의 개수가 0이라면 grid의 종류에 따라 계산이 된다. (default: 0) | ||
* The number of outlines. If the number of outlines is 0, it is calculated according to the type of grid. | ||
* @ko outline의 개수. 아웃라인의 개수가 0이라면 grid의 종류에 따라 계산이 된다. | ||
* @name Grid#outlineLength | ||
* @type {$ts:Grid.GridOptions["outlineLength"]} | ||
* @default 0 | ||
* @example | ||
@@ -607,6 +631,7 @@ * ```js | ||
/** | ||
* The size of the outline. If the outline size is 0, it is calculated according to the grid type. (default: 0) | ||
* @ko outline의 사이즈. 만약 outline의 사이즈가 0이면, grid의 종류에 따라 계산이 된다. (default: 0) | ||
* The size of the outline. If the outline size is 0, it is calculated according to the grid type. | ||
* @ko outline의 사이즈. 만약 outline의 사이즈가 0이면, grid의 종류에 따라 계산이 된다. | ||
* @name Grid#outlineSize | ||
* @type {$ts:Grid.GridOptions["outlineSize"]} | ||
* @default 0 | ||
* @example | ||
@@ -613,0 +638,0 @@ * ```js |
@@ -84,5 +84,6 @@ /** | ||
public get orgInlineSize() { | ||
const orgRect = (this.orgRect || this.rect); | ||
const orgRect = this.orgRect; | ||
const rect = this.rect; | ||
return this.horizontal ? orgRect.height : orgRect.width; | ||
return this.horizontal ? orgRect.height || rect.height : orgRect.width || rect.width; | ||
} | ||
@@ -95,5 +96,6 @@ /** | ||
public get orgContentSize() { | ||
const orgRect = (this.orgRect || this.rect); | ||
const orgRect = this.orgRect; | ||
const rect = this.rect; | ||
return this.horizontal ? orgRect.width : orgRect.height; | ||
return this.horizontal ? orgRect.width || rect.width : orgRect.height || rect.height; | ||
} | ||
@@ -227,16 +229,24 @@ /** | ||
}; | ||
if (typeof this.key !== "undefined") { | ||
status.key = this.key; | ||
const { | ||
key, | ||
mountState, | ||
updateState, | ||
isFirstUpdate, | ||
orgCSSText, | ||
} = this; | ||
if (typeof key !== "undefined") { | ||
status.key = key; | ||
} | ||
if (this.mountState !== MOUNT_STATE.UNCHECKED) { | ||
status.mountState = this.mountState; | ||
if (mountState !== MOUNT_STATE.UNCHECKED) { | ||
status.mountState = mountState; | ||
} | ||
if (this.updateState !== UPDATE_STATE.NEED_UPDATE) { | ||
status.updateState = this.updateState; | ||
if (updateState !== UPDATE_STATE.NEED_UPDATE) { | ||
status.updateState = updateState; | ||
} | ||
if (this.isFirstUpdate) { | ||
if (isFirstUpdate) { | ||
status.isFirstUpdate = true; | ||
} | ||
if (this.orgCSSText) { | ||
status.orgCSSText = this.orgCSSText; | ||
if (orgCSSText) { | ||
status.orgCSSText = orgCSSText; | ||
} | ||
@@ -243,0 +253,0 @@ return status; |
@@ -332,6 +332,7 @@ /** | ||
/** | ||
* The shape of the grid. You can set the shape and order of items with a 2d array ([contentPos][inlinePos]). You can place items as many times as you fill the array with numbers, and zeros and spaces are empty spaces. The order of the items is arranged in ascending order of the numeric values that fill the array. (default: []) | ||
* @ko Grid의 모양. 2d 배열([contentPos][inlinePos])로 아이템의 모양과 순서를 설정할 수 있다. 숫자로 배열을 채운만큼 아이템을 배치할 수 있으며 0과 공백은 빈 공간이다. 아이템들의 순서는 배열을 채운 숫자값의 오름차순대로 배치가 된다. (default: []) | ||
* The shape of the grid. You can set the shape and order of items with a 2d array ([contentPos][inlinePos]). You can place items as many times as you fill the array with numbers, and zeros and spaces are empty spaces. The order of the items is arranged in ascending order of the numeric values that fill the array. | ||
* @ko Grid의 모양. 2d 배열([contentPos][inlinePos])로 아이템의 모양과 순서를 설정할 수 있다. 숫자로 배열을 채운만큼 아이템을 배치할 수 있으며 0과 공백은 빈 공간이다. 아이템들의 순서는 배열을 채운 숫자값의 오름차순대로 배치가 된다. | ||
* @name Grid.FrameGrid#frame | ||
* @type {$ts:Grid.FrameGrid.FrameGridOptions["frame"]} | ||
* @default [] | ||
* @example | ||
@@ -363,6 +364,7 @@ * ```js | ||
/** | ||
* Make sure that the frame can be attached after the previous frame. (default: true) | ||
* @ko 다음 프레임이 전 프레임에 이어 붙일 수 있는지 있는지 확인한다. (default: true) | ||
* Make sure that the frame can be attached after the previous frame. | ||
* @ko 다음 프레임이 전 프레임에 이어 붙일 수 있는지 있는지 확인한다. | ||
* @name Grid.FrameGrid#useFrameFill | ||
* @type {$ts:Grid.FrameGrid.FrameGridOptions["useFrameFill"]} | ||
* @default true | ||
* @example | ||
@@ -369,0 +371,0 @@ * ```js |
@@ -7,3 +7,3 @@ /** | ||
import Grid from "../Grid"; | ||
import { MOUNT_STATE, PROPERTY_TYPE } from "../consts"; | ||
import { MINIMUM_NUMBER, MOUNT_STATE, PROPERTY_TYPE } from "../consts"; | ||
import { GridOptions, Properties, GridOutlines } from "../types"; | ||
@@ -44,4 +44,5 @@ import { getRangeCost, GetterSetter, isObject } from "../utils"; | ||
const contentOffset = parseFloat(item.gridData.contentOffset) || 0; | ||
const ratio = (inlineSize - inlineOffset) / Math.max(MINIMUM_NUMBER, contentSize - contentOffset); | ||
return (inlineSize - inlineOffset) / (contentSize - contentOffset) * (rowSize - contentOffset) + inlineOffset; | ||
return ratio * (rowSize - contentOffset) + inlineOffset; | ||
} | ||
@@ -266,3 +267,3 @@ | ||
const contentOffset = parseFloat(item.gridData.contentOffset) || 0; | ||
const maintainedRatio = (inlineSize - inlineOffset) / (contentSize - contentOffset); | ||
const maintainedRatio = (inlineSize - inlineOffset) / Math.max(MINIMUM_NUMBER, contentSize - contentOffset); | ||
@@ -448,6 +449,7 @@ ratioSum += maintainedRatio; | ||
/** | ||
* The minimum and maximum number of items per line. (default: [1, 8]) | ||
* @ko 한 줄에 들어가는 아이템의 최소, 최대 개수. (default: [1, 8]) | ||
* The minimum and maximum number of items per line. | ||
* @ko 한 줄에 들어가는 아이템의 최소, 최대 개수. | ||
* @name Grid.JustifiedGrid#columnRange | ||
* @type {$ts:Grid.JustifiedGrid.JustifiedGridOptions["columnRange"]} | ||
* @default [1, 8] | ||
* @example | ||
@@ -467,6 +469,7 @@ * ```js | ||
/** | ||
* The minimum and maximum number of rows in a group, 0 is not set. (default: 0) | ||
* @ko 한 그룹에 들어가는 행의 최소, 최대 개수, 0은 미설정이다. (default: 0) | ||
* The minimum and maximum number of rows in a group, 0 is not set. | ||
* @ko 한 그룹에 들어가는 행의 최소, 최대 개수, 0은 미설정이다. | ||
* @name Grid.JustifiedGrid#rowRange | ||
* @type {$ts:Grid.JustifiedGrid.JustifiedGridOptions["rowRange"]} | ||
* @default 0 | ||
* @example | ||
@@ -485,6 +488,7 @@ * ```js | ||
/** | ||
* The minimum and maximum size by which the item is adjusted. If it is not calculated, it may deviate from the minimum and maximum sizes. (default: [0, Infinity]) | ||
* @ko 아이템이 조정되는 최소, 최대 사이즈. 계산이 되지 않는 경우 최소, 최대 사이즈를 벗어날 수 있다. (default: [0, Infinity]) | ||
* The minimum and maximum size by which the item is adjusted. If it is not calculated, it may deviate from the minimum and maximum sizes. | ||
* @ko 아이템이 조정되는 최소, 최대 사이즈. 계산이 되지 않는 경우 최소, 최대 사이즈를 벗어날 수 있다. | ||
* @name Grid.JustifiedGrid#sizeRange | ||
* @type {$ts:Grid.JustifiedGrid.JustifiedGridOptions["sizeRange"]} | ||
* @default [0, Infinity] | ||
* @example | ||
@@ -503,6 +507,7 @@ * ```js | ||
/** | ||
* Maximum number of rows to be counted for container size. You can hide it on the screen by setting overflow: hidden. -1 is not set. (default: -1) | ||
* @ko - 컨테이너 크기에 계산될 최대 row 개수. overflow: hidden을 설정하면 화면에 가릴 수 있다. -1은 미설정이다. (default: -1) | ||
* Maximum number of rows to be counted for container size. You can hide it on the screen by setting overflow: hidden. -1 is not set. | ||
* @ko - 컨테이너 크기에 계산될 최대 row 개수. overflow: hidden을 설정하면 화면에 가릴 수 있다. -1은 미설정이다. | ||
* @name Grid.JustifiedGrid#displayedRow | ||
* @type {$ts:Grid.JustifiedGrid.JustifiedGridOptions["displayedRow"]} | ||
* @default -1 | ||
* @example | ||
@@ -521,6 +526,7 @@ * ```js | ||
/** | ||
* Whether to crop when the row size is out of sizeRange. If set to true, this ratio can be broken. (default: false) | ||
* @ko - row 사이즈가 sizeRange에 벗어나면 크롭할지 여부. true로 설정하면 비율이 깨질 수 있다. (default: false) | ||
* Whether to crop when the row size is out of sizeRange. If set to true, this ratio can be broken. | ||
* @ko - row 사이즈가 sizeRange에 벗어나면 크롭할지 여부. true로 설정하면 비율이 깨질 수 있다. | ||
* @name Grid.JustifiedGrid#isCroppedSize | ||
* @type {$ts:Grid.JustifiedGrid.JustifiedGridOptions["isCroppedSize"]} | ||
* @default false | ||
* @example | ||
@@ -527,0 +533,0 @@ * ```js |
@@ -252,6 +252,7 @@ /** | ||
/** | ||
* Align of the position of the items. If you want to use `stretch`, be sure to set `column` or `columnSize` option. ("start", "center", "end", "justify", "stretch") (default: "justify") | ||
* @ko 아이템들의 위치의 정렬. `stretch`를 사용하고 싶다면 `column` 또는 `columnSize` 옵션을 설정해라. ("start", "center", "end", "justify", "stretch") (default: "justify") | ||
* Align of the position of the items. If you want to use `stretch`, be sure to set `column` or `columnSize` option. ("start", "center", "end", "justify", "stretch") | ||
* @ko 아이템들의 위치의 정렬. `stretch`를 사용하고 싶다면 `column` 또는 `columnSize` 옵션을 설정해라. ("start", "center", "end", "justify", "stretch") | ||
* @name Grid.MasonryGrid#align | ||
* @type {$ts:Grid.MasonryGrid.MasonryGridOptions["align"]} | ||
* @default "justify" | ||
* @example | ||
@@ -272,5 +273,6 @@ * ```js | ||
* The number of columns. If the number of columns is 0, it is automatically calculated according to the size of the container. Can be used instead of outlineLength. | ||
* @ko 열의 개수. 열의 개수가 0이라면, 컨테이너의 사이즈에 의해 계산이 된다. outlineLength 대신 사용할 수 있다. (default: 0) | ||
* @ko 열의 개수. 열의 개수가 0이라면, 컨테이너의 사이즈에 의해 계산이 된다. outlineLength 대신 사용할 수 있다. | ||
* @name Grid.MasonryGrid#column | ||
* @type {$ts:Grid.MasonryGrid.MasonryGridOptions["column"]} | ||
* @default 0 | ||
* @example | ||
@@ -290,6 +292,7 @@ * ```js | ||
/** | ||
* The size of the columns. If it is 0, it is calculated as the size of the first item in items. Can be used instead of outlineSize. (default: 0) | ||
* @ko 열의 사이즈. 만약 열의 사이즈가 0이면, 아이템들의 첫번째 아이템의 사이즈로 계산이 된다. outlineSize 대신 사용할 수 있다. (default: 0) | ||
* The size of the columns. If it is 0, it is calculated as the size of the first item in items. Can be used instead of outlineSize. | ||
* @ko 열의 사이즈. 만약 열의 사이즈가 0이면, 아이템들의 첫번째 아이템의 사이즈로 계산이 된다. outlineSize 대신 사용할 수 있다. | ||
* @name Grid.MasonryGrid#columnSize | ||
* @type {$ts:Grid.MasonryGrid.MasonryGridOptions["columnSize"]} | ||
* @default 0 | ||
* @example | ||
@@ -309,6 +312,7 @@ * ```js | ||
/** | ||
* The size ratio(inlineSize / contentSize) of the columns. 0 is not set. (default: 0) | ||
* The size ratio(inlineSize / contentSize) of the columns. 0 is not set. | ||
* @ko 열의 사이즈 비율(inlineSize / contentSize). 0은 미설정이다. | ||
* @name Grid.MasonryGrid#columnSizeRatio | ||
* @type {$ts:Grid.MasonryGrid.MasonryGridOptions["columnSizeRatio"]} | ||
* @default 0 | ||
* @example | ||
@@ -315,0 +319,0 @@ * ```js |
@@ -233,6 +233,7 @@ /** | ||
/** | ||
* The aspect ratio (inlineSize / contentSize) of the container with items. (default: 1) | ||
* @ko 아이템들을 가진 컨테이너의 종횡비(inlineSize / contentSize). (default: 1) | ||
* The aspect ratio (inlineSize / contentSize) of the container with items. | ||
* @ko 아이템들을 가진 컨테이너의 종횡비(inlineSize / contentSize). | ||
* @name Grid.PackingGrid#aspectRatio | ||
* @type {$ts:Grid.PackingGrid.PackingGridOptions["aspectRatio"]} | ||
* @default 1 | ||
* @example | ||
@@ -251,7 +252,8 @@ * ```js | ||
/** | ||
* The priority that determines the weight of the item. (default: "custom"), "size" = (sizeWieght: 2, ratioWeight: 1), "ratio" = (sizeWeight: 1, ratioWeight; 2), "custom" = (set sizeWeight, ratioWeight) | ||
* The priority that determines the weight of the item. "size" = (sizeWieght: 2, ratioWeight: 1), "ratio" = (sizeWeight: 1, ratioWeight; 2), "custom" = (set sizeWeight, ratioWeight) | ||
* item's weight = item's ratio(inlineSize / contentSize) change * `ratioWeight` + size(inlineSize * contentSize) change * `sizeWeight`. | ||
* @ko 아이템의 가중치를 결정하는 우선수치. (default: "custom"), "size" = (sizeWieght: 2, ratioWeight: 1), "ratio" = (sizeWeight: 1, ratioWeight; 2), "custom" = (set sizeWeight, ratioWeight). 아이템의 가중치 = ratio(inlineSize / contentSize)의 변화량 * `ratioWeight` + size(inlineSize * contentSize)의 변화량 * `sizeWeight`. | ||
* @ko 아이템의 가중치를 결정하는 우선수치. "size" = (sizeWieght: 2, ratioWeight: 1), "ratio" = (sizeWeight: 1, ratioWeight; 2), "custom" = (set sizeWeight, ratioWeight). 아이템의 가중치 = ratio(inlineSize / contentSize)의 변화량 * `ratioWeight` + size(inlineSize * contentSize)의 변화량 * `sizeWeight`. | ||
* @name Grid.PackingGrid#weightPriority | ||
* @type {$ts:Grid.PackingGrid.PackingGridOptions["weightPriority"]} | ||
* @default "custom" | ||
* @example | ||
@@ -274,6 +276,7 @@ * ```js | ||
/** | ||
* The size weight when placing items. (default: 1) | ||
* @ko 아이템들을 배치하는데 사이즈 가중치. (default: 1) | ||
* The size weight when placing items. | ||
* @ko 아이템들을 배치하는데 사이즈 가중치. | ||
* @name Grid.PackingGrid#sizeWeight | ||
* @type {$ts:Grid.PackingGrid.PackingGridOptions["sizeWeight"]} | ||
* @default 1 | ||
* @example | ||
@@ -293,6 +296,7 @@ * ```js | ||
/** | ||
* The weight to keep ratio when placing items. (default: 1) | ||
* @ko 아이템들을 배치하는데 비율을 유지하는 가중치. (default: 1) | ||
* The weight to keep ratio when placing items. | ||
* @ko 아이템들을 배치하는데 비율을 유지하는 가중치. | ||
* @name Grid.PackingGrid#ratioWeight | ||
* @type {$ts:Grid.PackingGrid.PackingGridOptions["ratioWeight"]} | ||
* @default 1 | ||
* @example | ||
@@ -299,0 +303,0 @@ * ```js |
@@ -48,2 +48,3 @@ /** | ||
useTransform?: boolean; | ||
hideBeforeLoading?: boolean; | ||
renderOnPropertyChange?: boolean; | ||
@@ -71,2 +72,3 @@ preserveUIOnDestroy?: boolean; | ||
* @property - Whether to resize containers and items.<ko>컨테이너와 아이템들을 리사이즈할지 여부.</ko> | ||
* @property - Whether to resize items to their original size. <ko>아이템들의 원본 사이즈까지 리사이즈할지 여부.</ko> | ||
*/ | ||
@@ -77,2 +79,3 @@ export interface RenderOptions { | ||
useResize?: boolean; | ||
useOrgResize?: boolean; | ||
} | ||
@@ -79,0 +82,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1313219
14462