layui.define(function(a){"use strict";function e(a){var e=this;e.config=a||{},e.config.index=++o.index,e.render(!0)}var r=document,s="getElementById",c="getElementsByTagName",u="layui-disabled";e.prototype.type=function(){var a=this.config;if("object"==typeof a.elem)return void 0===a.elem.length?2:3},e.prototype.view=function(){var n=this.config,r=n.groups="groups"in n?0|n.groups:5;n.layout="object"==typeof n.layout?n.layout:["prev","page","next"],n.count=0|n.count,n.curr=0|n.curr||1,n.limits="object"==typeof n.limits?n.limits:[10,20,30,40,50],n.limit=0|n.limit||10,n.pages=Math.ceil(n.count/n.limit)||1,n.curr>n.pages&&(n.curr=n.pages),r<0?r=1:r>n.pages&&(r=n.pages),n.prev="prev"in n?n.prev:"&#x4E0A;&#x4E00;&#x9875;",n.next="next"in n?n.next:"&#x4E0B;&#x4E00;&#x9875;";var t,i,s=n.pages>r?Math.ceil((n.curr+(1<r?1:0))/(0<r?r:1)):1,l={prev:n.prev?'<a href="javascript:;" class="layui-laypage-prev'+(1==n.curr?" "+u:"")+'" data-page="'+(n.curr-1)+'">'+n.prev+"</a>":"",page:function(){var a=[];if(n.count<1)return"";1<s&&!1!==n.first&&0!==r&&a.push('<a href="javascript:;" class="layui-laypage-first" data-page="1"  title="&#x9996;&#x9875;">'+(n.first||1)+"</a>");var e=Math.floor((r-1)/2),t=1<s?n.curr-e:1,i=1<s?(e=n.curr+(r-e-1))>n.pages?n.pages:e:r;for(i-t<r-1&&(t=i-r+1),!1!==n.first&&2<t&&a.push('<span class="layui-laypage-spr">&#x2026;</span>');t<=i;t++)t===n.curr?a.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(n.theme)?'style="background-color:'+n.theme+';"':"")+"></em><em>"+t+"</em></span>"):a.push('<a href="javascript:;" data-page="'+t+'">'+t+"</a>");return n.pages>r&&n.pages>i&&!1!==n.last&&(i+1<n.pages&&a.push('<span class="layui-laypage-spr">&#x2026;</span>'),0!==r&&a.push('<a href="javascript:;" class="layui-laypage-last" title="&#x5C3E;&#x9875;"  data-page="'+n.pages+'">'+(n.last||n.pages)+"</a>")),a.join("")}(),next:n.next?'<a href="javascript:;" class="layui-laypage-next'+(n.curr==n.pages?" "+u:"")+'" data-page="'+(n.curr+1)+'">'+n.next+"</a>":"",count:'<span class="layui-laypage-count">共 '+n.count+" 条</span>",limit:(t=['<span class="layui-laypage-limits"><select lay-ignore>'],layui.each(n.limits,function(a,e){t.push('<option value="'+e+'"'+(e===n.limit?"selected":"")+">"+e+" 条/页</option>")}),t.join("")+"</select></span>"),refresh:['<a href="javascript:;" data-page="'+n.curr+'" class="layui-laypage-refresh">','<i class="layui-icon layui-icon-refresh"></i>',"</a>"].join(""),skip:['<span class="layui-laypage-skip">&#x5230;&#x7B2C;','<input type="text" min="1" value="'+n.curr+'" class="layui-input">','&#x9875;<button type="button" class="layui-laypage-btn">&#x786e;&#x5b9a;</button>',"</span>"].join("")};return['<div class="layui-box layui-laypage layui-laypage-'+(n.theme?/^#/.test(n.theme)?"molv":n.theme:"default")+'" id="layui-laypage-'+n.index+'">',(i=[],layui.each(n.layout,function(a,e){l[e]&&i.push(l[e])}),i.join("")),"</div>"].join("")},e.prototype.jump=function(a,e){if(a){var t=this,i=t.config,n=a.children,r=a[c]("button")[0],s=a[c]("input")[0],a=a[c]("select")[0],l=function(){var a=0|s.value.replace(/\s|\D/g,"");a&&(i.curr=a,t.render())};if(e)return l();for(var u=0,p=n.length;u<p;u++)"a"===n[u].nodeName.toLowerCase()&&o.on(n[u],"click",function(){var a=0|this.getAttribute("data-page");a<1||a>i.pages||(i.curr=a,t.render())});a&&o.on(a,"change",function(){var a=this.value;i.curr*a>i.count&&(i.curr=Math.ceil(i.count/a)),i.limit=a,t.render()}),r&&o.on(r,"click",function(){l()})}},e.prototype.skip=function(t){var i,a;t&&(i=this,(a=t[c]("input")[0])&&o.on(a,"keyup",function(a){var e=this.value,a=a.keyCode;/^(37|38|39|40)$/.test(a)||(/\D/.test(e)&&(this.value=e.replace(/\D/,"")),13===a&&i.jump(t,!0))}))},e.prototype.render=function(a){var e=this,t=e.config,i=e.type(),n=e.view();2===i?t.elem&&(t.elem.innerHTML=n):3===i?t.elem.html(n):r[s](t.elem)&&(r[s](t.elem).innerHTML=n),t.jump&&t.jump(t,a);n=r[s]("layui-laypage-"+t.index);e.jump(n),t.hash&&!a&&(location.hash="!"+t.hash+"="+t.curr),e.skip(n)};var o={render:function(a){return new e(a).index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};a("laypage",o)});