UNPKG

92.3 kBJavaScriptView Raw
1/*
2Copyright (c) NAVER Corp.
3name: @egjs/infinitegrid
4license: MIT
5author: NAVER Corp.
6repository: https://github.com/naver/egjs-infinitegrid
7version: 4.11.1
8*/
9!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(){"use strict";var k=function(e,t){return(k=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}k(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var z=function(){return(z=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 A(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 u=e.length-1;0<=u;u--)(r=e[u])&&(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 d(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 G(){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 u(e){return void 0===e}var K=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 K?t.eventType:t,i=G(this._eventHandler[i]||[]);return i.length<=0||(t instanceof K?(t.currentTarget=this,i.forEach(function(e){e(t)})):i.forEach(function(e){e.apply(void 0,G(n))})),this},t.once=function(n,i){var r,o=this;if("object"==typeof n&&u(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,G(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&&u(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],u(r)&&(this._eventHandler[e]=[],r=this._eventHandler[e]),r.push(t))}return this},t.off=function(e,t){if(u(e))this._eventHandler={};else if(u(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}(),I=K,V=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}(),U=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}(),j="function"==typeof Map,F=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 q=function(){function e(e,t,n,i,r,o,s,u){this.prevList=e,this.list=t,this.added=n,this.removed=i,this.changed=r,this.maintained=o,this.changedBeforeAdded=s,this.fixed=u}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 F;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,u=[];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 u.push([i,t]),!0}),this.cachePureChanged=u},e}();function Y(e,t,n){var i=j?Map:n?U:V,n=n||function(e){return e},r=[],o=[],s=[],u=e.map(n),n=t.map(n),a=new i,c=new i,h=[],l=[],d={},f=[],p=0,g=0;return u.forEach(function(e,t){a.set(e,t)}),n.forEach(function(e,t){c.set(e,t)}),u.forEach(function(e,t){e=c.get(e);void 0===e?(++g,o.push(t)):d[e]=g}),n.forEach(function(e,t){e=a.get(e);void 0===e?(r.push(t),++p):(s.push([e,t]),g=d[t]||0,h.push([e-g,t-p]),l.push(t===e),e!==t&&f.push([e,t]))}),o.reverse(),new q(e,t,r,o,f,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 Y(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 a=function(){return(a=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:"",X=e&&!!("getComputedStyle"in window),Q=/MSIE|Trident|Windows Phone|Edge/.test(t),J=e&&!!("addEventListener"in document),$="width",c="height";function ee(e,t){return e.getAttribute(t)||""}function te(e){return[].slice.call(e)}function ne(e,t){return void 0===t&&(t="data-"),"loading"in e&&"lazy"===e.getAttribute("loading")||!!e.getAttribute(t+"lazy")}function ie(e,t,n){J?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function re(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function oe(e,t){var n=e["client"+t]||e["offset"+t];return parseFloat(n||(n=e,((X?window.getComputedStyle(n):n.currentStyle)||{})[t.toLowerCase()]))||0}function se(e,t,n){var i=te(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,u=o.length;s<u;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 te(e.querySelectorAll("["+n+"width], "+t.join(", "))).filter(function(e){return-1===i.indexOf(e)})}var h=[];function ue(e,t){h.length||ie(window,"resize",ce),e.__PREFIX__=t,h.push(e),ae(e)}function ae(e,t){void 0===t&&(t="data-");var n,t=e.__PREFIX__||t,i=parseInt(ee(e,""+t+$),10)||0,r=parseInt(ee(e,""+t+c),10)||0;ee(e,t+"fixed")===c?(n=oe(e,"Height")||r,e.style[$]=i/r*n+"px"):(n=oe(e,"Width")||i,e.style[c]=r/i*n+"px")}function ce(){h.forEach(function(e){ae(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()||(e=!i.hasDataSize&&!i.hasLoading,i.onReady(e))},i.options=a({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=ne(e,t),i}s(e,r);var t=e.prototype;return t.check=function(){return this.isSkip||!this.checkElement()?(this.onAlreadyReady(!0),!1):(this.hasDataSize&&ue(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){ie(n,e,t.onCheck)})},t.clear=function(){var t=this,n=this.element;this.constructor.EVENTS.forEach(function(e){re(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=h.indexOf(e))<0||(t=ee(e,t+"fixed"),delete e.__PREFIX__,e.style[t===c?$:c]="",h.splice(n,1),h.length)||re(window,"resize",ce))},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(e){this.isReady||((e=!this.isPreReady&&e)&&(this.isPreReady=!0),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(e){var t=this;setTimeout(function(){t.onReady(e)})},e.EVENTS=[],e}(i),he=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(!0),!1):(this.hasDataSize?(ue(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=a({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=te(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,s=this,u=t.tagName.toLowerCase(),a=this.options.loaders,c=e.prefix,h=Object.keys(a);return a[u]?new a[u](t,e):(n=new he(t,e),i=te(t.querySelectorAll(h.join(", "))),n.setHasLoading(i.some(function(e){return ne(e,c)})),r=!1,o=this.clone().on("error",function(e){n.onError(e.target)}).on("ready",function(){n.onReady(r)}),n.on("requestChildren",function(){var e=se(t,h,s.options.prefix);o.check(e).on("preReady",function(e){(r=e.isReady)||n.onPreReady()})}).on("reqeustReadyChildren",function(){o.check(i)}).on("requestDestroy",function(){o.destroy()}),n)},t.clone=function(){return new e(a({},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 I("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 I("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 I("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 I("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 I("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),le=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(),Q&&e.setAttribute("src",t),!0},t.EVENTS=["load","error"],t}(t),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;return!(1<=e.readyState||(e.error?(this.onAlreadyError(e),1):(this.addEvents(),0)))},t.EVENTS=["loadedmetadata","error"],t}(t),fe=function(t){function e(e){return t.call(this,a({loaders:{img:le,video:de}},e=void 0===e?{}:e))||this}return s(e,t),e}(e),pe=function(e,t){return(pe=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}pe(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 l(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 u=e.length-1;0<=u;u--)(r=e[u])&&(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 g(e,t){for(var n=0,i=t.length,r=e.length;n<i;n++,r++)e[r]=t[n];return e}var f,C,m,y={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},ge=((t=f=f||{})[t.PROPERTY=1]="PROPERTY",t[t.RENDER_PROPERTY=2]="RENDER_PROPERTY",(e=C=C||{})[e.UNCHECKED=1]="UNCHECKED",e[e.UNMOUNTED=2]="UNMOUNTED",e[e.MOUNTED=3]="MOUNTED",(t=m=m||{})[t.NEED_UPDATE=1]="NEED_UPDATE",t[t.WAIT_LOADING=2]="WAIT_LOADING",t[t.UPDATED=3]="UPDATED",{gap:f.RENDER_PROPERTY,defaultDirection:f.PROPERTY,renderOnPropertyChange:f.PROPERTY,preserveUIOnDestroy:f.PROPERTY,useFit:f.PROPERTY,outlineSize:f.RENDER_PROPERTY,outlineLength:f.RENDER_PROPERTY}),v={horizontal:{inlinePos:"top",contentPos:"left",inlineSize:"height",contentSize:"width"},vertical:{inlinePos:"left",contentPos:"top",inlineSize:"width",contentSize:"height"}};function me(n,i){var e=ye(n);return H(i.map(function(e){return e.target}),e.map(function(e){return e.element})).maintained.filter(function(e){var t=e[0],e=e[1],t=i[t].size,e=n[e];return!e.inlineSize||!e.contentSize||t.inlineSize!==e.computedInlineSize||t.blockSize!==e.computedContentSize}).map(function(e){e=e[1];return n[e]})}function ye(e){return e.filter(function(e){return e.element})}function ve(e){return ye(e).map(function(e){return e.element})}function Re(e){return"string"==typeof e}function Se(e){return"object"==typeof e}function R(e){var t,r=e.prototype,o=e.propertyTypes;for(t in o)!function(n){var i=o[n]===f.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 L(e){for(var t=[],n=0;n<e;++n)t.push(n);return t}function _e(e,t){return Math.max(e-t[1],t[0]-e,0)+1}var Ee=function(){function e(e,t){var a=this;void 0===t&&(t={}),this._resizeTimer=0,this._maxResizeDebounceTimer=0,this.rect={width:0,height:0},this._updatedEntries=[],this._onWindowResize=function(){a._scheduleResize([{target:a.container}])},this._onObserve=function(e){var t=a._options,i=a.container,r=t.rectBox,o=t.childrenRectBox;a._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=a._options,n=t.resizeDebounce,t=t.maxResizeDebounce,i=a._updatedEntries;i.push.apply(i,e),a._updatedEntries=i.filter(function(e,t){return i.lastIndexOf(e)===t}),!a._maxResizeDebounceTimer&&n<=t&&(a._maxResizeDebounceTimer=window.setTimeout(a._onResize,t)),a._resizeTimer&&(clearTimeout(a._resizeTimer),a._resizeTimer=0),a._resizeTimer=window.setTimeout(a._onResize,n)},this._onResize=function(){clearTimeout(a._resizeTimer),clearTimeout(a._maxResizeDebounceTimer),a._maxResizeDebounceTimer=0,a._resizeTimer=0;var t,e,n,i,r=a._updatedEntries,o=a.container,r=r.filter(function(e){return e.target!==o||(t=e,!1)}),s=0<r.length,u=!!t;u&&(e=a._options.watchDirection,n=a.rect,(i=t.size)?a.setRect({width:i.inlineSize,height:i.blockSize}):a.resize(),i=a.rect,u=!e||("box"===e||"width"===e)&&n.width!==i.width||("box"===e||"height"===e)&&n.height!==i.height),a._updatedEntries=[],(u||s)&&a._emitter.trigger("resize",{isResizeContainer:u,childEntries:r})},this._options=p({resizeDebounce:100,maxResizeDebounce:0,useResizeObserver:!1,useWindowResize:!0,watchDirection:!1,rectBox:"content-box",childrenRectBox:"border-box"},t),this.container=Re(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){n.observe(e,{box:t})}))},t.unobserveChildren=function(e){var t=this._observer;t&&e.forEach(function(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}(),ze=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:y.horizontal,autoResize:y.autoResize,resizeDebounce:y.resizeDebounce,maxResizeDebounce:y.maxResizeDebounce,useResizeObserver:y.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 Ee(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 v[this.options.horizontal?"horizontal":"vertical"]},enumerable:!1,configurable:!0}),e}(i),Ie=function(){function e(e){this.initialRects={},this.sizePercetage=!1,this.posPercetage=!1,this.options=p({attributePrefix:y.attributePrefix,useTransform:y.useTransform,horizontal:y.horizontal,percentage:y.percentage,isEqualSize:y.isEqualSize,isConstantSize:y.isConstantSize,useRoundedSize:y.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===m.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,u=e.element,a=e.updateState===m.WAIT_LOADING,c=s&&s.width&&s.height,h=u?function(e,t){for(var n={},i=e.attributes,r=i.length,o=0;o<r;++o){var s=i[o],u=s.name,s=s.value;-1!==u.indexOf(t)&&(n[u.replace(t,"").replace(/[\s-_]([a-z])/g,function(e,t){return t.toUpperCase()})]=s)}return n}(u,this.options.attributePrefix):e.attributes,l=null!=(l=h.sizeGroup)?l:"",d=h.notEqualSize;if(""!==l&&o[l])f=o[l];else if(i&&!d&&!l&&o[""])f=o[""];else if(r&&c&&!a)f=s;else{if(t||!u)return;var f={left:u.offsetLeft,top:u.offsetTop,width:0,height:0};n?(f.width=u.offsetWidth,f.height=u.offsetHeight):(i=u.getBoundingClientRect(),f.width=i.width,f.height=i.height)}return e.attributes=h,e.shouldReupdate=!1,e.isFirstUpdate&&c||(e.orgRect=p({},f)),e.rect=p({},f),t||(e.element&&(e.mountState=C.MOUNTED),e.updateState===m.NEED_UPDATE&&(e.updateState=m.UPDATED,e.isFirstUpdate=!0),a)||d||o[l]||(o[l]=p({},f)),f},t._renderItem=function(e){var n,i,t,r,o,s,u,a=e.element,c=e.cssRect;a&&c&&(u=(e=this.options).horizontal,e=e.useTransform,n=this.posPercetage,i=this.sizePercetage,t=["position: absolute;"],r=(u=v[u?"horizontal":"vertical"]).inlineSize,o=u.inlinePos,s=this.getInlineSize(),u=Object.keys(c),e&&(u=u.filter(function(e){return"top"!==e&&"left"!==e}),t.push("transform: translate("+(c.left||0)+"px, "+(c.top||0)+"px);")),t.push.apply(t,u.map(function(e){var t=c[e];return e===r&&i||e===o&&n?e+": "+t/s*100+"%;":e+": "+t+"px;"})),a.style.cssText+=t.join(""))},e}(),Ce=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:"",orgRect:{left:0,top:0,width:0,height:0},rect:{left:0,top:0,width:0,height:0},cssRect:{},attributes:{},data:{},isFirstUpdate:!1,mountState:C.UNCHECKED,updateState:m.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=v[this.horizontal?"horizontal":"vertical"],i={};for(t in e)i[n[t]]=e[t];this.cssRect=i},t.getStatus=function(){return{mountState:this.mountState,updateState:this.updateState,attributes:this.attributes,orgCSSText:this.orgCSSText,isFirstUpdate:this.isFirstUpdate,element:null,key:this.key,orgRect:this.orgRect,rect:this.rect,cssRect:this.cssRect,gridData:this.gridData,data:this.data}},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!==C.UNCHECKED&&(e.mountState=i),r!==m.NEED_UPDATE&&(e.updateState=r),o&&(e.isFirstUpdate=!0),t&&(e.orgCSSText=t),e},Object.defineProperty(t,"_names",{get:function(){return this.horizontal?v.horizontal:v.vertical},enumerable:!1,configurable:!0}),e}(),S=function(f){function e(e,t){void 0===t&&(t={});var n=f.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=me(n.items,e.childEntries)).length&&n.updateItems(e)},n.options=p(p({},n.constructor.defaultOptions),t),n.containerElement=Re(e)?document.querySelector(e):e,n.options),e=t.isEqualSize,i=t.isConstantSize,r=t.useTransform,o=t.horizontal,s=t.percentage,u=t.externalContainerManager,a=t.externalItemRenderer,c=t.resizeDebounce,h=t.maxResizeDebounce,l=t.autoResize,d=t.useRoundedSize,t=t.useResizeObserver;return n.containerManager=u||new ze(n.containerElement,{horizontal:o,resizeDebounce:c,maxResizeDebounce:h,autoResize:l,useResizeObserver:t}).on("resize",n._onResize),n.itemRenderer=a||new Ie({useTransform:r,isEqualSize:e,isConstantSize:i,percentage:s,useRoundedSize:d}),n._init(),n}r(e,f);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){var t=this.options;return t.useResizeObserver&&t.observeChildren&&((t=this.containerManager).unobserveChildren(ve(this.items)),t.observeChildren(ve(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,u=r.changed,r=r.removed,a=[];return s.forEach(function(e){var t=e[0],e=e[1];a[e]=n[t]}),o.forEach(function(e){a[e]=new Ce(t,{element:i[e]})}),this.setItems(a),(o.length||r.length||u.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=m.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 Ce(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.checkReady=function(n){var i=this,e=(void 0===n&&(n={}),this.items),r=e.filter(function(e){var t;return(null==(t=e.element)?void 0:t.parentNode)&&e.updateState!==m.UPDATED}),t=e.filter(function(e){var t;return(null==(t=e.element)?void 0:t.parentNode)&&e.mountState!==C.MOUNTED}),o=[];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 fe({prefix:this.options.attributePrefix}).on("preReadyElement",function(e){r[e.index].updateState=m.WAIT_LOADING}).on("preReady",function(){r.forEach(function(e){var t=e.orgRect.width&&e.orgRect.height,n=e.cssRect.width||e.cssRect.height;!t&&n&&(e.element.style.cssText=e.orgCSSText)}),i._updateItems(r),i.readyItems(t,r,n)}).on("readyElement",function(e){var t=r[e.index];t.updateState=m.NEED_UPDATE,e.isPreReadyOver&&(t.isRestoreOrgCSSText&&(t.element.style.cssText=t.orgCSSText),i._updateItems([t]),i.readyItems([],[t],n))}).on("error",function(e){var t=r[e.index];i.trigger("contentError",{element:e.element,target:e.target,item:t,update:function(){o.push(t)}})}).on("ready",function(){o.length&&i.updateItems(o)}).check(r.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;"number"==typeof 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:g([],i),end:g([],i)},o=(e.forEach(function(e){e.mountState=C.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._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.options.gap,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=y,e.propertyTypes=ge,l([R],e)}(i);function Oe(e,t,n,i){return Math[i].apply(Math,e.slice(t,t+n))}var Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.applyGrid=function(y,e,t){y.forEach(function(e){e.isRestoreOrgCSSText=!1});for(var n,v=this.getComputedOutlineSize(y),R=this.getComputedOutlineLength(y),i=this.options,S=i.gap,r=i.align,_=i.observeChildren,E=i.columnSizeRatio,i=i.contentAlign,o=t.length,z=y.length,I=this._getAlignPoses(R,v),C="end"===e,O=C?"min":"max",P=C?"max":"min",e=[0],b=(e=o===R?t.slice():(n=o?Math[P].apply(Math,t):0,L(R).map(function(){return n}))).slice(),T=1<R?I[1]-I[0]:0,M="stretch"===r,w=C&&"start"===i,x=C?-1/0:1/0,s=(w&&(x=Math.min.apply(Math,b)),function(e){var t,n,i,r,o,s,e=y[C?e:z-1-e],u=parseInt(e.attributes.column||"1",10),a=parseInt(e.attributes.maxColumn||"1",10),c=e.contentSize,h=Math.min(R,u||Math.max(1,Math.ceil((e.inlineSize+S)/T))),l=Math.min(R,Math.max(h,a)),d=(n=h,a=O,i=x,r=(t=b).length-n+1,o="max"===a?"min":"max",s="max"===a?"lastIndexOf":"indexOf",(r=L(r).map(function(e){e=Oe(t,e,n,o);return Math[o](i,e)}))[s](Math[a].apply(Math,r))),f=Oe(b,d,h,P);for(w&&x!==f&&(x=Math.max.apply(Math,b),b=b.map(function(){return x}),f=x,d=0);h<l;){var p=d+h,g=d-1;if(C&&(R<=p||b[p]>f))break;if(!C&&(g<0||b[g]<f))break;C||--d,++h}d=Math.max(0,d),h=Math.min(R-d,h),(0<u&&1<h||M)&&(s=(h-1)*T+v,D._isObserverEnabled()&&_||e.cssInlineSize===s||(e.shouldReupdate=!0),e.cssInlineSize=s),0<E&&(c=e.computedInlineSize/E,e.cssContentSize=c);var a=I[d],f=C?f:f-S-c,m=(e.cssInlinePos=a,e.cssContentPos=f,C?f+c+S:f);L(h).forEach(function(e){b[d+e]=m})}),D=this,u=0;u<z;++u)s(u);return w&&x!==Math.min.apply(Math,b)&&(x=Math.max.apply(Math,b),b=b.map(function(){return x})),{start:C?e:b,end:C?b:e}},n.getComputedOutlineSize=function(e){void 0===e&&(e=this.items);var t=this.options,n=t.gap,t=t.align,i=this.getContainerInlineSize(),r=this.columnSize||this.outlineSize,o=this.column||this.outlineLength,s=o||1,u=0;if("stretch"===t)o||(t=this.maxStretchColumnSize||1/0,s=Math.max(1,Math.ceil((i+n)/(t+n)))),u=(i+n)/(s||1)-n;else if(r)u=r;else if(e.length){for(var a=e[0],c=0,h=e;c<h.length;c++){var l=h[c],d=l.attributes,f=parseInt(d.column||"1",10),d=parseInt(d.maxColumn||"1",10);if(l.updateState===m.UPDATED&&l.inlineSize&&1===f&&1===d){a=l;break}}u=a.inlineSize||0}else u=i;return u||0},n.getComputedOutlineLength=function(e){void 0===e&&(e=this.items);var t=this.gap,n=this.column||this.outlineLength,i=this.columnCalculationThreshold;return n||(n=this.getComputedOutlineSize(e),Math.min(e.length,Math.max(1,Math.floor((this.getContainerInlineSize()+t)/(n-i+t)))))},n._getAlignPoses=function(e,t){var n,i=this.options,r=i.align,i=i.gap,o=this.getContainerInlineSize(),s=L(e),u=0,a=0;return"justify"===r||"stretch"===r?(a=(n=e-1)?Math.max((o-t)/n,t+i):0,u=Math.min(0,o/2-(n*a+t)/2)):(n=(e-1)*(a=t+i)+t,"center"===r?u=(o-n)/2:"end"===r&&(u=o-n)),s.map(function(e){return u+e*a})},t.propertyTypes=p(p({},S.propertyTypes),{column:f.RENDER_PROPERTY,columnSize:f.RENDER_PROPERTY,columnSizeRatio:f.RENDER_PROPERTY,align:f.RENDER_PROPERTY,columnCalculationThreshold:f.RENDER_PROPERTY,maxStretchColumnSize:f.RENDER_PROPERTY,contentAlign:f.RENDER_PROPERTY}),t.defaultOptions=p(p({},S.defaultOptions),{align:"justify",column:0,columnSize:0,columnSizeRatio:0,columnCalculationThreshold:.5,maxStretchColumnSize:1/0,contentAlign:"masonry"}),l([R],t)}(S);function be(e,t,n){for(var i=function(e,t,n){var i,r,o,s,u,a,c={},h={},l=(h[t]=0,new Te(function(e){return e.cost}));for(l.push({value:t,cost:0});l.size();)for(var d in r=(i=l.pop()).value,o=i.cost,s=e(r)||{})u=o+s[d],(void 0===(a=h[d])||u<a)&&(l.push({value:d,cost:h[d]=u}),c[d]=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 Te=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,u=null;if(s<t&&(r=this.content[s],(r=this.scoreFunction(r))<i)&&(u=s),null===(u=o<t&&(s=this.content[o],this.scoreFunction(s)<(null==u?i:r))?o:u))break;this.content[e]=this.content[u],this.content[u]=n,e=u}},e}();function Me(e,t){var n,i=e.orgInlineSize,r=e.orgContentSize;return i&&r?(n=parseFloat(e.gridData.inlineOffset)||0,(r<=(e=parseFloat(e.gridData.contentOffset)||0)?1:(i-n)/(r-e))*(t-e)+n):t}var we=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.options,s=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)||t.inlineOffset||0,o=parseFloat(i.contentOffset)||0|t.contentOffset,!r||"inlineOffset"in i||"contentOffset"in i||e.mountState!==C.MOUNTED||(i=r.querySelector("["+s+"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=[];return e.length&&(r=i?this._getRowPath(e):this._getPath(e)),this._setStyle(e,r,n,"end"===t)},n._getRowPath=function(e){var t=this._getColumnRange(),n=this._getRowRange(),e=this._getRowLink(e,{path:[0],cost:0,length:0,currentNode:0},t,n);return null!=(t=null==e?void 0:e.path.map(function(e){return""+e}))?t:[]},n._getRowLink=function(e,t,n,i){var r=n[0],o=i[0],s=i[1],u=e.length,a=t.path,c=t.length,h=t.cost,l=t.currentNode;return l<u&&(s<=c||u<l+r)?(r=_e(u-l,n)*Math.abs(this._getCost(e,l,u)),p(p({},t),{length:c+1,path:g(g([],a),[u]),currentNode:u,cost:h+r,isOver:!0})):u<=l?p(p({},t),{currentNode:u,isOver:c<o||s<c}):this._searchRowLink(e,t,u,n,i)},n._searchRowLink=function(e,t,n,i,r){for(var o,s=i[0],u=i[1],a=t.currentNode,c=t.path,h=t.length,l=t.cost,d=Math.min(n,a+u),f=[],p=a+s;p<=d;++p)p!==a&&(o=Math.abs(this._getCost(e,a,p)),o=this._getRowLink(e,{path:g(g([],c),[p]),length:h+1,cost:l+o,currentNode:p},i,r))&&f.push(o);return f.sort(function(e,t){var n=e.isOver;return n!==t.isOver?n?1:-1:_e(e.length,r)-_e(t.length,r)||e.cost-t.cost}),f[0]},n._getExpectedRowSize=function(e){var t=this.options.gap,r=this.getContainerInlineSize()-t*(e.length-1),o=0,s=0;return e.forEach(function(e){var t,n=e.orgInlineSize,i=e.orgContentSize;n&&i?(t=parseFloat(e.gridData.inlineOffset)||0,e=parseFloat(e.gridData.contentOffset)||0,o+=n=i<=e?1:(n-t)/(i-e),s+=e*n,r-=t):o+=1}),o?(r+s)/o:0},n._getExpectedInlineSize=function(e,n){var t=this.options.gap,i=e.reduce(function(e,t){return e+Me(t,n)},0);return i?i+t*(e.length-1):0},n._getCost=function(e,t,n){var e=e.slice(t,n),t=this._getExpectedRowSize(e),n=this._getSizeRange(),i=n[0],n=n[1];if(this.isCroppedSize)return i<=t&&t<=n?0:(e=this._getExpectedInlineSize(e,t<i?i:n),Math.pow(e-this.getContainerInlineSize(),2));if(isFinite(n)){if(t<i)return Math.pow(t-i,2)+Math.pow(n,2);if(n<t)return Math.pow(t-n,2)+Math.pow(n,2)}else if(t<i)return Math.max(Math.pow(i,2),Math.pow(t,2))+Math.pow(n,2);return t-i},n._getPath=function(o){var s=this,u=o.length,e=this.options.columnRange,e=Se(e)?e:[e,e],a=e[0],c=e[1];return be(function(e){for(var t={},n=parseInt(e,10),i=Math.min(n+a,u);i<=u&&!(c<i-n);++i){var r=s._getCost(o,n,i);r<0&&i===u&&(r=0),t[""+i]=Math.pow(r,2)}return t},"0",""+u)},n._setStyle=function(e,t,n,i){var r,s=this,o=(void 0===n&&(n=[]),this.options),u=o.gap,a=o.isCroppedSize,c=o.displayedRow,h=this._getSizeRange(),o=n[0]||0,l=this.getContainerInlineSize(),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),d=o,f=0;return n.forEach(function(i,e){var t=i.length,r=s._getExpectedRowSize(i),n=(a&&(r=Math.max(h[0],Math.min(r,h[1]))),s._getExpectedInlineSize(i,r)),t=u*(t-1),o=(l-t)/(n-t);i.forEach(function(e,t){var n=Me(e,r),t=i[t-1],t=t?t.cssInlinePos+t.cssInlineSize+u:0;a&&(n*=o),e.setCSSGridRect({inlinePos:t,contentPos:d,inlineSize:n,contentSize:r})}),d+=u+r,(c<0||e<c)&&(f=d)}),i?{start:[o],end:[f]}:(r=d-o,e.forEach(function(e){e.cssContentPos-=r}),{start:[o-r],end:[o]})},n.getComputedOutlineLength=function(){return 1},n.getComputedOutlineSize=function(){return this.getContainerInlineSize()},n._getRowRange=function(){var e=this.rowRange;return Se(e)?e:[e,e]},n._getColumnRange=function(){var e=this.columnRange;return Se(e)?e:[e,e]},n._getSizeRange=function(){var e=this.sizeRange;return Se(e)?e:[e,e]},t.propertyTypes=p(p({},S.propertyTypes),{columnRange:f.RENDER_PROPERTY,rowRange:f.RENDER_PROPERTY,sizeRange:f.RENDER_PROPERTY,isCroppedSize:f.RENDER_PROPERTY,displayedRow:f.RENDER_PROPERTY}),t.defaultOptions=p(p({},S.defaultOptions),{columnRange:[1,8],rowRange:0,sizeRange:[0,1/0],displayedRow:-1,isCroppedSize:!1}),l([R],t)}(S);function xe(e){var t=-1/0;return e.forEach(function(e){isFinite(e)&&(t=Math.max(t,e))}),isFinite(t)?t:0}function De(e,t,n){return xe(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=xe(e),s=0;if(!n)return 0;for(var u=0;u<i;++u){var a=e[u],c=t[u];isFinite(a)&&isFinite(c)&&(a=a-o,c=c-r,s=u?Math.max(s,s+a-c):a-c)}return s}(e,t,n)}function Le(e,t,n){for(var i=n.inlinePos,r=n.inlineSize,o=n.contentPos,s=n.contentSize,u=i;u<i+r;++u)e[u]=Math.min(e[u],o),t[u]=Math.max(t[u],o+s)}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 i=this._getFrame(),r=i.inlineSize,o=i.contentSize,s=i.rects,u=this.options,a=u.gap,c=u.useFrameFill,u=this.getRectSize(r),h=u.inlineSize,l=u.contentSize,d=e.length;if(!d||!r||!o)return{start:n,end:n};for(var f=s.length,p=L(r).map(function(){return 1/0}),g=L(r).map(function(){return-1/0}),m=i.outline.map(function(e){return e*(l+a)}),y=0;y<d;y+=f)for(var v=De(g,m,c),R=0;R<f&&y+R<d;++R){var S=e[y+R],_=s[R],E=_.contentPos,z=_.inlinePos,I=_.contentSize,_=_.inlineSize,E=v+E*(l+a),C=z*(h+a),I=I*(l+a)-a,O=_*(h+a)-a;Le(p,g,{inlinePos:z,inlineSize:_,contentPos:E,contentSize:I+a}),S.setCSSGridRect({inlinePos:C,contentPos:E,inlineSize:O,contentSize:I})}var P,u="end"===t,o=n.length?n:[0],b=(o.length!==r&&(P=(u?Math.max:Math.min).apply(Math,o),o=L(r).map(function(){return P})),p=p.map(function(e){return isFinite(e)?e:0}),g=g.map(function(e){return isFinite(e)?e:0}),u?De(o,p,c):De(g,o,c));return e.forEach(function(e){e.cssContentPos+=b}),{start:p.map(function(e){return e+b}),end:g.map(function(e){return e+b})}},n.getComputedOutlineLength=function(){var e=this.options.frame;return e.length?e[0].length:0},n.getComputedOutlineSize=function(){var e=this.options,t=e.gap,e=e.rectSize;return"object"==typeof e?e.inlineSize:e||(this.getContainerInlineSize()+t)/this.getComputedOutlineLength()-t},n.getRectSize=function(e){var t=this.options,n=t.gap,t=t.rectSize;return"object"==typeof t?t:{inlineSize:t=t||(this.getContainerInlineSize()+n)/e-n,contentSize:t}},n._getFrame=function(){for(var e=this.options.frame,t=e.length,n=t?e[0].length:0,i=[],r={},o=L(n).map(function(){return 1/0}),s=L(n).map(function(){return-1/0}),u=0;u<t;++u)for(var a=0;a<n;++a){var c=e[u][a];!c||r[u+","+a]||(Le(o,s,c=this._findRect(r,c,u,a,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,u=1,a=1,c=i;c<r&&s[n][c]===t;++c)a=c-i+1;for(var h=n;h<o&&s[h][i]===t;++h)u=h-n+1;for(var l=n;l<n+u;++l)for(var d=i;d<i+a;++d)e[l+","+d]=!0;return{type:t,inlinePos:i,contentPos:n,inlineSize:a,contentSize:u}},t.propertyTypes=p(p({},S.propertyTypes),{frame:f.RENDER_PROPERTY,useFrameFill:f.RENDER_PROPERTY,rectSize:f.RENDER_PROPERTY}),t.defaultOptions=p(p({},S.defaultOptions),{frame:[],rectSize:0,useFrameFill:!0}),l([R],t)}(S),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 _,O,P,Ae=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,o=r.aspectRatio,s=r.gap,u=this.getContainerInlineSize(),a=u/o,r=n.length?n:[0],c="end"===t?Math.max.apply(Math,r):Math.min.apply(Math,r)-a-s,o=c+a+s,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(u+s,a+s)}),e.forEach(function(e,t){var t=h.items[t],n=t.inlineSize-s,i=t.contentSize-s,r=c+t.contentPos,t=t.inlinePos;e.setCSSGridRect({inlinePos:t,contentPos:r,inlineSize:n,contentSize:i})}),{start:[c],end:[o]}},n._findBestFitArea=function(e,p){var g,m,y,v,R,S,_,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,v={inlineSize:0,contentSize:0},R={inlineSize:0,contentSize:0},S=this._getWeight("size"),_=this._getWeight("ratio"),e.items.forEach(function(e){for(var t=E(e.getOrgSizeWeight(),e.getSize())*S,n=E(e.getOrgRatio(),e.getRatio())*_,i=e.inlineSize,r=e.contentSize,o=0;o<2;++o){var s=void 0,u=void 0,a=void 0,c=void 0,h=(0===o?(a=s=i,c=r-(u=r*(p.contentSize/(e.orgContentSize+p.contentSize)))):(c=u=r,a=i-(s=i*(p.inlineSize/(e.orgInlineSize+p.inlineSize)))),s*u),l=s/u,d=a*c,f=c/c,h=E(p.getSize(),h)*S;(h=(h=(h+=E(p.getRatio(),l)*_)+(E(e.getOrgSizeWeight(),d)*S-t))+(E(e.getOrgRatio(),f)*_-n))===Math.min(h,m)&&(m=h,g=e,y=0===o,v.inlineSize=s,v.contentSize=u,R.inlineSize=a,R.contentSize=c)}}),e=g,n=v,i=R,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({},S.propertyTypes),{aspectRatio:f.RENDER_PROPERTY,sizeWeight:f.RENDER_PROPERTY,ratioWeight:f.RENDER_PROPERTY,weightPriority:f.RENDER_PROPERTY}),t.defaultOptions=p(p({},S.defaultOptions),{aspectRatio:1,sizeWeight:1,ratioWeight:1,weightPriority:"custom"}),l([R],t)}(S),e="undefined"!=typeof window?window.navigator.userAgent:"",Ge=/iPhone|iPad/.test(e),Ke="infinitegrid-container",Ve={renderOnPropertyChange:!0,useFit:!0,autoResize:!0},Ue=z({},ge),b={START:"start",END:"end",NONE:""},T={CHANGE_SCROLL:"changeScroll",REQUEST_APPEND:"requestAppend",REQUEST_PREPEND:"requestPrepend",RENDER_COMPLETE:"renderComplete",CONTENT_ERROR:"contentError"},je={type:!0,groupKey:!0,key:!0,element:!0,html:!0,data:!0,inserted:!0,attributes:!0},t=["insertByGroupIndex","updateItems","getItems","getVisibleItems","getGroups","getVisibleGroups","renderItems","getContainerElement","getScrollContainerElement","getWrapperElement","setStatus","getStatus","removePlaceholders","prependPlaceholders","appendPlaceholders","getStartCursor","getEndCursor","setCursors"],M=((e=_=_||{})[e.NORMAL=0]="NORMAL",e[e.VIRTUAL=1]="VIRTUAL",e[e.LOADING=2]="LOADING",(e=O=O||{})[e.NORMAL=0]="NORMAL",e[e.VIRTUAL=1]="VIRTUAL",e[e.LOADING=2]="LOADING",(e=P=P||{})[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",function(r){function e(e,t){var n,i,e=r.call(this,e,z({html:"",type:O.NORMAL,cssRect:{top:-9999,left:-9999}},t))||this;return e.type===O.VIRTUAL&&((e.rect.width||e.rect.height)&&(e.mountState=C.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:O.VIRTUAL,groupKey:this.groupKey,key:this.key,orgRect:this.orgRect,rect:this.rect,cssRect:this.cssRect,attributes:this.attributes}},t.getMinimizedStatus=function(){var e=z(z({},r.prototype.getMinimizedStatus.call(this)),{type:O.NORMAL,groupKey:this.groupKey});return this.html&&(e.html=this.html),e},e}(Ce)),Fe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="",e}o(e,t);var n=e.prototype;return n.getLoadingItem=function(){return this.items[0]||null},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 M(this.options.horizontal,z(z({},e),{type:O.LOADING,key:"__INFINITEGRID__LOADING_ITEM"}))]}else this.items=[]},n.applyGrid=function(e,t,n){var i,r;return e.length?(i=n.length?d([],n,!0):[0],e=e[0],r=e.contentSize+this.gap,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}(S);function qe(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 Ye(e){return e===window}function Be(e){return"number"==typeof e}function We(e){return"string"==typeof e}function He(e){return e.reduce(function(e,t){return d(d([],e,!0),t,!0)},[])}function Ze(e){var t,n={},i={},r=S.defaultOptions;for(t in e){var o=e[t];t in Ve||(i[t]=o),t in r&&(n[t]=o)}return z(z({},n),{gridOptions:i})}function Xe(i){var r,o=[],s={},u={},a=(i.filter(function(e){return null!=e.groupKey}).forEach(function(e){e=e.groupKey;u[e]=!0}),!1);return i.forEach(function(e,t){null!=e.groupKey?a=!1:!e.inserted&&i[t-1]?(e.groupKey=i[t-1].groupKey,a=!1):(a||(r=$e(u),a=!0,u[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 Qe(e,t,n,i){var e=Y(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 Je(e,t,n){var i,r=[];if("start"===t){if(-1===(i=D(e,function(e){return e.type===_.NORMAL})))return[];t=D(e,function(t){return 0<=D(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=nt(e,function(e){return e.type===_.NORMAL})))return[];t=nt(e,function(t){return 0<=D(n,function(e){return e.groupKey===t.groupKey})}),t=0<=t?Math.max(i,t):i;r=e.slice(t+1)}return r}function w(e){var t,i=e.prototype;for(t in e.propertyTypes)!function(n){Object.defineProperty(i,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))}})}(t)}function $e(e,t){void 0===t&&(t="");for(var n=0;;){var i="infinitegrid_".concat(t).concat(n++);if(!(i in e))return i}}function et(e){var t=document.createElement("div");return t.innerHTML=e,x(t.children)}function tt(e,i){e=We(e)?et(e):e;return e.map(function(e){var t,n="";if(We(e))n=e;else{if(!("parentNode"in e))return z({groupKey:i,inserted:!0},e);n=(t=e).outerHTML}return{key:void 0,groupKey:i,html:n,element:t,inserted:!0}})}function x(e){var t=[];if(e)for(var n=e.length,i=0;i<n;i++)t.push(e[i]);return t}function D(e,t){for(var n=e.length,i=0;i<n;++i)if(t(e[i],i))return i;return-1}function nt(e,t){for(var n=e.length-1;0<=n;--n)if(t(e[n],n))return n;return-1}function it(e,n){return e.length===n.length&&e.every(function(e,t){return n[t]===e})}function rt(e){return He(e.map(function(e){return e.grid.getItems()}))}function ot(e,t){return t?d([],e,!0):e.filter(function(e){return e.type!==O.VIRTUAL})}function st(e,r){ut.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})})}ut=t;var ut,at,ct=function(r){function e(e,t){var n,i,t=r.call(this,e,(i=(n=t).gridOptions,n=A(t,["gridOptions"]),z(z({},Ze(i)),n)))||this;return t.groupItems=[],t.groups=[],t.itemKeys={},t.groupKeys={},t.startCursor=0,t.endCursor=0,t._placeholder=null,t._loadingGrid=new Fe(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=Ze(n),i=t.gridOptions,r=A(t,["gridOptions"]),t=this._checkShouldRender(n);for(e in this.options.gridOptions=z(z({},this.options.gridOptions),i),d([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 ot(this.groupItems,e)},t.getVisibleItems=function(e){return ot(this.items,e)},t.getRenderingItems=function(){return this.hasPlaceholder()?this.items:this.items.filter(function(e){return e.type!==O.VIRTUAL})},t.getGroups=function(e){return ot(this.groups,e)},t.hasVisibleVirtualGroups=function(){return this.getVisibleGroups(!0).some(function(e){return e.type===_.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.endLoading=function(){var e=this._loadingGrid.type;return this._loadingGrid.type="",this.items=this._getRenderingItems(),!!e},t.setLoading=function(e){this._loadingGrid.setLoadingItem(e),this.items=this._getRenderingItems()},t.getVisibleGroups=function(e){return ot(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,u,a,c=this,h=this.groups.slice();return h.length?((n=this._loadingGrid).getLoadingItem()&&("start"===n.type?h.unshift(this._getLoadingGroup()):"end"===n.type&&h.push(this._getLoadingGroup())),n=h.slice(),r=t,"start"===i&&n.reverse(),o=this.options.appliedItemChecker,t=this.groupItems,s=this.getComputedOutlineLength(t),u=this.getComputedOutlineSize(t),a=this.itemRenderer,n.forEach(function(e){var t=e.grid,n=t.getItems(),e=e.type===_.VIRTUAL&&!n[0],n=(t.outlineLength=s,t.outlineSize=u,n.filter(function(e){return e.mountState!==C.UNCHECKED&&e.rect.width||a.updateItem(e,!0),e.orgRect.width&&e.rect.width||o(e,t)})),e=e?c._applyVirtualGrid(t,i,r):n.length?t.applyGrid(n,i,r):{start:d([],r,!0),end:d([],r,!0)};t.setOutlines(e),r=e[i]}),{start:h[0].grid.getOutlines().start,end:h[h.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 je&&(i[t]=n[t]);return i}),t)),s=this.groupKeys,t=Xe(e),e=this._splitVirtualGroups("start",t),n=this._splitVirtualGroups("end",t),e=(t=d(d(d([],e,!0),this._mergeVirtualGroups(t),!0),n,!0)).map(function(e){var t=e.groupKey,e=e.items,n=!e[0]||e[0].type===O.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===O.NORMAL});return i.setItems(r),{type:n?_.VIRTUAL:_.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=m.NEED_UPDATE}),t=this._getLoadingItem())&&(t.updateState=m.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],u=o[r],a=i,c=r,h=e===P.MINIMIZE_INVISIBLE_ITEMS,l=e===P.MINIMIZE_INVISIBLE_GROUPS;if(e===P.REMOVE_INVISIBLE_GROUPS)n=this.getVisibleGroups(t),c=n.length-1,a=0;else if(n=this.getGroups(t),!t){for(var a=-1,c=-1,d=i;d<=r;++d)if((f=o[d])&&f.type!==_.VIRTUAL){a=n.indexOf(f);break}for(var f,d=r;i<=d;--d)if((f=o[d])&&f.type!==_.VIRTUAL){c=n.lastIndexOf(f);break}}var e=n.map(function(e,t){var n=e.grid,e=e.groupKey,t=t<a||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?_.VIRTUAL:_.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==u?void 0:u.items.slice().reverse()[0]);return{cursors:[a,c],orgCursors:[i,r],itemCursors:[p,t],startGroupKey:null==s?void 0:s.groupKey,endGroupKey:null==u?void 0:u.groupKey,groups:e,outlines:this.outlines}},t.fitOutlines=function(e){void 0===e&&(e=this.useFit);var i,t=this.groups,n=t[0];n&&(n=n.grid.getOutlines().start,i=n.length?Math.min.apply(Math,n):0,!e&&0<i||(t.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;Be(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=D(i,function(e){return e.type===_.NORMAL}),i.splice(0,n)):"end"===e?(n=nt(i,function(e){return e.type===_.NORMAL}),i.splice(n+1,r-n-1)):(t=e.groupKey,-1<(n=D(i,function(e){return e.groupKey===t}))&&i.splice(n,1)),this.syncItems(rt(this.getGroups()))},t.insertPlaceholders=function(e,t,n){void 0===n&&(n=$e(this.groupKeys,"virtual_"));var i=[],t=(Be(t)?i=function(e){for(var t=[],n=0;n<e;++n)t.push(n);return t}(t).map(function(){return{type:O.VIRTUAL,groupKey:n}}):Array.isArray(t)&&(i=t.map(function(e){return z(z({groupKey:n},e),{type:O.VIRTUAL})})),this._makeGrid()),i=this._syncItemInfos(i,this.itemKeys),t=(this._updatePlaceholder(i),t.setItems(i),{type:_.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,d([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===C.UNCHECKED})||(n=!0,e.renderItems=d([],t,!0))}),n&&(this.items=this._getRenderingItems()),n},t._updateItems=function(e){this.itemRenderer.updateEqualSizeItems(e,this.groupItems)},t._getGroupItems=function(){return rt(this.getGroups(!0))},t._getRenderingItems=function(){var e=He(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]===f.RENDER_PROPERTY)return!0;for(t in e)if(i[t]!==e[t]&&r[t]===f.RENDER_PROPERTY)return!0;return!1},t._applyVirtualGrid=function(e,t,n){var i=n.length?d([],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:d([],i,!0),end:d([],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===O.VIRTUAL&&e.type!==O.VIRTUAL?s[t]=new M(o,z({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 M(o,z({},e))}),e.map(function(e){var t,n=e.key,i=(null==e.key&&(n=$e(s,e.type===O.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 M(o,z(z({},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=Je(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===C.UNCHECKED})&&n.renderItems.forEach(function(e){e.type!==O.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===O.VIRTUAL}).forEach(function(e){var t,n=e,i=o;for(t in i){var r=i[t];n[t]="object"==typeof r?z(z({},n[t]),r):i[t]}})},t._makeGrid=function(){var e=this.options.gridConstructor,t=this.gridOptions;return new e(this.containerElement,z(z({},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:_.NORMAL,grid:e,items:t,renderItems:t}},t._getLoadingItem=function(){return this._loadingGrid.getLoadingItem()},e.defaultOptions=z(z({},S.defaultOptions),{appliedItemChecker:function(){return!1},gridConstructor:null,gridOptions:{}}),e.propertyTypes=z(z({},S.propertyTypes),{gridConstructor:f.PROPERTY,gridOptions:f.PROPERTY}),n([R],e)}(S),ht=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=z({threshold:0,useRecycle:!0,defaultDirection:"end"},e),t}o(e,n);var t=e.prototype;return t.scroll=function(n){var e=this.startCursor,t=this.endCursor,i=this.items,r=i.length,o=this.size,s=this.options,u=s.defaultDirection,a=s.threshold,s=s.useRecycle,u="end"===u;if(r)if(-1===e||-1===t)this.trigger("change",{prevStartCursor:e,prevEndCursor:t,nextStartCursor:h=u?0:r-1,nextEndCursor:h});else{var c=n+o,h=Math.max.apply(Math,i[e].startOutline),o=Math.min.apply(Math,i[t].endOutline),l=i.map(function(e){var t=e.startOutline,e=e.endOutline;return!(!t.length||!e.length||it(t,e))&&(t=Math.min.apply(Math,t),e=Math.max.apply(Math,e),t-a<=c)&&n<=e+a}),d=0<e,f=t<r-1,h=n<=h+a,o=o-a<=c,p=l.indexOf(!0),g=l.lastIndexOf(!0),l=(-1===p&&(p=e,g=t),s||(p=Math.min(p,e),g=Math.max(g,t)),p===e&&d&&h&&--p,g===t&&f&&o&&(g+=1),i.slice(p,g+1));if(l.every(function(e){return!0===e.isVirtual})){for(var m=!1,y=p-1;0<=y;--y)if(!i[y].isVirtual){p=y,m=!0;break}if(!m)for(y=g+1;y<r;++y)if(!i[y].isVirtual){g=y,m=!0;break}m&&(l=i.slice(p,g+1))}var v,s=l.some(function(e){return!0===e.isVirtual});(e===p&&t===g||(this.trigger("change",{prevStartCursor:e,prevEndCursor:t,nextStartCursor:p,nextEndCursor:g}),s))&&(s?(f=null==(d=l[0])?void 0:d.isVirtual,d=null==(s=l[l.length-1])?void 0:s.isVirtual,u&&o||!f?!u&&h||!d||l[s=(v=nt(l,function(e){return!e.isVirtual}))+1]&&this.trigger("requestAppend",{key:-1<v?l[v].key:void 0,nextKey:l[s].key,nextKeys:l.slice(s).map(function(e){return e.key}),isVirtual:!0}):l[f=(-1===(v=D(l,function(e){return!e.isVirtual}))?l.length:v)-1]&&this.trigger("requestPrepend",{key:-1<v?l[v].key:void 0,nextKey:l[f].key,nextKeys:l.slice(0,1+f).map(function(e){return e.key}),isVirtual:!0})):this._requestVirtualItems()||(u&&o||!h?!u&&h||!o||this.trigger("requestAppend",{key:i[t].key,isVirtual:!1}):this.trigger("requestPrepend",{key:i[e].key,isVirtual:!1})))}else this.trigger(u?"requestAppend":"requestPrepend",{key:void 0,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(),u=this.getEndCursor();if(o!==r)if(o){var a=i[0].key,c=i[o-1].key,i=D(t,function(e){return e.key===a})-1,o=D(t,function(e){return e.key===c})+1,u=o<=u,s=s<=i;if((e||!s)&&u)return this.trigger("requestAppend",{key:c,nextKey:t[o].key,isVirtual:!0}),!0;if((!e||!u)&&s)return this.trigger("requestPrepend",{key:a,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&&!it(o.startOutline,o.endOutline)||e===b.START&&0<t&&!r.isVirtual&&!it(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=Qe(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;return s||(s=0<(t=Y(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.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.getItemByKey=function(e){return this.itemKeys[e]},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=z(z({},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:x(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=Y(this.items,e.map(function(e){return z(z({},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=z(z({},this._state),t),this._diffResult=e},n.destroy=function(){this.off()},e}(i),lt=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=et(t.html)[0]),i[e].element=t.element}),e},e}(function(a){function e(){return null!==a&&a.apply(this,arguments)||this}return o(e,a),e.prototype.render=function(e,t){var n=this.container,e=a.prototype.render.call(this,e,t),i=e.prevList,t=e.removed,r=e.ordered,o=e.added,s=e.list,u=d([],i,!0);return t.forEach(function(e){u.splice(e,1),n.removeChild(i[e].element)}),r.forEach(function(e){var t=e[0],e=e[1],t=u.splice(t,1)[0];u.splice(e,0,t),n.insertBefore(t.element,null!=(e=null==(t=u[e+1])?void 0:t.element)?e:null)}),o.forEach(function(e){var t=s[e];u.splice(e,0,t),n.insertBefore(t.element,null!=(e=null==(t=u[e+1])?void 0:t.element)?e:null)}),this.updated(n.children),e},e}(e)),dt=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=Ge,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 I("scroll",{direction:e<t?"end":"start",scrollPos:t,relativeScrollPos:n.getRelativeScrollPos()})))},n.options=z({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 Ye(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];Ye(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,Ye(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();this.scrollOffset=(this.prevScrollPos||0)+(t?r.left-i.left:r.top-i.top),this.contentSize=n?t?window.innerWidth:window.innerHeight:t?e.offsetWidth:e.offsetHeight},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=x(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=Ke,x(o.childNodes).forEach(function(e){s.appendChild(e)}),o.appendChild(s),this._isCreateElement=!0):s=qe(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=qe(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(),this.setScrollPos(this.getOrgScrollPos())},e}(i),N=function(E){function e(e,t){var a=E.call(this)||this,t=(a._waitType="",a._onScroll=function(e){var t=e.direction,n=e.scrollPos,e=e.relativeScrollPos;a._scroll(),a.trigger(new I(T.CHANGE_SCROLL,{direction:t,scrollPos:n,relativeScrollPos:e}))},a._onChange=function(e){a.setCursors(e.nextStartCursor,e.nextEndCursor)},a._onRendererUpdated=function(e){var t,n,r,o,i,s,u;e.items.forEach(function(e){e.orgItem.element=e.element}),e.isChanged?(t=(i=e.diffResult).added,u=i.removed,n=i.prevList,r=i.list,u.forEach(function(e){e=n[e].orgItem;e.mountState!==C.UNCHECKED&&(e.mountState=C.UNMOUNTED)}),o=a.options.horizontal,i=t.map(function(e){var t,n,e=r[e].orgItem,i=e.element;return e.type===O.VIRTUAL?(t=z({},e.cssRect),n=e.rect,!t.width&&n.width&&(t.width=n.width),!t.height&&n.height&&(t.height=n.height),new Ce(o,{element:i,cssRect:t})):e}),s=a.containerManager,a.options.observeChildren&&(s.unobserveChildren(u.map(function(e){return n[e].element})),s.observeChildren(t.map(function(e){return r[e].element}))),s=(u=e.state).isRestore,u=u.isResize,a.itemRenderer.renderItems(i),s&&a._onRenderComplete({mounted:t.map(function(e){return r[e].orgItem}),updated:[],isResize:!1,direction:a.defaultDirection}),s&&!u&&!e.isItemChanged||a.groupManager.renderItems()):(a._checkEndLoading(),a._scroll())},a._onResize=function(e){e.isResizeContainer?a._renderItems({useResize:!0},!0):0<(e=me(a.getVisibleItems(),e.childEntries)).length&&a.updateItems(e)},a._onRequestAppend=function(e){a._onRequestInsert(b.END,T.REQUEST_APPEND,e)},a._onRequestPrepend=function(e){a._onRequestInsert(b.START,T.REQUEST_PREPEND,e)},a._onContentError=function(e){var t=e.element,n=e.target,i=e.item,e=e.update;a.trigger(new I(T.CONTENT_ERROR,{element:t,target:n,item:i,update:e,remove:function(){a.removeByKey(i.key)}}))},a._onRenderComplete=function(e){var t=e.isResize,n=e.mounted,i=e.updated,e=e.direction,r=a.infinite,o=r.getRenderedVisibleItems(),s=o.length,u=e===b.END;a._syncInfinite(),s&&(o=o[u?0:s-1],s=r.getItemByKey(o.key),r=u?Math.min.apply(Math,s.startOutline)-Math.min.apply(Math,o.startOutline):Math.max.apply(Math,s.endOutline)-Math.max.apply(Math,o.endOutline),a.scrollManager.scrollBy(r)),a.trigger(new I(T.RENDER_COMPLETE,{isResize:t,direction:e,mounted:n.filter(function(e){return e.type!==O.LOADING}),updated:i.filter(function(e){return e.type!==O.LOADING}),startCursor:a.getStartCursor(),endCursor:a.getEndCursor(),items:a.getVisibleItems(!0),groups:a.getVisibleGroups(!0)})),a.groupManager.shouldRerenderItems()?a._update():(a._checkEndLoading(),a._scroll())},a.options=z(z(z({},a.constructor.defaultOptions),{renderer:(new lt).on("requestUpdate",function(){return a._render()})}),t),a.options),n=t.gridConstructor,i=t.containerTag,r=t.container,o=t.renderer,s=t.threshold,u=t.useRecycle,c=t.scrollContainer,h=t.appliedItemChecker,t=A(t,["gridConstructor","containerTag","container","renderer","threshold","useRecycle","scrollContainer","appliedItemChecker"]),l=t.horizontal,d=t.attributePrefix,f=t.useTransform,p=t.percentage,g=t.isConstantSize,m=t.isEqualSize,y=t.autoResize,v=t.useResizeObserver,R=t.resizeDebounce,S=t.maxResizeDebounce,_=t.defaultDirection,e=We(e)?document.querySelector(e):e,c=new dt(e,{scrollContainer:c,container:r,containerTag:i,horizontal:l}).on({scroll:a._onScroll}),r=c.getContainer(),i=new ze(r,{horizontal:l,autoResize:y,resizeDebounce:R,maxResizeDebounce:S,useResizeObserver:v}).on("resize",a._onResize),y=new Ie({attributePrefix:d,horizontal:l,useTransform:f,percentage:p,isEqualSize:m,isConstantSize:g}),R=new ht({defaultDirection:_,useRecycle:u,threshold:s}).on({change:a._onChange,requestAppend:a._onRequestAppend,requestPrepend:a._onRequestPrepend}),S=(R.setSize(c.getContentSize()),new ct(r,{appliedItemChecker:h,gridConstructor:n,externalItemRenderer:y,externalContainerManager:i,gridOptions:t}));return S.on({renderComplete:a._onRenderComplete,contentError:a._onContentError}),o.setContainer(r),o.on("updated",a._onRendererUpdated),a.itemRenderer=y,a.groupManager=S,a.wrapperElement=e,a.scrollManager=c,a.containerManager=i,a.infinite=R,a.containerManager.resize(),a}o(e,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._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=tt(t,n);return-1===e?i.push.apply(i,t):i.splice.apply(i,d([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=D(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),z(z({},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),z(z({},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=D(e,function(e){return e.groupKey===t}),i=nt(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=D(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(){this._waitType=""},t.isWait=function(){return!!this._waitType},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._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;e.resize(),this.infinite.setSize(e.getContentSize())},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,n=n.getOutlines();return{key:t,isVirtual:e===_.VIRTUAL,startOutline:n.start,endOutline:n.end}}))},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 I(t,{groupKey:n.key,nextGroupKey:n.nextKey,nextGroupKeys:n.nextKeys||[],isVirtual:n.isVirtual,wait:function(){i.wait(e)},ready:function(){i.ready()}}))},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=x(this.getContainerElement().children)).length?(this.groupManager.syncItems(tt(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.endLoading()||!e.hasLoadingItem()||this._update()},e.defaultOptions=z(z({},y),{container:!1,containerTag:"div",renderer:null,threshold:100,useRecycle:!0,scrollContainer:null,appliedItemChecker:function(){return!1}}),e.propertyTypes=Ue,n([w],e)}(i),ft={__proto__:null,default:N,withInfiniteGridMethods:st,getRenderingItems:function(e,t){var n,i,r,o,s=t.status,u=t.usePlaceholder,a=t.useLoading,c=t.horizontal,h=t.useFirstRender,t=t.grid,l=[];return t?(t.setPlaceholder(u?{}:null),t.setLoading(a?{}:null),t.syncItems(e),l=t.getRenderingItems()):s?(a=s.groupManager,t=e,s=!!u,i=!!c,u=a.groups,t=Xe(t),r=Je(u,"start",t),o=Je(u,"end",t),r=d(d(d([],r,!0),t,!0),o,!0),o=(t=Qe(u.map(function(e){return e.groupKey}),r.map(function(e){return e.groupKey}),a.cursors[0],a.cursors[1])).startCursor,u=t.endCursor,a=He(r.slice(o,u+1).map(function(e){return e.items.map(function(e){return new M(i,z({},e))})})),l=a=s?a:a.filter(function(e){return e.type!==O.VIRTUAL})):h&&(n=!!c,l=(t=Xe(t=e))[0]?t[0].items.map(function(e){return new M(n,z({},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:M,MasonryInfiniteGrid:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyTypes=z(z({},N.propertyTypes),Pe.propertyTypes),t.defaultOptions=z(z(z({},N.defaultOptions),Pe.defaultOptions),{gridConstructor:Pe,appliedItemChecker:function(e,t){return(parseFloat(e.attributes.column)||0)>=t.outlineLength}}),n([w],t)}(N),JustifiedInfiniteGrid:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyTypes=z(z({},N.propertyTypes),we.propertyTypes),t.defaultOptions=z(z(z({},N.defaultOptions),we.defaultOptions),{gridConstructor:we}),n([w],t)}(N),FrameInfiniteGrid:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyTypes=z(z({},N.propertyTypes),Ne.propertyTypes),t.defaultOptions=z(z(z({},N.defaultOptions),Ne.defaultOptions),{gridConstructor:Ne}),n([w],t)}(N),PackingInfiniteGrid:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyTypes=z(z({},N.propertyTypes),Ae.propertyTypes),t.defaultOptions=z(z(z({},N.defaultOptions),Ae.defaultOptions),{gridConstructor:Ae}),n([w],t)}(N),Renderer:e,IS_IOS:Ge,CONTAINER_CLASS_NAME:Ke,IGNORE_PROPERITES_MAP:Ve,INFINITEGRID_PROPERTY_TYPES:Ue,DIRECTION:b,INFINITEGRID_EVENTS:T,ITEM_INFO_PROPERTIES:je,INFINITEGRID_METHODS:t,get GROUP_TYPE(){return _},get ITEM_TYPE(){return O},get STATUS_TYPE(){return P},INVISIBLE_POS:-9999};for(at in ft)N[at]=ft[at];return N});
10//# sourceMappingURL=infinitegrid.min.js.map