"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}module.exports=function(t){var e={};function i(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"===_typeof(t)&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(o,r,function(e){return t[e]}.bind(null,r));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=6)}({0:function(t,e,i){var o=!1,r=void 0,n=void 0;!function(){var t=wx.getSystemInfoSync();o="ios"===t.platform;var e=t.screenWidth||375,i=t.pixelRatio||2;e===r&&i===n||(r=e,n=i)}();var l=/([+-]?\d+(?:\.\d+)?)rpx/gi;t.exports={transformRpx:function(t,e){if("string"!=typeof t)return t;var i=l;return t.replace(i,function(t,i){return(0===(l=Number(i))?0:(l=l/750*r,0===(l=Math.floor(l+1e-4))?1!==n&&o?.5:1:l))+(e?"px":"");var l})}}},6:function(t,e,i){var o=wx.getSystemInfoSync(),r=i(0).transformRpx;Component({options:{multipleSlots:!0},relations:{"../recycle-item/recycle-item":{type:"child",linked:function(t){if(!this._hasCheckSize){this._hasCheckSize=!0;var e=this.boundingClientRect(this._pos.beginIndex);if(!e)return;setTimeout(function(){try{t.createSelectorQuery().select(".wx-recycle-item").boundingClientRect(function(t){!t||t.width===e.width&&t.height===e.height||console.warn("[recycle-view] the size in is not the same with param itemSize, expect {width: "+t.width+", height: "+t.height+"} but got {width: "+e.width+", height: "+e.height+"}")}).exec()}catch(t){}},10)}}}},properties:{debug:{type:Boolean,value:!1},scrollY:{type:Boolean,value:!0},batch:{type:Boolean,value:!1,public:!0,observer:"_recycleInnerBatchDataChanged"},batchKey:{type:String,value:"batchSetRecycleData",public:!0},scrollTop:{type:Number,value:0,public:!0,observer:"_scrollTopChanged",observeAssignments:!0},height:{type:Number,value:o.windowHeight,public:!0,observer:"_heightChanged"},width:{type:Number,value:o.windowWidth,public:!0,observer:"_widthChanged"},upperThreshold:{type:Number,value:50,public:!0},lowerThreshold:{type:Number,value:50,public:!0},scrollToIndex:{type:Number,public:!0,value:0,observer:"_scrollToIndexChanged",observeAssignments:!0},scrollWithAnimation:{type:Boolean,public:!0,value:!1},enableBackToTop:{type:Boolean,public:!0,value:!1},throttle:{type:Boolean,public:!0,value:!0},placeholderImage:{type:String,public:!0,value:""},screen:{type:Number,public:!0,value:4}},data:{innerBeforeHeight:0,innerAfterHeight:0,innerScrollTop:0,innerScrollIntoView:"",placeholderImageStr:"",totalHeight:0,useInPage:!1},attached:function(){this.data.placeholderImage&&this.setData({placeholderImageStr:r(this.data.placeholderImage,!0)}),this.setItemSize({array:[],map:{},totalHeight:0})},ready:function(){var t=this;this._initPosition(function(){t._isReady=!0,t._updateTimerId||t._scrollViewDidScroll({detail:{scrollLeft:t._pos.left,scrollTop:t._pos.top,ignoreScroll:!0}},!0)})},detached:function(){this.page=null,this.context&&(this.context.destroy(),this.context=null)},methods:{_log:function(){var t;if(this.data.debug){for(var e=new Date,i=e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+"."+e.getMilliseconds(),o=arguments.length,r=Array(o),n=0;ns[c][d]?n=s[c][d]:l=this.sizeArray.length)},__calcViewportIndexes:function(t,e){if(!this.sizeArray.length)return{};var i=this._pos;void 0===t&&(t=i.left),void 0===e&&(e=i.top);var o=this.data.beforeSlotHeight||0,r=this.data.screen,n=e-i.height*r-o,l=e+i.height*r-o;l>this.totalHeight&&(n-=l-this.totalHeight,l=this.totalHeight),n=this.sizeArray.length&&(a=this.sizeArray.length-1),!this._isIndexValid(h,a))return{beginIndex:-1,endIndex:-1,minTop:0,afterHeight:0,maxTop:0};var c=this.sizeArray[a].beforeHeight+this.sizeArray[a].height;return{beginIndex:h,endIndex:a,minTop:this.sizeArray[h].beforeHeight,afterHeight:this.totalHeight-c,maxTop:l}},setItemSize:function(t){this.sizeArray=t.array,this.sizeMap=t.map,t.totalHeight!==this.totalHeight&&this.setData({totalHeight:t.totalHeight,useInPage:this.useInPage||!1}),this.totalHeight=t.totalHeight},setList:function(t,e){this._currentSetDataKey=t,this._currentSetDataList=e},setPage:function(t){this.page=t},forceUpdate:function(t,e){var i=this;if(!this._isReady)return this._updateTimerId&&clearTimeout(this._updateTimerId),void(this._updateTimerId=setTimeout(function(){i.forceUpdate(t,e)},10));this._updateTimerId=null;var o=this;e?this.reRender(function(){o._scrollViewDidScroll({detail:{scrollLeft:o._pos.left,scrollTop:o.currentScrollTop||o.data.scrollTop||0,ignoreScroll:!0,cb:t}},!0)}):this._scrollViewDidScroll({detail:{scrollLeft:o._pos.left,scrollTop:o.currentScrollTop||o.data.scrollTop||0,ignoreScroll:!0,cb:t}},!0)},_initPosition:function(t){var e=this;e._pos={left:e.data.scrollLeft||0,top:e.data.scrollTop||0,width:this.data.width,height:Math.max(500,this.data.height),direction:0},this.reRender(t)},_widthChanged:function(t){return this._isReady?(this._pos.width=t,this.forceUpdate(),t):t},_heightChanged:function(t){return this._isReady?(this._pos.height=Math.max(500,t),this.forceUpdate(),t):t},reRender:function(t){var e=this,i=void 0,o=void 0,r=this;function n(){r._lastBeforeSlotHeight===i&&r._lastAfterSlotHeight===o||r.setData({hasBeforeSlotHeight:!0,hasAfterSlotHeight:!0,beforeSlotHeight:i,afterSlotHeight:o}),r._lastBeforeSlotHeight=i,r._lastAfterSlotHeight=o,t&&t()}var l=!1,s=!1;this.setData({hasBeforeSlotHeight:!1,hasAfterSlotHeight:!1},function(){e.createSelectorQuery().select(".slot-before").boundingClientRect(function(t){i=t.height,l=!0,s&&n&&n()}).exec(),e.createSelectorQuery().select(".slot-after").boundingClientRect(function(t){o=t.height,s=!0,l&&n&&n()}).exec()})},_setInnerBeforeAndAfterHeight:function(t){void 0!==t.beforeHeight&&(this._tmpBeforeHeight=t.beforeHeight),t.afterHeight&&(this._tmpAfterHeight=t.afterHeight)},_recycleInnerBatchDataChanged:function(t){var e=this;if(void 0!==this._tmpBeforeHeight){var i={innerBeforeHeight:this._tmpBeforeHeight||0,innerAfterHeight:this._tmpAfterHeight||0};void 0!==this._tmpInnerScrollTop&&(i.innerScrollTop=this._tmpInnerScrollTop);var o={},r=!1;void 0!==this._currentSetDataKey&&(o[this._currentSetDataKey]=this._currentSetDataList,r=!0);var n=this.data.scrollWithAnimation;r&&e.page.setData(o),e.setData(i,function(){e.setData({scrollWithAnimation:n}),"function"==typeof t&&t()}),delete this._currentSetDataKey,delete this._currentSetDataList,this._tmpBeforeHeight=void 0,this._tmpAfterHeight=void 0,this._tmpInnerScrollTop=void 0}},_renderByScrollTop:function(t){this._scrollViewDidScroll({detail:{scrollLeft:this._pos.scrollLeft,scrollTop:t,ignoreScroll:!0}},!0),this.data.scrollWithAnimation&&(this._isScrollingWithAnimation=!0),this.setData({innerScrollTop:t})},_scrollTopChanged:function(t,e){var i=this;return this._isInitScrollTop||0!==t?(this.currentScrollTop=t,this._isReady?(this._isInitScrollTop=!0,this._scrollTopTimerId=null,void 0===this._lastScrollTop&&(this._lastScrollTop=this.data.scrollTop),Math.abs(t-this._lastScrollTop)=this.sizeArray.length?null:{left:0,top:this.sizeArray[t].beforeHeight,width:this.sizeArray[t].width,height:this.sizeArray[t].height}},getIndexesInViewport:function(t){t||(t=1);var e=this.currentScrollTop,i=e+t;i<0&&(i=0);var o=e+this.data.height-t;o>this.totalHeight&&(o=this.totalHeight);for(var r=[],n=0;n=i&&this.sizeArray[n].beforeHeight<=o&&r.push(n),!(this.sizeArray[n].beforeHeight>o));n++);return r},getTotalHeight:function(){return this.totalHeight},setUseInPage:function(t){this.useInPage=t},setPlaceholderImage:function(t,e){var i=["data:image/svg+xml,%3Csvg height='"+e.height+"' width='"+e.width+"' xmlns='http://www.w3.org/2000/svg'%3E"];t.forEach(function(t){i.push("%3Crect width='"+t.width+"' x='"+t.left+"' height='"+t.height+"' y='"+t.top+"' style='fill:rgb(204,204,204);' /%3E")}),i.push("%3C/svg%3E"),this.setData({placeholderImageStr:i.join("")})}}})}});