@egjs/infinitegrid
Version:
A module used to arrange elements including content infinitely according to grid type. With this module, you can implement various grids composed of different card elements whose sizes vary. It guarantees performance by maintaining the number of DOMs the
11 lines • 104 kB
JavaScript
/*
Copyright (c) NAVER Corp.
name: @egjs/infinitegrid
license: MIT
author: NAVER Corp.
repository: https://github.com/naver/egjs-infinitegrid
version: 4.13.1
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).InfiniteGrid=t()}(this,function(){var D=function(e,t){return(D=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}D(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var I=function(){return(I=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function L(e,t){var n={};for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function n(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;0<=a;a--)(r=e[a])&&(s=(o<3?r(s):3<o?r(t,n,s):r(t,n))||s);return 3<o&&s&&Object.defineProperty(t,n,s),s}function f(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||((i=i||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function N(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}(arguments[t]));return e}function a(e){return void 0===e}var G=function(){function e(e,t){var n,i;if(this._canceled=!1,t)try{for(var r=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&i>=e.length?void 0:e)&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(t)),o=r.next();!o.done;o=r.next()){var s=o.value;this[s]=t[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.eventType=e}var t=e.prototype;return t.stop=function(){this._canceled=!0},t.isCanceled=function(){return this._canceled},e}(),i=function(){function e(){this._eventHandler={}}var t=e.prototype;return t.trigger=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var i=t instanceof G?t.eventType:t,i=N(this._eventHandler[i]||[]);return i.length<=0||(t instanceof G?(t.currentTarget=this,i.forEach(function(e){e(t)})):i.forEach(function(e){e.apply(void 0,N(n))})),this},t.once=function(n,i){var r,o=this;if("object"==typeof n&&a(i)){var e,t=n;for(e in t)this.once(e,t[e])}else"string"==typeof n&&"function"==typeof i&&(r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i.apply(void 0,N(e)),o.off(n,r)},this.on(n,r));return this},t.hasOn=function(e){return!!this._eventHandler[e]},t.on=function(e,t){if("object"==typeof e&&a(t)){var n,i=e;for(n in i)this.on(n,i[n])}else{var r;"string"==typeof e&&"function"==typeof t&&(r=this._eventHandler[e],a(r)&&(this._eventHandler[e]=[],r=this._eventHandler[e]),r.push(t))}return this},t.off=function(e,t){if(a(e))this._eventHandler={};else if(a(t))if("string"==typeof e)delete this._eventHandler[e];else{var n,i=e;for(n in i)this.off(n,i[n])}else{var r=this._eventHandler[e];if(r)for(var o=r.length,s=0;s<o;++s)if(r[s]===t){r.splice(s,1),o<=1&&delete this._eventHandler[e];break}}return this},e.VERSION="3.0.5",e}(),C=G,k=function(){function e(){this.keys=[],this.values=[]}var t=e.prototype;return t.get=function(e){return this.values[this.keys.indexOf(e)]},t.set=function(e,t){var n=this.keys,i=this.values,r=n.indexOf(e),r=-1===r?n.length:r;n[r]=e,i[r]=t},e}(),A=function(){function e(){this.object={}}var t=e.prototype;return t.get=function(e){return this.object[e]},t.set=function(e,t){this.object[e]=t},e}(),V="function"==typeof Map,K=function(){function e(){}var t=e.prototype;return t.connect=function(e,t){this.prev=e,this.next=t,e&&(e.next=this),t&&(t.prev=this)},t.disconnect=function(){var e=this.prev,t=this.next;e&&(e.next=t),t&&(t.prev=e)},t.getIndex=function(){for(var e=this,t=-1;e;)e=e.prev,++t;return t},e}();var Y=function(){function e(e,t,n,i,r,o,s,a){this.prevList=e,this.list=t,this.added=n,this.removed=i,this.changed=r,this.maintained=o,this.changedBeforeAdded=s,this.fixed=a}var t=e.prototype;return Object.defineProperty(t,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(t,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),t.caculateOrdered=function(){e=this.changedBeforeAdded,n=this.fixed,r=[],o=[],e.forEach(function(e){var t=e[0],e=e[1],n=new K;o[e]=r[t]=n}),r.forEach(function(e,t){e.connect(r[t-1])});var n,r,o,e=e.filter(function(e,t){return!n[t]}).map(function(e,t){var n,i=e[0],e=e[1];return i===e?[0,0]:(e=o[e-1],n=(i=r[i]).getIndex(),i.disconnect(),e?i.connect(e,e.next):i.connect(void 0,r[0]),[n,i.getIndex()])}),s=this.changed,a=[];this.cacheOrdered=e.filter(function(e,t){var n=e[0],e=e[1],t=s[t],i=t[0],t=t[1];if(n!==e)return a.push([i,t]),!0}),this.cachePureChanged=a},e}();function q(e,t,n){var i=V?Map:n?A:k,n=n||function(e){return e},r=[],o=[],s=[],a=e.map(n),n=t.map(n),u=new i,c=new i,h=[],l=[],f={},d=[],p=0,g=0;return a.forEach(function(e,t){u.set(e,t)}),n.forEach(function(e,t){c.set(e,t)}),a.forEach(function(e,t){e=c.get(e);void 0===e?(++g,o.push(t)):f[e]=g}),n.forEach(function(e,t){e=u.get(e);void 0===e?(r.push(t),++p):(s.push([e,t]),g=f[t]||0,h.push([e-g,t-p]),l.push(t===e),e!==t&&d.push([e,t]))}),o.reverse(),new Y(e,t,r,o,d,s,h,l)}var B,W="function"==typeof Map?void 0:(B=0,function(e){return e.__DIFF_KEY__||(e.__DIFF_KEY__=++B)});function H(e,t){return q(e,t,W)}var Z=function(e,t){return(Z=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))(e,t)};function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Z(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var X=function(){return(X=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};var e="undefined"!=typeof window,t=e?window.navigator.userAgent:"",Q=e&&!!("getComputedStyle"in window),J=/MSIE|Trident|Windows Phone|Edge/.test(t),$=e&&!!("addEventListener"in document),ee="width",te="height";function ne(e,t){return e.getAttribute(t)||""}function ie(e){return[].slice.call(e)}function re(e,t){return void 0===t&&(t="data-"),"loading"in e&&"lazy"===e.getAttribute("loading")||!!e.getAttribute(t+"lazy")}function oe(e,t,n){$?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function se(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function ae(e,t){var n=e["client"+t]||e["offset"+t];return parseFloat(n||(n=e,((Q?window.getComputedStyle(n):n.currentStyle)||{})[t.toLowerCase()]))||0}function ue(e,t,n){var i=ie(e.querySelectorAll(function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var i=Array(e),r=0,t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}(["["+n+"skip] ["+n+"width]"],t.map(function(e){return["["+n+"skip] "+e,e+"["+n+"skip]","["+n+"width] "+e].join(", ")})).join(", ")));return ie(e.querySelectorAll("["+n+"width], "+t.join(", "))).filter(function(e){return-1===i.indexOf(e)})}var u=[];function ce(e,t){u.length||oe(window,"resize",le),e.__PREFIX__=t,u.push(e),he(e)}function he(e,t){void 0===t&&(t="data-");var n,t=e.__PREFIX__||t,i=parseInt(ne(e,""+t+ee),10)||0,r=parseInt(ne(e,""+t+te),10)||0;ne(e,t+"fixed")===te?(n=ae(e,"Height")||r,e.style[ee]=i/r*n+"px"):(n=ae(e,"Width")||i,e.style[te]=r/i*n+"px")}function le(){u.forEach(function(e){he(e)})}var t=function(r){function e(e,t){void 0===t&&(t={});var n,i=r.call(this)||this,t=(i.isReady=!1,i.isPreReady=!1,i.hasDataSize=!1,i.hasLoading=!1,i.isSkip=!1,i.onCheck=function(e){i.clear(),e&&"error"===e.type&&i.onError(i.element),i.hasLoading&&i.checkElement()||i.onReady()},i.options=X({prefix:"data-"},t),i.element=e,i.options.prefix);return i.hasDataSize=(n=t,!!e.getAttribute((n=void 0===t?"data-":n)+"width")),i.isSkip=(n=t,!!e.getAttribute((n=void 0===t?"data-":n)+"skip")),i.hasLoading=re(e,t),i}s(e,r);var t=e.prototype;return t.check=function(){return this.isSkip||!this.checkElement()?(this.onAlreadyReady(),!1):(this.hasDataSize&&ce(this.element,this.options.prefix),(this.hasDataSize||this.hasLoading)&&this.onAlreadyPreReady(),!0)},t.addEvents=function(){var t=this,n=this.element;this.constructor.EVENTS.forEach(function(e){oe(n,e,t.onCheck)})},t.clear=function(){var t=this,n=this.element;this.constructor.EVENTS.forEach(function(e){se(n,e,t.onCheck)}),this.removeAutoSizer()},t.destroy=function(){this.clear(),this.off()},t.removeAutoSizer=function(){var e,t,n;this.hasDataSize&&(t=this.options.prefix,e=this.element,t=t,(n=u.indexOf(e))<0||(t=ne(e,t+"fixed"),delete e.__PREFIX__,e.style[t===te?ee:te]="",u.splice(n,1),u.length)||se(window,"resize",le))},t.onError=function(e){this.trigger("error",{element:this.element,target:e})},t.onPreReady=function(){this.isPreReady||(this.isPreReady=!0,this.trigger("preReady",{element:this.element,hasLoading:this.hasLoading,isSkip:this.isSkip}))},t.onReady=function(){var e=this.isPreReady;this.isPreReady=!0,this.isReady||(this.removeAutoSizer(),this.isReady=!0,this.trigger("ready",{element:this.element,withPreReady:!e,hasLoading:this.hasLoading,isSkip:this.isSkip}))},t.onAlreadyError=function(e){var t=this;setTimeout(function(){t.onError(e)})},t.onAlreadyPreReady=function(){var e=this;setTimeout(function(){e.onPreReady()})},t.onAlreadyReady=function(){var e=this;setTimeout(function(){e.onReady()})},e.EVENTS=[],e}(i),fe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.setHasLoading=function(e){this.hasLoading=e},n.check=function(){return this.isSkip?(this.onAlreadyReady(),!1):(this.hasDataSize?(ce(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(){e.prototype.onAlreadyPreReady.call(this),this.trigger("reqeustReadyChildren")},t.EVENTS=[],t}(t),e=function(n){function e(e){void 0===e&&(e={});var t=n.call(this)||this;return t.readyCount=0,t.preReadyCount=0,t.totalCount=0,t.totalErrorCount=0,t.isPreReadyOver=!0,t.elementInfos=[],t.options=X({loaders:{},prefix:"data-"},e),t}s(e,n);var t=e.prototype;return t.check=function(e){var o=this,n=this.options.prefix,e=(this.clear(),this.elementInfos=ie(e).map(function(e,r){var t=o.getLoader(e,{prefix:n});return t.check(),t.on("error",function(e){o.onError(r,e.target)}).on("preReady",function(e){var t=o.elementInfos[r],t=(t.hasLoading=e.hasLoading,t.isSkip=e.isSkip,o.checkPreReady(r));o.onPreReadyElement(r),t&&o.onPreReady()}).on("ready",function(e){var t=e.withPreReady,n=e.hasLoading,e=e.isSkip,i=o.elementInfos[r],n=(i.hasLoading=n,i.isSkip=e,t&&o.checkPreReady(r)),i=o.checkReady(r);t&&o.onPreReadyElement(r),o.onReadyElement(r),n&&o.onPreReady(),i&&o.onReady()}),{loader:t,element:e,hasLoading:!1,hasError:!1,isPreReady:!1,isReady:!1,isSkip:!1}}),this.elementInfos.length);return(this.totalCount=e)||setTimeout(function(){o.onPreReady(),o.onReady()}),this},t.getTotalCount=function(){return this.totalCount},t.isPreReady=function(){return this.elementInfos.every(function(e){return e.isPreReady})},t.isReady=function(){return this.elementInfos.every(function(e){return e.isReady})},t.hasError=function(){return 0<this.totalErrorCount},t.clear=function(){this.isPreReadyOver=!1,this.totalCount=0,this.preReadyCount=0,this.readyCount=0,this.totalErrorCount=0,this.elementInfos.forEach(function(e){e.loader&&e.loader.destroy()}),this.elementInfos=[]},t.destroy=function(){this.clear(),this.off()},t.getLoader=function(t,e){var n,i,r,o=this,s=t.tagName.toLowerCase(),a=this.options.loaders,u=e.prefix,c=Object.keys(a);return a[s]?new a[s](t,e):(n=new fe(t,e),i=ie(t.querySelectorAll(c.join(", "))),n.setHasLoading(i.some(function(e){return re(e,u)})),r=this.clone().on("error",function(e){n.onError(e.target)}).on("ready",function(){n.onReady()}),n.on("requestChildren",function(){var e=ue(t,c,o.options.prefix);r.check(e).on("preReady",function(e){e.isReady||n.onPreReady()})}).on("reqeustReadyChildren",function(){r.check(i)}).on("requestDestroy",function(){r.destroy()}),n)},t.clone=function(){return new e(X({},this.options))},t.checkPreReady=function(e){return this.elementInfos[e].isPreReady=!0,++this.preReadyCount,!(this.preReadyCount<this.totalCount)},t.checkReady=function(e){return this.elementInfos[e].isReady=!0,++this.readyCount,!(this.readyCount<this.totalCount)},t.onError=function(e,t){var n=this.elementInfos[e];n.hasError=!0,this.trigger(new C("error",{element:n.element,index:e,target:t,errorCount:this.getErrorCount(),totalErrorCount:++this.totalErrorCount}))},t.onPreReadyElement=function(e){var t=this.elementInfos[e];this.trigger(new C("preReadyElement",{element:t.element,index:e,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:t.hasLoading,isSkip:t.isSkip}))},t.onPreReady=function(){this.isPreReadyOver=!0,this.trigger(new C("preReady",{readyCount:this.readyCount,totalCount:this.totalCount,isReady:this.isReady(),hasLoading:this.hasLoading()}))},t.onReadyElement=function(e){var t=this.elementInfos[e];this.trigger(new C("readyElement",{index:e,element:t.element,hasError:t.hasError,errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:t.hasLoading,isPreReadyOver:this.isPreReadyOver,isSkip:t.isSkip}))},t.onReady=function(){this.trigger(new C("ready",{errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,totalCount:this.totalCount}))},t.getErrorCount=function(){return this.elementInfos.filter(function(e){return e.hasError}).length},t.hasLoading=function(){return this.elementInfos.some(function(e){return e.hasLoading})},e}(i),de=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.checkElement=function(){var e=this.element,t=e.getAttribute("src");if(e.complete){if(t)return e.naturalWidth||this.onAlreadyError(e),!1;this.onAlreadyPreReady()}return this.addEvents(),J&&e.setAttribute("src",t),!0},t.EVENTS=["load","error"],t}(t),pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.checkElement=function(){var e=this.element;return!(1<=e.readyState||(e.error?(this.onAlreadyError(e),1):(this.addEvents(),0)))},t.EVENTS=["loadedmetadata","error"],t}(t),ge=function(t){function e(e){return t.call(this,X({loaders:{img:de,video:pe}},e=void 0===e?{}:e))||this}return s(e,t),e}(e),me=function(e,t){return(me=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}me(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return(p=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function ye(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;0<=a;a--)(r=e[a])&&(s=(o<3?r(s):3<o?r(t,n,s):r(t,n))||s);return 3<o&&s&&Object.defineProperty(t,n,s),s}function m(e,t){for(var n=0,i=t.length,r=e.length;n<i;n++,r++)e[r]=t[n];return e}var c,O,g,h={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,useRoundedSize:!0,useResizeObserver:!1,observeChildren:!1},Re=((t=c=c||{})[t.PROPERTY=1]="PROPERTY",t[t.RENDER_PROPERTY=2]="RENDER_PROPERTY",(e=O=O||{})[e.UNCHECKED=1]="UNCHECKED",e[e.UNMOUNTED=2]="UNMOUNTED",e[e.MOUNTED=3]="MOUNTED",(t=g=g||{})[t.NEED_UPDATE=1]="NEED_UPDATE",t[t.WAIT_LOADING=2]="WAIT_LOADING",t[t.UPDATED=3]="UPDATED",{gap:c.RENDER_PROPERTY,defaultDirection:c.PROPERTY,renderOnPropertyChange:c.PROPERTY,preserveUIOnDestroy:c.PROPERTY,useFit:c.PROPERTY,outlineSize:c.RENDER_PROPERTY,outlineLength:c.RENDER_PROPERTY}),l={horizontal:{inlinePos:"top",contentPos:"left",inlineSize:"height",contentSize:"width"},vertical:{inlinePos:"left",contentPos:"top",inlineSize:"width",contentSize:"height"}};function ve(e,n){var i=Se(e);return H(n.map(function(e){return e.target}),i.map(function(e){return e.element})).maintained.filter(function(e){var t=e[0],e=e[1],t=n[t].size,e=i[e];return!e.inlineSize||!e.contentSize||t.inlineSize!==e.computedInlineSize||t.blockSize!==e.computedContentSize}).map(function(e){e=e[1];return i[e]})}function Se(e){return e.filter(function(e){return e.element})}function ze(e){return Se(e).map(function(e){return e.element})}function U(e){return"string"==typeof e}function Ee(e){return"object"==typeof e}function _e(e){return"number"==typeof e}function d(e){return e.reduce(function(e,t){return e+t},0)}function y(e){var t,r=e.prototype,o=e.propertyTypes;for(t in o)!function(n){var i=o[n]===c.RENDER_PROPERTY,e=Object.getOwnPropertyDescriptor(r,n)||{},t=e.get||function(){return this.options[n]},e=e.set||function(e){var t=this.options;t[n]!==e&&(t[n]=e,i)&&t.renderOnPropertyChange&&this.scheduleRender()};Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:t,set:e})}(t)}function F(e){for(var t=[],n=0;n<e;++n)t.push(n);return t}function Ie(e,t){return Math.max(e-t[1],t[0]-e,0)+1}function j(e,t,n){return Math.min(n,Math.max(e,t))}function R(e,t){var n;return t?(n=1/t,Math.round(e/t)/n):e}var Ce=function(){function e(e,t){var u=this;void 0===t&&(t={}),this._resizeTimer=0,this._maxResizeDebounceTimer=0,this.rect={width:0,height:0},this._updatedEntries=[],this._onWindowResize=function(){u._scheduleResize([{target:u.container}])},this._onObserve=function(e){var t=u._options,i=u.container,r=t.rectBox,o=t.childrenRectBox;u._scheduleResize(e.map(function(e){var t,n="border-box"===(e.target===i?r:o)?e.borderBoxSize:e.contentBoxSize;return{size:(n=n?n:[{inlineSize:(t=e.contentRect).width,blockSize:t.height}])[0]||n,target:e.target}}))},this._scheduleResize=function(e){var t=u._options,n=t.resizeDebounce,t=t.maxResizeDebounce,i=u._updatedEntries;i.push.apply(i,e),u._updatedEntries=i.filter(function(e,t){return i.lastIndexOf(e)===t}),!u._maxResizeDebounceTimer&&n<=t&&(u._maxResizeDebounceTimer=window.setTimeout(u._onResize,t)),u._resizeTimer&&(clearTimeout(u._resizeTimer),u._resizeTimer=0),u._resizeTimer=window.setTimeout(u._onResize,n)},this._onResize=function(){clearTimeout(u._resizeTimer),clearTimeout(u._maxResizeDebounceTimer),u._maxResizeDebounceTimer=0,u._resizeTimer=0;var t,e,n,i,r=u._updatedEntries,o=u.container,r=r.filter(function(e){return e.target!==o||(t=e,!1)}),s=0<r.length,a=!!t;a&&(e=u._options.watchDirection,n=u.rect,(i=t.size)?u.setRect({width:i.inlineSize,height:i.blockSize}):u.resize(),i=u.rect,a=!e||("box"===e||"width"===e)&&n.width!==i.width||("box"===e||"height"===e)&&n.height!==i.height),u._updatedEntries=[],(a||s)&&u._emitter.trigger("resize",{isResizeContainer:a,childEntries:r})},this._options=p({resizeDebounce:100,maxResizeDebounce:0,useResizeObserver:!1,useWindowResize:!0,watchDirection:!1,rectBox:"content-box",childrenRectBox:"border-box"},t),this.container=U(e)?document.querySelector(e):e,this._init()}var t=e.prototype;return t.getRect=function(){return this.rect},t.setRect=function(e){this.rect=p({},e)},t.isObserverEnabled=function(){return!!this._observer},t.resize=function(){var e=this.container;this.setRect("border-box"===this._options.rectBox?{width:e.offsetWidth,height:e.offsetHeight}:{width:e.clientWidth,height:e.clientHeight})},t.observeChildren=function(e){var t,n=this._observer;n&&(t=this._options.childrenRectBox,e.forEach(function(e){e&&n.observe(e,{box:t})}))},t.unobserveChildren=function(e){var t=this._observer;t&&e.forEach(function(e){e&&t.unobserve(e)})},t.listen=function(e){return this._emitter.on("resize",e),this},t.destroy=function(){var e;null!=(e=this._observer)&&e.disconnect(),this._options.useWindowResize&&window.removeEventListener("resize",this._onWindowResize)},t._init=function(){var e=this.container,t=this._options;this._emitter=new i,t.useResizeObserver&&window.ResizeObserver&&(this._observer=new window.ResizeObserver(this._onObserve),this._observer.observe(e,{box:t.rectBox})),t.useWindowResize&&window.addEventListener("resize",this._onWindowResize),this.resize()},e}(),Oe=function(i){function e(e,t){var n=i.call(this)||this;return n.container=e,n._onResize=function(e){n.trigger("resize",e)},n.options=p({horizontal:h.horizontal,autoResize:h.autoResize,resizeDebounce:h.resizeDebounce,maxResizeDebounce:h.maxResizeDebounce,useResizeObserver:h.useResizeObserver},t),n._init(),n}r(e,i);var t=e.prototype;return t.resize=function(){var e=this.container;this.setRect({width:e.clientWidth,height:e.clientHeight})},t.isObserverEnabled=function(){return this._watcher.isObserverEnabled()},t.getRect=function(){return this._watcher.getRect()},t.observeChildren=function(e){this._watcher.observeChildren(e)},t.unobserveChildren=function(e){this._watcher.unobserveChildren(e)},t.setRect=function(e){this._watcher.setRect(e)},t.getInlineSize=function(){return this.getRect()[this._names.inlineSize]},t.getContentSize=function(){return this.getRect()[this._names.contentSize]},t.getStatus=function(){return{rect:this._watcher.getRect()}},t.setStatus=function(e){this.setRect(e.rect),this.setContentSize(this.getContentSize())},t.setContentSize=function(e){var t,n=this.options.horizontal?"width":"height";this.setRect(p(p({},this.getRect()),((t={})[n]=e,t))),this.container.style[n]=e+"px"},t.destroy=function(e){void 0===e&&(e={}),this._watcher.destroy(),e.preserveUI||(this.container.style.cssText=this.orgCSSText)},t._init=function(){var e=this.container,t=window.getComputedStyle(e),t=(this.orgCSSText=e.style.cssText,"static"===t.position&&(e.style.position="relative"),this.options);this._watcher=new Ce(e,{useWindowResize:t.autoResize,useResizeObserver:t.useResizeObserver,resizeDebounce:t.resizeDebounce,maxResizeDebounce:t.maxResizeDebounce,watchDirection:!!t.useResizeObserver&&this._names.inlineSize}).listen(this._onResize)},Object.defineProperty(t,"_names",{get:function(){return l[this.options.horizontal?"horizontal":"vertical"]},enumerable:!1,configurable:!0}),e}(i),Pe=function(){function e(e){this.initialRects={},this.sizePercetage=!1,this.posPercetage=!1,this.options=p({attributePrefix:h.attributePrefix,useTransform:h.useTransform,horizontal:h.horizontal,percentage:h.percentage,isEqualSize:h.isEqualSize,isConstantSize:h.isConstantSize,useRoundedSize:h.useRoundedSize},e),this._init()}var t=e.prototype;return t.resize=function(){this.initialRects={}},t.renderItems=function(e){var t=this;e.forEach(function(e){t._renderItem(e)})},t.getInlineSize=function(){return this.containerRect[this.options.horizontal?"height":"width"]},t.setContainerRect=function(e){this.containerRect=e},t.updateEqualSizeItems=function(t,e){var n=this,i=(this.updateItems(t),t.some(function(e){return e.attributes.sizeGroup}));(this.options.isEqualSize||i)&&t.some(function(e){return e.updateState===g.UPDATED})&&e.forEach(function(e){-1===t.indexOf(e)&&n.updateItem(e,!0)})},t.updateItems=function(e){var t=this;e.forEach(function(e){t.updateItem(e)})},t.getStatus=function(){return{initialRects:this.initialRects}},t.setStatus=function(e){this.initialRects=e.initialRects},t._init=function(){var e=this.options.percentage,t=!1,n=!1;!0===e?n=t=!0:e&&(-1<e.indexOf("position")&&(n=!0),-1<e.indexOf("size"))&&(t=!0),this.posPercetage=n,this.sizePercetage=t},t.updateItem=function(e,t){var n=this.options,i=n.isEqualSize,r=n.isConstantSize,n=n.useRoundedSize,o=this.initialRects,s=e.orgRect,a=e.element,u=e.updateState===g.WAIT_LOADING,c=s&&s.width&&s.height,h=a?function(e,t){for(var n={},i=e.attributes,r=i.length,o=0;o<r;++o){var s=i[o],a=s.name,s=s.value;-1!==a.indexOf(t)&&(n[a.replace(t,"").replace(/[\s-_]([a-z])/g,function(e,t){return t.toUpperCase()})]=s)}return n}(a,this.options.attributePrefix):e.attributes,l=null!=(l=h.sizeGroup)?l:"",f=h.notEqualSize;if(""!==l&&o[l])d=o[l];else if(i&&!f&&!l&&o[""])d=o[""];else if(r&&c&&!u&&e.isFirstUpdate)d=s;else{if(t||!a)return;var d={left:a.offsetLeft,top:a.offsetTop,width:0,height:0};n?(d.width=a.offsetWidth,d.height=a.offsetHeight):(i=a.getBoundingClientRect(),d.width=i.width,d.height=i.height)}return e.attributes=h,e.shouldReupdate=!1,e.isFirstUpdate&&c||(e.orgRect=p({},d)),e.rect=p({},d),t||(e.element&&(e.mountState=O.MOUNTED),e.updateState===g.NEED_UPDATE&&(e.updateState=g.UPDATED,e.isFirstUpdate=!0),u)||f||o[l]||(o[l]=p({},d)),d},t._renderItem=function(e){var n,i,t,r,o,s,a,u,c=e.element,h=e.cssRect;c&&h&&(a=(e=this.options).horizontal,e=e.useTransform,n=this.posPercetage,i=this.sizePercetage,t=["position: absolute;"],r=(a=l[a?"horizontal":"vertical"]).inlineSize,o=a.inlinePos,s=this.getInlineSize(),u=0<(a=Object.keys(h)).length,e&&(a=a.filter(function(e){return"top"!==e&&"left"!==e}),t.push("transform: translate("+(h.left||0)+"px, "+(h.top||0)+"px);")),t.push.apply(t,a.map(function(e){var t=h[e];return e===r&&i||e===o&&n?e+": "+t/s*100+"%;":e+": "+t+"px;"})),u)&&(c.style.cssText+=t.join(""))},e}(),be=function(){function e(e,t){void 0===t&&(t={}),this.horizontal=e,this.isUpdating=!1,this.shouldReupdate=!1,this.hasTransition=!1,this.transitionDuration="",this.isRestoreOrgCSSText=!0;var n,e=t.element,i=p({key:"",index:0,orgRect:{left:0,top:0,width:0,height:0},rect:{left:0,top:0,width:0,height:0},cssRect:{},attributes:{},data:{},isFirstUpdate:!1,mountState:O.UNCHECKED,updateState:g.NEED_UPDATE,element:e||null,orgCSSText:null!=(e=null==e?void 0:e.style.cssText)?e:"",gridData:{}},t);for(n in i)this[n]=i[n]}var t=e.prototype;return Object.defineProperty(t,"orgInlineSize",{get:function(){var e=this._names.inlineSize;return this.orgRect[e]||this.rect[e]},enumerable:!1,configurable:!0}),Object.defineProperty(t,"orgContentSize",{get:function(){var e=this._names.contentSize;return this.orgRect[e]||this.rect[e]},enumerable:!1,configurable:!0}),Object.defineProperty(t,"inlineSize",{get:function(){return this.rect[this._names.inlineSize]},enumerable:!1,configurable:!0}),Object.defineProperty(t,"contentSize",{get:function(){return this.rect[this._names.contentSize]},enumerable:!1,configurable:!0}),Object.defineProperty(t,"cssInlineSize",{get:function(){return this.cssRect[this._names.inlineSize]},set:function(e){this.cssRect[this._names.inlineSize]=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"cssContentSize",{get:function(){return this.cssRect[this._names.contentSize]},set:function(e){this.cssRect[this._names.contentSize]=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"cssInlinePos",{get:function(){return this.cssRect[this._names.inlinePos]},set:function(e){this.cssRect[this._names.inlinePos]=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"cssContentPos",{get:function(){return this.cssRect[this._names.contentPos]},set:function(e){this.cssRect[this._names.contentPos]=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"computedInlineSize",{get:function(){var e=this._names.inlineSize;return this.cssRect[e]||this.rect[e]||this.orgRect[e]},enumerable:!1,configurable:!0}),Object.defineProperty(t,"computedContentSize",{get:function(){var e=this._names.contentSize;return this.cssRect[e]||this.rect[e]||this.orgRect[e]},enumerable:!1,configurable:!0}),Object.defineProperty(t,"computedInlinePos",{get:function(){var e,t=this._names.inlinePos;return null!=(e=this.cssRect[t])?e:this.rect[t]},enumerable:!1,configurable:!0}),Object.defineProperty(t,"computedContentPos",{get:function(){var e,t=this._names.contentPos;return null!=(e=this.cssRect[t])?e:this.rect[t]},enumerable:!1,configurable:!0}),t.setCSSGridRect=function(e){var t,n=l[this.horizontal?"horizontal":"vertical"],i={};for(t in e)i[n[t]]=e[t];this.cssRect=i},t.addCSSGridRect=function(e){var t,n=l[this.horizontal?"horizontal":"vertical"],i=this.cssRect;for(t in e)i[n[t]]=e[t]},t.getStatus=function(){return{index:this.index,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}},t.getMinimizedStatus=function(){var e={orgRect:this.orgRect,rect:this.rect,cssRect:this.cssRect,attributes:this.attributes,gridData:this.gridData},t=this,n=t.key,i=t.mountState,r=t.updateState,o=t.isFirstUpdate,t=t.orgCSSText;return void 0!==n&&(e.key=n),i!==O.UNCHECKED&&(e.mountState=i),r!==g.NEED_UPDATE&&(e.updateState=r),o&&(e.isFirstUpdate=!0),t&&(e.orgCSSText=t),e},Object.defineProperty(t,"_names",{get:function(){return this.horizontal?l.horizontal:l.vertical},enumerable:!1,configurable:!0}),e}(),v=function(d){function e(e,t){void 0===t&&(t={});var n=d.call(this)||this,t=(n.items=[],n.outlines={start:[],end:[]},n._renderTimer=0,n._onResize=function(e){e.isResizeContainer?n._renderItems({useResize:!0},!0):0<(e=ve(n.items,e.childEntries)).length&&n.updateItems(e)},n.options=p(p({},n.constructor.defaultOptions),t),n.containerElement=U(e)?document.querySelector(e):e,n.options),e=t.isEqualSize,i=t.isConstantSize,r=t.useTransform,o=t.horizontal,s=t.percentage,a=t.externalContainerManager,u=t.externalItemRenderer,c=t.resizeDebounce,h=t.maxResizeDebounce,l=t.autoResize,f=t.useRoundedSize,t=t.useResizeObserver;return n.containerManager=a||new Oe(n.containerElement,{horizontal:o,resizeDebounce:c,maxResizeDebounce:h,autoResize:l,useResizeObserver:t}).on("resize",n._onResize),n.itemRenderer=u||new Pe({useTransform:r,isEqualSize:e,isConstantSize:i,percentage:s,useRoundedSize:f}),n._init(),n}r(e,d);var t=e.prototype;return t.getContainerElement=function(){return this.containerElement},t.getItems=function(){return this.items},t.getChildren=function(){return[].slice.call(this.containerElement.children)},t.setItems=function(e){e.forEach(function(e,t){e.index=t});var t=this.options;return t.useResizeObserver&&t.observeChildren&&((t=this.containerManager).unobserveChildren(ze(this.items)),t.observeChildren(ze(e))),this.items=e,this},t.getContainerInlineSize=function(){return this.containerManager.getInlineSize()},t.getOutlines=function(){return this.outlines},t.setOutlines=function(e){return this.outlines=e,this},t.syncElements=function(e){void 0===e&&(e={});var n=this.items,t=this.options.horizontal,i=this.getChildren(),r=H(this.items.map(function(e){return e.element}),i),o=r.added,s=r.maintained,a=r.changed,r=r.removed,u=[];return s.forEach(function(e){var t=e[0],e=e[1];u[e]=n[t]}),o.forEach(function(e){u[e]=new be(t,{element:i[e]})}),this.setItems(u),(o.length||r.length||a.length)&&this.renderItems(e),this},t.updateItems=function(e,t){void 0===e&&(e=this.items);var n=(t=void 0===t?{}:t).useOrgResize;return e.forEach(function(e){var t;n&&((t=e.orgRect).width=0,t.height=0),e.updateState=g.NEED_UPDATE}),this.checkReady(t),this},t.renderItems=function(e){return this._renderItems(e=void 0===e?{}:e),this},t.getStatus=function(t){return{outlines:this.outlines,items:this.items.map(function(e){return t?e.getMinimizedStatus():e.getStatus()}),containerManager:this.containerManager.getStatus(),itemRenderer:this.itemRenderer.getStatus()}},t.setStatus=function(e){var t=this,n=this.options.horizontal,i=this.containerManager,r=i.getInlineSize(),o=this.getChildren();return this.itemRenderer.setStatus(e.itemRenderer),i.setStatus(e.containerManager),this.outlines=e.outlines,this.items=e.items.map(function(e,t){return new be(n,p(p({},e),{element:o[t]}))}),this.itemRenderer.renderItems(this.items),r!==i.getInlineSize()?this.renderItems({useResize:!0}):window.setTimeout(function(){t._renderComplete({direction:t.defaultDirection,mounted:t.items,updated:[],isResize:!1})}),this},t.getComputedOutlineSize=function(e){return void 0===e&&(e=this.items),this.options.outlineSize||this.getContainerInlineSize()},t.getComputedOutlineLength=function(e){return void 0===e&&(e=this.items),this.options.outlineLength||1},t.destroy=function(e){var e=(e=void 0===e?{}:e).preserveUI,e=void 0===e?this.options.preserveUIOnDestroy:e;this.containerManager.destroy({preserveUI:e}),e||this.items.forEach(function(e){var t=e.element,e=e.orgCSSText;t&&(t.style.cssText=e)}),null!=(e=this._im)&&e.destroy()},t.getInlineGap=function(){return this._getDirectionalGap("inline")},t.getContentGap=function(){return this._getDirectionalGap("content")},t.checkReady=function(i){var r=this,o=(i=void 0===i?{}:i).useOrgResize,e=this.items,s=e.filter(function(e){var t;return(null==(t=e.element)?void 0:t.parentNode)&&e.updateState!==g.UPDATED}),t=e.filter(function(e){var t;return(null==(t=e.element)?void 0:t.parentNode)&&e.mountState!==O.MOUNTED}),n=[];t.filter(function(e){var t;return!!e.hasTransition||(t=e.element,0<parseFloat(getComputedStyle(t).transitionDuration)&&(e.hasTransition=!0,e.transitionDuration=t.style.transitionDuration,!0))}).forEach(function(e){e.element.style.transitionDuration="0s"}),null!=(e=this._im)&&e.destroy(),this._im=new ge({prefix:this.options.attributePrefix}).on("preReadyElement",function(e){s[e.index].updateState=g.WAIT_LOADING}).on("preReady",function(){s.forEach(function(e){var t=!e.isFirstUpdate||!e.orgRect.width||!e.orgRect.height,n=e.cssRect.width||e.cssRect.height;(t||o)&&n&&(e.element.style.cssText=e.orgCSSText)}),r._updateItems(s),r.readyItems(t,s,i)}).on("readyElement",function(e){var t,n=s[e.index];n.updateState=g.NEED_UPDATE,e.isPreReadyOver&&(e=!n.isFirstUpdate||!n.orgRect.width||!n.orgRect.height,t=n.cssRect.width||n.cssRect.height,(n.isRestoreOrgCSSText||(e||o)&&t)&&(n.element.style.cssText=n.orgCSSText),r._updateItems([n]),r.readyItems([],[n],i))}).on("error",function(e){var t=s[e.index];r.trigger("contentError",{element:e.element,target:e.target,item:t,update:function(){n.push(t)}})}).on("ready",function(){n.length&&r.updateItems(n)}).check(s.map(function(e){return e.element}))},t.scheduleRender=function(){var e=this;this._clearRenderTimer(),this._renderTimer=window.setTimeout(function(){e.renderItems()})},t.fitOutlines=function(e){void 0===e&&(e=this.useFit);var t=this.outlines,n=t.start,i=t.end,r=n.length?Math.min.apply(Math,n):0;!e&&0<r||(t.start=n.map(function(e){return e-r}),t.end=i.map(function(e){return e-r}),this.items.forEach(function(e){var t=e.cssContentPos;_e(t)&&(e.cssContentPos=t-r)}))},t.readyItems=function(e,t,n){var i=this.outlines,r=n.direction||this.options.defaultDirection,i=n.outline||i["end"===r?"start":"end"],o=this.items,s={start:m([],i),end:m([],i)},o=(e.forEach(function(e){e.mountState=O.MOUNTED}),t.forEach(function(e){e.isUpdating=!0}),o.length&&(s=this.applyGrid(this.items,r,i)),t.forEach(function(e){e.isUpdating=!1}),this.setOutlines(s),this.fitOutlines(),this.itemRenderer.renderItems(this.items),this._refreshContainerContentSize(),e.filter(function(e){return e.hasTransition})),i=(o.length&&(this.containerManager.resize(),o.forEach(function(e){e.element.style.transitionDuration=e.transitionDuration})),this._renderComplete({direction:r,mounted:e,updated:t,isResize:!!n.useResize}),t.filter(function(e){return e.shouldReupdate}));i.length&&this.updateItems(i)},t._isObserverEnabled=function(){return this.containerManager.isObserverEnabled()},t._updateItems=function(e){this.itemRenderer.updateEqualSizeItems(e,this.getItems())},t._getDirectionalGap=function(e){var t=this.options.horizontal,n=this.options.gap;return"number"==typeof n?n:null!=(t=t&&"inline"===e||!t&&"content"===e?n.vertical:n.horizontal)?t:h.gap},t._renderComplete=function(e){this.trigger("renderComplete",e)},t._clearRenderTimer=function(){clearTimeout(this._renderTimer),this._renderTimer=0},t._refreshContainerContentSize=function(){var e=this.outlines,t=e.start,e=e.end,n=this.getContentGap(),e=e.length?Math.max.apply(Math,e):0,t=t.length?Math.max.apply(Math,t):0,t=Math.max(t,e-n);this.containerManager.setContentSize(t)},t._resizeContainer=function(){this.containerManager.resize(),this.itemRenderer.setContainerRect(this.containerManager.getRect())},t._init=function(){this._resizeContainer()},t._renderItems=function(e,t){void 0===e&&(e={}),this._clearRenderTimer();var n=e.useResize||e.useOrgResize;n&&!t&&(this._resizeContainer(),this.itemRenderer.resize()),!this.getItems().length&&this.getChildren().length?this.syncElements(e):n?this.updateItems(this.items,e):this.checkReady(e)},e.defaultOptions=h,e.propertyTypes=Re,ye([y],e)}(i);function Te(e,t,n,i){return Math[i].apply(Math,e.slice(t,t+n))}var Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.applyGrid=function(S,e,t){S.forEach(function(e){e.isRestoreOrgCSSText=!1});for(var n,f,i,z=this.getComputedOutlineSize(S),E=this.getComputedOutlineLength(S),_=!1,r=this.options,o=r.align,I=r.observeChildren,C=r.columnSizeRatio,s=r.contentAlign,a=r.stretchOutline,u=r.stretchContainerSize,O=r.stretchItemSize,P=this.getInlineGap(),b=this.getContentGap(),r=t.length,T=S.length,M=this._getAlignPoses(E,z),x="end"===e,w=x?"min":"max",D=x?"max":"min",d=[0],L=(d=r===E?t.slice():(n=r?Math[D].apply(Math,t):0,F(E).map(function(){return n}))).slice(),N=1<E?M[1]-M[0]:0,G="stretch"===o,k=x&&"start"===s,A=F(d.length).map(function(){return[]}),V=x?-1/0:1/0,c=(k&&(V=Math.min.apply(Math,L)),function(e){var t,n,i,r,e=x?e:T-1-e,o=S[e],s=parseInt(o.attributes.column||"1",10),a=parseInt(o.attributes.maxColumn||"1",10),u=o.contentSize,c=Math.min(E,s||Math.max(1,Math.ceil((o.inlineSize+P)/N))),h=Math.min(E,Math.max(c,a)),l=(n=c,a=w,i=V,y=(t=L).length-n+1,r="max"===a?"min":"max",R="max"===a?"lastIndexOf":"indexOf",(y=F(y).map(function(e){e=Te(t,e,n,r);return Math[r](i,e)}))[R](Math[a].apply(Math,y))),f=Te(L,l,c,D);for(k&&V!==f&&(V=Math.max.apply(Math,L),L=L.map(function(){return V}),f=V,l=0);c<h;){var d=l+c,p=l-1;if(x&&(E<=d||L[d]>f))break;if(!x&&(p<0||L[p]<f))break;x||--l,++c}l=Math.max(0,l),c=Math.min(E-l,c),A[l].push(e),(0<s&&1<c||G)&&(R=(c-1)*N+z,K._isObserverEnabled()&&I||o.cssInlineSize===R||(o.shouldReupdate=!0),o.cssInlineSize=R),!0===C?(a=o.orgContentSize/o.orgInlineSize,u=o.computedInlineSize*a,o.cssContentSize=u,_=!0):C&&0<C&&(u=o.computedInlineSize/C,o.cssContentSize=u,_=!0);var g,m,y=0,e=1/0,s=!1,R=(U(O[0])?(g=(R=O[0].split(":").map(function(e){return parseFloat(e)}))[0],m=R[1],y=o.computedInlineSize*m/g,s=!0):O[0]&&(y=O[0],s=!0),U(O[1])?(g=(a=O[1].split(":").map(function(e){return parseFloat(e)}))[0],m=a[1],e=o.computedInlineSize*m/g,s=!0):O[1]&&isFinite(O[1])&&(e=O[1],s=!0),j(u,y,e)),a=(s&&(o.cssContentSize=u=R,_=!0),M[l]),f=x?f:f-b-u,v=(o.cssInlinePos=a,o.cssContentPos=f,x?f+u+b:f);F(c).forEach(function(e){L[l+e]=v})}),K=this,h=0;h<T;++h)c(h);return a&&S.length&&(f=0,f="scale-up"===a?Math.max.apply(Math,L):"scale-center"===a?(Math.max.apply(Math,L)+Math.min.apply(Math,L))/2:Math.min.apply(Math,L),f=x?(f-=b,i=Math.min.apply(Math,d),j(f-i,u[0],u[1])+i):j((i=Math.max.apply(Math,d))-f,u[0],u[1])-i,L.forEach(function(e,t){var i,r,o,s,n,a=(A[t].length-1)*b,u=d[t],c=Math.abs(e-u)-(x?b:0)-a,h=Math.abs(f-u)-a,l=h/c;c&&1!=l&&isFinite(l)&&(L[t]=x?f+b:f,i=A[t].length,r=x?d[t]:d[t]-b,e=A[t].map(function(e,t){var n,i,r=S[e],o=_?r.computedContentSize:r.contentSize;return{item:r,index:t,itemIndex:e,minSize:U(O[0])?(n=(t=O[0].split(":").map(function(e){return parseFloat(e)}))[0],i=t[1],r.computedInlineSize*i/n):O[0],originalSize:o,nextSize:o,maxSize:U(O[1])?(n=(e=O[1].split(":").map(function(e){return parseFloat(e)}))[0],i=e[1],r.computedInlineSize*i/n):O[1]}}),1<l?e.sort(function(e,t){return e.originalSize-t.originalSize}):e.sort(function(e,t){return t.originalSize-e.originalSize}),s=o=0,e.forEach(function(e){var t=h<s?l:(h-s)/(c-o),n=e.originalSize,t=R(j(n*t,e.minSize,e.maxSize),.01);o+=n,s+=t,e.nextSize=t}),R(s-h,.01)&&(n=R(h/s,.01),e.forEach(function(e){e.nextSize*=n})),e.sort(function(e,t){return e.index-t.index}),e.forEach(function(e,t){var n=e.item,e=e.nextSize;n.addCSSGridRect({contentPos:x?r:r-e,contentSize:e}),r=x?n.cssContentPos+n.cssContentSize+b:n.cssContentPos-b,t===i-1&&(t=e=0,x?t=(.5<=n.cssContentPos%1?1:0)+(.5<=n.cssContentSize%1?1:0)+(.5<=f%1?-1:0):e=(n.cssContentPos%1<.5?-1:0)+(f%1<.5?1:0),n.addCSSGridRect({contentPos:n.cssContentPos-e,contentSize:n.cssContentSize-t}))}))})),k&&V!==Math.min.apply(Math,L)&&(V=Math.max.apply(Math,L),L=L.map(function(){return V})),{start:x?d:L,end:x?L:d}},n.getComputedOutlineSize=function(e){void 0===e&&(e=this.items);var t=this.options.align,n=this.getInlineGap(),i=this.getContainerInlineSize(),r=this.columnSize||this.outlineSize,o=this.column||this.outlineLength,s=o||1,a=0;if("stretch"===t)o||(t=this.maxStretchColumnSize||1/0,s=Math.max(1,Math.ceil((i+n)/(t+n)))),a=(i+n)/(s||1)-n;else if(r)a=r;else if(e.length){for(var u=e[0],c=0,h=e;c<h.length;c++){var l=h[c],f=l.attributes,d=parseInt(f.column||"1",10),f=parseInt(f.maxColumn||"1",10);if(l.updateState===g.UPDATED&&l.inlineSize&&1===d&&1===f){u=l;break}}a=u.inlineSize||0}else a=i;return a||0},n.getComputedOutlineLength=function(e){void 0===e&&(e=this.items);var t=this.getInlineGap(),n=this.column||this.outlineLength,i=this.columnCalculationThreshold,r=1;return n?r=n:(n=this.getComputedOutlineSize(e),r=Math.max(1,Math.floor((this.getContainerInlineSize()+t)/(n-i+t))),this.maxStretchColumnSize||(r=Math.min(e.length,r))),r},n._getAlignPoses=function(e,t){var n,i=this.options.align,r=this.getInlineGap(),o=this.getContainerInlineSize(),s=F(e),a=0,u=0;return"justify"===i||"stretch"===i?(u=(n=e-1)?Math.max((o-t)/n,t+r):0,a=Math.min(0,o/2-(n*u+t)/2)):(n=(e-1)*(u=t+r)+t,"center"===i?a=(o-n)/2:"end"===i&&(a=o-n)),s.map(function(e){return a+e*u})},t.propertyTypes=p(p({},v.propertyTypes),{column:c.RENDER_PROPERTY,columnSize:c.RENDER_PROPERTY,columnSizeRatio:c.RENDER_PROPERTY,align:c.RENDER_PROPERTY,columnCalculationThreshold:c.RENDER_PROPERTY,maxStretchColumnSize:c.RENDER_PROPERTY,contentAlign:c.RENDER_PROPERTY,stretchOutline:c.RENDER_PROPERTY,stretchContainerSize:c.RENDER_PROPERTY,stretchItemSize:c.RENDER_PROPERTY}),t.defaultOptions=p(p({},v.defaultOptions),{align:"justify",column:0,columnSize:0,columnSizeRatio:0,columnCalculationThreshold:.5,maxStretchColumnSize:1/0,contentAlign:"masonry",stretchOutline:"",stretchContainerSize:[0,1/0],stretchItemSize:[0,1/0]}),ye([y],t)}(v);function xe(e,t,n){for(var i=function(e,t,n){var i,r,o,s,a,u,c={},h={},l=(h[t]=0,new we(function(e){return e.cost}));for(l.push({value:t,cost:0});l.size();)for(var f in r=(i=l.pop()).value,o=i.cost,s=e(r)||{})a=o+s[f],(void 0===(u=h[f])||a<u)&&(l.push({value:f,cost:h[f]=a}),c[f]=r);if(void 0===h[n])throw t=["Could not find a path from ",t," to ",n,"."].join(""),new Error(t);return c}(e,t,n),r=[],o=n;o;)r.push(o),o=i[o];return r.reverse(),r}var we=function(){function e(e){this.content=[],this.scoreFunction=e}var t=e.prototype;return t.push=function(e){this.content.push(e),this.bubbleUp(this.content.length-1)},t.pop=function(){var e=this.content[0],t=this.content.pop();return 0<this.content.length&&(this.content[0]=t,this.sinkDown(0)),e},t.size=function(){return this.content.length},t.bubbleUp=function(e){for(var t=e,n=this.content[t];0<t;){var i=Math.floor((t+1)/2)-1,r=this.content[i];if(!(this.scoreFunction(n)<this.scoreFunction(r)))break;this.content[i]=n,this.content[t]=r,t=i}},t.sinkDown=function(e){for(var t=this.content.length,n=this.content[e],i=this.scoreFunction(n);;){var r,o=2*(e+1),s=o-1,a=null;if(s<t&&(r=this.content[s],(r=this.scoreFunction(r))<i)&&(a=s),null===(a=o<t&&(s=this.content[o],this.scoreFunction(s)<(null==a?i:r))?o:a))break;this.content[e]=this.content[a],this.content[a]=n,e=a}},e}();function De(e,t){var n,i;return _e(t)?t:(n="+"===(n=t.charAt(0))?1:"-"===n?-1:0,i=parseFloat(t),t.match(/%$/g)&&(i*=e/100),n?e+i:i)}function Le(e,t){var n=e.orgInlineSize,i=e.orgContentSize,r=e.gridData.inlineOffset||0,e=e.gridData.contentOffset||0;return n&&i?(i<=e?1:(n-r)/(i-e))*(t-e)+r:t}var Ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.applyGrid=function(e,t,n){var s=this,i=this.options,a=i.attributePrefix,u=i.horizontal,i=(e.forEach(function(e){var t,n,i,r,o;e.isUpdating&&(r=e.element,i=e.attributes,t=e.gridData,n=parseFloat(i.inlineOffset),o=parseFloat(i.contentOffset),isNaN(n)&&(n=s.inlineOffset||t.inlineOffset||0),isNaN(o)&&(o=s.contentOffset||0|t.contentOffset),!r||"inlineOffset"in i||"contentOffset"in i||e.mountState!==O.MOUNTED||(i=r.querySelector("["+a+"maintained-target]"))&&(e=r.offsetWidth-r.clientWidth+r.scrollWidth-i.clientWidth,r=r.offsetHeight-r.clientHeight+r.scrollHeight-i.clientHeight,o=u?(n=r,e):(n=e,r)),t.inlineOffset=n,t.contentOffset=o)}),this.options.rowRange),r=[],o="end"===t;return e.length&&(r=i?this._getRowPath(e,o):this._getPath(e,o)),this._setStyle(e,r,n,"end"===t)},n._getRowPath=function(e,t){var n=this._getColumnRange(),i=this._getRowRange(),e=this._getRowLink(e,{path:[0],cost:0,length:0,currentNode:0},n,i,t);return null!=(n=null==e?void 0:e.path.map(function(e){return""+e}))?n:[]},n._getRowLink=function(e,t,n,i,r){var o=n[0],s=i[0],a=i[1],u=e.length,c=t.path,h=t.length,l=t.cost,f=t.currentNode;return f<u&&(a<=h||u<f+o)?(o=Ie(u-f,n)*Math.abs(this._getCost(e,f,u,r)),p(p({},t),{length:h+1,path:m(m([],c),[u]),currentNode:u,cost:l+o,isOver:!0})):u<=f?p(p({},t),{currentNode:u,isOver:h<s||a<h}):this._searchRowLink(e,t,u,n,i,r)},n._searchRowLink=function(e,t,n,i,r,o){for(var s,a=i[0],u=i[1],c=t.currentNode,h=t.path,l=t.length,f=t.cost,d=Math.min(n,c+u),p=[],g=c+a;g<=d;++g)g!==c&&(s=Math.abs(this._getCost(e,c,g,o)),s=this._getRowLink(e,{path:m(m([],h),[g]),length:l+1,cost:f+s,currentNode:g},i,r,o))&&p.push(s);return p.sort(function(e,t){var n=e.isOver;return n!==t.isOver?n?1:-1:Ie(e.length,r)-Ie(t.length,r)||e.cost-t.cost}),p[0]},n._getExpectedRowSize=function(i,e){var t=this.getContainerInlineSize()-this.getInlineGap()*(i.length-1),r=t,o=0,s=0;if(i.forEach(function(e){var t,n=e.orgInlineSize,i=e.orgContentSize;n&&i?(t=e.gridData.inlineOffset||0,e=e.gridData.contentOffset||0,o+=n=i<=e?1:(n-t)/(i-e),s+=e*n,r-=t):o+=1}),o){var n=(r+s)/o;if(this.stretch){var a=this._getSizeRange(),u=j(n,a[0],a[1]);if(e)return u;var c=this.stretchRange,a=i.map(function(e){return Le(e,u)}),e=a.reduce(function(e,t,n){return e+De(t,i[n].attributes.minStretch||c[0])},0),a=a.reduce(function(e,t,n){return e+De(t,i[n].attributes.maxStretch||c[1])},0);if(e<=t&&t<=a)return u}return n}return 0},n._getExpectedInlineSizes=function(e,o){var t=this.options,s=t.stretch,a=t.stretchRange;return e.map(function(e){var t=s?De(e.orgInlineSize,e.attributes.minStretch||a[0]):-1/0,n=s?De(e.orgInlineSize,e.attributes.maxStretch||a[1]):1/0,e=Le(e,o),i=!1,r=!1;return n<=e?i=!0:e<=t&&(r=!0),{minSize:t,maxSize:n,size:j(e,t,n),originalSize:e,isMax:i,isMin:r}})},n._getStretchItemInfos=function(e,t){var n=e.length,i=this.getContainerInlineSize()-this.getInlineGap()*(Math.max(1,n)-1),n=this._getExpectedInlineSizes(e,t),e=d(n.map(function(e){return e.size})),t=i-e,r=i/d(n.map(function(e){return e.originalSize})),o=n.map(function(e){return p(p({},e),{passed:!1,size:e.originalSize*r})});if(0==t)return{infos:o,cost:0};for(var s=0<t,a=o.length,u=0;u<a&&"break"!==function(){var e=d(o.map(function(e){return e.passed?e.size:0})),t=d(o.map(function(e){return e.passed?0:e.originalSize})),n=(i-e)/t;if(o.forEach(function(e){e.passed||(s?e.size>e.maxSize&&(n=Math.min(n,e.maxSize/e.originalSize)):e.size<e.minSize&&(n=Math.max(n,e.minSize/e.originalSize)))}),o.forEach(function(e){!e.passed&&(e.size=j(e.originalSize*n,e.minSize,e.maxSize),s&&!R(e.size-e.maxSize,.001)||!s&&!R(e.size-e.minSize,.001))&&(e.passed=!0)}),o.every(function(e){return e.passed}))return"break"}();++u);var c=i/d(o.map(function(e){return e.size}));return R(c-1,.001)&&o.forEach(function(e){e.size*=c}),{infos:o,cost:d(o.map(function(e){var t=Math.abs(e.originalSize-e.size)/2,n=1;return e.size>e.maxSize?(n=2,e.isMin?t+=Math.abs(e.size-e.minSize):t+=Math.abs(e.size-e.maxSize)):e.size<e.minSize?(n=2,e.isMax?t+=Math.abs(e.size-e.maxSize):t+=Math.abs(e.size-e.minSize)):e.isMax?t+=Math.abs(e.maxSize-e.size):e.isMin&&(t+=Math.abs(e.minSize-e.size)),t*n}))}},n._getExpectedInlineSize=function(e,t){var n=this.getInlineGap(),t=this._getExpectedInlineSizes(e,t);return t.length?d(t.map(function(e){return e.size}))+n*(e.length-1):0},n._getCost=function(e,t,n,i){var r=e.slice(t,n),o=this.getContainerInlineSize(),s=this._getExpectedRowSize(r),a=this._getSizeRange(),u=a[0],a=a[1];if(this.isCroppedSize)return u<=s&&s<=a?0:(h=this._getExpectedInlineSize(r,s<u?u:a),Math.pow(h-o,2));var c,h,l=0;if(this.stretch)return s<u?s=u:a<s&&(s=a),c=Math.abs(s-u),h=this._getExpectedInlineSize(r,s),(l=!this.passUnstretchRow||(i?n!==e.length:0!==t)||o<=h?this._getStretchItemInfos(r,s).cost:l)+c;if(isFinite(a)){if(s<u)return Math.pow(s-u,2)+Math.pow(a,2)+l;if(a<s)return Math.pow(s-a,2)+Math.pow(a,2)+l}else if(s<u)return Math.max(Math.pow(u,2),Math.pow(s,2))+Math.pow(a,2)+l;return s-u+l},n._getPath=function(o,s){var a=this,u=o.length,e=this._getColumnRange(),c=e[0],h=e[1],l={};return xe(function(e){if(e in l)return l[e];l[e]={};for(var t={},n=parseInt(e,10),i=Math.min(n+c,u);i<=u&&!(h<i-n);++i){var r=a._getCost(o,n,i,s);r<0&&i===u&&(r=0),t[""+i]=Math.pow(r,2)}return l[e]=t},"0",""+u)},n._setStyle=function(e,t,n,l){var f,d,i,p=this,r=(void 0===n&&(n=[]),this.options),g=r.isCroppedSize,m=r.displayedRow,y=r.stretch,R=r.passUnstretchRow,v=e.length,S=this._getSizeRange(),r=n[0]||0,z=this.getContainerInlineSize(),E=this.getInlineGap(),_=this.getContentGap(),n=function(e,t){for(var n=t.length,i=[],r=0;r<n-1;++r){var o=parseInt(t[r],10),s=parseInt(t[r+1],10);i.push(e.slice(o,s))}return i}(e,t),I=n.length,C=r,O=0;return n.forEach(function(o,e){var n,i,r=o.length,s=p._getExpectedRowSize(o,!0),t=(g&&(s=Math.max(S[0],Math.min(s,S[1]))),E*(r-1)),a=o.map(function(e,t){var n=Le(e,s);return{index:t,item:e,inlineSize:n,orgInlineSize:n,maxInlineSize:n,minInlineSize:n}}),u=p._getExpectedInlineSize(o,s),c=(z-t)/(u-t),h=u-t,t=z-t;y&&u&&((u=R&&h<t&&(l?e===I-1:0===e))||t==h?(u&&(d=[C],f=o.map(function(e,t){return v-r+t})),n=p._getExpectedInlineSizes(o,s),a.forEach(function(e,t){e.minInlineSize=n[t].minSize,e.maxInlineSize=n[t].maxSize,e.inlineSize=j(e.inlineSize,e.minInlineSize,e.maxInlineSize)})):(i=p._getStretchItemInfos(o,s).infos,a.forEach(function(e,t){e.inlineSize=i[t].size,e.minInlineSize=i[t].minSize,e.maxInlineSize=i[t].maxSize}))),a.forEach(function(e,t){var n=e.item,i=e.inlineSize,t=o[t-1],t=t?t.cssInlinePos+t.cssInlineSize+E:0,r=(g&&(i*=c),n.gridData);r.orgInlineSize=e.orgInlineSize,r.orgContentSize=s,r.minInlineSize=e.minInlineSize,r.maxInlineSize=e.maxInlineSize,n.setCSSGridRect({inlinePos:t,contentPos:C,inlineSize:i,contentSize:s})}),C+=_+s,(m<0||e<m)&&(O=C)}),l?{start:[r],end:[O],passedItems:f,passed:d}:(i=C-r,e.forEach(function(e){e.cssContentPos-=i}),{passedItems:f,passed:d?[d[0]-i]:null,start:[r-i],end:[r]})},n.getComputedOutlineLength=function(){return 1},n.getComputedOutlineSize=function(){return this.getContainerInlineSize()},n._getRowRange=function(){var e=this.rowRange;return Ee(e)?e:[e,e]},n._getColumnRange=function(){var e=this.columnRange,e="function"==typeof e?e(this):e;return Ee(e)?e:[e,e]},n._getSizeRange=function(){var e=this.sizeRange;return Ee(e)?e:[e,e]},t.propertyTypes=p(p({},v.propertyTypes),{columnRange:c.RENDER_PROPERTY,rowRange:c.RENDER_PROPERTY,sizeRange:c.RENDER_PROPERTY,isCroppedSize:c.RENDER_PROPERTY,displayedRow:c.RENDER_PROPERTY,stretch:c.RENDER_PROPERTY,stretchRange:c.RENDER_PROPERTY,passUnstretchRow:c.RENDER_PROPERTY,inlineMargin:c.RENDER_PROPERTY,contentMargin:c.RENDER_PROPERTY,inlineOffset:c.RENDER_PROPERTY,contentOffset:c.RENDER_PROPERTY}),t.defaultOptions=p(p({},v.defaultOptions),{columnRange:[1,8],rowRange:0,sizeRange:[0,1/0],displayedRow:-1,isCroppedSize:!1,stretch:!1,passUnstretchRow:!0,stretchRange:["-20%","+20%"],inlineOffset:0,contentOffset:0}),ye([y],t)}(v);function Ge(e){var t=-1/0;return e.forEach(function(e){isFinite(e)&&(t=Math.max(t,e))}),isFinite(t)?t:0}function ke(e,t,n){return Ge(e)+function(e,t,n){var i=e.length;if(!i)return 0;var r=function(e){var t=1/0;return e.forEach(function(e){isFinite(e)&&(t=Math.min(t,e))}),isFinite(t)?t:0}(t),o=Ge(e),s=0;if(!n)return 0;for(var a=0;a<i;++a){var u=e[a],c=t[a];isFinite(u)&&isFinite(c)&&(u=u-o,c=c-r,s=a?Math.max(s,s+u-c):u-c)}return s}(e,t,n)}function Ae(e,t,n){for(var i=n.inlinePos,r=n.inlineSize,o=n.contentPos,s=n.contentSize,a=i;a<i+r;++a)e[a]=Math.min(e[a],o),t[a]=Math.max(t[a],o+s)}var Ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.applyGrid=function(e,t,n){var i=this._getFrame(),r=i.inlineSize,o=i.contentSize,s=i.rects,a=this.options.useFrameFill,u=this.getRectSize(r),c=u.inlineSize,h=u.contentSize,l=this.getInlineGap(),f=this.getContentGap(),d=e.length;if(!d||!r||!o)return{start:n,end:n};for(var p=s.length,g=F(r).map(function(){return 1/0}),m=F(r).map(function(){return-1/0}),y=i.outline.map(function(e){return e*(h+f)}),R=0;R<d;R+=p)for(var v=ke(m,y,a),S=0;S<p&&R+S<d;++S){var z=e[R+S],E=s[S],_=E.contentPos,I=E.inlinePos,C=E.contentSize,E=E.inlineSize,_=v+_*(h+f),O=I*(c+l),C=C*(h+f)-f,P=E*(c+l)-l;Ae(g,m,{inlinePos:I,inlineSize:E,contentPos:_,contentSize:C+f}),z.setCSSGridRect({inlinePos:O,contentPos:_,inlineSize:P,contentSize:C})}var b,u="end"===t,o=n.length?n:[0],T=(o.length!==r&&(b=(u?Math.max:Math.min).apply(Math,o),o=F(r).map(function(){return b})),g=g.map(function(e){return isFinite(e)?e:0}),m=m.map(function(e){return isFinite(e)?e:0}),u?ke(o,g,a):ke(m,o,a));return e.forEach(function(e){e.cssContentPos+=T}),{start:g.map(function(e){return e+T}),end:m.map(function(e){return e+T})}},n.getComputedOutlineLength=function(){var e=this.options.frame;return e.length?e[0].length:0},n.getComputedOutlineSize=function(){var e,t=this.options.rectSize;return"object"==typeof t?t.inlineSize:(e=this.getInlineGap(),t||(this.getContainerInlineSize()+e)/this.getComputedOutlineLength()-e)},n.getRectSize=function(e){var t,n=this.options.rectSize;return"object"==typeof n?n:(t=this.getInlineGap(),{inlineSize:n=n||(this.getContainerInlineSize()+t)/e-t,contentSize:n})},n._getFrame=function(){for(var e=this.options.frame,t=e.length,n=t?e[0].length:0,i=[],r={},o=F(n).map(function(){return 1/0}),s=F(n).map(function(){return-1/0}),a=0;a<t;++a)for(var u=0;u<n;++u){var c=e[a][u];!c||r[a+","+u]||(Ae(o,s,c=this._findRect(r,c,a,u,n,t)),i.push(c))}return i.sort(function(e,t){return e.type<t.type?-1:1}),{rects:i,inlineSize:n,contentSize:t,outline:o}},n._findRect=function(e,t,n,i,r,o){for(var s=this.options.frame,a=1,u=1,c=i;c<r&&s[n][c]===t;++c)u=c-i+1;for(var h=n;h<o&&s[h][i]===t;++h)a=h-n+1;for(var l=n;l<n+a;++l)for(var f=i;f<i+u;++f)e[l+","+f]=!0;return{type:t,inlinePos:i,contentPos:n,inlineSize:u,contentSize:a}},t.propertyTypes=p(p({},v.propertyTypes),{frame:c.RENDER_PROPERTY,useFrameFill:c.RENDER_PROPERTY,rectSize:c.RENDER_PROPERTY}),t.defaultOptions=p(p({},v.defaultOptions),{frame:[],rectSize:0,useFrameFill:!0}),ye([y],t)}(v),Ke=function(){function e(e){var t,n=p({orgInlineSize:0,orgContentSize:0,inlineSize:0,contentSize:0,inlinePos:0,contentPos:0,items:[]},e);for(t in n)this[t]=n[t]}var t=e.prototype;return t.scaleTo=function(e,t){var n=this.inlineSize?e/this.inlineSize:0,i=this.contentSize?t/this.contentSize:0;this.items.forEach(function(e){0!=n&&(e.inlinePos*=n,e.inlineSize*=n),0!=i&&(e.contentPos*=i,e.contentSize*=i)}),this.inlineSize=e,this.contentSize=t},t.push=function(e){this.items.push(e)},t.getOrgSizeWeight=function(){return this.orgInlineSize*this.orgContentSize},t.getSize=function(){return this.inlineSize*this.contentSize},t.getOrgRatio=function(){return 0===this.orgContentSize?0:this.orgInlineSize/this.orgContentSize},t.getRatio=function(){return 0===this.contentSize?0:this.inlineSize/this.contentSize},e}();function E(e,t){e/=t;return(e=e<1?1/e:e)-1}var S,P,z,Ue=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.applyGrid=function(e,t,n){var i=this,r=this.options.aspectRatio,o=this.getContainerInlineSize(),s=o/r,a=this.getInlineGap(),u=this.getContentGap(),r=n.length?n:[0],c="end"===t?Math.max.apply(Math,r):Math.min.apply(Math,r)-s-u,n=c+s+u,h=new Ke({});return e.forEach(function(e){e=new Ke({inlineSize:e.orgInlineSize,contentSize:e.orgContentSize,orgInlineSize:e.orgInlineSize,orgContentSize:e.orgContentSize});i._findBestFitArea(h,e),h.push(e),h.scaleTo(o+a,s+u)}),e.forEach(function(e,t){var t=h.items[t],n=t.inlineSize-a,i=t.contentSize-u,r=c+t.contentPos,t=t.inlinePos;e.setCSSGridRect({inlinePos:t,contentPos:r,inlineSize:n,contentSize:i})}),{start:[c],end:[n]}},n._findBestFitArea=function(e,p){var g,m,y,R,v,S,z,t,n,i,r;0===e.getRatio()?(e.orgInlineSize=p.inlineSize,e.orgContentSize=p.contentSize,e.inlineSize=p.inlineSize,e.contentSize=p.contentSize):(m=1/0,y=!1,R={inlineSize:0,contentSize:0},v={inlineSize:0,contentSize:0},S=this._getWeight("size"),z=this._getWeight("ratio"),e.items.forEach(function(e){for(var t=E(e.getOrgSizeWeight(),e.getSize())*S,n=E(e.getOrgRatio(),e.getRatio())*z,i=e.inlineSize,r=e.contentSize,o=0;o<2;++o){var s=void 0,a=void 0,u=void 0,c=void 0,h=(0===o?(u=s=i,c=r-(a=r*(p.contentSize/(e.orgContentSize+p.contentSize)))):(c=a=r,u=i-(s=i*(p.inlineSize/(e.orgInlineSize+p.inlineSize)))),s*a),l=s/a,f=u*c,d=c/c,h=E(p.getSize(),h)*S;(h=(h=(h+=E(p.getRatio(),l)*z)+(E(e.getOrgSizeWeight(),f)*S-t))+(E(e.getOrgRatio(),d)*z-n))===Math.min(h,m)&&(m=h,g=e,y=0===o,R.inlineSize=s,R.contentSize=a,v.inlineSize=u,v.contentSize=c)}}),e=g,n=R,i=v,r=y,(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(e){var t=this.options,n=t.weightPriority;return n===e?100:"custom"===n?t[e+"Weight"]:1},t.propertyTypes=p(p({},v.propertyTypes),{aspectRatio:c.RENDER_PROPERTY,sizeWeight:c.RENDER_PROPERTY,ratioWeight:c.RENDER_PROPERTY,weightPriority:c.RENDER_PROPERTY}),t.defaultOptions=p(p({},v.defaultOptions),{aspectRatio:1,sizeWeight:1,ratioWeight:1,weightPriority:"custom"}),ye([y],t)}(v),e="undefined"!=typeof window?window.navigator.userAgent:"",Fe=/iPhone|iPad/.test(e),je="infinitegrid-container",Ye={renderOnPropertyChange:!0,useFit:!0,autoResize:!0},qe=I({},Re),b={START:"start",END:"end",NONE:""},T={CHANGE_SCROLL:"changeScroll",REQUEST_APPEND:"requestAppend",REQUEST_PREPEND:"requestPrepend",RENDER_COMPLETE:"renderComplete",CONTENT_ERROR:"contentError"},Be={type:!0,groupKey:!0,key:!0,element:!0,html:!0,data:!0,inserted:!0,attributes:!0},t=["resizeScroll","insertByGroupIndex","updateItems","getItems","getVisibleItems","getGroups","getVisibleGroups","renderItems","getContainerElement","getScrollContainerElement","getWrapperElement","setStatus","getStatus","removePlaceholders","prependPlaceholders","appendPlaceholders","getStartCursor","getEndCursor","setCursors"],M=((e=S=S||{})[e.NORMAL=0]="NORMAL",e[e.VIRTUAL=1]="VIRTUAL",e[e.LOADING=2]="LOADING",(e=P=P||{})[e.NORMAL=0]="NORMAL",e[e.VIRTUAL=1]="VIRTUAL",e[e.LOADING=2]="LOADING",(e=z=z||{})[e.NOT_REMOVE=0]="NOT_REMOVE",e[e.MINIMIZE_INVISIBLE_ITEMS=1]="MINIMIZE_INVISIBLE_ITEMS",e[e.MINIMIZE_INVISIBLE_GROUPS=2]="MINIMIZE_INVISIBLE_GROUPS",e[e.REMOVE_INVISIBLE_GROUPS=3]="REMOVE_INVISIBLE_GROUPS",-9999),_=function(r){function e(e,t){var n,i,e=r.call(this,e,I({html:"",type:P.NORMAL,cssRect:{top:M,left:M}},t))||this;return e.type===P.VIRTUAL&&((e.rect.width||e.rect.height)&&(e.mountState=O.UNMOUNTED),t=e.orgRect,n=e.rect,(i=e.cssRect).width?n.width=i.width:t.width&&(n.width=t.width),i.height?n.height=i.height:t.height&&(n.height=t.height)),e}o(e,r);var t=e.prototype;return t.getVirtualStatus=function(){return{type:P.VIRTUAL,groupKey:this.groupKey,key:this.key,orgRect:this.orgRect,rect:this.rect,cssRect:this.cssRect,attributes:this.attributes}},t.getMinimizedStatus=function(){var e=I(I({},r.prototype.getMinimizedStatus.call(this)),{type:P.NORMAL,groupKey:this.groupKey});return this.html&&(e.html=this.html),e},e}(be),We=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="",e.isWaitEnd=!1,e.initialDisplay=null,e}o(e,t);var n=e.prototype;return n.getLoadingItem=function(){return this.items[0]||null},n.startLoading=function(){var e=this.items[0].element;e&&(null!=this.initialDisplay?this.initialDisplay=e.style.display||"":this.initialDisplay?e.style.display=this.initialDisplay:e.style.removeProperty("display"))},n.endLoading=function(){var e;this.type&&(e=this.items[0].element)&&(e.style.display="none")},n.setLoadingItem=function(e){if(e){var t=this.getLoadingItem();if(t)for(var n in e)t[n]=e[n];else this.items=[new _(this.options.horizontal,I(I({},e),{type:P.LOADING,key:"__INFINITEGRID__LOADING_ITEM"}))]}else this.items=[]},n.applyGrid=function(e,t,n){var i,r;return e.length?(i=n.length?f([],n,!0):[0],e=e[0],r=e.contentSize+this.getContentGap(),e.cssInlinePos=this.getContainerInlineSize()/2-e.inlineSize/2,"end"===t?(t=Math.max.apply(Math,i),e.cssContentPos=t,{start:i,end:i.map(function(e){return e+r})}):(t=Math.min.apply(Math,i),e.cssContentPos=t-r,{start:i.map(function(e){return e-r}),end:i})):{start:n,end:n}},e}(v);function He(e){var t;return e?("string"==typeof e?t=document.querySelector(e):e instanceof Element?t=e:("value"in e||"current"in e)&&(t=e.value||e.current),t):null}function Ze(e){return e===window}function Xe(e){return"number"==typeof e}function Qe(e){return"string"==typeof e}function Je(e){return e.reduce(function(e,t){return f(f([],e,!0),t,!0)},[])}function $e(e){var t,n={},i={},r=v.defaultOptions;for(t in e){var o=e[t];t in Ye||(i[t]=o),t in r&&(n[t]=o)}return I(I({},n),{gridOptions:i})}function et(i){var r,o=[],s={},a={},u=(i.filter(function(e){return null!=e.groupKey}).forEach(function(e){e=e.groupKey;a[e]=!0}),!1);return i.forEach(function(e,t){null!=e.groupKey?u=!1:!e.inserted&&i[t-1]?(e.groupKey=i[t-1].groupKey,u=!1):(u||(r=rt(a),u=!0,a[r]=!0),e.groupKey=r);var t=e.groupKey,n=s[t];n||(s[t]=n={groupKey:t,items:[]},o.push(n)),n.items.push(e)}),o}function tt(e,t,n,i){var e=q(e,t,function(e){return e}),r=-1,o=-1;return e.maintained.forEach(function(e){var t=e[0],e=e[1];n<=t&&t<=i&&(o=-1===r?r=e:(r=Math.min(r,e),Math.max(o,e)))}),{startCursor:r,endCursor:o}}function nt(e,t,n){var i,r=[];if("start"===t){if(-1===(i=x(e,function(e){return e.type===S.NORMAL})))return[];t=x(e,function(t){return 0<=x(n,function(e){return e.groupKey===t.groupKey})}),t=0<=t?Math.min(i,t):i,r=e.slice(0,t)}else{if(-1===(i=ut(e,function(e){return e.type===S.NORMAL})))return[];t=ut(e,function(t){return 0<=x(n,function(e){return e.groupKey===t.groupKey})}),t=0<=t?Math.max(i,t):i;r=e.slice(t+1)}return r}function it(e){var t=e.prototype,n=e.propertyTypes;for(var i in e.infinitegridTypes)!function(n){Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:function(){return this.options[n]},set:function(e){var t="_".concat("set ".concat(n).replace(/[\s-_]([a-z])/g,function(e,t){return t.toUpperCase()}));this[t]?this[t](e):this.options[n]=e}})}(i);for(i in n)!function(n){Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:function(){var e=this.groupManager.options;return(n in e?e:e.gridOptions)[n]},set:function(e){var t;this.groupManager[n]!==e&&(this.groupManager.gridOptions=((t={})[n]=e,t))}})}(i)}function rt(e,t){void 0===t&&(t="");for(var n=0;;){var i="infinitegrid_".concat(t).concat(n++);if(!(i in e))return i}}function ot(e){var t=document.createElement("div");return t.innerHTML=e,at(t.children)}function st(e,i){e=Qe(e)?ot(e):e;return e.map(function(e){var t,n="";if(Qe(e))n=e;else{if(!("parentNode"in e))return I({groupKey:i,inserted:!0},e);n=(t=e).outerHTML}return{key:void 0,groupKey:i,html:n,element:t,inserted:!0}})}function at(e){var t=[];if(e)for(var n=e.length,i=0;i<n;i++)t.push(e[i]);return t}function x(e,t){for(var n=e.length,i=0;i<n;++i)if(t(e[i],i))return i;return-1}function ut(e,t){for(var n=e.length-1;0<=n;--n)if(t(e[n],n))return n;return-1}function ct(e,n){return e.length===n.length&&e.every(function(e,t){return n[t]===e})}function ht(e){return Je(e.map(function(e){return e.grid.getItems()}))}function lt(e,t){return t?f([],e,!0):e.filter(function(e){return e.type!==P.VIRTUAL})}function ft(e,r){dt.forEach(function(i){i in e||(e[i]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=(n=this[r])[i].apply(n,e);return n===this[r]?this:n})})}dt=t;var dt,pt=function(r){function e(e,t){var n,i,t=r.call(this,e,(i=(n=t).gridOptions,n=L(t,["gridOptions"]),I(I({},$e(i)),n)))||this;return t.groupItems=[],t.groups=[],t.itemKeys={},t.groupKeys={},t.startCursor=0,t.endCursor=0,t._placeholder=null,t._loadingGrid=new We(e,{externalContainerManager:t.containerManager,useFit:!1,autoResize:!1,renderOnPropertyChange:!1,gap:t.gap}),t._mainGrid=t._makeGrid(),t}o(e,r);var t=e.prototype;return Object.defineProperty(t,"gridOptions",{set:function(n){var e,t=$e(n),i=t.gridOptions,r=L(t,["gridOptions"]),t=this._checkShouldRender(n);for(e in this.options.gridOptions=I(I({},this.options.gridOptions),i),f([this._mainGrid],this.groups.map(function(e){return e.grid}),!0).forEach(function(e){for(var t in n)e[t]=n[t]}),r)this[e]=r[e];this._loadingGrid.gap=this.gap,t&&this.scheduleRender()},enumerable:!1,configurable:!0}),t.getItemByKey=function(e){return this.itemKeys[e]||null},t.getGroupItems=function(e){return lt(this.groupItems,e)},t.getVisibleItems=function(e){return lt(this.items,e)},t.getRenderingItems=function(){return this.hasPlaceholder()?this.items:this.items.filter(function(e){return e.type!==P.VIRTUAL})},t.getGroups=function(e){return lt(this.groups,e)},t.hasVisibleVirtualGroups=function(){return this.getVisibleGroups(!0).some(function(e){return e.type===S.VIRTUAL})},t.hasPlaceholder=function(){return!!this._placeholder},t.hasLoadingItem=function(){return!!this._getLoadingItem()},t.updateItems=function(e,t){return void 0===e&&(e=this.groupItems),r.prototype.updateItems.call(this,e,t)},t.setPlaceholder=function(e){this._placeholder=e,this._updatePlaceholder()},t.getLoadingType=function(){return this._loadingGrid.type},t.startLoading=function(e){return this._loadingGrid.type=e,this.items=this._getRenderingItems(),!0},t.waitEndLoading=function(){return!(this._loadingGrid.isWaitEnd||!this._loadingGrid.type)&&(this._loadingGrid.isWaitEnd=!0)},t.endLoading=function(){var e;return!!this._loadingGrid.isWaitEnd&&(e=this._loadingGrid.type,this._loadingGrid.type="",this._loadingGrid.endLoading(),this.items=this._getRenderingItems(),!!e)},t.setLoading=function(e){this._loadingGrid.setLoadingItem(e),this.items=this._getRenderingItems()},t.getVisibleGroups=function(e){return lt(this.groups.slice(this.startCursor,this.endCursor+1),e)},t.getComputedOutlineLength=function(e){return void 0===e&&(e=this.items),this._mainGrid.getComputedOutlineLength(e)},t.getComputedOutlineSize=function(e){return void 0===e&&(e=this.items),this._mainGrid.getComputedOutlineSize(e)},t.applyGrid=function(e,i,t){var n,r,o,s,a,u,c,h=this,l=this.groups.slice();return l.length?((n=this._loadingGrid).getLoadingItem()&&("start"===n.type?l.unshift(this._getLoadingGroup()):"end"===n.type&&l.push(this._getLoadingGroup())),n=l.slice(),r=t,"start"===i&&n.reverse(),o=this.options.appliedItemChecker,t=this.groupItems,s=this.getComputedOutlineLength(t),a=this.getComputedOutlineSize(t),u=this.itemRenderer,c=[],n.forEach(function(e){var t=e.grid,n=t.getItems(),e=e.type===S.VIRTUAL&&!n[0],n=(c="end"===i?f(f([],c,!0),n,!0):f(f([],n,!0),c,!0),t.outlineLength=s,t.outlineSize=a,c.filter(function(e){return e.mountState!==O.UNCHECKED&&e.rect.width||u.updateItem(e,!0),e.orgRect.width&&e.rect.width||o(e,t)})),e=e?h._applyVirtualGrid(t,i,r):n.length?t.applyGrid(n,i,r):{start:f([],r,!0),end:f([],r,!0)};t.setOutlines(e),r=e.passed||e[i],c=null!=(e=null==(n=e.passedItems)?void 0:n.map(function(e){return c[e]}))?e:[]}),{start:l[0].grid.getOutlines().start,end:l[l.length-1].grid.getOutlines().end}):{start:[],end:[]}},t.syncItems=function(e){var o=this,t=this.itemKeys,e=(this.itemKeys={},this._syncItemInfos(e.map(function(e){var t,n=e,i={};for(t in n)t in Be&&(i[t]=n[t]);return i}),t)),s=this.groupKeys,t=et(e),e=this._splitVirtualGroups("start",t),n=this._splitVirtualGroups("end",t),e=(t=f(f(f([],e,!0),this._mergeVirtualGroups(t),!0),n,!0)).map(function(e){var t=e.groupKey,e=e.items,n=!e[0]||e[0].type===P.VIRTUAL,i=null!=(i=null==(i=s[t])?void 0:i.grid)?i:o._makeGrid(),r=n?e:e.filter(function(e){return e.type===P.NORMAL});return i.setItems(r),{type:n?S.VIRTUAL:S.NORMAL,groupKey:t,grid:i,items:r,renderItems:e}});this._registerGroups(e)},t.renderItems=function(e){var t;return(e=void 0===e?{}:e).useResize&&(this.groupItems.forEach(function(e){e.updateState=g.NEED_UPDATE}),t=this._getLoadingItem())&&(t.updateState=g.NEED_UPDATE),r.prototype.renderItems.call(this,e)},t.setCursors=function(e,t){this.startCursor=e,this.endCursor=t,this.items=this._getRenderingItems()},t.getStartCursor=function(){return this.startCursor},t.getEndCursor=function(){return this.endCursor},t.getGroupStatus=function(e,t){var n,i=this.startCursor,r=this.endCursor,o=this.groups,s=o[i],a=o[r],u=i,c=r,h=e===z.MINIMIZE_INVISIBLE_ITEMS,l=e===z.MINIMIZE_INVISIBLE_GROUPS;if(e===z.REMOVE_INVISIBLE_GROUPS)n=this.getVisibleGroups(t),c=n.length-1,u=0;else if(n=this.getGroups(t),!t){for(var u=-1,c=-1,f=i;f<=r;++f)if((d=o[f])&&d.type!==S.VIRTUAL){u=n.indexOf(d);break}for(var d,f=r;i<=f;--f)if((d=o[f])&&d.type!==S.VIRTUAL){c=n.lastIndexOf(d);break}}var e=n.map(function(e,t){var n=e.grid,e=e.groupKey,t=t<u||c<t,i=h&&t,t=l&&t,r=n.getItems(),r=t?[]:r.map(function(e){return i?e.getVirtualStatus():e.getMinimizedStatus()});return{type:t||i?S.VIRTUAL:S.NORMAL,groupKey:e,outlines:n.getOutlines(),items:r}}),t=this.getGroupItems(),p=t.indexOf(null==s?void 0:s.items[0]),t=t.indexOf(null==a?void 0:a.items.slice().reverse()[0]);return{cursors:[u,c],orgCursors:[i,r],itemCursors:[p,t],startGroupKey:null==s?void 0:s.groupKey,endGroupKey:null==a?void 0:a.groupKey,groups:e,outlines:this.outlines}},t.fitOutlines=function(e){void 0===e&&(e=this.useFit);var t,i,n=this.groups;n[0]&&(t=this.outlines.start,i=t.length?Math.min.apply(Math,t):0,!e&&0<i||(n.forEach(function(e){var e=e.grid,t=e.getOutlines(),n=t.start,t=t.end;e.setOutlines({start:n.map(function(e){return e-i}),end:t.map(function(e){return e-i})})}),this.groupItems.forEach(function(e){var t=e.cssContentPos;Xe(t)&&(e.cssContentPos=t-i)})))},t.setGroupStatus=function(e){var o=this,s=(this.itemKeys={},this.groupItems=[],this.items=[],this.groupKeys),t=e.groups.map(function(e){var t=e.type,n=e.groupKey,i=e.items,e=e.outlines,i=o._syncItemInfos(i),r=null!=(r=null==(r=s[n])?void 0:r.grid)?r:o._makeGrid();return r.setOutlines(e),r.setItems(i),{type:t,groupKey:n,grid:r,items:i,renderItems:i}});this.setOutlines(e.outlines),this._registerGroups(t),this._updatePlaceholder(),this.setCursors(e.cursors[0],e.cursors[1])},t.appendPlaceholders=function(e,t){return this.insertPlaceholders("end",e,t)},t.prependPlaceholders=function(e,t){return this.insertPlaceholders("start",e,t)},t.removePlaceholders=function(e){var t,n,i=this.groups,r=i.length;"start"===e?(n=x(i,function(e){return e.type===S.NORMAL}),i.splice(0,n)):"end"===e?(n=ut(i,function(e){return e.type===S.NORMAL}),i.splice(n+1,r-n-1)):(t=e.groupKey,-1<(n=x(i,function(e){return e.groupKey===t}))&&i.splice(n,1)),this.syncItems(ht(this.getGroups()))},t.insertPlaceholders=function(e,t,n){void 0===n&&(n=rt(this.groupKeys,"virtual_"));var i=[],t=(Xe(t)?i=function(e){for(var t=[],n=0;n<e;++n)t.push(n);return t}(t).map(function(){return{type:P.VIRTUAL,groupKey:n}}):Array.isArray(t)&&(i=t.map(function(e){return I(I({groupKey:n},e),{type:P.VIRTUAL})})),this._makeGrid()),i=this._syncItemInfos(i,this.itemKeys),t=(this._updatePlaceholder(i),t.setItems(i),{type:S.VIRTUAL,groupKey:n,grid:t,items:i,renderItems:i});return this.groupKeys[n]=t,"end"===e?(this.groups.push(t),(e=this.groupItems).push.apply(e,i)):(this.groups.splice(0,0,t),(e=this.groupItems).splice.apply(e,f([0,0],i,!1)),-1<this.startCursor&&(++this.startCursor,++this.endCursor)),{group:t,items:i}},t.shouldRerenderItems=function(){var n=!1;return this.getVisibleGroups().forEach(function(e){var t=e.items;t.length===e.renderItems.length||t.every(function(e){return e.mountState===O.UNCHECKED})||(n=!0,e.renderItems=f([],t,!0))}),n&&(this.items=this._getRenderingItems()),n},t._updateItems=function(e){this.itemRenderer.updateEqualSizeItems(e,this.groupItems)},t._getGroupItems=function(){return ht(this.getGroups(!0))},t._getRenderingItems=function(){var e=Je(this.getVisibleGroups(!0).map(function(e){return e.renderItems})),t=this._loadingGrid,n=t.getLoadingItem();return n&&("end"===t.type?e.push(n):"start"===t.type&&e.unshift(n)),e},t._checkShouldRender=function(e){var t,n=this.options.gridConstructor,i=this.gridOptions,r=n.propertyTypes;for(t in i)if(!(t in e)&&r[t]===c.RENDER_PROPERTY)return!0;for(t in e)if(i[t]!==e[t]&&r[t]===c.RENDER_PROPERTY)return!0;return!1},t._applyVirtualGrid=function(e,t,n){var i=n.length?f([],n,!0):[0],n=e.getOutlines(),e=n["end"===t?"start":"end"];return e.length!==i.length||e.some(function(e,t){return e!==i[t]})?{start:f([],i,!0),end:f([],i,!0)}:n},t._syncItemInfos=function(e,r){void 0===r&&(r={});var o=this.options.horizontal,s=this.itemKeys;return e.filter(function(e){return null!=e.key}).forEach(function(e){var t=e.key,n=r[t];n?n.type===P.VIRTUAL&&e.type!==P.VIRTUAL?s[t]=new _(o,I({orgRect:n.orgRect,rect:n.rect},e)):(e.data&&(n.data=e.data),null!=e.groupKey&&(n.groupKey=e.groupKey),e.element&&(n.element=e.element),s[t]=n):s[t]=new _(o,I({},e))}),e.map(function(e){var t,n=e.key,i=(null==e.key&&(n=rt(s,e.type===P.VIRTUAL?"virtual_":"")),s[n]);return i||((t=r[n])?(i=t,e.data&&(i.data=e.data),e.element&&(i.element=e.element)):i=new _(o,I(I({},e),{key:n})),s[n]=i),i})},t._registerGroups=function(e){var t={};e.forEach(function(e){t[e.groupKey]=e}),this.groups=e,this.groupKeys=t,this.groupItems=this._getGroupItems()},t._splitVirtualGroups=function(e,t){var e=nt(this.groups,e,t),n=this.itemKeys;return e.forEach(function(e){e.renderItems.forEach(function(e){n[e.key]=e})}),e},t._mergeVirtualGroups=function(e){var i=this.itemKeys,r=this.groupKeys;return e.forEach(function(e){var t,n=r[e.groupKey];n&&(t=e.items).every(function(e){return e.mountState===O.UNCHECKED})&&n.renderItems.forEach(function(e){e.type!==P.VIRTUAL||i[e.key]||(t.push(e),i[e.key]=e)})}),e},t._updatePlaceholder=function(e){void 0===e&&(e=this.groupItems);var o=this._placeholder;o&&e.filter(function(e){return e.type===P.VIRTUAL}).forEach(function(e){var t,n=e,i=o;for(t in i){var r=i[t];n[t]="object"==typeof r?I(I({},n[t]),r):i[t]}})},t._makeGrid=function(){var e=this.options.gridConstructor,t=this.gridOptions;return new e(this.containerElement,I(I({},t),{useFit:!1,autoResize:!1,useResizeObserver:!1,observeChildren:!1,renderOnPropertyChange:!1,externalContainerManager:this.containerManager,externalItemRenderer:this.itemRenderer}))},t._getLoadingGroup=function(){var e=this._loadingGrid,t=e.getItems();return{groupKey:"__INFINITEGRID__LOADING_GRID",type:S.NORMAL,grid:e,items:t,renderItems:t}},t._getLoadingItem=function(){return this._loadingGrid.getLoadingItem()},e.defaultOptions=I(I({},v.defaultOptions),{appliedItemChecker:function(){return!1},gridConstructor:null,gridOptions:{}}),e.propertyTypes=I(I({},v.propertyTypes),{gridConstructor:c.PROPERTY,gridOptions:c.PROPERTY}),n([y],e)}(v);function gt(e){var t,n;return e.length?(t=1/0,n=-1/0,e.forEach(function(e){t=Math.min(t,e.pos),n=Math.max(n,e.pos+e.size)},0),(t+n)/2):0}var mt,yt=function(n){function e(e){var t=n.call(this)||this;return t.startCursor=-1,t.endCursor=-1,t.size=0,t.items=[],t.itemKeys={},t.options=I({threshold:0,useRecycle:!0,defaultDirection:"end",isReachStart:!1,isReachEnd:!1},e),t}o(e,n);var t=e.prototype;return Object.defineProperty(t,"isReachStart",{set:function(e){this.options.isReachStart=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"isReachEnd",{set:function(e){this.options.isReachEnd=e},enumerable:!1,configurable:!0}),t.scroll=function(n){var e=this.startCursor,t=this.endCursor,i=this.items,r=i.length,o=this.size,s=this.options,a=s.defaultDirection,u=s.threshold,c=s.useRecycle,h=s.isReachEnd,s=s.isReachStart,a="end"===a;if(!r)return(!s||!h)&&(f="",!h&&a?f="requestAppend":s||a?!h&&s?f="requestAppend":h&&!s&&(f="requestPrepend"):f="requestPrepend",f)?void this.trigger(f,{key:void 0,isVirtual:!1}):void 0;if(-1===e||-1===t)this.trigger("change",{prevStartCursor:e,prevEndCursor:t,nextStartCursor:f=a?0:r-1,nextEndCursor:f});else{var l=n+o,f=Math.max.apply(Math,i[e].startOutline),o=Math.min.apply(Math,i[t].endOutline),d=i.map(function(e){var t=e.startOutline,e=e.endOutline;return!(!t.length||!e.length||ct(t,e))&&(t=Math.min.apply(Math,t),e=Math.max.apply(Math,e),t-u<=l)&&n<=e+u}),p=0<e,g=t<r-1,f=n<=f+u,o=o-u<=l,m=d.indexOf(!0),y=d.lastIndexOf(!0),d=(-1===m&&(m=e,y=t),c||(m=Math.min(m,e),y=Math.max(y,t)),m===e&&p&&f&&--m,y===t&&g&&o&&(y+=1),i.slice(m,y+1));if(d.every(function(e){return!0===e.isVirtual})){for(var R=!1,v=m-1;0<=v;--v)if(!i[v].isVirtual){m=v,R=!0;break}if(!R)for(v=y+1;v<r;++v)if(!i[v].isVirtual){y=v,R=!0;break}R&&(d=i.slice(m,y+1))}var S,c=d.some(function(e){return!0===e.isVirtual});(e===m&&t===y||(this.trigger("change",{prevStartCursor:e,prevEndCursor:t,nextStartCursor:m,nextEndCursor:y}),c))&&(c?(g=null==(p=d[0])?void 0:p.isVirtual,p=null==(c=d[d.length-1])?void 0:c.isVirtual,a&&o||!g?!a&&f||!p||d[c=(S=ut(d,function(e){return!e.isVirtual}))+1]&&this.trigger("requestAppend",{key:-1<S?d[S].key:void 0,nextKey:d[c].key,nextKeys:d.slice(c).map(function(e){return e.key}),isVirtual:!0}):d[g=(-1===(S=x(d,function(e){return!e.isVirtual}))?d.length:S)-1]&&this.trigger("requestPrepend",{key:-1<S?d[S].key:void 0,nextKey:d[g].key,nextKeys:d.slice(0,1+g).map(function(e){return e.key}),isVirtual:!0})):this._requestVirtualItems()||(a&&o&&!h||!f||s?!a&&f&&!s||!o||h||this.trigger("requestAppend",{key:i[t].key,isVirtual:!1}):this.trigger("requestPrepend",{key:i[e].key,isVirtual:!1})))}},t._requestVirtualItems=function(){var e="end"===this.options.defaultDirection,t=this.items,n=this.getVisibleItems(),i=n.filter(function(e){return!e.isVirtual}),r=n.length,o=i.length,s=this.getStartCursor(),a=this.getEndCursor();if(o!==r)if(o){var u=i[0].key,c=i[o-1].key,i=x(t,function(e){return e.key===u})-1,o=x(t,function(e){return e.key===c})+1,a=o<=a,s=s<=i;if((e||!s)&&a)return this.trigger("requestAppend",{key:c,nextKey:t[o].key,isVirtual:!0}),!0;if((!e||!a)&&s)return this.trigger("requestPrepend",{key:u,nextKey:t[i].key,isVirtual:!0}),!0}else if(r)return o=n[r-1],e?this.trigger("requestAppend",{nextKey:n[0].key,isVirtual:!0}):this.trigger("requestPrepend",{nextKey:o.key,isVirtual:!0}),!0;return!1},t.setCursors=function(e,t){this.startCursor=e,this.endCursor=t},t.setSize=function(e){this.size=e},t.getStartCursor=function(){return this.startCursor},t.getEndCursor=function(){return this.endCursor},t.isLoading=function(e){var t=this.startCursor,n=this.endCursor,i=this.items,r=i[t],o=i[n],i=i.length;return!(e===b.END&&-1<n&&n<i-1&&!o.isVirtual&&!ct(o.startOutline,o.endOutline)||e===b.START&&0<t&&!r.isVirtual&&!ct(r.startOutline,r.endOutline))},t.setItems=function(e){this.items=e;var t={};e.forEach(function(e){t[e.key]=e}),this.itemKeys=t},t.syncItems=function(e){var t=this.items,n=this.startCursor,i=this.endCursor,r=tt(this.items.map(function(e){return e.key}),e.map(function(e){return e.key}),n,i),o=r.startCursor,r=r.endCursor,s=r-o!=i-n||-1===n||-1===o,a=(s||(s=0<(t=q(t.slice(n,i+1),e.slice(o,r+1),function(e){return e.key})).added.length||0<t.removed.length||0<t.changed.length),this.options.defaultDirection),u=[],n=f([],e,!0);return"start"===a&&n.reverse(),n.forEach(function(e,t){0<t&&u.length&&("start"===a?(e.endOutline.length||(e.endOutline=f([],u,!0)),e.startOutline.length||(e.startOutline=f([],e.endOutline,!0))):(e.startOutline.length||(e.startOutline=f([],u,!0)),e.endOutline.length||(e.endOutline=f([],e.startOutline,!0)))),u="start"===a?e.startOutline:e.endOutline}),this.setItems(e),this.setCursors(o,r),s},t.getItems=function(){return this.items},t.getVisibleItems=function(){var e=this.startCursor,t=this.endCursor;return-1===e?[]:this.items.slice(e,t+1)},t.getSize=function(){return this.size},t.getItemByKey=function(e){return this.itemKeys[e]},t.getItemPartByKey=function(n){var i;return this.items.forEach(function(e,t){null!=(e=e.parts)&&e.forEach(function(e){e.key===n&&(i={itemIndex:t,part:e})})}),i},t.getScrollSize=function(){var e=this.items,t=e.length;return t?Math.max.apply(Math,f([0],e[t-1].endOutline,!1)):0},t.getVisibleAreaByParts=function(e){var t,n,i=this,e=e.map(function(e){return i.getItemPartByKey(e.key)}).filter(Boolean);return e.length?(t=1/0,n=-1,e.forEach(function(e){t=Math.min(e.itemIndex,t),n=Math.min(e.itemIndex,n)}),{parts:e=e.map(function(e){return e.part}),centerPos:gt(e),startCursor:t,endCursor:n}):null},t.getVisibleArea=function(e){var i,t,n,r,o=this.items,s=e+this.size/2,e=this.getRenderedVisibleItems();return e.length&&(i=[],e.forEach(function(n){var e;null!=(e=n.parts)&&e.filter(function(e){return e.pos!==M}).forEach(function(e){var t=e.pos+e.size/2,t=Math.abs(s-t);i.push([t,{part:e,itemIndex:o.findIndex(function(e){return e.key===n.key})}])})}),t=0,e.forEach(function(e){t=Math.max(t,e.startOutline.length)}),t)&&(e=i.sort(function(e,t){return e[0]-t[0]}).slice(0,t).map(function(e){return e[1]})).length?(r=gt(n=e.map(function(e){return e.part})),e=e.map(function(e){return e.itemIndex}),{centerStartIndex:Math.min.apply(Math,e),centerEndIndex:Math.max.apply(Math,e),parts:n,centerPos:r}):null},t.getRenderedVisibleItems=function(){var e=this.getVisibleItems(),t=e.map(function(e){var t=e.startOutline,n=e.endOutline,e=t.length;return 0!==e&&e===n.length&&t.some(function(e,t){return n[t]!==e})}),n=t.indexOf(!0),t=t.lastIndexOf(!0);return-1===t?[]:e.slice(n,t+1)},t.destroy=function(){this.off(),this.startCursor=-1,this.endCursor=-1,this.items=[],this.size=0},e}(i),e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.items=[],e.container=null,e.rendererKey=0,e._updateTimer=0,e._state={},e._isItemChanged=!1,e}o(e,t);var n=e.prototype;return n.updateKey=function(){this.rendererKey=Date.now()},n.getItems=function(){return this.items},n.setContainer=function(e){this.container=e},n.render=function(e,t){return this.syncItems(e,t)},n.update=function(e){var t=this;void 0===e&&(e={}),this._state=I(I({},this._state),e),this.trigger("update",{state:e}),clearTimeout(this._updateTimer),this._updateTimer=window.setTimeout(function(){t.trigger("requestUpdate",{state:e})})},n.updated=function(n){void 0===n&&(n=null!=(e=null==(e=this.container)?void 0:e.children)?e:[]);var e=this._diffResult,t=!!(e.added.length||e.removed.length||e.changed.length),i=this._state,r=this._isItemChanged,e=e.list;return this._isItemChanged=!1,this._state={},(this.items=e).forEach(function(e,t){e.element=n[t]}),this.trigger("updated",{items:e,elements:at(n),diffResult:this._diffResult,state:i,isItemChanged:r,isChanged:t}),t},n.syncItems=function(e,t){void 0===t&&(t={});var n=this.rendererKey,e=q(this.items,e.map(function(e){return I(I({},e),{renderKey:"".concat(n,"_").concat(e.key)})}),function(e){return e.renderKey});return this._isItemChanged=!!e.added.length||!!e.removed.length||!!e.changed.length,this._state=I(I({},this._state),t),this._diffResult=e},n.destroy=function(){this.off()},e}(i),Rt=function(r){function e(){return null!==r&&r.apply(this,arguments)||this}return o(e,r),e.prototype.syncItems=function(n){var e=r.prototype.syncItems.call(this,n),t=e.added,i=e.list;return t.forEach(function(e){var t=n[e].orgItem;t.html&&!t.element&&(t.element=ot(t.html)[0]),i[e].element=t.element}),e},e}(function(u){function e(){return null!==u&&u.apply(this,arguments)||this}return o(e,u),e.prototype.render=function(e,t){var n=this.container,e=u.prototype.render.call(this,e,t),i=e.prevList,t=e.removed,r=e.ordered,o=e.added,s=e.list,a=f([],i,!0);return t.forEach(function(e){a.splice(e,1),n.removeChild(i[e].element)}),r.forEach(function(e){var t=e[0],e=e[1],t=a.splice(t,1)[0];a.splice(e,0,t),n.insertBefore(t.element,null!=(e=null==(t=a[e+1])?void 0:t.element)?e:null)}),o.forEach(function(e){var t=s[e];a.splice(e,0,t),n.insertBefore(t.element,null!=(e=null==(t=a[e+1])?void 0:t.element)?e:null)}),this.updated(n.children),e},e}(e)),vt=function(i){function e(e,t){var n=i.call(this)||this;return n.wrapper=e,n.prevScrollPos=null,n.scrollOffset=0,n.contentSize=0,n._isScrollIssue=Fe,n._onCheck=function(){var e=n.getScrollPos(),t=n.getOrgScrollPos();n.setScrollPos(t),null===e||n._isScrollIssue&&0===t||e===t?t&&(n._isScrollIssue=!1):(n._isScrollIssue=!1,n.trigger(new C("scroll",{direction:e<t?"end":"start",scrollPos:t,relativeScrollPos:n.getRelativeScrollPos()})))},n.options=I({container:!1,containerTag:"div",horizontal:!1,scrollContainer:null},t),n._init(),n}o(e,i);var t=e.prototype;return t.getWrapper=function(){return this.wrapper},t.getContainer=function(){return this.container},t.getScrollContainer=function(){return this.scrollContainer},t.getScrollOffset=function(){return this.scrollOffset},t.getContentSize=function(){return this.contentSize},t.getRelativeScrollPos=function(){return(this.prevScrollPos||0)-this.scrollOffset},t.getScrollPos=function(){return this.prevScrollPos},t.setScrollPos=function(e){this.prevScrollPos=e},t.getOrgScrollPos=function(){var e=this.eventTarget,t=this.options.horizontal,n="scroll".concat(t?"Left":"Top");return Ze(e)?window[t?"pageXOffset":"pageYOffset"]||document.documentElement[n]||document.body[n]:e[n]},t.setStatus=function(e){this.contentSize=e.contentSize,this.scrollOffset=e.scrollOffset,this.prevScrollPos=e.prevScrollPos,this.scrollTo(this.prevScrollPos)},t.getStatus=function(){return{contentSize:this.contentSize,scrollOffset:this.scrollOffset,prevScrollPos:this.prevScrollPos}},t.scrollTo=function(e){var t=this.eventTarget,e=this.options.horizontal?[e,0]:[0,e],n=e[0],e=e[1];Ze(t)?t.scroll(n,e):(t.scrollLeft=n,t.scrollTop=e)},t.scrollBy=function(e){var t,n,i;e&&(t=this.eventTarget,n=(i=this.options.horizontal?[e,0]:[0,e])[0],i=i[1],this.prevScrollPos+=e,Ze(t)?t.scrollBy(n,i):(t.scrollLeft+=n,t.scrollTop+=i))},t.resize=function(){var e=this.scrollContainer,t=this.options.horizontal,n=e===document.body,i=n?{top:0,left:0}:e.getBoundingClientRect(),r=this.container.getBoundingClientRect(),o=this.getRelativeScrollPos(),s=this.contentSize,a=this.getOrgScrollPos()||0;return this.setScrollPos(a),this.scrollOffset=a+(t?r.left-i.left:r.top-i.top),this.contentSize=n?t?window.innerWidth:window.innerHeight:t?e.offsetWidth:e.offsetHeight,this.getRelativeScrollPos()!==o||s!==this.contentSize},t.destroy=function(){var e,t,n,i=this.container;this.eventTarget.removeEventListener("scroll",this._onCheck),this._isCreateElement?(e=this.scrollContainer,t=document.createDocumentFragment(),n=at(i.childNodes),e.removeChild(i),n.forEach(function(e){t.appendChild(e)}),e.appendChild(t)):this.options.container&&(i.style.cssText=this._orgCSSText)},t._init=function(){var e=this.options,t=e.container,n=e.containerTag,i=e.horizontal,e=e.scrollContainer,r=this.wrapper,o=r,s=r,r="",n=(t?(!0===t?((s=document.createElement(n)).style.position="relative",s.className=je,at(o.childNodes).forEach(function(e){s.appendChild(e)}),o.appendChild(s),this._isCreateElement=!0):s=He(t),r=s.style.cssText,(n=o.style).overflowX=(t=i?["scroll","hidden"]:["hidden","scroll"])[0],n.overflowY=t[1],i&&(s.style.height="100%")):(o=He(e)||document.body,r=s.style.cssText),o===document.body?window:o);n.addEventListener("scroll",this._onCheck),this._orgCSSText=r,this.container=s,this.scrollContainer=o,this.eventTarget=n,this.resize()},e}(i),w=function(_){function e(e,t){var l=_.call(this)||this,t=(l._waitType="",l._onScroll=function(e){var t=e.direction,n=e.scrollPos,e=e.relativeScrollPos;l._scroll(),l.trigger(new C(T.CHANGE_SCROLL,{direction:t,scrollPos:n,relativeScrollPos:e}))},l._onChange=function(e){l.setCursors(e.nextStartCursor,e.nextEndCursor)},l._onRendererUpdated=function(e){var t,n,r,o,i,s,a;e.items.forEach(function(e){e.orgItem.element=e.element}),e.isChanged?(t=(i=e.diffResult).added,a=i.removed,n=i.prevList,r=i.list,a.forEach(function(e){e=n[e].orgItem;e.mountState!==O.UNCHECKED&&(e.mountState=O.UNMOUNTED,l.options.useDetachedRecycle)&&(e.element=null)}),o=l.options.horizontal,i=t.map(function(e){var t,n,e=r[e].orgItem,i=e.element;return e.type===P.VIRTUAL?(t=I({},e.cssRect),n=e.rect,!t.width&&n.width&&(t.width=n.width),!t.height&&n.height&&(t.height=n.height),new be(o,{element:i,cssRect:t})):e}),s=l.containerManager,l.options.observeChildren&&(s.unobserveChildren(a.map(function(e){return n[e].element})),s.observeChildren(t.map(function(e){return r[e].element}))),s=(a=e.state).isRestore,a=a.isResize,l.itemRenderer.renderItems(i),s&&l._onRenderComplete({mounted:t.map(function(e){return r[e].orgItem}),updated:[],isResize:!1,direction:l.defaultDirection}),s&&!a&&!e.isItemChanged||l.groupManager.renderItems()):(l._checkEndLoading(),l._scroll())},l._onResize=function(e){e.isResizeContainer?l._renderItems({useResize:!0},!0):0<(e=ve(l.getVisibleItems(),e.childEntries)).length&&l.updateItems(e)},l._onRequestAppend=function(e){l._onRequestInsert(b.END,T.REQUEST_APPEND,e)},l._onRequestPrepend=function(e){l._onRequestInsert(b.START,T.REQUEST_PREPEND,e)},l._onContentError=function(e){var t=e.element,n=e.target,i=e.item,e=e.update;l.trigger(new C(T.CONTENT_ERROR,{element:t,target:n,item:i,update:e,remove:function(){l.removeByKey(i.key)}}))},l._onRenderComplete=function(e){var t,n=e.isResize,i=e.mounted,r=e.updated,e=e.direction,o=l.infinite,s=l.scrollManager,a=s.getRelativeScrollPos(),s=s.getScrollPos(),u=o.getScrollSize(),c=o.getSize(),h=o.getVisibleArea(a),a=(l._syncInfinite(),h&&(t=h.parts.filter(function(e){return e.pos!==M}),!(t=o.getVisibleAreaByParts(t))||"end"===e&&0===h.centerStartIndex||(t=t.centerPos-h.centerPos,h=o.getScrollSize(),o=o.getSize(),t<0?(u=Math.max(a-Math.max(0,u-c),0),t+=a-(Math.min(a,Math.max(0,h-o))+u)):0<t&&(c=Math.max(0,h-o),t=Math.max(0,Math.min(c,s+t)-s)),l.scrollManager.scrollBy(t))),i.filter(function(e){return e.type!==P.LOADING})),u=(l.trigger(new C(T.RENDER_COMPLETE,{isResize:n,direction:e,mounted:a,updated:r.filter(function(e){return e.type!==P.LOADING}),startCursor:l.getStartCursor(),endCursor:l.getEndCursor(),items:l.getVisibleItems(!0),groups:l.getVisibleGroups(!0)})),l.groupManager.shouldRerenderItems());(u=a.length||r.length?u||!!l.groupManager.endLoading():u)?l._update():(l._checkEndLoading(),l._scroll())},l.options=I(I(I({},l.constructor.defaultOptions),{renderer:(new Rt).on("requestUpdate",function(){return l._render()})}),t),l.options),n=t.gridConstructor,i=t.containerTag,r=t.container,o=t.renderer,s=t.threshold,a=t.useRecycle,u=t.scrollContainer,c=t.appliedItemChecker,t=L(t,["gridConstructor","containerTag","container","renderer","threshold","useRecycle","scrollContainer","appliedItemChecker"]),h=t.horizontal,f=t.attributePrefix,d=t.useTransform,p=t.percentage,g=t.isConstantSize,m=t.isEqualSize,y=t.autoResize,R=t.useResizeObserver,v=t.resizeDebounce,S=t.maxResizeDebounce,z=t.defaultDirection,E=t.useRoundedSize,e=Qe(e)?document.querySelector(e):e,u=new vt(e,{scrollContainer:u,container:r,containerTag:i,horizontal:h}).on({scroll:l._onScroll}),r=u.getContainer(),i=new Oe(r,{horizontal:h,autoResize:y,resizeDebounce:v,maxResizeDebounce:S,useResizeObserver:R}).on("resize",l._onResize),y=new Pe({attributePrefix:f,horizontal:h,useTransform:d,percentage:p,isEqualSize:m,isConstantSize:g,useRoundedSize:E}),v=new yt({defaultDirection:z,useRecycle:a,threshold:s}).on({change:l._onChange,requestAppend:l._onRequestAppend,requestPrepend:l._onRequestPrepend}),S=(v.setSize(u.getContentSize()),new pt(r,{appliedItemChecker:c,gridConstructor:n,externalItemRenderer:y,externalContainerManager:i,gridOptions:t}));return S.on({renderComplete:l._onRenderComplete,contentError:l._onContentError}),o.setContainer(r),o.on("updated",l._onRendererUpdated),l.itemRenderer=y,l.groupManager=S,l.wrapperElement=e,l.scrollManager=u,l.containerManager=i,l.infinite=v,l.containerManager.resize(),l}o(e,_);var t=e.prototype;return t.renderItems=function(e){return this._renderItems(e=void 0===e?{}:e),this},t.getWrapperElement=function(){return this.scrollManager.getWrapper()},t.getScrollContainerElement=function(){return this.scrollManager.getScrollContainer()},t.getContainerElement=function(){return this.scrollManager.getContainer()},t.syncItems=function(e){return this.groupManager.syncItems(e),this._syncGroups(),this},t.setCursors=function(e,t,n){return this.groupManager.setCursors(e,t),this.infinite.setCursors(e,t),n?(this.getVisibleItems().forEach(function(e){e.cssRect.top===M&&(e.cssRect={})}),this._syncItems()):(this._update(),this._checkEndLoading()),this},t.getStartCursor=function(){return this.infinite.getStartCursor()},t.getEndCursor=function(){return this.infinite.getEndCursor()},t.append=function(e,t){return this.insert(-1,e,t)},t.prepend=function(e,t){return this.insert(0,e,t)},t.insert=function(e,t,n){var i=this.groupManager.getGroupItems(),t=st(t,n);return-1===e?i.push.apply(i,t):i.splice.apply(i,f([e,0],t,!1)),this.syncItems(i)},t.insertByGroupIndex=function(e,t,n){var i,r,e=this.groupManager.getGroups()[e];return e?(i=this.groupManager.getGroupItems(),r=e.groupKey,e=x(i,function(e){return e.groupKey===r}),this.insert(e,t,n)):this.append(t,n)},t.getStatus=function(e,t){return{containerManager:this.containerManager.getStatus(),itemRenderer:this.itemRenderer.getStatus(),groupManager:this.groupManager.getGroupStatus(e,t),scrollManager:this.scrollManager.getStatus()}},t.setPlaceholder=function(e){return this.groupManager.setPlaceholder(e),this},t.setLoading=function(e){return this.groupManager.setLoading(e),this},t.appendPlaceholders=function(e,t){var n=this,i=this.groupManager.appendPlaceholders(e,t);return this._syncGroups(!0),I(I({},i),{remove:function(){n.removePlaceholders({groupKey:i.group.groupKey})}})},t.prependPlaceholders=function(e,t){var n=this,i=this.groupManager.prependPlaceholders(e,t);return this._syncGroups(!0),I(I({},i),{remove:function(){n.removePlaceholders({groupKey:i.group.groupKey})}})},t.removePlaceholders=function(e){this.groupManager.removePlaceholders(e),this._syncGroups(!0)},t.setStatus=function(e,t){this.itemRenderer.setStatus(e.itemRenderer),this.containerManager.setStatus(e.containerManager),this.scrollManager.setStatus(e.scrollManager);var n=this.groupManager,i=this.containerManager.getInlineSize(),e=(n.setGroupStatus(e.groupManager),this._syncInfinite(),this.infinite.setCursors(n.getStartCursor(),n.getEndCursor()),this._getRenderer().updateKey(),{isResize:this.containerManager.getInlineSize()!==i,isRestore:!0});return t?this._syncItems(e):this._update(e),this},t.removeGroupByIndex=function(e){var t=this.getGroups();return this.removeGroupByKey(t[e].groupKey)},t.removeGroupByKey=function(t){var e=this.getItems(),n=x(e,function(e){return e.groupKey===t}),i=ut(e,function(e){return e.groupKey===t});return-1===n?this:(e.splice(n,i-n+1),this.syncItems(e))},t.removeByIndex=function(e){var t=this.getItems(!0);return t.splice(e,1),this.syncItems(t)},t.removeByKey=function(t){var e=x(this.getItems(!0),function(e){return e.key===t});return this.removeByIndex(e)},t.updateItems=function(e,t){return this.groupManager.updateItems(e,t=void 0===t?{}:t),this},t.getItems=function(e){return this.groupManager.getGroupItems(e)},t.getVisibleItems=function(e){return this.groupManager.getVisibleItems(e)},t.getRenderingItems=function(){return this.groupManager.getRenderingItems()},t.getGroups=function(e){return this.groupManager.getGroups(e)},t.getVisibleGroups=function(e){return this.groupManager.getVisibleGroups(e)},t.wait=function(e){this._waitType=e=void 0===e?b.END:e,this._checkStartLoading(e)},t.ready=function(e){this._waitType="",e&&(this.groupManager.waitEndLoading(),this.groupManager.endLoading())&&this._update()},t.isWait=function(){return!!this._waitType},t.resizeScroll=function(){this._resizeScroll()&&this._scroll()},t.destroy=function(){this.off(),this._getRenderer().destroy(),this.containerManager.destroy(),this.groupManager.destroy(),this.scrollManager.destroy(),this.infinite.destroy()},t._getRenderer=function(){return this.options.renderer},t._getRendererItems=function(){return this.getRenderingItems().map(function(e){return{element:e.element,key:"".concat(e.type,"_").concat(e.key),orgItem:e}})},t._setIsReachStart=function(e){this.options.isReachStart=e,this.infinite.isReachStart=e},t._setIsReachEnd=function(e){this.options.isReachEnd=e,this.infinite.isReachEnd=e},t._syncItems=function(e){this._getRenderer().syncItems(this._getRendererItems(),e)},t._render=function(e){this._getRenderer().render(this._getRendererItems(),e)},t._update=function(e){void 0===e&&(e={}),this._getRenderer().update(e)},t._resizeScroll=function(){var e=this.scrollManager,t=e.resize();return this.infinite.setSize(e.getContentSize()),t},t._syncGroups=function(e){var t=this.infinite;this.scrollManager.getContentSize()||this._resizeScroll(),this._syncInfinite(),this.groupManager.setCursors(t.getStartCursor(),t.getEndCursor()),e?this._update():this._render()},t._syncInfinite=function(){this.infinite.syncItems(this.getGroups(!0).map(function(e){var t=e.groupKey,n=e.grid,e=e.type,i=n.getOutlines();return{key:t,isVirtual:e===S.VIRTUAL,startOutline:i.start,endOutline:i.end,parts:n.getItems().map(function(e){return{key:e.key,pos:e.computedContentPos,size:e.computedContentSize}})}}))},t._scroll=function(){this.infinite.scroll(this.scrollManager.getRelativeScrollPos())},t._onRequestInsert=function(e,t,n){var i=this;this._waitType?this._checkStartLoading(this._waitType):this.trigger(new C(t,{groupKey:n.key,nextGroupKey:n.nextKey,nextGroupKeys:n.nextKeys||[],isVirtual:n.isVirtual,reachStart:function(){i._setIsReachStart(!0),i._scroll()},reachEnd:function(){i._setIsReachEnd(!0),i._scroll()},wait:function(){i.wait(e)},ready:function(e){i.ready(e)}}))},t._renderItems=function(e,t){return void 0===e&&(e={}),!t&&e.useResize&&this.containerManager.resize(),this._resizeScroll(),this.getRenderingItems().length?this.getVisibleGroups(!0).length?this.groupManager.renderItems(e):this.setCursors(0,0):0<(t=at(this.getContainerElement().children)).length?(this.groupManager.syncItems(st(t)),this._syncInfinite(),this.setCursors(0,0,!0),this._getRenderer().updated()):this.infinite.scroll(0),this},t._checkStartLoading=function(e){var t=this.groupManager,n=this.infinite;!t.getLoadingType()&&n.isLoading(e)&&t.startLoading(e)&&t.hasLoadingItem()&&this._update()},t._checkEndLoading=function(){var e=this.groupManager,t=this.groupManager.getLoadingType();!t||this._waitType&&this.infinite.isLoading(t)||!e.waitEndLoading()||!e.hasLoadingItem()||this._update()},e.defaultOptions=I(I({},h),{container:!1,containerTag:"div",renderer:null,threshold:100,useRecycle:!0,useDetachedRecycle:!1,scrollContainer:null,isReachStart:!1,isReachEnd:!1,appliedItemChecker:function(){return!1}}),e.infinitegridTypes={isReachEnd:c.PROPERTY,isReachStart:c.PROPERTY},e.propertyTypes=qe,n([it],e)}(i),St={__proto__:null,default:w,withInfiniteGridMethods:ft,getRenderingItems:function(e,t){var n,i,r,o,s=t.status,a=t.usePlaceholder,u=t.useLoading,c=t.horizontal,h=t.useFirstRender,t=t.grid,l=[];return t?(t.setPlaceholder(a?{}:null),t.setLoading(u?{}:null),t.syncItems(e),l=t.getRenderingItems()):s?(u=s.groupManager,t=e,s=!!a,i=!!c,a=u.groups,t=et(t),r=nt(a,"start",t),o=nt(a,"end",t),r=f(f(f([],r,!0),t,!0),o,!0),o=(t=tt(a.map(function(e){return e.groupKey}),r.map(function(e){return e.groupKey}),u.cursors[0],u.cursors[1])).startCursor,a=t.endCursor,u=Je(r.slice(o,a+1).map(function(e){return e.items.map(function(e){return new _(i,I({},e))})})),l=u=s?u:u.filter(function(e){return e.type!==P.VIRTUAL})):h&&(n=!!c,l=(t=et(t=e))[0]?t[0].items.map(function(e){return new _(n,I({},e))}):[]),l},mountRenderingItems:function(e,t){var n=t.grid,i=t.usePlaceholder,r=t.useLoading,o=t.useFirstRender,t=t.status;n&&(i&&n.setPlaceholder({}),r&&n.setLoading({}),t&&n.setStatus(t,!0),n.syncItems(e),o)&&!t&&n.getGroups().length&&n.setCursors(0,0,!0)},InfiniteGridItem:_,MasonryInfiniteGrid:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyTypes=I(I({},w.propertyTypes),Me.propertyTypes),t.defaultOptions=I(I(I({},w.defaultOptions),Me.defaultOptions),{gridConstructor:Me,appliedItemChecker:function(e,t){return(parseFloat(e.attributes.column)||0)>=t.outlineLength}}),n([it],t)}(w),JustifiedInfiniteGrid:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyTypes=I(I({},w.propertyTypes),Ne.propertyTypes),t.defaultOptions=I(I(I({},w.defaultOptions),Ne.defaultOptions),{gridConstructor:Ne}),n([it],t)}(w),FrameInfiniteGrid:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyTypes=I(I({},w.propertyTypes),Ve.propertyTypes),t.defaultOptions=I(I(I({},w.defaultOptions),Ve.defaultOptions),{gridConstructor:Ve}),n([it],t)}(w),PackingInfiniteGrid:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyTypes=I(I({},w.propertyTypes),Ue.propertyTypes),t.defaultOptions=I(I(I({},w.defaultOptions),Ue.defaultOptions),{gridConstructor:Ue}),n([it],t)}(w),Renderer:e,IS_IOS:Fe,CONTAINER_CLASS_NAME:je,IGNORE_PROPERITES_MAP:Ye,INFINITEGRID_PROPERTY_TYPES:qe,DIRECTION:b,INFINITEGRID_EVENTS:T,ITEM_INFO_PROPERTIES:Be,INFINITEGRID_METHODS:t,get GROUP_TYPE(){return S},get ITEM_TYPE(){return P},get STATUS_TYPE(){return z},INVISIBLE_POS:M};for(mt in St)w[mt]=St[mt];return w});
//# sourceMappingURL=infinitegrid.min.js.map