{"version":3,"file":"infinitegrid.packinglayout.js","sources":["../node_modules/@egjs/component/dist/component.esm.js","../src/browser.ts","../src/consts.ts","../src/utils.ts","../src/ItemManager.ts","../src/DOMRenderer.ts","../src/Watcher.ts","../src/Infinite.ts","../src/AutoSizer.ts","../src/ImageLoaded.ts","../src/LayoutManager.ts","../src/InfiniteGrid.ts","../src/layouts/lib/BoxModel.ts","../src/layouts/PackingLayout.ts","../src/index.packinglayout.ts"],"sourcesContent":["/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/component project is licensed under the MIT license\n\n@egjs/component JavaScript library\nhttps://naver.github.io/egjs-component\n\n@version 2.1.2\n*/\n/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\n/**\n * A class used to manage events in a component\n * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스\n * @alias eg.Component\n */\n\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Component.VERSION; // ex) 2.0.0\n * @memberof eg.Component\n */\n\n /**\n * @support {\"ie\": \"7+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n */\n function Component() {\n this._eventHandler = {};\n this.options = {};\n }\n /**\n * Triggers a custom event.\n * @ko 커스텀 이벤트를 발생시킨다\n * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름\n * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터\n * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고\n * @example\n class Some extends eg.Component {\n some(){\n \tif(this.trigger(\"beforeHi\")){ // When event call to stop return false.\n \tthis.trigger(\"hi\");// fire hi event.\n \t}\n }\n }\n const some = new Some();\n some.on(\"beforeHi\", (e) => {\n if(condition){\n \te.stop(); // When event call to stop, `hi` event not call.\n }\n });\n some.on(\"hi\", (e) => {\n // `currentTarget` is component instance.\n console.log(some === e.currentTarget); // true\n });\n // If you want to more know event design. You can see article.\n // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F\n */\n\n\n var _proto = Component.prototype;\n\n _proto.trigger = function trigger(eventName, customEvent) {\n if (customEvent === void 0) {\n customEvent = {};\n }\n\n var handlerList = this._eventHandler[eventName] || [];\n var hasHandlerList = handlerList.length > 0;\n\n if (!hasHandlerList) {\n return true;\n } // If detach method call in handler in first time then handler list calls.\n\n\n handlerList = handlerList.concat();\n customEvent.eventType = eventName;\n var isCanceled = false;\n var arg = [customEvent];\n var i = 0;\n\n customEvent.stop = function () {\n isCanceled = true;\n };\n\n customEvent.currentTarget = this;\n\n for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n restParam[_key - 2] = arguments[_key];\n }\n\n if (restParam.length >= 1) {\n arg = arg.concat(restParam);\n }\n\n for (i = 0; handlerList[i]; i++) {\n handlerList[i].apply(this, arg);\n }\n\n return !isCanceled;\n };\n /**\n * Executed event just one time.\n * @ko 이벤트가 한번만 실행된다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n alert(\"hi\");\n }\n thing() {\n this.once(\"hi\", this.hi);\n }\n }\n var some = new Some();\n some.thing();\n some.trigger(\"hi\");\n // fire alert(\"hi\");\n some.trigger(\"hi\");\n // Nothing happens\n */\n\n\n _proto.once = function once(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var i;\n\n for (i in eventHash) {\n this.once(i, eventHash[i]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var self = this;\n this.on(eventName, function listener() {\n for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arg[_key2] = arguments[_key2];\n }\n\n handlerToAttach.apply(self, arg);\n self.off(eventName, listener);\n });\n }\n\n return this;\n };\n /**\n * Checks whether an event has been attached to a component.\n * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다.\n * @param {String} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름\n * @return {Boolean} Indicates whether the event is attached. 이벤트 등록 여부\n * @example\n class Some extends eg.Component {\n some() {\n this.hasOn(\"hi\");// check hi event.\n }\n }\n */\n\n\n _proto.hasOn = function hasOn(eventName) {\n return !!this._eventHandler[eventName];\n };\n /**\n * Attaches an event to a component.\n * @ko 컴포넌트에 이벤트를 등록한다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.on(\"hi\",this.hi); //attach event\n }\n }\n */\n\n\n _proto.on = function on(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.on(name, eventHash[name]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var handlerList = this._eventHandler[eventName];\n\n if (isUndefined(handlerList)) {\n this._eventHandler[eventName] = [];\n handlerList = this._eventHandler[eventName];\n }\n\n handlerList.push(handlerToAttach);\n }\n\n return this;\n };\n /**\n * Detaches an event from the component.\n * @ko 컴포넌트에 등록된 이벤트를 해제한다\n * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름\n * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.off(\"hi\",this.hi); //detach event\n }\n }\n */\n\n\n _proto.off = function off(eventName, handlerToDetach) {\n // All event detach.\n if (isUndefined(eventName)) {\n this._eventHandler = {};\n return this;\n } // All handler of specific event detach.\n\n\n if (isUndefined(handlerToDetach)) {\n if (typeof eventName === \"string\") {\n this._eventHandler[eventName] = undefined;\n return this;\n } else {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.off(name, eventHash[name]);\n }\n\n return this;\n }\n } // The handler of specific event detach.\n\n\n var handlerList = this._eventHandler[eventName];\n\n if (handlerList) {\n var k;\n var handlerFunction;\n\n for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) {\n if (handlerFunction === handlerToDetach) {\n handlerList = handlerList.splice(k, 1);\n break;\n }\n }\n }\n\n return this;\n };\n\n return Component;\n }();\n\n Component.VERSION = \"2.1.2\";\n return Component;\n}();\n\nexport default Component;\n//# sourceMappingURL=component.esm.js.map\n","import { WindowMockType } from \"./types\";\n\nlet win: WindowMockType;\n\nif (typeof window === \"undefined\") {\n\t// window is undefined in node.js\n\twin = {\n\t\tdocument: {},\n\t\tnavigator: {\n\t\t\tuserAgent: \"\",\n\t\t},\n\t};\n} else {\n\twin = window;\n}\n\nexport { win as window };\nexport const document = win.document;\n","import { window, document } from \"./browser\";\nimport { IAlign } from \"./types\";\n\nconst ua = window.navigator.userAgent;\n\nexport const SUPPORT_COMPUTEDSTYLE = !!(\"getComputedStyle\" in window);\nexport const SUPPORT_ADDEVENTLISTENER = !!(\"addEventListener\" in document);\nexport const SUPPORT_PASSIVE = (() => {\n\tlet supportsPassiveOption = false;\n\n\ttry {\n\t\tif (SUPPORT_ADDEVENTLISTENER && Object.defineProperty) {\n\t\t\tdocument.addEventListener(\"test\", null, Object.defineProperty({},\n\t\t\t\t\"passive\", {\n\t\t\t\t\tget() {\n\t\t\t\t\t\tsupportsPassiveOption = true;\n\t\t\t\t\t},\n\t\t\t\t}));\n\t\t}\n\t} catch (e) {\n\t\t//\n\t}\n\treturn supportsPassiveOption;\n})();\n\nexport const IS_IE = /MSIE|Trident|Windows Phone|Edge/.test(ua);\nexport const IS_IOS = /iPhone|iPad/.test(ua);\nexport const IS_ANDROID2 = /Android 2\\./.test(ua);\nexport const CONTAINER_CLASSNAME = \"_eg-infinitegrid-container_\";\nexport const IGNORE_CLASSNAME = \"_eg-infinitegrid-ignore_\";\nexport const TRANSITION_NAME = \"_INFINITEGRID_TRANSITION\";\n\nexport const APPEND = true;\nexport const PREPEND = false;\nexport const VERTICAL = \"vertical\";\nexport const HORIZONTAL = \"horizontal\";\nexport const CACHE = true;\nexport const NO_CACHE = false;\nexport const TRUSTED = true;\nexport const NO_TRUSTED = false;\nexport const MULTI = true;\nexport const SINGLE = false;\nexport const DUMMY_POSITION = -100000;\nexport const GROUPKEY_ATT = \"data-groupkey\";\n\nexport const DEFAULT_OPTIONS = {\n\thorizontal: false,\n\tmargin: 0,\n};\n\nexport const agent = ua.toLowerCase();\nexport const isMobile = /mobi|ios|android/.test(agent);\n\nexport const ALIGN: IAlign = {\n\tSTART: \"start\",\n\tCENTER: \"center\",\n\tEND: \"end\",\n\tJUSTIFY: \"justify\",\n};\n\nexport const IDLE = 0;\nexport const LOADING_APPEND = 1;\nexport const LOADING_PREPEND = 2;\nexport const PROCESSING = 4;\n\nconst webkit = /applewebkit\\/([\\d|.]*)/g.exec(agent);\n\nexport const WEBKIT_VERSION = (webkit && parseInt(webkit[1], 10)) || 0;\nexport const DEFENSE_BROWSER = (WEBKIT_VERSION && WEBKIT_VERSION < 537);\n\ninterface ITransitionEnd {\n\ttransitionend: string;\n\twebkitTransitionEnd: string;\n\tMSTransitionEnd: string;\n\toTransitionEnd: string;\n\tmozTransitionEnd: string;\n}\n\nexport const [TRANSFORM, TRANSITION, TRANSITION_END] = (() => {\n\tconst properties: ITransitionEnd = {\n\t\ttransitionend: \"\",\n\t\twebkitTransitionEnd: \"-webkit-\",\n\t\tMSTransitionEnd: \"-ms-\",\n\t\toTransitionEnd: \"-o-\",\n\t\tmozTransitionEnd: \"-moz-\",\n\t};\n\n\tfor (const property in properties) {\n\t\tconst prefix = properties[property as keyof ITransitionEnd];\n\n\t\tif (`on${property.toLowerCase()}` in window) {\n\t\t\treturn [`${prefix}transform`, `${prefix}transition`, property];\n\t\t}\n\t}\n\treturn [];\n})() as [\"transform\", \"transition\", \"transitionend\"];\n","\nimport { window, document } from \"./browser\";\nimport {\n\tSUPPORT_COMPUTEDSTYLE,\n\tSUPPORT_ADDEVENTLISTENER,\n\tSUPPORT_PASSIVE,\n\tVERTICAL,\n\tHORIZONTAL,\n\tDEFAULT_OPTIONS,\n} from \"./consts\";\nimport { IJQuery, IRectlProperties, InnerSizeType, ClientSizeType, ScrollSizeType, OffsetSizeType, WindowMockType } from \"./types\";\n\nexport function toArray(nodes: HTMLCollection): HTMLElement[];\nexport function toArray(nodes: T[] | NodeListOf): T[];\nexport function toArray(nodes: T[] | NodeListOf | HTMLCollection) {\n\t// SCRIPT5014 in IE8\n\tconst array = [];\n\n\tif (nodes) {\n\t\tfor (let i = 0, len = nodes.length; i < len; i++) {\n\t\t\tarray.push(nodes[i]);\n\t\t}\n\t}\n\treturn array;\n}\nexport function matchHTML(html: string) {\n\treturn html.match(/^<([A-z]+)\\s*([^>]*)>/);\n}\n/**\n * Select or create element\n * @param {String|HTMLElement|jQuery} param\n * when string given is as HTML tag, then create element\n * otherwise it returns selected elements\n * @param {Boolean} multi\n * @returns {HTMLElement}\n */\nexport function $(param: WindowMockType, multi?: false): WindowMockType;\nexport function $(\n\tparam: string | HTMLElement | Array | IJQuery,\n\tmulti: true,\n): HTMLElement[];\nexport function $(\n\tparam: string | HTMLElement | Array | IJQuery,\n\tmulti?: false,\n): HTMLElement;\nexport function $(\n\tparam: string | HTMLElement | WindowMockType | IJQuery,\n\tmulti?: false,\n): HTMLElement | WindowMockType;\nexport function $(\n\tparam: string | WindowMockType | HTMLElement | Array | IJQuery,\n\tmulti = false,\n): HTMLElement | WindowMockType | HTMLElement[] {\n\tlet el: WindowMockType | HTMLElement | HTMLElement[] | NodeListOf;\n\n\tif (typeof param === \"string\") { // String (HTML, Selector)\n\t\t// check if string is HTML tag format\n\t\tconst match = matchHTML(param);\n\n\t\t// creating element\n\t\tif (match) { // HTML\n\t\t\tconst dummy = document.createElement(\"div\");\n\n\t\t\tdummy.innerHTML = param;\n\t\t\tel = dummy.childNodes as NodeListOf;\n\t\t} else { // Selector\n\t\t\tel = document.querySelectorAll(param);\n\t\t}\n\t\tif (multi) {\n\t\t\treturn toArray(el as NodeListOf);\n\t\t} else {\n\t\t\treturn el && (el as NodeListOf)[0];\n\t\t}\n\t} else if (isWindow(param)) { // window\n\t\tel = param;\n\t} else if (isJQuery(param)) { // jQuery\n\t\tel = multi ? $(param.toArray(), true) :\n\t\t\t$(param.get(0), false);\n\t} else if (Array.isArray(param)) {\n\t\tel = param.map(v => $(v));\n\t\tif (!multi) {\n\t\t\tel = el.length >= 1 ? (el as HTMLElement[])[0] : undefined;\n\t\t}\n\t} else if (param.nodeName &&\n\t\t(param.nodeType === 1 || param.nodeType === 9)) { // HTMLElement, Document\n\t\tel = param;\n\t}\n\treturn el;\n}\nexport function addEvent(\n\telement: Element | WindowMockType,\n\ttype: string,\n\thandler: (...args: any[]) => any,\n\teventListenerOptions?: boolean | { [key: string]: any },\n) {\n\tif (SUPPORT_ADDEVENTLISTENER) {\n\t\tlet options = eventListenerOptions || false;\n\n\t\tif (typeof eventListenerOptions === \"object\") {\n\t\t\toptions = SUPPORT_PASSIVE ? eventListenerOptions : false;\n\t\t}\n\t\telement.addEventListener(type, handler, options);\n\t} else if ((element as any).attachEvent) {\n\t\t(element as any).attachEvent(`on${type}`, handler);\n\t} else {\n\t\t(element as any)[`on${type}`] = handler;\n\t}\n}\nexport function removeEvent(\n\telement: Element | WindowMockType,\n\ttype: string,\n\thandler: (...args: any[]) => any,\n) {\n\tif (element.removeEventListener) {\n\t\telement.removeEventListener(type, handler, false);\n\t} else if ((element as any).detachEvent) {\n\t\t(element as any).detachEvent(`on${type}`, handler);\n\t} else {\n\t\t(element as any)[`on${type}`] = null;\n\t}\n}\nexport function addOnceEvent(\n\telement: Element,\n\ttype: string,\n\thandler: (...args: any[]) => any,\n\teventListenerOptions?: boolean | { [key: string]: any },\n) {\n\tconst callback = (e: any) => {\n\t\tremoveEvent(element, type, callback);\n\t\thandler(e);\n\t};\n\n\taddEvent(element, type, callback, eventListenerOptions);\n}\nexport function scroll(el: HTMLElement | WindowMockType, horizontal = false) {\n\tconst prop = `scroll${horizontal ? \"Left\" : \"Top\"}` as \"scrollLeft\" | \"scrollTop\";\n\n\tif (isWindow(el)) {\n\t\treturn window[horizontal ? \"pageXOffset\" : \"pageYOffset\"] || document.body[prop] || document.documentElement[prop];\n\t} else {\n\t\treturn el[prop];\n\t}\n}\nexport function scrollTo(el: WindowMockType | Element, x: number, y: number) {\n\tif (isWindow(el)) {\n\t\tel.scroll(x, y);\n\t} else {\n\t\tel.scrollLeft = x;\n\t\tel.scrollTop = y;\n\t}\n}\nexport function scrollBy(el: WindowMockType | Element, x: number, y: number) {\n\tif (isWindow(el)) {\n\t\tel.scrollBy(x, y);\n\t} else {\n\t\tel.scrollLeft += x;\n\t\tel.scrollTop += y;\n\t}\n}\nexport function getStyles(el: Element) {\n\treturn (SUPPORT_COMPUTEDSTYLE ?\n\t\twindow.getComputedStyle(el) : (el as any).currentStyle) || {};\n}\nfunction _getSize(el: WindowMockType | Document | HTMLElement, name: \"Width\" | \"Height\", isOffset?: boolean) {\n\tif (isWindow(el)) { // WINDOW\n\t\treturn window[`inner${name}` as InnerSizeType] || document.body[`client${name}` as ClientSizeType];\n\t} else if (isDocument(el)) { // DOCUMENT_NODE\n\t\tconst doc = (el as Document).documentElement;\n\t\tconst body = (el as Document).body;\n\n\t\treturn Math.max(\n\t\t\tbody[`scroll${name}` as ScrollSizeType], doc[`scroll${name}` as ScrollSizeType],\n\t\t\tbody[`offset${name}` as OffsetSizeType], doc[`offset${name}` as OffsetSizeType],\n\t\t\tdoc[`client${name}` as ClientSizeType],\n\t\t);\n\t} else { // NODE\n\t\tlet size = 0;\n\n\t\tif (isOffset) {\n\t\t\tconst clientRect = el.getBoundingClientRect();\n\n\t\t\tsize = name === \"Width\" ? clientRect.right - clientRect.left : clientRect.bottom - clientRect.top;\n\t\t} else {\n\t\t\tsize = el[`client${name}` as ClientSizeType] || el[`offset${name}` as OffsetSizeType];\n\t\t}\n\t\treturn parseFloat(size || getStyles(el)[name.toLowerCase()]) || 0;\n\t}\n}\n\nexport function innerWidth(el: WindowMockType | Document | HTMLElement) {\n\treturn _getSize(el, \"Width\", false);\n}\nexport function innerHeight(el: WindowMockType | Document | HTMLElement) {\n\treturn _getSize(el, \"Height\", false);\n}\nexport function outerWidth(el: WindowMockType | Document | HTMLElement) {\n\treturn _getSize(el, \"Width\", true);\n}\nexport function outerHeight(el: WindowMockType | Document | HTMLElement) {\n\treturn _getSize(el, \"Height\", true);\n}\nexport function getSize(el: HTMLElement) {\n\treturn {\n\t\twidth: outerWidth(el),\n\t\theight: outerHeight(el),\n\t};\n}\nexport const STYLE: {\n\tvertical: IRectlProperties,\n\thorizontal: IRectlProperties,\n} = {\n\tvertical: {\n\t\tstartPos1: \"top\",\n\t\tendPos1: \"bottom\",\n\t\tsize1: \"height\",\n\t\tstartPos2: \"left\",\n\t\tendPos2: \"right\",\n\t\tsize2: \"width\",\n\t},\n\thorizontal: {\n\t\tstartPos1: \"left\",\n\t\tendPos1: \"right\",\n\t\tsize1: \"width\",\n\t\tstartPos2: \"top\",\n\t\tendPos2: \"bottom\",\n\t\tsize2: \"height\",\n\t},\n};\n\nexport function getStyleNames(isHorizontal: boolean): IRectlProperties {\n\treturn STYLE[isHorizontal ? HORIZONTAL : VERTICAL];\n}\nexport function assign(target: A, source: B): A & B;\nexport function assign(target: A, source1: B, source2: C): A & B & C;\nexport function assign(target: A, source1: B, source2: C, source3: D): A & B & C & D;\nexport function assign(target: { [key: string]: any }, ...sources: Array<{ [key: string]: any }>): { [key: string]: any };\nexport function assign(target: { [key: string]: any }, ...sources: Array<{ [key: string]: any }>) {\n\tsources.forEach(source => {\n\t\tfor (const key in source) {\n\t\t\ttarget[key] = source[key];\n\t\t}\n\t});\n\treturn target;\n}\nexport function assignOptions(\n\tdefaultOptions: A, options: B): typeof DEFAULT_OPTIONS & A & B {\n\treturn assign({},\n\t\tDEFAULT_OPTIONS,\n\t\tdefaultOptions,\n\t\toptions);\n}\n\nexport function toZeroArray(outline?: number[]) {\n\tif (!outline || !outline.length) {\n\t\treturn [0];\n\t}\n\treturn outline;\n}\nexport function cloneItems(items: T[]) {\n\treturn items.map(item => assign({}, item));\n}\nexport function isJQuery(el: any): el is IJQuery {\n\treturn (typeof (window as any).jQuery === \"function\" && el instanceof (window as any).jQuery) ||\n\t\tel.constructor.prototype.jquery && el.toArray;\n}\nexport function isWindow(el: any): el is WindowMockType {\n\treturn el === window;\n}\nexport function isDocument(el: Node): el is Document {\n\treturn el.nodeType === 9;\n}\n\nexport function fill(arr: T[], value: T) {\n\tconst length = arr.length;\n\n\tfor (let i = length - 1; i >= 0; --i) {\n\t\tarr[i] = value;\n\t}\n\n\treturn arr;\n}\n\nexport function isUndefined(target: any): target is undefined {\n\treturn typeof target === \"undefined\";\n}\n","import { MULTI, GROUPKEY_ATT, IGNORE_CLASSNAME, DUMMY_POSITION } from \"./consts\";\nimport { $, toArray, isUndefined, assign } from \"./utils\";\nimport { CursorType, IJQuery, IInfiniteGridGroup, IInfiniteGridItem, IItemManagerStatus } from \"./types\";\n\nexport default class ItemManager {\n\tpublic static from(\n\t\telements: HTMLElement[] | string | string[] | IJQuery, selector: string,\n\t\t{ groupKey }: { groupKey: string | number }) {\n\t\tconst filted = ItemManager.selectItems($(elements, MULTI), selector);\n\n\t\t// Item Structure\n\t\treturn toArray(filted).map(el => ({\n\t\t\tel,\n\t\t\tgroupKey,\n\t\t\tcontent: el.outerHTML,\n\t\t\trect: {\n\t\t\t\ttop: DUMMY_POSITION,\n\t\t\t\tleft: DUMMY_POSITION,\n\t\t\t},\n\t\t}));\n\t}\n\tpublic static selectItems(elements: HTMLElement[], selector?: string) {\n\t\treturn elements.filter(v => {\n\t\t\tconst classNames = v.className.split(\" \");\n\n\t\t\tif (classNames.some(c => c === IGNORE_CLASSNAME)) {\n\t\t\t\treturn false;\n\t\t\t} else if (!selector || selector === \"*\") {\n\t\t\t\treturn v;\n\t\t\t} else {\n\t\t\t\treturn classNames.some(c => c === selector);\n\t\t\t}\n\t\t});\n\t}\n\tpublic static pluck(data: A[], property: B):\n\t\tA[B] extends any[] ? A[B] : Array {\n\t\treturn data.reduce((acc, v) => acc.concat(v[property]), []) as any;\n\t}\n\tpublic _data: IInfiniteGridGroup[];\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\tpublic getStatus(startKey?: string | number, endKey?: string | number): IItemManagerStatus {\n\t\tconst datas = this._data;\n\t\tconst startIndex = Math.max(this.indexOf(startKey), 0);\n\t\tconst endIndex = this.indexOf(endKey) + 1 || datas.length;\n\n\t\treturn {\n\t\t\t_data: datas.slice(startIndex, endIndex).map(data => {\n\t\t\t\tconst items = data.items.map(item => {\n\t\t\t\t\tconst item2 = assign({}, item);\n\n\t\t\t\t\tdelete item2.el;\n\t\t\t\t\treturn item2;\n\t\t\t\t});\n\t\t\t\tconst data2 = assign({}, data);\n\n\t\t\t\tdata2.items = items;\n\t\t\t\treturn data2;\n\t\t\t}),\n\t\t};\n\t}\n\tpublic setStatus(status: IItemManagerStatus) {\n\t\tconst data = status._data;\n\n\t\tthis.set(data);\n\t}\n\tpublic size() {\n\t\treturn this._data.length;\n\t}\n\tpublic fit(base: number, horizontal: boolean) {\n\t\tif (!this._data.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst property = horizontal ? \"left\" : \"top\";\n\n\t\tif (base !== 0) {\n\t\t\tthis._data = this._data.map(v => {\n\t\t\t\tv.items = v.items.map(item => {\n\t\t\t\t\titem.rect[property] -= base;\n\t\t\t\t\treturn item;\n\t\t\t\t});\n\t\t\t\tv.outlines.start = v.outlines.start.map(start => start - base);\n\t\t\t\tv.outlines.end = v.outlines.end.map(end => end - base);\n\t\t\t\treturn v;\n\t\t\t});\n\t\t}\n\t}\n\tpublic pluck(property: T, start?: number, end?: number) {\n\t\tconst data = isUndefined(start) ? this._data :\n\t\t\tthis._data.slice(start, (isUndefined(end) ? start : end) + 1);\n\n\t\treturn ItemManager.pluck(data, property);\n\t}\n\tpublic getOutline(index: number, property: keyof IInfiniteGridGroup[\"outlines\"]) {\n\t\tconst data = this._data[index];\n\n\t\treturn data ? data.outlines[property] : [];\n\t}\n\tpublic getEdgeIndex(cursor: CursorType, start: number, end: number) {\n\t\tconst prop = cursor === \"start\" ? \"min\" : \"max\";\n\t\tlet index = -1;\n\t\tlet targetValue = cursor === \"start\" ? Infinity : -Infinity;\n\n\t\tfor (let i = start; i <= end; i++) {\n\t\t\tconst value = Math[prop](...this.getOutline(i, cursor));\n\n\t\t\tif ((cursor === \"start\" && targetValue > value) ||\n\t\t\t\t(cursor === \"end\" && targetValue < value)) {\n\t\t\t\ttargetValue = value;\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t}\n\t\treturn index;\n\t}\n\tpublic getEdgeValue(cursor: CursorType, start: number, end: number) {\n\t\tconst outlines = this.pluck(\"outlines\", this.getEdgeIndex(cursor, start, end))\n\t\t\t.reduce((acc, v) => acc.concat(v[cursor]), []);\n\n\t\treturn outlines.length ? Math[cursor === \"start\" ? \"min\" : \"max\"](...outlines) : 0;\n\t}\n\tpublic clearOutlines(startCursor = -1, endCursor = -1) {\n\t\tconst datas = this.get();\n\n\t\tdatas.forEach((group, cursor) => {\n\t\t\tif (startCursor <= cursor && cursor <= endCursor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tgroup.items.forEach(item => {\n\t\t\t\titem.rect.top = DUMMY_POSITION;\n\t\t\t\titem.rect.left = DUMMY_POSITION;\n\t\t\t});\n\t\t\tgroup.outlines.start = [];\n\t\t\tgroup.outlines.end = [];\n\t\t});\n\t}\n\tpublic getMaxEdgeValue() {\n\t\tconst groups = this.get();\n\t\tconst length = groups.length;\n\n\t\tfor (let i = length - 1; i >= 0; --i) {\n\t\t\tconst end = groups[i].outlines.end;\n\n\t\t\tif (end.length) {\n\t\t\t\tconst pos = Math.max(...end);\n\n\t\t\t\treturn pos;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\tpublic append(layouted: IInfiniteGridGroup) {\n\t\tthis._data.push(layouted);\n\t\treturn layouted.items;\n\t}\n\tpublic prepend(layouted: IInfiniteGridGroup) {\n\t\tthis._data.unshift(layouted);\n\t\treturn layouted.items;\n\t}\n\tpublic clear() {\n\t\tthis._data = [];\n\t}\n\tpublic remove(element: HTMLElement, start: number, end: number) {\n\t\tlet items: IInfiniteGridItem[] = [];\n\t\tlet groups: IInfiniteGridGroup[] = [];\n\t\tconst key = element.getAttribute(GROUPKEY_ATT);\n\t\tconst datas = this.get(start, end)\n\t\t\t.filter(v => String(v.groupKey) === key);\n\n\t\tif (!datas.length) {\n\t\t\treturn { items, groups };\n\t\t}\n\t\tconst data = datas[0];\n\n\t\tconst length = data.items.length;\n\t\tlet idx = -1;\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tif (data.items[i].el === element) {\n\t\t\t\tidx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (idx >= 0) {\n\t\t\t// remove item information\n\t\t\titems = data.items.splice(idx, 1);\n\n\t\t\tif (!data.items.length) {\n\t\t\t\tthis._data.splice(this.indexOf(data), 1);\n\t\t\t\tgroups = [data];\n\t\t\t} else {\n\t\t\t\tthis.set(data, key);\n\t\t\t}\n\t\t}\n\t\treturn { items, groups };\n\t}\n\tpublic indexOf(data: IInfiniteGridGroup | string | number) {\n\t\tconst groupKey = typeof data === \"object\" ? data.groupKey : data;\n\t\tconst datas = this._data;\n\t\tconst length = datas.length;\n\n\t\tfor (let i = 0; i < length; ++i) {\n\t\t\tif (groupKey === datas[i].groupKey) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\tpublic get(start?: number, end?: number) {\n\t\treturn isUndefined(start) ? this._data :\n\t\t\tthis._data.slice(start, (isUndefined(end) ? start : end) + 1);\n\t}\n\tpublic set(data: IInfiniteGridGroup | IInfiniteGridGroup[], key?: string | number) {\n\t\tif (!Array.isArray(data)) {\n\t\t\tif (!isUndefined(key)) {\n\t\t\t\tconst len = this._data.length;\n\t\t\t\tlet idx = -1;\n\n\t\t\t\tfor (let i = 0; i < len; i++) {\n\t\t\t\t\tif (this._data[i].groupKey === key) {\n\t\t\t\t\t\tidx = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tidx > 0 && (this._data[idx] = data);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._data = data.concat();\n\t\t}\n\t}\n\tpublic getData(index: number) {\n\t\treturn this._data[index];\n\t}\n}\n","import {\n\tAPPEND,\n\tPREPEND,\n\tDUMMY_POSITION,\n\tMULTI,\n\tGROUPKEY_ATT,\n\tCONTAINER_CLASSNAME,\n\tTRANSITION_NAME,\n\tTRANSITION,\n\tTRANSITION_END,\n\tTRANSFORM,\n} from \"./consts\";\nimport { window, document } from \"./browser\";\nimport {\n\t$,\n\tinnerHeight,\n\tinnerWidth,\n\tgetSize,\n\tgetStyles,\n\taddOnceEvent,\n\tassign,\n} from \"./utils\";\nimport { RectType, IPosition, ISize, IJQuery, IInfiniteGridItem, WindowMockType, IDOMRendererStatus, IDOMRendererSize } from \"./types\";\n\nexport function resetSize(item: IInfiniteGridItem) {\n\titem.orgSize = null;\n\titem.size = null;\n}\nexport interface IDOMRendererOptions {\n\tisEqualSize: boolean;\n\tisConstantSize: boolean;\n\thorizontal: boolean;\n\tcontainer: boolean | HTMLElement;\n}\n\nexport interface IDOMRendererOrgStyle {\n\tposition?: CSSStyleDeclaration[\"position\"];\n\toverflowX?: CSSStyleDeclaration[\"overflowX\"];\n\toverflowY?: CSSStyleDeclaration[\"overflowY\"];\n}\n\nfunction createContainer(element: HTMLElement) {\n\tconst container = document.createElement(\"div\");\n\n\tcontainer.className = CONTAINER_CLASSNAME;\n\tcontainer.style.position = \"relative\";\n\tcontainer.style.height = \"100%\";\n\n\tconst children = element.children;\n\tconst length = children.length;\t// for IE8\n\n\tfor (let i = 0; i < length; i++) {\n\t\tcontainer.appendChild(children[0]);\n\t}\n\telement.appendChild(container);\n\treturn container;\n}\nfunction render(properties: RectType[], rect: IInfiniteGridItem[\"rect\"], styles: HTMLElement[\"style\"]) {\n\tproperties.forEach(p => {\n\t\t(p in rect) && (styles[p] = `${rect[p]}px`);\n\t});\n}\nfunction setTransition(styles: HTMLElement[\"style\"], transitionDuration?: number, pos1?: IPosition, pos2?: IPosition) {\n\tstyles[`${TRANSITION}-property`] = transitionDuration ? `${TRANSFORM},width,height` : \"\";\n\tstyles[`${TRANSITION}-duration`] = transitionDuration ? `${transitionDuration}s` : \"\";\n\tstyles[`${TRANSITION}-delay`] = transitionDuration ? `0s` : \"\";\n\tstyles[TRANSFORM] = transitionDuration ? `translate(${pos1.left - pos2.left}px,${pos1.top - pos2.top}px)` : \"\";\n}\n\nexport default class DOMRenderer {\n\tpublic static renderItem(item: IInfiniteGridItem, rect: IInfiniteGridItem[\"rect\"], transitionDuration?: number) {\n\t\tif (!item.el) {\n\t\t\treturn;\n\t\t}\n\t\tconst { el, prevRect } = item;\n\t\tconst styles = el.style;\n\n\t\t// for debugging\n\t\tel.setAttribute(GROUPKEY_ATT, `${item.groupKey}`);\n\t\tstyles.position = \"absolute\";\n\t\trender([\"width\", \"height\"], rect, styles);\n\t\tif (transitionDuration && TRANSITION && prevRect) {\n\t\t\tsetTransition(styles, transitionDuration, rect as IPosition, prevRect as IPosition);\n\t\t\tif ((el as any)[TRANSITION_NAME]) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tel[TRANSITION_NAME] = true;\n\t\t\taddOnceEvent(el, TRANSITION_END, () => {\n\t\t\t\tconst itemRect = item.rect;\n\n\t\t\t\tsetTransition(styles);\n\t\t\t\trender([\"left\", \"top\"], itemRect, styles);\n\t\t\t\titem.prevRect = itemRect;\n\t\t\t\tel[TRANSITION_NAME] = false;\n\t\t\t});\n\t\t} else {\n\t\t\trender([\"left\", \"top\"], rect, styles);\n\t\t\titem.prevRect = rect;\n\t\t}\n\t}\n\tpublic static renderItems(items: IInfiniteGridItem[], transitionDuration?: number) {\n\t\titems.forEach(item => {\n\t\t\tDOMRenderer.renderItem(item, item.rect, transitionDuration);\n\t\t});\n\t}\n\tpublic static removeItems(items: IInfiniteGridItem[]) {\n\t\titems.forEach(item => {\n\t\t\tif (item.el) {\n\t\t\t\tDOMRenderer.removeElement(item.el);\n\t\t\t\titem.el = null;\n\t\t\t}\n\t\t});\n\t}\n\tpublic static removeElement(element: HTMLElement) {\n\t\tconst parentNode = element && element.parentNode;\n\n\t\tif (!parentNode) {\n\t\t\treturn;\n\t\t}\n\t\tparentNode.removeChild(element);\n\t}\n\tpublic static createElements(items: IInfiniteGridItem[]) {\n\t\tif (!items.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst noElementItems = items.filter(item => !item.el);\n\n\t\tif (!noElementItems.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst elements = $(noElementItems.map(({ content }) =>\n\t\t\tcontent.replace(/^[\\s\\uFEFF]+|[\\s\\uFEFF]+$/g, \"\")).join(\"\"), MULTI);\n\n\t\tnoElementItems.forEach((item, index) => {\n\t\t\titem.el = elements[index];\n\t\t});\n\t}\n\tpublic container: HTMLElement;\n\tpublic view: WindowMockType | HTMLElement;\n\tpublic options: IDOMRendererOptions = {\n\t\tisEqualSize: false,\n\t\tisConstantSize: false,\n\t\thorizontal: false,\n\t\tcontainer: false,\n\t};\n\tpublic _size: IDOMRendererSize = {\n\t\tcontainer: -1,\n\t\tview: -1,\n\t\tviewport: -1,\n\t\titem: null,\n\t};\n\tpublic _orgStyle: IDOMRendererOrgStyle = {};\n\tconstructor(element: string | HTMLElement | IJQuery, options: IDOMRendererOptions) {\n\t\tassign(this.options, options);\n\t\tthis._init(element);\n\t\tthis.resize();\n\t}\n\tpublic getStatus() {\n\t\treturn {\n\t\t\tcssText: this.container.style.cssText,\n\t\t\t_size: assign({}, this._size),\n\t\t};\n\t}\n\tpublic setStatus(status: IDOMRendererStatus) {\n\t\tthis.container.style.cssText = status.cssText;\n\t\tassign(this._size, status._size);\n\t}\n\tpublic updateSize(items: IInfiniteGridItem[]) {\n\t\tconst { isEqualSize, isConstantSize } = this.options;\n\t\tconst size = this._size;\n\n\t\treturn items.map(item => {\n\t\t\tif (!item.el) {\n\t\t\t\treturn item;\n\t\t\t}\n\t\t\tif (isEqualSize && !size.item) {\n\t\t\t\tsize.item = getSize(item.el);\n\t\t\t}\n\t\t\titem.size = (isEqualSize && assign({}, size.item)) ||\n\t\t\t\t(isConstantSize && item.orgSize && assign({}, item.orgSize)) ||\n\t\t\t\tgetSize(item.el);\n\t\t\tif (!item.orgSize) {\n\t\t\t\titem.orgSize = assign({}, item.size);\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t}\n\tpublic append(items: IInfiniteGridItem[]) {\n\t\tthis._insert(items, APPEND, {\n\t\t\ttop: DUMMY_POSITION,\n\t\t\tleft: DUMMY_POSITION,\n\t\t});\n\t}\n\tpublic prepend(items: IInfiniteGridItem[]) {\n\t\tthis._insert(items, PREPEND, {\n\t\t\ttop: DUMMY_POSITION,\n\t\t\tleft: DUMMY_POSITION,\n\t\t});\n\t}\n\tpublic createAndInsert(items: IInfiniteGridItem[], isAppend?: boolean) {\n\t\tDOMRenderer.createElements(items);\n\n\t\tDOMRenderer.renderItems(items);\n\t\tthis._insert(items, isAppend);\n\t}\n\tpublic getViewSize() {\n\t\treturn this._size.view;\n\t}\n\tpublic getViewportSize() {\n\t\treturn this._size.viewport;\n\t}\n\tpublic getContainerSize() {\n\t\treturn this._size.container;\n\t}\n\tpublic setContainerSize(size: number) {\n\t\tthis._size.container = size;\n\t\tthis.container.style[this.options.horizontal ? \"width\" : \"height\"] = `${size}px`;\n\t}\n\tpublic resize() {\n\t\tconst horizontal = this.options.horizontal;\n\t\tconst view = this.view;\n\t\tconst isResize = this.isNeededResize();\n\n\t\tif (isResize) {\n\t\t\tthis._size = {\n\t\t\t\tviewport: this._calcSize(),\n\t\t\t\titem: null,\n\t\t\t};\n\t\t}\n\t\tthis._size.view = horizontal ? innerWidth(view) : innerHeight(view);\n\t\treturn isResize;\n\t}\n\tpublic isNeededResize() {\n\t\treturn this._calcSize() !== this._size.viewport;\n\t}\n\tpublic clear() {\n\t\tthis.container.innerHTML = \"\";\n\t\tthis.container.style[this.options.horizontal ? \"width\" : \"height\"] = \"\";\n\n\t\tthis._size = {\n\t\t\titem: null,\n\t\t\tviewport: -1,\n\t\t\tcontainer: -1,\n\t\t\tview: -1,\n\t\t};\n\t}\n\tpublic destroy() {\n\t\tthis.clear();\n\t\tconst container = this.options.container;\n\n\t\tfor (const p in this._orgStyle) {\n\t\t\t(this[container ? \"view\" : \"container\"] as HTMLElement).style[p as keyof IDOMRendererOrgStyle] =\n\t\t\t\tthis._orgStyle[p as keyof IDOMRendererOrgStyle];\n\t\t}\n\t\tcontainer && this.container.parentNode.removeChild(this.container);\n\t}\n\tprivate _init(el: HTMLElement | IJQuery | string) {\n\t\tconst element = $(el);\n\t\tconst style = getStyles(element);\n\t\tconst { container, horizontal } = this.options;\n\n\t\tif (style.position === \"static\") {\n\t\t\tthis._orgStyle.position = element.style.position;\n\t\t\telement.style.position = \"relative\";\n\t\t}\n\t\tif (container) {\n\t\t\tconst target = horizontal ? [\"X\", \"Y\"] : [\"Y\", \"X\"];\n\n\t\t\tthis._orgStyle.overflowX = element.style.overflowX;\n\t\t\tthis._orgStyle.overflowY = element.style.overflowY;\n\t\t\telement.style[`overflow${target[0]}` as \"overflowX\" | \"overflowY\"] = \"scroll\";\n\t\t\telement.style[`overflow${target[1]}` as \"overflowX\" | \"overflowY\"] = \"hidden\";\n\t\t\tthis.view = element;\n\t\t\tthis.container = container === true ? createContainer(this.view as HTMLElement) : container;\n\t\t} else {\n\t\t\tthis.view = window;\n\t\t\tthis.container = element;\n\t\t}\n\t}\n\tprivate _insert(items: IInfiniteGridItem[], isAppend?: boolean, styles?: IInfiniteGridItem[\"rect\"]) {\n\t\tconst container = this.container;\n\t\tconst df = document.createDocumentFragment();\n\n\t\titems.forEach(item => {\n\t\t\tstyles && DOMRenderer.renderItem(item, styles);\n\t\t\tisAppend ? df.appendChild(item.el) : df.insertBefore(item.el, df.firstChild);\n\t\t});\n\t\tisAppend ?\n\t\t\tcontainer.appendChild(df) :\n\t\t\tcontainer.insertBefore(df, container.firstChild);\n\t}\n\tprivate _calcSize() {\n\t\treturn this.options.horizontal ?\n\t\t\tinnerHeight(this.container) : innerWidth(this.container);\n\t}\n}\n","import {\n\tIS_IOS,\n} from \"./consts\";\nimport {\n\twindow,\n} from \"./browser\";\nimport {\n\taddEvent,\n\tremoveEvent,\n\tscroll,\n\tscrollTo,\n\tscrollBy,\n\tassign,\n} from \"./utils\";\nimport { WindowMockType, IWatchStatus } from \"./types\";\n\nexport interface IWatcherOptions {\n\tcontainer: HTMLElement;\n\tisOverflowScroll: boolean;\n\thorizontal: boolean;\n\tresize: () => void;\n\tcheck: (e?: {\n\t\tisForward: boolean,\n\t\tscrollPos: number,\n\t\torgScrollPos: number,\n\t\thorizontal: boolean,\n\t}) => void;\n}\n\nexport default class Watcher {\n\tpublic options: IWatcherOptions;\n\tprivate _timer: {\n\t\tresize: any;\n\t};\n\tprivate _containerOffset: number;\n\tprivate _view: WindowMockType | HTMLElement;\n\tprivate _isScrollIssue: boolean;\n\tprivate _prevPos: number;\n\tconstructor(view: WindowMockType | HTMLElement, options: Partial = {}) {\n\t\tassign(this.options = {\n\t\t\tcontainer: view as HTMLElement,\n\t\t\tresize: () => void 0,\n\t\t\tcheck: () => void 0,\n\t\t\tisOverflowScroll: false,\n\t\t\thorizontal: false,\n\t\t}, options);\n\t\tthis._timer = {\n\t\t\tresize: null,\n\t\t};\n\t\tthis.reset();\n\t\tthis._containerOffset = 0;\n\t\tthis._view = view;\n\t\tthis._isScrollIssue = IS_IOS;\n\t\tthis._onCheck = this._onCheck.bind(this);\n\t\tthis._onResize = this._onResize.bind(this);\n\t\tthis.attachEvent();\n\t\tthis.resize();\n\t\tthis.setScrollPos();\n\t}\n\tpublic getStatus(): IWatchStatus {\n\t\treturn {\n\t\t\t_prevPos: this._prevPos,\n\t\t\tscrollPos: this.getOrgScrollPos(),\n\t\t};\n\t}\n\tpublic setStatus(status: IWatchStatus, applyScrollPos = true) {\n\t\tthis._prevPos = status._prevPos;\n\t\tapplyScrollPos && this.scrollTo(status.scrollPos);\n\t}\n\tpublic scrollBy(pos: number) {\n\t\tconst arrPos = this.options.horizontal ? [pos, 0] : [0, pos];\n\n\t\tscrollBy(this._view, arrPos[0], arrPos[1]);\n\t\tthis.setScrollPos();\n\t}\n\tpublic scrollTo(pos: number) {\n\t\tconst arrPos = this.options.horizontal ? [pos, 0] : [0, pos];\n\n\t\tscrollTo(this._view, arrPos[0], arrPos[1]);\n\t}\n\tpublic getScrollPos() {\n\t\treturn this._prevPos;\n\t}\n\tpublic setScrollPos(pos = this.getOrgScrollPos()) {\n\t\tlet rawPos = pos;\n\n\t\tif (typeof pos === \"undefined\") {\n\t\t\trawPos = this.getOrgScrollPos();\n\t\t}\n\t\tthis._prevPos = rawPos - this.getContainerOffset();\n\t}\n\tpublic attachEvent() {\n\t\taddEvent(this._view, \"scroll\", this._onCheck);\n\t\taddEvent(window, \"resize\", this._onResize);\n\t}\n\tpublic getOrgScrollPos() {\n\t\treturn scroll(this._view, this.options.horizontal);\n\t}\n\tpublic reset() {\n\t\tthis._prevPos = null;\n\t}\n\tpublic getContainerOffset() {\n\t\treturn this._containerOffset;\n\t}\n\tpublic resize() {\n\t\tthis._containerOffset = this.options.isOverflowScroll ? 0 : this._getOffset();\n\t}\n\tpublic detachEvent() {\n\t\tremoveEvent(this._view, \"scroll\", this._onCheck);\n\t\tremoveEvent(window, \"resize\", this._onResize);\n\t}\n\tpublic destroy() {\n\t\tthis.detachEvent();\n\t\tthis.reset();\n\t}\n\tprivate _onCheck() {\n\t\tconst prevPos = this.getScrollPos();\n\t\tconst orgScrollPos = this.getOrgScrollPos();\n\n\t\tthis.setScrollPos(orgScrollPos);\n\t\tconst scrollPos = this.getScrollPos();\n\n\t\tif (prevPos === null || (this._isScrollIssue && orgScrollPos === 0) || prevPos === scrollPos) {\n\t\t\torgScrollPos && (this._isScrollIssue = false);\n\t\t\treturn;\n\t\t}\n\t\tthis._isScrollIssue = false;\n\t\tthis.options.check({\n\t\t\tisForward: prevPos < scrollPos,\n\t\t\tscrollPos,\n\t\t\torgScrollPos,\n\t\t\thorizontal: this.options.horizontal,\n\t\t});\n\t}\n\tprivate _getOffset() {\n\t\tconst { container, horizontal } = this.options;\n\t\tconst rect = container.getBoundingClientRect();\n\n\t\treturn rect[horizontal ? \"left\" : \"top\"] + this.getOrgScrollPos();\n\t}\n\tprivate _onResize() {\n\t\tif (this._timer.resize) {\n\t\t\tclearTimeout(this._timer.resize);\n\t\t}\n\t\tthis._timer.resize = setTimeout(() => {\n\t\t\tthis.resize();\n\t\t\tthis.options.resize();\n\t\t\tthis._timer.resize = null;\n\t\t\tthis.reset();\n\t\t}, 100);\n\t}\n\n}\n","import ItemManager from \"./ItemManager\";\nimport { assign } from \"./utils\";\nimport { CursorType, IInfiniteGridItem, IInfiniteGridGroup, IInfiniteStatus } from \"./types\";\n\nfunction isVisible(group: IInfiniteGridGroup, threshold: number, scrollPos: number, endScrollPos: number) {\n\tconst { items, outlines } = group;\n\tconst start = outlines.start;\n\tconst end = outlines.end;\n\n\tif (start.length === 0 || end.length === 0 || !items.length || !items[0].el) {\n\t\treturn 2;\n\t}\n\tconst min = Math.min(...start);\n\tconst max = Math.max(...end);\n\n\tif ((endScrollPos + threshold < min)) {\n\t\treturn +1;\n\t} else if ((scrollPos - threshold > max)) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nexport interface IInfiniteOptions {\n\tuseRecycle?: boolean;\n\tthreshold?: number;\n\tappend?: (e?: { cache: IInfiniteGridGroup[] }) => void;\n\tprepend?: (e?: { cache: IInfiniteGridGroup[] }) => void;\n\trecycle?: (e?: { start: number, end: number }) => void;\n}\nclass Infinite {\n\tpublic options: Required;\n\tprivate _items: ItemManager;\n\tprivate _status: IInfiniteStatus;\n\tconstructor(itemManger: ItemManager, options: IInfiniteOptions) {\n\t\tthis.options = assign({\n\t\t\tuseRecycle: true,\n\t\t\tthreshold: 100,\n\t\t\tappend: () => void 0,\n\t\t\tprepend: () => void 0,\n\t\t\trecycle: () => void 0,\n\t\t}, options);\n\n\t\tthis._items = itemManger;\n\t\tthis.clear();\n\t}\n\tpublic setSize(size: number) {\n\t\tthis._status.size = size;\n\t}\n\tpublic recycle(scrollPos: number, isForward?: boolean) {\n\t\tif (!this.options.useRecycle) {\n\t\t\treturn;\n\t\t}\n\t\tconst { startCursor, endCursor, size } = this._status;\n\n\t\tif (startCursor === -1 || endCursor === -1) {\n\t\t\treturn;\n\t\t}\n\t\tconst endScrollPos = scrollPos + size;\n\t\tconst { threshold, recycle } = this.options;\n\t\tconst visibles = this._items.get(startCursor, endCursor)\n\t\t\t.map(group => isVisible(group, threshold, scrollPos, endScrollPos));\n\t\tconst length = visibles.length;\n\t\tlet start = isForward ? 0 : visibles.lastIndexOf(0);\n\t\tlet end = isForward ? visibles.indexOf(0) - 1 : visibles.length - 1;\n\n\t\tif (!isForward && start !== -1) {\n\t\t\tstart += 1;\n\t\t}\n\t\tif (start < 0 || end < 0 || start > end || end - start + 1 >= length) {\n\t\t\treturn;\n\t\t}\n\t\tstart = startCursor + start;\n\t\tend = startCursor + end;\n\n\t\trecycle({ start, end });\n\t\tif (isForward) {\n\t\t\tthis.setCursor(\"start\", end + 1);\n\t\t} else {\n\t\t\tthis.setCursor(\"end\", start - 1);\n\t\t}\n\t}\n\tpublic scroll(scrollPos: number) {\n\t\tconst startCursor = this.getCursor(\"start\");\n\t\tconst endCursor = this.getCursor(\"end\");\n\t\tconst items = this._items;\n\n\t\tif (typeof scrollPos !== \"number\" || startCursor === -1 ||\n\t\t\tendCursor === -1 || !items.size()) {\n\t\t\treturn;\n\t\t}\n\t\tconst size = this._status.size;\n\t\tconst { threshold, append, prepend } = this.options;\n\t\tconst datas = items.get();\n\t\tconst endScrollPos = scrollPos + size;\n\t\tconst startEdgePos = Math.max(...datas[startCursor].outlines.start);\n\t\tconst endEdgePos = Math.min(...datas[endCursor].outlines.end);\n\t\tconst visibles = datas.map((group, i) => {\n\t\t\tconst { start, end } = group.outlines;\n\n\t\t\tif (!start.length || !end.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst startPos = Math.min(...start);\n\t\t\tconst endPos = Math.max(...end);\n\n\t\t\tif (startPos - threshold <= endScrollPos && scrollPos <= endPos + threshold) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t\tconst startIndex = visibles.indexOf(true);\n\t\tconst endIndex = visibles.lastIndexOf(true);\n\n\t\tif (~startIndex && startIndex < startCursor) {\n\t\t\tprepend({ cache: datas.slice(startIndex, Math.min(startCursor, endIndex + 1)) });\n\t\t} else if (endCursor < endIndex) {\n\t\t\tappend({ cache: datas.slice(Math.max(startIndex, endCursor + 1), endIndex + 1) });\n\t\t} else if (endScrollPos >= endEdgePos - threshold) {\n\t\t\tappend({ cache: datas.slice(endCursor + 1, endCursor + 2) });\n\t\t} else if (scrollPos <= startEdgePos + threshold) {\n\t\t\tprepend({ cache: datas.slice(startCursor - 1, startCursor) });\n\t\t}\n\t}\n\tpublic setCursor(cursor: CursorType, index: number) {\n\t\tconst status = this._status;\n\t\tconst items = this._items;\n\t\tconst size = items.size();\n\n\t\tif (!this.options.useRecycle) {\n\t\t\tstatus.startCursor = 0;\n\t\t\tif (items.getOutline(size - 1, \"end\").length) {\n\t\t\t\tstatus.endCursor = size - 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (cursor !== \"end\") {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (cursor === \"start\") {\n\t\t\tstatus.startCursor = index;\n\t\t} else {\n\t\t\tstatus.endCursor = Math.min(size - 1, index);\n\t\t}\n\t\tstatus.startCursor = Math.max(0, status.startCursor);\n\t}\n\tpublic setStatus(status: IInfiniteStatus) {\n\t\tthis._status = assign(this._status, status);\n\t}\n\tpublic getStatus(startKey: string | number, endKey: string | number): IInfiniteStatus {\n\t\tconst { startCursor, endCursor, size } = this._status;\n\t\tconst startIndex = Math.max(this._items.indexOf(startKey), 0);\n\t\tconst endIndex = (this._items.indexOf(endKey) + 1 || this._items.size()) - 1;\n\t\tconst start = Math.max(startCursor - startIndex, ~startCursor ? 0 : -1);\n\t\tconst end = Math.max(Math.min(endCursor - startIndex, endIndex - startIndex), start);\n\n\t\treturn {\n\t\t\tstartCursor: start,\n\t\t\tendCursor: end,\n\t\t\tsize,\n\t\t};\n\t}\n\tpublic getEdgeOutline(cursor: CursorType) {\n\t\tconst { startCursor, endCursor } = this._status;\n\n\t\tif (startCursor === -1 || endCursor === -1) {\n\t\t\treturn [];\n\t\t}\n\t\treturn this._items.getOutline(cursor === \"start\" ? startCursor : endCursor, cursor);\n\t}\n\tpublic getEdgeValue(cursor: CursorType) {\n\t\tconst outlines = this.getEdgeOutline(cursor);\n\n\t\treturn outlines.length ? Math[cursor === \"start\" ? \"min\" : \"max\"](...outlines) : 0;\n\t}\n\tpublic getVisibleItems() {\n\t\treturn this._items.pluck(\"items\", this._status.startCursor, this._status.endCursor);\n\t}\n\tpublic getCursor(cursor: CursorType) {\n\t\treturn this._status[cursor === \"start\" ? \"startCursor\" : \"endCursor\"];\n\t}\n\tpublic getVisibleData() {\n\t\treturn this._items.get(this._status.startCursor, this._status.endCursor);\n\t}\n\tpublic remove(element: HTMLElement): {\n\t\titems: IInfiniteGridItem[],\n\t\tgroups: IInfiniteGridGroup[],\n\t} {\n\t\tconst { startCursor, endCursor } = this._status;\n\t\tconst result =\n\t\t\tthis._items.remove(element, startCursor, endCursor);\n\n\t\tif (result.groups.length) {\n\t\t\tthis.setCursor(\"end\", endCursor - 1);\n\t\t}\n\t\tif (!this._items.size()) {\n\t\t\tthis._status.startCursor = -1;\n\t\t\tthis._status.endCursor = -1;\n\t\t}\n\t\treturn result;\n\t}\n\tpublic clear() {\n\t\tthis._status = {\n\t\t\tstartCursor: -1,\n\t\t\tendCursor: -1,\n\t\t\tsize: -1,\n\t\t};\n\t}\n}\n\nexport default Infinite;\n","import { window } from \"./browser\";\nimport { addEvent, removeEvent, innerWidth, innerHeight } from \"./utils\";\n\nconst elements: HTMLElement[] = [];\n\nfunction onResize() {\n\tAutoSizer.resizeAll();\n}\nexport interface IAutoSizierElemenet extends HTMLElement {\n\t__PREFIX__?: string;\n}\nexport default class AutoSizer {\n\tpublic static add(element: IAutoSizierElemenet, prefix = \"data-\") {\n\t\tif (!elements.length) {\n\t\t\taddEvent(window, \"resize\", onResize);\n\t\t}\n\t\telement.__PREFIX__ = prefix;\n\t\telements.push(element);\n\t\tAutoSizer.resize(element);\n\t}\n\tpublic static remove(element: IAutoSizierElemenet, isFixed = false) {\n\t\tconst fixed = element.getAttribute(`${element.__PREFIX__}fixed`) || \"width\";\n\n\t\tif (!isFixed) {\n\t\t\telement.style[fixed === \"width\" ? \"height\" : \"width\"] = \"\";\n\t\t}\n\t\tconst index = elements.indexOf(element);\n\n\t\tif (index < 0) {\n\t\t\treturn;\n\t\t}\n\t\telements.splice(index, 1);\n\t\tif (!elements.length) {\n\t\t\tremoveEvent(window, \"reisze\", onResize);\n\t\t}\n\t}\n\tpublic static resize(element: IAutoSizierElemenet, prefix = \"data-\") {\n\t\tconst elementPrefix = typeof element.__PREFIX__ === \"string\" ? element.__PREFIX__ : prefix;\n\t\tconst dataWidth = parseInt(element.getAttribute(`${elementPrefix}width`), 10) || 0;\n\t\tconst dataHeight = parseInt(element.getAttribute(`${elementPrefix}height`), 10) || 0;\n\t\tconst fixed = element.getAttribute(`${elementPrefix}fixed`);\n\n\t\tif (fixed === \"height\") {\n\t\t\tconst size = innerHeight(element) || dataHeight;\n\n\t\t\telement.style.width = `${dataWidth / dataHeight * size}px`;\n\t\t} else {\n\t\t\tconst size = innerWidth(element) || dataWidth;\n\n\t\t\telement.style.height = `${dataHeight / dataWidth * size}px`;\n\t\t}\n\t}\n\tpublic static resizeAll() {\n\t\telements.forEach(element => AutoSizer.resize(element));\n\t}\n}\n","import { IS_IE } from \"./consts\";\nimport { addEvent, removeEvent, toArray } from \"./utils\";\nimport AutoSizer from \"./AutoSizer\";\n\nexport const CHECK_ALL: 1 = 1;\nexport const CHECK_ONLY_ERROR: 2 = 2;\n\nexport interface IImageLoadedOptions {\n\tprefix?: string;\n\tlength?: number;\n\ttype?: 1 | 2;\n\tcomplete?: () => void;\n\tend?: () => void;\n\terror?: (e: { target: LoadingImageElement, itemIndex: number }) => void;\n}\nexport interface LoadingImageElement extends HTMLImageElement {\n\t__ITEM_INDEX__?: number;\n}\n\nfunction isDataAttribute(target: HTMLElement, prefix: string) {\n\treturn !!target.getAttribute(`${prefix}width`);\n}\n\nclass ImageLoaded {\n\tpublic static CHECK_ALL = 1;\n\tpublic static CHECK_ONLY_ERROR = 2;\n\tpublic static waitImageLoaded(\n\t\tchecklist: LoadingImageElement[][],\n\t\t{ prefix = \"\", length, type, complete, error, end }: IImageLoadedOptions,\n\t) {\n\t\tlet checkCount = 0;\n\t\tlet endCount = length;\n\n\t\tif (type !== CHECK_ONLY_ERROR) {\n\t\t\tcheckCount = endCount;\n\t\t}\n\t\tconst checkEnd = () => {\n\t\t\tif (--endCount !== 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tend && end();\n\t\t};\n\t\tconst checkImage = () => {\n\t\t\tcheckCount--;\n\t\t\tif (checkCount !== 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcomplete && complete();\n\t\t};\n\t\tconst onError = (target: LoadingImageElement, itemIndex = target.__ITEM_INDEX__) => {\n\t\t\terror && error({\n\t\t\t\ttarget,\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t};\n\t\tconst onCheck = (e: Event) => {\n\t\t\tconst target = (e.target || e.srcElement) as LoadingImageElement;\n\n\t\t\tremoveEvent(target, \"error\", onCheck);\n\t\t\tremoveEvent(target, \"load\", onCheck);\n\n\t\t\tif (type === CHECK_ALL && isDataAttribute(target, prefix)) {\n\t\t\t\tAutoSizer.remove(target, e.type === \"error\");\n\t\t\t} else {\n\t\t\t\tcheckImage();\n\t\t\t}\n\t\t\tif (e.type === \"error\") {\n\t\t\t\tonError(target);\n\t\t\t}\n\t\t\tdelete target.__ITEM_INDEX__;\n\t\t\tcheckEnd();\n\t\t};\n\n\t\tchecklist.forEach((images, i) => {\n\t\t\timages.forEach(v => {\n\t\t\t\t// workaround for IE\n\t\t\t\tif (v.complete && (!IS_IE || (IS_IE && v.naturalWidth))) {\n\t\t\t\t\tif (!v.naturalWidth) {\n\t\t\t\t\t\tonError(v, i);\n\t\t\t\t\t}\n\t\t\t\t\tcheckImage();\n\t\t\t\t\tcheckEnd();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tv.__ITEM_INDEX__ = i;\n\t\t\t\tif (type === CHECK_ALL && isDataAttribute(v, prefix)) {\n\t\t\t\t\tAutoSizer.add(v, prefix);\n\t\t\t\t\tcheckImage();\n\t\t\t\t}\n\t\t\t\taddEvent(v, \"load\", onCheck);\n\t\t\t\taddEvent(v, \"error\", onCheck);\n\n\t\t\t\tIS_IE && v.setAttribute(\"src\", v.getAttribute(\"src\"));\n\t\t\t});\n\t\t});\n\t}\n\tpublic static checkImageLoaded(el: HTMLElement) {\n\t\tif (el.tagName === \"IMG\") {\n\t\t\treturn (el as HTMLImageElement).complete ? [] : [(el as HTMLImageElement)];\n\t\t} else {\n\t\t\treturn toArray(el.querySelectorAll(\"img\"));\n\t\t}\n\t}\n\tpublic static check(\n\t\telements: HTMLElement[],\n\t\t{ prefix, type = CHECK_ALL, complete, error, end }: IImageLoadedOptions,\n\t) {\n\t\tconst images = elements.map(element => this.checkImageLoaded(element));\n\t\tconst length = images.reduce((sum, element) => sum + element.length, 0);\n\n\t\tif (type === CHECK_ONLY_ERROR || length === 0) {\n\t\t\t// convert to async\n\t\t\tsetTimeout(() => {\n\t\t\t\tcomplete && complete();\n\t\t\t\tif (length === 0) {\n\t\t\t\t\tend && end();\n\t\t\t\t}\n\t\t\t}, 0);\n\t\t}\n\t\tif (length > 0) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.waitImageLoaded(images, { prefix, length, type, complete, error, end });\n\t\t\t}, 0);\n\t\t}\n\t}\n}\n\nexport default ImageLoaded;\n","import AutoSizer from \"./AutoSizer\";\nimport ImageLoaded, { CHECK_ALL, CHECK_ONLY_ERROR } from \"./ImageLoaded\";\nimport ItemManager from \"./ItemManager\";\nimport { matchHTML, $, assign } from \"./utils\";\nimport { DUMMY_POSITION } from \"./consts\";\nimport DOMRenderer from \"./DOMRenderer\";\nimport { ILayout, ILayoutResult, IInfiniteGridItem, IInfiniteGridGroup, IErrorCallbackOptions } from \"./types\";\n\nfunction hasTarget(target: T[], value: T) {\n\treturn ~target.indexOf(value);\n}\n\nexport interface ILayoutManagerOptions {\n\tattributePrefix?: string;\n\tisEqualSize?: boolean;\n\tisConstantSize?: boolean;\n\thorizontal?: boolean;\n}\n\nexport interface ICompleteCallbackOptions {\n\tgroups?: ILayoutResult[];\n\titems?: IInfiniteGridItem[];\n\tisAppend?: boolean;\n}\nexport interface IEndCallbackOptions {\n\tremove: HTMLElement[];\n\tlayout?: boolean;\n}\nexport interface ILayoutManagerCallbacks {\n\tcomplete: (e: ICompleteCallbackOptions) => void;\n\terror: (e: IErrorCallbackOptions) => void;\n\tend: (e: IEndCallbackOptions) => void;\n}\n\nexport default class LayoutMananger {\n\tpublic options: Required;\n\tpublic _items: ItemManager;\n\tpublic _renderer: DOMRenderer;\n\tpublic _layout: ILayout;\n\tconstructor(items: ItemManager, renderer: DOMRenderer, options: ILayoutManagerOptions = {}) {\n\t\tassign(this.options = {\n\t\t\tattributePrefix: \"data-\",\n\t\t\tisEqualSize: false,\n\t\t\tisConstantSize: false,\n\t\t\thorizontal: false,\n\t\t}, options);\n\n\t\tthis._items = items;\n\t\tthis._renderer = renderer;\n\t\tthis._layout = null;\n\t}\n\tpublic setLayout(layout: ILayout) {\n\t\tthis._layout = layout;\n\t}\n\tpublic setSize(size: number) {\n\t\tthis._layout.setSize(size);\n\t}\n\tpublic append(\n\t\t{\n\t\t\tgroups,\n\t\t\titems,\n\t\t\tisUpdate,\n\t\t}: {\n\t\t\tgroups: IInfiniteGridGroup[],\n\t\t\titems: IInfiniteGridItem[],\n\t\t\tisUpdate?: boolean,\n\t\t},\n\t\tcallbacks: Partial,\n\t) {\n\t\tthis._insert({ groups, items, isUpdate, isAppend: true }, callbacks);\n\t}\n\tpublic prepend(\n\t\t{\n\t\t\tgroups,\n\t\t\titems,\n\t\t\tisUpdate,\n\t\t}: {\n\t\t\tgroups: IInfiniteGridGroup[],\n\t\t\titems: IInfiniteGridItem[],\n\t\t\tisUpdate?: boolean,\n\t\t},\n\t\tcallbacks: Partial,\n\t) {\n\t\tthis._insert({ groups, items, isUpdate, isAppend: false }, callbacks);\n\t}\n\tpublic layout(isRelayout: boolean, groups: IInfiniteGridGroup[], items: IInfiniteGridItem[]) {\n\t\tconst renderer = this._renderer;\n\t\tconst { isEqualSize, isConstantSize } = renderer.options;\n\t\tconst layoutGroups = groups.filter(group => {\n\t\t\tconst item = group.items[0];\n\n\t\t\treturn item.orgSize && item.rect.top > DUMMY_POSITION / 10;\n\t\t});\n\n\t\tif (!layoutGroups.length) {\n\t\t\treturn [];\n\t\t}\n\t\tlet outline = layoutGroups[0].outlines.start;\n\n\t\tif (isRelayout) {\n\t\t\toutline = [outline.length ? Math.min(...outline) : 0];\n\t\t\tif (!isConstantSize && items.length) {\n\t\t\t\trenderer.updateSize(items);\n\n\t\t\t\t// update invisible items' size\n\t\t\t\tif (isEqualSize && items[0].size) {\n\t\t\t\t\tItemManager.pluck(layoutGroups, \"items\").forEach(item => {\n\t\t\t\t\t\titem.size = assign({}, items[0].size);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._layout.layout(layoutGroups, outline);\n\t\treturn layoutGroups;\n\t}\n\tpublic destroy() {\n\t\tthis._items = null;\n\t\tthis._renderer = null;\n\t}\n\tprivate _complete(\n\t\tgroups: IInfiniteGridGroup[],\n\t\titems: IInfiniteGridItem[],\n\t\tisAppend: boolean,\n\t\tisUpdate: boolean,\n\t\tcallback: ILayoutManagerCallbacks[\"complete\"],\n\t) {\n\t\tconst itemManager = this._items;\n\t\tconst cursor = isAppend ? \"end\" : \"start\";\n\t\tconst groupIndex = itemManager.indexOf(groups[0]);\n\t\tconst prevGroup = itemManager.getData(groupIndex + (isAppend ? -1 : 1));\n\t\tlet outline = prevGroup ? prevGroup.outlines[cursor] : [0];\n\n\t\tthis._renderer.updateSize(items);\n\n\t\tconst groupInfos = groups.map(group => {\n\t\t\tconst groupOutline = group.outlines[isAppend ? \"start\" : \"end\"];\n\t\t\tconst isRelayout = isUpdate || !outline.length || (outline.length === groupOutline.length ?\n\t\t\t\t!outline.every((v, index) => v === groupOutline[index]) : true);\n\n\t\t\tif (!isRelayout) {\n\t\t\t\toutline = group.outlines[isAppend ? \"end\" : \"start\"];\n\t\t\t\tDOMRenderer.renderItems(group.items);\n\t\t\t\treturn group;\n\t\t\t}\n\t\t\tconst groupItems = group.items;\n\t\t\tconst groupInfo = this._layout[isAppend ? \"append\" : \"prepend\"](groupItems, outline, true);\n\n\t\t\tassign(group, groupInfo);\n\t\t\tDOMRenderer.renderItems(groupInfo.items);\n\t\t\toutline = groupInfo.outlines[isAppend ? \"end\" : \"start\"];\n\n\t\t\treturn groupInfo;\n\t\t});\n\n\t\tcallback({\n\t\t\tgroups: groupInfos,\n\t\t\titems,\n\t\t\tisAppend,\n\t\t});\n\t}\n\tprivate _error(\n\t\tremoveTarget: HTMLElement[],\n\t\treplaceTarget: number[],\n\t\ttarget: HTMLImageElement,\n\t\titems: IInfiniteGridItem[],\n\t\terrorIndex: number,\n\t\tcallback: ILayoutManagerCallbacks[\"error\"],\n\t) {\n\t\tconst item = items[errorIndex];\n\t\tconst element = item.el;\n\t\tconst prefix = this.options.attributePrefix;\n\n\t\t// remove item\n\t\tconst removeItem = () => {\n\t\t\tif (hasTarget(removeTarget, element)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tremoveTarget.push(element);\n\t\t\tconst index = replaceTarget.indexOf(errorIndex);\n\n\t\t\tindex !== -1 && replaceTarget.splice(index, 1);\n\t\t};\n\t\t// remove image\n\t\tconst remove = () => {\n\t\t\tif (target === element) {\n\t\t\t\tremoveItem();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (hasTarget(removeTarget, element)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttarget.parentNode.removeChild(target);\n\t\t\titem.content = element.outerHTML;\n\t\t\tif (hasTarget(replaceTarget, errorIndex)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treplaceTarget.push(errorIndex);\n\t\t};\n\t\t// replace image\n\t\tconst replace = (src: string) => {\n\t\t\tif (hasTarget(removeTarget, element)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (src) {\n\t\t\t\tif (matchHTML(src) || typeof src === \"object\") {\n\t\t\t\t\tconst parentNode = target.parentNode;\n\n\t\t\t\t\tparentNode.insertBefore($(src), target);\n\t\t\t\t\tparentNode.removeChild(target);\n\t\t\t\t\titem.content = element.outerHTML;\n\t\t\t\t} else {\n\t\t\t\t\ttarget.src = src;\n\t\t\t\t\tif (target.getAttribute(`${prefix}width`)) {\n\t\t\t\t\t\tAutoSizer.remove(target);\n\t\t\t\t\t\ttarget.removeAttribute(`${prefix}width`);\n\t\t\t\t\t\ttarget.removeAttribute(`${prefix}height`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\titem.content = element.outerHTML;\n\t\t\tif (hasTarget(replaceTarget, errorIndex)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treplaceTarget.push(errorIndex);\n\t\t};\n\t\t// replace item\n\t\tconst replaceItem = (content: string) => {\n\t\t\tif (hasTarget(removeTarget, element)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telement.innerHTML = content;\n\t\t\titem.content = element.outerHTML;\n\t\t\tif (hasTarget(replaceTarget, errorIndex)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treplaceTarget.push(errorIndex);\n\t\t};\n\n\t\tcallback({\n\t\t\ttarget,\n\t\t\telement,\n\t\t\titems,\n\t\t\titem,\n\t\t\titemIndex: errorIndex,\n\t\t\treplace,\n\t\t\treplaceItem,\n\t\t\tremove,\n\t\t\tremoveItem,\n\t\t});\n\t}\n\tprivate _end(\n\t\tremoveTarget: HTMLElement[],\n\t\treplaceTarget: number[],\n\t\titems: IInfiniteGridItem[],\n\t\tcallback: ILayoutManagerCallbacks[\"end\"],\n\t) {\n\t\tconst { attributePrefix } = this.options;\n\n\t\tconst removeTargetLength = removeTarget.length;\n\t\tconst replaceTargetLength = replaceTarget.length;\n\n\t\tif (!removeTargetLength && !replaceTargetLength) {\n\t\t\tcallback({ remove: [] });\n\t\t\treturn;\n\t\t}\n\t\tconst layoutedItems = replaceTarget.map(itemIndex => items[itemIndex]);\n\n\t\tif (!replaceTargetLength) {\n\t\t\tcallback({ remove: removeTarget, layout: true });\n\t\t\treturn;\n\t\t}\n\t\t// wait layoutComplete beacause of error event.\n\t\tImageLoaded.check(layoutedItems.map(v => v.el), {\n\t\t\tprefix: attributePrefix,\n\t\t\tcomplete: () => {\n\t\t\t\tthis._renderer.updateSize(layoutedItems);\n\t\t\t\tcallback({ remove: removeTarget, layout: true });\n\t\t\t},\n\t\t});\n\t}\n\tprivate _insert(\n\t\t{\n\t\t\tgroups,\n\t\t\titems = ItemManager.pluck(groups, \"items\"),\n\t\t\tisAppend,\n\t\t\tisUpdate,\n\t\t}: {\n\t\t\tgroups: IInfiniteGridGroup[],\n\t\t\titems: IInfiniteGridItem[],\n\t\t\tisAppend: boolean,\n\t\t\tisUpdate: boolean,\n\t\t},\n\t\t{\n\t\t\terror = () => void 0,\n\t\t\tcomplete = () => void 0,\n\t\t\tend = () => void 0,\n\t\t}: Partial,\n\t) {\n\t\tif (!groups.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst checkGroups = isAppend ? groups : groups.reverse();\n\t\tconst replaceTarget: number[] = [];\n\t\tconst removeTarget: HTMLElement[] = [];\n\t\tconst elements = items.map(item => item.el);\n\t\tconst type = this.options.isEqualSize && this._renderer._size.item ? CHECK_ONLY_ERROR : CHECK_ALL;\n\t\tconst prefix = this.options.attributePrefix;\n\n\t\tImageLoaded.check(elements, {\n\t\t\tprefix,\n\t\t\ttype,\n\t\t\tcomplete: () => {\n\t\t\t\tif (!this._items) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._complete(checkGroups, items, isAppend, isUpdate, complete);\n\t\t\t},\n\t\t\terror: ({ target, itemIndex }) => {\n\t\t\t\tif (!this._items) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._error(removeTarget, replaceTarget, target, items, itemIndex, error);\n\t\t\t},\n\t\t\tend: () => {\n\t\t\t\tif (!this._items) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._end(removeTarget, replaceTarget, items, end);\n\t\t\t},\n\t\t});\n\t}\n}\n","/**\n * Copyright (c) 2017 NAVER Corp.\n * egjs projects are licensed under the MIT license\n*/\nimport Component from \"@egjs/component\";\nimport ItemManager from \"./ItemManager\";\nimport DOMRenderer, { resetSize } from \"./DOMRenderer\";\nimport Watcher from \"./Watcher\";\nimport {\n\tAPPEND,\n\tPREPEND,\n\tCACHE,\n\tNO_CACHE,\n\tTRUSTED,\n\tNO_TRUSTED,\n\tIS_ANDROID2,\n\tIDLE,\n\tLOADING_APPEND,\n\tLOADING_PREPEND,\n\tPROCESSING,\n\tDEFENSE_BROWSER,\n\tIGNORE_CLASSNAME,\n\tDUMMY_POSITION,\n\tIS_IOS,\n} from \"./consts\";\nimport Infinite from \"./Infinite\";\nimport { toArray, $, outerHeight, outerWidth, assign } from \"./utils\";\nimport LayoutMananger from \"./LayoutManager\";\nimport {\n\tIJQuery, ILayout,\n\tCursorType, StyleType,\n\tIItemManagerStatus, IInfiniteGridItem,\n\tIInfiniteGridGroup, IErrorCallbackOptions, IDOMRendererStatus, IWatchStatus, IInfiniteStatus, IInfiniteGridStatus\n} from \"./types\";\n\n// IE8\n// https://stackoverflow.com/questions/43216659/babel-ie8-inherit-issue-with-object-create\n/* eslint-disable */\n// if (typeof Object.create !== \"function\") {\n// // tslint:disable\n// Object.create = (o: any, properties: any) => {\n// if (typeof o !== \"object\" && typeof o !== \"function\") {\n// throw new TypeError(\"Object prototype may only be an Object: \" + o);\n// } else if (o === null) {\n// throw new Error(\"This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.\");\n// }\n// function F() { }\n// F.prototype = o;\n// return new F();\n// };\n// // tslint:enable\n// }\n/* eslint-enable */\n\nexport interface IInfiniteGridOptions {\n\titemSelector: string;\n\tisOverflowScroll: boolean;\n\tthreshold: number;\n\tisEqualSize: boolean;\n\tisConstantSize: boolean;\n\tuseRecycle: boolean;\n\thorizontal: boolean;\n\ttransitionDuration: number;\n\tuseFit: boolean;\n\tattributePrefix: string;\n}\n\n/**\n * A module used to arrange card elements including content infinitely according to layout type. With this module, you can implement various layouts composed of different card elements whose sizes vary. It guarantees performance by maintaining the number of DOMs the module is handling under any circumstance\n * @ko 콘텐츠가 있는 카드 엘리먼트를 레이아웃 타입에 따라 무한으로 배치하는 모듈. 다양한 크기의 카드 엘리먼트를 다양한 레이아웃으로 배치할 수 있다. 카드 엘리먼트의 개수가 계속 늘어나도 모듈이 처리하는 DOM의 개수를 일정하게 유지해 최적의 성능을 보장한다\n * @alias eg.InfiniteGrid\n * @extends eg.Component\n *\n * @example\n```\n
    \n
  • \n
    test1
    \n
  • \n
  • \n
    test2
    \n
  • \n
  • \n
    test3
    \n
  • \n
  • \n
    test4
    \n
  • \n
  • \n
    test5
    \n
  • \n
  • \n
    test6
    \n
  • \n
\n\n```\n *\n * @support {\"ie\": \"8+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n **/\nclass InfiniteGrid extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.InfiniteGrid.VERSION; // ex) 3.3.3\n\t * @memberof eg.InfiniteGrid\n\t */\n\tpublic static VERSION = \"#__VERSION__#\";\n\n\tpublic options: IInfiniteGridOptions;\n\tprivate _loadingBar: {\n\t\tappend?: HTMLElement,\n\t\tprepend?: HTMLElement,\n\t};\n\tprivate _items: ItemManager;\n\tprivate _renderer: DOMRenderer;\n\tprivate _manager: LayoutMananger;\n\tprivate _watcher: Watcher;\n\tprivate _infinite: Infinite;\n\tprivate _status: IInfiniteGridStatus[\"_status\"];\n\n\t/**\n\t * @param {HTMLElement|String|jQuery} element A base element for a module 모듈을 적용할 기준 엘리먼트\n\t * @param {Object} [options] The option object of the eg.InfiniteGrid module eg.InfiniteGrid 모듈의 옵션 객체\n\t * @param {String} [options.itemSelector] A selector to select card elements that make up the layout레이아웃을 구성하는 카드 엘리먼트를 선택할 선택자(selector)\n\t * @param {Boolean} [options.useRecycle=true] Indicates whether keep the number of DOMs is maintained. If the useRecycle value is 'true', keep the number of DOMs is maintained. If the useRecycle value is 'false', the number of DOMs will increase as card elements are added. DOM의 수를 유지할지 여부를 나타낸다. useRecycle 값이 'true'이면 DOM 개수를 일정하게 유지한다. useRecycle 값이 'false' 이면 카드 엘리먼트가 추가될수록 DOM 개수가 계속 증가한다.\n\t * @param {Boolean} [options.isOverflowScroll=false] Indicates whether overflow:scroll is appliedoverflow:scroll 적용여부를 결정한다.\n\t * @param {Boolean} [options.horizontal=false] Direction of the scroll movement (true: horizontal, false: vertical) 스크롤 이동 방향 (true 가로방향, false 세로방향)\n\t * @param {Boolean} [options.useFit=true] The useFit option scrolls upwards so that no space is visible until an item is added 위로 스크롤할 시 아이템을 추가하는 동안 보이는 빈 공간을 안보이게 한다.\n\t * @param {Boolean} [options.isEqualSize=false] Indicates whether sizes of all card elements are equal to one another. If sizes of card elements to be arranged are all equal and this option is set to \"true\", the performance of layout arrangement can be improved. 카드 엘리먼트의 크기가 동일한지 여부. 배치될 카드 엘리먼트의 크기가 모두 동일할 때 이 옵션을 'true'로 설정하면 레이아웃 배치 성능을 높일 수 있다\n\t * @param {Boolean} [options.isConstantSize=false] Indicates whether sizes of all card elements does not change, the performance of layout arrangement can be improved. 모든 카드 엘리먼트의 크기가 불변일 때 이 옵션을 'true'로 설정하면 레이아웃 배치 성능을 높일 수 있다\n\t * @param {Number} [options.transitionDruation=0] Indicates how many seconds a transition effect takes to complete. 트랜지션 효과를 완료하는데 걸리는 시간을 나타낸다.\n\t * @param {Number} [options.threshold=100] The threshold size of an event area where card elements are added to a layout.레이아웃에 카드 엘리먼트를 추가하는 이벤트가 발생하는 기준 영역의 크기.\n\t * @param {String} [options.attributePrefix=\"data-\"] The prefix to use element's data attribute.엘리먼트의 데이타 속성에 사용할 접두사.\n\t */\n\tconstructor(element: HTMLElement | string | IJQuery, options?: Partial) {\n\t\tsuper();\n\t\tassign(this.options = {\n\t\t\titemSelector: \"*\",\n\t\t\tisOverflowScroll: false,\n\t\t\tthreshold: 100,\n\t\t\tisEqualSize: false,\n\t\t\tisConstantSize: false,\n\t\t\tuseRecycle: true,\n\t\t\thorizontal: false,\n\t\t\ttransitionDuration: 0,\n\t\t\tuseFit: true,\n\t\t\tattributePrefix: \"data-\",\n\t\t}, options);\n\t\tDEFENSE_BROWSER && (this.options.useFit = false);\n\t\tIS_ANDROID2 && (this.options.isOverflowScroll = false);\n\t\tthis._reset();\n\t\tthis._loadingBar = {};\n\n\t\tconst {\n\t\t\tisOverflowScroll,\n\t\t\tisEqualSize,\n\t\t\tisConstantSize,\n\t\t\thorizontal,\n\t\t\tthreshold,\n\t\t\tuseRecycle,\n\t\t} = this.options;\n\n\t\tthis._items = new ItemManager();\n\t\tthis._renderer = new DOMRenderer(element, {\n\t\t\tisEqualSize,\n\t\t\tisConstantSize,\n\t\t\thorizontal,\n\t\t\tcontainer: isOverflowScroll,\n\t\t});\n\t\tthis._watcher = new Watcher(\n\t\t\tthis._renderer.view,\n\t\t\t{\n\t\t\t\tisOverflowScroll,\n\t\t\t\thorizontal,\n\t\t\t\tcontainer: this._renderer.container,\n\t\t\t\tresize: () => this._onResize(),\n\t\t\t\tcheck: param => this._onCheck(param),\n\t\t\t});\n\n\t\tthis._infinite = new Infinite(this._items, {\n\t\t\tuseRecycle,\n\t\t\tthreshold,\n\t\t\tappend: param => this._requestAppend(param),\n\t\t\tprepend: param => this._requestPrepend(param),\n\t\t\trecycle: param => this._recycle(param),\n\t\t});\n\t}\n\t/**\n\t * Adds a card element at the bottom of a layout. This method is available only if the isProcessing() method returns false.\n\t * @ko 카드 엘리먼트를 레이아웃 아래에 추가한다. isProcessing() 메서드의 반환값이 'false'일 때만 이 메서드를 사용할 수 있다\n\t * 이 메소드는 isProcessing()의 반환값이 false일 경우에만 사용 가능하다.\n\t * @param {Array|jQuery} elements Array of the card elements to be added 추가할 카드 엘리먼트의 배열\n\t * @param {Number|String} [groupKey] The group key to be configured in a card element. It is automatically generated by default.\n\t * 추가할 카드 엘리먼트에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * infinitegrid.append(\"<div class='item'>test1</div><div class='item'>test2</div>\");\n\t * infinitegrid.append([\"<div class='item'>test1</div>\", \"<div class='item'>test2</div>\"]);\n\t * infinitegrid.append([HTMLElement1, HTMLElement2]);\n\t * infinitegrid.append(jQuery([\"<div class='item'>test1</div>\", \"<div class='item'>test2</div>\"]));\n\t */\n\tpublic append(elements: HTMLElement[] | IJQuery | string[] | string, groupKey?: string | number) {\n\t\tthis._manager && this._insert({\n\t\t\telements,\n\t\t\tisAppend: APPEND,\n\t\t\tgroupKey,\n\t\t});\n\t\treturn this;\n\t}\n\t/**\n\t * Adds a card element at the top of a layout. This method is available only if the isProcessing() method returns false.\n\t * @ko 카드 엘리먼트를 레이아웃의 위에 추가한다. isProcessing() 메서드의 반환값이 'false'일 때만 이 메서드를 사용할 수 있다\n\t * @param {Array|jQuery} elements Array of the card elements to be added 추가할 카드 엘리먼트 배열\n\t * @param {Number|String} [groupKey] The group key to be configured in a card element. It is automatically generated by default.\n\t * 추가할 카드 엘리먼트에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * infinitegrid.prepend(\"<div class='item'>test1</div><div class='item'>test2</div>\");\n\t * infinitegrid.prepend([\"<div class='item'>test1</div>\", \"<div class='item'>test2</div>\"]);\n\t * infinitegrid.prepend([HTMLElement1, HTMLElement2]);\n\t * infinitegrid.prepend(jQuery([\"<div class='item'>test1</div>\", \"<div class='item'>test2</div>\"]));\n\t */\n\tpublic prepend(elements: HTMLElement[] | IJQuery | string[] | string, groupKey?: string | number) {\n\t\tthis._manager && this._insert({\n\t\t\telements,\n\t\t\tisAppend: PREPEND,\n\t\t\tgroupKey,\n\t\t});\n\t\treturn this;\n\t}\n\t/**\n\t * Specifies the Layout class to use.\n\t * @ko 사용할 Layout 클래스를 지정한다.\n\t * @param {Class|Object} LayoutKlass The Layout class to use or an instance of a layout moudle사용할 Layout 클래스 또는 레이아웃 모듈의 인스턴스\n\t * @param {Object} options Options to apply to the Layout.Layout에 적용할 옵션\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * infinitegrid.setLayout(eg.InfiniteGrid.GridLayout, {\n\t * margin: 10,\n\t * align: \"start\"\n\t * });\n\t * infinitegrid.setLayout(eg.InfiniteGrid.JustifiedLayout, {\n\t * margin: 10,\n\t * minSize: 100,\n\t * maxSize: 200\n\t * });\n\t * infinitegrid.setLayout(eg.InfiniteGrid.SquareLayout, {\n\t * margin: 10,\n\t * column: 2\n\t * });\n\t * infinitegrid.setLayout(eg.InfiniteGrid.FrameLayout, {\n\t * margin: 10,\n\t * frame: [\n\t * [1, 2],\n\t * [4, 3],\n\t * ]\n\t * });\n\t * infinitegrid.setLayout(eg.InfiniteGrid.PackingLayout, {\n\t * margin: 10,\n\t * aspectRatio: 1.5\n\t * });\n\t * var layout = new eg.InfiniteGrid.GridLayout({\n\t * margin: 10,\n\t * align: \"start\"\n\t * });\n\t * infinitegrid.setLayout(layout);\n\t */\n\tpublic setLayout(LayoutKlass: ILayout | (new (...args: any[]) => ILayout), options = {}) {\n\t\tconst { isEqualSize, isConstantSize, attributePrefix, horizontal } = this.options;\n\n\t\tif (!this._manager) {\n\t\t\tthis._manager = new LayoutMananger(this._items, this._renderer, {\n\t\t\t\tattributePrefix,\n\t\t\t\tisEqualSize,\n\t\t\t\tisConstantSize,\n\t\t\t});\n\t\t}\n\t\tif (typeof LayoutKlass === \"function\") {\n\t\t\tthis._manager.setLayout(new LayoutKlass(assign(options, {\n\t\t\t\thorizontal,\n\t\t\t})));\n\t\t} else {\n\t\t\tLayoutKlass.options.horizontal = horizontal;\n\t\t\tthis._manager.setLayout(LayoutKlass);\n\t\t}\n\t\tthis._renderer.resize();\n\t\tthis._setSize(this._renderer.getViewportSize());\n\t\treturn this;\n\t}\n\t/**\n\t * Returns the layouted items.\n\t * @ko 레이아웃된 아이템들을 반환한다.\n\t * @param {Boolean} includeCached Indicates whether to include the cached items. 캐싱된 아이템을 포함할지 여부를 나타낸다.\n\t * @returns List of items 아이템의 목록\n\t */\n\tpublic getItems(includeCached = false): IInfiniteGridItem[] {\n\t\treturn includeCached ? this._items.pluck(\"items\") : this._infinite.getVisibleItems();\n\t}\n\t/**\n\t * Rearranges a layout.\n\t * @ko 레이아웃을 다시 배치한다.\n\t * @param {Boolean} [isRelayout=true] Indicates whether a card element is being relayouted 카드 엘리먼트 재배치 여부\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic layout(isRelayout = true) {\n\t\tif (!this._manager) {\n\t\t\treturn this;\n\t\t}\n\t\tconst renderer = this._renderer;\n\t\tconst itemManager = this._items;\n\t\tconst infinite = this._infinite;\n\t\tconst isResize = renderer.resize();\n\t\tconst items = this.getItems();\n\t\tconst { isEqualSize, isConstantSize, transitionDuration } = this.options;\n\t\tconst isLayoutAll = isRelayout && (isEqualSize || isConstantSize);\n\t\tconst size = itemManager.size();\n\n\t\tif (isRelayout) {\n\t\t\tthis._watcher.resize();\n\t\t\tif (isResize) {\n\t\t\t\tthis._setSize(renderer.getViewportSize());\n\t\t\t}\n\t\t}\n\t\t// check childElement\n\t\tif (!size || !items.length) {\n\t\t\tconst children = toArray(renderer.container.children);\n\n\t\t\tif (children.length) {\n\t\t\t\tthis._insert({\n\t\t\t\t\telements: children,\n\t\t\t\t\tisAppend: true,\n\t\t\t\t\tisChildren: true,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (renderer.getContainerSize()) {\n\t\t\t\t\trenderer.setContainerSize(0);\n\t\t\t\t}\n\t\t\t\tthis._requestAppend({});\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\t// layout datas\n\t\tconst startCursor = infinite.getCursor(\"start\");\n\t\tconst endCursor = infinite.getCursor(\"end\");\n\t\tconst data = isLayoutAll || !(isRelayout && isResize) ? itemManager.get() :\n\t\t\titemManager.get(startCursor, endCursor);\n\n\t\t// LayoutManger interface\n\t\tthis._manager.layout(isRelayout, data, isResize ? items : []);\n\t\tif (isLayoutAll) {\n\t\t\tthis._fit();\n\t\t} else if (isRelayout && isResize) {\n\t\t\titemManager.clearOutlines(startCursor, endCursor);\n\t\t}\n\t\tDOMRenderer.renderItems(items, transitionDuration);\n\t\tisRelayout && this._watcher.setScrollPos();\n\t\tthis._onLayoutComplete({\n\t\t\titems,\n\t\t\tisAppend: APPEND,\n\t\t\tfromCache: CACHE,\n\t\t\tisTrusted: NO_TRUSTED,\n\t\t\tuseRecycle: false,\n\t\t\tisLayout: true,\n\t\t});\n\t\treturn this;\n\t}\n\t/**\n\t * Removes a item element on a grid layout.\n\t * @ko 그리드 레이아웃의 카드 엘리먼트를 삭제한다.\n\t * @param {HTMLElement} item element to be removed 삭제될 아이템 엘리먼트\n\t * @return {Object} Removed item element 삭제된 아이템 엘리먼트 정보\n\t */\n\tpublic remove(element: HTMLElement, isLayout = true) {\n\t\tif (element) {\n\t\t\tconst {items, groups} = this._infinite.remove(element);\n\n\t\t\titems && DOMRenderer.removeElement(element);\n\t\t\tisLayout && this.layout(groups.length > 0);\n\t\t\treturn items;\n\t\t}\n\t\treturn null;\n\t}\n\t/**\n\t * Returns the list of group keys which belongs to card elements currently being maintained. You can use the append() or prepend() method to configure group keys so that multiple card elements can be managed at once. If you do not use these methods to configure group keys, groupkey is automatically generated.\n\t * @ko 현재 유지하고 있는 카드 엘리먼트의 그룹 키 목록을 반환한다. 여러 개의 카드 엘리먼트를 묶어서 관리할 수 있도록 append() 메서드나 prepend() 메서드에서 그룹 키를 지정할 수 있다. append() 메서드나 prepend() 메서드에서 그룹 키를 지정하지 않았다면 자동으로 그룹키가 생성된다.\n\t * @param {Boolean} includeCached Indicates whether to include the cached groups. 캐싱된 그룹을 포함할지 여부를 나타낸다.\n\t * @return {Array} List of group keys 그룹 키의 목록\n\t */\n\tpublic getGroupKeys(includeCached?: boolean) {\n\t\tconst data = includeCached ?\n\t\t\tthis._items.get() : this._infinite.getVisibleData();\n\n\t\treturn data.map(v => v.groupKey);\n\t}\n\t/**\n\t * Returns the current state of a module such as location information. You can use the setStatus() method to restore the information returned through a call to this method.\n\t * @ko 카드의 위치 정보 등 모듈의 현재 상태 정보를 반환한다. 이 메서드가 반환한 정보를 저장해 두었다가 setStatus() 메서드로 복원할 수 있다\n\t * @return {Object} State object of the eg.InfiniteGrid moduleeg.InfiniteGrid 모듈의 상태 객체\n\t */\n\tpublic getStatus(startKey?: string | number, endKey?: string | number): IInfiniteGridStatus {\n\t\treturn {\n\t\t\t_status: assign({}, this._status),\n\t\t\t_items: this._items.getStatus(startKey, endKey),\n\t\t\t_renderer: this._renderer.getStatus(),\n\t\t\t_watcher: this._watcher.getStatus(),\n\t\t\t_infinite: this._infinite.getStatus(startKey, endKey),\n\t\t};\n\t}\n\t/**\n\t * Sets the state of the eg.InfiniteGrid module with the information returned through a call to the getStatue() method.\n\t * @ko getStatue() 메서드가 저장한 정보로 eg.InfiniteGrid 모듈의 상태를 설정한다.\n\t * @param {Object} status State object of the eg.InfiniteGrid module eg.InfiniteGrid 모듈의 상태 객체\n\t * @param {boolean} [applyScrollPos=true] Checks whether to scroll스크롤의 위치를 복원할지 결정한다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic setStatus(status: IInfiniteGridStatus, applyScrollPos = true) {\n\t\tif (!status) {\n\t\t\treturn this;\n\t\t}\n\t\tconst { _status, _renderer, _items, _watcher, _infinite } = status;\n\n\t\tif (!_status ||\n\t\t\t!_renderer || !_items || !_watcher || !_infinite) {\n\t\t\treturn this;\n\t\t}\n\t\tconst items = this._items;\n\t\tconst renderer = this._renderer;\n\t\tconst watcher = this._watcher;\n\t\tconst infinite = this._infinite;\n\n\t\twatcher.detachEvent();\n\t\tassign(this._status, _status);\n\t\tthis._status.processingStatus = IDLE;\n\t\titems.setStatus(_items);\n\t\trenderer.setStatus(_renderer);\n\t\tinfinite.setStatus(_infinite);\n\n\t\tconst visibleItems = this.getItems();\n\t\tconst length = visibleItems.length;\n\n\t\trenderer.createAndInsert(visibleItems, true);\n\n\t\tconst isReLayout = renderer.isNeededResize();\n\n\t\twatcher.setStatus(_watcher, applyScrollPos);\n\t\twatcher.attachEvent();\n\n\t\tconst { isConstantSize, isEqualSize } = this.options;\n\n\t\tif (!length) {\n\t\t\tthis._requestAppend({ cache: [] });\n\t\t} else if (isReLayout) {\n\t\t\trenderer.resize();\n\t\t\tthis._setSize(renderer.getViewportSize());\n\n\t\t\tif (isConstantSize) {\n\t\t\t\tthis.layout(true);\n\t\t\t} else {\n\t\t\t\tthis._items.clearOutlines();\n\t\t\t\tthis._postLayout({\n\t\t\t\t\tfromCache: true,\n\t\t\t\t\tgroups: isEqualSize ? items.get() : infinite.getVisibleData(),\n\t\t\t\t\titems: visibleItems,\n\t\t\t\t\tnewItems: visibleItems,\n\t\t\t\t\tisAppend: true,\n\t\t\t\t\tisTrusted: false,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tthis.layout(false);\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t * Clears added card elements and data.\n\t * @ko 추가된 카드 엘리먼트와 데이터를 모두 지운다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic clear() {\n\t\tthis._items.clear();\n\t\tthis._renderer.clear();\n\t\tthis._infinite.clear();\n\t\tthis._reset();\n\t\tthis._appendLoadingBar();\n\t\treturn this;\n\t}\n\t/**\n\t * Specifies the Loading Bar to use for append or prepend items.\n\t * @ko 아이템을 append 또는 prepend 하기 위해 사용할 로딩 바를 지정한다.\n\t * @param {String|Object} [userLoadingBar={}] The loading bar HTML markup or element or element selector 로딩 바 HTML 또는 element 또는 selector \n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic setLoadingBar(userLoadingBar: {\n\t\tappend?: string | HTMLElement,\n\t\tprepepnd?: string | HTMLElement,\n\t} | string = {}) {\n\t\tconst loadingBarObj: {\n\t\t\tappend?: string | HTMLElement,\n\t\t\tprepend?: string | HTMLElement,\n\t\t} = typeof userLoadingBar === \"object\" ? userLoadingBar : {\n\t\t\tappend: userLoadingBar,\n\t\t\tprepend: userLoadingBar,\n\t\t};\n\n\t\tthis._status.loadingSize = 0;\n\t\tthis._status.loadingStyle = {};\n\t\tconst loadingBar = this._loadingBar;\n\n\t\tfor (const type in loadingBarObj) {\n\t\t\tloadingBar[type as \"append\" | \"prepend\"] = $(loadingBarObj[type as \"append\" | \"prepend\"]);\n\t\t\tloadingBar[type as \"append\" | \"prepend\"].className += ` ${IGNORE_CLASSNAME}`;\n\t\t}\n\t\tthis._appendLoadingBar();\n\t\treturn this;\n\t}\n\t/**\n\t * Checks whether a card element or data is being added.\n\t * @ko 카드 엘리먼트 추가 또는 데이터 로딩이 진행 중인지 확인한다\n\t * @return {Boolean} Indicates whether a card element or data is being added 카드 엘리먼트 추가 또는 데이터 로딩 진행 중 여부\n\t */\n\tpublic isProcessing() {\n\t\treturn this._isProcessing() || this._isLoading();\n\t}\n\t/**\n\t * Returns the element of loading bar.\n\t * @ko 로딩 바의 element를 반환한다.\n\t * @param {Boolean} [isAppend=currentLoadingBar|true] Checks whether the card element is added to the append () method. 카드 엘리먼트가 append() 메서드로 추가 할 것인지 확인한다.\n\t * @return {Element} The element of loading bar. 로딩 바의 element\n\t */\n\tpublic getLoadingBar(isAppend = this._getLoadingStatus() !== LOADING_PREPEND) {\n\t\treturn this._loadingBar[isAppend ? \"append\" : \"prepend\"];\n\t}\n\t/**\n\t * Start loading for append/prepend during loading data.\n\t * @ko 데이터가 로딩되는 동안 append/prepend하길 위해 로딩을 시작한다.\n\t * @param {Boolean} [isAppend=true] Checks whether the card element is added to the append () method. 카드 엘리먼트가 append() 메서드로 추가 할 것인지 확인한다.\n\t * @param {Object} [userStyle = {display: \"block\"}] custom style to apply to this loading bar for start. 로딩 시작을 위한 로딩 바에 적용할 커스텀 스타일 \n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic startLoading(isAppend?: boolean, userStyle: StyleType = { display: \"block\" }) {\n\t\tif (this._isLoading()) {\n\t\t\treturn this;\n\t\t}\n\t\tconst type = isAppend ? \"append\" : \"prepend\";\n\n\t\tthis._process(isAppend ? LOADING_APPEND : LOADING_PREPEND);\n\t\tif (!this._loadingBar[type]) {\n\t\t\treturn this;\n\t\t}\n\t\tthis._renderLoading(userStyle);\n\t\tthis._status.loadingStyle = userStyle;\n\t\tif (!isAppend) {\n\t\t\tthis._fit();\n\t\t} else {\n\t\t\tthis._setContainerSize(this._getEdgeValue(\"end\") + this._status.loadingSize);\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t * End loading after startLoading() for append/prepend\n\t * @ko append/prepend하길 위해 startLoading() 호출해선 걸었던 로딩을 끝낸다.\n\t * @param {Object} [userStyle = {display: \"none\"}] custom style to apply to this loading bar for end 로딩 시작을 위한 로딩 바에 적용할 커스텀 스타일 \n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic endLoading(userStyle: StyleType = { display: \"none\" }) {\n\t\tif (!this._isLoading()) {\n\t\t\treturn this;\n\t\t}\n\t\tconst isAppend = this._getLoadingStatus() === LOADING_APPEND;\n\t\tconst type = isAppend ? \"append\" : \"prepend\";\n\t\tconst el = this._loadingBar[type];\n\t\tconst status = this._status;\n\t\tconst size = status.loadingSize;\n\n\t\tthis._process(LOADING_APPEND | LOADING_PREPEND, false);\n\t\tstatus.loadingSize = 0;\n\t\tstatus.loadingStyle = {};\n\t\tif (el) {\n\t\t\tconst style: StyleType = assign({\n\t\t\t\t[this.options.horizontal ? \"left\" : \"top\"]: `${-size}px`,\n\t\t\t}, userStyle);\n\n\t\t\tfor (const property in style) {\n\t\t\t\tel.style[property as keyof StyleType] = style[property as keyof StyleType];\n\t\t\t}\n\t\t\tif (!isAppend) {\n\t\t\t\tthis._fitItems(size);\n\t\t\t} else {\n\t\t\t\tthis._setContainerSize(this._getEdgeValue(\"end\"));\n\t\t\t}\n\t\t}\n\t\tif (this.options.useRecycle && !this.isProcessing()) {\n\t\t\tthis._infinite.recycle(this._watcher.getScrollPos(), isAppend);\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t * Retrieves the item via index or the element.\n\t * @ko index 또는 element를 통해 아이템을 가져온다.\n\t * @param {number | HTMLElement} [groupIndex=0] The element corresponding to item or the index of the group where the item is in position item에 해당하는 element 또는 해당 item이 있는 group의 index\n\t * @param {number} [itemIndex] If groupIndex is used, the index of the item in the group groupIndex를 사용할 경우 해당 group에 있는 Item의 index \n\t * @return The item containing the content, size and position,etccontent, size, position 등이 담겨있는 item 정보\n\t * @example\n\n\t ig.getItem(0, 0);\n\t ig.getItem(element);\n\n\t {\n\t el: HTMLElement,\n\t content: \"
...
\",\n\t size: {width: ..., height: ...},\n\t rect: {top: ..., left: ..., width: ..., height: ...},\n\t }\n\t */\n\tpublic getItem(groupIndex = 0, itemIndex?: number): IInfiniteGridItem {\n\t\tif (itemIndex == null && typeof groupIndex === \"object\") {\n\t\t\tif (!groupIndex) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst items = this.getItems();\n\t\t\tconst length = items.length;\n\n\t\t\tfor (let i = 0; i < length; ++i) {\n\t\t\t\tif (items[i].el === groupIndex) {\n\t\t\t\t\treturn items[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst group = this._items.getData(groupIndex);\n\n\t\t\treturn group && group.items[itemIndex || 0];\n\t\t}\n\t}\n\t/**\n\t * Updates the item via index or the element.\n\t * @ko index 또는 element를 통해 아이템을 업데이트한다.\n\t * @param {number | HTMLElement} [groupIndex=0] The element corresponding to item or the index of the group where the item is in position item에 해당하는 element 또는 해당 item이 있는 group의 index\n\t * @param {number} [itemIndex] If groupIndex is used, the index of the item in the group groupIndex를 사용할 경우 해당 group에 있는 Item의 index \n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\telement.innerHTML = \"2\";\n\telement.style.height = \"400px\";\n\tig.updateItem(element);\n\tig.updateItem(0, 0);\n\t */\n\tpublic updateItem(groupIndex?: number, itemIndex?: number) {\n\t\tconst item = this.getItem(groupIndex, itemIndex);\n\n\t\tthis._updateItem(item) && this.layout(false);\n\n\t\treturn this;\n\t}\n\t/**\n\t * Update the currently displayed items.\n\t * @ko 현재보여주는 아이템들을 업데이트한다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\telement.innerHTML = \"2\";\n\telement.style.height = \"400px\";\n\n\telement2.innerHTML = \"2\";\n\telement2.style.height = \"400px\";\n\n\tig.updateItems();\n\t */\n\tpublic updateItems() {\n\t\tthis.getItems().forEach(item => {\n\t\t\tthis._updateItem(item);\n\t\t});\n\t\tthis.layout(false);\n\t\treturn this;\n\t}\n\t/**\n\t * Move to some group or item position.\n\t * @ko 해당하는 그룹 또는 아이템의 위치로 이동한다.\n\t * @param {Number} [index] group's index 그룹의 index\n\t * @param {Number} [itemIndex=-1] item's index 그룹의 index\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic moveTo(index?: number, itemIndex = 0) {\n\t\tif (this.isProcessing()) {\n\t\t\treturn this;\n\t\t}\n\t\tconst data = this._items.getData(index);\n\n\t\tif (!data) {\n\t\t\treturn this;\n\t\t}\n\t\tconst infinite = this._infinite;\n\t\tconst outlines = data.outlines;\n\t\tconst items = data.items;\n\t\tconst item = items[itemIndex];\n\t\tconst isResize = outlines.start && (outlines.start.length === 0);\n\t\tconst startCursor = infinite.getCursor(\"start\");\n\t\tconst endCursor = infinite.getCursor(\"end\");\n\t\tconst isInCursor = startCursor <= index && index <= endCursor;\n\t\tconst { useRecycle, horizontal } = this.options;\n\n\t\tif (isInCursor || !useRecycle || !isResize) {\n\t\t\tlet pos = item ? item.rect[horizontal ? \"left\" : \"top\"] : Math.max(...outlines.start);\n\t\t\tconst fit = Math.min(...outlines.start);\n\n\t\t\tif (fit < 0) {\n\t\t\t\t// base < 0\n\t\t\t\tthis._fitItems(fit, 0);\n\t\t\t\tpos -= fit;\n\t\t\t}\n\t\t\tconst isAppend = index > startCursor;\n\n\t\t\tif (isInCursor || isAppend) {\n\t\t\t\tthis._scrollTo(pos);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tthis._postLayout({\n\t\t\t\tfromCache: true,\n\t\t\t\tgroups: [data],\n\t\t\t\titems,\n\t\t\t\tnewItems: [],\n\t\t\t\tisAppend,\n\t\t\t\tisTrusted: false,\n\t\t\t\tmoveCache: true,\n\t\t\t\tmoveItem: itemIndex,\n\t\t\t});\n\t\t\treturn this;\n\t\t} else {\n\t\t\tconst isAppend = index > endCursor || index < startCursor - 1;\n\n\t\t\tthis._postCache({\n\t\t\t\tisAppend,\n\t\t\t\tcache: [data],\n\t\t\t\tisTrusted: false,\n\t\t\t\tmoveItem: itemIndex,\n\t\t\t});\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n * Destroys elements, properties, and events used on a grid layout.\n * @ko 그리드 레이아웃에 사용한 엘리먼트와 속성, 이벤트를 해제한다\n */\n\tpublic destroy() {\n\t\tthis._infinite.clear();\n\t\tthis._watcher.destroy();\n\t\tthis._manager.destroy();\n\t\tthis._reset();\n\t\tthis._items.clear();\n\t\tthis._renderer.destroy();\n\t}\n\tprivate _setContainerSize(size: number) {\n\t\tthis._renderer.setContainerSize(Math.max(this._items.getMaxEdgeValue(), size));\n\t}\n\tprivate _appendLoadingBar() {\n\t\tconst loadingBar = this._loadingBar;\n\t\tconst container = this._renderer.container;\n\n\t\tfor (const type in loadingBar) {\n\t\t\tcontainer.appendChild(loadingBar[type as \"append\" | \"prepend\"]);\n\t\t}\n\t}\n\tprivate _setSize(size: number) {\n\t\tthis._infinite.setSize(this._renderer.getViewSize());\n\t\tthis._manager.setSize(size);\n\t}\n\tprivate _fitItems(base: number, margin = 0) {\n\t\tbase > 0 && this._watcher.scrollBy(-base);\n\t\tthis._items.fit(base, this.options.horizontal);\n\t\tDOMRenderer.renderItems(this.getItems());\n\t\tthis._setContainerSize(this._getEdgeValue(\"end\") || margin);\n\t\tbase < 0 && this._watcher.scrollBy(-base);\n\t}\n\t// called by visible\n\tprivate _fit(useFit = this.options.useFit) {\n\t\tlet base = this._getEdgeValue(\"start\");\n\t\tconst margin = (this._getLoadingStatus() === LOADING_PREPEND && this._status.loadingSize) || 0;\n\t\tconst { isConstantSize, isEqualSize, useRecycle } = this.options;\n\n\t\tif (!useRecycle || !useFit || isConstantSize || isEqualSize) {\n\t\t\tif (base < margin) {\n\t\t\t\tthis._fitItems(base - margin, margin);\n\t\t\t}\n\t\t\tbase = 0;\n\t\t} else if (base !== 0 || margin) {\n\t\t\tthis._fitItems(base - margin, margin);\n\t\t} else {\n\t\t\treturn 0;\n\t\t}\n\t\tthis._isLoading() && this._renderLoading();\n\t\treturn base;\n\t}\n\tprivate _getEdgeValue(cursor: CursorType) {\n\t\treturn this._infinite.getEdgeValue(cursor);\n\t}\n\tprivate _isProcessing() {\n\t\treturn (this._status.processingStatus & PROCESSING) > 0;\n\t}\n\tprivate _isLoading() {\n\t\treturn this._getLoadingStatus() > 0;\n\t}\n\tprivate _getLoadingStatus() {\n\t\treturn this._status.processingStatus & (LOADING_APPEND | LOADING_PREPEND);\n\t}\n\tprivate _process(status: number, isAdd = true) {\n\t\tif (isAdd) {\n\t\t\tthis._status.processingStatus |= status;\n\t\t} else {\n\t\t\tthis._status.processingStatus -= this._status.processingStatus & status;\n\t\t}\n\t}\n\tprivate _insert({\n\t\telements,\n\t\tisAppend,\n\t\tisChildren,\n\t\tgroupKey = new Date().getTime() + Math.floor(Math.random() * 1000),\n\t}: {\n\t\telements: string | string[] | HTMLElement[] | IJQuery,\n\t\tisAppend?: boolean,\n\t\tisChildren?: boolean,\n\t\tgroupKey?: string | number,\n\t}) {\n\t\tif (this._isProcessing() || elements.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst items = ItemManager.from(elements, this.options.itemSelector, {\n\t\t\tgroupKey,\n\t\t});\n\n\t\tif (!items.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst group: IInfiniteGridGroup = {\n\t\t\tgroupKey,\n\t\t\titems,\n\t\t\toutlines: { start: [], end: [] },\n\t\t};\n\t\tconst method = isAppend ? \"append\" : \"prepend\";\n\n\t\tthis._items[method](group);\n\n\t\tif (!isAppend) {\n\t\t\tconst infinite = this._infinite;\n\t\t\tconst startCursor = infinite.getCursor(\"start\");\n\t\t\tconst endCursor = infinite.getCursor(\"end\");\n\n\t\t\tinfinite.setCursor(\"start\", startCursor + 1);\n\t\t\tinfinite.setCursor(\"end\", endCursor + 1);\n\t\t}\n\t\tthis._postLayout({\n\t\t\tfromCache: NO_CACHE,\n\t\t\tgroups: [group],\n\t\t\titems,\n\t\t\tnewItems: items,\n\t\t\tisAppend,\n\t\t\tisChildren,\n\t\t\tisTrusted: NO_TRUSTED,\n\t\t});\n\t}\n\t// add items, and remove items for recycling\n\tprivate _recycle({ start, end }: { start: number, end: number }) {\n\t\tif (!this.options.useRecycle) {\n\t\t\treturn;\n\t\t}\n\t\tDOMRenderer.removeItems(this._items.pluck(\"items\", start, end));\n\t}\n\tprivate _renderLoading(userStyle = this._status.loadingStyle) {\n\t\tif (!this._isLoading()) {\n\t\t\treturn;\n\t\t}\n\t\tconst isAppend = this._getLoadingStatus() === LOADING_APPEND;\n\t\tconst el = this._loadingBar[isAppend ? \"append\" : \"prepend\"];\n\n\t\tif (!el) {\n\t\t\treturn;\n\t\t}\n\t\tconst style = assign({\n\t\t\tposition: \"absolute\",\n\t\t}, userStyle);\n\n\t\tfor (const property in style) {\n\t\t\tel.style[property as keyof StyleType] = style[property as keyof StyleType];\n\t\t}\n\t\tthis._status.loadingSize = this.options.horizontal ? outerWidth(el) : outerHeight(el);\n\t\tconst posName = this.options.horizontal ? \"left\" : \"top\";\n\n\t\tif (!(posName in style)) {\n\t\t\tconst pos = isAppend ? this._getEdgeValue(\"end\") : this._getEdgeValue(\"start\") - this._status.loadingSize;\n\n\t\t\tel.style[posName] = `${pos}px`;\n\t\t}\n\t}\n\tprivate _updateItem(item: IInfiniteGridItem) {\n\t\tif (item && item.el) {\n\t\t\titem.content = item.el.outerHTML;\n\n\t\t\t!this.options.isEqualSize && resetSize(item);\n\t\t\tthis._renderer.updateSize([item]);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\tprivate _setScrollPos(pos: number) {\n\t\tthis._watcher.setScrollPos(this._watcher.getContainerOffset() + pos);\n\t}\n\tprivate _scrollTo(pos: number) {\n\t\tthis._watcher.scrollTo(this._watcher.getContainerOffset() + pos);\n\t}\n\tprivate _onImageError(e: IErrorCallbackOptions) {\n\t\t/**\n\t\t * This event is fired when an error occurs in the image.\n\t\t * @ko 이미지 로드에 에러가 날 때 발생하는 이벤트.\n\t\t * @event eg.InfiniteGrid#imageError\n\t\t * @param {eg.InfiniteGrid.IErrorCallbackOptions} e The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @example\n\tig.on(\"imageError\", e => {\n\t e.remove();\n\t e.removeItem();\n\t e.replace(\"http://...jpg\");\n\t e.replace(imageElement);\n\t e.replaceItem(\"item html\");\n\t});\n\t\t */\n\t\tthis.trigger(\"imageError\", assign(e, { element: e.item.el }));\n\t}\n\tprivate _postCache({\n\t\tcache,\n\t\tisAppend,\n\t\tisTrusted = true,\n\t\tmoveItem = -1,\n\t}: {\n\t\tcache: IInfiniteGridGroup[],\n\t\tisAppend?: boolean,\n\t\tisTrusted?: boolean,\n\t\tmoveItem?: number,\n\t}) {\n\t\tconst { isConstantSize } = this.options;\n\t\tconst items = ItemManager.pluck(cache, \"items\");\n\t\tlet fromCache = true;\n\t\tconst newItems = items.filter(item => {\n\t\t\tif (!item.orgSize) {\n\t\t\t\tfromCache = false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn !isConstantSize && item.rect.top < DUMMY_POSITION / 10;\n\t\t});\n\n\t\tthis._postLayout({\n\t\t\tfromCache,\n\t\t\tgroups: cache,\n\t\t\titems,\n\t\t\tnewItems,\n\t\t\tisAppend,\n\t\t\tisTrusted,\n\t\t\tmoveItem,\n\t\t});\n\t}\n\tprivate _postLayout({\n\t\tfromCache,\n\t\tgroups,\n\t\titems = ItemManager.pluck(groups, \"items\"),\n\t\tnewItems,\n\t\tisAppend,\n\t\tisChildren,\n\t\tisTrusted,\n\t\tmoveCache,\n\t\tmoveItem = -2,\n\t}: {\n\t\tfromCache: boolean,\n\t\tgroups: IInfiniteGridGroup[],\n\t\titems: IInfiniteGridItem[],\n\t\tnewItems?: IInfiniteGridItem[],\n\t\tisAppend: boolean,\n\t\tisChildren?: boolean,\n\t\tisTrusted?: boolean,\n\t\tmoveCache?: boolean,\n\t\tmoveItem?: number,\n\t}) {\n\t\tthis._process(PROCESSING);\n\t\tconst method = isAppend ? \"append\" : \"prepend\";\n\t\tconst itemManager = this._items;\n\t\tconst horizontal = this.options.horizontal;\n\n\t\t// If container has children, it does not render first.\n\t\tif (!isChildren) {\n\t\t\tDOMRenderer.createElements(items);\n\t\t\tthis._renderer[method](items);\n\t\t}\n\t\tthis._manager[method]({\n\t\t\tgroups,\n\t\t\titems: newItems,\n\t\t}, {\n\t\t\t\tcomplete: () => {\n\t\t\t\t\tconst infinite = this._infinite;\n\t\t\t\t\tconst startCursor = Math.max(infinite.getCursor(\"start\"), 0);\n\t\t\t\t\tconst endCursor = Math.max(infinite.getCursor(\"end\"), 0);\n\t\t\t\t\tlet requestStartCursor = itemManager.indexOf(groups[0].groupKey);\n\t\t\t\t\tlet requestEndCursor = itemManager.indexOf(groups[groups.length - 1].groupKey);\n\t\t\t\t\tlet isInCursor = true;\n\n\t\t\t\t\tif (requestStartCursor > endCursor + 1 || requestEndCursor < startCursor - 1) {\n\t\t\t\t\t\tisInCursor = false;\n\t\t\t\t\t}\n\t\t\t\t\tif (isInCursor) {\n\t\t\t\t\t\tif (isAppend) {\n\t\t\t\t\t\t\trequestStartCursor = startCursor;\n\t\t\t\t\t\t\trequestEndCursor = Math.max(endCursor, requestEndCursor);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trequestStartCursor = Math.max(Math.min(startCursor, requestStartCursor), 0);\n\t\t\t\t\t\t\trequestEndCursor = endCursor;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t!isInCursor && this._recycle({ start: startCursor, end: endCursor });\n\t\t\t\t\tinfinite.setCursor(\"start\", requestStartCursor);\n\t\t\t\t\tinfinite.setCursor(\"end\", requestEndCursor);\n\n\t\t\t\t\tif (moveItem > -1) {\n\t\t\t\t\t\tconst pos = items[moveItem].rect[horizontal ? \"left\" : \"top\"];\n\n\t\t\t\t\t\tif (!isInCursor && !moveCache) {\n\t\t\t\t\t\t\titemManager.clearOutlines(requestStartCursor, requestEndCursor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._scrollTo(pos);\n\t\t\t\t\t\tthis._setScrollPos(pos);\n\t\t\t\t\t}\n\t\t\t\t\tthis._onLayoutComplete({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tisAppend,\n\t\t\t\t\t\tfromCache,\n\t\t\t\t\t\tisTrusted,\n\t\t\t\t\t\tuseRecycle: false,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\terror: e => this._onImageError(e),\n\t\t\t\tend: ({ remove, layout }) => {\n\t\t\t\t\tremove.forEach(el => this.remove(el, false));\n\t\t\t\t\tif (layout) {\n\t\t\t\t\t\tthis.layout(false);\n\t\t\t\t\t} else if (!this.isProcessing() && this.options.useRecycle) {\n\t\t\t\t\t\tconst watcher = this._watcher;\n\t\t\t\t\t\tconst scrollPos = watcher.getScrollPos();\n\n\t\t\t\t\t\tthis._infinite.recycle(scrollPos, isAppend);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\treturn this;\n\t}\n\t// called by visible\n\tprivate _requestAppend({ cache }: { cache?: IInfiniteGridGroup[] }) {\n\t\tif (this._isProcessing()) {\n\t\t\treturn;\n\t\t}\n\t\tif (cache && cache.length) {\n\t\t\tthis._postCache({ cache, isAppend: APPEND });\n\t\t} else {\n\t\t\t/**\n\t\t\t * This event is fired when a card element must be added at the bottom or right of a layout because there is no card to be displayed on screen when a user scrolls near bottom or right.\n\t\t\t * @ko 카드 엘리먼트가 레이아웃의 아래나 오른쪽에 추가돼야 할 때 발생하는 이벤트. 사용자가 아래나 오른쪽으로 스크롤해서 화면에 표시될 카드가 없을 때 발생한다\n\t\t\t * @event eg.InfiniteGrid#append\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String|Number} groupKey The group key of the first group visible on the screen 화면에 보여지는 마지막 그룹의 그룹키\n\t\t\t * @param {Boolean} param.isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n\t\t\t * @param {Function} param.startLoading Start loading for append loading data. 뒷쪽에 추가되는 데이터 로딩을 시작한다. \n\t\t\t * @param {Object} param.startLoading.userStyle The custom style to apply to this loading bar for start. 로딩을 시작할 때 로딩 바에 적용될 사용자 스타일 \n\t\t\t * @param {Function} param.endLoading End loading after startLoading() for append/prepend loading data. 데이터 로딩을 위해 append/prepend startLoading() 호출 이후 로딩을 끝낸다.\n\t\t\t * @param {Object} param.endLoading.userStyle The custom style to apply to this loading bar for start. 로딩이 끝날 때 로딩 바에 적용될 사용자 스타일 \n\t\t\t */\n\t\t\tthis.trigger(\"append\", {\n\t\t\t\tisTrusted: TRUSTED,\n\t\t\t\tgroupKey: this.getGroupKeys().pop() || \"\",\n\t\t\t\tstartLoading: (userStyle: StyleType) => {\n\t\t\t\t\tthis.startLoading(true, userStyle);\n\t\t\t\t},\n\t\t\t\tendLoading: (userStyle: StyleType) => {\n\t\t\t\t\tthis.endLoading(userStyle);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\t// called by visible\n\tprivate _requestPrepend({ cache }: { cache?: IInfiniteGridGroup[] }) {\n\t\tthis._fit(this.options.useFit || !cache.length);\n\t\tif (this._isProcessing()) {\n\t\t\treturn;\n\t\t}\n\t\tif (cache && cache.length) {\n\t\t\tthis._postCache({ cache, isAppend: PREPEND });\n\t\t} else {\n\t\t\t/**\n\t\t\t * This event is fired when a card element must be added at the top or left of a layout because there is no card to be displayed on screen when a user scrolls near top or left.\n\t\t\t * @ko 카드가 레이아웃의 위나 왼쪽에 추가돼야 할 때 발생하는 이벤트. 사용자가 위나 왼쪽으로 스크롤해서 화면에 표시될 카드가 없을 때 발생한다.\n\t\t\t * @event eg.InfiniteGrid#prepend\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String|Number} groupKey The group key of the first group visible on the screen 화면에 보여지는 첫번째 그룹의 그룹키\n\t\t\t * @param {Boolean} param.isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n\t\t\t * @param {Function} param.startLoading Start loading for prepend loading data. 앞쪽에 추가되는 데이터 로딩을 시작한다. \n\t\t\t * @param {Object} param.startLoading.userStyle The custom style to apply to this loading bar for start. 로딩을 시작할 때 로딩 바에 적용될 사용자 스타일 \n\t\t\t * @param {Function} param.endLoading End loading after startLoading() for append/prepend loading data. 데이터 로딩을 위해 append/prepend startLoading() 호출 이후 로딩을 끝낸다.\n\t\t\t * @param {Object} param.endLoading.userStyle The custom style to apply to this loading bar for start. 로딩이 끝날 때 로딩 바에 적용될 사용자 스타일 \n\t\t\t */\n\t\t\tthis.trigger(\"prepend\", {\n\t\t\t\tisTrusted: TRUSTED,\n\t\t\t\tgroupKey: this.getGroupKeys().shift(),\n\t\t\t\tstartLoading: (userStyle: StyleType) => {\n\t\t\t\t\tthis.startLoading(false, userStyle);\n\t\t\t\t},\n\t\t\t\tendLoading: (userStyle: StyleType) => {\n\t\t\t\t\tthis.endLoading(userStyle);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\tprivate _onResize() {\n\t\tthis.layout(true);\n\t}\n\tprivate _onCheck({\n\t\tisForward,\n\t\tscrollPos,\n\t\thorizontal,\n\t\torgScrollPos,\n\t}: {\n\t\tisForward: boolean,\n\t\tscrollPos: number,\n\t\thorizontal: boolean,\n\t\torgScrollPos: number,\n\t}) {\n\t\t/**\n\t\t * This event is fired when the user scrolls.\n\t\t * @ko 사용자가 스크롤 할 경우 발생하는 이벤트.\n\t\t * @event eg.InfiniteGrid#change\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Boolean} param.isForward Indicates whether the scroll progression direction is forward or backword. 스크롤 진행방향이 앞쪽으로 진행하는 지, 뒤쪽으로 진행하는지를 나타낸다.\n\t\t * @param {Number} param.scrollPos Current scroll position value relative to the infiniteGrid container element. infiniteGrid 컨테이너 엘리먼트 기준의 현재 스크롤 위치값\n\t\t * @param {Boolean} param.orgScrollPos Current position of the scroll 현재 스크롤 위치값\n\t\t * @param {Boolean} param.isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n\t\t * @param {Boolean} options.horizontal Direction of the scroll movement (true: horizontal, false: vertical) 스크롤 이동 방향 (true 가로방향, false 세로방향\n\t\t */\n\t\tthis.trigger(\"change\", {\n\t\t\tisForward,\n\t\t\thorizontal,\n\t\t\tscrollPos,\n\t\t\torgScrollPos,\n\t\t});\n\t\tthis._infinite.scroll(scrollPos);\n\t}\n\tprivate _onLayoutComplete({\n\t\titems,\n\t\tisAppend,\n\t\tisTrusted = false,\n\t\tuseRecycle = this.options.useRecycle,\n\t\tfromCache = false,\n\t\tisLayout = false,\n\t}: {\n\t\titems: IInfiniteGridItem[],\n\t\tisAppend: boolean,\n\t\tisTrusted: boolean,\n\t\tuseRecycle: boolean,\n\t\tfromCache: boolean,\n\t\tisLayout?: boolean,\n\t}) {\n\t\tconst viewSize = this._renderer.getViewSize();\n\n\t\tif (!isAppend) {\n\t\t\tthis._fit();\n\t\t} else {\n\t\t\tthis._isLoading() && this._renderLoading();\n\t\t}\n\n\t\tconst watcher = this._watcher;\n\t\tconst scrollPos = watcher.getScrollPos();\n\n\t\t// recycle after _fit beacause prepend and append are occured simultaneously by scroll.\n\t\tif (!isLayout && useRecycle && !this._isLoading()) {\n\t\t\tthis._infinite.recycle(scrollPos, isAppend);\n\t\t}\n\n\t\tconst size = this._getEdgeValue(\"end\");\n\n\t\tif (isAppend) {\n\t\t\tthis._setContainerSize(size + this._status.loadingSize || 0);\n\t\t\tif (scrollPos > 0) {\n\t\t\t\t!IS_IOS && this._scrollTo(scrollPos);\n\t\t\t}\n\t\t}\n\t\t!isLayout && this._process(PROCESSING, false);\n\n\t\t/**\n\t\t * This event is fired when layout is successfully arranged through a call to the append(), prepend(), or layout() method.\n\t\t * @ko 레이아웃 배치가 완료됐을 때 발생하는 이벤트. append() 메서드나 prepend() 메서드, layout() 메서드 호출 후 카드의 배치가 완료됐을 때 발생한다\n\t\t * @event eg.InfiniteGrid#layoutComplete\n\t\t *\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Array} param.target Rearranged card elements재배치된 카드 엘리먼트들\n\t\t * @param {Boolean} param.fromCache Check whether these items are cache or not 해당 아이템들이 캐시인지 아닌지 확인한다.\n\t\t * @param {Boolean} param.isLayout Returns true if this is an event called by resize event or layout method. Returns false if this is an event called by adding an item. 해당 이벤트가 리사이즈 이벤트 또는 layout() 메서드를 통해 호출됐으면 true, 아이템 추가로 호출됐으면 false를 반환한다.\n\t\t * @param {Boolean} param.isAppend Checks whether the append() method is used to add a card element. It returns true even though the layoutComplete event is fired after the layout() method is called. 카드 엘리먼트가 append() 메서드로 추가됐는지 확인한다. layout() 메서드가 호출된 후 layoutComplete 이벤트가 발생해도 'true'를 반환한다.\n\t\t * @param {Boolean} param.isScroll Checks whether scrolling has occurred after the append(), prepend(), ..., etc method is called append, prend 등 호출 후 스크롤이 생겼는지 확인한다.\n\t\t * @param {Number} param.scrollPos Current scroll position value relative to the infiniteGrid container element. infiniteGrid 컨테이너 엘리먼트 기준의 현재 스크롤 위치값\n\t\t * @param {Number} param.orgScrollPos Current position of the scroll 현재 스크롤 위치값\n\t\t * @param {Number} param.size The size of container element 컨테이너 엘리먼트의 크기\n\t\t * @param {Boolean} param.isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n\t\t * @param {Function} param.endLoading End loading after startLoading() for append/prepend loading data. 데이터 로딩을 위해 append/prepend startLoading() 호출 이후 로딩을 끝낸다.\n\t\t * @param {Object} param.endLoading.userStyle The custom style to apply to this loading bar for start. 로딩이 끝날 때 로딩 바에 적용될 사용자 스타일 \n\t\t */\n\t\tthis.trigger(\"layoutComplete\", {\n\t\t\ttarget: items.concat(),\n\t\t\tisAppend,\n\t\t\tisTrusted,\n\t\t\tfromCache,\n\t\t\tisLayout,\n\t\t\tisScroll: viewSize < watcher.getContainerOffset() + size,\n\t\t\tscrollPos,\n\t\t\torgScrollPos: watcher.getOrgScrollPos(),\n\t\t\tsize,\n\t\t\tendLoading: (userStyle: StyleType) => {\n\t\t\t\tthis.endLoading(userStyle);\n\t\t\t},\n\t\t});\n\t\tthis._infinite.scroll(scrollPos);\n\t}\n\tprivate _reset() {\n\t\tthis._status = {\n\t\t\tprocessingStatus: IDLE,\n\t\t\tloadingSize: 0,\n\t\t\tloadingStyle: {},\n\t\t};\n\t}\n}\n\nexport default InfiniteGrid;\n","import { assign } from \"../../utils\";\n\nexport interface IBoxModel {\n\toriginWidth: number;\n\toriginHeight: number;\n\twidth: number;\n\theight: number;\n\tleft: number;\n\ttop: number;\n\titems: BoxModel[];\n}\n\nexport default class BoxModel implements IBoxModel {\n\tpublic originWidth: number;\n\tpublic originHeight: number;\n\tpublic width: number;\n\tpublic height: number;\n\tpublic left: number;\n\tpublic top: number;\n\tpublic items: BoxModel[];\n\tconstructor(options: Partial) {\n\t\tassign(this, {\n\t\t\toriginWidth: 0,\n\t\t\toriginHeight: 0,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\titems: [],\n\t\t}, options);\n\t}\n\tpublic scaleTo(width: number, height: number) {\n\t\tconst scaleX = this.width ? width / this.width : 0;\n\t\tconst scaleY = this.height ? height / this.height : 0;\n\n\t\tthis.items.forEach(v => {\n\t\t\tif (scaleX !== 0) {\n\t\t\t\tv.left *= scaleX;\n\t\t\t\tv.width *= scaleX;\n\t\t\t}\n\t\t\tif (scaleY !== 0) {\n\t\t\t\tv.top *= scaleY;\n\t\t\t\tv.height *= scaleY;\n\t\t\t}\n\t\t});\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t}\n\tpublic push(item: BoxModel) {\n\t\tthis.items.push(item);\n\t}\n\tpublic getOriginSize() {\n\t\treturn this.originWidth * this.originHeight;\n\t}\n\tpublic getSize() {\n\t\treturn this.width * this.height;\n\t}\n\tpublic getOriginRatio() {\n\t\treturn (this.originHeight === 0) ? 0 : this.originWidth / this.originHeight;\n\t}\n\tpublic getRatio() {\n\t\treturn (this.height === 0) ? 0 : this.width / this.height;\n\t}\n}\n","import BoxModel from \"./lib/BoxModel\";\nimport { APPEND, PREPEND } from \"../consts\";\nimport { getStyleNames, assignOptions, toZeroArray, cloneItems } from \"../utils\";\nimport { ILayout, IRectlProperties, ISize, IInfiniteGridItem, IInfiniteGridGroup } from \"../types\";\n\nfunction getCost(originLength: number, length: number) {\n\tlet cost = originLength / length;\n\n\tif (cost < 1) {\n\t\tcost = 1 / cost;\n\t}\n\n\treturn cost - 1;\n}\nfunction fitArea(\n\titem: BoxModel,\n\tbestFitArea: BoxModel,\n\titemFitSize: ISize,\n\tcontainerFitSize: ISize,\n\tlayoutVertical: boolean,\n) {\n\titem.height = itemFitSize.height;\n\titem.width = itemFitSize.width;\n\tbestFitArea.height = containerFitSize.height;\n\tbestFitArea.width = containerFitSize.width;\n\n\tif (layoutVertical) {\n\t\titem.top = bestFitArea.top + bestFitArea.height;\n\t\titem.left = bestFitArea.left;\n\t} else {\n\t\titem.left = bestFitArea.left + bestFitArea.width;\n\t\titem.top = bestFitArea.top;\n\t}\n}\n\n/**\n * @classdesc The PackingLayout is a layout that shows the important cards bigger without sacrificing the weight of the cards. Rows and columns are separated so that cards are dynamically placed within the horizontal and vertical space rather than arranged in an orderly fashion.\n * @ko PackingLayout은 카드의 본래 크기에 따른 비중을 해치지 않으면서 중요한 카드는 더 크게 보여 주는 레이아웃이다. 행과 열이 구분돼 이미지를 정돈되게 배치하는 대신 가로세로 일정 공간 내에서 동적으로 카드를 배치한다.\n * @class eg.InfiniteGrid.PackingLayout\n * @param {Object} [options] The option object of eg.InfiniteGrid.PackingLayout module eg.InfiniteGrid.PackingLayout 모듈의 옵션 객체\n * @param {String} [options.margin=0] Margin used to create space around items 아이템들 사이의 공간\n * @param {Boolean} [options.horizontal=false] Direction of the scroll movement (false: vertical, true: horizontal) 스크롤 이동 방향 (false: 세로방향, true: 가로방향)\n * @param {Boolean} [options.aspectRatio=1] The aspect ratio of the group 그룹의 가로 세로 비 \n * @param {Boolean} [options.sizeWeight=1] The size weight when placing an image 이미지를 배치할 때 사이즈 가중치 \n * @param {Boolean} [options.ratioWeight=1] The ratio weight when placing an image 이미지를 배치할 때 비율 가중치 \n * @example\n```\n\n```\n **/\nclass PackingLayout implements ILayout {\n\tpublic options: {\n\t\thorizontal: boolean,\n\t\tmargin: number,\n\t\taspectRatio: number,\n\t\tsizeWeight: number,\n\t\tratioWeight: number,\n\t};\n\tprivate _size: number;\n\tprivate _style: IRectlProperties;\n\tconstructor(options: Partial = {}) {\n\t\tthis.options = assignOptions({\n\t\t\tmargin: 0,\n\t\t\thorizontal: false,\n\t\t\taspectRatio: 1,\n\t\t\tsizeWeight: 1,\n\t\t\tratioWeight: 1,\n\t\t}, options);\n\t\tthis._size = 0;\n\t\tthis._style = getStyleNames(this.options.horizontal);\n\t}\n\t/**\n\t * Adds items at the bottom of a outline.\n\t * @ko 아이템들을 아웃라인 아래에 추가한다.\n\t * @method eg.InfiniteGrid.PackingLayout#append\n\t * @param {Array} items Array of items to be layouted 레이아웃할 아이템들의 배열\n\t * @param {Array} [outline=[]] Array of outline points to be reference points 기준점이 되는 아웃라인 점들의 배열\n\t * @return {Object} Layouted items and outline of start and end 레이아웃이 된 아이템과 시작과 끝의 아웃라인이 담긴 정보\n\t * @example\n\t * layout.prepend(items, [100]);\n\t */\n\tpublic append(items: IInfiniteGridItem[], outline?: number[], cache?: boolean) {\n\t\treturn this._insert(items, outline, APPEND, cache);\n\t}\n\t/**\n\t * Adds items at the top of a outline.\n\t * @ko 아이템을 아웃라인 위에 추가한다.\n\t * @method eg.InfiniteGrid.PackingLayout#prepend\n\t * @param {Array} items Array of items to be layouted 레이아웃할 아이템들의 배열\n\t * @param {Array} [outline=[]] Array of outline points to be reference points 기준점이 되는 아웃라인 점들의 배열\n\t * @return {Object} Layouted items and outline of start and end 레이아웃이 된 아이템과 시작과 끝의 아웃라인이 담긴 정보\n\t * @example\n\t * layout.prepend(items, [100]);\n\t */\n\tpublic prepend(items: IInfiniteGridItem[], outline?: number[], cache?: boolean) {\n\t\treturn this._insert(items, outline, PREPEND, cache);\n\t}\n\t/**\n\t * Adds items of groups at the bottom of a outline.\n\t * @ko 그룹들의 아이템들을 아웃라인 아래에 추가한다.\n\t * @method eg.InfiniteGrid.PackingLayout#layout\n\t * @param {Array} groups Array of groups to be layouted 레이아웃할 그룹들의 배열\n\t * @param {Array} outline Array of outline points to be reference points 기준점이 되는 아웃라인 점들의 배열\n\t * @return {eg.InfiniteGrid.PackingLayout} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * layout.layout(groups, [100, 200, 300, 400]);\n\t */\n\tpublic layout(groups: IInfiniteGridGroup[] = [], outline: number[] = []) {\n\t\tconst length = groups.length;\n\t\tlet point = outline;\n\n\t\tfor (let i = 0; i < length; ++i) {\n\t\t\tconst group = groups[i];\n\t\t\tconst outlines = this._layout(group.items, point, APPEND);\n\n\t\t\tgroup.outlines = outlines;\n\t\t\tpoint = outlines.end;\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t * Set the viewport size of the layout.\n\t * @ko 레이아웃의 가시 사이즈를 설정한다.\n\t * @method eg.InfiniteGrid.PackingLayout#setSize\n\t * @param {Number} size The viewport size of container area where items are added to a layout 레이아웃에 아이템을 추가하는 컨테이너 영역의 가시 사이즈\n\t * @return {eg.InfiniteGrid.PackingLayout} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * layout.setSize(800);\n\t */\n\tpublic setSize(size: number) {\n\t\tthis._size = size;\n\t\treturn this;\n\t}\n\tprivate _findBestFitArea(container: BoxModel, item: BoxModel) {\n\t\tif (container.getRatio() === 0) { // 아이템 최초 삽입시 전체영역 지정\n\t\t\tcontainer.originWidth = item.width;\n\t\t\tcontainer.originHeight = item.height;\n\t\t\tcontainer.width = item.width;\n\t\t\tcontainer.height = item.height;\n\t\t\treturn;\n\t\t}\n\n\t\tlet bestFitArea = null;\n\t\tlet minCost = 10000000;\n\t\tlet layoutVertical = false;\n\t\tconst itemFitSize: ISize = {\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t};\n\t\tconst containerFitSize: ISize = {\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t};\n\t\tconst { sizeWeight, ratioWeight } = this.options;\n\n\t\tcontainer.items.forEach(v => {\n\t\t\tconst containerSizeCost = getCost(v.getOriginSize(), v.getSize()) * sizeWeight;\n\t\t\tconst containerRatioCost = getCost(v.getOriginRatio(), v.getRatio()) * ratioWeight;\n\t\t\tconst width = v.width;\n\t\t\tconst height = v.height;\n\t\t\tlet cost;\n\n\t\t\tfor (let i = 0; i < 2; ++i) {\n\t\t\t\tlet itemWidth;\n\t\t\t\tlet itemHeight;\n\t\t\t\tlet containerWidth;\n\t\t\t\tlet containerHeight;\n\n\t\t\t\tif (i === 0) {\n\t\t\t\t\t// 상하에 아이템 추가\n\t\t\t\t\titemWidth = width;\n\t\t\t\t\titemHeight = height * (item.height / (v.originHeight + item.height));\n\t\t\t\t\tcontainerWidth = width;\n\t\t\t\t\tcontainerHeight = height - itemHeight;\n\t\t\t\t} else {\n\t\t\t\t\t// 좌우에 아이템 추가\n\t\t\t\t\titemHeight = height;\n\t\t\t\t\titemWidth = width * (item.width / (v.originWidth + item.width));\n\t\t\t\t\tcontainerHeight = height;\n\t\t\t\t\tcontainerWidth = width - itemWidth;\n\t\t\t\t}\n\n\t\t\t\tconst itemSize = itemWidth * itemHeight;\n\t\t\t\tconst itemRatio = itemWidth / itemHeight;\n\t\t\t\tconst containerSize = containerWidth * containerHeight;\n\t\t\t\tconst containerRatio = containerHeight / containerHeight;\n\n\t\t\t\tcost = getCost(item.getSize(), itemSize) * sizeWeight;\n\t\t\t\tcost += getCost(item.getRatio(), itemRatio) * ratioWeight;\n\t\t\t\tcost += getCost(v.getOriginSize(), containerSize) * sizeWeight - containerSizeCost;\n\t\t\t\tcost += getCost(v.getOriginRatio(), containerRatio) * ratioWeight - containerRatioCost;\n\n\t\t\t\tif (cost === Math.min(cost, minCost)) {\n\t\t\t\t\tminCost = cost;\n\t\t\t\t\tbestFitArea = v;\n\t\t\t\t\tlayoutVertical = (i === 0);\n\t\t\t\t\titemFitSize.width = itemWidth;\n\t\t\t\t\titemFitSize.height = itemHeight;\n\t\t\t\t\tcontainerFitSize.width = containerWidth;\n\t\t\t\t\tcontainerFitSize.height = containerHeight;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tfitArea(item, bestFitArea, itemFitSize, containerFitSize, layoutVertical);\n\t}\n\tprivate _layout(items: IInfiniteGridItem[], outline: number[] = [], isAppend?: boolean) {\n\t\tconst style = this._style;\n\t\tconst { horizontal, aspectRatio, margin } = this.options;\n\t\tconst pos1Name = style.startPos1;\n\t\tconst containerWidth = this._size * (horizontal ? aspectRatio : 1);\n\t\tconst containerHeight = this._size / (horizontal ? 1 : aspectRatio);\n\t\tconst containerSize1 = horizontal ? containerWidth : containerHeight;\n\t\tconst prevOutline = toZeroArray(outline);\n\t\tconst start = isAppend ? Math.max(...prevOutline) :\n\t\t\tMath.min(...prevOutline) - containerSize1 - margin;\n\t\tconst end = start + containerSize1 + margin;\n\t\tconst container = new BoxModel({});\n\n\t\titems.forEach(item => {\n\t\t\tconst { width, height } = item.orgSize;\n\t\t\tconst model = new BoxModel({\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\toriginWidth: width,\n\t\t\t\toriginHeight: height,\n\t\t\t});\n\n\t\t\tthis._findBestFitArea(container, model);\n\t\t\tcontainer.push(model);\n\t\t\tcontainer.scaleTo(containerWidth + margin, containerHeight + margin);\n\t\t});\n\t\titems.forEach((item, i) => {\n\t\t\tconst boxItem = container.items[i];\n\t\t\tconst width = boxItem.width;\n\t\t\tconst height = boxItem.height;\n\t\t\tconst top = boxItem.top;\n\t\t\tconst left = boxItem.left;\n\n\t\t\titem.rect = { top, left, width: width - margin, height: height - margin };\n\t\t\titem.rect[pos1Name] += start;\n\t\t});\n\n\t\treturn {\n\t\t\tstart: [start],\n\t\t\tend: [end],\n\t\t};\n\t}\n\tprivate _insert(items: IInfiniteGridItem[] = [], outline: number[] = [], isAppend?: boolean, cache?: boolean) {\n\t\t// this only needs the size of the item.\n\t\tconst clone = cache ? items : cloneItems(items);\n\n\t\treturn {\n\t\t\titems: clone,\n\t\t\toutlines: this._layout(clone, outline, isAppend),\n\t\t};\n\t}\n}\n\nexport default PackingLayout;\n","/**\n * Copyright (c) NAVER Corp.\n * egjs-infinitegrid projects are licensed under the MIT license\n */\nimport InfiniteGrid from \"./InfiniteGrid\";\nimport PackingLayout from \"./layouts/PackingLayout\";\n\n(InfiniteGrid as any).PackingLayout = PackingLayout;\n\nexport default InfiniteGrid;\n"],"names":["isUndefined","value","Component","_eventHandler","options","_proto","prototype","trigger","eventName","customEvent","handlerList","hasHandlerList","length","concat","eventType","isCanceled","arg","i","stop","currentTarget","_len","arguments","restParam","Array","_key","apply","once","handlerToAttach","eventHash","self","on","listener","_len2","_key2","off","hasOn","name","push","handlerToDetach","undefined","k","handlerFunction","splice","VERSION","win","window","document","navigator","userAgent","ua","SUPPORT_COMPUTEDSTYLE","SUPPORT_ADDEVENTLISTENER","SUPPORT_PASSIVE","supportsPassiveOption","Object","defineProperty","addEventListener","get","e","IS_IE","test","IS_IOS","IS_ANDROID2","CONTAINER_CLASSNAME","IGNORE_CLASSNAME","TRANSITION_NAME","APPEND","PREPEND","VERTICAL","HORIZONTAL","CACHE","NO_CACHE","TRUSTED","NO_TRUSTED","MULTI","DUMMY_POSITION","GROUPKEY_ATT","DEFAULT_OPTIONS","horizontal","margin","agent","toLowerCase","isMobile","IDLE","LOADING_APPEND","LOADING_PREPEND","PROCESSING","webkit","exec","WEBKIT_VERSION","parseInt","DEFENSE_BROWSER","TRANSFORM","TRANSITION","TRANSITION_END","nodes","array","len","html","match","param","multi","el","matchHTML","dummy","createElement","innerHTML","childNodes","querySelectorAll","toArray","isWindow","isJQuery","$","isArray","map","v","nodeName","nodeType","element","type","handler","eventListenerOptions","attachEvent","removeEventListener","detachEvent","callback","removeEvent","addEvent","prop","body","documentElement","x","y","scroll","scrollLeft","scrollTop","scrollBy","getComputedStyle","currentStyle","isOffset","isDocument","doc","Math","max","size","clientRect","getBoundingClientRect","right","left","bottom","top","parseFloat","getStyles","_getSize","width","outerWidth","height","outerHeight","STYLE","vertical","startPos1","endPos1","size1","startPos2","endPos2","size2","isHorizontal","target","_i","sources","forEach","source","key","defaultOptions","assign","outline","items","item","jQuery","constructor","jquery","clear","ItemManager","elements","selector","_a","groupKey","filted","selectItems","content","outerHTML","rect","filter","classNames","className","split","some","c","data","property","reduce","acc","startKey","endKey","datas","_data","startIndex","indexOf","endIndex","slice","item2","data2","status","set","base","outlines","start","end","pluck","index","cursor","targetValue","Infinity","getOutline","getEdgeIndex","startCursor","endCursor","group","groups","pos","layouted","unshift","getAttribute","String","idx","orgSize","container","style","position","children","appendChild","properties","styles","p","transitionDuration","pos1","pos2","isEqualSize","isConstantSize","view","viewport","_init","resize","DOMRenderer","prevRect","setAttribute","render","setTransition","addOnceEvent","itemRect","renderItem","removeElement","parentNode","removeChild","noElementItems","replace","join","cssText","_size","getSize","_insert","isAppend","createElements","renderItems","isResize","isNeededResize","_calcSize","innerWidth","innerHeight","_orgStyle","overflowX","overflowY","createContainer","df","createDocumentFragment","insertBefore","firstChild","check","isOverflowScroll","_timer","reset","_containerOffset","_view","_isScrollIssue","_onCheck","bind","_onResize","setScrollPos","_prevPos","scrollPos","getOrgScrollPos","applyScrollPos","scrollTo","arrPos","rawPos","getContainerOffset","_getOffset","prevPos","getScrollPos","orgScrollPos","isForward","clearTimeout","setTimeout","_this","threshold","endScrollPos","min","itemManger","useRecycle","append","prepend","recycle","_items","_status","_b","visibles","isVisible","lastIndexOf","setCursor","getCursor","startEdgePos","endEdgePos","startPos","endPos","cache","getEdgeOutline","result","remove","AutoSizer","resizeAll","prefix","onResize","__PREFIX__","isFixed","fixed","elementPrefix","dataWidth","dataHeight","CHECK_ALL","CHECK_ONLY_ERROR","ImageLoaded","checklist","complete","error","checkCount","endCount","checkEnd","checkImage","onError","itemIndex","__ITEM_INDEX__","onCheck","srcElement","isDataAttribute","images","naturalWidth","add","tagName","checkImageLoaded","sum","waitImageLoaded","renderer","attributePrefix","_renderer","_layout","layout","setSize","callbacks","isUpdate","isRelayout","layoutGroups","updateSize","itemManager","groupIndex","prevGroup","getData","groupInfos","groupOutline","every","groupItems","groupInfo","removeTarget","replaceTarget","errorIndex","removeItem","hasTarget","src","removeAttribute","replaceItem","removeTargetLength","replaceTargetLength","layoutedItems","_c","_d","_e","_f","checkGroups","reverse","_complete","_error","_end","tslib_1","_super","itemSelector","useFit","_reset","_loadingBar","_watcher","Watcher","_infinite","Infinite","_requestAppend","_requestPrepend","_recycle","_manager","LayoutKlass","LayoutMananger","setLayout","_setSize","getViewportSize","includeCached","getVisibleItems","infinite","getItems","isLayoutAll","isChildren","getContainerSize","setContainerSize","_fit","clearOutlines","_onLayoutComplete","fromCache","isTrusted","isLayout","getVisibleData","getStatus","watcher","processingStatus","setStatus","visibleItems","createAndInsert","isReLayout","_postLayout","newItems","_appendLoadingBar","userLoadingBar","loadingBarObj","loadingSize","loadingStyle","loadingBar","_isProcessing","_isLoading","_getLoadingStatus","userStyle","display","_process","_renderLoading","_setContainerSize","_getEdgeValue","_fitItems","isProcessing","getItem","_updateItem","isInCursor","fit","_scrollTo","moveCache","moveItem","_postCache","destroy","getMaxEdgeValue","getViewSize","getEdgeValue","isAdd","from","method","removeItems","posName","resetSize","requestStartCursor","requestEndCursor","_setScrollPos","_onImageError","getGroupKeys","pop","startLoading","endLoading","shift","viewSize","isScroll","InfiniteGrid","originWidth","originHeight","scaleX","scaleY","originLength","cost","bestFitArea","itemFitSize","containerFitSize","layoutVertical","assignOptions","aspectRatio","sizeWeight","ratioWeight","_style","getStyleNames","point","getRatio","minCost","containerSizeCost","getCost","getOriginSize","containerRatioCost","getOriginRatio","itemWidth","itemHeight","containerWidth","containerHeight","itemSize","itemRatio","containerSize","containerRatio","fitArea","pos1Name","containerSize1","prevOutline","toZeroArray","BoxModel","model","_findBestFitArea","scaleTo","boxItem","clone","cloneItems","PackingLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;;;;;;;;;;IASA;;;;IAIA,SAASA,WAAT,CAAqBC,KAArB,EAA4B;IAC1B,SAAO,OAAOA,KAAP,KAAiB,WAAxB;IACD;IACD;;;;;;;IAOA,IA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