-
Notifications
You must be signed in to change notification settings - Fork 254
/
Copy pathpqgrid.min.js
17 lines (17 loc) · 251 KB
/
pqgrid.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*!
* ParamQuery Pro v3.5.1
*
* Copyright (c) 2012-2021 Paramvir Dhindsa (http://paramquery.com)
* Released under GNU General Public License v3
* http://paramquery.com/license
*
*/
if("function"==typeof require){var jQuery=require("jquery-ui-pack"),pq={},JSZip=require("jszip");module.exports=pq}else var jQuery=window.jQuery,pq=window.pq=window.pq||{},JSZip=window.JSZip;!function(e){var t=e.ui.autocomplete.prototype,r=t._renderMenu,i=t._renderItem;t._renderMenu=function(t,i){r.call(this,t,i);var o=this.options,n=o.selectItem;if(n&&n.on){var a=n.cls,a=void 0===a?"ui-state-highlight":a,l=this.element.val();l&&a&&e("a",t).filter(function(){return e(this).text()===l}).addClass(a)}},t._renderItem=function(e,t){var r=i.call(this,e,t),o=this.options,n=o.highlightText;if(n&&n.on){var a=this.element.val();if(a){var l=new RegExp("("+a+")","i"),s=t.label;if(l.test(s)){var d=n.style,d=void 0===d?"font-weight:bold;":d,c=n.cls,c=void 0===c?"":c;s=s.replace(l,"<span style='"+d+"' class='"+c+"'>$1</span>"),r.find("a").html(s)}}}return r};var o=e.paramquery=e.paramquery||{},n=function(e,t,r,i){for(var o=t.slice(),n=[],a=0,l=o.length;l>a;a++){var s=o[a],d=s.cb,c=s.one;if(c){if(s._oncerun)continue;s._oncerun=!0}var h=d.call(e,r,i);if(h===!1&&(r.preventDefault(),r.stopPropagation()),c&&n.push(a),r.isImmediatePropagationStopped())break}if(n.length)for(var a=n.length-1;a>=0;a--)o.splice(n[a],1)};o._trigger=function(t,r,i){var o,a,l=this,s=l.listeners,d=s[t],c=l.options,h=c.allEvents,u=c.bubble,f=l.element,p=c[t];if(i=i||{},r=e.Event(r),r.type=l.widgetName+":"+t,r.target=f[0],a=r.originalEvent)for(o in a)o in r||(r[o]=a[o]);if(h&&"function"==typeof h&&h.call(l,r,i),d&&d.length&&(n(l,d,r,i),r.isImmediatePropagationStopped()))return!r.isDefaultPrevented();if(c.trigger&&(f[u?"trigger":"triggerHandler"](r,i),r.isImmediatePropagationStopped()))return!r.isDefaultPrevented();if(p){var g=p.call(l,r,i);g===!1&&(r.preventDefault(),r.stopPropagation())}return d=s[t+"Done"],d&&d.length&&n(l,d,r,i),!r.isDefaultPrevented()};var a=function(e,t,r,i,o){var n=e.listeners[t];n||(n=e.listeners[t]=[]),n[o?"unshift":"push"]({cb:r,one:i})};o.on=function(){var e=arguments;if("boolean"==typeof e[0])var t=e[0],r=e[1],i=e[2],o=e[3];else var r=e[0],i=e[1],o=e[2];for(var n=r.split(" "),l=0;l<n.length;l++){var s=n[l];s&&a(this,s,i,o,t)}return this},o.one=function(){for(var e=arguments.length,t=[],r=0;e>r;r++)t[r]=arguments[r];return t[e]=!0,this.on.apply(this,t)};var l=function(e,t,r){if(r){var i=e.listeners[t];if(i){for(var o=[],n=0,a=i.length;a>n;n++){var l=i[n],s=l.cb;r==s&&o.push(n)}if(o.length)for(var n=o.length-1;n>=0;n--)i.splice(o[n],1)}}else delete e.listeners[t]};o.off=function(e,t){for(var r=e.split(" "),i=0;i<r.length;i++){var o=r[i];o&&l(this,o,t)}return this};var s={options:{items:"td.pq-has-tooltip,td[title]",position:{my:"center top",at:"center bottom"},content:function(){var t=e(this),r=t.closest(".pq-grid"),i=r.pqGrid("getInstance").grid,o=i.getCellIndices({$td:t}),n=o.rowIndx,a=o.dataIndx,l=i.data({rowIndx:n,dataIndx:a,data:"pq_valid"}).data;if(l){var s=l.icon,d=l.msg;d=null!=d?d:"";var c=""==s?"":"<span class='ui-icon "+s+" pq-tooltip-icon'></span>";return c+d}return t.attr("title")}}};s._create=function(){this._super();var t=this.element,r=this.eventNamespace;t.on("pqtooltipopen"+r,function(t,r){var i=e(t.target),o=e(t.originalEvent.target);if(o.on("remove",function(e){i.pqTooltip("close",e,!0)}),i.is(".pq-grid")){var n,a=i.pqGrid("getCellIndices",{$td:o}),l=a.rowIndx,s=a.dataIndx,d=i.pqGrid("getRowData",{rowIndx:l});if((n=d)&&(n=n.pq_celldata)&&(n=n[s])&&(n=n.pq_valid)){var c=n,h=c.style,u=c.cls;r.tooltip.addClass(u);var f=r.tooltip.attr("style");r.tooltip.attr("style",f+";"+h)}i.find("div.pq-sb-horiz,div.pq-sb-vert").on("pqscrollbardrag",function(e,t){e.currentTarget=o[0],i.pqTooltip("close",e,!0)})}}),t.on("pqtooltipclose"+r,function(t,r){var i=e(t.target),o=e(t.originalEvent.target);o.off("remove"),i.is(".pq-grid")&&i.find("div.pq-sb-horiz,div.pq-sb-vert").off("pqscrollbardrag")})},e.widget("paramquery.pqTooltip",e.ui.tooltip,s)}(jQuery),function(e){function t(e,t){var r,i,n,a;if(e){if(i=e.split(":"),e=t&&i.length>1?i[1]:i[0],r=o[e])return r;n=/^([^#]*|&#[^#]*)?[\,\.#0]*?([\,\s\.]?)([#0]*)([\,\s\.]?)([0]*?)(\s*[^#^0]*|&#[^#]*)?$/,a=e.match(n),a&&a.length&&(r={symbol:a[1]||"",thouSep:a[2],thousand:a[3].length,decSep:a[4],decimal:a[5].length,symbolEnd:a[6]||""},o[e]=r)}return r=r||{symbol:"",symbolEnd:"",thouSep:",",thousand:3,decSep:".",decimal:2}}var r=e.paramquery,i=Array.prototype;i.find||(i.find=function(e,t){for(var r,i=0,o=this.length;o>i;i++)if(r=this[i],e.call(t,r,i,this))return r}),i.findIndex||(i.findIndex=function(e,t){for(var r,i=0,o=this.length;o>i;i++)if(r=this[i],e.call(t,r,i,this))return i;return-1}),i.map||(i.map=function(e,t){for(var r=0,i=this.length,o=[];i>r;r++)o.push(e.call(t,this[r],r,this));return o}),i.forEach||(i.forEach=function(e,t){for(var r=0,i=this.length;i>r;r++)e.call(t,this[r],r,this)}),pq.getFn=function(){var e={};return function(t){var r=t;return"string"==typeof t&&((r=e[t])||(r=window,t.split(".").forEach(function(e){r=r[e]}),e[t]=r)),r}}(),pq.searchSeqArray=function(e,t){for(var r,i=e.length,o=t,n=t,a=0,n=n>i-1?i-1:n;;){if(r=e[n],a++,t>r){if(n==i-1){n=-1;break}n=Math.ceil((n+o)/2),n=n>i-1?i-1:n}else{if(!(r>t))break;o=n,n=Math.floor(n/2)}if(a>100)throw"too many iterations"}return n},pq.arrayUnique=function(e,t){var r,i,o,n=[],a=e.length,l={};for(r=0;a>r;r++)i=e[r],o=t?i[t]:i,l.hasOwnProperty(o)||(l[o]=1,n.push(i));return n},r.select=function(e){var t,r,i,o=e.attr,n=e.options,a=e.groupIndx,l=e.labelIndx,s=e.valueIndx,d=null!=l&&null!=s,c=null!=a,h=e.prepend,u=e.dataMap,f=function(){for(var e={},t=0;t<u.length;t++){var r=u[t];e[r]=m[r]}return"data-map='"+JSON.stringify(e)+"'"},p=["<select ",o," >"];if(h)for(var g in h)p.push('<option value="',g,'">',h[g],"</option>");if(n&&n.length){for(var v=0,w=n.length;w>v;v++){var m=n[v];if(d){var x=m[s],_=m.pq_disabled?'disabled="disabled" ':"",I=m.pq_selected?'selected="selected" ':"";if(null==x)continue;if(i=u?f():"",c){var y=m.pq_disabled_group?'disabled="disabled" ':"";t=m[a],r!=t&&(null!=r&&p.push("</optgroup>"),p.push('<optgroup label="',t,'" ',y," >"),r=t)}if(l==s)p.push("<option ",I,_,i,">",x,"</option>");else{var b=m[l];p.push("<option ",I,_,i,' value="',x,'">',b,"</option>")}}else if("object"==typeof m)for(var g in m)p.push('<option value="',g,'">',m[g],"</option>");else p.push("<option>",m,"</option>")}c&&p.push("</optgroup>")}return p.push("</select>"),p.join("")},e.fn.pqval=function(e){if(e){if(e.incr){var t=this.data("pq_value");return this.prop("indeterminate",!1),t?(t=!1,this.prop("checked",!1)):t===!1?(t=null,this.prop("indeterminate",!0),this.prop("checked",!1)):(t=!0,this.prop("checked",!0)),this.data("pq_value",t),t}var t=e.val;return this.data("pq_value",t),this.prop("indeterminate",!1),null==t?(this.prop("indeterminate",!0),this.prop("checked",!1)):t?this.prop("checked",!0):this.prop("checked",!1),this}return this.data("pq_value")},r.xmlToArray=function(t,r){var i=r.itemParent,o=r.itemNames,n=[],a=e(t).find(i);return a.each(function(t,r){var i=e(r),a=[];e(o).each(function(e,t){a.push(i.find(t).text().replace(/\r|\n|\t/g,""))}),n.push(a)}),n},r.xmlToJson=function(t,r){var i=r.itemParent,o=r.itemNames,n=[],a=e(t).find(i);return a.each(function(t,r){for(var i=e(r),a={},l=0,s=o.length;s>l;l++){var d=o[l];a[d]=i.find(d).text().replace(/\r|\n|\t/g,"")}n.push(a)}),n},r.tableToArray=function(t){var r=e(t),i=[],o=[],n=r.children("tbody").children("tr"),a=n.length?e(n[0]):e(),l=n.length>1?e(n[1]):e();return a.children("th,td").each(function(t,r){var o=e(r),n=o.html(),a=o.width(),s="left",d="string";if(l.length)var c=l.find("td:eq("+t+")"),h=c.attr("align"),s=h?h:s;var u={title:n,width:a,dataType:d,align:s,dataIndx:t};i.push(u)}),n.each(function(t,r){if(0!=t){var i=e(r),n=[];i.children("td").each(function(t,r){n.push(e.trim(e(r).html()))}),o.push(n)}}),{data:o,colModel:i}};var o={};r.formatCurrency=function(e,r){var i=parseFloat(e);if(!isNaN(i)){var o=0>i,n=t(r,o),a=n.symbol,l=n.symbolEnd,s=n.thousand,d=n.thouSep,c=n.decSep,h=n.decimal;i=i.toFixed(h);for(var u=i.length,f=h+c.length,p=i.substring(0,u-f),g=i.substring(u-f+c.length,u),v=p.match(/\d/g).reverse(),w=[],m=0;m<v.length;m++)m>0&&m%s==0&&w.push(d),w.push(v[m]);return w=w.reverse(),p=w.join(""),(o?"-":"")+a+p+c+g+l}},pq.formatNumber=r.formatCurrency,pq.validation={is:function(e,t){return"string"!=e&&e?(e=e.substring(0,1).toUpperCase()+e.substring(1,e.length),this["is"+e](t)):!0},isFloat:function(e){var t=parseFloat(e);return!isNaN(t)&&t==e},isInteger:function(e){var t=parseInt(e);return!isNaN(t)&&t==e},isDate:function(e){var t=Date.parse(e);return!isNaN(t)}};var n=[],a={},l=r.toLetter=function(e){var t=n[e];if(!t){e++;var r=e%26,i=e/26|0,o=r?String.fromCharCode(64+r):(--i,"Z");t=i?l(i-1)+o:o,e--,n[e]=t,a[t]=e}return t};r.generateData=function(e,t){for(var r=[],i=0;t>i;i++)r[i]=l(i);for(var o=[],i=0;e>i;i++)for(var n=o[i]=[],a=0;t>a;a++)n[a]=r[a]+(i+1);return o}}(jQuery),function(e){function t(t,r,i){return e(t?"<span tabindex='0' rel='tooltip' data-placement='top' title='"+r+"' class='btn btn-xs "+i+"'></span>":"<span class='pq-ui-button ui-widget-header' tabindex='0' rel='tooltip' title='"+r+"'><span class='ui-icon ui-icon-"+i+"'></span></span>")}function r(t,r){t.bind("click keydown",function(t){return"keydown"!=t.type||t.keyCode==e.ui.keyCode.ENTER?r.call(this,t):void 0})}function i(e,t,r){t[r?"addClass":"removeClass"]("disabled").css("pointer-events",r?"none":"").attr("tabindex",r?"":"0")}var o={};o.options={bootstrap:{on:!1,pager:"",nextIcon:"glyphicon glyphicon-forward",prevIcon:"glyphicon glyphicon-backward",firstIcon:"glyphicon glyphicon-step-backward",lastIcon:"glyphicon glyphicon-step-forward",refreshIcon:"glyphicon glyphicon-refresh"},curPage:0,totalPages:0,totalRecords:0,msg:"",rPPOptions:[10,20,30,40,50,100],rPP:20},o._regional={strDisplay:"Displaying {0} to {1} of {2} items.",strFirstPage:"First Page",strLastPage:"Last Page",strNextPage:"Next Page",strPage:"Page {0} of {1}",strPrevPage:"Previous Page",strRefresh:"Refresh",strRpp:"Records per page:{0}"},e.extend(o.options,o._regional),o._create=function(){var i=this,o=this.options,n=this.element,a=o.bootstrap,l=a.on;this.listeners={},n.addClass("pq-pager "+(l?a.pager:"")),this.first=t(l,o.strFirstPage,l?a.firstIcon:"seek-first").appendTo(n),r(this.first,function(e){o.curPage>1&&i._onChange(e,1)}),this.prev=t(l,o.strPrevPage,l?a.prevIcon:"seek-prev").appendTo(n),r(this.prev,function(e){if(o.curPage>1){var t=o.curPage-1;i._onChange(e,t)}}),e("<span class='pq-separator'></span>").appendTo(n),this.pageHolder=e("<span class='pq-page-placeholder'></span>").appendTo(n),e("<span class='pq-separator'></span>").appendTo(n),this.next=t(l,o.strNextPage,l?a.nextIcon:"seek-next").appendTo(n),r(this.next,function(e){if(o.curPage<o.totalPages){var t=o.curPage+1;i._onChange(e,t)}}),this.last=t(l,o.strLastPage,l?a.lastIcon:"seek-end").appendTo(n),r(this.last,function(e){if(o.curPage!==o.totalPages){var t=o.totalPages;i._onChange(e,t)}}),e("<span class='pq-separator'></span>").appendTo(n),this.rPPHolder=e("<span class='pq-page-placeholder'></span>").appendTo(n),this.$refresh=t(l,o.strRefresh,l?a.refreshIcon:"refresh").appendTo(n),r(this.$refresh,function(e){return i._trigger("beforeRefresh",e)===!1?!1:void i._trigger("refresh",e)}),e("<span class='pq-separator'></span>").appendTo(n),this.$msg=e("<span class='pq-pager-msg'></span>").appendTo(n),this._refresh()},o._destroy=function(){this.element.empty().removeClass("pq-pager").enableSelection()},o._setOption=function(e,t){"curPage"!=e&&"totalPages"!=e||(t=1*t),this._super(e,t)},o._setOptions=function(t){var r,i=!1,o=this.options;for(r in t){var n=t[r],a=typeof n;"string"==a||"number"==a?n!=o[r]&&(this._setOption(r,n),i=!0):"function"==typeof n.splice||e.isPlainObject(n)?JSON.stringify(n)!=JSON.stringify(o[r])&&(this._setOption(r,n),i=!0):n!=o[r]&&(this._setOption(r,n),i=!0)}return i&&this._refresh(),this},e.widget("paramquery.pqPager",o),pq.pager=function(t,r){var i=e(t).pqPager(r),o=i.data("paramqueryPqPager")||i.data("paramquery-pqPager");return o};var n=e.paramquery;n.pqPager.regional={},n.pqPager.regional.en=o._regional,o=n.pqPager.prototype,n.pqPager.defaults=o.options,o._refreshPage=function(){var t=this;this.pageHolder.empty();for(var r=this.options,i=r.bootstrap,o=r.strPage,n=o.split(/\s/),a=[],l=0,s=n.length;s>l;l++){var d=n[l];"{0}"==d?a.push("<input type='text' tabindex='0' class='pq-pager-input ",i.on?"":"ui-corner-all","' />"):"{1}"==d?a.push("<span class='total'></span>"):a.push("<span>",d,"</span>")}var c=a.join(""),h=e(c).appendTo(this.pageHolder);this.page=h.filter("input").bind("keydown",function(t){t.keyCode===e.ui.keyCode.ENTER&&e(this).trigger("change")}).bind("change",function(i){var o=e(this),n=o.val();return isNaN(n)||1>n?(o.val(r.curPage),!1):(n=parseInt(n),n!==r.curPage?n>r.totalPages?(o.val(r.curPage),!1):t._onChange(i,n)===!1?(o.val(r.curPage),!1):void 0:void 0)}),this.$total=h.filter("span.total")},o._onChange=function(e,t){return this._trigger("beforeChange",e,{curPage:t})===!1?!1:this._trigger("change",e,{curPage:t})===!1?!1:void this.option({curPage:t})},o._refresh=function(){this._refreshPage();var t=(this.$rPP,this),r=this.options,o=r.bootstrap;if(this.rPPHolder.empty(),r.strRpp){var n=r.rPPOptions,a=r.strRpp;if(-1!=a.indexOf("{0}")){for(var l=["<select class='",o.on?"":"ui-corner-all","'>"],s=0,d=n.length;d>s;s++){var c=n[s];l.push('<option value="',c,'">',c,"</option>")}l.push("</select>");var h=l.join("");a=a.replace("{0}","</span>"+h),a="<span>"+a+"<span class='pq-separator'></span>"}else a="<span>"+a+"</span><span class='pq-separator'></span>";this.$rPP=e(a).appendTo(this.rPPHolder).filter("select").val(r.rPP).change(function(r){var i=e(this),o=i.val();return t._trigger("beforeChange",r,{rPP:o})===!1?(i.val(t.options.rPP),!1):void(t._trigger("change",r,{rPP:o})!==!1&&(t.options.rPP=o))})}var u=r.bootstrap.on,f=r.curPage>=r.totalPages;i(u,this.next,f),i(u,this.last,f);var f=r.curPage<=1;if(i(u,this.first,f),i(u,this.prev,f),this.page.val(r.curPage),this.$total.text(r.totalPages),this.options.totalRecords>0){var p=r.rPP,g=r.curPage,v=r.totalRecords,w=(g-1)*p,m=g*p;m>v&&(m=v);var x=r.strDisplay;x=x.replace("{0}",w+1),x=x.replace("{1}",m),x=x.replace("{2}",v),this.$msg.html(x)}else this.$msg.html("")},o.getInstance=function(){return{pager:this}},o._trigger=n._trigger,o.on=n.on,o.one=n.one,o.off=n.off}(jQuery),function(e){function t(e,t){return e?"<div class='"+t+"'></div>":"<div class='ui-icon ui-icon-"+t+"'></div>"}var r=e.paramquery,i={};i.options={length:200,num_eles:3,trigger:!1,cur_pos:0,ratio:0,timeout:350,pace:"optimum",direction:"vertical",bootstrap:{on:!1,slider:"btn btn-default",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down",left:"glyphicon glyphicon-chevron-left",right:"glyphicon glyphicon-chevron-right"},theme:!1},i._destroy=function(){e(document).off("."+this.eventNamespace),this.element.removeClass("pq-sb pq-sb-vert pq-sb-vert-t pq-sb-vert-wt").enableSelection().removeClass("pq-sb-horiz pq-sb-horiz-t pq-sb-horiz-wt").unbind("click.pq-scrollbar").empty(),this.element.removeData()},i._create=function(){this.listeners={},this._createLayout()},i._setOption=function(e,t){var r=this.options;"disabled"==e?(this._super(e,t),1==t?this.$slider.draggable("disable"):this.$slider.draggable("enable")):"theme"==e?(r[e]=t,this._createLayout()):"ratio"==e?t>=0&&1>=t&&(r[e]=t):r[e]=t},i._setOptions=function(){this._super.apply(this,arguments),this.refresh()},e.widget("paramquery.pqScrollBar",i),pq.scrollbar=function(t,r){var i=e(t).pqScrollBar(r),o=i.data("paramqueryPqScrollBar")||i.data("paramquery-pqScrollBar");return o};var i=r.pqScrollBar.prototype;r.pqScrollBar.defaults=i.options,i._createLayout=function(){var r=this,i=this.options,o=i.bootstrap,n=o.on,a=i.direction,l=this.eventNamespace,s=i.theme,d=this.element.empty();"vertical"==a?(d.removeClass("pq-sb-vert-t pq-sb-vert-wt").addClass("pq-sb pq-sb-vert"),s?(d.addClass("pq-sb-vert-t"),d[0].innerHTML=["<div class='top-btn pq-sb-btn ",n?"":"ui-state-default ui-corner-top","'>",t(n,n?o.up:"triangle-1-n"),"</div>","<div class='pq-sb-slider ",n?o.slider:"ui-corner-all ui-state-default","'>","</div>","<div class='bottom-btn pq-sb-btn ",n?"":"ui-state-default ui-corner-bottom","'>",t(n,n?o.down:"triangle-1-s"),"</div>"].join("")):(d.addClass("pq-sb-vert-wt"),d[0].innerHTML=["<div class='top-btn pq-sb-btn'></div>","<div class='pq-sb-slider'>","<div class='vert-slider-top'></div>","<div class='vert-slider-bg'></div>","<div class='vert-slider-center'></div>","<div class='vert-slider-bg'></div>","<div class='vert-slider-bottom'></div>","</div>","<div class='bottom-btn pq-sb-btn'></div>"].join(""))):(d.removeClass("pq-sb-horiz-t pq-sb-horiz-wt").addClass("pq-sb pq-sb-horiz"),s?(d.addClass("pq-sb-horiz-t"),d[0].innerHTML=["<div class='left-btn pq-sb-btn ",n?"":"ui-state-default ui-corner-left","'>",t(n,n?o.left:"triangle-1-w"),"</div>","<div class='pq-sb-slider pq-sb-slider-h ",n?o.slider:"ui-state-default ui-corner-all","'>","</div>","<div class='right-btn pq-sb-btn ",n?"":"ui-state-default ui-corner-right","'>",t(n,n?o.right:"triangle-1-e"),"</div>"].join("")):(d.addClass("pq-sb-horiz-wt"),d.width(this.width),d[0].innerHTML=["<div class='left-btn pq-sb-btn'></div>","<div class='pq-sb-slider pq-sb-slider-h'>","<span class='horiz-slider-left'></span>","<span class='horiz-slider-bg'></span>","<span class='horiz-slider-center'></span>","<span class='horiz-slider-bg'></span>","<span class='horiz-slider-right'></span>","</div>","<div class='right-btn pq-sb-btn'></div>"].join(""))),d.disableSelection().unbind(".pq-scrollbar").on("mousedown.pq-scrollbar",function(t){if(!i.disabled&&!r.$slider.is(":hidden"))if(e(document).off("."+l).on("mouseup."+l,function(e){r._mouseup(e)}),"vertical"==a){var o=t.pageY,n=r.element.offset().top,s=n+i.length,d=r.$slider,c=d.offset().top,h=d.height(),u=c+h;c>o&&o>n+17?r._setTimerPageLeft(o,h,t,0):o>u&&s-17>o&&r._setTimerPageRight(o,h,t,0)}else{var f=t.pageX,n=r.element.offset().left,s=n+i.length,c=r.$slider.offset().left,u=c+r.$slider.width();c>f&&f>n+17?(r.$slider.css("left",f-r.element.offset().left),r._updateCurPosAndTrigger(t)):f>u&&s-17>f&&(r.$slider.css("left",f-r.element.offset().left-r.$slider.width()),r._updateCurPosAndTrigger(t))}});var c=this.$slider=e("div.pq-sb-slider",this.element);c.attr("tabindex","0"),this._bindSliderEvents(c),this.$top_btn=e("div.top-btn,div.left-btn",this.element).click(function(e){return r.options.disabled?void 0:(r.decr_cur_pos(e),!1)}).mousedown(function(e){return r.options.disabled?void 0:(r.mousedownTimeout=setTimeout(function(){r.mousedownInterval=setInterval(function(){r.decr_cur_pos(e)},0)},r.options.timeout),!1)}).bind("mouseup mouseout",function(e){r._mouseup(e)}),this.$bottom_btn=e("div.bottom-btn,div.right-btn",this.element).click(function(e){return r.options.disabled?void 0:(r.incr_cur_pos(e),!1)}).mousedown(function(e){return r.options.disabled?void 0:(r.mousedownTimeout=setTimeout(function(){r.mousedownInterval=setInterval(function(){r.incr_cur_pos(e)},0)},r.options.timeout),!1)}).bind("mouseup mouseout",function(e){r._mouseup(e)}),this.refresh()};var o=0;i._setTimerPageLeft=function(e,t,r,i){var n=this,a=n.options;this.mousedownTimeout=window.setTimeout(function(){if(e>=n.$slider.offset().top)n._mouseup();else{n._pageLeft(r);var i=o?0:a.timeout;o++,n._setTimerPageLeft(e,t,r,i)}},i)},i._setTimerPageRight=function(e,t,r,i){var n=this;this.mousedownTimeout=window.setTimeout(function(){if(e<=n.$slider.offset().top+t)n._mouseup();else{n._pageRight(r);var i=o?0:n.options.timeout;o++,n._setTimerPageRight(e,t,r,i)}},i)},i._bindSliderEvents=function(t){var r=this,i=this.options.direction,o="x";"vertical"==i&&(o="y"),t.draggable({axis:o,helper:function(e,t){return r._setDragLimits(),this},start:function(e){r.topWhileDrag=null,r.dragging=!0},drag:function(e){r.dragging=!0;var t=r.options.pace;"optimum"==t?r._setNormalPace(e):"fast"==t&&r._updateCurPosAndTrigger(e)},stop:function(e){"fast"!=r.options.pace&&r._updateCurPosAndTrigger(e),r.dragging=!1,r.refresh()}}).on("keydown.pq-scrollbar",function(t){var i=t.keyCode,o=r.options,n=o.cur_pos,a=o.ratio,l=o.num_eles,s=e.ui.keyCode;return null==r.keydownTimeout&&(r.keydownTimeout=window.setTimeout(function(){i==s.DOWN||i==s.RIGHT?r.incr_cur_pos(t):i==s.UP||i==s.LEFT?r.decr_cur_pos(t):i==s.HOME?o.steps?n>0&&(o.cur_pos=0,r.updateSliderPos(),r.scroll(t)):a>0&&(o.ratio=0,r.updateSliderPos(),r.drag(t)):i==s.END?o.steps?l>n&&(o.cur_pos=l,r.updateSliderPos(),r.scroll(t)):1>a&&(o.ratio=1,r.updateSliderPos(),r.drag(t)):"vertical"==o.direction&&(i==s.PAGE_DOWN?r._pageRight(t):i==s.PAGE_UP&&r._pageLeft(t)),r.keydownTimeout=null},0)),i==s.DOWN||i==s.RIGHT||i==s.UP||i==s.LEFT||i==s.PAGE_DOWN||i==s.PAGE_UP||i==s.HOME||i==s.END?(t.preventDefault(),!1):void 0})},i.decr_cur_pos=function(e){var t=this,r=t.options,i=r.steps;if(i)r.cur_pos>0&&(r.cur_pos--,t.updateSliderPos(),t.scroll(e));else if(r.ratio>0){var o=r.ratio-1/(r.num_eles-1);0>o&&(o=0),r.ratio=o,t.updateSliderPos(),t.drag(e)}},i.incr_cur_pos=function(e){var t=this,r=t.options,i=r.steps;if(i)r.cur_pos<r.num_eles-1&&r.cur_pos++,t.updateSliderPos(),t.scroll(e);else{if(r.ratio<1){var o=r.ratio+1/(r.num_eles-1);o>1&&(o=1),r.ratio=o}t.updateSliderPos(),t.drag(e)}},i._mouseup=function(e){if(!this.options.disabled){o=0;var t=this;window.clearTimeout(t.mousedownTimeout),t.mousedownTimeout=null,window.clearInterval(t.mousedownInterval),t.mousedownInterval=null}},i._setDragLimits=function(){var e=this.options;if("vertical"==e.direction){var t=this.element.offset().top+17,r=t+e.length-34-this.slider_length;this.$slider.draggable("option","containment",[0,t,0,r])}else t=this.element.offset().left+17,r=t+e.length-34-this.slider_length,this.$slider.draggable("option","containment",[t,0,r,0])},i._validateCurPos=function(){var e=this.options;e.cur_pos>=e.num_eles&&(e.cur_pos=e.num_eles-1),e.cur_pos<0&&(e.cur_pos=0)},i._updateSliderPosRatio=function(){var e=this,t=this.options,r=t.direction,i=t.ratio,o=e.$slider[0],n=t.length-34-this.slider_length;if(null==i)throw"updateSliderPosRatio ratio N/A";var a=i*n+17;"vertical"==r?o.style.top=a+"px":o.style.left=a+"px"},i._updateSliderPosCurPos=function(){var e=this.options,t=this.$slider[0],r=this.scroll_space*e.cur_pos/(e.num_eles-1);"vertical"==e.direction?t.style.top=17+r+"px":t.style.left=17+r+"px"},i.updateSliderPos=function(){var e=this.options;if(void 0===e.steps)throw"updateSliderPos. steps N/A";e.steps?this._updateSliderPosCurPos():this._updateSliderPosRatio()},i.scroll=function(e){var t=this.options;this._trigger("scroll",e,{cur_pos:t.cur_pos,num_eles:t.num_eles})},i.drag=function(e){var t=this,r=t.options;this._trigger("drag",e,{ratio:r.ratio})},i._pageRight=function(e){this._trigger("pageRight",e,null)},i._pageLeft=function(e){this._trigger("pageLeft",e,null)},i._setSliderBgLength=function(){var t=this.options,r=t.theme,i=this.$slider,o=t.length,n=40*t.num_eles+o,a=o-34,l=a*o/n,s=Math.round((l-14)/2);1>s&&(s=1);var d=14+2*s;if(this.scroll_space=t.length-34-d,d!==this.slider_length){this.slider_length=d;var c="vertical"===t.direction?{dim:"height",cls:".vert-slider-bg"}:{dim:"width",cls:".horiz-slider-bg"};r?i[c.dim](d-2):(e(c.cls,this.element)[c.dim](s),i[c.dim](d))}},i._updateCurPosAndTrigger=function(e,t){var r=this,i=this.options,o=i.direction,n=r.$slider;null==t&&(t=parseInt(n[0].style["vertical"===o?"top":"left"]));var a=i.length-34-this.slider_length,l=(t-17)/a;if(i.steps){var s=l*(i.num_eles-1);if(s=Math.round(s),i.cur_pos!=s){if(this.dragging){if(null!=this.topWhileDrag){if(this.topWhileDrag<t&&i.cur_pos>s)return;if(this.topWhileDrag>t&&i.cur_pos<s)return}this.topWhileDrag=t}r.options.cur_pos=s,this.scroll(e)}}else i.ratio=l,this.drag(e)},i._setNormalPace=function(e){this.timer&&(window.clearInterval(this.timer),this.timer=null);var t=this,r=this.options,i=r.direction;t.timer=window.setInterval(function(){var r=t.$slider,o=parseInt(r[0].style["vertical"===i?"top":"left"]);t.prev_top===o&&(t._updateCurPosAndTrigger(e,o),window.clearInterval(t.timer),t.timer=null),t.prev_top=o},20)},i.refresh=function(){var e=this.options,t=this.$slider[0],r=this.element;return e.num_eles<=1?void(r[0].style.display="none"):(r[0].style.display="",this._validateCurPos(),this.dragging||(r["vertical"===e.direction?"height":"width"](e.length),this._setSliderBgLength(),this.scroll_space<4||e.num_eles<=1?t.style.display="none":t.style.display=""),void this.updateSliderPos())},i._trigger=r._trigger,i.on=r.on,i.one=r.one,i.off=r.off}(jQuery),function(e){e.paramquery=e.paramquery||{},e.paramquery.onResize=function(t,r){var i=!1,o=e(t);if("static"===o.css("position")&&o.css("position","relative"),!i){var n=e('<iframe type="text/html" src="about:blank" class="pq-resize-iframe" style="display:block;width:100%;height:100%;position:absolute;top:0;left:0;z-index:-1;overflow: hidden; pointer-events: none;" />').appendTo(o);n[0].data="about:blank",n.css("opacity","0")}for(var a=0;a<o.length;a++)if(i)e(o[a]).on("resize",function(e){r()});else{var l=n[a],s=e(l.contentWindow);s.on("resize",function(e){r()})}}}(jQuery),function(e){function t(e){return"<span class='btn btn-xs glyphicon glyphicon-"+e+"' ></span>"}function r(e){return"<span class='ui-widget-header pq-ui-button'><span class='ui-icon ui-icon-"+e+"'></span></span>"}var i=function(){};i.prototype.belongs=function(e){return e.target==this.that.element[0]?!0:void 0};var o=e.paramquery;o.cClass=i;var n=function(e){this.that=e;var t=this.options=e.options,r=this;null!=t.postRenderInterval&&e.on("refresh",function(){r.prColDef.length&&r.postRenderAll()}).on("refreshRow",function(e,t){r.prColDef.length&&r.postRenderRow(t)}).on("refreshCell",function(e,t){t.column.postRender&&r.postRenderRow(t)}).on("refreshColumn",function(e,t){t.column.postRender&&r.setTimerPostRender(0,t.colIndx,t.column)}),t.mergeModel.flex||e.on("refresh refreshCell refreshRow refreshColumn",r.onRefreshMerge(e))};o.cGenerateView=n;var a=n.prototype=new i;a.onRefreshMerge=function(t){return function(){for(var r,i,o,n,a,l,s,d=t.$cont.find(".pq-merge-cell-div"),c=d.length,h=[],u=[];c--;)r=d[c],i=r.parentNode,o||(o=2*parseInt(e(i).css("paddingTop")),n=2*parseInt(e(i).css("paddingLeft"))),a=Math.max(i.offsetHeight,28),l=a-o,s=i.offsetWidth-n,h[c]=l-1+"px",u[c]=s+"px";for(c=d.length;c--;)r=d[c],r.style.height=h[c],r.style.width=u[c]}},a.generateView=function(e){e=e||{};var t,r,i=this,n=this.that,a=n.options,l="flex"===a.width,s="flex"===a.height,d=a.cls,c=d.cont_inner,h=d.cont_inner_b,u=n.initH,f=n.finalH,p=n.pqpanes;if(e.$cont){var g=this._generateTables(null,null,e),v=e.$cont;v.empty(),p.v?v[0].innerHTML=["<div class='",c,"'>",g,"</div>","<div class='",c,"'>",g,"</div>"].join(""):v[0].innerHTML=["<div class='",c,"'>",g,"</div>"].join("");var w=v.children("div"),m=w.children("table");n.tables[0]={$tbl:m,$cont:v}}else{t=n.initV,r=n.finalV;var x=n.pdata,v=n.$cont;null!=a.editModel.indices&&n.blurEditor({force:!0});var _={pageData:x,initV:t,finalV:r,initH:u,finalH:f,source:e.source};n._trigger("beforeTableView",null,_);var g=i._generateTables(t,r,e);if(v.empty(),0===n.totalVisibleRows)v.append("<div class='"+c+" pq-grid-norows' >"+a.strNoRows+"</div>");else{var I=s||l?"style='position:relative;'":"";p.h&&p.v?v[0].innerHTML=["<div class='",c,"'>",g,"</div>","<div class='",c,"'>",g,"</div>","<div class='",c," ",h,"'>",g,"</div>","<div class='",c," ",h,"'>",g,"</div>"].join(""):p.v?v[0].innerHTML=["<div class='",c,"' ",I," >",g,"</div>","<div class='",c,"' >",g,"</div>"].join(""):p.h?v[0].innerHTML=["<div class='",c,"' style='position:static;' >",g,"</div>","<div class='",c," ",h,"' style='position:static;' >",g,"</div>"].join(""):v[0].innerHTML=["<div class='",c,"' ",I," >",g,"</div>"].join("")}n.$tbl=v.children("div").children("table"),a.scrollModel.flexContent&&n.$tbl[0]&&o.onResize(n.$tbl[0],function(){var e=n.iRefresh;e.ignoreTResize||e.softRefresh()}),this.setPaneEvents(),n._trigger("refresh",null,_)}this.setPanes()},a.postRenderRow=function(e){var t,r=this.that,i=this.prColDef,o=r.iMerge,n=e.rowIndx,a=r;null!=e.colIndx&&(i=[{colIndx:e.colIndx,column:e.column}]);for(var l=0,s=i.length;s>l;l++){var d=i[l],t=d.column.postRender,c=d.colIndx;o.ismergedCell(n,c)?o.isRootCell(n,c,"a")&&(e=o.getRootCell(n,c),t.call(a,e)):(e=r.normalize({rowIndx:n,colIndx:c}),t.call(a,e))}},a.setTimerPostRender=function(e,t,r){var i=this.that,o=this,n=i.pdata,a=function(e){return-1==i.options.postRenderInterval?e():setTimeout(e,0)};n&&n.length&&(o.postRenderTimeoutID=a(function(){var a=i.initV,l=i.options.freezeRows;a>e&&e>=l&&(e=a);var s=n[e];s.pq_hidden||o.postRenderRow({column:r,colIndx:t,rowIndx:e+i.rowIndxOffset}),e++,e<=i.finalV&&o.setTimerPostRender(e)}))},a.postRenderAll=function(){var e=this.that,t=this,r=e.pdata,i=e.options.postRenderInterval,o=function(e){return-1==i?e():setTimeout(e,i)};r&&r.length&&(clearTimeout(t.postRenderTimeoutID),t.postRenderTimeoutID=o(function(){t.setTimerPostRender(0)}))},a.scrollView=function(){var e=this.that,t=this.options,r=t.virtualX,i=t.virtualY;r||e.hscroll.drag(),i||e.vscroll.drag()},a.setPaneEvents=function(){var t=this.that,r=t.$cont,i=t.pqpanes,o=r.children("div"),n=t.iMouseSelection,a=t.$tbl;if(a&&a.length)if(i.h&&i.v){var l=e(o[0]),s=e(o[1]),d=e(o[2]),c=e(o[3]);l.on("scroll",function(e){this.scrollTop=0,this.scrollLeft=0}),s.on("scroll",function(e){this.scrollTop=0,this.scrollLeft=n.getScrollLeft(!0)}),d.on("scroll",function(e){this.scrollTop=n.getScrollTop(!0),this.scrollLeft=0}),c.on("scroll",function(e){this.scrollTop=n.getScrollTop(!0),this.scrollLeft=n.getScrollLeft(!0)})}else if(i.v){var h=e(o[0]),u=e(o[1]);h.on("scroll",function(e){this.scrollTop=n.getScrollTop(!0),this.scrollLeft=0}),u.on("scroll",function(e){this.scrollTop=n.getScrollTop(!0),this.scrollLeft=n.getScrollLeft(!0)})}else if(i.h){var f=e(o[0]),p=e(o[1]);f.on("scroll",function(e){this.scrollTop=0,this.scrollLeft=n.getScrollLeft(!0)}),p.on("scroll",function(e){this.scrollTop=n.getScrollTop(!0),this.scrollLeft=n.getScrollLeft(!0)})}else o.on("scroll",function(e){this.scrollTop=n.getScrollTop(!0),this.scrollLeft=n.getScrollLeft(!0)})},a.setPanes=function(){var t,r=this.that,i=r.$cont,o=r.pqpanes,n=i.children("div"),a=r.iRefresh,l=r.$tbl,s=r.options,d=1*s.freezeCols,c=(r.initH,1),h=r.calcWidthCols(-1,d)+c,u="flex"===s.width,f=u&&!s.maxWidth?"":a.getEContWd();if(r.tables.length){var p=r.tables[0].$tbl,g=r.tables[0].$cont,v=p.parent("div");o.v?(e(v[0]).css({width:h}),e(v[1]).css({left:h,width:f-h}),e(p[1]).css({left:-1*h})):e(v[0]).css({width:f}),g.height(p[0].scrollHeight-1),a.setContHeight()}if(l&&l.length){var w="flex"===s.height,m=w&&!s.maxHeight?"":a.getEContHt();if(o.h&&o.v){var x=e(n[0]),_=e(n[1]),I=e(l[1]),y=e(n[2]),b=e(l[2]),C=e(n[3]),q=e(l[3]),t=r.calcHeightFrozenRows(),M=t;x.css({width:h,height:M}),_.css({left:h,width:f-h,height:M}),I.css({left:-1*h}),y.css({width:h,top:M,height:m-M}),b.css({marginTop:-(M+1)}),C.css({left:h,width:f-h,top:M,height:m-M}),q.css({marginTop:-(M+1),left:-1*h})}else if(o.v){var D=e(n[0]),R=e(n[1]),P=e(l[1]);D.css({width:h,height:m}),R.css({left:h,width:f-h,height:m}),P.css({left:-1*h})}else if(o.h){var T=e(n[0]),k=e(n[1]),S=e(l[1]),t=r.calcHeightFrozenRows(),M=t;T.css({height:M,width:f}),k.css({width:f,top:M,height:m-M}),S.css({marginTop:-(M+1)})}else n.css({width:f,height:m})}s.showHeader&&(o.vH?(r.$header_left.css({width:h}),r.$header_right.css({left:h,width:f-h}),r.$header_right_inner.css({left:-h})):r.$header_left.css({width:f}))},a.createColDefs=function(){for(var e=this.that,t=e.colModel,r=e.initH,i=e.finalH,o=e.options,n=o.freezeCols,a=[],l=[],s=0;i>=s;s++){if(r>s&&s>=n&&(s=r,s>i))throw"initH>finalH";var d=t[s];d.hidden||(a.push({column:d,colIndx:s}),d.postRender&&"function"==typeof d.postRender&&l.push({column:d,colIndx:s}))}this.colDef=a,this.prColDef=l},a._generateTables=function(e,t,r){r=r||{};var i,o=this.that,n=o.options,a=n.bootstrap,l=n.numberCell,s=o.iRefresh,d=1*n.freezeRows,c=0,h=r.other,u=h?r.data.length-1:t;if(h?i=r.data:(i=o.pdata,
this.setFrozenRip(i,d)),h||null!=e&&null!=u){this.vrows=s.vrows,this.vfrows=s.vfrows;var f=["pq-grid-table"];a.on&&f.push(a.tbody),n.columnBorders&&f.push("pq-td-border-right"),n.rowBorders&&f.push("pq-td-border-top"),f.push(n.wrap?"pq-wrap":"pq-no-wrap");var p=["<table class='"+f.join(" ")+"' >"];if(p.push("<tr class='pq-row-hidden'>"),l.show){var g=l.width;p.push("<td style='width:"+g+"px;' ></td>")}for(var v=this.colDef,w=0,m=v.length;m>w;w++){var x=v[w],_=x.colIndx,I=x.column,g=I.outerWidth;p.push("<td style='width:",g,"px;' pq-col-indx='",_,"'></td>")}p.push("</tr>");for(var c=0;u>=c;c++){e>c&&c>=d&&(c=e);var y=i[c],b=c,C=y?y.pq_hidden:!1;if(!C){var q=y.pq_detail&&y.pq_detail.show;this._generateRow(y,b,p,h,q),q&&this._generateDetailRow(y,b,p)}}return p.push("</table>"),p.join("")}},a.appendRow=function(e){var t=this.that,r=t.pdata,i=t.colModel,o=t.finalV;if(o+e>r.length&&(e=r.length-o),e){if(e>1)throw"noRows > 1";t._trigger("beforeTableView",null,{pageData:r,initV:o,finalV:o,initH:t.initH,finalH:t.finalH,colModel:i}),t.refreshRow({rowIndxPage:o,refresh:!1})}return e},a.prependRow=function(e){var t=this.that,r=t.options.freezeRows,i=t.calcVisibleRows(t.pdata,0,r),o=t.pdata,n=t.initV,a=t.colModel;if(t._mergeCells){if(i)for(var l=0;r>l;l++)t.refreshRow({rowIndxPage:l,refresh:!1});t.refreshRow({rowIndxPage:n+1,refresh:!1})}return t._trigger("beforeTableView",null,{pageData:o,initV:n,finalV:n,initH:t.initH,finalH:t.finalH,colModel:a}),t.refreshRow({rowIndxPage:n,refresh:!1}),e},a.removeTopRow=function(t){for(var r=this.that,i=r.options.freezeRows,o=r.calcVisibleRows(r.pdata,0,i),n=r.$tbl,a=e([]),l=0;l<n.length;l++){var s=e(n[l]),d=s.children("tbody"),c=d.children("tr:gt(0)").slice(o,t+o);a=a.add(c)}if(a.remove(),r._mergeCells){if(o)for(var l=0;i>l;l++)r.refreshRow({rowIndxPage:l,refresh:!1});r.refreshRow({rowIndxPage:r.initV,refresh:!1})}},a.removeBottomRow=function(t){var r=this.that,i=r.$tbl;if(t)for(var o=0;o<i.length;o++){var n=e(i[o]),a=n.children("tbody"),l=a.children("tr:gt(0)").slice(-t);l.remove()}},a.format=function(){var t=e.datepicker,r=pq.formatNumber;return function(e,i,o){if("date"==o){if(isNaN(Date.parse(e)))return;return t.formatDate(i,new Date(e))}return r(e,i)}}(),a.renderCell=function(e){var t=this.that,r=[],i=[],o=e.Export,n=!1,a=this.options,l=["pq-grid-cell"];if(!e.other&&!o&&t._mergeCells){if(e=t.iMerge.renderCell(e),null==e)return"";e.rowspan&&(r.push("rowspan='"+e.rowspan+"'","colspan='"+e.colspan+"'"),a.mergeModel.flex||(n=!0,l.push("pq-merge-cell"))),e.style&&i.push(e.style),e.cls&&l.push(e.cls)}var s=e.rowData,d=e.column,c=e.colIndx,h=d.dataIndx,f=a.freezeCols,p=a.columnBorders;if(s){if(!o){r.push("pq-col-indx='"+c+"'"),"right"==d.align?l.push("pq-align-right"):"center"==d.align&&l.push("pq-align-center"),c==f-1&&p&&l.push("pq-last-frozen-col");var g=d.cls;g&&l.push(g);var v=t.iSelection.dirty?null:s.pq_cellselect;v&&v[h]&&l.push(t.iCells.hclass)}var w,m=s[h],x=d.format,_=x?this.format(m,x,d.dataType):m;if(e.dataIndx=h,e.cellData=m,e.formatVal=_,d.render&&(w=d.render.call(t,e),w&&"string"!=typeof w)){var I=w.attr,y=w.cls,b=w.style;I&&r.push(I),y&&l.push(y),b&&i.push(b),w=w.text}if(null==w&&d._render&&(w=d._render.call(t,e)),w&&"string"!=typeof w){var I=w.attr,y=w.cls,b=w.style;I&&r.push(I),y&&l.push(y),b&&i.push(b),w=w.text}if(null==w&&(w=_),o)return w;""!==w&&void 0!=w||(w=" ");var C=s.pq_cellcls;if(C){var q=C[h];q&&l.push(q)}var M=s.pq_cellattr;if(M){var D=M[h];if(D){var R=u(D);for(var P in R){var T=R[P];"style"==P?i.push(T):r.push(P+'="'+T+'"')}}}i=i.length?" style='"+i.join("")+"' ":"";var k=["<td class='",l.join(" "),"' ",r.join(" "),i," >",n?"<div class='pq-merge-cell-div'><div><div class='pq-merge-inner'>":"",w,n?"</div></div></div>":"","</td>"].join("");return k}},a.setFrozenRip=function(e,t){if(e){for(var r;t--&&(r=e[t])&&r.pq_hidden;);this.frozenRip=t}},a.refreshRow=function(e,t){var r=this.that,i=r.pdata[e],o=i.pq_detail&&i.pq_detail.show;this._generateRow(i,e,t,null,o)},a._generateRow=function(e,t,r,i,o){var n=["pq-grid-row"];this.frozenRip===t&&n.push("pq-last-frozen-row"),o&&n.push("pq-detail-master");var a=this.that,l=this.options,s=l.rowInit,d=l.numberCell,c="",h="",f=a.rowIndxOffset,p=t+f;if(s){var g=s.call(a,{rowData:e,rowIndxPage:t,rowIndx:p});g&&(g.cls&&n.push(g.cls),c+=g.attr?" "+g.attr:"",h+=g.style?g.style:"")}!i&&l.stripeRows&&this.isOdd(t,l.freezeRows)&&n.push("pq-grid-oddRow"),e.pq_rowselect&&n.push(a.iRows.hclass);var v=e.pq_rowcls;null!=v&&n.push(v);var w=e.pq_rowattr;if(w){var m=u(w);for(var x in m){var _=m[x];c+=" "+x+'="'+_+'"'}}h=h?"style='"+h+"'":"",r.push("<tr pq-row-indx='",t,"' class='",n.join(" "),"' ",c," ",h," >"),d.show&&r.push(["<td pq-col-indx='-1' class='pq-grid-number-cell'>",i?" ":p+1,"</td>"].join(""));for(var I={rowIndx:t+f,rowIndxPage:t,other:i,rowData:e},y=this.colDef,b=0,C=y.length;C>b;b++){var q=y[b],M=q.colIndx,D=q.column;I.column=D,I.colIndx=M,r.push(this.renderCell(I))}return r.push("</tr>"),r},a.isOdd=function(e,t){var r=pq.searchSeqArray(t>e?this.vfrows:this.vrows,e);return r/2==parseInt(r/2)},a._generateDetailRow=function(e,t,r){var i=["pq-grid-row pq-detail-child"],o=this.that,n=o.options,a=n.numberCell,l="pq-grid-cell";n.stripeRows&&this.isOdd(t,n.freezeRows)&&i.push("pq-grid-oddRow"),e.pq_rowselect&&i.push(o.iRows.hclass);var s=e.pq_rowcls;return null!=s&&i.push(s),r.push("<tr pq-row-indx='"+t+"' class='"+i.join(" ")+"' >"),a.show&&r.push(["<td class='pq-grid-number-cell'>"," </td>"].join("")),r.push("<td class='"+l+" pq-detail-child' colSpan='20'></td>"),r.push("</tr>"),r};var l={widgetEventPrefix:"pqgrid"};l._create=function(){var t=this,r=this.options,i=r.dataModel,a=r.bootstrap,l=a.on,s=r.roundCorners&&!l,d=r.ui,h=r.sortModel;if(e(document).triggerHandler("pqGrid:bootup",{instance:this}),this.BS_on=l,r.collapsible||(r.collapsible={on:!1,collapsed:!1}),r.flexHeight&&(r.height="flex"),r.flexWidth&&(r.width="flex"),i.sortIndx){h.on=r.sortable,h.type=i.sorting;var u=[],p=i.sortIndx,g=i.sortDir;if(e.isArray(p)){for(var v=0;v<p.length;v++){var w=g&&g[v]?g[v]:"up";u.push({dataIndx:p[v],dir:w})}h.single=!1}else{var w=g?g:"up";u.push({dataIndx:p,dir:w}),h.single=!0}h.sorter=u}r.virtualXHeader===!1&&(r.virtualXHeader=null),this.setEditorPosTimer(),this.iGenerateView=new n(this),this.iRefresh=new o.cRefresh(this),this.iKeyNav=new f(this),this.iIsValid=new c(this),this.tables=[],this.$tbl=null,this.iColModel=new o.cColModel(this),this.iSort=new o.cSort(this),this.iHeader=new o.cHeader(this),this._initTypeColumns();var m=this.element;m.on("scroll"+this.eventNamespace,function(){this.scrollLeft=0,this.scrollTop=0});var x=l?a.grid:d.grid,_=l?"":d.header_o,I=l?"":d.bottom,y=l?a.top:d.top;m.empty().addClass("pq-grid "+x+" "+(s?" ui-corner-all":"")).html(["<div class='pq-grid-top ",y," ",s?" ui-corner-top":"","'>","<div class='pq-grid-title",s?" ui-corner-top":"","'> </div>","</div>","<div class='pq-grid-center' >","<div class='pq-header-outer ",_,"'>","</div>","<div class='pq-grid-cont-outer' >","<div class='pq-grid-cont' tabindex='0'></div>","</div>","</div>","<div class='pq-grid-bottom ",I," ",s?" ui-corner-bottom":"","'>","<div class='pq-grid-footer'></div>","</div>"].join("")),this.$bottom=e("div.pq-grid-bottom",m),this._trigger("render",null,{dataModel:this.options.dataModel,colModel:this.colModel}),this.$top=e("div.pq-grid-top",m),r.showTop||this.$top.css("display","none"),this.$title=e("div.pq-grid-title",m),r.showTitle||this.$title.css("display","none");var b=this.$grid_center=e("div.pq-grid-center",m).on("scroll",function(){this.scrollTop=0});this.$header_o=e("div.pq-header-outer",this.$grid_center).on("scroll",function(){this.scrollTop=0,this.scrollLeft=0}),this.$footer=e("div.pq-grid-footer",m),this.$cont_o=e(".pq-grid-cont-outer",b);var C=this.$cont=e("div.pq-grid-cont",b);e(window).bind("resize"+t.eventNamespace+" orientationchange"+t.eventNamespace,function(e,r){t.onWindowResize(e,r)}),C.on("click",".pq-grid-cell,.pq-grid-number-cell",function(r){return e.data(r.target,t.widgetName+".preventClickEvent")!==!0&&e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onClickCell(r):void 0}),C.on("click","tr.pq-grid-row",function(r){return e.data(r.target,t.widgetName+".preventClickEvent")!==!0&&e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onClickRow(r):void 0}),C.on("contextmenu","td.pq-grid-cell",function(r){return e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onRightClickCell(r):void 0}),C.on("contextmenu","tr.pq-grid-row",function(r){return e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onRightClickRow(r):void 0}),C.on("dblclick","td.pq-grid-cell",function(r){return e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onDblClickCell(r):void 0}),C.on("dblclick","tr.pq-grid-row",function(r){return e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onDblClickRow(r):void 0}),C.on("blur",function(){t.onblur()}),C.on("focus",function(){t.onfocus()}),C.on("mousedown",function(r){if(1===r.which){var i=e(r.target);if(i.closest(".pq-grid")[0]==t.element[0]){var o,n=i.closest(".pq-grid-cell:not(.pq-detail-child)");if(n.length&&(r.currentTarget=n[0],o=t._onCellMouseDown(r),o===!1))return!1;if(r.isPropagationStopped())return;var a=i.closest(".pq-grid-row");if(a.length&&(r.currentTarget=a[0],o=t._onRowMouseDown(r),o===!1))return!1;if(r.isPropagationStopped())return;return t._onContMouseDown(r)}}}),C.on("mouseenter","td.pq-grid-cell",function(r){return e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onCellMouseEnter(r,e(this)):void 0}),C.on("mouseenter","tr.pq-grid-row",function(r){return e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onRowMouseEnter(r,e(this)):void 0}),C.on("mouseleave","td.pq-grid-cell",function(r){return e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onCellMouseLeave(r,e(this)):void 0}),C.on("mouseleave","tr.pq-grid-row",function(r){return e(r.target).closest(".pq-grid")[0]==t.element[0]?t._onRowMouseLeave(r,e(this)):void 0}),C.on("keyup",function(r){e(r.target).closest(".pq-grid")[0]==t.element[0]&&t._trigger("keyUp",r,null)}),b.bind("mousewheel DOMMouseScroll",function(e){return t._onMouseWheel(e)});this.$hvscroll=e("<div class='pq-hvscroll-square ui-widget-content'></div>").appendTo(b);var q=e("<div class='pq-vscroll'></div>").appendTo(b);this.prevVScroll=0;var M=r.scrollModel;void 0===M.lastColumn&&r.virtualX&&(M.lastColumn="auto"),this.vscroll=pq.scrollbar(q,{pace:M.pace,theme:M.theme,bootstrap:r.bootstrap,steps:r.virtualY&&!M.smooth,direction:"vertical",cur_pos:0,pageRight:function(){t.iKeyNav.pageDown()},pageLeft:function(){t.iKeyNav.pageUp()},drag:function(e,r){t.iMouseSelection.syncViewWithScrollBarVert(r.ratio)},scroll:function(e,r){t.iRefresh.refreshVscroll(r)}});var D=e("<div class='pq-hscroll'></div>").appendTo(b);"flex"===r.height&&D.css("position","relative"),this.hscroll=pq.scrollbar(D,{direction:"horizontal",pace:M.pace,bootstrap:r.bootstrap,theme:M.theme,steps:r.virtualX&&!M.smooth,cur_pos:0,drag:function(e,r){t.iMouseSelection.syncViewWithScrollBarHor(r.ratio)},scroll:function(){r.virtualX&&!r.scrollModel.smooth&&t.refresh()}}),r.selectionModel["native"]||this.disableSelection(),b.bind("keydown.pq-grid",function(r){e(r.target).closest(".pq-grid")[0]==t.element[0]&&t._onKeyPressDown(r)}),this._refreshTitle(),this.iRows=new o.cRows(this),this.iCells=new o.cCells(this),this.generateLoading(),this._initPager(),this._refreshResizable(),this._refreshDraggable(),this.iResizeColumns=new o.cResizeColumns(this),this._mouseInit()},l._mouseDown=function(t){var r=this;return e(t.target).closest(".pq-editor-focus").length?(this._blurEditMode=!0,void window.setTimeout(function(){r._blurEditMode=!1},0)):(this._saveDims(),this._mousePQUpDelegate=function(e){return r._mousePQUp(e)},e(document).bind("mouseup"+this.eventNamespace,this._mousePQUpDelegate),this._super(t))},l.destroy=function(){this._trigger("destroy"),this._super(),window.clearInterval(this._refreshEditorPosTimer),this.autoResizeTimeout&&clearTimeout(this.autoResizeTimeout);for(var t in this)delete this[t];this.options=void 0,e.fragments={}},l._setOption=function(e,t){var r=this.options,i=r.dataModel;if("height"===e){if("flex"===t){var o=this.vscroll;t&&o&&o.widget().hasClass("pq-sb-vert")&&(r.virtualY?o.option("cur_pos",0):o.option("ratio",0)),this.hscroll.widget().css("position","relative")}else"flex"===r.height&&this.hscroll.widget().css("position","");r[e]=t}else if("width"===e&&"flex"==t){r[e]=t;var n=this.hscroll;t&&n&&n.widget().hasClass("pq-sb-horiz")&&(r.virtualX?n.option("cur_pos",0):n.option("ratio",0))}else if("title"==e)r[e]=t,this._refreshTitle();else if("roundCorners"==e)r[e]=t,t?(this.element.addClass("ui-corner-all"),this.$top.addClass("ui-corner-top"),this.$bottom.addClass("ui-corner-bottom")):(this.element.removeClass("ui-corner-all"),this.$top.removeClass("ui-corner-top"),this.$bottom.removeClass("ui-corner-bottom"));else if("virtualX"==e)r[e]=t,this.hscroll.option("steps",t);else if("virtualY"==e)r[e]=t,this.vscroll.option("steps",t);else if("freezeCols"==e)t=parseInt(t),!isNaN(t)&&t>=0&&t<=this.colModel.length-2&&(r[e]=t);else if("freezeRows"==e)t=parseInt(t),!isNaN(t)&&t>=0&&(r[e]=t);else if("resizable"==e)r[e]=t,this._refreshResizable();else if("draggable"==e)r[e]=t,this._refreshDraggable();else if("scrollModel"==e)r[e]=t;else if("dataModel"==e)t.data!==i.data&&i.dataUF&&(i.dataUF.length=0),r[e]=t;else{if("groupModel"==e)throw"use groupOption() to set groupModel options.";if("pageModel"==e)r[e]=t;else if("selectionModel"===e)r[e]=t;else if("colModel"===e||"columnTemplate"==e)r[e]=t,this.iColModel.init();else if("disabled"===e)this._super(e,t),t===!0?this._disable():this._enable();else if("numberCell"===e)r[e]=t,this.iRefresh.decidePanes();else if("strLoading"===e)r[e]=t,this._refreshLoadingString();else if("showTop"===e)r[e]=t,this.$top.css("display",t?"":"none");else if("showTitle"===e)r[e]=t,this.$title.css("display",t?"":"none");else if("showToolbar"===e){r[e]=t;var a=this._toolbar.widget();a.css("display",t?"":"none")}else"toolbar"==e?r[e]=t:"collapsible"===e?(r[e]=t,this._createCollapse()):"showBottom"===e?(r[e]=t,this.$bottom.css("display",t?"":"none")):r[e]=t}return this},l.options={cancel:"input,textarea,button,select,option,.pq-no-capture,.ui-resizable-handle",trigger:!1,bootstrap:{on:!1,thead:"table table-striped table-condensed table-bordered",tbody:"table table-condensed",grid:"panel panel-default",top:"",btn:"btn btn-default",groupModel:{icon:["glyphicon-triangle-bottom","glyphicon-triangle-right"]},header_active:"active"},ui:{on:!0,grid:"ui-widget ui-widget-content",top:"ui-widget-header",bottom:"ui-widget-header",header_o:"ui-widget-header",header:"ui-state-default",header_active:"ui-state-active"},cls:{cont_inner:"pq-grid-cont-inner",cont_inner_b:"pq-grid-cont-inner-b"},distance:3,collapsible:{on:!0,toggle:!0,collapsed:!1,_collapsed:!1,refreshAfterExpand:!0,css:{zIndex:1e3}},colModel:null,columnBorders:!0,dataModel:{data:[],dataUF:[],cache:!1,dataType:"JSON",location:"local",sorting:"local",sortDir:"up",method:"GET"},direction:"",draggable:!1,editable:!0,editModel:{cellBorderWidth:0,pressToEdit:!0,clicksToEdit:2,filterKeys:!0,keyUpDown:!0,reInt:/^([\-]?[1-9][0-9]*|[\-]?[0-9]?)$/,reFloat:/^[\-]?[0-9]*\.?[0-9]*$/,onBlur:"validate",saveKey:e.ui.keyCode.ENTER,onSave:"nextFocus",onTab:"nextFocus",allowInvalid:!1,invalidClass:"pq-cell-red-tr pq-has-tooltip",warnClass:"pq-cell-blue-tr pq-has-tooltip",validate:!0},editor:{select:!1,type:"textbox"},summaryOptions:{number:"avg,sum,max,min",date:"count,max,min",string:"count"},summaryTitle:{avg:"Avg: {0}",count:"Count: {0}",max:"Max: {0}",min:"Min: {0}",sum:"Sum: {0}"},validation:{icon:"ui-icon-alert",cls:"ui-state-error",style:"padding:3px 10px;"},warning:{icon:"ui-icon-info",cls:"",style:"padding:3px 10px;"},freezeCols:0,freezeRows:0,freezeBorders:!0,calcDataIndxFromColIndx:!0,height:400,hoverMode:"null",_maxColWidth:"99%",_minColWidth:50,minWidth:100,numberCell:{width:30,title:"",resizable:!0,minWidth:30,maxWidth:100,show:!0},pageModel:{curPage:1,totalPages:0,rPP:10,rPPOptions:[10,20,50,100]},resizable:!1,roundCorners:!0,rowBorders:!0,rowHeight:25,scrollModel:{pace:"fast",smooth:!1,horizontal:!0,lastColumn:"auto",autoFit:!1,theme:!0},selectionModel:{type:"cell",onTab:"nextFocus",row:!0,mode:"block"},swipeModel:{on:!0,speed:20,ratio:.15,repeat:20},showBottom:!0,showHeader:!0,showTitle:!0,showToolbar:!0,showTop:!0,sortable:!0,sql:!1,stripeRows:!0,title:" ",treeModel:null,virtualX:!1,virtualY:!1,width:"auto",wrap:!0,hwrap:!0};var s={strAdd:"Add",strDelete:"Delete",strEdit:"Edit",strGroup_header:"Drag a column here to group by that column",strGroup_merge:"Merge cells",strGroup_fixCols:"Fix columns",strGroup_grandSummary:"Grand summary",strLoading:"Loading",strNoRows:"No rows to display."};e.extend(!0,l.options,s),e.widget("paramquery._pqGrid",e.ui.mouse,l);var d=o._pqGrid.prototype;d.refreshCM=function(e){e?this.option("colModel",e):this.iColModel.init()},d.readCell=function(e,t,r,i,o){var n=t.dataIndx;if(!r||r.isRootCell(i,o,"o")!==!1)return e[n]},d.saveCell=function(e,t,r){var i=t.dataIndx;e[i]=r},d._destroyResizable=function(){var e=this.element,t=e.data();(t.resizable||t.uiResizable||t["ui-resizable"])&&e.resizable("destroy")},d._disable=function(){null==this.$disable&&(this.$disable=e("<div class='pq-grid-disable'></div>").css("opacity",.2).appendTo(this.element))},d._enable=function(){this.$disable&&(this.element[0].removeChild(this.$disable[0]),this.$disable=null)},d._destroy=function(){this.loading&&this.xhr.abort(),this._destroyResizable(),this._destroyDraggable(),this._mouseDestroy(),this.element.off(this.eventNamespace),e(window).unbind(this.eventNamespace),e(document).unbind(this.eventNamespace),this.element.empty().css("height","").css("width","").removeClass("pq-grid ui-widget ui-widget-content ui-corner-all").removeData()},d.collapse=function(e){var t=this,r=this.element,i=this.options,o=i.collapsible,n=o.$collapse.children("span"),a=function(){r.css("overflow","hidden"),n.addClass("ui-icon-circle-triangle-s").removeClass("ui-icon-circle-triangle-n"),r.hasClass("ui-resizable")&&r.resizable("destroy"),t._toolbar&&t._toolbar.disable(),o.collapsed=!0,o._collapsed=!0,o.animating=!1,t._trigger("collapse")};return e=e?e:{},o._collapsed?!1:(o.htCapture=r.height(),void(e.animate===!1?(r.height(23),a()):(o.animating=!0,r.animate({height:"23px"},function(){a()}))))},d.expand=function(e){var t=this,r=this.element,i=this.options,o=i.collapsible,n=o.htCapture,a=o.$collapse.children("span"),l=function(){r.css("overflow",""),o._collapsed=!1,o.collapsed=!1,t._refreshResizable(),o.refreshAfterExpand&&t.refresh(),a.addClass("ui-icon-circle-triangle-n").removeClass("ui-icon-circle-triangle-s"),t._toolbar&&t._toolbar.enable(),o.animating=!1,t._trigger("expand")};return e=e?e:{},o._collapsed===!1?!1:void(e.animate===!1?(r.height(n),l()):(o.animating=!0,r.animate({height:n},function(){l()})))},d._createCollapse=function(){var i=this,o=this.$top,n=this.options,a=this.BS_on,l=n.collapsible;if(!l.$stripe){var s=e(["<div class='pq-slider-icon pq-no-capture' >","</div>"].join("")).appendTo(o);l.$stripe=s}l.on?l.$collapse||(l.$collapse=e(a?t("collapse-down"):r("circle-triangle-n")).appendTo(l.$stripe).click(function(e){l.collapsed?i.expand():i.collapse()})):l.$collapse&&(l.$collapse.remove(),delete l.$collapse),l.collapsed&&!l._collapsed?i.collapse({animate:!1}):!l.collapsed&&l._collapsed&&i.expand({animate:!1}),l.toggle?l.$toggle||(l.$toggle=e(a?t("fullscreen"):r("arrow-4-diag")).prependTo(l.$stripe).click(function(e){i.toggle()})):l.$toggle&&(l.$toggle.remove(),delete l.$toggle)},d.toggle=function(){var t,r=this.options,i=r.collapsible,o=this.element,n=this._maxim,t=n?"min":"max",a=e(document.body);if(this._trigger("beforeToggle",null,{state:t})===!1)return!1;if("min"==t){var l=n.eleObj,s=n.docObj;this.option({height:l.height,width:l.width,maxHeight:l.maxHeight,maxWidth:l.maxWidth}),o[0].style.cssText=l.cssText,a[0].style.cssText=s.cssText,e("html").css({overflow:"visible"}),window.scrollTo(s.scrollLeft,s.scrollTop),this._maxim=null}else{var l={height:r.height,width:r.width,cssText:o[0].style.cssText,maxHeight:r.maxHeight,maxWidth:r.maxWidth};this.option({height:"100%",width:"100%",maxHeight:null,maxWidth:null}),o.css(e.extend({position:"fixed",left:0,top:0,margin:0},i.css));var s={scrollLeft:e(window).scrollLeft(),scrollTop:e(window).scrollTop(),cssText:a[0].style.cssText};a.css({height:0,width:0,overflow:"hidden",position:"static"}),e("html").css({overflow:"hidden"}),window.scrollTo(0,0),this._maxim={eleObj:l,docObj:s}}this._trigger("toggle",null,{state:t}),this._refreshResizable(),this.refresh(),e(window).trigger("resize",{$grid:o,state:t})},d._mouseCapture=function(t){var r=this.options;if(r.virtualX&&r.virtualY&&!r.scrollModel.smooth)return!1;if(!t.target)return!1;if(e(t.target).closest(".pq-grid")[0]==this.element[0]){var i=r.swipeModel;return 0!=i.on&&("touch"!=i.on||e.support.touch)}return!1},d._saveDims=function(){var t=(this.$cont,this.$tbl),r=this.$tbl_header;if(t)for(var i=0;i<t.length;i++){var o=t[i],n=e(o);n.data("offsetHeight",Math.round(o.offsetHeight)-1),n.data("scrollWidth",Math.round(o.scrollWidth))}if(r)for(var i=0;i<r.length;i++){var o=r[i],a=e(o).parent();a.data("offsetHeight",Math.round(o.offsetHeight)),a.data("scrollWidth",Math.round(o.scrollWidth))}},d._mousePQUp=function(t){e(document).unbind("mouseup"+this.eventNamespace,this._mousePQUpDelegate),this._trigger("mousePQUp",t,null)},d._mouseStart=function(e){return this.blurEditor({force:!0}),!0},d._mouseDrag=function(e){return 0!=this._trigger("mouseDrag",e,null)},d._mouseStop=function(e){return 0!=this._trigger("mouseStop",e,null)},d.onWindowResize=function(t,r){var i,o,n=this,a=n.options,l=n.element,s=l.parent(),d="_lastParentHt",c="_lastParentWd",h="autoResizeTimeout";if(r){var u=r.$grid;if(u&&(u==l||0==l.closest(u).length))return}s.length&&(s[0]==document.body||"fixed"==l.css("position")?(i=window.innerHeight?window.innerHeight:e(window).height(),o=e(window).width()):(i=s.height(),o=s.width()),null!=n[d]&&i==n[d]&&o==n[c]||(n[d]=i,n[c]=o,e.support.touch&&a.editModel.indices&&e(document.activeElement).is(".pq-editor-focus")||(n[h]&&clearTimeout(n[h]),n[h]=window.setTimeout(function(){n._refreshAfterResize(),delete n[h]},a.autoSizeInterval||0))))},d._onMouseWheel=function(e){this._saveDims();var t=this.options,r=this,i=0,o=!1,e=e.originalEvent,n=e.wheelDeltaX,a=e.wheelDeltaY,l=e.wheelDelta;if(n&&Math.abs(n)>Math.abs(a)){if("flex"==t.width)return!0;o=!0,i=n/120}else if(l){if(!this.iRefresh.vscroll)return!0;i=l/120}else if(e.detail){if(!this.iRefresh.vscroll)return!0;i=-1*e.detail/3}i*=3;var s=o?r.hscroll:r.vscroll,d=parseInt(s.option("cur_pos")),c=parseInt(s.option("num_eles"));if(!t.scrollModel.smooth&&(o&&t.virtualX||!o&&t.virtualY)){i=i>0?Math[1>i?"ceil":"floor"](i):Math[-1>i?"ceil":"floor"](i);var h=d-i;if(0>h?h=0:h>c-1&&(h=c-1),h==d)return!0;s.option("cur_pos",d-i),s.scroll()}else{var u=s.option("ratio"),f=u-i/(c-1);if(f>1?f=1:0>f&&(f=0),u==f)return!0;s.option("ratio",f),s.drag()}return!1},d._onDblClickCell=function(t){var r=this,i=e(t.currentTarget),o=r.getCellIndices({$td:i}),n=o.rowIndxPage,a=r.rowIndxOffset,l=n+a,s=o.colIndx;return null!=s?0==r._trigger("cellDblClick",t,{$td:i,rowIndxPage:n,rowIndx:l,colIndx:s,column:r.colModel[s],rowData:r.pdata[n]})?!1:void(r.options.editModel.clicksToEdit>1&&this.isEditableRow({rowIndx:l})&&this.isEditableCell({colIndx:s,rowIndx:l})&&r.editCell({rowIndxPage:n,colIndx:s})):void 0},d._onClickCont=function(e){},d._onClickRow=function(t){var r=this,i=e(t.currentTarget),o=parseInt(i.attr("pq-row-indx")),n=r.rowIndxOffset,a=o+n;if(!isNaN(o)){this.options;return 0==r._trigger("rowClick",t,{$tr:i,rowIndxPage:o,rowIndx:a,rowData:r.pdata[o]})?!1:void 0}},d._onRightClickRow=function(t){var r=this,i=e(t.currentTarget),o=parseInt(i.attr("pq-row-indx")),n=r.rowIndxOffset,a=o+n;if(!isNaN(o)){this.options;return 0==r._trigger("rowRightClick",t,{$tr:i,rowIndxPage:o,rowIndx:a,rowData:r.pdata[o]})?!1:void 0}},d._onDblClickRow=function(t){var r=this,i=e(t.currentTarget),o=parseInt(i.attr("pq-row-indx")),n=r.getRowIndxOffset(),a=o+n;return 0==r._trigger("rowDblClick",t,{$tr:i,rowIndxPage:o,rowIndx:a,rowData:r.pdata[o]})?!1:void 0},d.getValueFromDataType=function(t,r,i){var o;if("date"==r)return o=Date.parse(t),isNaN(o)?"":i?o:t;if("object"==r)return t;if("integer"==r)o=parseInt(t);else{if("float"!=r)return"bool"==r?(o=e.trim(t).toLowerCase(),0==o.length?null:"true"==o||"yes"==o||"1"==o?!0:"false"==o||"no"==o||"0"==o?!1:Boolean(o)):e.trim(t);o=parseFloat(t)}return isNaN(o)||null==o?null==t?t:null:o};var c=function(e){this.that=e},h=c.prototype;h._isValidCell=function(e){var t=this.that,r=e.column,i=r.validations;if(!i||!i.length)return{valid:!0};var o=e.value,n=r.dataType,a=function(e){return t.getValueFromDataType(e,n,!0)},l=e.rowData;if(!l)throw"rowData required.";for(var s=0;s<i.length;s++){var d=i[s],c=d.on,h=d.type,u=!1,f=d.msg,p=d.value;if(c!==!1){if(null==o&&"function"!=typeof h)u=!1;else if("minLen"==h)o=a(o),p=a(p),o.length>=p&&(u=!0);else if("nonEmpty"==h)null!=o&&""!==o&&(u=!0);else if("maxLen"==h)o=a(o),p=a(p),o.length<=p&&(u=!0);else if("gt"==h)o=a(o),p=a(p),o>p&&(u=!0);else if("gte"==h)o=a(o),p=a(p),o>=p&&(u=!0);else if("lt"==h)o=a(o),p=a(p),p>o&&(u=!0);else if("lte"==h)o=a(o),p=a(p),p>=o&&(u=!0);else if("neq"==h)o=a(o),p=a(p),o!==p&&(u=!0);else if("regexp"==h)new RegExp(p).test(o)&&(u=!0);else if("function"==typeof h){var g={column:r,value:o,rowData:l,msg:f},v=h.call(t,g);0==v?(u=!1,g.msg!=f&&(f=g.msg)):u=!0}else u=!0;if(!u)return{valid:!1,msg:f,column:r,warn:d.warn,dataIndx:r.dataIndx,validation:d}}}return{valid:!0}},h.isValidCell=function(t){var r=this.that,i=t.rowData,o=t.rowIndx,n=t.value,a=t.valueDef,l=t.column,s=t.focusInvalid,d=r.options,c=d.bootstrap,h=t.allowInvalid,u=l.dataIndx,f=d.validation,p=d.warning,g=d.editModel,v=g.invalidClass,w=g.warnClass,m=document.activeElement;if(t.checkEditable&&0==r.isEditableCell({rowIndx:o,dataIndx:u}))return{valid:!0};var x=this._isValidCell({column:l,value:n,rowData:i}),_=x.valid,I=x.warn,y=x.msg;if(_)r.data({rowData:i,dataIndx:u,data:"pq_valid"})&&(r.removeClass({rowData:i,rowIndx:o,dataIndx:u,cls:w+" "+v}),r.removeData({rowData:i,dataIndx:u,data:"pq_valid"}));else var b=e.extend({},I?p:f,x.validation),C=b.css,q=b.cls,M=b.icon,D=b.style;if(h||I)return _?{valid:!0}:(r.addClass({rowData:i,rowIndx:o,dataIndx:u,cls:I?w:v}),r.data({rowData:i,dataIndx:u,data:{pq_valid:{css:C,icon:M,style:D,msg:y,cls:q}}}),x);if(!_){if(null==o){var R=r.getRowIndx({rowData:i,dataUF:!0}),o=R.rowIndx;if(null==o||R.uf)return x.uf=R.uf,x}if(s){var P;if(a){if(e(m).hasClass("pq-editor-focus")){var T=d.editModel.indices;if(T){var k=T.rowIndx,S=T.dataIndx;if(null!=o&&o!=k)throw"incorrect usage of isValid rowIndx: "+o;if(u!=S)throw"incorrect usage of isValid dataIndx: "+u;r.editCell({rowIndx:k,dataIndx:u})}}}else{r.goToPage({rowIndx:o});var H={rowIndx:o,dataIndx:u},H=r.normalize(H);P=r.getCell(H),r["cell"==d.selectionModel.type?"setSelection":"scrollCell"](H),r.focus(H)}var E;if(P||(E=r.getEditCell())&&E.$cell){var $=P||E.$cell;$.attr("title",y);var V="tooltip",z="open";c.on&&c.tooltip&&(V=c.tooltip,z="show");try{$[V]("destroy")}catch(W){}$[V]({trigger:"manual",position:{my:"left center+5",at:"right center"},content:function(){var e=""==M?"":"<span class='ui-icon "+M+" pq-tooltip-icon'></span>";return e+y},open:function(e,t){var r=t.tooltip;if(q&&r.addClass(q),D){var i=r.attr("style");r.attr("style",i+";"+D)}C&&r.tooltip.css(C)}})[V](z)}}return x}if(a){var E=r.getEditCell();if(E&&E.$cell){var $=E.$cell;$.removeAttr("title");try{$.tooltip("destroy")}catch(W){}}}return{valid:!0}},d.isValid=function(e){return this.iIsValid.isValid(e)},h.isValid=function(e){e=e||{};var t=this.that,r=e.allowInvalid,i=e.focusInvalid,o=e.checkEditable,r=null==r?!1:r,n=e.dataIndx;if(null!=n){var a=t.columns[n],l=e.rowData||t.getRowData(e),s=e.hasOwnProperty("value"),d=s?e.value:l[n],c=this.isValidCell({rowData:l,checkEditable:o,rowIndx:e.rowIndx,value:d,valueDef:s,column:a,allowInvalid:r,focusInvalid:i});return c.valid||c.warn?{valid:!0}:c}if(null!=e.rowIndx||null!=e.rowIndxPage||null!=e.rowData){for(var l=e.rowData||t.getRowData(e),h=t.colModel,u=[],f=0,p=h.length;p>f;f++){var a=h[f],g=a.hidden;if(!g){var n=a.dataIndx,d=l[n],c=this.isValidCell({rowData:l,value:d,column:a,rowIndx:e.rowIndx,checkEditable:o,allowInvalid:r,focusInvalid:i});if(!c.valid&&!c.warn){if(!r)return c;u.push({rowData:l,dataIndx:n,column:a})}}}return r&&u.length?{cells:u,valid:!1}:{valid:!0}}var v=e.data?e.data:t.options.dataModel.data,u=[];if(!v)return null;for(var f=0,p=v.length;p>f;f++){var w,l=v[f];if(!o||(w=this.getRowIndx({rowData:l}).rowIndx,null!=w&&0!=t.isEditableRow({rowData:l,rowIndx:w}))){var m=this.isValid({rowData:l,rowIndx:w,checkEditable:o,allowInvalid:r,focusInvalid:i}),x=m.cells;if(r===!1){if(!m.valid)return m}else x&&x.length&&(u=u.concat(x))}}return r&&u.length?{cells:u,valid:!1}:{valid:!0}},d.isValidChange=function(e){e=e||{};var t=this.getChanges(),r=t.addList,i=t.updateList,o=i.concat(r);return e.data=o,this.isValid(e)},d.isEditableRow=function(e){var t=this.options,r=t.editable;return null!=r?"function"==typeof r?r.call(this,this.normalize(e)):r:!0},d.isEditableCell=function(e){var t=this.normalize(e),r=(t.rowIndx,t.colIndx,this.iMerge,t.column),i=r.editable;return t.checkVisible&&r.hidden?!1:null!=i?"function"==typeof i?i.call(this,t):i:!0},d._onContMouseDown=function(t){this.blurEditor({blurIfFocus:!0});var r=this;if(r._trigger("contMouseDown",t,null)===!1)return!1;var i=e(t.target),o=i.closest(".pq-grid-cell,.pq-grid-number-cell"),n=i.closest(".pq-grid-row");if(!o.length&&!n.length){var a=this.$cont[0];a.setAttribute("tabindex",0),a.focus()}return!0},d._onCellMouseDown=function(t){var r,i=this,o=e(t.currentTarget),n=i.getCellIndices({$td:o});if(null!=n.rowIndx)return n=this.iMerge.getRootCell(n.rowIndx,n.colIndx,"o"),r=i.normalize(n),r.$td=o,0!=i._trigger("cellMouseDown",t,r)},d._onRowMouseDown=function(t){var r=this,i=e(t.currentTarget),o=r.getRowIndx({$tr:i});return o.$tr=i,0!=r._trigger("rowMouseDown",t,o)},d._onCellMouseEnter=function(e,t){var r=t,i=this.options,o=this.getCellIndices({$td:r}),n=this;if(null!=o.rowIndx&&null!=o.colIndx)return n._trigger("cellMouseEnter",e,o)===!1?!1:("cell"==i.hoverMode&&n.highlightCell(r),!0)},d._onRowMouseEnter=function(e,t){var r=t,i=this.options,o=this,n=o.getRowIndx({$tr:r}),a=n.rowIndxPage;return o._trigger("rowMouseEnter",e,n)===!1?!1:("row"==i.hoverMode&&o.highlightRow(a),!0)},d._onCellMouseLeave=function(e,t){var r=t,i=this;return"cell"==i.options.hoverMode&&i.unHighlightCell(r),!0},d._onRowMouseLeave=function(e,t){var r=t,i=this,o=i.getRowIndx({$tr:r}),n=o.rowIndxPage;return"row"==i.options.hoverMode&&i.unHighlightRow(n),!0},d.enableSelection=function(){this.element.removeClass("pq-disable-select").off("selectstart"+this.eventNamespace)},d.disableSelection=function(){this.element.addClass("pq-disable-select").on("selectstart"+this.eventNamespace,function(t){var r=t.target;if(r){var i=e(t.target);return i.is("input,textarea,select")?!0:i.closest(".pq-native-select").length?!0:void t.preventDefault()}})},d._onClickCell=function(t){var r=this,i=this.options,o=i.editModel,n=e(t.currentTarget),a=r.getCellIndices({$td:n}),l=this.iMerge.getRootCell(a.rowIndx,a.colIndx,"o"),s=this.normalize(l),d=s.rowIndx,c=s.colIndx;return s.$td=n,s.evt=t,0==r._trigger("cellClick",t,s)?!1:void(null==c||0>c||1==o.clicksToEdit&&this.isEditableRow({rowIndx:d})&&this.isEditableCell({colIndx:c,rowIndx:d})&&r.editCell(s))},d._onRightClickCell=function(t){var r=e(t.currentTarget),i=this.getCellIndices({$td:r}),o=this,n=i.rowIndxPage,a=this.rowIndxOffset,l=n+a,s=i.colIndx,d=this.colModel,c=this.options;c.DM;if(null!=s){var h=d[s],u=h.dataIndx;return 0==this._trigger("cellRightClick",t,{$td:r,rowIndxPage:n,rowIndx:l,colIndx:s,dataIndx:u,column:h,rowData:o.pdata[n]})?!1:void 0}},d.highlightCell=function(e){
e.addClass("pq-grid-cell-hover ui-state-hover")},d.unHighlightCell=function(e){e.removeClass("pq-grid-cell-hover ui-state-hover")},d.highlightRow=function(e){if(isNaN(e));else{var t=this.getRow({rowIndxPage:e});t&&t.addClass("pq-grid-row-hover ui-state-hover")}},d.unHighlightRow=function(e){if(isNaN(e));else{var t=this.getRow({rowIndxPage:e});t&&t.removeClass("pq-grid-row-hover ui-state-hover")}},d._getCreateEventData=function(){return{dataModel:this.options.dataModel,data:this.pdata,colModel:this.options.colModel}},d._findCellFromEvt=function(t){var r=e(t.target),i=r.closest(".pq-grid-cell");if(null==i||0==i.length)return{rowIndxPage:null,colIndx:null,$td:null};var o=this.getCellIndices({$td:i});return o.$td=i,o},d._initPager=function(){var t=this,r=t.options,i=r.pageModel;if(i.type){var o={bootstrap:r.bootstrap,change:function(e,r){t.blurEditor({force:!0});var i=t.options.pageModel;void 0!=r.curPage&&(i.prevPage=i.curPage,i.curPage=r.curPage),void 0!=r.rPP&&(i.rPP=r.rPP),"remote"==i.type?t.remoteRequest({callback:function(){t._onDataAvailable({apply:!0,header:!1})}}):t.refreshView({header:!1,source:"pager"})},refresh:function(e){t.refreshDataAndView()}};o=e.extend(o,i),this.pagerW=pq.pager(i.appendTo?i.appendTo:this.$footer,o)}},d.generateLoading=function(){this.$loading&&this.$loading.remove(),this.$loading=e("<div class='pq-loading'></div>").appendTo(this.element),e(["<div class='pq-loading-bg'></div><div class='pq-loading-mask ui-state-highlight'><div>",this.options.strLoading,"...</div></div>"].join("")).appendTo(this.$loading),this.$loading.find("div.pq-loading-bg").css("opacity",.2)},d._refreshLoadingString=function(){this.$loading.find("div.pq-loading-mask").children("div").html(this.options.strLoading)},d.showLoading=function(){null==this.showLoadingCounter&&(this.showLoadingCounter=0),this.showLoadingCounter++,this.$loading.show()},d.hideLoading=function(){this.showLoadingCounter>0&&this.showLoadingCounter--,this.showLoadingCounter||this.$loading.hide()},d.refreshDataFromDataModel=function(e){e=e||{};var t,r,i,o,n,a=this,l=a.options,s=l.dataModel,d=l.pageModel,c=s.data,h=d.type,u=a._queueATriggers;for(var f in u){var p=u[f];delete u[f],a._trigger(f,p.evt,p.ui)}if(a._trigger("beforeRefreshData",null,{}),"local"==h)o=d.totalRecords=c.length,d.totalPages=i=Math.ceil(o/d.rPP),d.curPage>i&&(d.curPage=i),i&&!d.curPage&&(d.curPage=1),t=(d.curPage-1)*d.rPP,t=t>=0?t:0,r=d.curPage*d.rPP,r>c.length&&(r=c.length),a.pdata=c.slice(t,r),n=t;else if("remote"==h){d.totalPages=i=Math.ceil(d.totalRecords/d.rPP),d.curPage>i&&(d.curPage=i),i&&!d.curPage&&(d.curPage=1);var r=d.rPP;r>c.length&&(r=c.length),a.pdata=c.slice(0,r),n=d.rPP*(d.curPage-1)}else l.backwardCompat?a.pdata=c.slice(0):a.pdata=c;a.rowIndxOffset=n>=0?n:0,a._trigger("dataReady",null,{source:e.source})},d.getQueryStringCRUD=function(){return""},d.remoteRequest=function(t){this.loading&&this.xhr.abort(),t=t||{};var r=this,i="",o="",n=this.options,a=!1,l=this.colModel,s=n.dataModel,d=n.sortModel,c=n.filterModel,h=n.pageModel;if("function"==typeof s.getUrl){var u={colModel:l,dataModel:s,sortModel:d,groupModel:n.groupModel,pageModel:h,filterModel:c},f=s.getUrl.call(this,u);f&&f.url&&(i=f.url),f&&f.data&&(o=f.data)}else if("string"==typeof s.url){i=s.url;var p={},g={},v={};if("remote"==d.type){t.initBySort||this.sort({initByRemote:!0});var w=this.iSort.getQueryStringSort();w&&(p={pq_sort:w})}"remote"==h.type&&(v={pq_curpage:h.curPage,pq_rpp:h.rPP});var m;"local"!=c.type&&(m=this.iFilterData.getQueryStringFilter(),m&&(a=!0,g={pq_filter:m}));var x=s.postData,_=s.postDataOnce;x&&"function"==typeof x&&(x=x.call(this,{colModel:l,dataModel:s})),o=e.extend({pq_datatype:s.dataType},g,v,p,x,_)}i&&(this.loading=!0,this.showLoading(),this.xhr=e.ajax({url:i,dataType:s.dataType,async:null==s.async?!0:s.async,cache:s.cache,contentType:s.contentType,type:s.method,data:o,beforeSend:function(e,t){return"function"==typeof s.beforeSend?s.beforeSend.call(r,e,t):void 0},success:function(e,i,o){r.onRemoteSuccess(e,i,o,a,t)},error:function(e,t,i){if(r.hideLoading(),r.loading=!1,"function"==typeof s.error)s.error.call(r,e,t,i);else if("abort"!=i)throw"Error : "+i}}))},d.onRemoteSuccess=function(e,t,r,i,o){var n,a=this,l=a.options,s=a.colModel,d=l.pageModel,c=l.dataModel;n="function"==typeof c.getData?c.getData.call(a,e,t,r):e,c.data=n.data,"remote"==d.type&&(null!=n.curPage&&(d.curPage=n.curPage),null!=n.totalRecords&&(d.totalRecords=n.totalRecords)),a.hideLoading(),a.loading=!1,a._trigger("load",null,{dataModel:c,colModel:s}),i&&(a._queueATriggers.filter={ui:{}}),o.callback&&o.callback()},d._refreshTitle=function(){this.$title.html(this.options.title)},d._destroyDraggable=function(){var e=this.element,t=e.parent(".pq-wrapper");t.length&&t.data("draggable")&&(t.draggable("destroy"),this.$title.removeClass("pq-draggable pq-no-capture"),e.unwrap(".pq-wrapper"))},d._refreshDraggable=function(){var e=this.options,t=this.element,r=this.$title;if(e.draggable){r.addClass("pq-draggable pq-no-capture");var i=t.parent(".pq-wrapper");i.length||t.wrap("<div class='pq-wrapper' />"),t.parent(".pq-wrapper").draggable({handle:r})}else this._destroyDraggable()},d._refreshResizable=function(){var t=this,r=this.element,i=this.options,o=(i.width+"").indexOf("%")>-1,n=(i.height+"").indexOf("%")>-1,a="auto"==i.width,l="flex"==i.width,s="flex"==i.height;if(!i.resizable||(s||n)&&(l||o||a))this._destroyResizable();else{var d="e,s,se";s||n?d="e":(l||o||a)&&(d="s");var c=!0;if(r.hasClass("ui-resizable")){var h=r.resizable("option","handles");d==h?c=!1:this._destroyResizable()}c&&r.resizable({helper:"ui-state-default",handles:d,minWidth:i.minWidth,minHeight:i.minHeight?i.minHeight:100,delay:0,start:function(t,r){e(r.helper).css({opacity:.5,background:"#ccc",border:"1px solid steelblue"})},resize:function(e,t){},stop:function(r,o){var n=t.element,a=n[0],l=i.width,s=i.height,d=(l+"").indexOf("%")>-1,c=(s+"").indexOf("%")>-1,h="auto"==l,u="flex"==l,f="flex"==s,p=!1;a.style.width=a.offsetWidth+3+"px",a.style.height=a.offsetHeight+3+"px",c||f||(p=!0,i.height=a.offsetHeight),d||h||u||(p=!0,i.width=a.offsetWidth),t.refresh(),n.css("position","relative"),p&&e(window).trigger("resize")}})}},d._refreshAfterResize=function(){var e=this.options,t=e.width,r=e.height,i=-1!=(t+"").indexOf("%"),o="auto"===t,n=-1!=(r+"").indexOf("%");(i||o||n)&&this.refresh()},d.refresh=function(e){this.iRefresh.refresh(e)},d.refreshView=function(e){null!=this.options.editModel.indices&&this.blurEditor({force:!0}),this.refreshDataFromDataModel(e),this.refresh(e)},d._refreshPager=function(){var e=this.options,t=e.pageModel,r=!!t.type,i=t.rPP,o=t.totalRecords;if(r){var n=e.pageModel;this.pagerW||this._initPager(),this.pagerW.option(n),o>i?this.$bottom.css("display",""):e.showBottom||this.$bottom.css("display","none")}else this.pagerW&&(this.pagerW.destroy(),this.pagerW=null),e.showBottom?this.$bottom.css("display",""):this.$bottom.css("display","none")},d.getInstance=function(){return{grid:this}},d.refreshDataAndView=function(e){var t=this.options.dataModel;if("remote"==t.location){var r=this;this.remoteRequest({callback:function(){r._onDataAvailable(e)}})}else this._onDataAvailable(e)},d.getColIndx=function(e){var t,r,i,o=e.dataIndx,n=e.column;if(n)r=!0;else{if(void 0===o)throw"dataIndx / column NA";i=!0}var a=this.colModel,l=a.length;if(r){for(var s=0;l>s;s++)if(a[s]==n)return s}else if(t=this.colIndxs[o],null!=t)return t;return-1},d.getColumn=function(e){if(null==e.dataIndx)throw"dataIndx N/A";return this.columns[e.dataIndx]},d._generateCellRowOutline=function(){var t=this.options,r=t.editModel;if(this.$div_focus){if(t.debug)throw"this.$div_focus already present assert failed"}else{var i=this.element;r.inline&&(i=this.getCell(r.indices),i.css("padding",0).empty()),this.$div_focus=e(["<div class='pq-editor-outer'>","<div class='pq-editor-inner'>","</div>","</div>"].join("")).appendTo(i);var o=e.extend({all:!0},r.indices),n=this.getCell(o);n.css("height",n[0].offsetHeight),n.empty(),this.refreshEditorPos()}},d._removeEditOutline=function(t){function r(e){e.hasClass("hasDatepicker")&&e.datepicker("hide").datepicker("destroy")}if(this.$div_focus){var i=this.$div_focus.find(".pq-editor-focus");if(r(i),i[0]==document.activeElement){var o=this._blurEditMode;this._blurEditMode=!0,i.blur(),this._blurEditMode=o}this.$div_focus.remove(),delete this.$div_focus;var n=this.options.editModel,a=e.extend({},n.indices);n.indices=null,a.rowData=void 0,this.refreshCell(a)}},d.refreshEditorPos=function(){var e=this.options,t=e.editModel,r=t.cellBorderWidth,i=this.$div_focus,o=this.getCell(t.indices);if(!o||!o.length)return!1;var n=o[0].offsetWidth,a=o[0].offsetHeight,l=this.element.offset(),s=o.offset(),d=s.left-l.left-1,c=s.top-l.top-1;i.css({height:a,width:n-1,borderWidth:r,left:d,top:c})},d.setEditorPosTimer=function(){var e=this,t=this.options;this._refreshEditorPosTimer&&(window.clearInterval(this._refreshEditorPosTimer),this._refreshEditorPosTimer=null),this._refreshEditorPosTimer=window.setInterval(function(){var r=t.editModel;r.indices&&e.refreshEditorPos()},200)},d.get$Tbl=function(t,r){var i=this.$tbl,o=[];if(i&&i.length){var n=this.pqpanes,a=this.options,l=a.freezeRows,s=a.freezeCols;return n.h&&n.v?null==r?t>=l?o.push(i[2],i[3]):o.push(i[0],i[1]):o=r>=s&&t>=l?i[3]:s>r&&t>=l?i[2]:r>=s&&l>t?i[1]:i[0]:o=n.v?null==r?i:r>=s?i[1]:i[0]:n.h&&t>=l?i[1]:i[0],o?e(o):void 0}},d.scrollCell=function(e){this.scrollRow(e),this.scrollColumn(e)},d.scrollY=function(e){this.vscroll.option("cur_pos",e),this.vscroll.scroll()},d.scrollRow=function(e){var t=this.options,e=this.normalize(e),r=e.rowIndxPage,i=e.rowData;return!this.pdata||r>=this.pdata.length?!1:!i||i.pq_hidden?!1:void(t.virtualY?this._scrollRowVirtual(e):this.iMouseSelection.scrollRowNonVirtual(e))},d._scrollRowVirtual=function(e){var t=this.options,r=e.rowIndxPage,i=!!this.iHierarchy,o=e.rowIndx,n=this.vscroll,a=this.scrollCurPos,r=null==r?o-this.rowIndxOffset:r,l=parseInt(t.freezeRows);if(!(l>r)){var s=this._calcCurPosFromRowIndxPage(r);if(null!=s){a>s&&(n.option("cur_pos",s),n.scroll());var d=this.get$Tbl(r);if(!d||!d.length)return null;var c=d.children("tbody").children("tr[pq-row-indx="+r+"]"),h=c.last(),u=h;c.length>1&&(u=c.first());var f=h[0],p=parseInt(d.css("marginTop"));if(void 0==f)n.option("cur_pos",s),n.scroll();else{var g=f.offsetTop+f.offsetHeight,v=this.iRefresh.getEContHt(),w=p,m=this._getSBHeight(),x=u.prev("tr");if(x.hasClass("pq-row-hidden")||x.hasClass("pq-last-frozen-row"))return;if(g>v-w){var _,I=g-(v-m-w),c=d.children().children("tr"),y=0,b=0;for(l?(_=c.filter("tr.pq-last-frozen-row").last().next(),0==_.length&&(_=c.filter("tr.pq-row-hidden").next())):_=c.filter("tr.pq-row-hidden").next();;){if(!_.length)break;if(y+=_[0].offsetHeight,_[0]==h[0])break;if(i&&0!=_.hasClass("pq-detail-child")){if(y>=I)break}else if(b++,y>=I)break;_=_.next()}var C=a+b;C>s&&(C=s);var q=n.option("num_eles");C+1>q&&(q=C+1),n.option({num_eles:q,cur_pos:C}),n.scroll()}}}}},d.blurEditor=function(e){if(this.$div_focus){var t=this.$div_focus.find(".pq-editor-focus");if(!e||!e.blurIfFocus)return t.triggerHandler("blur",e);document.activeElement==t[0]&&t.blur()}},d._scrollColumnVirtual=function(e){var t=e.colIndx,r=this.hscroll,t=null==t?this.colIndxs[e.dataIndx]:t,i=this.options.freezeCols,o=this._calcRightEdgeCol(t).width,n=this.iRefresh.getEContWd();if(o>n){for(var a=this.calcWidthCols(-1,t+1)-n,l=this.colModel,s=l.length,d=0,c=0,h=i;s>h;h++){var u=l[h];if(u.hidden||(d+=u.outerWidth),h==t){c=h-i-this._calcNumHiddenUnFrozens(h);break}if(d>=a){c=h-i-this._calcNumHiddenUnFrozens(h)+1;break}}return r.option("cur_pos",c),r.scroll(),!0}if(t>=i&&t<this.initH){var f=t-i-this._calcNumHiddenUnFrozens(t);return r.option("cur_pos",f),r.scroll(),!0}return!1},d.scrollColumn=function(e){var t=this.options,r=t.virtualX;return"flex"!==t.width||t.maxWidth?r?this._scrollColumnVirtual(e):this.iMouseSelection.scrollColumnNonVirtual(e):!1},d.selection=function(e){if(e){var t,r=e.method,i=e.type;return"row"==i?t=this.iRows[r](e):"cell"==i&&(t=this.iCells[r](e)),"add"!=r&&"remove"!=r&&"removeAll"!=r||(this.iSelection.dirty=!0,this.iSelection._trigger()),t}var o=this.iSelection;return o.isDirty()&&o.refresh(),o},d.goToPage=function(e){var t=this.options.pageModel;if("local"==t.type||"remote"==t.type){var r=e.rowIndx,i=t.rPP,o=null==e.page?Math.ceil((r+1)/i):e.page,n=t.curPage;o!=n&&(t.curPage=o,"local"==t.type?this.refreshView():this.refreshDataAndView())}},d.setSelection=function(e){if(null==e)return this.iSelection.removeAll(),!0;var t=this.pdata;if(!t||!t.length)return!1;e=this.normalize(e);var r=e.rowIndx,i=e.rowIndxPage,o=e.colIndx;if(e.rowData&&null==r){var n=this.getRowIndx(e);e.rowIndx=r=n.rowIndx,e.rowIndxPage=i=n.rowIndxPage}return null==r||0>r||0>o||o>=this.colModel.length?!1:(this.goToPage(e),i=r-this.rowIndxOffset,this.scrollRow({rowIndxPage:i}),null==o?this.range({r1:r}).select():(this.scrollColumn({colIndx:o}),this.range({r1:r,c1:o}).select()),void(e.focus!==!1&&this.focus({rowIndxPage:i,colIndx:null==o?this.getFirstVisibleCI():o})))},d.getColModel=function(){return this.colModel},d.saveEditCell=function(t){var r=this.options,i=r.editModel;if(!i.indices)return null;var o,n=e.extend({},i.indices),a=t?t.evt:null,l=this.rowIndxOffset,s=n.colIndx,d=n.rowIndxPage,c=d+l,h=this.colModel,u=h[s],f=u.dataIndx,p=this.pdata,g=p[d],v=r.dataModel;if(null==g)return null;if(null!=d){var w=this.getEditCellData();if(e.isPlainObject(w)){o={};for(var m in w)o[m]=g[m]}else o=this.readCell(g,u);"<br>"==w&&(w=""),null==o&&""===w&&(w=null);var x={rowIndx:c,rowIndxPage:d,dataIndx:f,column:u,newVal:w,value:w,oldVal:o,rowData:g,dataModel:v};if(this._trigger("cellBeforeSave",a,x)===!1)return!1;var _={},I=!1;e.isPlainObject(w)?(_=w,I=!0):_[f]=w;var y=this.updateRow({row:_,rowIndx:c,refresh:I,silent:!0,source:"edit",checkEditable:!1});return y===!1?!1:(this._trigger("cellSave",a,x),!0)}},d._addInvalid=function(e){},d._digestData=function(e){if(this._trigger("beforeValidate",null,e)===!1)return!1;var t=this,r=t.options,i=r.editModel,o=r.dataModel,n=o.data,a=r.colModel,l=r.pageModel,s=r.historyModel,d=e.validate,d=null==d?i.validate:d,c="remote"==l.type,h=e.allowInvalid,h=null==h?i.allowInvalid:h,u=r.trackModel,f=e.track,f=null==f?null==r.track?u.on:r.track:f,p=e.history,p=null==p?s.on:p,g=this.iHistory,v=this.iUCData,w=e.checkEditable,w=null==w?!0:w,m=e.checkEditableAdd,m=null==m?w:m,x=this.saveCell,_=this.columns,I=this.colIndxs,y=e.source,b=this.rowIndxOffset,C=t.getValueFromDataType,q=e.rowList,M=q.length;n||(n=r.dataModel.data=[]);for(var D=[],R=0;M>R;R++){var P=q[R],T=P.newRow,k=P.rowData,S=P.type,H=P.checkEditable,E=P.rowIndx,$=P.oldRow;if(null==H&&("update"==S?H=w:"add"==S&&(H=m)),"update"==S){if(!$)throw"oldRow required while update";if(H&&r.editable!==!0&&t.isEditableRow({rowIndx:E,rowData:k})===!1)continue}else if("delete"==S){D.push(P);continue}if("add"==S)for(var V=0,z=a.length;z>V;V++){var W=a[V],L=W.dataIndx;T[L]=T[L]}for(var L in T){var W=_[L],A=I[L];if(W){if(H&&null!=W.editable&&t.isEditableCell({rowIndx:E,colIndx:A,dataIndx:L})===!1){delete T[L],$&&delete $[L];continue}var F=W.dataType,O=C(T[L],F),N=$?$[L]:void 0,N=void 0!==N?C(N,F):void 0;if(T[L]=O,d&&W.validations)if("edit"==y&&h===!1){var j=this.isValid({focusInvalid:!0,dataIndx:L,rowIndx:E,value:O});if(0==j.valid&&!j.warn)return!1}else{var B="add"==S?T:k,j=this.iIsValid.isValidCell({column:W,rowData:B,allowInvalid:h,value:O});j.valid===!1&&(h!==!1||j.warn||delete T[L])}if("update"==S&&O===N){delete T[L],$&&delete $[L];continue}}}if(T)if("update"==S)for(var L in T){D.push(P);break}else D.push(P)}if(q=e.rowList=D,M=q.length,!M)return"edit"==y?null:!1;p&&(g.increment(),g.push({rowList:q}));for(var R=0;M>R;R++){var P=q[R],S=P.type,T=P.newRow,E=P.rowIndx,G=P.rowIndxPage,k=P.rowData;if("update"==S){f&&v.update({rowData:k,row:T,refresh:!1});for(var L in T){var W=_[L],O=T[L];x(k,W,O)}}else if("add"==S){if(f&&v.add({rowData:T}),null==E&&null==G)n.push(T);else{var G=E-b,U=c?G:E;n.splice(U,0,T)}c&&l.totalRecords++}else if("delete"==S){var K=t.getRowIndx({rowData:k,dataUF:!0}),Q=K.uf,E=K.rowIndx;f&&v["delete"]({rowIndx:E,rowData:k});var G=E-b,U=c?G:E;if(Q)o.dataUF.splice(E,1);else{var X=n.splice(U,1);X&&X.length&&c&&l.totalRecords--}}}return t._trigger("change",null,e),!0},d.refreshColumn=function(e){var t=this.normalize(e),r=this.initV,i=this.finalV,o=this.options.freezeRows,n=t.colIndx,a=t.dataIndx,l=t.column;t.skip=!0;for(var s=0;i>=s;s++)r>s&&s>=o&&(s=r),t.rowIndxPage=s,this.refreshCell(t);this._trigger("refreshColumn",null,{column:l,colIndx:n,dataIndx:a}),this.iRefresh.softRefresh()},d.refreshCell=function(e){var t=this.normalize(e);if(this.pdata){var r=t.skip,i=t.rowIndx,o=t.rowIndxPage,n=t.colIndx,a=this.iMerge,l=t.rowData;if(l){var s=this.getCell({all:!0,rowIndxPage:o,colIndx:n});if(s&&s.length>0){var d=t;a.ismergedCell(i,n)&&(d=a.getRootCell(i,n,"a"));var c,h=this.iGenerateView.renderCell(d);if(!h)return;s.replaceWith(h),(c=this._focusElement)&&c.rowIndxPage==o&&this.focus(),r||(this._trigger("refreshCell",null,t),this.iRefresh.softRefresh())}}}},d.refreshRow=function(t){var r=this.normalize(t);if(this.pdata){var i=this,o=r.rowIndx,n=r.rowIndxPage,a=i.options,l=a.freezeRows,s=r.rowData;if(!s||s.pq_hidden||n>i.finalV||n<i.initV&&n>=l)return null;var d,c=this.getRow({all:!0,rowIndxPage:n}),h=[];i.iGenerateView.refreshRow(n,h);var u=h.join("");if(c&&c.length)c.replaceWith(u);else{if(!a.virtualY)return!1;if(n==i.finalV)i.$tbl.append(u);else{if(n!=i.initV)throw"refreshRow > rip not found";for(var f=i.$tbl,p=0;p<f.length;p++)e(f[p]).children("tbody").children(l?".pq-last-frozen-row":"tr:first").after(u)}}return(d=this._focusElement)&&d.rowIndxPage==n&&i.focus(),this._trigger("refreshRow",null,{rowData:s,rowIndx:o,rowIndxPage:n}),r.refresh!==!1&&this.iRefresh.softRefresh(),!0}},d.quitEditMode=function(e){if(!this._quitEditMode){var t=this,r=!1,i=!1,o=!1,n=this.options,a=n.editModel,l=a.indices,s=void 0;t._quitEditMode=!0,e&&(r=e.old,i=e.silent,o=e.fireOnly,s=e.evt),l&&(i||r||this._trigger("editorEnd",s,l),o||(this._removeEditOutline(e),a.indices=null)),t._quitEditMode=null}},d.getViewPortRowsIndx=function(){return{beginIndx:this.initV,endIndx:this.finalV}},d.getViewPortIndx=function(){return{initV:this.initV,finalV:this.finalV,initH:this.initH,finalH:this.finalH}},d.getRowIndxOffset=function(){return this.rowIndxOffset},d.getEditCell=function(){var e=this.options.editModel;if(e.indices){var t=this.getCell(e.indices),r=this.$div_focus.children(".pq-editor-inner"),i=r.find(".pq-editor-focus");return{$td:t,$cell:r,$editor:i}}return{}},d.editCell=function(e){var t=this.normalize(e),r=this.iMerge,i=t.rowIndx,o=t.colIndx;if(r.ismergedCell(i,o)){var n=r.getRootCell(i,o,"o");if(n.rowIndx!=t.rowIndx||n.colIndx!=t.colIndx)return!1}this.scrollRow(t),this.scrollColumn(t);var a=this.getCell(t);return a&&a.length?this._editCell(t):void 0},d.getFirstEditableColIndx=function(e){if(null==e.rowIndx)throw"rowIndx NA";if(!this.isEditableRow(e))return-1;for(var t=this.colModel,r=0;r<t.length;r++)if(e.colIndx=r,this.isEditableCell(e)&&!t[r].hidden)return r;return-1},d.editFirstCellInRow=function(e){var t=this.rowIndxOffset,r=e.rowIndx,i=e.rowIndxPage,r=null==r?i+t:r,i=null==i?r-t:i,o=this.getFirstEditableColIndx({rowIndx:r});-1!=o&&this.editCell({rowIndxPage:i,colIndx:o})},d._editCell=function(t){var r=this.normalize(t),i=this,n=r.evt,a=r.rowIndxPage,l=r.colIndx,s=i.pdata;if(!s||a>=s.length)return!1;var d=this.options,c=d.editModel,h=s[a],u=r.rowIndx,f=this.colModel,p=f[l],g=p.dataIndx,v=i.readCell(h,p),w={rowIndx:u,rowIndxPage:a,cellData:v,rowData:h,dataIndx:g,colIndx:l,column:p},m=p.editor,x=this,m="function"==typeof m?m.call(x,w):m;if(void 0===m&&"function"==typeof d.geditor&&(m=d.geditor.call(x,w)),m!==!1){m&&m.getData&&(c._getData=m.getData);var _=d.editor,I=m?e.extend({},_,m):_,y=!1;if(c.indices){var b=c.indices;if(b.rowIndxPage==a&&b.colIndx==l){this.refreshEditorPos();var C=this.$div_focus.find(".pq-editor-focus");return window.setTimeout(function(){C.focus()},0),!1}if(this.blurEditor({evt:n})===!1)return!1;this.quitEditMode({evt:n})}c.indices={rowIndxPage:a,rowIndx:u,colIndx:l,column:p,dataIndx:g},this._generateCellRowOutline();var q=this.$div_focus,M=q.children(".pq-editor-inner");"right"==p.align?M.addClass("pq-align-right"):"center"==p.align?M.addClass("pq-align-center"):M.addClass("pq-align-left"),w.$cell=M;var D,R=I.type,P=null==r.select?I.select:r.select,T=I.init,k=I.valueIndx,S=I.dataMap,H=I.mapIndices,H=H?H:{},E=I.cls||"",E="function"==typeof E?E.call(x,w):E,$="pq-editor-focus "+E,V=$+" pq-cell-editor ",z=I.attr||"",z="function"==typeof z?z.call(x,w):z,W=I.style||"",W="function"==typeof W?W.call(x,w):W,L=W?"style='"+W+"'":"",A=L,F=L;if(w.cls=$,w.attr=z,"function"==typeof R&&(D=R.call(x,w),D&&(R=D)),_._type=R,"checkbox"==R){var O=I.subtype,N=v?"checked='checked'":"";D="<input "+N+" class='"+V+"' "+z+" "+F+" type=checkbox name='"+g+"' />",M.html(D);var j=M.children("input");"triple"==O&&(j.pqval({val:v}),M.click(function(t){e(this).children("input").pqval({incr:!0})}))}else if("textarea"==R||"select"==R||"textbox"==R){if("textarea"==R)D="<textarea class='"+V+"' "+z+" "+A+" name='"+g+"' ></textarea>";else if("select"==R){var B=I.options||[];"function"==typeof B&&(B=B.call(x,w));var G=[z," class='",V,"' ",A," name='",g,"'"].join("");D=o.select({options:B,attr:G,prepend:I.prepend,labelIndx:I.labelIndx,valueIndx:k,groupIndx:I.groupIndx,dataMap:S})}else D="<input class='"+V+"' "+z+" "+A+" type=text name='"+g+"' />";e(D).appendTo(M).val("select"==R&&null!=k&&(H[k]||this.columns[k])?H[k]?h[H[k]]:h[k]:v)}else R&&"contenteditable"!=R||(D="<div contenteditable='true' tabindx='0' "+L+" "+z+" class='"+V+"'></div>",M.html(D),M.children().html(v),y=!0);"function"==typeof T&&T.call(x,w);var i=this,C=M.children(".pq-editor-focus"),U=c.filterKeys,K=p.editModel;K&&void 0!==K.filterKeys&&(U=K.filterKeys);var Q={$cell:M,$editor:C,dataIndx:g,column:p,colIndx:l,rowIndx:u,rowIndxPage:a,rowData:h};if(c.indices=Q,C.data({FK:U}).on("click",function(t){e(this).focus()}).on("keydown",function(e){i.iKeyNav._keyDownInEdit(e)}).on("keypress",function(e){return i.iKeyNav._keyPressInEdit(e,{FK:U})}).on("keyup",function(e){return i.iKeyNav._keyUpInEdit(e,{FK:U})}).on("blur",function(t,r){var o=i.options,n=o.editModel,a=n.onBlur,l="save"==a,s="validate"==a,d=n.cancelBlurCls,c=r?r.force:!1;if(!i._quitEditMode&&!i._blurEditMode&&n.indices){var h=e(t.target);if(!c){if(i._trigger("editorBlur",t,Q)===!1)return;if(!a)return;if(d&&h.hasClass(d))return;if(h.hasClass("hasDatepicker")){var u=h.datepicker("widget");if(u.is(":visible"))return!1}else if(h.hasClass("ui-autocomplete-input")){if(h.autocomplete("widget").is(":visible"))return}else if(h.hasClass("ui-multiselect")){if(e(".ui-multiselect-menu").is(":visible")||e(document.activeElement).closest(".ui-multiselect-menu").length)return}else if(h.hasClass("pq-select-button")&&(e(".pq-select-menu").is(":visible")||e(document.activeElement).closest(".pq-select-menu").length))return}i._blurEditMode=!0;var f=c||l||!s;if(!i.saveEditCell({evt:t,silent:f})&&!c&&s)return i._deleteBlurEditMode(),!1;i.quitEditMode({evt:t}),i._deleteBlurEditMode()}}).on("focus",function(e){i._trigger("editorFocus",e,Q)}),i._trigger("editorBegin",n,Q),C.focus(),window.setTimeout(function(){var t=e(document.activeElement);if(t.hasClass("pq-editor-focus")===!1){var r=i.element?i.element.find(".pq-editor-focus"):e();r.focus()}},0),P)if(y)try{var X=C[0],Y=document.createRange();Y.selectNodeContents(X);var J=window.getSelection();J.removeAllRanges(),J.addRange(Y)}catch(Z){}else C.select()}},d._deleteBlurEditMode=function(e){var t=this,e=e?e:{};t._blurEditMode&&(e.timer?window.setTimeout(function(){delete t._blurEditMode},0):delete t._blurEditMode)},d.getRow=function(t){var r=this.normalize(t),i=r.rowIndxPage,o=r.all?this.$tbl:this.get$Tbl(i),n=e();if(o&&o.length){var a=o.children("tbody");null!=i&&(n=a.children("tr[pq-row-indx="+i+"]"),n.length>o.length&&(n=n.filter(".pq-detail-master")))}return n},d.getCell=function(t){var r=t.all,i=this.options,o=this.normalize(t),n=o.rowIndxPage,a=o.rowIndx,l=o.colIndx,s=this.iMerge,d=s.ismergedCell(a,l);if(d){var c=s.getRootCell(a,l,"a"),h=s.getRootCell(a,l,"o");if(!(n===h.rowIndxPage&&l===h.colIndx||n===c.rowIndxPage&&l===c.colIndx))return e();n=c.rowIndxPage,l=h.colIndx}else{if(n>=i.freezeRows&&(n<this.initV||n>this.finalV)||l>=i.freezeCols&&(l<this.initH||l>this.finalH))return e();if(!o.rowData||!o.column||o.rowData.pq_hidden||o.column.hidden)return e()}var u,f=r?this.$tbl:this.get$Tbl(n,l);return u=f&&f.length?f.children().children("tr[pq-row-indx="+n+"]").children("[pq-col-indx="+l+"]"):e()},d.getCellHeader=function(t){var r,i=t.colIndx,o=t.dataIndx,i=null==i?this.colIndxs[o]:i,n=this.$tbl_header,a=this.options,l=a.freezeCols;if(n){n.length>1&&(n=e(i>=l?n[1]:n[0]));var r=n.find("[pq-col-indx="+i+"].pq-grid-col-leaf");return r}return e()},d.getEditorIndices=function(){var t=this.options.editModel.indices;return t?e.extend({},t):null},d.getEditCellData=function(){var t=this.options,r=t.editModel,i=r.indices;if(!i)return null;var o,n=i.colIndx,a=i.rowIndxPage,l=i.rowIndx,s=this.colModel[n],d=s.editor,c=t.editor,h=d?e.extend({},c,d):c,u=h.valueIndx,f=h.labelIndx,p=h.mapIndices,p=p?p:{},g=s.dataIndx,v=this.$div_focus,w=v.children(".pq-editor-inner"),m=r._getData||h.getData;if(r._getData=void 0,"function"==typeof m)o=m.call(this,{$cell:w,rowData:i.rowData,dataIndx:g,rowIndx:l,rowIndxPage:a,column:s,colIndx:n});else{var x=c._type;if("checkbox"==x){var _=w.children();o="triple"==h.subtype?_.pqval():!!_.is(":checked")}else if("contenteditable"==x)o=w.children().html();else{var I=w.find('*[name="'+g+'"]');if(I&&I.length)if("select"==x&&null!=u)if(p[u]||this.columns[u]){o={},o[p[u]?p[u]:u]=I.val(),o[p[f]?p[f]:f]=I.find("option:selected").text();var y=h.dataMap;if(y){var b=I.find("option:selected").data("map");if(b)for(var C=0;C<y.length;C++){var q=y[C];o[p[q]?p[q]:q]=b[q]}}}else o=I.val();else o=I.val();else{var I=w.find(".pq-editor-focus");I&&I.length&&(o=I.val())}}}return o},d.getCellIndices=function(e){var t=e.$td;if(null==t||0==t.length||t.closest(".pq-grid")[0]!=this.element[0])return{};var r,i=t.parent("tr"),o=i.attr("pq-row-indx");null!=o&&(o=parseInt(o),r=o+this.rowIndxOffset);var n,a=t.attr("pq-col-indx");return null!=a&&(a=parseInt(a),a>=0&&(n=this.colModel[a].dataIndx)),this.iMerge.getRootCell(r,a,"o")},d.getRowsByClass=function(e){var t=this.options,r=t.dataModel,i=t.pageModel,o="remote"==i.type,n=this.rowIndxOffset,a=r.data,l=[];if(null==a)return l;for(var s=0,d=a.length;d>s;s++){var c=a[s];if(c.pq_rowcls&&(e.rowData=c,this.hasClass(e))){var h={rowData:c},u=o?s+n:s,f=u-n;h.rowIndx=u,h.rowIndxPage=f,l.push(h)}}return l},d.getCellsByClass=function(e){var t=this,r=this.options,i=r.dataModel,o=r.pageModel,n="remote"==o.type,a=this.rowIndxOffset,l=i.data,s=[];if(null==l)return s;for(var d=0,c=l.length;c>d;d++){var h=l[d],u=n?d+a:d,f=h.pq_cellcls;if(f)for(var p in f){var g={rowData:h,rowIndx:u,dataIndx:p,cls:e.cls};if(t.hasClass(g)){var v=t.normalize(g);s.push(v)}}}return s},d.data=function(t){var r=t.dataIndx,i=t.colIndx,r=null!=i?this.colModel[i].dataIndx:r,o=t.data,n=null==o||"string"==typeof o,a=t.rowData||this.getRowData(t);if(!a)return{data:null};if(null==r){var l=a.pq_rowdata;if(n){var s;return null!=l&&(s=null==o?l:l[o]),{data:s}}var d=e.extend(!0,a.pq_rowdata,o);a.pq_rowdata=d}else{var c=a.pq_celldata;if(n){var s;if(null!=c){var h=c[r];s=null==o||null==h?h:h[o]}return{data:s}}c||(a.pq_celldata={});var d=e.extend(!0,a.pq_celldata[r],o);a.pq_celldata[r]=d}},d.attr=function(t){var r=t.rowIndx,i=t.dataIndx,o=t.colIndx,i=null!=o?this.colModel[o].dataIndx:i,n=t.attr,a=null==n||"string"==typeof n,l=this.rowIndxOffset,s=t.refresh,d=t.rowData||this.getRowData(t);if(!d)return{attr:null};if(a||s===!1||null!=r||(r=this.getRowIndx({rowData:d}).rowIndx),null==i){var c=d.pq_rowattr;if(a){var h;return null!=c&&(h=null==n?c:c[n]),{attr:h}}var f=e.extend(!0,d.pq_rowattr,n);if(d.pq_rowattr=f,s!==!1&&null!=r){var p=this.getRow({rowIndxPage:r-l});if(p){var g=u(f);p.attr(g)}}}else{var v=d.pq_cellattr;if(a){var h;if(null!=v){var w=v[i];h=null==n||null==w?w:w[n]}return{attr:h}}v||(d.pq_cellattr={});var f=e.extend(!0,d.pq_cellattr[i],n);if(d.pq_cellattr[i]=f,s!==!1&&null!=r){var m=this.getCell({rowIndxPage:r-l,dataIndx:i});if(m){var g=u(f);m.attr(g)}}}};var u=function(e){var t={};for(var r in e){var i=e[r];if(i)if("title"==r)i=i.replace(/\"/g,"""),t[r]=i;else if("style"==r&&"object"==typeof i){var o,n=[];for(var a in i)o=i[a],o&&n.push(a+":"+o);i=n.join(";")+(n.length?";":""),i&&(t[r]=i)}else"object"==typeof i&&(i=JSON.stringify(i)),t[r]=i}return t};d.removeData=function(t){var r=t.dataIndx,i=t.colIndx,r=null!=i?this.colModel[i].dataIndx:r,o=t.data,o=null==o?[]:o,n="string"==typeof o?o.split(" "):o,a=n.length,l=t.rowData||this.getRowData(t);if(l)if(null==r){var s=l.pq_rowdata;if(s){if(a)for(var d=0;a>d;d++){var c=n[d];delete s[c]}a&&!e.isEmptyObject(s)||delete l.pq_rowdata}}else{var h=l.pq_celldata;if(h&&h[r]){var u=h[r];if(a)for(var d=0;a>d;d++){var c=n[d];delete u[c]}a&&!e.isEmptyObject(u)||delete h[r]}}},d.removeAttr=function(t){var r=t.rowIndx,i=t.dataIndx,o=t.colIndx,i=null!=o?this.colModel[o].dataIndx:i,n=t.attr,n=null==n?[]:n,a="string"==typeof n?n.split(" "):n,l=a.length,s=r-this.rowIndxOffset,d=t.refresh,c=t.rowData||this.getRowData(t);if(c)if(d!==!1&&null==r&&(r=this.getRowIndx({rowData:c}).rowIndx),null==i){var h=c.pq_rowattr;if(h){if(l)for(var u=0;l>u;u++){var f=a[u];delete h[f]}else for(var f in h)a.push(f);l&&!e.isEmptyObject(h)||delete c.pq_rowattr}if(d!==!1&&null!=r&&a.length){n=a.join(" ");var p=this.getRow({rowIndxPage:s});p&&p.removeAttr(n)}}else{var g=c.pq_cellattr;if(g&&g[i]){var v=g[i];if(l)for(var u=0;l>u;u++){var f=a[u];delete v[f]}else for(var f in v)a.push(f);l&&!e.isEmptyObject(v)||delete g[i]}if(d!==!1&&null!=r&&a.length){n=a.join(" ");var w=this.getCell({rowIndxPage:s,dataIndx:i});w&&w.removeAttr(n)}}},d.normalize=function(e){var t={};for(var r in e)t[r]=e[r];var i=t.rowIndx,o=t.rowIndxPage,n=t.dataIndx,a=t.colIndx;if(null!=o||null!=i){var l=this.rowIndxOffset;i=null==i?parseInt(o,10)+l:i,o=null==o?parseInt(i,10)-l:o,t.rowIndx=i,t.rowIndxPage=o,t.rowData=t.rowData||this.getRowData(t)}if(null!=a||null!=n){var s=this.colModel;n=null==n?s[a]?s[a].dataIndx:void 0:n,a=null==a?this.colIndxs[n]:a,t.column=s[a],t.colIndx=a,t.dataIndx=n}return t},d.addClass=function(e){var t=this.normalize(e),r=t.rowIndxPage,i=t.dataIndx,o=pq.arrayUnique,n=t.cls,a=t.refresh,l=t.rowData;if(l)if(a!==!1&&null==r&&(r=this.getRowIndx({rowData:l}).rowIndxPage),null==i){var s,d=l.pq_rowcls;if(s=d?d+" "+n:n,s=o(s.split(/\s+/)).join(" "),l.pq_rowcls=s,a!==!1&&null!=r){var c=this.getRow({rowIndxPage:r});c&&c.addClass(n)}}else{var h=[];"function"!=typeof i.push?h.push(i):h=i;var u=l.pq_cellcls;u||(u=l.pq_cellcls={});for(var f=0,p=h.length;p>f;f++){var s,i=h[f],g=u[i];if(s=g?g+" "+n:n,s=o(s.split(/\s+/)).join(" "),u[i]=s,a!==!1&&null!=r){var v=this.getCell({rowIndxPage:r,dataIndx:i});v&&v.addClass(n)}}}},d.removeClass=function(e){var t=this.normalize(e),r=t.rowIndx,i=t.rowData,o=t.dataIndx,n=t.cls,a=t.refresh;if(i){var l=i.pq_cellcls,s=i.pq_rowcls;if(a!==!1&&null==r&&(r=this.getRowIndx({rowData:i}).rowIndx),null==o){if(s&&(i.pq_rowcls=this._removeClass(s,n),null!=r&&a!==!1)){var d=this.getRow({rowIndx:r});d&&d.removeClass(n)}}else if(l){var c=[];"function"!=typeof o.push?c.push(o):c=o;for(var h=0,u=c.length;u>h;h++){var o=c[h],f=l[o];if(f&&(i.pq_cellcls[o]=this._removeClass(f,n),null!=r&&a!==!1)){var p=this.getCell({rowIndx:r,dataIndx:o});p&&p.removeClass(n)}}}}},d.hasClass=function(e){var t,r=e.dataIndx,i=e.cls,o=this.getRowData(e),n=new RegExp("\\b"+i+"\\b");if(o){if(null==r)return t=o.pq_rowcls,!(!t||!n.test(t));var a=o.pq_cellcls;return!!(a&&a[r]&&n.test(a[r]))}return null},d._removeClass=function(e,t){if(e&&t){for(var r=e.split(/\s+/),i=t.split(/\s+/),o=[],n=0,a=r.length;a>n;n++){
for(var l=r[n],s=!1,d=0,c=i.length;c>d;d++){var h=i[d];if(l===h){s=!0;break}}s||o.push(l)}return o.length>1?o.join(" "):1===o.length?o[0]:null}},d.getRowIndx=function(e){var t,r,i=e.$tr,o=e.rowData,n=this.rowIndxOffset;if(o){var a=this.options,l=a.dataModel,s=this.get_p_data(),d=!1,c=e.dataUF?l.dataUF:null,h=!1;if(s)for(var u=0,f=s.length;f>u;u++)if(s[u]==o){h=!0;break}if(!h&&c){d=!0;for(var u=0,f=c.length;f>u;u++)if(c[u]==o){h=!0;break}}return h?(t=u-n,r=u,{rowIndxPage:d?void 0:t,uf:d,rowIndx:r,rowData:o}):{}}return null==i||0==i.length?{}:(t=i.attr("pq-row-indx"),null==t?{}:(t=parseInt(t),{rowIndxPage:t,rowIndx:t+n}))},d.search=function(e){for(var t=this.options,r=e.row,i=e.first,o=t.dataModel,n=t.pageModel,a=n.type,l=[],s=this.rowIndxOffset,d="remote"==a,c=o.data,h=0,u=c.length;u>h;h++){var f=c[h],p=!0;for(var g in r)r[g]!==f[g]&&(p=!1);if(p){var v=d?h+s:h,w=this.normalize({rowIndx:v});if(l.push(w),i)break}}return l};var f=function(e){this.options=e.options,this.that=e},p=f.prototype;p._incrRowIndx=function(e,t){for(var r=this.that,i=e,t=1,o=r.pdata,n=0,a=e+1,l=o.length;l>a;a++){var s=o[a].pq_hidden;if(!s&&(n++,i=a,n==t))return i}return i},p._decrRowIndx=function(e,t){for(var r=this.that,i=e,o=r.pdata,t=1,n=0,a=e-1;a>=0;a--){var l=o[a].pq_hidden;if(!l&&(n++,i=a,n==t))return i}return i},p._decrRowIndx2=function(e,t){var r,i,o=this.that,n=o.rowIndxOffset,a=e+n,l=o.iMerge,s=o.pdata;if(r=l.ismergedCell(a,t)){var d=l.getRootCell(a,t,"a"),i=l.getData(a,t,"proxy_cell"),t=d.colIndx;t=i?i.colIndx:t}for(var c=e-1;c>=0;c--){var h=s[c].pq_hidden;if(!h){e=c;break}}return{rowIndxPage:e,colIndx:t}},p._incrRowIndx2=function(e,t){var r,i,o=this.that,n=o.rowIndxOffset,a=e+n,l=o.iMerge,s=o.pdata;if(r=l.ismergedCell(a,t)){var d=l.getRootCell(a,t,"a"),i=l.getData(a,t,"proxy_cell"),t=d.colIndx;e=r.rowspan?e+r.rowspan-1:0,t=i?i.colIndx:t}for(var c=e+1,h=s.length;h>c;c++){var u=s[c].pq_hidden;if(!u){e=c;break}}return{rowIndxPage:e,colIndx:t}},d.addColumn=function(e){for(var t=e.colList||[{colIndx:e.colIndx,column:e.column}],r=e.history!==!1,i=this.options,o=i.colModel,n=0;n<t.length;n++){var a=t[n].colIndx,l=t[n].column;void 0==l.dataIndx&&(l.dataIndx=Math.random()),null==a&&(a=t.colIndx=o.length),o.splice(a,0,l)}this.iColModel.init(),r&&(this.iHistory.increment(),t.type="add",this.iHistory.push({colList:t})),this._trigger("addColumn",null,{colList:t}),e.refresh!==!1&&this.refreshView()},d.deleteColumn=function(e){for(var t=e.colList||[{colIndx:e.colIndx}],r=e.history!==!1,i=this.options,o=i.colModel,n=t.length-1;n>=0;n--){var a=t[n],l=a.colIndx,s=o.splice(l,1)[0];a.column=s}this.iColModel.init(),r&&(this.iHistory.increment(),t.type="delete",this.iHistory.push({colList:t})),this._trigger("deleteColumn",null,{colList:t}),e.refresh!==!1&&this.refreshView()},p._incrIndx=function(e,t,r){var i,o,n,a,l,s=this.that,d=s.iMerge,c=s.pdata,h=s.rowIndxOffset,u=s[r?"getLastVisibleRIP":"getFirstVisibleRIP"](),f=s.colModel,p=f.length;if(null==t)return e==u?null:(e=this[r?"_incrRowIndx":"_decrRowIndx"](e),{rowIndxPage:e});do{if(n=e+h,(i=d.ismergedCell(n,t))&&(!l&&(o=d.getData(n,t,"proxy_cell"))&&(a=o.rowIndx-h,c[a].pq_hidden||(e=a)),c[e].pq_hidden&&(e=d.getRootCell(n,t).rowIndxPage),!l&&r&&(t+=i&&i.colspan?i.colspan-1:0)),t=r?t+1:t-1,r&&t>=p||!r&&0>t){if(e==u)return null;e=this[r?"_incrRowIndx":"_decrRowIndx"](e),t=r?0:p-1}l=f[t]}while(l&&l.hidden);return{rowIndxPage:e,colIndx:t}},p._incrEditIndx=function(e,t,r){var i,o=this.that,n=o.colModel,a=n.length,l=o.iMerge,s=o.rowIndxOffset,d=o[r?"getLastVisibleRIP":"getFirstVisibleRIP"]();do{var c=e+s,h=l.ismergedCell(c,t);if(h){var u=l.getData(c,t,"proxy_edit_cell");u&&(c=u.rowIndx,e=c-s),t=r?t+h.colspan:t-1}else t=r?t+1:t-1;if(r&&t>=a||!r&&0>t){if(e==d)return null;do{e=this[r?"_incrRowIndx":"_decrRowIndx"](e);var f=o.isEditableRow({rowIndxPage:e});if(e==d&&0==f)return null}while(0==f);t=r?0:a-1}if(c=e+s,h=l.ismergedCell(c,t)){var p=l.getRootCell(c,t,"o");l.setData(p.rowIndx,p.colIndx,{proxy_edit_cell:{rowIndx:c,colIndx:t}}),c=p.rowIndx,t=p.colIndx}i=n[t];var g=o.isEditableCell({rowIndx:c,colIndx:t,checkVisible:!0}),v=i.editor,v="function"==typeof v?v.call(o,o.normalize({rowIndx:c,colIndx:t})):v;e=c-s}while(i&&(i.hidden||0==g||v===!1));return{rowIndxPage:e,colIndx:t}},p.getMergeCell=function(e,t){var r,i,o=this.that,n=o.options,a=o.iMerge;return a.ismergedCell(e,t)&&(i=a.getRootCell(e,t,"o"),a.setData(i.rowIndx,i.colIndx,{proxy_cell:{rowIndx:e,colIndx:t}}),n.virtualY&&(r=a.getRootCell(e,t,"a"))),r||(e=this.getVisibleRowIndx(e),t=this.getVisibleColIndx(t),r=o.normalize({rowIndx:e,colIndx:t})),r},p.getVisibleRowIndx=function(e){for(var t=this.that,r=t.pdata,i=r.length,o=t.rowIndxOffset,n=e-o,a=t.getRowData({rowIndx:e});a.pq_hidden&&i-1>n;)n++,e++,a=t.getRowData({rowIndx:e});return e},p.getVisibleColIndx=function(e){for(var t=this.that,r=t.colModel,i=r.length,o=r[e];o.hidden&&i-1>e;)e++,o=r[e];return e},d._onKeyPressDown=function(t){var r=e(t.target).closest(".pq-grid-header");if(r.length>0)return 0!=this._trigger("headerKeyDown",t,null);var i=this.iKeyNav._bodyKeyPressDown(t);return i===!1?!1:0==this._trigger("keyDown",t,null)?!1:void 0},p._saveAndMove=function(e,t){if(null==e)return t.preventDefault(),!1;var r=this.that,i=e.rowIndxPage,o=e.colIndx;if(r._blurEditMode=!0,r.saveEditCell({evt:t})===!1||!r.pdata)return r.pdata||r.quitEditMode(t),r._deleteBlurEditMode({timer:!0,msg:"_saveAndMove saveEditCell"}),t.preventDefault(),!1;if(r.quitEditMode(t),e.incr){var n=this[e.edit?"_incrEditIndx":"_incrIndx"](i,o,!t.shiftKey);i=n?n.rowIndxPage:i,o=n?n.colIndx:o}r.scrollRow({rowIndxPage:i}),r.scrollColumn({colIndx:o});var a=i+r.rowIndxOffset;return this.select({rowIndx:a,colIndx:o,evt:t}),e.edit&&r._editCell({rowIndxPage:i,colIndx:o}),r._deleteBlurEditMode({timer:!0,msg:"_saveAndMove"}),t.preventDefault(),!1},p._keyPressInEdit=function(t,r){var i=this.that,o=i.options,n=o.editModel.indices,a=r||{},l=a.FK,s=n.column,d=e.ui.keyCode,c=["BACKSPACE","LEFT","RIGHT","UP","DOWN","DELETE","HOME","END"].map(function(e){return d[e]}),h=s.dataType;if(e.inArray(t.keyCode,c)>=0)return!0;if(i._trigger("editorKeyPress",t,e.extend({},n))===!1)return!1;if(l&&("float"==h||"integer"==h)){var u="float"==h?"0123456789.-":"0123456789-",f=t.charCode||t.keyCode,p=String.fromCharCode(f);if(p&&-1==u.indexOf(p))return!1}return!0},p.getValText=function(t){var r=t[0].nodeName.toLowerCase(),i=["input","textarea","select"],o="text";return-1!=e.inArray(r,i)&&(o="val"),o},p._keyUpInEdit=function(t,r){var i=this.that,o=i.options,r=r?r:{},n=r.FK,a=o.editModel,l=a.indices;i._trigger("editorKeyUp",t,e.extend({},l));var s=l.column,d=s.dataType;if(n&&("float"==d||"integer"==d)){var c=e(t.target),h="integer"==d?a.reInt:a.reFloat,u=this.getValText(c),f=c.data("oldVal"),p=c[u]();if(0==h.test(p))if(h.test(f))c[u](f);else{var g="float"==d?parseFloat(f):parseInt(f);isNaN(g)?c[u](0):c[u](g)}}},p._keyDownInEdit=function(t){var r=this.that,i=r.options,o=i.editModel.indices;if(o){var n=e(t.target),a=e.ui.keyCode,l=i.editModel,s=e.extend({},o),d=s.rowIndxPage,c=s.colIndx,h=s.column,u=h.editModel,f=u?e.extend({},l,u):l,p=this.getValText(n);if(n.data("oldVal",n[p]()),0==r._trigger("editorKeyDown",t,s))return!1;if(t.keyCode==a.TAB||t.keyCode==f.saveKey){var g=t.keyCode==a.TAB?f.onTab:f.onSave,s={rowIndxPage:d,colIndx:c,incr:!!g,edit:"nextEdit"==g};return this._saveAndMove(s,t)}if(t.keyCode==a.ESCAPE)return r.quitEditMode({evt:t}),r.focus({rowIndxPage:d,colIndx:c}),t.preventDefault(),!1;if(t.keyCode==a.PAGE_UP||t.keyCode==a.PAGE_DOWN)return t.preventDefault(),!1;if(f.keyUpDown&&!t.altKey){if(t.keyCode==a.DOWN){var s=this._incrRowIndx2(d,c);return this._saveAndMove(s,t)}if(t.keyCode==a.UP){var s=this._decrRowIndx2(d,c);return this._saveAndMove(s,t)}}}},p.select=function(t){var r=this.that,i=this,o=t.rowIndx,n=t.colIndx,a=t.evt,t=this.getMergeCell(o,n),o=t.rowIndx,n=t.colIndx,l=t.rowIndxPage,s=r.options,d=r.iSelection,c=s.selectionModel,h=c.type,u="row"==h,f="cell"==h,p=s.realFocus?function(e){clearTimeout(i.timeoutID),i.timeoutID=setTimeout(function(){e()},0)}:function(e){e()};p(function(){r.scrollCell({rowIndx:o,colIndx:n});var t=d.address();if(a.shiftKey&&a.keyCode!==e.ui.keyCode.TAB&&c.type&&"single"!=c.mode&&t.length){var i=t[t.length-1],s=i.firstR,h=i.firstC,p=i.type,g=!1;"column"==p?(i.c1=h,i.c2=n,i.r1=i.r2=i.type=void 0):"row"==p?(i.r1=s,i.r2=o,i.c1=i.c2=i.type=void 0):(t={r1:s,r2:o,c1:h,c2:n,firstR:s,firstC:h},g=!0),r.range(t,g).select()}else u?r.range({r1:o,firstR:o},!1).select():f&&r.range({r1:o,c1:n,firstR:o,firstC:n}).select();r.focus({rowIndxPage:l,colIndx:n})})},p._bodyKeyPressDown=function(t){var r,i,o,r,o,n=this.that,a=n.rowIndxOffset,l=this.options,s=n.iMerge,d=n._focusElement,c=(n.colModel,l.selectionModel),h=l.editModel,u=t.ctrlKey||t.metaKey,f=e.ui.keyCode,p=t.keyCode;if(h.indices)return void n.$div_focus.find(".pq-cell-focus").focus();if(d){var g=document.activeElement;if("pq-grid-cont"!=g.className&&"TD"!=g.nodeName.toUpperCase()&&"pq-grid-excel"!=g.id)return}else{var v=e(t.target);if(!v.hasClass("pq-grid-cell"))return;d=n.getCellIndices({$td:v})}var w,m,x=n.normalize(d),i=x.rowIndxPage,r=x.rowIndx,o=x.colIndx,_=n.pdata,I=x,y=!0;if(null!=r&&null!=o&&null!=x.rowData){if(s.ismergedCell(r,o)&&(I=s.getRootCell(r,o,"o"),x=I,i=x.rowIndxPage,r=x.rowIndx,o=x.colIndx,p!=f.PAGE_UP&&p!=f.PAGE_DOWN&&p!=f.SPACE&&p!=f.HOME&&p!=f.END||(w=s.getData(r,o,"proxy_cell"))&&(m=w.rowIndx-a,_[m].pq_hidden||(i=m,r=i+a))),0==n._trigger("cellKeyDown",t,I))return!1;if(p==f.LEFT||p==f.RIGHT||p==f.UP||p==f.DOWN||c.onTab&&p==f.TAB){var b=null;p==f.LEFT||p==f.TAB&&t.shiftKey?b=this._incrIndx(i,o,!1):p==f.RIGHT||p==f.TAB&&!t.shiftKey?b=this._incrIndx(i,o,!0):p==f.UP?b=this._decrRowIndx2(i,o):p==f.DOWN&&(b=this._incrRowIndx2(i,o)),b&&(r=b.rowIndxPage+a,this.select({rowIndx:r,colIndx:b.colIndx,evt:t}))}else if(p==f.PAGE_DOWN||p==f.SPACE||p==f.PAGE_UP){var C=p==f.PAGE_UP?"pageUp":"pageDown",q=this[C](i);q&&(i=q.rowIndxPage,null!=i&&(r=i+a,this.select({rowIndx:r,colIndx:o,evt:t})))}else if(p==f.HOME)u?r=n.getFirstVisibleRIP()+a:o=n.getFirstVisibleCI(),this.select({rowIndx:r,colIndx:o,evt:t});else if(p==f.END)u?r=n.getLastVisibleRIP()+a:o=n.getLastVisibleCI(),this.select({rowIndx:r,colIndx:o,evt:t});else if(p==f.ENTER){i=I.rowIndxPage,o=I.colIndx;var M=n.getCell({rowIndxPage:i,colIndx:o});if(M&&M.length>0){var r=i+a,D=n.isEditableRow({rowIndx:r}),R=n.isEditableCell({rowIndx:r,colIndx:o});if(D&&R)n.editCell({rowIndxPage:i,colIndx:o});else{var P=M.find("button");P.length&&e(P[0]).click()}}}else if(u&&"65"==p){var T=n.iSelection;"row"==c.type&&"single"!=c.mode?T.selectAll({type:"row",all:c.all}):"cell"==c.type&&"single"!=c.mode&&T.selectAll({type:"cell",all:c.all})}else if(h.pressToEdit&&(p>=32&&127>=p||189==p)&&!u)if(46==p)n.clear();else{i=I.rowIndxPage,o=I.colIndx;var M=n.getCell({rowIndxPage:i,colIndx:o});if(M&&M.length>0){var r=i+a,D=n.isEditableRow({rowIndx:r}),R=n.isEditableCell({rowIndx:r,colIndx:o});D&&R&&n.editCell({rowIndxPage:i,colIndx:o,select:!0})}y=!1}else y=!1;y&&t.preventDefault()}},p.incrPageSize=function(){for(var t=this.that,r=t.$tbl,i=r.children("tbody").children(".pq-grid-row"),o=parseInt(r.css("marginTop")),n=t.iRefresh.getEContHt()-o,a=i.length-1;a>=0;a--){var l=i[a];if(l.offsetTop<n)break}var s=t.getRowIndx({$tr:e(l)}).rowIndxPage;return{rowIndxPage:s}},p.pageNonVirtual=function(t,r){var i,o=this.that,n=o.$cont[0].offsetHeight-o._getSBHeight(),a=o.getRow({rowIndxPage:t}),l=0,s=0,d=e(a[0])[r]("tr.pq-grid-row"),c=d.length;if(c>0){do{i=d[s];var h=i.offsetHeight;if(l+=h,l>=n)break;s++}while(c>s);s=s>0?s-1:s;do{var a=e(d[s]);if(t=o.getRowIndx({$tr:a}).rowIndxPage,null!=t)break;s--}while(s>=0)}return t},p.pageDown=function(e){var t=this.that,r=t.options,i=t.vscroll,o=i.option("cur_pos"),n=i.option("num_eles"),a=i.option("ratio");if(r.virtualY){if(n-1>o){var e=this.incrPageSize().rowIndxPage,l=t._calcCurPosFromRowIndxPage(e);if(null==l)return;i.option("cur_pos",l),i.scroll()}}else if(null!=e)e=this.pageNonVirtual(e,"nextAll");else if(1>a){var s=t.iRefresh.getEContHt(),d=t.iMouseSelection;d.updateTableY(-1*s),d.syncScrollBarVert()}return{rowIndxPage:e,curPos:l}},p.pageUp=function(e){var t=this.that,r=t.options,i=t.vscroll;if(r.virtualY){var o=i.option("cur_pos");if(o>0){var e=this.decrPageSize().rowIndxPage,n=t._calcCurPosFromRowIndxPage(e);if(null==n)return;i.option("cur_pos",n),i.scroll()}}else{var a=i.option("ratio");if(null!=e)e=this.pageNonVirtual(e,"prevAll");else if(a>0){var l=t.iRefresh.getEContHt(),s=t.iMouseSelection;s.updateTableY(l),s.syncScrollBarVert()}}return{rowIndxPage:e,curPos:n}},p.decrPageSize=function(){var t,r=this.that,i=r.$tbl,o=i.children("tbody").children(".pq-grid-row"),n=r.options.freezeRows,a=r.pdata,l=0;if(o.length){var s;if(n?(s=o.filter("tr.pq-last-frozen-row"),s.length&&(s=s.next())):o.length>=2&&(s=e(o[1])),s&&s.length)for(var l=r.getRowIndx({$tr:s}).rowIndxPage,t=l,d=0,c=r.pageSize-3,h=l;h>=0;h--){var u=a[h];if(!u.pq_hidden&&(d++,t=h,d>=c))break}}return{rowIndxPage:t}},d._calcNumHiddenFrozens=function(){for(var e=0,t=this.options.freezeCols,r=0;t>r;r++)this.colModel[r].hidden&&e++;return e},d._calcNumHiddenUnFrozens=function(e){for(var t=0,r=this.options.freezeCols,i=null!=e?e:this.colModel.length,o=r;i>o;o++)this.colModel[o].hidden&&t++;return t},d._getSBHeight=function(){return this.iRefresh.getSBHeight()},d._getSBWidth=function(){return this.iRefresh.getSBWidth()},d.getFirstVisibleRIP=function(e){for(var t=this.pdata,r=e?this.initV:0,i=t.length;i>r;r++)if(!t[r].pq_hidden)return r},d.getLastVisibleRIP=function(){for(var e=this.pdata,t=e.length-1;t>=0;t--)if(!e[t].pq_hidden)return t;return null},d.getFirstVisibleCI=function(e){for(var t=this.colModel,r=t.length,i=e?this.initH:0;r>i;i++){var o=t[i].hidden;if(!o)return i}return null},d.getLastVisibleCI=function(){for(var e=this.colModel,t=e.length,r=t-1;r>=0;r--){var i=e[r].hidden;if(!i)return r}return null},d.getTotalVisibleColumns=function(){for(var e=this.colModel,t=e.length,r=0,i=0;t>i;i++){var o=e[i],n=o.hidden;n||r++}return r},d._calcCurPosFromRowIndxPage=function(e){var t=this.options,r=this.pdata,i=t.freezeRows;if(i>e)return 0;for(var o=0,n=i,a=i,l=r.length;l>a;a++){var s=r[a];if(n==e)break;n++;var d=s.pq_hidden;d||o++}return o>=l?null:o},d._calcCurPosFromColIndx=function(e){var t=this.options,r=this.colModel,i=t.freezeCols;if(i>e)return 0;for(var o=0,n=i,a=i,l=r.length;l>a;a++){var s=r[a];if(n==e)break;n++;var d=s.hidden;d||o++}return o>=l?null:o},d.calcWidthCols=function(e,t,r){var i=0,o=this.options,n=0,a=o.numberCell,l=this.colModel;if(-1==e&&(a.show&&(i+=r?1*a.width:a.outerWidth),e=0),r)for(var s=e;t>s;s++){var d=l[s];if(d&&!d.hidden){if(!d._width)throw"assert failed";i+=d._width+n}}else for(var s=e;t>s;s++){var d=l[s];d&&!d.hidden&&(i+=d.outerWidth)}return i},d.calcHeightFrozenRows=function(){var t=this.$tbl,r=0;if(t&&t.length){var i=e(t[0]).find("tr.pq-last-frozen-row");if(i&&i.length){var o=i[0];r=o.offsetTop+o.offsetHeight}}return r},d._calcRightEdgeCol=function(e){var t=0,r=0,i=this.colModel,o=this.initH,n=this.options,a=n.freezeCols,l=n.numberCell;l.show&&(t+=l.outerWidth,r++);for(var s=0;e>=s;s++){o>s&&s>=a&&(s=o);var d=i[s];d.hidden||(t+=d.outerWidth,r++)}return{width:t,cols:r}},d._createHeader=function(){this.iHeader.createHeader(),this.options.showHeader&&this._trigger("createHeader")},d.createTable=function(e){e.other=!0;var t=this.iGenerateView;t.generateView(e),t.scrollView()}}(jQuery),function(e){function t(e){this.that=e}function r(e,t,r){for(var i=e[t],o=0;o<i.length;o++)if(i[o]==r)return o}function i(e,t,r){for(var i=0,o=t;r>o;o++){var n=e[o];n.hidden!==!0&&i++}return i}function o(e,t,r){for(var i,o;r&&(i=e[r][t],o=e[r-1][t],i==o);)r--;return r}var n=e.paramquery,a=n._pqGrid.prototype;a.getHeadCell=function(e){var t,r,i,o,n=e.attr("pq-col-indx"),a=e.attr("pq-row-indx");return null!=n&&null!=a&&(n=1*n,a=1*a,r=this.headerCells[a][n],r&&(o=r.colModel,i=r.leftPos)),o&&o.length&&(t=!0),{col:r,ci:n,o_ci:i,ri:a,isParent:t}},a.flex=function(e){this.iResizeColumns.flex(e)},n.cHeader=t;var l=t.prototype;l.createHeader=function(){var t=this.that,r=this,i=t.options,o=i.bootstrap,n=(o.on?o.thead:"")+" pq-grid-header-table ",a=i.ui,l=o.on?"":a.header,s=i.hwrap,d=t.pqpanes,c=parseInt(i.freezeCols),h=i.numberCell,u=t.colModel,f=i.sortModel,p=t.depth,g=i.virtualX,v=t.iGenerateView.colDef,w=t.initH,m=t.finalH,x=t.headerCells,_=t.$header_o;if(_.empty(),null!=m){if(i.showHeader===!1)return void _.css("display","none");_.css("display",""),n+=s?"pq-wrap ":"pq-no-wrap ";var I=["<table class='"+n+"' >"];if(p>=1){I.push("<tr class='pq-row-hidden'>"),h.show&&I.push("<td style='width:"+h.width+"px;' ></td>");for(var y=0,b=v.length;b>y;y++){var C=v[y],q=C.colIndx,M=C.column,D=M.outerWidth;I.push("<td style='width:"+D+"px;' pq-col-indx="+q+"></td>")}I.push("</tr>")}for(var R="pq-grid-col ",P=0;p>P;P++){I.push("<tr class='pq-grid-title-row'>"),0==P&&h.show&&I.push(["<th pq-col-indx='-1' class='pq-grid-number-col' rowspan='",p,"'>","<div class='pq-td-div'>",h.title?h.title:" ","</div></th>"].join(""));for(var q=0;m>=q;q++){if(w>q&&q>=c&&g&&(q=w,q>m))throw"initH>finalH";r.createHeaderCell(P,q,x,I,R,c,w,p,f)}I.push("</tr>")}t.ovCreateHeader(I,R),I.push("</table>");var T=I.join("");d.vH?_[0].innerHTML=["<span class='pq-grid-header pq-grid-header-left ",l,"'>","<div class='pq-grid-header-inner'>",T,"</div>","</span>","<span class='pq-grid-header ",l,"'>","<div class='pq-grid-header-inner'>",T,"</div>","</span>"].join(""):_[0].innerHTML=["<span class='pq-grid-header ",l,"'>","<div class='pq-grid-header-inner'>",T,"</div>","</span>"].join("");var k=t.$header=_.children(".pq-grid-header"),S=k.children(".pq-grid-header-inner");t.$tbl_header=S.children("table"),t.$header_left=e(k[0]),t.$header_left_inner=e(S[0]),d.vH&&(t.$header_right=e(k[1]),t.$header_right_inner=e(S[1])),k.click(function(e){return r._onHeaderClick(e)}),r._refreshResizeColumn(w,m,u),t._trigger("refreshHeader",null,null)}},l._onHeaderClick=function(t){var r,i,o,n=this,a=this.that,l=a.iDragColumns;if(!l||"stop"==l.status){var s=e(t.target);return s.is("input,label")?!0:(r=s.closest(".pq-grid-col"),r.length&&(o=a.getHeadCell(r),i=o.col,i&&!o.isParent)?n._onHeaderCellClick(i,o.ci,t):void 0)}},l.createHeaderCell=function(e,t,o,a,l,s,d,c,h){var u=this.that,f=u.options.sheet,p=o[e][t],g=u.colModel,v=p.colSpan;if(!(p.hidden||0===v||e>0&&p==o[e-1][t])){if(t>0&&p==o[e][t-1]){if(t>d)return;var w=r(o,e,p);if(s>w)return;v-=i(g,w,t)}else if(s&&s>t&&t+v>s){var m=v-i(g,s,d),x=i(g,t,s);v=Math.max(m,x)}var _=p.halign||p.align,I=p.cls,y=[l],b=p.title,C=p.type,b="function"==typeof b?b.call(u,{column:p,colIndx:t,dataIndx:p.dataIndx}):b,b=f?n.toLetter(t):b,b=null!=b?b:"checkbox"==C&&p.cb.header?"<input type='checkbox'/>":p.dataIndx;p.pqtitle=b,_&&y.push("pq-align-"+_),t==s-1&&1==c&&y.push("pq-last-frozen-col"),s-1>=t?y.push("pq-left-col"):t>=d&&y.push("pq-right-col"),I&&y.push(I);var q="";null!=p.colModel&&0!=p.colModel.length||y.push("pq-grid-col-leaf");var M="pq-row-indx="+e,D="pq-col-indx="+t,R=h.space?"pq-space":"";a.push(["<th ",q," ",D," ",M," "," class='",y.join(" "),"' rowspan=",p.rowSpan," colspan=",v,">","<div class='pq-td-div'>",b,"<span class='pq-col-sort-icon ",R,"'></span>",h.number?"<span class='pq-col-sort-count "+R+"'></span>":"","</div></th>"].join(""))}},l._onHeaderCellClick=function(e,t,r){var i=this.that,o=i.options,n=o.sortModel,a=e.dataIndx;if(i._trigger("headerCellClick",r,{column:e,colIndx:t,dataIndx:a})!==!1){if(o.selectionModel.column&&-1==r.target.className.indexOf("pq-td-div")){var l={c1:t,firstC:t},s=i.iSelection.address();if(r.shiftKey){var d=s.length;if(d&&"column"==s[d-1].type){var c=s[d-1];c.c1=c.firstC,c.c2=t,c.r1=c.r2=c.type=void 0}l=s}return i.range(l,!1).select(),void i.focus({rowIndxPage:i.getFirstVisibleRIP(!0),colIndx:t})}n.on&&0!=e.sortable&&i.sort({sorter:[{dataIndx:a}],addon:!0,tempMultiple:n.multiKey&&r[n.multiKey],evt:r})}},l._refreshResizeColumn=function(e,t,r){var i=this.that,o=i.options,n=!!o.filterModel.ficon,a=o.numberCell,l=parseInt(o.freezeCols),s=[],d=[],c=i.pqpanes.vH,h=0,u=0;a.show&&(h=a.outerWidth,a.resizable&&(u=h-5,s.push("<div pq-col-indx='-1' style='left:",u,"px;'"," class='pq-grid-col-resize-handle'> </div>")));for(var f=i.iGenerateView.colDef,p=0,g=f.length;g>p;p++){var v=f[p],w=v.colIndx,m=v.column,x=m.ficon,_=x||null==x&&n,I=s;h+=m.outerWidth,(m.resizable!==!1||_)&&(c&&w>=l&&(I=d),u=h-5,I.push("<div pq-col-indx='",w,"' style='left:",u,"px;'"," class='pq-grid-col-resize-handle'> </div>"))}d.length&&i.$header_right_inner.append(d.join("")),i.$header_left_inner.append(s.join(""))},l.refreshHeaderSortIcons=function(){var e=this.that,t=e.options,r=t.bootstrap,i=(t.ui,e.$header);if(i){var o=e.iSort.getSorter(),n=o.length,a=!1,l=e.options.sortModel;l.number&&n>1&&(a=!0);for(var s=0;n>s;s++){var d=o[s],c=d.dataIndx,h=e.getColIndx({dataIndx:c}),u=d.dir,f=" pq-col-sort-"+("up"==u?"asc":"desc"),p=r.on?" glyphicon glyphicon-arrow-"+u:"ui-icon ui-icon-triangle-1-"+("up"==u?"n":"s"),g=i.find(".pq-grid-col-leaf[pq-col-indx="+h+"]");g.addClass(f),g.find(".pq-col-sort-icon").addClass(p),a&&g.find(".pq-col-sort-count").html(s+1)}}};var s=function(t){this.that=t;var r=this;t.$header_o.on({mousedown:function(t){if(!t.pq_composed){var i=e(t.target);r.setDraggables(t),t.pq_composed=!0;var o=e.Event("mousedown",t);i.trigger(o)}},dblclick:function(e){r.doubleClick(e)}},".pq-grid-col-resize-handle");var i=t.options,o=i.flex;o.on&&o.one&&t.one("ready",function(){r.flex()})};n.cResizeColumns=s;var d=s.prototype=new n.cClass;d.doubleClick=function(t){var r=this.that,i=r.options,o=i.flex,n=e(t.target),a=parseInt(n.attr("pq-col-indx"));isNaN(a)||o.on&&this.flex(o.all&&!i.scrollModel.autoFit?{}:{colIndx:[a]})},d._initFlexTable=function(t,r){if(t.length){var i,o=t.css({tableLayout:"auto",width:""}).addClass("pq-no-wrap").removeClass("pq-wrap").children("tbody").children(".pq-row-hidden"),n=o.children("td").css("width","");if(r){var a,l=o.next().children("td"),s=0,d=[],c=[];l.each(function(e,t){if(a=1*t.getAttribute("colspan"),a>1&&(s+=a-1,d[s]=t.offsetWidth,i=n[s],!i||!i.offsetWidth))for(var r=s-(a-1);s>r;r++)c[r]=!0;s++})}}return[n||e(),c||[],d]},d.flex=function(t){t=t||{};var r,i=this.that,o=i.options,n=i.element,a=o.numberCell,l=t.colIndx,s=t.dataIndx,d=null==t.refresh?!0:t.refresh,c=!1,h=0,u=i.$tbl,f=i.$tbl_header,p=u&&u.length?e(u[0]).clone():e(),g=i.tables&&i.tables.length?i.tables[0].$tbl:null,g=g?e(g[0]).clone():e(),v=f&&f.length?e(f[0]).clone():e(),w=p.find(".pq-merge-cell");if(w.each(function(t,r){r.innerHTML=e(r).find(".pq-merge-inner")[0].innerHTML,r.style.whiteSpace="noWrap"}),null!=s){l=[];for(var m=0,x=s.length;x>m;m++){var _=i.colIndxs[s[m]];null!=_&&l.push(_)}}null!=l&&(l.sort(function(e,t){return e-t}),r=l.length),v.find("tr.pq-grid-header-search-row").remove();var I=e("<div class='pq-grid'>").append(v).append(g).append(p);I.addClass(n.attr("class")),n.parent().append(I);for(var y=this._initFlexTable(p,!0),b=y[0],C=y[1],q=y[2],M=0,D=this._initFlexTable(g)[0],R=this._initFlexTable(v)[0],P=a.show?0:-1,T=i.iGenerateView.colDef,m=0,x=T.length;x>m;m++){var k=T[m],S=k.colIndx,H=k.column;if(P++,l){if(!l.length)break;if(l[0]!==S)continue;l.splice(0,1)}var E=b[P],$=R[P],V=D[P],z=C[P],W=E?E.offsetWidth:0,L=V?V.offsetWidth:0,A=$?$.offsetWidth:0;z?W=0:M&&(W=q[P]-M,M=0);var F=Math.max(W,L,A)-h+1;z&&(M+=F),H._width!==F&&(c=!0,H.width=F,1===r&&(H._resized=!0))}I.remove(),c&&d&&i.refresh({source:"flex",colModel:!0})},d.setDraggables=function(t){var r,i,o,n=e(t.target),a=(this.that,this);n.draggable({axis:"x",helper:function(t,r){var i=e(t.target),o=parseInt(i.attr("pq-col-indx"));return a._setDragLimits(o),a._getDragHelper(t,r),i},start:function(e,t){r=t.position.left,o=parseInt(a.$cl[0].style.left)},drag:function(e,t){i=t.position.left;var n=i-r;a.$cl[0].style.left=o+n+"px"},stop:function(e,t){return a.resizeStop(e,t,r)}})},d._getDragHelper=function(t){var r=this.that,i=r.options,o=parseInt(i.freezeCols),n=e(t.target),a=r.$grid_center,l=parseInt(n.attr("pq-col-indx")),s=a.outerHeight();this.$cl=e("<div class='pq-grid-drag-bar'></div>").appendTo(a),this.$clleft=e("<div class='pq-grid-drag-bar'></div>").appendTo(a),this.$cl.height(s),this.$clleft.height(s);var d=e("[pq-col-indx="+l+"]",r.$header)[0],c=d.offsetLeft;r.pqpanes.vH?l>=o&&(c-=r.$header[1].scrollLeft):(c+=r.$header[0].offsetLeft,c-=r.$header[0].scrollLeft),this.$clleft.css({left:c}),c+=d.offsetWidth,this.$cl.css({left:c})},d._setDragLimits=function(e){if(!(0>e)){var t=this.that,r=t.colModel,i=r[e],o=t.options,n=(o.numberCell,t.$header_left);e>=o.freezeCols&&t.pqpanes.vH&&(n=t.$header_right);var a=n.find("th[pq-col-indx='"+e+"']"),l=a.offset().left+i._minWidth,s=l+i._maxWidth-i._minWidth,d=n.find("div.pq-grid-col-resize-handle[pq-col-indx="+e+"]");d.draggable("option","containment",[l,0,s,0])}},d.resizeStop=function(t,r,i){var o=this.that,n=o.colModel,a=o.options,l=this,s=a.numberCell;l.$clleft.remove(),l.$cl.remove();var d,c=r.position.left,h=c-i,u=e(r.helper),f=parseInt(u.attr("pq-col-indx"));if(-1==f){d=null;var p=parseInt(s.width),g=p+h;s.width=g}else{d=n[f];var p=parseInt(d.width),g=p+h;d.width=g,d._resized=!0}o.refresh(),o._trigger("columnResize",t,{colIndx:f,column:d,dataIndx:d?d.dataIndx:null,oldWidth:p,newWidth:d?d.width:s.width})};var c=function(t){var r=this;r.that=t,r.$drag_helper=null;var i=t.options.dragColumns,o=i.topIcon,n=i.bottomIcon;r.status="stop",r.$arrowTop=e("<div class='pq-arrow-down ui-icon "+o+"'></div>").appendTo(t.element),r.$arrowBottom=e("<div class='pq-arrow-up ui-icon "+n+"' ></div>").appendTo(t.element),r.hideArrows(),i&&i.enabled&&t.$header_o.on("mousedown",".pq-grid-col",r.onColMouseDown(r,t))};n.cDragColumns=c;var h=c.prototype;h.onColMouseDown=function(t,r){return function(i){var o,n,a,l,s=e(this);if(!i.pq_composed){if(e(i.target).is("input,select,textarea"))return;if(o=r.getHeadCell(s),n=o.col,a=n?n.parent:null,!n||n.nodrag||n._nodrag||a&&1==a.colSpan)return;t.setDraggable(i,n,o)&&(i.pq_composed=!0,l=e.Event("mousedown",i),e(i.target).trigger(l))}}},h.showFeedback=function(e,t){var r=this.that,i=e[0],o=i.offsetParent.offsetParent,n=r.$grid_center[0].offsetTop,a=i.offsetLeft-o.offsetParent.scrollLeft+(t?0:i.offsetWidth)-8,l=n+i.offsetTop-16,s=n+r.$header[0].offsetHeight;this.$arrowTop.css({left:a,top:l,display:""}),this.$arrowBottom.css({left:a,top:s,display:""})},h.showArrows=function(){this.$arrowTop.show(),this.$arrowBottom.show()},h.hideArrows=function(){this.$arrowTop.hide(),this.$arrowBottom.hide()},h.updateDragHelper=function(e){var t=this.that,r=t.options.dragColumns,i=r.acceptIcon,o=r.rejectIcon,n=this.$drag_helper;n&&(e?(n.children("span.pq-drag-icon").addClass(i).removeClass(o),n.removeClass("ui-state-error")):(n.children("span.pq-drag-icon").removeClass(i).addClass(o),n.addClass("ui-state-error")))},h.setDraggable=function(t,r,i){var o=e(t.currentTarget),n=this,a=n.that;return o.hasClass("ui-draggable")?void 0:(o.draggable({distance:10,cursorAt:{top:-18,left:-10},zIndex:"1000",appendTo:a.element,revert:"invalid",helper:n.dragHelper(n,a,r),start:n.onStart(n,a,r,i),drag:n.onDrag(n,a),stop:function(){a.element&&(n.status="stop",a.$header.find(".pq-grid-col-resize-handle").show(),n.hideArrows())}}),!0)},h.onStart=function(e,t,r,i){return function(o){return t._trigger("columnDrag",o.originalEvent,{column:r})===!1?!1:void e.setDroppables(i)}},h.onDrag=function(t,r){return function(i,o){t.status="drag";var n=e(".pq-drop-hover",r.$header);if(n.length>0){t.showArrows(),t.updateDragHelper(!0);var a=n.width(),l=i.clientX-n.offset().left+e(document).scrollLeft();a/2>l?(t.leftDrop=!0,t.showFeedback(n,!0)):(t.leftDrop=!1,t.showFeedback(n,!1))}else{t.hideArrows();var s=e(".pq-drop-hover",r.$top);s.length?t.updateDragHelper(!0):t.updateDragHelper()}}},h.dragHelper=function(t,r,i){var o=r.options.dragColumns.rejectIcon;return function(){t.status="helper",r.$header.find(".pq-grid-col-resize-handle").hide();var n=e("<div class='pq-col-drag-helper ui-widget-content ui-corner-all panel panel-default' ><span class='pq-drag-icon ui-icon "+o+" glyphicon glyphicon-remove'></span>"+i.pqtitle+"</div>");return t.$drag_helper=n,n[0]}},h._columnIndexOf=function(e,t){for(var r=0,i=e.length;i>r;r++)if(e[r]==t)return r;return-1},h.setDroppables=function(t){var r,i,o,n,a,l,s,d=this,c=d.that,h=t.col,u=t.ri,f=t.o_ci,p=f+h.o_colspan,g=c.$header_left,v=d.onDrop(),w={hoverClass:"pq-drop-hover ui-state-highlight",accept:".pq-grid-col",tolerance:"pointer",drop:v},m=g.find(".pq-left-col"),x=c.pqpanes.v||c.pqpanes.vH?c.$header_right.find(".pq-right-col"):g.find(".pq-right-col");for(m=m.add(x),s=m.length;s--;)a=e(m[s]),l=a.hasClass("ui-droppable"),r=c.getHeadCell(a),n=r.col,i=r.ri,o=r.ci,n==h||n.nodrop||n._nodrop||i>u&&o>=f&&p>o?l&&a.droppable("destroy"):l||a.droppable(w)},h.onDrop=function(){var t=this,r=this.that;return function(i,o){if(!t.dropPending){var n=1*o.draggable.attr("pq-col-indx"),a=1*o.draggable.attr("pq-row-indx"),l=e(this),s=1*l.attr("pq-col-indx"),d=1*l.attr("pq-row-indx"),c=t.leftDrop,h=t.moveColumn(n,s,c,a,d);t.dropPending=!0,window.setTimeout(function(){r.iColModel.init();var e=r._trigger("columnOrder",null,{dataIndx:h.dataIndx,column:h,oldcolIndx:n,colIndx:r.getColIndx({column:h})});e!==!1&&r.refresh(),t.dropPending=!1},0)}}},h.moveColumn=function(e,t,r,i,n){var a=this.that,l=this,s=a.options.colModel,d=a.headerCells,c=a.depth-1,i=null==i?o(d,e,c):i,n=null==n?o(d,t,c):n,h=d[i][e],u=d[n][t],f=i?d[i-1][e].colModel:s,p=n?d[n-1][t].colModel:s,g=l._columnIndexOf(f,h),v=r?1:0,w=f.splice(g,1)[0],m=l._columnIndexOf(p,u)+1-v;return p.splice(m,0,w),w}}(jQuery),function(e){function t(t,r){this.that=t;var i=this,o=t.options;this.type="detail",this.refreshComplete=!0,this.detachView=!1,t.on("cellClick",function(e,t){return i.toggle(e,t)}).on("cellKeyDown",function(t,r){return t.keyCode==e.ui.keyCode.ENTER?i.toggle(t,r):void 0}).on("refresh",function(e,t){return i.aftertable()}).on("beforeTableView",function(e,t){return i.beforeTableView(e,t)}).on("tableWidthChange",function(e,t){return i.tableWidthChange(e,t)}),r._render=function(e){var t,r=o.detailModel,i=e.cellData,n=e.rowData;if(!n.pq_gsummary&&!n.pq_gtitle)return t=i&&i.show?r.expandIcon:r.collapseIcon,"<div class='ui-icon "+t+"'></div>"}}e.paramquery.cHierarchy=t;var r=t.prototype=new e.paramquery.cClass;r.tableWidthChange=function(){if(this.refreshComplete){this.refreshComplete=!1;for(var t=this.that,r=t.$tbl.children("tbody").children("tr.pq-detail-child").children("td.pq-detail-child"),i=0,o=r.length;o>i;i++)for(var n=r[i],a=e(n),l=a.find(".pq-grid"),s=0,d=l.length;d>s;s++){var c=e(l[s]);c.is(":visible")&&c.pqGrid("onWindowResize")}this.refreshComplete=!0}},r.aftertable=function(t){var r=this.that,i=r.options.detailModel.init,o=r.pdata;if(this.refreshComplete){this.refreshComplete=!1,t=t?t:r.$tbl.children("tbody").children("tr.pq-detail-child");for(var n=0,a=t.length;a>n;n++){var l=t[n],s=e(l),d=s.attr("pq-row-indx"),c=o[d],h=!1,u=c.pq_detail.child;u||"function"==typeof i&&(h=!0,u=i.call(r.element[0],{rowData:c}),c.pq_detail.child=u,c.pq_detail.height=25);var f=s.children("td.pq-detail-child");f.append(u);for(var p=f.find(".pq-grid"),g=0,v=p.length;v>g;g++){var w=e(p[g]);h?w.hasClass("pq-pending-refresh")&&w.is(":visible")&&(w.removeClass("pq-pending-refresh"),w.pqGrid("refresh")):w.is(":visible")&&w.pqGrid("onWindowResize")}}this.refreshComplete=!0,this.detachView=!1}},r.beforeTableView=function(e,t){this.detachView||(this.detachInitView(),this.detachView=!0)},r.detachInitView=function(t){var r=this.that,i=r.$tbl;if(i&&i.length){t=t?t:i.children("tbody").children("tr.pq-detail-child");for(var o=0;o<t.length;o++){var n=t[o],a=e(n),l=a.children("td.pq-detail-child").children();l.detach()}}},r.toggle=function(e,t){var r=this.that,i=t.column,o=t.rowData,n=t.rowIndx,a=this.type;if(!o.pq_gtitle&&!o.pq_gsummary&&i&&i.type===a){var l="pq_detail",s={rowIndx:n,focus:!0};null==o[l]?r.rowExpand(s):o[l].show===!1?r.rowExpand(s):this.rowCollapse(s)}},r.rowExpand=function(e){
this.normalize(e);var t=this.that,r=t.options,i=e.rowData,o=e.rowIndx,n=e.rowIndxPage,a=r.detailModel,l="pq_detail";if(null!=i){if(t._trigger("beforeRowExpand",null,e)===!1)return!1;null==i[l]?i[l]={show:!0}:i[l].show===!1&&(i[l].show=!0),a.cache||this.rowInvalidate(e),t.refreshRow({rowIndx:o});var s=[];t.iGenerateView._generateDetailRow(i,n,s);var d=t.getRow({rowIndxPage:n});d.after(s.join("")),this.aftertable(d.next()),e.focus&&t.getCell({rowIndx:o,dataIndx:l}).attr("tabindex","0").focus(),e.scrollRow&&this.scrollRow({rowIndx:o})}},r.rowInvalidate=function(e){var t=this.that,r=t.getRowData(e),i="pq_detail",o=r[i],n=o?o.child:null;n&&(n.remove(),r[i].child=null,r[i].height=0)},r.normalize=function(e){var t=this.that,r=e.rowIndx,i=e.rowIndxPage,o=t.rowIndxOffset;e.rowIndx=null==r?i+o:r,e.rowIndxPage=null==i?r-o:i,e.rowData=t.getRowData(e)},r.rowCollapse=function(e){this.normalize(e);var t=this.that,r=t.options,i=e.rowData,o=e.rowIndx,n=e.rowIndxPage,a=r.detailModel,l="pq_detail";if(null!=i&&null!=i[l]&&i[l].show===!0){if(a.cache||this.rowInvalidate(e),i[l].show=!1,r.virtualY)t.refresh();else{var s=t.getRow({rowIndxPage:n}).next("tr.pq-detail-child");s.length&&(this.detachInitView(s),s.remove(),t.refreshRow({rowIndx:o})),e.focus&&t.getCell({rowIndx:o,dataIndx:l}).attr("tabindex","0").focus()}if(e.scrollRow){var o=e.rowIndx;this.scrollRow({rowIndx:o})}}}}(jQuery),function(e){function t(e,t){if(window.getComputedStyle)return getComputedStyle(e)[t];var r=e.currentStyle[t];return"auto"==r?0:r}var r=function(e){var t=this;t.that=e,e.on("dataReadyDone",function(){t.calcVisibleV()}).on("CMInit",function(){t.calcVisibleH()}).on("refresh",function(){t.summaryTable()})};e.paramquery.cRefresh=r;var i=r.prototype;i._computeOuterWidths=function(){for(var e=this.that,t=e.options,r=0,i=t.numberCell,o=e.colModel,n=o.length,a=0;n>a;a++){var l=o[a];l.outerWidth=l._width+r}i.show&&(i.outerWidth=i.width)},i.autoFit=function(){var e=this.that,t=e.colModel,r=t.length,i=e.calcWidthCols(-1,r,!0),o=this.contWd-this.getSBWidth();if(i!==o){for(var n,a=i-o,l=[],s=0;r>s;s++){var d=t[s],c=d._percent,h=(d.resizable!==!1,d._resized),u=d.hidden;if(!u&&!c&&!h){var f;0>a?(f=d._maxWidth-d._width,f&&l.push({availWd:-1*f,colIndx:s})):(f=d._width-d._minWidth,f&&l.push({availWd:f,colIndx:s}))}h&&(n=d,delete d._resized)}l.sort(function(e,t){return e.availWd>t.availWd?1:e.availWd<t.availWd?-1:0});for(var s=0,p=l.length;p>s;s++){var g,v=l[s],f=v.availWd,w=v.colIndx,m=Math.round(a/(p-s)),d=t[w],x=d._width;Math.abs(f)>Math.abs(m)?(g=x-m,a-=m):(g=x-f,a-=f),d.width=d._width=g}if(0!=a&&n){var g=n._width-a;g>n._maxWidth?g=n._maxWidth:g<n._minWidth&&(g=n._minWidth),n.width=n._width=g}}},i.autoLastColumn=function(){var e=this.that,t=e.options,r=0,i=e.colModel,o=i.length,n=t.freezeCols,a=this.contWd-this.getSBWidth(),l=e.calcWidthCols(-1,n,!0),s=a-l,d=!1,c=e.getLastVisibleCI();if(null!=c){var h=i[c];if(!h._percent){for(var u,f=h._width,p=h._minWidth,g=h._maxWidth,v=o-1;v>=n;v--){var w=i[v];if(!w.hidden){var m=w._width+r;if(s-=m,0>s){d=!0,u=f+s>=p?f+s:f+m+s;break}}}d||(u=f+s),u>g?u=g:p>u&&(u=p),h.width=h._width=u}}},i.numericVal=function(e,t){var r;return r=(e+"").indexOf("%")>-1?parseInt(e)*t/100:parseInt(e),Math.round(r)},i.refreshColumnWidths=function(e){e=e||{};var t=this.that,r=t.options,i=r.numberCell,o="flex"===r.width,n=0,a=t.colModel,l=r.scrollModel,s=l.lastColumn,d=l.autoFit,c=this.contWd,h=a.length,u=this.getSBWidth(),f=r._minColWidth,p=r._maxColWidth,g=0;i.show&&(i.width<i.minWidth&&(i.width=i.minWidth),g=i.outerWidth=i.width);var v=o?null:c-u-g,f=Math.floor(this.numericVal(f,v)),p=Math.ceil(this.numericVal(p,v)),w=0;if(!o&&5>v||isNaN(v)){if(r.debug)throw"availWidth N/A"}else{delete t.percentColumn;for(var m=0;h>m;m++){var x=a[m],_=x.hidden;if(!_){var I=x.width,y=(I+"").indexOf("%")>-1?!0:null,b=x.minWidth,C=x.maxWidth,b=b?this.numericVal(b,v):f,C=C?this.numericVal(C,v):p;if(b>C&&(C=b),void 0!=I){var q,M=0;!o&&y?(t.percentColumn=!0,x.resizable=!1,x._percent=!0,q=this.numericVal(I,v)-n,M=Math.floor(q),w+=q-M,w>=1&&(M+=1,w-=1)):I&&(M=parseInt(I)),b>M?M=b:!o&&M>C&&(M=C),x._width=M}else x._width=b;y||(x.width=x._width),x._minWidth=b,x._maxWidth=o?1e3:C}}o===!1&&e.refreshWidth!==!1&&(d&&this.autoFit(),"auto"===s&&r.virtualX&&this.autoLastColumn()),this._computeOuterWidths()}},i.estRowsInViewPort=function(){var e=Math.ceil(this.contHt/this.rowHt);return this.that.pageSize=e,e},i._refreshFrozenLine=function(){var t=this.that,r=t.options,i=r.numberCell,o=t.$cont_o,n=r.freezeBorders,a=r.freezeCols,l=r.freezeRows;if(this.$freezeLine&&this.$freezeLine.remove(),this.$freezeLineH&&this.$freezeLineH.remove(),n){if(a){var s=t.calcWidthCols(-1,a);isNaN(s)||0===s||s>0&&i.show&&s===i.width||(this.$freezeLine=e(["<div class='pqg-vert-frozen-line' "," style = 'left:",s-1,"px;' >","</div>"].join("")).appendTo(o))}if(l){var d=t.$tbl;if(d){var c=d.children("tbody").children(".pq-last-frozen-row")[0];if(c){var h=c.offsetTop+c.offsetHeight-1;this.$freezeLineH=e("<div class='pqg-horiz-frozen-line' style='top:"+(h-1)+"px;' ></div>").appendTo(o)}}}}},i.setScrollVNumEles=function(t){t=t||{};var r=this.that,i=r.vscroll,o=r.options;if(!o.maxHeight&&"flex"===o.height)return i.option("num_eles",0),0;var n,a,l=!!r.iHierarchy,s=parseInt(i.option("num_eles")),d=parseInt(i.option("cur_pos")),c=this.getEContHt(),h=r.pdata,u=h?r.totalVisibleRows:0,f=0;if(r.$tbl&&r.$tbl.length>0&&(n=r.$tbl[r.$tbl.length-1],f=n.scrollHeight,a=e(n)),f>0){for(var p=a.children().children("tr"),g=0,v=0,w=1;w<p.length;w++){var m=p[w];if(g+=m.offsetHeight,g>=c){l&&e(m).hasClass("pq-detail-child")&&(v=v>1?v-1:1);break}l?e(m).hasClass("pq-detail-child")===!1&&v++:v++}s=u-v+1}else s=d+1;return s>u&&(s=u),g>c&&l&&s++,i.option("num_eles",s),s},i._setScrollVLength=function(e){e=e||{};var t=this.that,r=t.options;if("flex"!==r.height||r.maxHeight){var i=this.getSBHeight(),o=this.contHt-i+this.headerHt-2;t.vscroll.widget().css("bottom",i),t.vscroll.option("length",o)}},i.setHeaderHeight=function(){var t,r,i,o=this.that,n=o.$header,a="scrollHeight",l=".pq-grid-header-search-row";if(n&&n.length){if(n.length>1){if(t=n[0][a],r=n[1][a],i=Math.max(t,r),t!==r){var s=e(n[0]).find(l),d=e(n[1]).find(l);s.length&&(s.css("height",""),d.css("height",""),t=n[0][a],r=n[1][a],i=Math.max(t,r),i>t?s.height(d[0][a]):d.height(s[0][a]))}}else t=n[0][a],i=t;o.$header_o.height(i-3),this.headerHt=i-1}else o.$header_o.height(0),this.headerHt=0},i.initContHeight=function(){var e=this.that,t=e.options,r="flex"==t.height;r&&!t.maxHeight||(this.contHt=this.height-(t.showHeader?this.rowHt:0)-(t.showTop?e.$top[0].offsetHeight:0)-(t.showBottom?e.$bottom[0].offsetHeight:0))},i.initContWidth=function(){var e=this.that;e.options;this.contWd=this.width},i.setContHeight=function(e){e=e||{};var r=this.that,i=r.$top,o=r.options,n=this.height-r.$header_o[0].offsetHeight-(o.showTop?i[0].offsetHeight+parseInt(t(i[0],"marginTop")):0)-r.$bottom[0].offsetHeight+1;n=n>=0?n:"",r.$cont.height(n),this.contHt=n},i.setContAndGridHeightForFlex=function(){var e=this.that,t=e.hscroll.widget();if(this.vscroll)t.css("position","");else{t.css("position","relative");var r=e.$cont,i=e.options.cls,o=r.children("."+i.cont_inner_b);r.height(""),o.length||(o=r.children("."+i.cont_inner)),o.height(""),e.element.height(""),e.$grid_center.height("")}},i.setContAndGridWidthForFlex=function(){var e=this.that,t=e.options,r=t.maxWidth,i=this.maxWidthPixel,o=e.calcWidthCols(-1,e.colModel.length),n=e.element,a=this.getSBWidth(),l=o+a;r&&l>=i&&(l=i),this.contWd=l,n.width(l+"px")},i.getTotalVisibleRows=function(e,t,r){var i=this.that,o=this.vrows,n=this.estRowsInViewPort(),a=0,l=r?r.length:0,s=t,d=0,c=0,h=null,u=!!i.iHierarchy,f=i.options,p=f.detailModel.offset,g=0,v=this.rowHt,w=u?this.contHt:void 0;if(null==r||0==l)return{initV:null,finalV:null,tvRows:a,lastFrozenRow:null};for(var m=0,x=l>t?t:l;x>m;m++){var _=r[m],I=_.pq_hidden;if(!I&&(h=m,a++,u)){var y=_.pq_detail;if(y&&y.show){var b=y.height||0;b>p&&(b=p),g+=b+v}else g+=v}}if(t>l)return{initV:h,finalV:h,tvRows:a,lastFrozenRow:h};n-=a,s=d=o[e],c=0;for(var m=s,x=l;x>m;m++){var _=r[m],I=_.pq_hidden;if(I)d++;else{if(c===n)break;d++,c++}if(u&&!I){var y=_.pq_detail;if(y&&y.show){var b=y.height||0;b>p&&(b=p),g+=b+v}else g+=v;if(g>w)break}}return a+=o.length,s=s>=l?l-1:s,d=d>=l?l-1:d,d=s>d?s:d,{initV:s,finalV:d,tvRows:a,lastFrozenRow:h}},i.setInitH=function(e,t){var r=this.that;r.initH=e,r.finalH=t},i.setInitV=function(e,t){var r,i=this.that;null!=e&&null!=t||(r=this.vrows,r&&r.length&&(e=t=r[r.length-1])),i.initV=e,i.finalV=t},i.calcVisibleV=function(){var e,t=this.that,r=t.options,i=r.freezeRows,o=t.pdata||[],n=o.length,a=[],l=0;for(e=0;i>e;e++)o[e].pq_hidden||(a[l++]=e);for(this.vfrows=a,l=0,a=[],e=i;n>e;e++)o[e].pq_hidden||(a[l++]=e);this.vrows=a},i.calcVisibleH=function(){for(var e,t=this.that,r=t.options,i=r.freezeCols,o=[],n=0,a=t.colModel,e=i,l=a.length;l>e;e++)a[e].hidden||(o[n++]=e);this.vcols=o},i.calcInitFinal=function(){var e,t,r=this.that,i=r.options,o=i.virtualY,n=i.freezeRows,a="flex"===i.height,l=r.pdata;if(null==l||0===l.length){var s=this.getTotalVisibleRows(d,n,l);r.totalVisibleRows=s.tvRows,e=s.initV,t=s.finalV,r.lastFrozenRow=s.lastFrozenRow}else if(o){var d=parseInt(r.vscroll.option("cur_pos"));if(isNaN(d)||0>d)throw"cur_pos NA";r.scrollCurPos=d;var s=this.getTotalVisibleRows(d,n,l);r.totalVisibleRows=s.tvRows,e=s.initV,r.lastFrozenRow=s.lastFrozenRow,t=a&&!i.maxHeight?l.length-1:s.finalV}else{var s=this.getTotalVisibleRows(0,n,l);r.lastFrozenRow=s.lastFrozenRow,r.totalVisibleRows=s.tvRows,e=0,t=l.length-1}this.setInitV(e,t)},i.calcInitFinalH=function(){var e,t,r=this.that,i=r.options,o=i.virtualX,n=r.colModel,a=n.length;if(o){var e,l=parseInt(r.hscroll.option("cur_pos")),s=parseInt(i.freezeCols),d="flex"===i.width,c=this.vcols;if(c||(this.calcVisibleH(),c=this.vcols),l>=c.length&&(l=c.length-1),e=c[l],e>a-1&&(e=a-1),(0>e||null==e)&&(e=0),d&&!i.maxWidth)t=a-1;else{for(var h=r.calcWidthCols(-1,s),u=this.getEContWd(),f=e;a>f;f++){var p=n[f];if(!p.hidden){var g=p.outerWidth;if(!g&&i.debug)throw"outerwidth N/A";if(h+=g,h>u)break}}t=f,t>a-1&&(t=a-1),s-1>t&&(t=s-1)}}else e=0,t=a-1;this.setInitH(e,t)},i._calcOffset=function(e){var t=/(-|\+)([0-9]+)/,r=t.exec(e);return r&&3===r.length?parseInt(r[1]+r[2]):0},i.setMax=function(e){var t=this.that,r=t.element,i=t.options,o=i[e];o?(o==parseInt(o)&&(o+="px"),r.css(e,o)):r.css(e,"")},i.refreshGridWidthAndHeight=function(){var t,r,i=this.that,o=i.options,n=(o.width+"").indexOf("%")>-1,a=(o.height+"").indexOf("%")>-1,l=(o.maxHeight+"").indexOf("%")>-1,s="flex"==o.height,d=l&&s,c=(o.maxWidth+"").indexOf("%")>-1,h="flex"==o.width,u=c&&h,f=i.element;if(n||a||d||u){var p=f.parent();if(!p.length)return;var g,v;p[0]==document.body||"fixed"==f.css("position")?(g=e(window).width(),v=window.innerHeight?window.innerHeight:e(window).height()):(g=p.width(),v=p.height());var w=this._calcOffset,m=n?w(o.width):0,x=a?w(o.height):0;u?t=parseInt(o.maxWidth)*g/100:n&&(t=parseInt(o.width)*g/100+m),d?r=parseInt(o.maxHeight)*v/100:a&&(r=parseInt(o.height)*v/100+x)}t||(h&&o.maxWidth?c||(t=o.maxWidth):n||(t=o.width)),o.maxWidth&&(this.maxWidthPixel=t),r||(s&&o.maxHeight?l||(r=o.maxHeight):a||(r=o.height)),parseFloat(t)==t?(t=t<o.minWidth?o.minWidth:t,f.css("width",t)):"auto"===t&&f.width(t),parseFloat(r)==r&&(r=r<o.minHeight?o.minHeight:r,f.css("height",r)),this.width=Math.round(f.width()),this.height=Math.round(f.height())},i.decidePanes=function(){var e=this.that,t=e.pqpanes={v:!1,h:!1,vH:!1},r=e.options,i=r.virtualX,o=r.virtualY,n="flex"==r.height&&!r.maxHeight,a="flex"==r.width&&!r.maxWidth,l=r.numberCell,s=r.freezeRows,d=r.freezeCols;!s||n||!d&&!l.show||a?s&&!n?o||(t.h=!0):!d&&!l.show||a||i||(t.v=!0,t.vH=!0):(o||(t.h=!0),i||(t.v=!0,t.vH=!0))},i._storeColumnWidths=function(e){for(var t=this.that,r=t.options,i=t.colModel,o=r.virtualX,n=r.freezeCols,a=t.initH,l=e?i.length-1:t.finalH,s=[],d=0;l>=d;d++)!e&&o&&a>d&&d>=n&&(d=a),s[d]={outerWidth:i[d].outerWidth};return s},i._isColumnWidthChanged=function(e){for(var t=this.that,r=t.colModel,i=t.iGenerateView.colDef,o=0,n=i.length;n>o;o++){var a=i[o],l=a.colIndx;if(r[l].outerWidth!==e[l].outerWidth)return!0}return!1},i.softRefresh=function(){var e=this.that,t=e.options;this.refreshScrollbars(),e.iGenerateView.setPanes(),e._saveDims(),e.iMouseSelection.syncScrollBarVert(),"flex"==t.height&&this.setContAndGridHeightForFlex(),"flex"==t.width&&this.setContAndGridWidthForFlex(),this._refreshFrozenLine()},i.refreshScrollbars=function(e){e=e||{};var t,r,i,o,n=this,a=n.that,l=a.options,s=a.iGenerateView,d="flex"===l.height,c="flex"===l.width;(d||n.contHt)&&(c||n.contWd)&&null!==a.totalVisibleRows&&(r=n.setScrollVNumEles(e),o=r>1,d&&!l.maxHeight||o===n.vscroll||(n.vscroll=o,l.scrollModel.autoFit||l.virtualX||c?(t=n._storeColumnWidths(),n.refreshColumnWidths(),(n._isColumnWidthChanged(t)||c)&&(n.ignoreTResize=!0,n._refreshTableWidths(t,{table:!0,header:!0}),delete n.ignoreTResize,n.setHeaderHeight(),n.setContHeight(),s.setPanes(),r=n.setScrollVNumEles(!0),o=r>1,n.vscroll=o),t=null):s.setPanes()),r=n.setScrollHNumEles(),i=r>1,n.hscroll!=i&&(n.hscroll=i,s.setPanes()),n._setScrollHLength(),n._setScrollVLength(e),n._setScrollHVLength())},i._setScrollHVLength=function(){var e=this.that;this.vscroll&&this.hscroll||e.$hvscroll.css("visibility","hidden")},i._setScrollHLength=function(){var e=this.that,t=e.hscroll.widget(),r=e.$hvscroll,i=e.options;if(!i.scrollModel.horizontal)return t.css("visibility","hidden"),void r.css("visibility","hidden");t.css("visibility",""),r.css("visibility","");var o=this.contWd,n=this.getSBWidth();t.css("right",0===n?0:""),e.hscroll.option("length",o-n)},i.estVscroll=function(){var e=this.that,t=!0;null==e.totalVisibleRows||null==this.contHt?t=!1:e.totalVisibleRows*this.rowHt<this.contHt&&(t=!1),this.vscroll=t},i.getSBWidth=function(){return null==this.vscroll&&this.estVscroll(),this.vscroll?17:0},i.estHscroll=function(){var e=this.that;if(null==this.contWd)throw"failed";var t=!1,r=this.calcColsOutsideCont(e.colModel)+1;r>1&&(t=!0),this.hscroll=t},i.getSBHeight=function(){return null==this.hscroll&&this.estHscroll(),this.hscroll?17:0},i.getEContHt=function(){if(null==this.contHt)throw"contHt N/A";return this.contHt-this.getSBHeight()},i.getEContWd=function(){if(null==this.contWd)throw"contWd N/A";return this.contWd-this.getSBWidth()},i.calcColsOutsideCont=function(e){var t=this.that,r=t.options,i=r.numberCell,o=r.freezeCols,n=this.contWd-this.getSBWidth(),a=0;i.show&&(a+=i.outerWidth);for(var l=0;l<e.length;l++){var s=e[l];s.hidden||(a+=s.outerWidth)}var d=0,c=0,h=Math.round(a);for(h>n&&c++,l=o;l<e.length;l++)if(s=e[l],!s.hidden){if(d+=s.outerWidth,h=a-d,!(h>n))break;c++}return c},i.setScrollHNumEles=function(){var e=this.that,t=e.options,r=e.colModel,i=t.scrollModel,o=e.hscroll,n=1*o.option("cur_pos"),a=0;return("flex"!==t.width||t.maxWidth)&&(a="fullScroll"===i.lastColumn?r.length-t.freezeCols-e._calcNumHiddenUnFrozens():this.calcColsOutsideCont(r)+1),n&&n>=a&&(a=n+1),e.hscroll.option("num_eles",a),a},i.init=function(){var e=this.that,t=e.options;this.hscroll=this.vscroll=this.contHt=this.contWd=null,e.initH=e.initV=e.finalH=e.finalV=null,e.totalVisibleRows=e.lastFrozenRow=null,this.rowHt=t.rowHeight,this.headerHt=0,this.height=null},i.refresh=function(e){e=e||{};var t,r=this,i=r.that,o=e.header,n=e.table,a=e.pager,l=i.iGenerateView,s=i.element;if(!s[0].offsetWidth)return void s.addClass("pq-pending-refresh");if(e.toolbar&&i.refreshToolbar(),i.iMouseSelection.resetMargins(),r.init(),t=i.options,r.decidePanes(),t.collapsible._collapsed=!1,r.setMax("maxHeight"),r.setMax("maxWidth"),r.refreshGridWidthAndHeight(),r.initContHeight(),r.initContWidth(),r.calcInitFinal(),o===!1||n===!1)var d=r._storeColumnWidths(!0);r.refreshColumnWidths(),r.calcInitFinalH(),l.createColDefs(),o!==!1?i._createHeader():r._isColumnWidthChanged(d)&&r._refreshTableWidths(d,{header:!0}),i._refreshHeaderSortIcons(),a!==!1&&i._refreshPager(),r.setHeaderHeight(),r.setContHeight(),n!==!1?l.generateView({source:e.source}):(r._refreshTableWidths(d,{table:!0}),l.setPanes()),i._saveDims(),l.scrollView(),r.refreshScrollbars(),"flex"==t.height&&r.setContAndGridHeightForFlex(),"flex"==t.width&&r.setContAndGridWidthForFlex(),r._refreshFrozenLine(),i._createCollapse(),t.dataModel.postDataOnce=void 0},i.summaryTable=function(){var t,r=this,i=r.$summary,o=r.that,n=o.options.summaryData;n?(i||(i=r.$summary=e("<div class='pq-grid-summary'></div>").prependTo(o.$bottom)),t={data:n,$cont:i},o.createTable(t)):i&&i[0].innerHTML&&i.empty()},i.refreshVscroll=function(e){var t=this.that,r=t.iGenerateView,i=t.options;if(i.virtualY&&!i.scrollModel.smooth){var o=t.initV,n=t.finalV;this.calcInitFinal();var a=o-t.initV,l=n-t.finalV;i.fullrefreshOnScroll||i.detailModel.init||t._mergeCells||1!=Math.abs(a)||1!=Math.abs(l)?o==t.initV&&n==t.finalV||r.generateView():-1==a?(r.removeTopRow(1),r.appendRow(t.finalV-n)):1==a&&(r.prependRow(),r.removeBottomRow(n-t.finalV)),t._saveDims();var s;r.scrollView(),s=this.setScrollVNumEles(),1>=s&&this.refreshScrollbars()}},i._refreshTableWidths=function(e,t){var r,i,o=this.that,n=o.$tbl_header,a=t.header&&n,l=o.$tbl,s=t.table&&l,d=a?n.children().children(".pq-row-hidden"):null,c=a?o.$header.find(".pq-grid-col-resize-handle"):null,h=s&&l?l.children().children(".pq-row-hidden"):null,u=!1,f=0;if(s&&o.tables.length){var p=o.tables[0].$tbl.children().children(".pq-row-hidden");h=h?h.add(p):p}for(var g=o.iGenerateView.colDef,v=0,w=g.length;w>v;v++){var m=g[v],x=m.colIndx,_=m.column,I=e[x],y=I.outerWidth,b=_.outerWidth;if(b!==y&&(a&&(r=d.find("td[pq-col-indx="+x+"]"),r.width(b)),h&&(i=h.find("td[pq-col-indx="+x+"]"),i.length&&(u=!0,i.width(b)))),f+=b-y,a&&0!==f){var C=c.filter("[pq-col-indx="+x+"]"),q=parseInt(C.css("left"));C.css("left",q+f)}}u&&o._trigger("tableWidthChange"),o._saveDims()}}(jQuery),function(e){function t(e,t,r){for(var i=0,o=e.length;o>i;i++){for(var n=e[i],a={},l=0,s=t.length;s>l;l++){var d=t[l];a[d]=n[d]}r.push(a)}}function r(e){var t=this;t.that=e,t.findformulas(),e.on("columnChange",function(){t.findformulas()}).on("dataAvailable",function(){t._onDA()}).on(!0,"change",function(e,r){t._onchange(r)})}var i=e.paramquery,o=i.cClass,n={};n.options={flex:{on:!0,one:!1,all:!0},detailModel:{cache:!0,offset:100,expandIcon:"ui-icon-triangle-1-se glyphicon glyphicon-minus",collapseIcon:"ui-icon-triangle-1-e glyphicon glyphicon-plus"},dragColumns:{enabled:!0,acceptIcon:"ui-icon-check glyphicon-ok",rejectIcon:"ui-icon-closethick glyphicon-remove",topIcon:"ui-icon-circle-arrow-s glyphicon glyphicon-circle-arrow-down",bottomIcon:"ui-icon-circle-arrow-n glyphicon glyphicon-circle-arrow-up"},track:null,mergeModel:{flex:!1},realFocus:!0,sortModel:{on:!0,type:"local",multiKey:"shiftKey",number:!0,single:!0,cancel:!0,sorter:[],useCache:!0,ignoreCase:!1},filterModel:{on:!0,type:"local",mode:"AND",header:!1}},n._create=function(){var e=this,t=e.options;e.listeners={},e._queueATriggers={},e.iHistory=new i.cHistory(e),e.iGroup=new i.cGroup(e),i.cMerge&&(e.iMerge=new i.cMerge(e)),e.iFilterData=new i.cFilterData(e),e.iSelection=new pq.Selection(e),e.iHeaderSearch=new l(e),e.iUCData=new i.cUCData(e),e.iMouseSelection=new i.cMouseSelection(e),e._super(),new r(e),e.iDragColumns=new i.cDragColumns(e),e.refreshToolbar(),"remote"===t.dataModel.location&&e.refresh({table:!0}),e.on("dataAvailable",function(){e.one("refreshDone",function(){e._trigger("ready"),setTimeout(function(){e.element&&e._trigger("complete")},0)})}),e.refreshDataAndView({header:!0})},e.widget("paramquery.pqGrid",i._pqGrid,n),e.widget.extend=function(){var t,r,i=Array.prototype.shift,o=e.isPlainObject,n=e.isArray,a=e.widget.extend,l=i.apply(arguments);"boolean"==typeof l&&(t=l,l=i.apply(arguments));var s,d,c,h=arguments,u=0,f=h.length;for(null==t&&(t=f>1);f>u;u++){s=h[u];for(d in s)c=s[d],void 0!==c&&(r=!(u>0),o(c)?(l[d]=l[d]||{},a(r,l[d],c)):n(c)?l[d]=t&&r?c.slice():c:l[d]=c)}return l},pq.grid=function(t,r){var i=e(t).pqGrid(r),o=i.data("paramqueryPqGrid")||i.data("paramquery-pqGrid");return o},i.pqGrid.regional={};var a=i.pqGrid.prototype;i.pqGrid.defaults=a.options,a.focus=function(t){t=t||{};var r,i=this,o=t.$td,n=t.rowIndxPage,a=t.colIndx,l=document.activeElement;if(o){if(null==n||null==a){var s=this.getCellIndices({$td:o});n=s.rowIndxPage,a=s.colIndx}}else{if(null==n||null==a){if(l&&l!=document.body&&"pq-grid-excel"!=l.id&&"pq-grid-cont"!=l.className)return;var d=this._focusElement;if(!d)return;n=d.rowIndxPage,a=d.colIndx}var c=this.iMerge,h=n+this.rowIndxOffset;if(c.ismergedCell(h,a)){var u=c.getRootCell(h,a,"o");n=u.rowIndxPage,a=u.colIndx}o=i.getCell({rowIndxPage:n,colIndx:a})}if(this.options.realFocus){if(this._focusElement={$ele:o,rowIndxPage:n,colIndx:a},!(r=o[0])||"TD"!=r.nodeName.toUpperCase()){var f=this.options.dataModel.data;return void(f&&f.length||this.$cont.focus())}e(l).hasClass("pq-editor-focus")===!1&&(r.setAttribute("tabindex",0),r.focus())}else{var p=this._focusElement;p&&(this.removeClass({rowIndxPage:p.rowIndxPage,colIndx:p.colIndx,cls:"pq-focus",refresh:!1}),this.element.find(".pq-focus").removeClass("pq-focus")),o&&(this.addClass({rowIndxPage:n,colIndx:a,cls:"pq-focus"}),this._focusElement={$ele:o,rowIndxPage:n,colIndx:a});var g=this.$cont;document.activeElement!=g[0]&&g[0].focus()}},a.onfocus=function(){if(!this.options.realFocus){var e=this._focusElement;if(e){var t=e.rowIndxPage,r=e.colIndx;this.addClass({rowIndxPage:t,colIndx:r,cls:"pq-focus"})}}},a.onblur=function(){if(!this.options.realFocus){var e=this._focusElement;if(e){var t=e.rowIndxPage,r=e.colIndx;this.removeClass({rowIndxPage:t,colIndx:r,cls:"pq-focus"})}}},a.range=function(e,t){return new pq.Range(this,e,"range",t)},a.rowExpand=function(e){this.iHierarchy.rowExpand(e)},a.rowInvalidate=function(e){this.iHierarchy.rowInvalidate(e)},a.rowCollapse=function(e){this.iHierarchy.rowCollapse(e)},a.saveState=function(t){t=t||{};for(var r,i,o,n=this,a=n.element,l=e.extend,s=n.options,d=s.sortModel,c=l(!0,{},{sorter:d.sorter}),h=s.pageModel,u={rPP:h.rPP,curPage:h.curPage},f=n.colModel,p=[],g=0,v=f.length,w=s.groupModel,m=l(!0,{},{dataIndx:w.dataIndx,dir:w.dir,collapsed:w.collapsed,merge:w.merge,grandSummary:w.grandSummary}),x=a[0].id;v>g;g++)r=f[g],o={width:r.width,dataIndx:r.dataIndx,hidden:r.hidden},(i=r.filter)&&(o.filter={value:i.value,value2:i.value2,on:i.on}),p[g]=o;var _={colModel:p,height:s.height,datestamp:Date.now(),width:s.width,groupModel:m,pageModel:u,sortModel:c,freezeRows:s.freezeRows,freezeCols:s.freezeCols};return t.stringify!==!1&&(_=JSON.stringify(_),t.save!==!1&&"undefined"!=typeof Storage&&localStorage.setItem("pq-grid"+(x?x:""),_)),_},a.loadState=function(t){t=t||{};var r,i=this,o=i.element,n=e.widget.extend,a=e.extend,l=o[0].id,s=t.state||("undefined"==typeof Storage?void 0:localStorage.getItem("pq-grid"+(l||"")));if(!s)return!1;"string"==typeof s&&(s=JSON.parse(s));for(var d,c,h,u=s.colModel,f=[],p=[],g=[],v=[],w=[],m=i.options,x=i.depth>1,_=x?i.colModel:m.colModel,I=0,y=u.length;y>I;I++)d=u[I],h=d.dataIndx,p[h]=!0,g[h]=I,f[h]=d.width,v[h]=d.filter,w[h]=d.hidden;x||_.sort(function(e,t){return g[e.dataIndx]-g[t.dataIndx]});for(var I=0,y=_.length;y>I;I++)c=_[I],h=c.dataIndx,p[h]&&(c.width=f[h]||c.width,c.filter=a(c.filter,v[h]),c.hidden=w[h]);i.iColModel.init(),n(m.sortModel,s.sortModel),n(m.pageModel,s.pageModel);var b=s.groupModel;return i.groupOption(b,!1),r={freezeRows:s.freezeRows,freezeCols:s.freezeCols},isNaN(1*m.height)||isNaN(1*s.height)||(r.height=s.height),isNaN(1*m.width)||isNaN(1*s.width)||(r.width=s.width),i.option(r),t.refresh!==!1&&i.refreshDataAndView(),!0};var l=function(t){function r(e,r,i){t.filter({data:[{dataIndx:e,value:r,value2:i}]})}this.that=t;var i=this;this.dataHS={},t.on("headerKeyDown",function(t,r){var o=e(t.originalEvent.target);return o.hasClass("pq-grid-hd-search-field")?i.onKeyDown(t,r,o):!0}),t.on("createHeader",function(e,t){return i._onCreateHeader()}),this.changeListener={change:function(e,t){r(t.dataIndx,t.value,t.value2)}},this.keyupListener={keyup:function(e,t){r(t.dataIndx,t.value,t.value2)}},this.clickListener={click:function(e,t){r(t.dataIndx,t.value)}}},s=l.prototype=new o;s.get$Ele=function(t,r){var i,o=this.that,n=o.options.freezeCols,a=e(o.$tbl_header[0]),l=".pq-grid-hd-search-field[name='"+r+"']",s=e(o.$tbl_header[2==o.$tbl_header.length?1:0]);return i=t>=n?s.find(l):a.find(l)},s.onKeyDown=function(t,r,i){var o=this.that,n=t.keyCode,a=e.ui.keyCode;if(n!==a.TAB)return!0;var l,s=i.attr("name"),d=o.getColIndx({dataIndx:s}),c=o.colModel,h=t.shiftKey,u=c[d];if("between"==u.filter.condition){o.scrollColumn({colIndx:d});var f=this.get$Ele(d,s);if(f[0]==i[0]?h||(l=f[1]):h&&(l=f[0]),l)return l.focus(),t.preventDefault(),!1}for(;;){if(h?d--:d++,0>d||d>=c.length)break;var u=c[d],p=u.filter;if(!u.hidden&&p){o.scrollColumn({colIndx:d});var l,s=u.dataIndx,l=this.get$Ele(d,s);if("between"==p.condition&&(l=e(h?l[1]:l[0])),l)return l.focus(),t.preventDefault(),!1;break}}},s._bindFocus=function(){function t(t){var o=e(t.target),n=o.closest(".pq-grid-hd-search-field"),a=n.attr("name");if(r.scrollColumn({dataIndx:a})){var l=r.getColIndx({dataIndx:a}),s=i.get$Ele(l,a);s.focus()}}for(var r=this.that,i=this,o=r.$header.find(".pq-grid-header-search-row"),n=0;n<o.length;n++)e(o[n]).on("focusin",t)},s._onCreateHeader=function(){var t=this,r=this.that,i=r.options,o=i.filterModel;if(o.header){this._bindFocus();var n=r.colModel,a=i.freezeCols,l=r.$tbl_header,s=e(l[0]),d=e(l[1]),c="input,select";if(l.length>1){s.find(c).css("visibility","hidden");for(var h=0;a>h;h++){var u=n[h],f=u.dataIndx,c="*[name='"+f+"']";s.find(c).css("visibility","visible"),d.find(c).css("visibility","hidden")}}for(var p=r.iGenerateView.colDef,h=0,g=p.length;g>h;h++){var v=p[h],w=v.colIndx,u=v.column,m=u.filter;if(m){var x=u.dataIndx,_=s;w>=a&&l.length>1&&(_=d);var I=_.find("*[name='"+x+"']");if(0!=I.length){var y=m.type,b=m.value,C=m.value2;"checkbox"==y&&"triple"==m.subtype?I.pqval({val:b}):"select"==y&&null!=b&&I.val(b);var q=m.init;q&&q.call(I,{dataIndx:x,column:u});var M=m.listeners;if(M)for(var D=0;D<M.length;D++){var R=M[D];"string"==typeof R&&(R=t[R+"Listener"]);for(var P in R){var T=R[P];!function(t,i,o){t.bind(P,function(n){var a=r.getColumn({dataIndx:o}),l=a.filter;return"checkbox"==l.type?b="triple"==l.subtype?t.pqval({incr:!0}):!!t.is(":checked"):"between"==l.condition?(b=e(t[0]).val(),C=e(t[1]).val()):b=t.val(),i.call(this,n,{column:a,dataIndx:o,value:b,value2:C})})}(I,T,x)}}}}}}};var d=function(e,t){var r=["<div class='pq-from-div'>",e,"</div>","<span class='pq-from-to-center'>-</span>","<div class='pq-to-div'>",t,"</div>"].join("");return r};s.createDOM=function(e,t){var r=this.that,o=r.options,n=o.bootstrap.on,a=n?" ":" ui-corner-all",l=(this.dataHS,o.numberCell),s=d;e.push("<tr class='pq-grid-header-search-row'>"),l.show&&e.push(["<td pq-col-indx='-1' class='pq-grid-number-col' rowspan='1'>","<div class='pq-td-div'> </div></td>"].join(""));for(var c=r.iGenerateView.colDef,h=0,u=c.length;u>h;h++){var f=c[h],p=f.column,g=t,v=p.halign;v||(v=p.align),"right"==v?g+=" pq-align-right":"center"==v&&(g+=" pq-align-center");var w=p.cls;w&&(g=g+" "+w);var m=p.filter;if(m){var x=p.dataIndx,_=m.type,I=m.value,y=m.condition,b=m.cls,b="pq-grid-hd-search-field "+(b?b:""),C=m.style,C=C?C:"",q=m.attr,q=q?q:"",M="";if("between"==y)var D=m.value2,D=null!=D?D:"";if("textbox"===_)I=I?I:"",b=b+" pq-search-txt"+a,M="between"==y?s(this._input(x,I,b+" pq-from",C,q),this._input(x,D,b+" pq-to",C,q)):this._input(x,I,b,C,q);else if("textarea"===_)I=I?I:"",b=b+" pq-search-txt"+a,M="between"==y?s(this._textarea(x,I,b+" pq-from",C,q),this._textarea(x,D,b+" pq-to",C,q)):this._textarea(x,I,b,C,q);else if("select"===_)if(m.cache)M=m.cache;else{var R=m.options;"function"==typeof R&&(R=R.call(r,{column:p,value:I,dataIndx:x,cls:b,style:C,attr:q})),b+=a;var P=["name='",x,"' class='",b,"' style='",C,"' ",q].join("");M=i.select({options:R,attr:P,prepend:m.prepend,valueIndx:m.valueIndx,labelIndx:m.labelIndx,groupIndx:m.groupIndx}),m.cache=M}else if("checkbox"==_){var T=null==I||0==I?"":"checked=checked";M=["<input ",T," name='",x,"' type=checkbox class='"+b+"' style='"+C+"' "+q+"/>"].join("")}else"string"==typeof _?M=_:"function"==typeof _&&(M=_.call(r,{width:p.outerWidth,value:I,value2:D,column:p,dataIndx:x,cls:b,attr:q,style:C}));e.push(["<td class='",g,"'><div class='pq-td-div' >","",M,"</div></td>"].join(""))}else e.push(["<td class='",g,"'><div class='pq-td-div' >"," ","</div></td>"].join(""))}e.push("</tr>")},s._input=function(e,t,r,i,o){return['<input value="',t,"\" name='",e,"' type=text style='"+i+"' class='"+r+"' "+o+" />"].join("")},s._textarea=function(e,t,r,i,o){return["<textarea name='",e,"' style='"+i+"' class='"+r+"' "+o+" >",t,"</textarea>"].join("")},a.refreshToolbar=function(){var t,r=this,i=r.options,o=i.toolbar;if(r._toolbar&&(t=r._toolbar,t.destroy()),o){var n=o.cls,n=n?n:"",a=o.style,a=a?a:"",l=o.attr,l=l?l:"",s=o.items,d=e("<div class='"+n+"' style='"+a+"' "+l+" ></div>");t?t.widget().replaceWith(d):r.$top.append(d),t=pq.toolbar(d,{items:s,gridInstance:r,bootstrap:i.bootstrap}),i.showToolbar||d.css("display","none"),r._toolbar=t}},a.isLeftOrRight=function(e){var t=(this.options,this.freezeCols);return e>t?"right":"left"},a.ovCreateHeader=function(e,t){this.options.filterModel.header&&this.iHeaderSearch.createDOM(e,t)},a.filter=function(t){var r=this,i=this.options,o=void 0===t.apply?!0:t.apply,n=void 0===t.sort?!0:t.sort,a=i.dataModel,l=i.filterModel;if(void 0!=t)for(var s="replace"==t.oper,d=t.data,c=this.colModel,c=o?c:e.extend(!0,[],c),h=0,u=c.length,f=d.length,p=0;u>p;p++){for(var g=c[p],v=!1,w=0;f>w&&h!=f;w++){var m=d[w];if(m.dataIndx==g.dataIndx){v=!0,h++;var x=g.filter,_=m.condition,I=m.value;if(x?x.on=!0:x=g.filter={on:!0},_&&(x.condition=_),_=x.condition,x.value=I,"between"==_)x.value2=m.value2;else if("range"==_){var y=[];if(I)if("string"==typeof I){var b=x.options,C=I.indexOf('"'),q=I.lastIndexOf('"');if(I=I.substr(C,q+1),I=JSON.parse("["+I+"]"),b)for(var M=0,D=b.length;D>M;M++){var R=b[M];-1!=e.inArray(R,I)&&y.push(R)}else y=I.split(",s*")}else"function"==typeof I.push&&(y=I);x.value=y}break}}s&&!v&&g.filter&&(g.filter.on=!1)}var P={header:!1,apply:o,sort:n,CM:c};return"remote"!=a.location||"local"==l.type?(P.source="filter",P.trigger=!1,r._onDataAvailable(P)):void this.remoteRequest({apply:o,CM:c,callback:function(){return r._onDataAvailable(P)}})},a._initTypeColumns=function(){for(var e=this.colModel,t=0,r=e.length;r>t;t++){var o=e[t],n=o.type;"checkBoxSelection"===n||"checkbox"==n?(o.type="checkbox",new i.cCheckBoxColumn(this,o)):"detail"===n&&(o.dataIndx="pq_detail",this.iHierarchy=new i.cHierarchy(this,o))}},a.refreshHeader=function(){this._createHeader(),this.iGenerateView.setPanes(),this._refreshHeaderSortIcons()},a._refreshHeaderSortIcons=function(){this.iHeader.refreshHeaderSortIcons()},a.getLargestRowCol=function(e){for(var t,r=0;r<e.length;r++){var i=e[r],o=i.rowIndx;null==t?t=i.rowIndx:o>t&&(t=o),t=i.rowIndx}},a.bringCellToView=function(e){this._bringCellToView(e)},a._setUrl=function(e){this.options.dataModel.getUrl=function(){return{url:this.url+(null!=e?e:"")}}},a.pageData=function(){return this.pdata},a.getData=function(e){e=e||{};var r=e.dataIndx,i=r?r.length:0,o=e.data,n=this.options.dataModel,a=n.data,l=n.dataUF,s=[];if(!i)return a.concat(l?l:[]);o?t(o,r,s):(a&&t(a,r,s),l&&t(l,r,s));for(var d=[],c=0;i>c;c++){var h=r[c],u=this.getColumn({dataIndx:h});d.push({dataIndx:h,dir:"up",dataType:u.dataType,sortType:u.sortType})}s=this.iSort._sortLocalData(d,s);for(var f=[],p=void 0,g=0,v=s.length;v>g;g++){var w=s[g],m=JSON.stringify(w);m!==p&&(f.push(w),p=m)}return f},a.get_p_data=function(){var e=this.options,t="remote"==e.pageModel.type,r=e.dataModel.data,i=this.pdata,o=this.rowIndxOffset,n=e.groupModel,a=o&&t?new Array(o):[],l=n.on&&n.dataIndx.length;return l?o?(t||(a=r.slice(0,o)),a.concat(i)):i:o&&t?a.concat(i):r},a._onDataAvailable=function(e){e=e||{};var t=this.options,r=null==e.apply?!0:e.apply,i=e.source,o=e.sort,n=[],a=t.filterModel,l=t.dataModel,s=t.sortModel,d=l.location;
return r!==!1&&e.trigger!==!1&&this._trigger("dataAvailable",e.evt,{source:i}),n=a&&a.on&&("local"==d&&"remote"!=a.type||"remote"==d&&"local"==a.type)?this.iFilterData.filterLocalData(e).data:l.data,"local"==s.type&&o!==!1&&(r?this.sort({refresh:!1}):n=this.iSort.sortLocalData(n)),r===!1?n:(l.data=n,void this.refreshView(e))},a.reset=function(t){t=t||{};var r,i,o,n,a,l=this,s=t.sort,d=0,c=l.options,h=e.extend,u=t.filter,f=t.group;if(s||u||f){if(s&&(o=s===!0?{sorter:[]}:s,h(c.sortModel,o)),u)for(r=l.getColModel(),i=r.length;i>d;d++)a=r[d].filter,a&&(a.value=null,a.value2=null,a.cache=null);f&&(n=f===!0?{dataIndx:[]}:f,l.groupOption(n,!1)),t.refresh!==!1&&(u?(l.filter({oper:"replace",data:[]}),l.refreshHeader()):s?l.sort():l.refreshView())}},a._trigger=i._trigger,a.on=i.on,a.one=i.one,a.off=i.off,a.pager=function(){return this.pagerW},a.vscrollbar=function(){return this.vscroll},a.hscrollbar=function(){return this.hscroll},a.toolbar=function(){return this._toolbar.element},i.cCompute=r;var c=r.prototype;c.callRow=function(e,t,r){if(e)for(;r--;){var i=t[r],o=i.formula,n=i.column;e[n.dataIndx]=o.call(this.that,{rowData:e,column:n})}},c._onDA=function(){var e=this.formulas.length;if(e)for(var t=this.that.options,r=t.dataModel.data,i=r.length,o=this.formulas;i--;)this.callRow(r[i],o,e)},c._onchange=function(e){var t=this.formulas.length;if(t)for(var r=e.rowList,i=this.formulas,o=r.length;o--;)this.callRow(r[o].rowData,i,t)},c.findformulas=function(){for(var e,t,r=this.that,i=r.colModel,o=[],n=i.length;n--;)e=i[n],t=e.formula,t&&o.push({formula:t,column:e});this.formulas=o};var h=i.cColModel=h=function(e){this.that=e,this.init()},u=h.prototype;u.extend=function(t,r){for(var i,o,n=e.extend,a=t.length;a--;){var l=t[a];for(i in r)void 0===l[i]&&(o=r[i],o&&"object"==typeof o?l[i]=n(!0,{},o):l[i]=o)}},u.init=function(){var e,t,r,i=this.that,o=i.options,n=o.columnTemplate,a=o.colModel;a||(this._autoGenColumns(),a=o.colModel),e=this.nestedCols(a),i.depth=e.depth,t=i.colModel=e.colModel,r=t.length,n&&this.extend(t,n),this.getHeadersCells(),this.alignColumns(t,r),this.assignRowSpan(),this._refreshDataIndices(),i._trigger("CMInit")},u.alignColumns=function(e,t){for(var r=0;t>r;r++){var i=e[r];if(!i.align){var o=i.dataType;!o||"integer"!=o&&"float"!=o||(i.align="right")}}},u.nestedCols=function(e,t,r,i){var o=e.length,n=[];null==t&&(t=1);for(var a=t,l=0,s=0,d=0,c=0,h=0;o>h;h++){var u=e[h];u.parent=i?i:void 0,r===!0&&(u.hidden=r);var f=u.colModel;if(f&&f.length){var p=this.nestedCols(f,t+1,u.hidden,u);n=n.concat(p.colModel),p.colSpan>0?(p.depth>a&&(a=p.depth),u.colSpan=p.colSpan,l+=p.colSpan):u.colSpan=0,c+=p.o_colspan,u.o_colspan=p.o_colspan,u.childCount=p.childCount,d+=p.childCount}else u.hidden?u.colSpan=0:(u.colSpan=1,l++),c++,u.o_colspan=1,u.childCount=0,d++,n.push(u)}return{depth:a,colModel:n,colSpan:l,width:s,childCount:d,o_colspan:c}},u.getHeadersCells=function(){for(var e=this.that,t=e.options.colModel,r=e.colModel.length,i=e.depth,o=[],n=0;i>n;n++){o[n]=[];for(var a=0,l=0,s=0;r>s;s++){var d;if(0==n)d=t[a];else{var c=o[n-1][s],h=c.colModel;if(h&&0!=h.length){for(var u=s-c.leftPos,f=0,p=0,g=0;g<h.length;g++)if(f+=h[g].childCount>0?h[g].childCount:1,f>u){p=g;break}d=h[p]}else d=c}var v=d.childCount?d.childCount:1;s==l?(d.leftPos=s,o[n][s]=d,l+=v,t[a+1]&&a++):o[n][s]=o[n][s-1]}}return e.headerCells=o,o},u.getDataType=function(){var e=this.colModel;if(e&&e[0]){var t=e[0].dataIndx;return"string"==typeof t?"JSON":"ARRAY"}},u.assignRowSpan=function(){for(var e=this.that,t=e.colModel.length,r=e.headerCells,i=e.depth,o=0;t>o;o++)for(var n=0;i>n;n++){var a=r[n][o];if(!(o>0&&a==r[n][o-1]||n>0&&a==r[n-1][o])){for(var l=1,s=n+1;i>s;s++){var d=r[s][o];a==d&&l++}a.rowSpan=l}}return r},u._autoGenColumns=function(){var t=this.that,r=t.options,i=r.columnTemplate||{},o=i.dataType,n=i.title,a=i.width,l=r.dataModel.data,s=pq.validation,d=[];if(l&&l.length){var c=l[0];e.each(c,function(e,t){var r="string";s.isInteger(t)?r=t+"".indexOf(".")>-1?"float":"integer":s.isDate(t)?r="date":s.isFloat(t)&&(r="float"),d.push({dataType:o?o:r,dataIndx:e,title:n?n:e,width:a?a:100})})}r.colModel=d},u._refreshDataIndices=function(){for(var e=this.that,t="JSON"==this.getDataType(),r={},i={},o={},n=e.colModel,a=n.length,l=0;a>l;l++){var s=n[l],d=s.dataIndx;null==d&&(d="detail"==s.type?"pq_detail":t?"dataIndx_"+l:l,"pq_detail"==d&&(s.dataType="object"),s.dataIndx=d),r[d]=s,i[d]=l;var c=s.validations;c&&(o[d]=o)}e.columns=r,e.colIndxs=i,e.validations=o}}(jQuery),function(e){var t=e.paramquery,r=t._pqGrid.prototype;r.exportExcel=function(e){return e=e||{},e.format="xlsx",this.exportData(e)},r.exportCsv=function(e){return e=e||{},e.format="csv",this.exportData(e)},r.exportData=function(e){var t=new i(this,e);return t.Export(e)};var i=t.cExport=function(e,t){var r=this,i="ParamQuery Pro";r.that=e,r.templates={content_types:'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Override PartName="/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/worksheet.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>',workbook:['<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="',t.sheetName?t.sheetName:i,'" sheetId="1" r:id="rId1"/></sheets></workbook>'].join(""),worksheet:'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><%=content%></worksheet>',rels:'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="workbook.xml"/></Relationships>',workbook_rels:'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheet.xml"/></Relationships>'}},o=i.prototype;o.getTitle=function(e,t){var r=e.title;return r?"function"==typeof r&&(r=r.call(this.that,{colIndx:t,column:e,dataIndx:e.dataIndx,Export:!0})):r="",r},o.getRenderVal=function(e,t,r){var i=e.column,o=i.exportRender;return(t&&o!==!1||o)&&(i.render||i._render||i.format)?r.renderCell(e):e.rowData[e.dataIndx]},o.getXlsMergeCells=function(e,r,i,o){e=e.concat(i.getMergeCells(r,this.curPage,o));var n=[],a=t.toLetter,l=e.length;n.push('<mergeCells count="'+l+'">');for(var s=0;l>s;s++){var d=e[s];d=a(d.c1)+(d.r1+1)+":"+a(d.c2)+(d.r2+1),n.push('<mergeCell ref="',d,'"/>')}return n.push("</mergeCells>"),l?n.join(""):""},o.getXlsCols=function(e,t){var r,i,o,n,a=[],l=0,s=function(e,t,r,i,o){e.push('<col min="',t,'" max="',r,'" hidden="',i,'" customWidth="1" width="',Math.ceil(o/7),'"/>')};a.push("<cols>");for(var d=0;t>d;d++){var c=e[d],h=c.hidden?"1":"0",u=c._width;c.copy!==!1&&(l++,u||(u=parseInt(c.width),u||(u=100)),o===u&&n===h?i=l:(null!=o&&(s(a,r,i,n,o),r=null),i=l,null==r&&(r=l)),o=u,n=h)}return s(a,r,i,n,o),a.push("</cols>"),a.join("")},o.getXlsHeader=function(e,t,r){for(var i=this,o=[],n=0;t>n;n++){var a=e[n];o.push("<row>");for(var l=0,s=a.length;s>l;l++){var d=a[l];if(d.copy!==!1){var c=d.o_colspan,h=d.rowSpan,u=i.getTitle(d,l);n>0&&d==e[n-1][l]?u="":l>0&&d==e[n][l-1]?u="":(c>1||h>1)&&r.push({r1:n,c1:l,r2:n+h-1,c2:l+c-1}),o.push('<c t="inlineStr"><is><t><![CDATA['+u+"]]></t></is></c>")}}o.push("</row>")}return o.join("")},o.getXlsBody=function(e,t,r,i,o,n,a,l,s){var d,c,h,u,f,p,g,v,w,m,x=this,_=[],I={integer:"Number","float":"Number",bool:"bool"};for(d=0;i>d;d++){for(p=r[d],w=p.pq_hidden?'hidden="1"':"",g=o?d+n:d,v=g-n,f={rowIndx:g,rowIndxPage:v,rowData:p,Export:!0},_.push("<row "+w+">"),c=0;t>c;c++)u=e[c],u.copy!==!1&&(h=void 0,a.ismergedCell(g,c)&&(a.isRootCell(g,c,"o")||(h=null)),void 0===h&&(f.colIndx=c,f.column=u,f.dataIndx=u.dataIndx,h=x.getRenderVal(f,l,s)),m=null==h?null:I[u.dataType],"string"==typeof h&&(m="String"),m=m||"String",h=null==h?"":h,"String"==m?_.push('<c t="inlineStr"><is><t><![CDATA['+h+"]]></t></is></c>"):"Number"==m?_.push("<c><v>"+h+"</v></c>"):"bool"==m?(h=h?"1":"0",_.push('<c t="b"><v>'+h+"</v></c>")):_.push("<c><v>"+h+"</v></c>"));_.push("</row>")}return _.join("\n")},o.getXlsContent=function(e,t,r,i,o,n,a,l,s,d,c,h){var u=this,f='<sheetViews><sheetView workbookViewId="0"><pane ySplit="<%=a%>" topLeftCell="A<%=b%>" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>',p=u.getXlsCols(e,t),g=[],v=h?i:0,f=f.replace("<%=a%>",v),f=f.replace("<%=b%>",v+1),w=h?u.getXlsHeader(r,i,g):"",m=u.getXlsBody(e,t,o,n,a,l,s,d,c),x=[f,p,"<sheetData>",w,m,"</sheetData>",u.getXlsMergeCells(g,h?i:0,s,n)].join("");return x},o.getHtmlHeader=function(e,t){for(var r,i,o,n,a,l=this,s=[],d=0;t>d;d++){var c=e[d],h=null;s.push("<tr>");for(var u=0,f=c.length;f>u;u++)r=c[u],i=r.colSpan,!r.hidden&&i&&r.copy!==!1&&(o=r.rowSpan,d>0&&r==e[d-1][u]||h&&u>0&&r==h||(n=l.getTitle(r,u),h=r,a=r.halign||r.align,a=a?"align="+a:"",s.push("<th colspan=",i," rowspan=",o," ",a,">",n,"</th>")));s.push("</tr>")}return s.join("")},o.getHtmlBody=function(e,t,r,i,o,n,a,l,s){var d,c,h,u,f,p,g,v,w,m,x,_,I=this,y=[];for(d=0;i>d;d++)if(g=r[d],!g.pq_hidden){for(v=o?d+n:d,w=v-n,p={rowIndx:v,rowIndxPage:w,rowData:g,Export:!0},y.push("<tr>"),c=0;t>c;c++)if(h=e[c],!h.hidden&&h.copy!==!1){if(u=null,f=null,x="",a.ismergedCell(v,c)){if(!(f=a.isRootCell(v,c)))continue;u=a.getRootCell(v,c,"o"),u.Export=!0,m=I.getRenderVal(u,l,s),x="rowspan="+f.rowspan+" colspan="+f.colspan+" "}else p.colIndx=c,p.column=h,p.dataIndx=h.dataIndx,m=I.getRenderVal(p,l,s);_=h.align,x+=_?"align="+_:"",m=null==m?"":m,y.push("<td ",x,">",m,"</td>")}y.push("</tr>")}return y.join("")},o.getHtmlContent=function(e,t,r,i,o,n,a,l,s,d,c,h,u){var f=this,p=f.that,g=e.cssRules||"",v=p.element.find(".pq-grid-table"),w=v.css("font-family"),m=v.css("font-size"),x="table{empty-cells:show;font-family:"+w+";font-size:"+m+";border-collapse:collapse;}",_=[];return _.push("<!DOCTYPE html><html><head>",'<meta charset="utf-8" />',"<title>",e.title?e.title:"ParamQuery Pro","</title>","</head><body>","<style>",x,"td,th{padding: 5px;border:1px solid #ccc;}",g,"</style>","<table>"),_.push(u?f.getHtmlHeader(i,o,t):""),_.push(f.getHtmlBody(t,r,n,a,l,s,d,c,h)),_.push("</table></body></html>"),_.join("")},o.getCsvHeader=function(e,t,r,i){for(var o,n,a,l=this,s=[],d=[],c=0;t>c;c++){for(var h=e[c],u=null,f=0,p=h.length;p>f;f++)o=r[f],o.hidden||o.copy===!1||(n=h[f],c>0&&n==e[c-1][f]?s.push(""):u&&f>0&&n==u?s.push(""):(a=l.getTitle(n,f),a=a?a.replace(/\"/g,'""'):"",u=n,s.push('"'+a+'"')));d.push(s.join(i)),s=[]}return d},o.getCSVContent=function(e,t,r,i,o,n,a,l,s,d,c,h,u){var f,p,g,v,w,m,x,_,I,y,b,C=this,q=e.separator||",",M=[];for(b=u?C.getCsvHeader(i,o,t,q):[],v=0;a>v;v++)if(x=n[v],!x.pq_hidden){_=l?v+s:v,I=_-s,m={rowIndx:_,rowIndxPage:I,rowData:x,Export:!0};for(var w=0;r>w;w++)if(y=t[w],!y.hidden&&y.copy!==!1){p=null,f=null,d.ismergedCell(_,w)?(f=d.isRootCell(_,w))?(p=d.getRootCell(_,w,"o"),p.Export=!0,g=C.getRenderVal(p,c,h)):g="":(m.colIndx=w,m.column=y,m.dataIndx=y.dataIndx,g=C.getRenderVal(m,c,h));var D=(null==g?"":g)+"";D=D.replace(/\"/g,'""'),M.push('"'+D+'"')}b.push(M.join(q)),M=[]}return b.join("\n")},o.getJsonContent=function(e,t){function r(e,t){return 0!==(e+"").indexOf("pq_")?t:void 0}return e.nostringify?t:JSON.stringify(t,e.nopqdata?r:null,e.nopretty?null:2)},o.postRequest=function(t){var r,i,o=t.format,n=t.url,a=t.filename||"pqGrid";if(t.zip&&"xlsx"!=o){var l=new JSZip;l.file(a+"."+t.format,t.data),r=l.generate({type:"base64",compression:"DEFLATE"}),i=!0,o="zip"}else i=!!t.decodeBase,r=t.data;return n&&e.ajax({url:n,type:"POST",cache:!1,data:{pq_ext:o,pq_data:r,pq_decode:i,pq_filename:a},success:function(t){n+=(n.indexOf("?")>0?"&":"?")+"pq_filename="+t,e(document.body).append("<iframe height='0' width='0' frameborder='0' src=\""+n+'"></iframe>')}}),r},o.Export=function(e){var t,r,i,o,n=this,a=n.that,l=a.options,s=n.templates,d=l.groupModel,c="remote"==l.pageModel.type,h=a.rowIndxOffset,u=a.iGenerateView,f=a.iMerge,p=a.colModel,g=p.length,v=a.headerCells,w=v.length,m=n.curPage=d.on&&d.dataIndx.length||c,x=m?a.pdata:l.dataModel.data,x=l.summaryData?x.concat(l.summaryData):x,_=x.length,I=e.url,y=e.render,b=!e.noheader,C=e.format;return a._trigger("beforeExport",null,e),"xlsx"==C?(t=n.getXlsContent(p,g,v,w,x,_,c,h,f,y,u,b),r=new JSZip,r.file("[Content_Types].xml",s.content_types),r.file("workbook.xml",s.workbook),r.file("worksheet.xml",s.worksheet.replace("<%=content%>",t)),o=r.folder("_rels"),o.file(".rels",s.rels),o.file("workbook.xml.rels",s.workbook_rels),I?(e.data=r.generate({type:"base64",compression:"DEFLATE"}),e.decodeBase=!0):i=r.generate({type:"blob",compression:"DEFLATE"})):"json"==C?e.data=n.getJsonContent(e,x):"csv"==C?e.data=n.getCSVContent(e,p,g,v,w,x,_,c,h,f,y,u,b):e.data=n.getHtmlContent(e,p,g,v,w,x,_,c,h,f,y,u,b),i=i?i:n.postRequest(e),a._trigger("exportData",null,e),i}}(jQuery),function(e){var t=e.paramquery,r={};r.options={items:[],gridInstance:null},e.widget("paramquery.pqToolbar",r),r=t.pqToolbar.prototype,r.refresh=function(){this.element.empty(),this._create()},r._create=function(){var r,i,o=this.options,n=o.gridInstance,a={button:"click",select:"change",checkbox:"change",textbox:"change"},l=o.bootstrap,s=l.on,d=n.colModel,c=o.items,h=this.element;h.addClass("pq-toolbar");for(var u=0,f=c.length;f>u;u++){var p,g,v=c[u],w=v.type,m=v.value,x=v.icon,_=v.options||{},I=v.label,i=v.listener,y=i?[i]:v.listeners,y=y||[function(){}],b=v.cls,C=b?b:"",C=s&&"button"==w?l.btn+" "+C:C,C=C?"class='"+C+"'":"",q=v.style,M=q?"style='"+q+"'":"",D=v.attr,R=D?D:"",P=I&&"button"!=w?[C,R]:[C,R,M],P=P.join(" ");if(v.options=_,"textbox"==w)g=e([I?"<label "+M+">"+I:"","<input type='text' "+P+">",I?"</label>":""].join(""));else if("textarea"==w)g=e([I?"<label "+M+">"+I:"","<textarea "+P+"></textarea>",I?"</label>":""].join(""));else if("checkbox"==w)g=e([I?"<label "+M+">":"","<input type='checkbox' ",m?"checked='checked' ":"",P,">",I?I+"</label>":""].join(""));else if("separator"==w)g=e("<span class='pq-separator' "+[R,M].join(" ")+"></span>");else if("button"==w){var T="";s&&(T=x?"<span class='glyphicon "+x+"'></span>":""),g=e("<button type='button' "+P+">"+T+I+"</button>"),e.extend(_,{label:I?I:!1,icons:{primary:s?"":x}}),g.button(_)}else"select"==w?("function"==typeof _&&(_=_.call(n,{colModel:d})),_=_||[],p=t.select({options:_,attr:P,prepend:v.prepend,groupIndx:v.groupIndx,valueIndx:v.valueIndx,labelIndx:v.labelIndx}),g=e([I?"<label "+M+">"+I:"",p,I?"</label>":""].join(""))):"string"==typeof w?g=e(w):"function"==typeof w&&(p=w.call(n,{colModel:d,cls:C}),g=e(p));g.appendTo(h),"checkbox"!==w&&void 0!==m&&(I?e(g[0].children[0]).val(m):g.val(m));for(var k=0,S=y.length;S>k;k++){i=y[k];var H={};"function"==typeof i?H[a[w]]=i:H=i;for(r in H)g.on(r,this._onEvent(n,H[r],v))}}},r._onEvent=function(t,r,i){return function(o){"checkbox"==i.type?i.value=e(o.target).prop("checked"):i.value=e(o.target).val(),r.call(t,o)}},r._destroy=function(){this.element.empty().removeClass("pq-toolbar").enableSelection()},r._disable=function(){null==this.$disable&&(this.$disable=e("<div class='pq-grid-disable'></div>").css("opacity",.2).appendTo(this.element))},r._enable=function(){this.$disable&&(this.element[0].removeChild(this.$disable[0]),this.$disable=null)},r._setOption=function(e,t){"disabled"==e&&(1==t?this._disable():this._enable())},pq.toolbar=function(t,r){var i=e(t).pqToolbar(r),o=i.data("paramqueryPqToolbar")||i.data("paramquery-pqToolbar");return o}}(jQuery),function(e){var t=e.paramquery,r=t.pqGrid.prototype.options,i={on:!1,dirtyClass:"pq-cell-dirty"};r.trackModel=r.trackModel||i;var o=t.cUCData=function(e){this.that=e,this.udata=[],this.ddata=[],this.adata=[],this.options=e.options;var t=this;e.on("dataAvailable",function(e,r){"filter"!=r.source&&(t.udata=[],t.ddata=[],t.adata=[])})},n=o.prototype=new t.cClass;n.add=function(e){for(var t=this.that,r=this.adata,i=this.ddata,o=e.rowData,n=this.options.trackModel,a=n.dirtyClass,l=t.getRecId({rowData:o}),s=0,d=r.length;d>s;s++){var c=r[s];if(null!=l&&c.recId==l)throw"primary key violation";if(c.rowData==o)throw"same data can't be added twice."}for(var s=0,d=i.length;d>s;s++)if(o==i[s].rowData)return void i.splice(s,1);var h=[];for(var u in o)h.push(u);t.removeClass({rowData:o,dataIndx:h,cls:a});var e={recId:l,rowData:o};r.push(e)},n.update=function(t){var r=this.that,i=this.options.trackModel,o=i.dirtyClass,n=t.rowData||r.getRowData(t),a=r.getRecId({rowData:n}),l=t.dataIndx,s=t.refresh,d=r.columns,c=r.getValueFromDataType,h=t.row,u=this.udata,f=u.slice(0),p=!1;if(null!=a){for(var g=0,v=u.length;v>g;g++){var w=u[g],m=w.oldRow;if(w.rowData==n){p=!0;for(var l in h){var x=d[l],_=x.dataType,I=h[l],I=c(I,_),y=m[l],y=c(y,_);if(m.hasOwnProperty(l)&&y===I){var b={rowData:n,dataIndx:l,refresh:s,cls:o};r.removeClass(b),delete m[l]}else{var b={rowData:n,dataIndx:l,refresh:s,cls:o};r.addClass(b),m.hasOwnProperty(l)||(m[l]=n[l])}}e.isEmptyObject(m)&&f.splice(g,1);break}}if(!p){var m={};for(var l in h){m[l]=n[l];var b={rowData:n,dataIndx:l,refresh:s,cls:o};r.addClass(b)}var b={rowData:n,recId:a,oldRow:m};f.push(b)}this.udata=f}},n["delete"]=function(e){for(var t=this.that,r=e.rowIndx,i=e.rowIndxPage,o=t.rowIndxOffset,r=null==r?i+o:r,i=null==i?r-o:i,n=t.options.pageModel.type,a="remote"==n?i:r,l=this.adata,s=this.ddata,d=t.getRowData(e),c=0,h=l.length;h>c;c++)if(l[c].rowData==d)return void l.splice(c,1);s.push({indx:a,rowData:d,rowIndx:r})},n.isDirty=function(e){var t=this.that,r=this.udata,i=this.adata,o=this.ddata,n=!1,a=t.getRowData(e);if(a)for(var l=0;l<r.length;l++){var s=r[l];if(a==s.rowData){n=!0;break}}else(r.length||i.length||o.length)&&(n=!0);return n},n.getChangesValue=function(t){t=t||{};for(var r=this.that,i=t.all,o=this.udata,n=this.adata,a=this.ddata,l=[],s=[],d=[],c=[],h=[],u=[],f=0,p=a.length;p>f;f++){var g=a[f],v=g.rowData,w={};h.push(v);for(var m in v)0!=m.indexOf("pq_")&&(w[m]=v[m]);u.push(w)}for(var f=0,p=o.length;p>f;f++){var g=o[f],x=g.oldRow,v=g.rowData;if(-1==e.inArray(v,h)&&-1==e.inArray(v,l)){var w={};if(i!==!1)for(var m in v)0!=m.indexOf("pq_")&&(w[m]=v[m]);else{for(var m in x)w[m]=v[m];w[r.options.dataModel.recIndx]=g.recId}l.push(v),s.push(w),d.push(x)}}for(var f=0,p=n.length;p>f;f++){var g=n[f],v=g.rowData,w={};for(var m in v)0!=m.indexOf("pq_")&&(w[m]=v[m]);c.push(w)}return{updateList:s,addList:c,deleteList:u,oldList:d}},n.getChanges=function(){for(var t=(this.that,this.udata),r=this.adata,i=this.ddata,o=e.inArray,n=[],a=[],l=[],s=[],d=0,c=i.length;c>d;d++){var h=i[d],u=h.rowData;s.push(u)}for(var d=0,c=t.length;c>d;d++){var h=t[d],f=h.oldRow,u=h.rowData;-1==o(u,s)&&-1==o(u,n)&&(n.push(u),a.push(f))}for(var d=0,c=r.length;c>d;d++){var h=r[d],u=h.rowData;l.push(u)}return{updateList:n,addList:l,deleteList:s,oldList:a}},n.getChangesRaw=function(){var e=(this.that,this.udata),t=this.adata,r=this.ddata,i={updateList:[],addList:[],deleteList:[]};return i.updateList=e,i.addList=t,i.deleteList=r,i},n.commitAdd=function(t,r){for(var i=this.that,o=i.colModel,n=o.length,a=this.adata,l=e.inArray,s=a.length,d=i.getValueFromDataType,c=[],h=t.length,u=[],f=0;h>f;f++)for(var p=t[f],g=0;s>g;g++){var v=a[g].rowData,w=!0;if(-1==l(v,u)){for(var m=0;n>m;m++){var x=o[m],_=x.hidden,I=x.dataType,y=x.dataIndx;if(!_&&y!=r){var b=v[y],b=d(b,I),C=p[y],C=d(C,I);if(b!==C){w=!1;break}}}if(w){var q={},M={};q[r]=p[r],M[r]=v[r],c.push({type:"update",rowData:v,oldRow:M,newRow:q}),u.push(v);break}}}for(var D=[],g=0;s>g;g++){var v=a[g].rowData;-1==l(v,u)&&D.push(a[g])}return this.adata=D,c},n.commitUpdate=function(t,r){for(var i=this.that,o=this.options.trackModel.dirtyClass,n=i.colModel,a=(n.length,this.udata),l=a.length,s=t.length,d=[],c=[],h=0;l>h;h++){var u=a[h],f=u.rowData,p=u.oldRow;if(-1==e.inArray(f,c))for(var g=0;s>g;g++){var v=t[g];if(f[r]==v[r]){c.push(f);for(var w in p)i.removeClass({rowData:f,dataIndx:w,cls:o})}}}for(var m=[],h=0;l>h;h++){var f=a[h].rowData;-1==e.inArray(f,c)&&m.push(a[h])}return this.udata=m,d},n.commitDelete=function(e,t){for(var r,i,o,n,a=this.ddata,l=a.length,s=this.udata;l--&&(r=a[l].rowData,i=r[t],o=e.length);)for(;o--;)if(i==e[o][t]){for(e.splice(o,1),a.splice(l,1),n=s.length;n--;)s[n].rowData==r&&s.splice(n,1);break}},n.commitUpdateAll=function(){for(var e=this.that,t=this.options.trackModel.dirtyClass,r=this.udata,i=0,o=r.length;o>i;i++){var n=r[i],a=n.oldRow,l=n.rowData;for(var s in a)e.removeClass({rowData:l,dataIndx:s,cls:t})}this.udata=[]},n.commitAddAll=function(){this.adata=[]},n.commitDeleteAll=function(){for(var e,t=this.ddata,r=this.udata,i=r.length,o=t.length,n=0;i>0&&o>n;n++){for(e=t[n].rowData;i--;)r[i].rowData==e&&r.splice(i,1);i=r.length}t.length=0},n.commit=function(e){var t=this.that,r=e?e.history:null,r=null==r?!1:r,i=t.options.dataModel,o=[],n=[],a=[],l=i.recIndx;if(null==e)this.commitAddAll(),this.commitUpdateAll(),this.commitDeleteAll();else{var s=e.type,d=e.rows;"add"==s?d?n=this.commitAdd(d,l):this.commitAddAll():"update"==s?d?a=this.commitUpdate(d,l):this.commitUpdateAll():"delete"==s&&(d?this.commitDelete(d,l):this.commitDeleteAll())}o=n.concat(a),o.length&&(t._digestData({source:"commit",checkEditable:!1,track:!1,history:r,rowList:o}),t.refreshView())},n.rollbackAdd=function(e,t){for(var r=this.adata,i=[],o=(e.type,0),n=r.length;n>o;o++){var a=r[o],l=a.rowData;i.push({type:"delete",rowData:l})}return this.adata=[],i},n.rollbackDelete=function(e,t){for(var r=this.ddata,i=[],o=(e.type,r.length-1);o>=0;o--){var n=r[o],a=(n.indx,n.rowIndx),l=n.rowData;i.push({type:"add",rowIndx:a,newRow:l})}return this.ddata=[],i},n.rollbackUpdate=function(e,t){for(var r=this.that,i=this.options.trackModel.dirtyClass,o=this.udata,n=[],a=0,l=o.length;l>a;a++){var s=o[a],d=s.recId,c=s.rowData,h={},u=s.oldRow;if(null!=d){var f=[];for(var p in u)h[p]=c[p],f.push(p);r.removeClass({rowData:c,dataIndx:f,cls:i,refresh:!1}),n.push({type:"update",rowData:c,newRow:u,oldRow:h})}}return this.udata=[],n},n.rollback=function(e){var t=this.that,r=t.options.dataModel,i=t.options.pageModel,o=e&&null!=e.refresh?e.refresh:!0,n=e&&null!=e.type?e.type:null,a=[],l=[],s=[],d=[],c=r.data;null!=n&&"update"!=n||(s=this.rollbackUpdate(i,c)),null!=n&&"delete"!=n||(l=this.rollbackDelete(i,c)),null!=n&&"add"!=n||(d=this.rollbackAdd(i,c)),a=l.concat(d,s),t._digestData({history:!1,allowInvalid:!0,checkEditable:!1,source:"rollback",track:!1,rowList:a}),o&&t.refreshView()};var a=t.pqGrid.prototype;a.getChanges=function(e){if(this.blurEditor({force:!0}),e){var t=e.format;if(t){if("byVal"==t)return this.iUCData.getChangesValue(e);if("raw"==t)return this.iUCData.getChangesRaw()}}return this.iUCData.getChanges()},a.rollback=function(e){this.blurEditor({force:!0}),this.iUCData.rollback(e)},a.isDirty=function(e){return this.iUCData.isDirty(e)},a.commit=function(e){this.iUCData.commit(e)},a.updateRow=function(e){for(var t=this,r=e.rowList||[{rowIndx:e.rowIndx,newRow:e.newRow||e.row,rowData:e.rowData,rowIndxPage:e.rowIndxPage}],i=[],o=0,n=r.length;n>o;o++){var a=t.normalize(r[o]),l=a.newRow,s=a.rowData,d={};if(s){for(var c in l)d[c]=s[c];a.oldRow=d,a.type="update",i.push(a)}}if(!i.length)return!1;var h=this._digestData({source:e.source||"update",history:e.history,checkEditable:e.checkEditable,track:e.track,allowInvalid:e.allowInvalid,rowList:i});return h===!1?!1:void(e.refresh!==!1&&(i.length>1?t.refresh():t.refreshRow({rowIndx:i[0].rowIndx})))},a.getRecId=function(e){var t=this,r=t.options.dataModel;e.dataIndx=r.recIndx;var i=t.getCellData(e);return null==i?null:i},a.getCellData=function(e){var t=e.rowData||this.getRowData(e),r=e.dataIndx;return t?t[r]:null},a.getRowData=function(e){if(!e)return null;var t,r=e.rowData;if(null!=r)return r;if(t=e.recId,null==t){var i=e.rowIndx,i=null!=i?i:e.rowIndxPage+this.rowIndxOffset,o=this.get_p_data(),n=o[i];return n}for(var a=this.options,l=a.dataModel,s=l.recIndx,d=l.data,c=0,h=d.length;h>c;c++){var n=d[c];if(n[s]==t)return n}return null},a.deleteRow=function(e){for(var t=this,r=e.rowList||[{rowIndx:e.rowIndx,rowIndxPage:e.rowIndxPage}],i=[],o=0,n=r.length;n>o;o++){var a=t.normalize(r[o]),l=a.rowData;a.oldRow=l,a.type="delete",i.push(a)}return i.length?(this._digestData({source:e.source||"delete",history:e.history,track:e.track,rowList:i}),void(e.refresh!==!1&&t.refreshView())):!1},a.addRow=function(e){var t=this,r=e.rowList||[{rowIndx:e.rowIndx,rowIndxPage:e.rowIndxPage,newRow:e.newRow||e.rowData}],i=[],o=t.options,n=o.dataModel,a=n.data;null==a&&(n.data=[],a=n.data);for(var l=0,s=r.length;s>l;l++){var d=t.normalize(r[l]);d.type="add",i.push(d)}if(!i.length)return!1;var c=this._digestData({source:e.source||"add",history:e.history,track:e.track,checkEditable:e.checkEditable,rowList:i});if(c===!1)return!1;e.refresh!==!1&&this.refreshView();var h=i[0].rowIndx;return null==h?a.length-1:h}}(jQuery),function(e){var t=function(e){this.focusSelection=null},r=t.prototype;r.inViewRow=function(e){var t=this.that,r=t.options,i=r.freezeRows,o=t.finalV;return i>e?!0:e>=t.initV&&o>=e};var i=function(e){this.that=e;var t=e.options;this.options=t,this.selection=[],this.hclass=" pq-state-select "+(t.bootstrap.on?"":"ui-state-highlight")};e.paramquery.cRows=i;var o=function(e){var t=e.options;this.that=e,this.selection=[],this.hclass="pq-state-select "+(t.bootstrap.on?"":"ui-state-highlight")};e.paramquery.cCells=o;var n=o.prototype=new t,a=i.prototype=new t;a.isSelected=function(e){var t=e.rowData||this.that.getRowData(e);return t?t.pq_rowselect===!0:null},a.selectRange=function(e){var t=(this.that,e.range),r=t.r1,i=t.r2,o=e.evt,n=[];if(r>i){var a=r;r=i,i=a}for(var l=r;i>=l;l++)n.push({rowIndx:l});this.add({rows:n,evt:o})},n.removeAll=function(e){e=e||{};var t=this.that,r=t.get_p_data(),i=this.hclass;if(r&&r.length){t.$tbl&&t.$tbl.children().children().children().removeClass(i);for(var o=0,n=r.length;n>o;o++){var a=r[o];a&&delete a.pq_cellselect}}},a.removeAll=function(e){e=e||{};var t=this.that,r=e.all,i=this.hclass,o=t.get_p_data();if(o&&o.length){e.refresh&&t.$tbl&&t.$tbl.children().children().removeClass(i),o=r?o:t.pdata;for(var n=0,a=o.length;a>n;n++){var l=o[n];l&&delete l.pq_rowselect}}},n.isSelected=function(e){var t=this.that,r=e.rowData||t.getRowData(e),i=e.dataIndx,o=e.colIndx;return null==o&&null==i?null:null==r?null:(i=null==i?t.colModel[o].dataIndx:i,1==(r.pq_cellselect&&r.pq_cellselect[i]))},a.getSelection=function(){for(var e=this.that,t=e.selection(),r=t.address(),i=[],o=0,n=r.length;n>o;o++){var a=r[o],l=a.type;if("row"==l)for(var s=a.r1,d=a.r2,c=s;d>=c;c++){var h=e.getRowData({rowIndx:c});i.push({rowIndx:c,rowData:h})}}return i},n.getSelection=function(){for(var e=this.that,t=e.selection(),r=e.colModel,i=t.address(),o=[],n=0,a=i.length;a>n;n++){var l=i[n],s=l.type;if("block"==s||"cell"==s||"column"==s)for(var d=l.r1,c=l.r2,h=l.c1,u=l.c2,f=d;c>=f;f++)for(var p=e.getRowData({rowIndx:f}),g=h;u>=g;g++)o.push({rowIndx:f,rowData:p,colIndx:g,dataIndx:r[g].dataIndx})}return o},n.inViewCell=function(e,t){var r=this.that,i=r.options,o=i.freezeCols;return this.inViewRow(e)?o>t||t>=r.initH&&t<=r.finalH:!1},n._add=function(e){var t,r=this.that,i=r.normalize(e),o=i.rowIndxPage,n=i.rowData,a=i.colIndx,l=i.dataIndx,s=this.isSelected({rowData:n,dataIndx:l});if(null==s)return!1;var d=r.iMerge.ismergedCell(i.rowIndx,a)||this.inViewCell(o,a);if(s===!1){if(d){var c=r.getCell({rowIndxPage:o,colIndx:a});c&&c.addClass(this.hclass)}var h=n.pq_cellselect=n.pq_cellselect||{};h[l]=!0,t=!0}return t?i:void 0},a._add=function(e){var t=this.that,r=t.normalize(e),i=r.rowIndxPage,o=r.rowData,n=this.isSelected({rowData:o});if(r.rowIndxPage=i,null==n)return!1;var a=this.inViewRow(i);if(n===!1){if(!o.pq_hidden&&a){var l=t.getRow({rowIndxPage:i});l.length&&l.addClass(this.hclass)}o.pq_rowselect=!0}},n.add=function(e){var t=(this.that,!1);t=this._add(e)},a.add=function(e){var t=(this.that,e.rows);if(t&&"function"==typeof t.push)for(var r=0,i=t.length;i>r;r++){var o=t[r];o.trigger=!1,this._add(o)}else this._add(e)},a._remove=function(e){var t=this.that,r=t.normalize(e),i=r.rowIndx,o=r.rowIndxPage,n=r.rowData,a=r.$tr,l=(r.evt,this.isSelected({rowData:n}));if(l){if(this.inViewRow(o)){var a=t.getRow({rowIndxPage:o});a&&(a.removeClass(this.hclass),a.removeAttr("tabindex"))}return n.pq_rowselect=!1,{rowIndx:i,rowData:n}}},a.remove=function(e){var t=e.rows,r=!1;if(t&&"function"==typeof t.push)for(var i=0,o=t.length;o>i;i++){var n=t[i];n.trigger=!1,r=this._remove(n)}else r=this._remove(e)},n.selectBlock=function(t){for(var r=this.that,i=this,o=i.hclass,n=t.range,a=n.r1,l=n.c1,s=n.r2,d=n.c2,c=r.initH,h=r.finalH,u=r.options,f=u.freezeCols,p=[],g=r.colModel,v=[],w=!!t.remove,m=l;d>=m;m++)p[m]=g[m].dataIndx;for(var x=a;s>=x;x++){var _=r.normalize({rowIndx:x}),I=_.rowData,y=_.rowIndxPage;if(I){var b=I.pq_cellselect=I.pq_cellselect||{};if(i.inViewRow(y))for(var m=l;d>=m;m++){var C=p[m];if(w&&b[C]||!w&&!b[C]){if(f>m||m>=c&&h>=m){var q=r.getCell({rowIndxPage:y,colIndx:m});q.length&&v.push(q[0])}b[C]=w?void 0:!0}}else for(var m=l;d>=m;m++){var C=p[m];b[C]=w?void 0:!0}}}v.length&&e(v)[w?"removeClass":"addClass"](o)}}(jQuery),function(e){var t=!0;e(function(){var r=e("<input type='checkbox' style='position:fixed;left:-50px;top:-50px;'/>").appendTo(document.body);r[0].indeterminate=!0,r.on("change",function(){t=!1}),r.click(),r.remove()});var r=e.paramquery.cCheckBoxColumn=function(t,r){var i=this;this.that=t,this.options=t.options,this.column=r;var o={all:!1,header:!1,select:!1,check:!0,uncheck:!1};r.cb=e.extend({},o,r.cb),r._render=function(e){var t=e.rowData;if(!t.pq_gtitle&&!t.pq_gsummary){var i=r.cb.check===e.cellData?"checked":"";return"<input type='checkbox' "+i+" />"}},this.dataIndx=r.dataIndx;var n=t.element,a=t.eventNamespace;t.on("dataAvailable",function(){t.one("dataReady",function(){return i._onDataReady()})}).on("dataReady",function(){i.setValCBox()}),n.on("change"+a,function(t){var r=t.target;return"checkbox"==r.type&&e(r).closest(".pq-grid")[0]==this?i.onCheckBoxChange(t):void 0}),t.on("cellKeyDown",function(e,t){return i.onCellKeyDown(e,t)}),t.on("refreshHeader",function(e,t){return i.refreshHeader(e,t)})},i=r.prototype=new e.paramquery.cClass;i.hasHeaderChkBox=function(){return this.column.cb.header},i.setValCBox=function(){if(this.hasHeaderChkBox()){var e=this.that,t=this.options,r=this.dataIndx,i=this.column.cb,o=i.all,n="remote"==t.pageModel.type,a=e.rowIndxOffset,a=n||!o?a:0,l=o?t.dataModel.data:e.pdata,s=null,d=0,c=0;if(l){for(var h=0,u=0,f=l.length;f>u;u++){var p=l[u],g=u+a;e.isEditableRow({rowIndx:g})&&e.isEditableCell({rowIndx:g,dataIndx:r})&&(h++,p[r]===i.check?d++:c++)}d==h&&h?s=!0:c==h&&(s=!1),this.$inp&&this.$inp.pqval({val:s})}}},i.onHeaderChange=function(t){for(var r=e(t.target),i=this.that,o=this.column,n=o.dataIndx,a=i.options,l=o.cb,s=l.all,d=s?a.dataModel.data:i.pdata,c="remote"==a.pageModel.type,h=i.rowIndxOffset,h=c||!s?h:0,u=[],f={column:o,dataIndx:n,source:"header"},p=r[0].checked,g=0,v=d.length;v>g;g++){var w=g+h,m=d[g],x={},_={};x[n]=p?l.check:l.uncheck,_[n]=m[n],u.push({rowIndx:w,rowData:m,newRow:x,oldRow:_,type:"update"})}var I={rowList:u,source:"checkbox"};return I.history=I.track=l.select?!1:null,f.check=p,f.rows=u,i._trigger("beforeCheck",t,f)===!1?(i.refreshHeader(),!1):i._digestData(I)===!1?(i.refreshHeader(),!1):(i.refresh({header:!1}),u=f.rows=I.rowList,i._trigger("check",t,f),void(l.select&&i.selection({type:"row",method:p?"add":"remove",rows:u})))},i.refreshHeader=function(e,r){var i=this;
if(this.hasHeaderChkBox()){var o=this.that,n=o.pdata;if(n){var a=o.getCellHeader({dataIndx:this.dataIndx});if(a){var l=this.$inp=a.find("input");this.setValCBox(),t&&l.on("click",function(e){null==l.data("pq_value")&&(l[0].checked=!0,l.data("pq_value",!0),i.onHeaderChange(e))}),l.on("change",function(e){i.onHeaderChange(e)})}}}},i._onDataReady=function(){var e=this.that,t=this.options,r=t.dataModel.data,i="remote"==t.pageModel.type,o=i?e.rowIndxOffset:0,n=this.column,a=n.cb,l=n.dataIndx;if(null!=l&&r){for(var s=[],d=0,c=r.length;c>d;d++){var h=r[d];h[l]===a.check&&s.push({rowIndx:d+o,rowData:h})}if(e._trigger("check",null,{rows:s,column:n,dataIndx:l,source:"dataAvailable"})!==!1&&a.select){for(var d=0;c>d;d++){var h=r[d];h[l]===a.check&&(h.pq_rowselect=!0)}e.selection().refresh()}}this.setValCBox()},i.rowSelect=function(e,t){var r=this.that,i=t.rows,o=t.rowData,n=this.dataIndx;if(i)for(var a=0,l=i.length;l>a;a++){var s=i[a],d=s.rowIndx,o=s.rowData;o[n]=!0,r.refreshCell({rowIndx:d,dataIndx:n})}else o&&(o[n]=!0,d=t.rowIndx,r.refreshCell({rowIndx:d,dataIndx:n}));this.setValCBox()},i.rowUnSelect=function(e,t){var r=this.that,i=t.rows,o=t.rowData,n=this.dataIndx;if(i)for(var a=0,l=i.length;l>a;a++){var s=i[a],d=s.rowIndx,o=s.rowData;o[n]=!1,r.refreshCell({rowIndx:d,dataIndx:n})}else o&&(o[n]=!1,d=t.rowIndx,r.refreshCell({rowIndx:d,dataIndx:n}));this.setValCBox()},i.onCheckBoxChange=function(t){var r=this.that,i=this.column.cb,o=e(t.target),n=o.closest(".pq-grid-cell");if(n.length){var a=r.getCellIndices({$td:n}),a=r.normalize(a),l=a.rowData,s=a.rowIndx,d=a.dataIndx;if(d==this.dataIndx){var c=o[0].checked,h={},u={};h[d]=c?i.check:i.uncheck,u[d]=l[d];var f=[{rowData:l,rowIndx:s,oldRow:u,newRow:h,type:"update"}];if(a.check=c,a.rows=f,r._trigger("beforeCheck",t,a)===!1)return r.refreshCell({rowIndx:s,dataIndx:d}),!1;var p={source:"checkbox",rowList:f};if(p.history=p.track=i.select?!1:null,r._digestData(p)===!1)return r.refreshCell({rowIndx:s,dataIndx:d}),!1;r.refreshRow({rowIndx:s}),f=a.rows=p.rowList,r._trigger("check",t,a),i.select&&r.selection({type:"row",method:c?"add":"remove",rows:f}),this.setValCBox()}}},i.onCellKeyDown=function(t,r){if(r.dataIndx==this.dataIndx&&(13==t.keyCode||32==t.keyCode)){var i=e(t.originalEvent.target).find("input");return i.click(),!1}}}(jQuery),function(){for(var e=0,t=["moz","webkit"],r=0;!window.requestAnimationFrame&&r<t.length;r++)window.requestAnimationFrame=window[t[r]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[r]+"CancelAnimationFrame"]||window[t[r]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t){var r=(new Date).getTime(),i=Math.max(0,16-(r-e)),o=window.setTimeout(function(){e=(new Date).getTime(),t()},i);return o}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),function(e){function t(e){this.that=e;var t=this;this.scrollTop=0,this.scrollLeft=0,this.borderRight=0,this.borderRightExtra=0,this.borderTop=0,this.borderTopExtra=0,this.borderLeft=0,this.borderLeftExtra=0,this.borderBottom=0,this.borderBottomExtra=0,this.maxBorder=5e3,this.rowht=e.options.rowHeight,this.colwd=60,e.on("contMouseDown",function(e,r){return t._onContMouseDown(e,r)}).on("mouseDrag",function(e,r){return t._onMouseDrag(e,r)}).on("mouseStop",function(e,r){return t._onMouseStop(e,r)}).on("mousePQUp",function(e,r){return t._onMousePQUp(e,r)}).on("rowMouseDown",function(e,r){return t._onRowMouseDown(e,r)}).on("cellMouseDown",function(e,r){return t._onCellMouseDown(e,r)}).on("refresh",function(t,r){setTimeout(function(){e.element&&e.focus()},0)}).on("cellMouseEnter",function(e,r){return t._onCellMouseEnter(e,r)}).on("rowMouseEnter",function(e,r){return t._onRowMouseEnter(e,r)})}e.paramquery.cMouseSelection=t;var r=t.prototype=new e.paramquery.cClass;r.inViewPort=function(e){var t=this.that,r=t.iRefresh,i=r.getEContHt(),o=r.getEContWd()+1,n=e[0],a=this,l=a.marginTop,s=a.scrollLeft;if(i>=n.offsetTop+n.offsetHeight+l){if("TD"!=n.nodeName.toUpperCase())return!0;if(o>=n.offsetLeft+n.offsetWidth+s)return!0}},r._onCellMouseDown=function(e,t){var r=this.that,i=t.rowIndx,o=(t.rowIndxPage,r.iSelection),n=t.colIndx,a=r.options.selectionModel,l=a.type,s=a.mode;if("cell"!=l)return void r.focus(t);if(null!=n){var d=o.address()[0];if(e.shiftKey&&"single"!=s&&d){var c=d.firstR,h=d.firstC;r.range({r1:c,c1:h,r2:i,c2:n,firstR:c,firstC:h}).select()}else this.mousedown={r1:i,c1:n},r.range({r1:i,c1:n,firstR:i,firstC:n}).select();return r.focus(t),!0}},r._onCellMouseEnter=function(e,t){var r=this.that,i=r.options.selectionModel,o=i.type,n=i.mode;if(this.mousedown&&"single"!=n){if("cell"==o){var a=this.mousedown,l=a.r1,s=a.c1,d=t.rowIndx,c=t.colIndx;if(l==d&&s==c)return;if(a.r2==d&&a.c2==c)return;this.mousedown.r2=d,this.mousedown.c2=c,r.scrollCell({rowIndx:d,colIndx:c}),r.range({r1:l,c1:s,r2:d,c2:c,firstR:l,firstC:s}).select()}r.focus(t)}},r._onRowMouseEnter=function(e,t){var r=this.that,i=r.options.selectionModel,o=i.type,n=i.mode;if("row"==o&&this.mousedown&&"single"!=n){var a=this.mousedown,l=a.r1,s=t.rowIndx;if(l==s)return void r.range({r1:l,firstR:l},!1).select();if(this.mousedown.r2==s)return;this.mousedown.r2=s,r.scrollRow({rowIndx:s}),r.range({r1:l,r2:s,firstR:l},!1).select()}},r._onRowMouseDown=function(t,r){var i,o=this.that,n=r.rowIndx,a=o.iSelection,l=o.options.selectionModel,s=e(t.originalEvent.target).hasClass("pq-grid-number-cell"),d=l.mode,c=l.type;if(("row"==c||l.row&&s)&&null!=n){var h=o.iSelection.address();if(t.shiftKey&&"single"!=d){var u=h.length;if(u&&"row"==h[u-1].type){var f=h[u-1];f.r1=f.firstR,f.r2=n,f.c1=f.c2=f.type=void 0}o.range(h).select()}else(t.ctrlKey||t.metaKey)&&"single"!=d?(i=o.iRows.isSelected({rowIndx:n}),a[i?"removeRow":"add"]({r1:n,firstR:n})):(this.mousedown={r1:n,y1:t.pageY,x1:t.pageX},o.range({r1:n,firstR:n},!1).select());return s&&setTimeout(function(){o.focus({rowIndxPage:r.rowIndxPage,colIndx:o.getFirstVisibleCI(!0)})},0),!0}},r._onContMouseDown=function(e,t){var r=this.that,i=r.options.swipeModel,o=i.on;return o&&(this._stopSwipe(!0),this.swipedown={x:e.pageX,y:e.pageY}),!0},r._onMousePQUp=function(e,t){this.that;this.mousedown=null},r._stopSwipe=function(e){var t=this;e&&(t.swipedown=null,t.swipedownPrev=null),window.clearInterval(t.intID),window.cancelAnimationFrame(t.intID),t.intID=null},r._onMouseStop=function(e,t){var r=this,i=this.that;if(this.swipedownPrev){var o=i.options.swipeModel,n=this.swipedownPrev,a=n.ts,l=(new Date).getTime(),s=l-a,d=n.x,c=n.y,h=e.pageX,u=e.pageY,f=h-d,p=u-c,g=Math.sqrt(f*f+p*p),v=g/s;if(v>o.ratio){var w=0,m=o.repeat;r._stopSwipe();var x=function(){w+=o.speed,m--;var e=h+w*f/s,t=u+w*p/s;r._onMouseDrag({pageX:e,pageY:t}),m>0?r.intID=window.requestAnimationFrame(x):r._stopSwipe(!0)};x()}else r.swipedown=null,r.swipedownPrev=null}},r._onMouseDrag=function(e,t){var r=this.that,i=r.options;if(this.swipedown){var o=this.swipedown,n=o.x,a=o.y,l=e.pageX,s=e.pageY;this.swipedownPrev={x:n,y:a,ts:(new Date).getTime()};var d=i.scrollModel.smooth;i.virtualY&&!d||(this.scrollVertSmooth(a,s),this.syncScrollBarVert()),i.virtualX&&!d||(this.scrollHorSmooth(n,l),this.syncScrollBarHor()),o.x=l,o.y=s}return!0},r.updateTableY=function(e){if(0==e)return!1;var t=this.that,r=this.getTableForVertScroll(),i=t.iRefresh.getEContHt();if(!r||!r.length)return!1;var o,n=r.data("offsetHeight")-1,a=this.scrollTop-e;return o=0>a?0:0>e&&i-n+a>0?n-i:a,this.setScrollTop(o,r,i),!0},r.setScrollTop=function(e,t,r){e>=0&&(e=Math.round(e),this.scrollTop=e,t.parent("div").scrollTop(e))},r.getScrollLeft=function(e){return this.scrollLeft},r.getScrollTop=function(e){return this.scrollTop},r.setScrollLeft=function(t,r,i,o){if(t>=0){t=Math.round(t),this.scrollLeft=t;var n=i?i.parent():e();n=n.add(r?r.parent("div"):e()),n.scrollLeft(t)}},r.scrollVertSmooth=function(e,t){e!=t&&this.updateTableY(t-e)},r.scrollHorSmooth=function(e,t){if(e!=t){var r=this.that,i=r.options,o=t-e,n=this.getTableForHorScroll(),a=this.getTableHeaderForHorScroll(),l=r.iRefresh.getEContWd();if(n||a){var s,d=n?n:a,c=i.virtualX?this.getScrollWidth(d):d.data("scrollWidth"),h=this.scrollLeft-o;s=0>h?0:0>c-l-h?c-l:h,this.setScrollLeft(s,n,a,l)}}},r.syncViewWithScrollBarVert=function(e){if(null!=e){var t=this.that,r=this.getTableForVertScroll();if(r&&r.length){var i=t.options;i.editModel.indices&&t.blurEditor({force:!0});var o=r.data("offsetHeight"),n=t.iRefresh.getEContHt(),a=o-n,l=a*e;(l||0===l)&&(0>l&&(l=0),this.setScrollTop(l,r,n))}}},r.syncViewWithScrollBarHor=function(e){if(null!=e){var t=this.that,r=this.getTableForHorScroll(),i=this.getTableHeaderForHorScroll();if(r||i){var o=t.options;o.editModel.indices&&t.blurEditor({force:!0});var n=r?r:i,a=o.virtualX?this.getScrollWidth(n):n.data("scrollWidth"),l=t.iRefresh.getEContWd(),s=a-l,d=s*e;a&&l&&(0>d&&(d=0),this.setScrollLeft(d,r,i,l))}}},r.resetMargins=function(){this.scrollLeft=0,this.scrollTop=0},r.syncHeaderViewWithScrollBarHor=function(e){if(null!=e){var t=this.that,r=this.getTableHeaderForHorScroll();if(r){var i=t.options,o=i.freezeCols;i.editModel.indices&&t.blurEditor({force:!0});var n=r,a=n.data("scrollWidth"),l=t.iRefresh.getEContWd(),s=t.calcWidthCols(o,e+o);a&&l&&(0>s&&(s=0),r.css("marginLeft",-s))}}},r.syncScrollBarVert=function(){var e=this.that,t=this.getTableForVertScroll();if(t&&t.length){var r=t.data("offsetHeight"),i=e.iRefresh.getEContHt(),o=r-i,n=this.scrollTop,a=n/o;a>=0&&1>=a&&e.vscroll.widget().hasClass("pq-sb-vert")&&e.vscroll.option("ratio",a)}},r.syncScrollBarHor=function(){var e=this.that,t=e.options,r=this.getTableForHorScroll(),i=this.getTableHeaderForHorScroll();if(r||i){var o=r?r:i,n=t.virtualX?this.getScrollWidth(o):o.data("scrollWidth"),a=e.iRefresh.getEContWd(),l=n-a,s=this.scrollLeft,d=s/l;d>=0&&1>=d&&e.hscroll.widget().hasClass("pq-sb-horiz")&&e.hscroll.option("ratio",d)}},r.getTableForVertScroll=function(){var t=this.that,r=t.pqpanes,i=t.$tbl;if(i&&i.length)return r.h&&r.v?i=e([i[2],i[3]]):r.v?i=e([i[0],i[1]]):r.h&&(i=e(i[1])),i},r.getTableForHorScroll=function(){var t=this.that,r=t.pqpanes,i=[],o=t.$tbl;if(o&&o.length){if(r.h&&r.v?i.push(o[1],o[3]):r.v?i.push(o[1]):r.h?i.push(o[0],o[1]):i.push(o[0]),t.tables.length){var n=t.tables[0].$tbl;r.v?i.push(n[1]):i.push(n[0])}return e(i)}},r.getTableHeaderForHorScroll=function(){var t=this.that,r=t.pqpanes,i=t.$tbl_header;if(i&&i.length)return i=e(r.vH?i[1]:i[0]),i.parent()},r.scrollRowNonVirtual=function(e){var t=this.that,r=t.options,i=e.rowIndxPage,o=(!!t.iHierarchy,e.rowIndx),n=t.iRefresh.getEContHt(),i=null==i?o-t.rowIndxOffset:i,a=parseInt(r.freezeRows);if(!(a>i)){var l=t.get$Tbl(i),s=t.getRow({rowIndxPage:i}),d=s[0];if(d){var c=l[0].offsetTop+1,h=d.offsetHeight,u=this.getScrollTop(),f=d.offsetTop-1,p=-1;if(0>c+f-u){var g=c+f+p;g=0>g?0:g,this.setScrollTop(g,l,n),this.syncScrollBarVert()}else if(f+h-u>n){var g=h+f-n;this.setScrollTop(g,l,n),this.syncScrollBarVert()}}}},r.scrollColumnNonVirtual=function(e){var t=this.that,r=e.colIndx,r=null==r?t.getColIndx({dataIndx:e.dataIndx}):r,i=t.options.freezeCols;if(!(i>r)){var o=t._calcRightEdgeCol(r).width,n=t._calcRightEdgeCol(r-1).width,a=t._calcRightEdgeCol(i-1).width,l=this.getTableForHorScroll(),s=this.getTableHeaderForHorScroll(),d=t.iRefresh.getEContWd(),c=this.scrollLeft;if(o-c>d){var h=o-d;this.setScrollLeft(h,l,s,d),this.syncScrollBarHor()}else if(c>n-a){var h=n-a;this.setScrollLeft(h,l,s,d),this.syncScrollBarHor()}}}}(jQuery),function(e){var t=null,r=!1,i="pq-grid-excel",o="",n=e.paramquery.pqGrid.prototype,a=n.options,l={on:!0,header:!0,zIndex:1e4},s={on:!0},d={on:!0,compare:"byVal",select:!0,validate:!0,allowInvalid:!0,type:"replace"};a.pasteModel=a.pasteModel||d,a.copyModel=a.copyModel||l,a.cutModel=a.cutModel||s,n._setGlobalStr=function(e){o=e},n.canPaste=function(){return!!o},n.copy=function(){t=new c(this),t.copy(),t=null},n.paste=function(e){t=new c(this),t.paste(e),t=null},n.cut=function(){t=new c(this),t.copy({cut:!0,source:"cut"}),t=null},n.clear=function(){this.iSelection.clear()};var c=function(e,t){this.that=e},h=c.prototype;h.createClipBoard=function(){var t=e("#pq-grid-excel-div"),r=this.that.options.copyModel,o=e("#"+i);0==o.length&&(t=e("<div id='pq-grid-excel-div' style='position:fixed;top:20px;left:20px;height:1px;width:1px;overflow:hidden;z-index:"+r.zIndex+";'/>").appendTo(document.body),o=e("<textarea id='"+i+"' autocomplete='off' spellcheck='false' style='overflow:hidden;height:10000px;width:10000px;opacity:0' />").appendTo(t),o.css({opacity:0})),o.on("focusin",function(e){e.stopPropagation()}),o.select()},h.destroyClipBoard=function(){this.clearClipBoard();var t=this.that,r=e(window).scrollTop(),i=e(window).scrollLeft();t.focus();var o=e(window).scrollTop(),n=e(window).scrollLeft();r==o&&i==n||window.scrollTo(i,r)},h.clearClipBoard=function(){var t=e("#"+i);t.val("")},h.copy=function(e){return this.that.iSelection.copy(e)},h.paste=function(t){t=t||{};var r,i=this.that,n=t.dest,a=t.clip,l=a?a.length?a.val():"":o,l=l.replace(/\n$/,""),s=l.split("\n"),d=s.length,c=i.colModel,h=i.options,u=i.readCell,f=h.pasteModel,p="row",g=!1,v=c.length;if(f.on&&0!=l.length&&0!=d){var w={rows:s};if(i._trigger("beforePaste",null,w)===!1)return!1;var m,x,_,I,y=f.type,b=n?i.range(n):i.selection(),C=b._areas,q=C.length?C[0]:null;q&&i.getRowData({rowIndx:q.r1})?(p="row"==q.type?"row":"cell",m=q.r1,_=q.r2,x=q.c1,I=q.c2):(p="cell",m=0,_=0,x=0,I=0);var M,D;"replace"==y?(M=m,D=d>_-m+1?"extend":"repeat"):"append"==y?(M=_+1,D="extend"):"prepend"==y&&(M=m,D="extend");for(var R,P,T,k="extend"==D?d:_-m+1,S=0,H=t.rowList||[],E=0,$=0;k>$;$++){var V=s[S],z=$+M,W="replace"==y?i.getRowData({rowIndx:z}):null,L=W?{}:null,A={};void 0===V&&"repeat"===D&&(S=0,V=s[S]),S++;var F=V.split(" ");if(!P)if("cell"==p){if(r=F.length,R=I-x+1<F.length?"extend":"repeat",P="extend"==R?r:I-x+1,isNaN(P))throw"lenH NaN. assert failed.";P+x>v&&(P=v-x)}else P=v,x=0;for(var O=0,N=0,j=0,T=P,B=F.length,N=0;T>N;N++){O>=B&&(O=0);var G=N+x,U=c[G],K=F[O],Q=U.dataIndx;U.copy!==!1?(O++,A[Q]=K,L&&(L[Q]=u(W,U))):(j++,"extend"==R&&v>T+x&&T++)}if(0==e.isEmptyObject(A)){var X="update";null==W&&(g=!0,X="add"),H.push({newRow:A,rowIndx:z,rowData:W,oldRow:L,type:X}),E++}}var Y={rowList:H,source:"paste",allowInvalid:f.allowInvalid,validate:f.validate};i._digestData(Y),i[g?"refreshView":"refresh"](),f.select&&("cell"==p?i.range({r1:M,c1:x,r2:M+E-1,c2:"extend"==R?x+P-1+j:I}).select():i.range({r1:M,r2:M+E-1}).select()),i._trigger("paste",null,w)}},e(document).unbind(".pqExcel").bind("keydown.pqExcel",function(o){if(o.ctrlKey||o.metaKey){var n=e(o.target);if(!(n.hasClass("pq-grid-row")||n.hasClass("pq-grid-cell")||n.is("#"+i)||n.hasClass("pq-grid-cont")))return;var a=n.closest(".pq-grid");if(t||n.length&&a.length){if(!t){try{var l=a.pqGrid("getInstance").grid;if(l.option("selectionModel.native"))return!0}catch(s){return!0}t=new c(l,n),t.createClipBoard()}if("67"==o.keyCode||"99"==o.keyCode)t.copy({clip:e("#"+i)});else if("88"==o.keyCode)t.copy({cut:!0,clip:e("#"+i)});else if("86"==o.keyCode||"118"==o.keyCode)r=!0,t.clearClipBoard(),window.setTimeout(function(){t&&(t.paste({clip:e("#"+i)}),t.destroyClipBoard(),t=null),r=!1},0);else{var d=e("#"+i);if(d.length){var h=document.activeElement;h==d[0]&&t.that._onKeyPressDown(o)}}}}else{var f=o.keyCode,p=e.ui.keyCode,g=f==p.UP||f==p.DOWN||f==p.LEFT||f==p.RIGHT||f==p.PAGE_UP||f==p.PAGE_DOWN;if(g){if(u)return!1;var n=e(o.target);(n.hasClass("pq-grid-row")||n.hasClass("pq-grid-cell"))&&(u=!0)}}}).bind("keyup.pqExcel",function(i){var o=i.keyCode;if(r||!t||i.ctrlKey||i.metaKey||-1==e.inArray(o,[17,91,93,224])||(t.destroyClipBoard(),t=null),u){var n=e(i.target);n.hasClass("pq-grid-row")||n.hasClass("pq-grid-cell")||(u=!1)}});var u=!1}(jQuery),function(e){var t=e.paramquery.pqGrid.prototype.options,r={on:!0,checkEditable:!0,checkEditableAdd:!1,allowInvalid:!0};t.historyModel=t.historyModel||r;var i=e.paramquery.cHistory=function(e){var t=this;this.that=e,this.options=e.options,this.records=[],this.counter=0,this.id=0,e.on("keyDown",function(e,r){return t._onKeyDown(e,r)}).on("dataAvailable",function(e,r){"filter"!=r.source&&t.reset()})},o=i.prototype=new e.paramquery.cClass;o._onKeyDown=function(e,t){var r={z:"90",y:"89",c:"67",v:"86"},i=e.ctrlKey||e.metaKey;return i&&e.keyCode==r.z?(this.undo(),!1):i&&e.keyCode==r.y?(this.redo(),!1):void 0},o.resetUndo=function(){if(0==this.counter)return!1;this.counter=0;var e=this.that;e._trigger("history",null,{type:"resetUndo",num_undo:0,num_redo:this.records.length-this.counter,canUndo:!1,canRedo:!0})},o.reset=function(){if(0==this.counter&&0==this.records.length)return!1;this.records=[],this.counter=0,this.id=0;var e=this.that;e._trigger("history",null,{num_undo:0,num_redo:0,type:"reset",canUndo:!1,canRedo:!1})},o.increment=function(){var e=this.records,t=e.length;if(t){var r=e[t-1].id;this.id=r+1}else this.id=0},o.push=function(t){var r=this.canRedo(),i=this.records,o=this.counter;i.length>o&&i.splice(o,i.length-o),i[o]=e.extend({id:this.id},t),this.counter++;var n,a,l=this.that;1==this.counter&&(n=!0),r&&this.counter==i.length&&(a=!1),l._trigger("history",null,{type:"add",canUndo:n,canRedo:a,num_undo:this.counter,num_redo:0})},o.canUndo=function(){return this.counter>0},o.canRedo=function(){return this.counter<this.records.length},o.processCol=function(e,t){var r=this.that;if(e.length){var i="add"==e.type,i=t?i:!i;r[i?"addColumn":"deleteColumn"]({colList:e,history:!1})}},o.undo=function(){var e=this.canRedo(),t=this.that,r=!1,i=this.options.historyModel,o=this.records;if(!(this.counter>0))return!1;this.counter--;for(var n=this.counter,a=o[n],l=a.rowList,l=l?l:[],s=a.colList,s=s?s:[],d=[],c=(a.id,0),h=l.length;h>c;c++){var u=l[c],f=u.newRow,p=u.rowData,g=u.type,v=u.oldRow,w=u.rowIndx;"update"==g?(w=t.getRowIndx({rowData:p}).rowIndx,d.push({type:g,rowIndx:w,rowData:p,oldRow:f,newRow:v})):"add"==g?(r=!0,d.push({type:"delete",rowData:f})):"delete"==g&&(r=!0,d.push({type:"add",rowIndx:w,newRow:p}))}if(s.length)this.processCol(s);else{t._digestData({history:!1,source:"undo",checkEditable:i.checkEditable,checkEditableAdd:i.checkEditableAdd,allowInvalid:i.allowInvalid,rowList:d});t[r?"refreshView":"refresh"]({source:"undo"})}var m,x;return e===!1&&(m=!0),0==this.counter&&(x=!1),t._trigger("history",null,{canUndo:x,canRedo:m,type:"undo",num_undo:this.counter,num_redo:this.records.length-this.counter}),!0},o.redo=function(){var e=this.canUndo(),t=this.that,r=this.options.historyModel,i=this.counter,o=this.records;if(i==o.length)return!1;for(var n=!1,a=o[i],l=a.rowList,l=l?l:[],s=a.colList,s=s?s:[],d=[],c=(a.id,0),h=l.length;h>c;c++){var u=l[c],f=u.newRow,p=u.rowData,g=u.type,v=u.oldRow,w=u.rowIndx;"update"==g?(w=t.getRowIndx({rowData:p}).rowIndx,d.push({type:g,rowIndx:w,rowData:p,oldRow:v,newRow:f})):"add"==g?(n=!0,d.push({type:"add",rowIndx:w,newRow:f})):"delete"==g&&(n=!0,d.push({type:"delete",rowData:p}))}if(s.length)this.processCol(s,!0);else{t._digestData({history:!1,source:"redo",checkEditable:r.checkEditable,checkEditableAdd:r.checkEditableAdd,allowInvalid:r.allowInvalid,rowList:d});t[n?"refreshView":"refresh"]({source:"redo"})}this.counter<o.length&&this.counter++;var m,x;return 0==e&&(m=!0),this.counter==this.records.length&&(x=!1),t._trigger("history",null,{canUndo:m,canRedo:x,type:"redo",num_undo:this.counter,num_redo:this.records.length-this.counter}),!0};var n=e.paramquery.pqGrid.prototype;n.history=function(e){var t=e.method;return this.iHistory[t](e)}}(jQuery),function(e){var t=e.paramquery;t.filter=function(){var e={begin:{text:"Begins With",TR:!0,string:!0},between:{text:"Between",TR:!0,string:!0,date:!0,number:!0},notbegin:{text:"Does not begin with",TR:!0,string:!0},contain:{text:"Contains",TR:!0,string:!0},notcontain:{text:"Does not contain",TR:!0,string:!0},equal:{text:"Equal To",TR:!0,string:!0,bool:!0},notequal:{text:"Not Equal To",TR:!0,string:!0},empty:{text:"Empty",TR:!1,string:!0,bool:!0},notempty:{text:"Not Empty",TR:!1,string:!0,bool:!0},end:{text:"Ends With",TR:!0,string:!0},notend:{text:"Does not end with",TR:!0,string:!0},less:{text:"Less Than",TR:!0,number:!0,date:!0},lte:{text:"Less than or equal",TR:!0,number:!0,date:!0},range:{TR:!0,string:!0,number:!0,date:!0},regexp:{TR:!0,string:!0,number:!0,date:!0},great:{text:"Great Than",TR:!0,number:!0,date:!0},gte:{text:"Greater than or equal",TR:!0,number:!0,date:!0}};return{conditions:e,getAllConditions:function(){var t=[];for(var r in e)t.push(r);return t}(),getConditions:function(t){var r=[];for(var i in e)e[i][t]&&r.push(i);return r},getTRConditions:function(){var t=[];for(var r in e)e[r].TR&&t.push(r);return t}(),getWTRConditions:function(){var t=[];for(var r in e)e[r].TR||t.push(r);return t}()}}(),t.filter.rules={},t.filter.rules.en={begin:"Begins With",between:"Between",notbegin:"Does not begin with",contain:"Contains",notcontain:"Does not contain",equal:"Equal To",notequal:"Not Equal To",empty:"Empty",notempty:"Not Empty",end:"Ends With",notend:"Does not end with",less:"Less Than",lte:"Less than or equal",great:"Great Than",gte:"Greater than or equal"};var r=function(e){this.that=e,e.on("load",function(){var t=e.options.dataModel.dataUF;t&&(t.length=0)})};t.cFilterData=r;var i=r.prototype;r.conditions={equal:function(e,t){return e==t?!0:void 0},contain:function(e,t){return-1!=e.indexOf(t)?!0:void 0},notcontain:function(e,t){return-1==e.indexOf(t)?!0:void 0},empty:function(e){return 0==e.length?!0:void 0},notempty:function(e){return e.length>0?!0:void 0},begin:function(e,t){return 0==(e+"").indexOf(t)?!0:void 0},notbegin:function(e,t){return 0!=e.indexOf(t)?!0:void 0},end:function(e,t){var r=e.lastIndexOf(t);return-1!=r&&r+t.length==e.length?!0:void 0},notend:function(e,t){var r=e.lastIndexOf(t);return-1==r||r+t.length!=e.length?!0:void 0},regexp:function(e,t){return t.test(e)?(t.lastIndex=0,!0):void 0},notequal:function(e,t){return e!=t?!0:void 0},great:function(e,t){return e>t?!0:void 0},gte:function(e,t){return e>=t?!0:void 0},between:function(e,t,r){return e>=t&&r>=e?!0:void 0},range:function(t,r){return-1!=e.inArray(t,r)?!0:void 0},less:function(e,t){return t>e?!0:void 0},lte:function(e,t){return t>=e?!0:void 0}},r.convert=function(t,r){return t=null==t?"":t,"string"==r?t=e.trim(t).toUpperCase():"date"==r?t=Date.parse(t):"integer"==r?t=parseInt(t):"float"==r?t=parseFloat(t):"bool"==r&&(t=String(t).toLowerCase()),t},i.isMatchCellSingle=function(e,t){var i=e.dataIndx,o=e.dataType,n=e.value,a=e.value2,l=e.condition,s=e.cbFn,d=t[i];d="regexp"==l?null==d?"":d:r.convert(d,o);var c=!!s(d,n,a);return c},i.isMatchRow=function(e,t,r){if(0==t.length)return!0;for(var i=0;i<t.length;i++){var o=t[i],n=this.isMatchCell(o,e);if("OR"==r&&n)return!0;if("AND"==r&&!n)return!1}return"AND"==r?!0:"OR"==r?!1:void 0},i.getQueryStringFilter=function(){var e=this.that,t=e.options,r=t.stringify,i=t.filterModel,o=i.mode,n=e.colModel,a=this.getFilterData({CM:n,location:"remote"}),l="";if(i&&i.on&&a)if(a.length){var s={mode:o,data:a};l=r===!1?s:JSON.stringify(s)}else l="";return l},i.filterLocalData=function(e){e=e||{};var t=this.that,r=e.apply,r=null==r?!0:r,i=r?t.colModel:e.CM,o=this.getFilterData({CM:i}),n=t.options,a=n.dataModel,l=t.iSort,s=a.data,d=[],c=[],h=a.dataUF,u=n.filterModel,f=u.multiple,p=u?u.mode:null;if(s||(s=a.data=[]),h||(h=a.dataUF=[]),r===!1&&(s=s.slice()),h.length){for(var g=0,v=h.length;v>g;g++)s.push(h[g]);0==l.readSorter().length&&l.sortLocalData(s),h=a.dataUF=[]}else{if(!o.length)return{data:s,dataUF:h};l.saveOrder()}if(this.isMatchCell=f?this.isMatchCellMultiple:this.isMatchCellSingle,u.on&&p&&o&&o.length){if(s.length)for(var g=0,v=s.length;v>g;g++){var w=s[g];this.isMatchRow(w,o,p)?d.push(w):c.push(w)}s=d,h=c,r&&(a.data=s,a.dataUF=h)}return r&&(t._queueATriggers.filter={ui:{type:"local",filter:o}}),{data:s,dataUF:h}},i.getFilterData=function(r){var i=r.CM;if(!i)throw"CM N/A";for(var o=this.that,n=i.length,a=r.location,l=o.options.filterModel,s=(l.multiple,t.filter.getAllConditions),d=t.filter.getTRConditions,c=[],h=t.cFilterData,u=function(t,r,i){return"function"==typeof t?!0:"between"==t?null!=r&&""!==r||null!=i&&""!==i:-1!=e.inArray(t,s)?null!=r&&""!==r||-1==e.inArray(t,d):!0},f=function(e,t){return"remote"==a?(e=null==e?"":e,e.toString()):h.convert(e,t)},p=0;n>p;p++){var g=i[p],v=g.filter;if(v&&v.on){var w=g.dataIndx,m=g.dataType,m=m&&"stringi"!=m&&"function"!=typeof m?m:"string",x=v.value,_=v.value2,I=v.condition;if(u(I,x,_)){if("between"==I)""===x||null==x?(I="lte",x=f(_,m)):""===_||null==_?(I="gte",x=f(x,m)):(x=f(x,m),_=f(_,m));else if("regexp"==I){if("remote"==a)x=x.toString();else if("string"==typeof x)try{var y=v.modifiers,y=y?y:"gi";x=new RegExp(x,y)}catch(b){x=/.*/}}else if("range"==I){if(null==x)continue;if("string"==typeof x)x=f(x,m),x=x.split(/\s*,\s*/);else if(x&&"function"==typeof x.push){if(0==x.length)continue;x=x.slice();for(var C=0,q=x.length;q>C;C++)x[C]=f(x[C],m)}}else x=f(x,m);var M;M="remote"==a?"":"function"==typeof I?I:h.conditions[I],c.push({dataIndx:w,value:x,value2:_,condition:I,dataType:m,cbFn:M})}}}return c}}(jQuery),function(e){var t=e.paramquery,r=t.cSort=function(e){var t=this;t.that=e,t.sorters=[],t.tmpPrefix="pq_tmp_",t.cancel=!1};t.pqGrid.prototype.sort=function(e){e=e||{};var t=this,r=this.options,i=r.dataModel,o=i.data,n=r.sortModel,a=n.type;if(o&&o.length||"local"!=a){var l,s=r.editModel,d=this.iSort,c=d.getSorter(),h=e.evt,u=null==e.single?d.readSingle():e.single,f=d.readCancel();if(e.sorter?e.addon?(e.single=u,e.cancel=f,l=d.addon(e)):l=e.sorter:l=d.readSorter(),l.length||c.length){s.indices&&t.blurEditor({force:!0});var p={dataIndx:l.length?l[0].dataIndx:null,oldSorter:c,sorter:l,source:e.source,single:u};if(t._trigger("beforeSort",h,p)===!1)return void d.cancelSort();d.resumeSort(),"local"==a&&d.saveOrder(),d.setSorter(l),d.setSingle(u),d.writeSorter(l),d.writeSingle(u),"local"==a?(i.data=d.sortLocalData(o),this._queueATriggers.sort={evt:h,ui:p},e.refresh!==!1&&this.refreshView()):"remote"==a&&(this._queueATriggers.sort={evt:h,ui:p},e.initByRemote||this.remoteRequest({initBySort:!0,callback:function(){t._onDataAvailable()}}))}}};var i=r.prototype;i.cancelSort=function(){this.cancel=!0},i.resumeSort=function(){this.cancel=!1},i.readSorter=function(){var e,t=this.that,r=t.options,i=t.columns,o=[],n=r.sortModel,a=n.sorter;if(a&&(e=a.length)){for(;e--;)null==i[a[e].dataIndx]&&a.splice(e,1);o=o.concat(a)}return o=pq.arrayUnique(o,"dataIndx")},i.setSingle=function(e){this.single=e},i.getSingle=function(){return this.single},i.readSingle=function(){return this.that.options.sortModel.single},i.writeSingle=function(e){this.that.options.sortModel.single=e},i.setCancel=function(e){this.cancel=e},i.getCancel=function(){return this.cancel},i.readCancel=function(){return this.that.options.sortModel.cancel},i.writeCancel=function(e){this.that.options.sortModel.cancel=e},i.writeSorter=function(e){var t=this.that.options,r=t.sortModel;r.sorter=e},i.addon=function(e){e=e||{};var t=e.sorter,r=t[0].dataIndx,i=t[0].dir,o=e.single,n=e.cancel,a=0,l=this.readSorter();if(null==o)throw"sort single N/A";if(null!=r)if(o&&!e.tempMultiple)if(l=l.length?[l[0]]:[],l[a]&&l[a].dataIndx==r){var s=l[a].dir,d="up"===s?"down":n&&"down"===s?"":"up";""===d?l.length--:l[a].dir=d}else d=i?i:"up",l[a]={dataIndx:r,dir:d};else{var c=this.inSorters(l,r);c>-1?(s=l[c].dir,"up"==s?l[c].dir="down":n&&"down"==s?l.splice(c,1):1==l.length?l[c].dir="up":l.splice(c,1)):l.push({dataIndx:r,dir:"up"})}return l},i.saveOrder=function(e){var t=this.that,r=t.options.dataModel,e=r.data;if(e&&e.length&&!(r.dataUF&&r.dataUF.length||this.getSorter().length&&null!=e[0].pq_order))for(var i=0,o=e.length;o>i;i++)e[i].pq_order=i},i.getQueryStringSort=function(){if(this.cancel)return"";var e=this.that,t=this.sorters,r=e.options,i=r.stringify;return t.length?i===!1?t:JSON.stringify(t):""},i.getSorter=function(){var e=this.sorters;return e},i.setSorter=function(e){this.sorters=e.slice(0)},i.inSorters=function(e,t){for(var r=0;r<e.length;r++)if(e[r].dataIndx==t)return r;return-1},i.sortLocalData=function(e){var t=this.sorters;return t.length||(t=[{dataIndx:"pq_order",dir:"up",dataType:"integer"}]),this._sortLocalData(t,e)},i.compileSorter=function(e,t){var r=this,i=r.that,n=i.columns,a=i.options,l=[],s=[],d=[],c=r.tmpPrefix,h=a.sortModel,u=h.useCache,f=h.ignoreCase,p=e.length;t=t?t:a.dataModel.data;for(var g=0;p>g;g++){var v=e[g],w=v.dataIndx,m=n[w]||{},x=v.dir=v.dir||"up",_="up"==x?1:-1,I=m.sortType,I=pq.getFn(I),y=m.dataType||v.dataType||"string",y="string"==y&&f?"stringi":y,b=u&&"date"==y,C=b?c+w:w;s[g]=C,d[g]=_,I?l[g]=function(e,t){return function(r,i,o,n){return t(r,i,o,n,e)}}(I,o.sort_sortType):"integer"==y?l[g]=o.sort_number:"float"==y?l[g]=o.sort_number:"function"==typeof y?l[g]=function(e,t){return function(r,i,o,n){return t(r,i,o,n,e)}}(y,o.sort_dataType):"date"==y?l[g]=o["sort_date"+(b?"_fast":"")]:"bool"==y?l[g]=o.sort_bool:"stringi"==y?l[g]=o.sort_locale:l[g]=o.sort_string,b&&r.useCache(t,y,w,C)}return r._composite(l,s,d,p)},i._composite=function(e,t,r,i){return function(o,n){for(var a=0,l=0;i>l&&(a=e[l](o,n,t[l],r[l]),0==a);l++);return a}},i._sortLocalData=function(e,t){if(!t)return[];if(!t.length||!e||!e.length)return t;var r=this,i=r.that,o=i.options.sortModel,n=r.compileSorter(e),a={sort_composite:n};return i._trigger("customSort",null,a)!==!1?t.sort(n):t=a.data,o.useCache&&setTimeout(r.removeCache(e,t),0),t},i.useCache=function(e,t,r,i){for(var n=o["get_"+t],a=e.length;a--;){var l=e[a];l[i]=n(l[r])}},i.removeCache=function(e,t){var r=this.tmpPrefix;return function(){for(var i=e.length;i--;){var o=e[i],n=r+o.dataIndx,a=t.length;if(a&&t[0].hasOwnProperty(n))for(;a--;)delete t[a][n]}}};var o={get_date:function(e){var t;return e?isNaN(t=Date.parse(e))?0:t:0},sort_number:function(e,t,r,i){var o=e[r],n=t[r];return o=o?1*o:0,n=n?1*n:0,(o-n)*i},sort_date:function(e,t,r,i){var o=e[r],n=t[r];return o=o?Date.parse(o):0,n=n?Date.parse(n):0,(o-n)*i},sort_date_fast:function(e,t,r,i){var o=e[r],n=t[r];return(o-n)*i},sort_dataType:function(e,t,r,i,o){var n=e[r],a=t[r];return o(n,a)*i},sort_sortType:function(e,t,r,i,o){return o(e,t,r)*i},sort_string:function(e,t,r,i){var o=e[r]||"",n=t[r]||"",a=0;return o>n?a=1:n>o&&(a=-1),a*i},sort_locale:function(e,t,r,i){var o=e[r]||"",n=t[r]||"";return o.localeCompare(n)*i},sort_bool:function(e,t,r,i){var o=e[r],n=t[r],a=0;return o&&!n||o===!1&&null===n?a=1:(n&&!o||n===!1&&null===o)&&(a=-1),a*i}};pq.sortObj=o}(jQuery),function(e){function t(e){this.that=e,this.mc=null;var t=this,r=e.options;this.DM=r.dataModel,e.on("dataReady columnOrder groupShowHide",function(e,i){r.mergeCells&&"pager"!==i.source&&t.init()})}function r(e,t,r){for(var i=t;t+r>i;i++){var o=e[i];if(!o)return-1;if(!o.hidden)return i}}function i(e,t,r){for(var i=t;t+r>i;i++){var o=e[i];if(!o)return-1;if(!o.pq_hidden)return i}}function o(e,t,r){var i=0,o=e.length;r=r>o?o:r;for(var n=t;r>n;n++){var a=e[n];a.hidden!==!0&&i++}return i}function n(e,t,r){var i=0,o=e.length;r=r>o?o:r;for(var n=t;r>n;n++){var a=e[n];a.pq_hidden!==!0&&i++}return i}e.paramquery.cMerge=t;var a=t.prototype=new e.paramquery.cClass;a.init=function(){for(var e=this.that,t=e.colModel,a=e.options.mergeCells||[],l=e.get_p_data(),s=[],d=[],c=0,h=a.length;h>c;c++){var u,f,p=a[c],g=p.r1,v=g,w=l[g],m=p.c1,x=m,_=t[m],I=p.rc,y=p.cc;if(_&&w&&(_.hidden&&(x=r(t,m,y)),u=o(t,m,m+y),w.pq_hidden&&(v=i(l,g,I)),f=n(l,g,g+I),!(1>f||1>u))){s.push({r1:g,c1:m,rc:I,cc:y,e_rc:f,e_cc:u}),d[v]=d[v]||[],d[v][x]={show:!0,rowspan:f,colspan:u,o_rowspan:I,o_colspan:y,style:p.style,cls:p.cls,attr:p.attr,r1:g,c1:m,v_r1:v,v_c1:x};for(var b={show:!1,r1:g,c1:m,v_r1:v,v_c1:x},C=g;g+I>C;C++){d[C]=d[C]||[];for(var q=m;m+y>q;q++)C==v&&q==x||(d[C][q]=b)}}}e._mergeCells=d.length>0,this.mc=d,this.mc2=s},a.isHidden=function(e,t){var r,i=(this.that,this.mc);return!(!(i&&i[e]&&(r=i[e][t]))||r.show)},a.setData=function(e,t,r){var i,o=(this.that,this.mc);o[e]&&(i=o[e][t])&&(i.data=r)},a.getData=function(e,t,r){var i,o=(this.that,this.mc);if(o[e]&&(i=o[e][t])){var n=i.data;return n?n[r]:null}},a.removeData=function(e,t,r){
var i,o=(this.that,this.mc);if(o&&o[e]&&(i=o[e][t])){var n=i.data;n&&(n[r]=null)}},a.ismergedCell=function(e,t){var r,i=(this.that,this.mc);if(i&&i[e]&&(r=i[e][t])){var o=r.v_r1,n=r.v_c1,a=i[o][n];return e==a.r1&&t==a.c1?{rowspan:a.o_rowspan,colspan:a.o_colspan}:!0}return!1},a.isRootCell=function(e,t,r){var i,o=(this.that,this.mc);if(o&&o[e]&&(i=o[e][t])){if("o"==r)return e==i.r1&&t==i.c1;var n=i.v_r1,a=i.v_c1;if("a"==r){var l=o[n][a];return l.a_r1==e&&l.a_c1==t}if(n==e&&a==t){var l=o[n][a];return{rowspan:l.rowspan,colspan:l.colspan}}}},a.getRootCell=function(e,t,r){var i,o=this.that,n=this.mc;if(n&&n[e]&&(i=n[e][t])){if("a"==r){e=i.v_r1,t=i.v_c1;var a=n[e][t];a.a_r1&&(e=a.a_r1,t=a.a_c1)}else"o"==r?(e=i.r1,t=i.c1):(e=i.v_r1,t=i.v_c1);var l=o.colModel,s=l[t],d=o.rowIndxOffset,c=e-d;return 0>c&&(c=0,e=d),{rowIndxPage:c,colIndx:t,column:s,dataIndx:s.dataIndx,rowData:o.getRowData({rowIndx:e}),rowIndx:e,rowspan:i.rowspan,colspan:i.colspan}}return o.normalize({rowIndx:e,colIndx:t})},a.inflateRange=function(e,t,r,i){var o=this.that,n=!1,a=o.options,l=a.groupModel,s=l.on?o.rowIndxOffset+o.pdata.length-1:a.dataModel.data.length-1,d=o.colModel.length-1,c=this.mc2;if(!c)return[e,t,r,i];e:for(var h=0,u=c.length;u>h;h++){var f=c[h],p=f.r1,g=f.c1,v=p+f.rc-1,w=g+f.cc-1,v=v>s?s:v,w=w>d?d:w,m=e>p&&v>=e,x=r>=p&&v>r,_=t>g&&w>=t,I=i>=g&&w>i;if((m||x)&&w>=t&&i>=g||(_||I)&&v>=e&&r>=p){n=!0,e=e>p?p:e,t=t>g?g:t,r=v>r?v:r,i=w>i?w:i;break e}}return n?this.inflateRange(e,t,r,i):[e,t,r,i]};var l=e.paramquery.pqGrid.prototype;l.calcVisibleRows=n,a.renderCell=function(e){var t,r,i=this.that,a=e.rowIndx,l=e.rowIndxPage,s=e.colIndx,d=this.mc;if(d[a]&&(r=d[a][s])){var c=r.v_r1,h=r.v_c1,u=r.r1,f=r.c1,p=i.options,g=i.colModel,v=i.rowIndxOffset,w=p.freezeCols,m=p.freezeRows,x=m?m+v:0,_=i.initH,I=i.initV,y=s==h&&l==I&&c>=x,b=s==h&&a==I&&c>=x,C=a==c&&s==_&&h>=w,q=a==I&&s==_&&h>=w&&c>=x;if(!(r.show||y||b||C||q))return null;var M=u-v,D=i.pdata,R=i.get_p_data(),P=R[u],T=g[f];t={rowData:P,rowIndx:u,colIndx:f,column:T,rowIndxPage:M};var k=d[c][h],S=k.colspan,H=k.rowspan,E=o(g,s,w),$=n(D,a-v,m);if(w&&w>s&&S>E){var V=S-o(g,w,_),z=E;S=Math.max(V,z)}else S-=o(g,h,s);if(m&&a>v&&x>a&&H>$){var W=H-n(D,m,I),L=$;H=Math.max(W,L)}else H-=n(R,c,a);k.a_r1=a,k.a_c1=s,t.rowspan=H,t.colspan=S,t.style=k.style,t.attr=k.attr,t.cls=k.cls}return t?t:e},a.getMergeCells=function(e,t,r){for(var i,o,n,a=this.that,l=a.options.mergeCells,s=a.rowIndxOffset,d=s+r,c=[],h=l?l.length:0,u=0;h>u;u++)i=l[u],o=i.r1,n=i.c1,(!t||o>=s&&d>o)&&(t&&(o-=s),o+=e,c.push({r1:o,c1:n,r2:o+i.rc-1,c2:n+i.cc-1}));return c}}(jQuery),function(){pq.extend=function(e,t,r){var i=function(){};i.prototype=e.prototype;var o=t.prototype=new i,n=e.prototype;for(var a in r){var l=n[a],s=r[a];l?o[a]=function(e,t){return function(){var r,i=this._super;return this._super=function(){return e.apply(this,arguments)},r=t.apply(this,arguments),this._super=i,r}}(l,s):o[a]=s}o.constructor=t,o._base=e,o._bp=function(e){var t=arguments;return Array.prototype.shift.call(t),n[e].apply(this,t)}};var e=pq.Range=function(t,r,i,o){if(null==t)throw"invalid param";return this.that=t,this instanceof e==0?new e(t,r,i,o):(this._type=i?i:"range",void this.init(r,o))},t=e.prototype;t._areas=[],t.init=function(e,t){if(t=t!==!1,e)if("function"==typeof e.push)for(var r=0,i=e.length;i>r;r++)this.init(e[r],t);else{var o=this._normal(e,t);if(o){var n=this._areas;n.length?n.push(o):this._areas=[o]}}},t.address=function(){return this.dirty&&this.refresh(),this._areas},t.areas=function(e){this.dirty&&this.refresh();var t=this.that,r=this._areas,r=null==e?r:r[e];return pq.Range(t,r,"area")},t.merge=function(e){e=e||{};var t,r,i=this.that,o=i.options,n=o.mergeCells,a=this._areas,l=a[0];l&&(t=l.r2-l.r1+1,r=l.c2-l.c1+1,(t>1||r>1)&&(l.rc=t,l.cc=r,n.push(l),e.refresh!==!1&&i.refreshView()))},t.unmerge=function(e){e=e||{};var t=this.that,r=t.options,i=r.mergeCells,o=this._areas,n=o[0];if(n){for(var a=0;a<i.length;a++){var l=i[a];if(l.r1==n.r1&&l.c1==n.c1){i.splice(a,1);break}}e.refresh!==!1&&t.refreshView()}},t.hide=function(e){e=e||{};for(var t=this.that,r=t.colModel,i=t.get_p_data(),o=this._areas,n=0,a=o.length;a>n;n++){var l=o[n],s=l.type,d=l.r1,c=l.r2,h=l.c1,u=l.c2;if("column"==s)for(var f=h;u>=f;f++)r[f].hidden=!0;else if("row"==s)for(var f=d;c>=f;f++)i[f].pq_hidden=!0}e.refresh!==!1&&t.refreshView()},t.unhide=function(e){e=e||{};for(var t=this.that,r=t.colModel,i=t.get_p_data(),o=this._areas,n=0,a=o.length;a>n;n++){var l=o[n],s=l.type,d=l.r1,c=l.r2,h=l.c1,u=l.c2;if("column"==s)for(var f=h;u>=f;f++)r[f].hidden=!1;else if("row"==s)for(var f=d;c>=f;f++)i[f].pq_hidden=!1}e.refresh!==!1&&t.refreshView()},t.select=function(){var e=this.that,t=e.iSelection,r=t._areas[0],i=this._areas,o=i[0];if(!o)return this;var n=o.r1,a=o.c1;if(t.dirty||1!=i.length||"block"!=i[0].type||!r||"cell"!=r.type&&"block"!=r.type||n!=r.r1||a!=r.c1){t.removeAll({trigger:!1});for(var l=0,s=i.length;s>l;l++)t.add(i[l],!1);t._trigger()}else{var d=r.r1,c=r.c1,h=r.r2,u=r.c2,f=o.r2,p=o.c2,g=e.iCells;if(f==h&&p==u)return this;p>u?g.selectBlock({range:{r1:n,c1:u+1,r2:f,c2:p}}):u>p&&g.selectBlock({range:{r1:Math.max(n,d),c1:p+1,r2:Math.max(f,h),c2:u},remove:!0}),f>h?g.selectBlock({range:{r1:h+1,c1:a,r2:f,c2:p}}):h>f&&g.selectBlock({range:{r1:f+1,c1:Math.max(a,c),r2:h,c2:Math.max(p,u)},remove:!0}),t._areas=i,t._trigger()}return this},t.resize=function(t,r){var i=this._areas[0],o={r1:i.r1,c1:i.c1,rc:t,cc:r};return e(this.that,o)},t.cut=function(e){return e=e||{},e.cut=!0,this.copy(e)},t.copy=function(e){e=e||{},this.dirty&&this.refresh();var t=this.that,r=e.dest,i=!!e.cut,o=null==e.copy?!0:e.copy,n=e.source||(i?"cut":"copy"),a=null==e.history?!0:e.history,l=null==e.allowInvalid?!0:e.allowInvalid,s=[],d=[],c=t.get_p_data(),h=t.colModel,u=t.readCell,f=t.iMerge,p=this._areas;if(p.length){for(var g=this._areas[0],v=g.type,w=g.r1,m=g.c1,x="cell"==v?w:g.r2,_="cell"==v?m:g.c2,I=0;;){for(var y=w;x>=y;y++){for(var b=[],C=c[y],q={},M={},D=m;_>=D;D++){var R=h[D],P=R.dataIndx;if(R.copy!==!1){var T=C[P];o&&b.push(u(C,R,f,y,D)),i&&(q[P]=void 0,M[P]=T)}}i&&s.push({rowIndx:y,rowData:C,oldRow:M,newRow:q,type:"update"});var k=b.join(" ");b=[],d.push(k)}if(I++,g=p[I],"row"!=v||!g||"row"!=g.type)break;w=g.r1,m=g.c1,x=g.r2,_=g.c2}if(o){var k=d.join("\n");if(e.clip){var S=e.clip;S.val(k),S.select()}else t._setGlobalStr(k)}if(r)t.paste({dest:r,rowList:s,history:a,allowInvalid:l});else if(i){var H=t._digestData({rowList:s,source:n,history:a,allowInvalid:l});H!==!1&&t.refresh({source:"cut"})}}},t.clear=function(){return this.copy({copy:!1,cut:!0,source:"clear"})},t.add=function(e){this.init(e)},t._countArea=function(e){var t=(this.that,e),r=e.type,i=t.r1,o=t.c1,n=t.r2,a=t.c2;return"cell"==r?1:(n-i+1)*(a-o+1)},t.count=function(){this.dirty&&this.refresh();for(var e=(this.that,"range"==this._type),t=this._areas,r=0,i=t.length,o=0;i>o;o++)r+=e?this._countArea(t[o]):1;return r},t.rows=function(e){this.dirty&&this.refresh();var t=this.that,r=[],i=this._areas[0];if(i)for(var o=i.r1,n=i.c1,a=i.r2,l=i.c2,s=i.type,d=null==e?o:o+e,c=null==e?a:o+e,h=d;c>=h;h++)r.push({r1:h,c1:n,r2:h,c2:l,type:s});return pq.Range(t,r,"row")},t.columns=function(e){this.dirty&&this.refresh();var t=this.that,r=[],i=this._areas[0];if(i)for(var o=i.r1,n=i.c1,a=i.r2,l=i.c2,s=i.type,d=null==e?n:n+e,c=null==e?l:n+e,h=d;c>=h;h++)r.push({r1:o,c1:h,r2:a,c2:h,type:s});return pq.Range(t,r,"column")},t.cell=function(e,t){this.dirty&&this.refresh();var r=this.that,i=[],o=this._areas[0];if(o){var n=o.r1+e,a=o.c1+t;i=[n,a,n,a]}return pq.Range(r,i,"cell")},t.item=function(e){this.dirty&&this.refresh();for(var t=(this.that,0),r=!1,i=this._areas,o=0,n=i.length;n>o;o++){var a=i[o],l=this._countArea(a);if(t+l>e){r=!0,e-=t;break}t+=l}if(r){if(a)var s=a.r1,d=a.c1,c=a.c2,h=c-d+1,u=Math.floor(e/h),f=e%h,s=s+u,d=d+f;return{r1:s,c1:d}}},t._normal=function(e,t){if(e.type)return e;if("function"==e.push){for(var r=[],i=0,o=e.length;o>i;i++){var n=this._normal(e[i],t);n&&r.push(n)}return r}var a,l,s=this.that,d=s.get_p_data(),c=d.length-1,h=s.colModel,u=h.length-1,f=e.r1,p=e.c1,f=f>c?c:f,p=p>u?u:p,g=e.rc,v=e.cc,w=e.r2,m=e.c2,w=w>c?c:w,m=m>u?u:m,w=g?f+g-1:w,m=v?p+v-1:m;if(0>u||0>c)return null;if(f>w&&(a=f,f=w,w=a),p>m&&(a=p,p=m,m=a),null!=f||null!=p){if(null==f?(f=0,w=c,m=null==m?p:m,l="column"):null==p?(p=0,w=null==w?f:w,m=u,l="row"):null==w?(l="cell",w=f,m=p):l="block",t){var r=s.iMerge.inflateRange(f,p,w,m);f=r[0],p=r[1],w=r[2],m=r[3]}return e.r1=f,e.c1=p,e.r2=w,e.c2=m,e.type=e.type||l,e}},t.getValue=function(){var e,t,r,i,o,n,a,l,s,d,c,h=this.address(),u=[],f=this.that;if(h.length){for(e=h[0],o=e.r1,n=e.c1,a=e.r2,l=e.c2,c=f.get_p_data(),s=o;a>=s;s++)for(t=c[s],r=u[s-o]=[],d=n;l>=d;d++)i=t[f.colModel[d].dataIndx],r.push(i);return u}},t.value=function(e){var t,r,i,o,n,a,l,s,d=this.that,c=d.colModel,h=[],u=this.address();if(void 0===e)return this.getValue();i="function"==typeof e.push;for(var f=0;f<u.length;f++){o=u[f],n=o.r1,a=o.c1,l=o.r2,s=o.c2;for(var p=n;l>=p;p++){var g=d.normalize({rowIndx:p}),v=g.rowData,w=g.rowIndx,m={},x={};t=i?e[p-n]:e;for(var _=a;s>=_;_++){var I=c[_].dataIndx;r=i?t[_-a]:e,x[I]=r,m[I]=v[I]}h.push({rowData:v,rowIndx:w,type:"update",newRow:x,oldRow:m})}}return h.length&&(d._digestData({rowList:h,source:"range"}),d.refresh()),this};var r=pq.Selection=function(e,t){if(null==e)throw"invalid param";if(this instanceof r==0)return new r(e,t);this.that=e;var i=(e.options,this);e.on("dataReady columnOrder addColumn deleteColumn",function(e,t){"pager"!=t.source&&i.renew()}),this._base(e,t)},i={};i.renew=function(){this.dirty=!0},i.isDirty=function(){return this.dirty};var o=function(e){e.shiftKey&&"pqGrid:mousePQUp"!=e.type||(this._trigger("selectEnd",null,{selection:this.selection()}),this.off("mousePQUp",o),this.off("keyUp",o))};i._trigger=function(){var e=this.that;this.dirty&&this.refresh(),e._trigger("selectChange",null,{selection:this}),e.off("mousePQUp",o),e.off("keyUp",o),e.on("mousePQUp",o),e.on("keyUp",o)},i.removeAll=function(e){e=e||{};var t=this.that;t.iCells.removeAll({refresh:!0}),t.iRows.removeAll({refresh:!0,all:!0}),this._areas=[],e.trigger!==!1&&this._trigger()},t.indexOf=function(e){this.dirty&&this.refresh(),e=this._normal(e);for(var t=(this.that,e.type),r=e.r1,i=e.c1,o=e.r2,n=e.c2,a=this._areas,l=0,s=a.length;s>l;l++){var d=a[l],c=d;if(t==d.type&&r>=c.r1&&o<=c.r2&&i==c.c1&&n==c.c2)return l}return-1},i.add=function(e,t){var r=this.that,i=this._normal(e,!0),o=r.iCells,n=r.iRows,a=i.r1,l=i.c1,s=i.r2,d=i.type;if(!(this.indexOf(i)>=0)){if("row"==d){var c=this._areas;if(c.length){var h=c[c.length-1],d=h.type;if("row"==d){var u=h.r2;u>=a&&(this.dirty=!0)}}s>a?n.selectRange({range:i}):n.add({rowIndx:a})}else"column"==d||"block"==d?o.selectBlock({range:i}):"cell"==d&&o.add({rowIndx:a,colIndx:l});this._super(i),t!==!1&&this._trigger()}},i._adjust=function(e){var t=this.that,r=t.get_p_data(),i=r.length-1,o=t.colModel,n=o.length-1,a=e.r1,l=e.c1,s=e.r2,d=e.c2,s=s>i?i:s,d=d>n?n:d;return 0>n||0>i||a>s||l>d?null:(e.r1=a,e.r2=s,e.c1=l,e.c2=d,e)},t.removeRow=function(e,t){var r=e.r1,i=e.r2,o=this._areas,n=this._areas[t],a=n.r1,l=n.r2;if(r==a&&i==l)o.splice(t,1);else if(r>a){if(n.r2=r-1,l>i){var s=this._normal({r1:i+1,r2:l});o.splice(t+1,0,s)}}else if(l>i){if(r>a){var s=this._normal({r1:i+1,r2:l});o.splice(t,0,s)}n.r1=i+1}},i.removeRow=function(e,t){var r=this.that,i=this._normal(e),o=this.indexOf(i);o>-1&&"row"==i.type&&i.r1==i.r2&&(r.iRows.remove({rowIndx:i.r1}),this._super(e,o),t!==!1&&this._trigger())},i.selectAll=function(e){e=e||{};var t=e.type,r=this.that,i=r.colModel,o=e.all,n=o?0:r.rowIndxOffset,a=o?r.options.dataModel.data.length-1:r.pdata.length-1,l=i.length-1,s=n+a;if("cell"==t){var d={r1:n,c1:0};d.r2=s,d.c2=l,r.range(d).select()}else{var d={r1:n};d.r2=s,o||this.removeRows({all:!1,trigger:!1}),r.iRows.selectRange({range:d});var c=o?[]:this._areas;c.push({r1:n,c1:0,r2:s,c2:l,type:"row"}),this._areas=c,this._trigger()}return this},i.removeRows=function(e){e=e||{};var t=this.that,r=e.all;t.iRows.removeAll({refresh:!0,all:e.all}),r?this._areas=[]:this.refresh(),e.trigger!==!1&&this._trigger()},i.refresh=function(){for(var e=this.that,t=[],r=e.colModel,i=r.length-1,o=e.get_p_data(),n=0,a=o.length;a>n;n++){var l,s=o[n];s&&(s.pq_cellselect=void 0,s.pq_rowselect?l?l.r2=n:l={r1:n,r2:n,c1:0,c2:i,type:"row"}:l&&(t.push(l),l=null))}l&&t.push(l),this.dirty=!1,this._areas=t},pq.extend(e,r,i)}(),function(e){function t(e,t,r,i){e.push("<li data-option='",r,"' class='pq-menu-item'>","<label>","<input type='checkbox' ",t[r]?"checked":"","/>",i["strGroup_"+r],"</label></li>")}function r(e,t,r,i){var o,n=e[t],a=i;if(n){do o=n[a].rip,a++;while(r>o);return a-1}}var i=e.paramquery;i.pqGrid.defaults.groupModel={on:!1,title:[],titleDefault:"{0} ({1})",header:!0,headerMenu:!0,menuItems:["merge","fixCols","grandSummary"],fixCols:!0,icon:["ui-icon-triangle-1-se","ui-icon-triangle-1-e"],dataIndx:[],collapsed:[],dir:[],showSummary:[],calcSummary:[],summaryInTitleRow:"collapsed",summaryEdit:!0,refreshOnChange:!0},pq.aggregate={sum:function(e){for(var t,r=0,i=e.length;i--;)t=e[i],null!=t&&(r+=t-0);return r},avg:function(e,t){var r=this.sum(e,t,!0)/e.length;return r},max:function(e,t){var r,i=t.dataType;return"float"==i||"integer"==i?r=Math.max.apply(Math,e):"date"==i?(e.sort(function(e,t){return e=Date.parse(e),t=Date.parse(t),isNaN(e)&&(e=0),isNaN(t)&&(t=0),t-e}),r=e[0]):(e.sort(),r=e[e.length-1]),r},min:function(e,t){var r,i,o,n,a=t.dataType;if("integer"==a||"float"==a)r=Math.min.apply(Math,e);else if("date"==a){for(n=e.length,i=[];n--;)o=e[n],o&&i.push({dateO:o,dateP:Date.parse(o)});i.sort(function(e,t){return e.dateP-t.dateP}),r=i.length?i[0].dateO:void 0}else e.sort(),r=e[0];return r},count:function(e){return e.length}};var o=i.cGroup=function(e){var t=this;t.that=e,e.options.groupModel.on&&t.init()},n=o.prototype;n.init=function(){var e,t,r,i,o,n,a=this;a._init||(a.mc=[],a.tree=[],a.summaryData=[],n=a.that,e=n.options,t=e.groupModel,r=e.bootstrap,i=r.on,o=i?"glyphicon ":"ui-icon ",a.groupRemoveIcon="pq-group-remove "+o+(i?"glyphicon-remove":"ui-icon-close"),a.toggleIcon="pq-group-toggle "+o,n.on("cellClick",a.onCellClick(a)).on("cellKeyDown",a.onCellKeyDown(a,t)).on(!0,"cellMouseDown",a.onCellMouseDown()).on("change",a.onChange(a,t)).on("dataReady",a.onDataReady(a,n)).on("columnDragDone",a.onColumnDrag(a)).on("columnOrder",a.onColumnOrder(a)),a._init=!0)},n.onCellClick=function(t){return function(r,i){i.rowData.pq_gtitle&&e(r.originalEvent.target).hasClass("pq-group-icon")&&t.toggleRow(i.rowIndxPage,r)}},n.onChange=function(e,t){return function(){e.saveState(t.refreshOnChange)}},n.onCellMouseDown=function(){return function(t,r){r.rowData.pq_gtitle&&e(t.originalEvent.target).hasClass("pq-group-icon")&&t.stopImmediatePropagation()}},n.onCellKeyDown=function(t,r){return function(i,o){return o.rowData.pq_gtitle&&e.inArray(o.dataIndx,r.dataIndx)>=0&&i.keyCode==e.ui.keyCode.ENTER?(t.toggleRow(o.rowIndxPage,i),!1):void 0}},n.showRows=function(){this.that.options.dataModel.data.forEach(function(e){e.pq_hidden&&(e.pq_hidden=void 0)})},n.removeGroup=function(e){for(var t=this,r=t.that,i=0,o=r.options.groupModel,n=o.dataIndx;i<n.length;i++)if(e===n[i]){n.splice(i,1);break}n.length||(t.showRows(),t.mc.length=0),t._triggerChange=!0,t.refreshFull()},n.addGroup=function(t,r){var i=this.that,o=i.options.groupModel,n=o.dataIndx=o.dataIndx||[];null!=t&&-1===e.inArray(t,n)&&(null==r?n.push(t):n.splice(r,0,t),this._triggerChange=!0,this.refreshFull())},n._initHeadSortable=function(){var e=this,t=e.that,r=e.$header,i=t.options;r.sortable({axis:"x",distance:3,tolerance:"pointer",cancel:".pq-group-menu",stop:e.onSortable(e,i)})},n.onColumnDrag=function(e){return function(t,r){var i=r.column,o=i.colModel;o&&o.length||i.groupable===!1?e.acceptDrop=!1:e._initHeadDroppable()}},n._initHeadDroppable=function(){var e=this,t=e.that,r=e.$header;r&&(r.droppable({accept:function(r){var i=1*r.attr("pq-col-indx");if(!isNaN(i)&&t.colModel[i])return e.acceptDrop},tolerance:"pointer",hoverClass:"pq-drop-hover",drop:e.onDrop(t,e)}),e.acceptDrop=!0)},n.onDrop=function(e,t){return function(r,i){var o=1*i.draggable.attr("pq-col-indx"),n=e.colModel[o].dataIndx;t.addGroup(n),t.acceptDrop=!1}},n.onSortable=function(t,r){return function(){for(var i=[],o=r.groupModel,n=o.dataIndx,a=[],l=!1,s=e(this).find(".pq-group-item"),d=0;d<s.length;d++){var c=e(s[d]),h=c.data("indx"),u=c.data("dir");n[d]!==h&&(l=!0),i.push(h),a.push(u)}l&&(o.dataIndx=i,o.dir=a,t._triggerChange=!0,t.refreshFull())}},n._initHeader=function(e,t){var r=this;if(r.$header){var i=r.$header,o=i.find(".pq-group-item");i.data("uiSortable")||r._initHeadSortable(),o.length||i.append("<span class='pq-group-placeholder'>"+e.strGroup_header+"</span>"),t.headerMenu&&r._initHeaderMenu()}},n.createHeader=function(){for(var t=this,r=t.that,i=t.$header,n=r.options,a=n.bootstrap,l=r.columns,s=a.on,d=n.groupModel,c=d.dataIndx,h=c.length;h--;)null==l[c[h]]&&c.splice(h,1);if(h=c.length,d.header&&d.on){if(i?i.empty():(i=t.$header=e("<div class='pq-group-header ui-helper-clearfix' ></div>").appendTo(r.$top),i.on("click",".pq-group-item",o.onGroupItemClick(t))),h){for(var u=[],f=0;h>f;f++){var p=c[f],g=l[p],v=d.collapsed,w=s?a.groupModel.icon:d.icon,m=v[f]?w[1]:w[0],x=d.dir[f];u.push("<div tabindex='0' class='pq-group-item' data-indx='",p,"' data-dir='",x,"'>","<span class='",t.toggleIcon,m,"' ></span>",g.pqtitle||("string"==typeof g.title?g.title:p),"<span class='",t.groupRemoveIcon,"' ></span></div>")}i[0].innerHTML=u.join("")}t._initHeader(n,d)}else i&&(i.remove(),t.$header=null)},o.onGroupItemClick=function(t){return function(r){var i=e(r.target),o=e(this).data("indx");i.hasClass("pq-group-remove")?t.removeGroup(o):t.toggleLevel(o,r)}},n._initHeaderMenu=function(){for(var r,i=this,o=i.that,n=o.BS_on,a=o.options,l=i.$header,s=["<ul class='pq-group-menu'><li>",n?"<span class='glyphicon glyphicon-chevron-left'></span>":"","<ul>"],d=a.groupModel,c=d.menuItems,h=0,u=c.length;u>h;h++)t(s,d,c[h],a);s.push("</ul></li></ul>"),r=e(s.join("")).appendTo(l),r.menu({icons:{submenu:"ui-icon-carat-1-w"},position:{my:"right top",at:"left top"}}),r.change(function(t){if("INPUT"==t.target.nodeName){var r=e(t.target),i=r.closest("li").data("option"),n={};n[i]=!a.groupModel[i],o.groupOption(n)}})},n.setOption=function(){var e=this;e._init&&(e.refreshColumns(),e.summaryData.length=0,e.tree.length=0,e._initmerge())},n.onDataReady=function(e,t){return function(){e.tree.length=0;var r=t.options.groupModel,i=r.dataIndx.length;r.on&&(i||r.grandSummary)&&(e._groupData(),e.refreshColumns(),i&&(e._initcollapsed(),e._initmerge())),e.createHeader()}},n.onColumnOrder=function(e){return function(){e._initmerge()}},n.toggleLevel=function(t,r){var i=this.that.options.groupModel,o=i.collapsed,n=e.inArray(t,i.dataIndx),a=r.ctrlKey?"All":"",l=o[n];this[(l?"expand":"collapse")+a](n)},n.collapseTo=function(e){this.expandTo(e,!0)},n.expandTo=function(e,t){var i,o,n,a,l,s=this.that,d=!!t,c=e.split(","),h=c.length,u=this.tree,f=0,p=s.pdata;if(!(h>u.length)){for(var g=0;h>g;g++){if(l=1*c[g]+f,a=u[g][l],!a){if(0==g)return;break}i=a.rip,(!d||d&&g==h-1)&&(o=p[i],o.pq_close!=d&&(n=o,o.pq_close=d)),f=r(u,g+1,i,l)}n&&s._trigger("group",null,{indx:l,close:d})!==!1&&this.saveState(!0)}},n._editorSummary=function(t,r){var i=t.summaryOptions,o=this;return function(t){var n=t.rowData;if(n.pq_gsummary||n.pq_gtitle){var a,l,s=pq.aggregate,d=t.column,c=d.summary,h=c?c.edit:null,u=d.dataType,f=[""];if(e.inArray(t.dataIndx,r.dataIndx)>-1)return!1;if(!r.summaryEdit&&!h||h===!1)return!1;"integer"==u||"float"==u?u="number":"date"!==u&&(u="string"),l=i[u].split(","),a=e.inArray;for(var p in s)a(p,l)>-1&&f.push(p);return 1==f.length?!1:{type:"select",prepend:r.prepend,options:r.options||f,valueIndx:r.valueIndx,labelIndx:r.labelIndx,init:r.init||o._editorInit,getData:r.getData||o._editorGetData}}}},n._editorInit=function(e){var t,r=e.column.summary;r||(r=e.column.summary={}),t=r.type,e.$cell.find("select").val(t)},n._editorGetData=function(e){var t=e.column,r=t.dataType,i=e.$cell.find("select").val();return t.summary.type=i,this.one("beforeValidate",function(e,i){i.allowInvalid=!0,i.track=!1,i.history=!1,t.dataType="string",this.one(!0,"change",function(e,i){t.dataType=r})}),i},n._renderTitle=function(e,t){var r=this.that,i=e.bootstrap,o=i.on,n=o?i.groupModel.icon:t.icon,a=o?["glyphicon "+n[0],"glyphicon "+n[1]]:["ui-icon "+n[0],"ui-icon "+n[1]];return function(e){var i,o,n,l,s=e.rowData;return s.pq_gtitle&&null!=e.cellData?(i=s.pq_close,o=s.pq_level,n=t.title,n=n[o]||t.titleDefault,n="function"==typeof n?n.call(r,e):n.replace("{0}",e.cellData).replace("{1}",s.pq_items),l=i?1:0,{text:(e.Export?"":"<span class='pq-group-icon "+a[l]+"'></span>")+n,cls:"pq-group-title-cell",style:"text-align:left;"}):void 0}},n._renderSummary=function(e){var t=this.that;return function(r){var i,o,n,a,l=r.rowData;return l.pq_gsummary||l.pq_gtitle?(o=r.column,n=o.summary.type,a=e.summaryTitle[n],"function"==typeof a?a.call(t,r):(i=r.formatVal,null==i&&(i=r.cellData,i=null==i?"":i),"number"!=typeof i||o.format||parseInt(i)===i||(i=i.toFixed(2)),a?a.replace("{0}",i):i)):void 0}},n.refreshColumns=function(){for(var e,t,r,i,o,n,a,l=this.that,s=l.options,d=s.groupModel,c=d.on,h=d.fixCols,u=d.dataIndx,f=u.length,p=l.colModel,g=p.length;g--;)i=p[g],(r=i._render)&&(r==i._renderGT?(delete i._renderGT,delete i._render):r==i._renderGS&&(delete i._renderGS,delete i._render)),i._nodrag&&(delete i._nodrag,delete i._nodrop),c&&(o=i.summary)&&(n=o.type)&&(t=t||this._renderSummary(s),i._render=i._renderGS=t);if(s.geditor=c?this._editorSummary(s,d):void 0,c)for(g=f-1;g>=0;g--)i=l.getColumn({dataIndx:u[g]}),e=e||this._renderTitle(s,d),i._renderGT=i._render=e;if(h&&c)for(g=0;f>g;g++)a=l.getColIndx({dataIndx:u[g]}),i=p[a],i._nodrag=i._nodrop=!0,a!=g&&(l.iDragColumns.moveColumn(a,g,!0),l.iColModel.init())},n.refreshFull=function(){var e=this.that;this.refreshColumns(),this._triggerChange&&(e._trigger("groupChange"),this._triggerChange=!1),e.refreshView()},n.refreshView=function(){this.that.refreshView()},n.collapseAll=function(e){this.expandAll(e,!0)},n.expandAll=function(e,t){this.trigger({all:!0,close:!!t,level:e||0})!==!1&&this.that.refreshView()},n.collapse=function(e){this.expand(e,!0)},n.expand=function(e,t){this.trigger({close:!!t,level:e||0})!==!1&&this.that.refreshView()},n.showHideRows=function(e,t,r){for(var i,o=this.that,n=!0,a=o.pdata,l=e,s=a.length;s>l;l++)if(i=a[l],i.pq_gsummary)r.merge||r.summaryInTitleRow?i.pq_level>=t&&(i.pq_hidden=n):i.pq_level>t&&(i.pq_hidden=n);else if(i.pq_gtitle){if(i.pq_level<=t)break;i.pq_hidden=n}else i.pq_hidden=n},o.beforeTrigger=function(e,t){return function(r){return t._trigger("beforeGroupExpand",e,r)===!1}},n.trigger=function(e){var t,r,i,n,a=e.evt,l=e.rd,s=e.level,d=e.all,c=e.close,h=this.that,u=h.options.groupModel,f=u.dataIndx,p=u.collapsed,g=o.beforeTrigger(a,h),v={};if(l){if(t=l.pq_level,r=f[t],i=l[r],c=!l.pq_close,v={level:t,close:c,group:i},g(v))return!1;l.pq_close=c}else if(d){if(v={all:!0,close:c,level:s},g(v))return!1;for(n=s;n<f.length;n++)p[n]=c}else if(null!=s){if(v={level:s,close:c},g(v))return!1;p[s]=c}return h._trigger("group",null,v)},n.toggleRow=function(e,t){var r=this.that,i=r.pdata,o=i[e];this.trigger({evt:t,rd:o})!==!1&&this.saveState(!0)},n.saveState=function(e){var t=this.that,r=t.options.groupModel;if(r.on&&r.dataIndx.length){for(var i=t.pdata,o=i.length,n=new Array(o),a=0;o>a;a++)n[a]=i[a];this.pdata=n,e&&t.refreshView()}},n._initmerge=function(){for(var e,t,r,i,o,n,a,l,s,d=this.that,c=d.options,h=c.groupModel,u=h.dataIndx,f=d.colIndxs,p=h.merge,g=this.tree,v=d.rowIndxOffset,w=d.colModel.length,m=[],x=d.pdata,_=0;_<g.length;_++){t=g[_],i=f[u[_]];for(var I=0,y=t.length;y>I&&(r=t[I],o=r.rip,null!=o);I++)p?(n=r.rip2,a=n-o,l=o+v,m.push({r1:l,rc:a,c1:i,cc:1})):(l=o+v,s=x[o],e=h.summaryInTitleRow,e&&(s.pq_close||"collapsed"!==e)||m.push({r1:l,rc:1,c1:i,cc:w-i}))}m.length?(this.mc=c.mergeCells=m,d.iMerge.init()):this.mc.length&&(this.mc.length=0,d.iMerge.init())},n._initcollapsed=function(){var e,t,r,i,o,n,a=this.that,l=a.options.groupModel,s=l.merge,d=this.pdata,c=a.pdata;if(c){for(var h=0,u=c.length;u>h;h++)e=c[h],t=e.pq_gtitle,void 0!==t&&(o=e.pq_level,n=null,d&&(r=d[h],i=r?r.pq_close:null,null!=i&&(n=e.pq_close=i)),null==n&&(n=e.pq_close),n?this.showHideRows(h+1,o,l):s&&(e.pq_hidden=!0));delete this.pdata}},n.setSumCols=function(t){var r=e.inArray,i=[],o=[];return this.that.colModel.forEach(function(e){var n,a=e.summary;a&&a.type&&(n=e.dataIndx,-1===r(n,t)&&(i.push(e),o.push(n)))}),this._sumCols=i,this._sumDIs=o,[i,o]},n.getSumCols=function(){return this._sumCols},n.getSumDIs=function(){return this._sumDIs},n.group=function(e){return function(t,r,i){var o={},n=[];return t.forEach(function(t){t.pq_hidden=void 0;var a=e(t,r,i),l=o[a];null==l&&(o[a]=l=n.length,n[l]=[a,[]]),n[l][1].push(t)}),n}},n.summary=function(e,t){var r=pq.aggregate,i=e.map(function(e){return e.summary.type});return function(o,n,a){t.forEach(function(t,l){var s,d=[];o.forEach(function(e,r){d[r]=e[t]}),s=r[i[l]](d,e[l]),n[t]=s,a&&(a[t]=s)})}},n.flatten=function(e,t,r,i){var o=r.dataIndx,n=this.concat(),a=this.tree=[],l=o.length,s=[];return function d(c,h,u){if(!l)return c;var f=h||0,p=o[f],g=r.collapsed[f],v=r.calcSummary[f]!==!1,w=r.showSummary[f],m=a[f]=a[f]||[],x=t(c,p,e[p]);return x.forEach(function(e){var t,r=e[1],o=w?{pq_gsummary:!0,pq_level:f,pq_rowcls:"pq-summary-row"}:0,a=r.length,c=s.length;t={pq_gtitle:!0,pq_level:f,pq_close:g,pq_items:a,pq_children:[]},t[p]=e[0],s.push(t),u&&u.push(t),v&&i(r,t,o),l>f+1?d(r,f+1,t.pq_children):s=n(s,r,t),o&&s.push(o),m.push({rip:c,rip2:s.length})}),s}},n.concat=function(){return function(e,t,r){return t.forEach(function(t){e.push(t)}),r.pq_children=t,e}},n._getVal=function(t){var r=e.trim;return function(e,i,o){var n=e[i],a=o.groupChange;return a?(a=pq.getFn(a))(n):(n=r(n),t?n.toUpperCase():n)}},n._groupData=function(){var e=this,t=e.that,r=t.options,i=r.groupModel,o=e._getVal(i.ignoreCase),n=i.dataIndx,a=t.pdata,l=t.columns,s=this.setSumCols(n),d=this.summary(s[0],s[1]);if(i.grandSummary){var c={pq_grandsummary:!0,pq_gsummary:!0};d(a,c),e.summaryData=r.summaryData=[c]}else e.summaryData.length=0;t.pdata=this.flatten(l,this.group(o),i,d)(a)};var a=i.pqGrid.prototype;a.group=function(e){var t=this.iGroup;return null==e?t:void t.expandTo(e.indx)},a.groupOption=function(t,r){var i=t.dataIndx,o=i?i.length:0,n=this.iGroup,a=this.options,l=a.groupModel,s=l.dataIndx,d=t.on||null==t.on&&l.on;d&&n.init(),l.on&&s.length&&(t.on===!1||0===o)&&n.showRows(),e.extend(l,t),n.setOption(),r!==!1&&this.refreshView()}}(jQuery),function(e){var t=e.paramquery;e(document).on("pqGrid:bootup",function(e,t){new r(t.instance)});var r=t.cScroll=function(t){var r=this,i=e(document),o=".pqgrid-csroll";r.that=t,t.one("refresh",r.oneRefresh(t,r,i,o))};t.cScroll=r;var i=r.prototype;i.oneRefresh=function(t,r,i,o){return function(){t.$cont.on("mousedown",function(t){e(t.target).closest(".pq-sb").length||(i.on("mousemove"+o,function(e){r.onMouseDrag(e)}),i.on("mouseup"+o,function(){i.off(o)}))})}},i.onMouseDrag=function(e){var t=this,r=t.that,i=r.$cont,o=i[0].offsetHeight,n=i[0].offsetWidth,a=i.offset(),l=a.top,s=a.left,d=l+o,c=s+n,h=e.pageY,u=e.pageX,f=h-d,p=u-c,g=l-h,v=s-u;u>s&&c>u&&(f>0||g>0)?f>0?t.scrollV(f,!0):g>0&&t.scrollV(g):h>l&&d>h&&(p>0?t.scrollH(p,!0):v>0&&t.scrollH(v))},i.scrollH=function(e,t){var r=this,i=r.that.options.virtualX;r[i?"scrollVirtual":"scrollNV"](e,t,!0)},i.scrollV=function(e,t){var r=this,i=r.that.options.virtualY;r[i?"scrollVirtual":"scrollNV"](e,t)},i.scrollVirtual=function(e,t,r){var i=this.that,o=r?i.hscrollbar():i.vscrollbar(),n=o.options,a=n.cur_pos,l=n.num_eles,s=Math.ceil(e/10),d=Math.pow(5,s-1)*(t?1:-1),a=a+d;0>a?a=0:a>=l&&(a=l-1),o.option("cur_pos",a).scroll()},i.scrollNV=function(e,t,r){var i=this.that,o=i.$tbl[0],n=o[r?"offsetWidth":"offsetHeight"],a=r?i.hscrollbar():i.vscrollbar(),l=a.options,s=l.ratio,d=s*n,c=d+(t?e:-e),h=c/n;h>1?h=1:0>h&&(h=0),a.option("ratio",h).drag()}}(jQuery),function(e){var t=e.paramquery;e(document).on("pqGrid:bootup",function(e,t){var i=t.instance;i.iFillHandle=new r(i)}),t.pqGrid.defaults.fillHandle="all",t.pqGrid.defaults.autofill=!0;var r=t.cFillHandle=function(e){var t=this;t.$wrap,t.locked,t.sel,t.that=e,e.on("selectChange",t.onSelectChange(t)).on("selectEnd",t.onSelectEnd(t)).on("refresh refreshRow",t.onRefresh(t))},i=r.prototype;i.onSelectChange=function(e){return function(){this.options.fillHandle&&e.create()}},i.onSelectEnd=function(e){return function(){this.options.fillHandle&&(e.setDraggable(),e.setDoubleClickable())}},i.onRefresh=function(e){var t;return function(){this.options.fillHandle&&(clearTimeout(t),t=setTimeout(function(){e.that.element&&(e.create(),e.setDraggable())},300))}},i.remove=function(){var e=this.$wrap;e&&e.remove()},i.create=function(){var t=this;if(!t.locked){t.remove();var r=t.that,i=r.selection().address();if(1===i.length){var i=i[0],o=i.r2,n=i.c2,a={rowIndx:o,colIndx:n},l=r.iMerge,s=l.ismergedCell(o,n),d=s?l.getRootCell(o,n,"a"):a,c=r.getCell(d);if(c.length&&r._trigger("beforeFillHandle",null,r.normalize(d))!==!1){var h=c[0],u=c.closest(".pq-grid-cont-inner"),f=u[0],p=f.offsetTop,g=f.offsetLeft,v=h.offsetLeft+h.offsetWidth-8-g,w=h.offsetTop+h.offsetHeight-8-p,m=e("<div class='pq-fill-handle'></div>").appendTo(u);m.css({position:"absolute",top:w,left:v,height:10,width:10,background:"#333",cursor:"crosshair",border:"2px solid #fff"}),t.$wrap=m}}}},i.setDoubleClickable=function(){var e=this,t=e.$wrap;t&&t.on("dblclick",e.onDblClick(e.that,e))},i.setDraggable=function(){var e=this,t=e.$wrap,r=e.that.$cont;t&&t.draggable({helper:function(){return"<div style='height:10px;width:10px;cursor:crosshair;'></div>"},appendTo:r,start:function(){e.onStart()},drag:function(t){e.onDrag(t)},stop:function(){e.onStop()}})},i.patternDate=function(e,t){var r=this;return function(i){var o=new Date(e);return o.setDate(o.getDate()+(t?1-i:i-1)),r.formatDate(o)}},i.formatDate=function(e){return e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()},i.patternDate2=function(e,t){var r,i=new Date(e),o=new Date(t),n=this,a=o.getDate()-i.getDate(),l=o.getMonth()-i.getMonth(),s=o.getFullYear()-i.getFullYear();return!l&&!s||!a&&!l||!s&&!a?function(t){var r=new Date(e);return a?r.setDate(r.getDate()+a*(t-1)):l?r.setMonth(r.getMonth()+l*(t-1)):r.setFullYear(r.getFullYear()+s*(t-1)),n.formatDate(r)}:(i=Date.parse(i),r=Date.parse(o)-i,function(e){var t=new Date(i+r*(e-1));return n.formatDate(t)})},i.pattern=function(e,t,r){var i,o,n,a=e.length,l="date"===t;return 1===a?(i=e[0],l?this.patternDate(i,r):function(e){return i+(r?1-e:e-1)}):2===a?l?this.patternDate2(e[0],e[1]):(i=e[1]-e[0],o=e[0]-i,function(e){return i*e+o}):3===a?(i=(e[2]-2*e[1]+e[0])/2,o=e[1]-e[0]-3*i,n=e[0]-i-o,function(e){return i*e*e+o*e+n}):!1},i.autofillVal=function(e,t,r){var i,o,n,a,l,s,d=this.that,c=e.r1,h=e.c1,u=e.r2,f=e.c2,p=t.r2,g=t.r1,v=[],w=0;if(c>g){for(s=p-g+2,n=g;c-1>=n;n++)for(i=v[w++]=[],s--,o=0,a=h;f>=a;a++)i[o]=r[o](s),o++;l={r1:g,r2:c-1,c1:h,c2:f}}else if(p>u){for(s=u-c+1,n=u+1;p>=n;n++)for(i=v[w++]=[],s++,o=0,a=h;f>=a;a++)i[o]=r[o](s),o++;l={r1:u+1,r2:p,c1:h,c2:f}}return l&&d.range(l).value(v),!0},i.autofill=function(e,t){var r,i,o,n,a,l,s,d=this.that,c=d.colModel,h=d.get_p_data(),u=[],f=e.r1,p=e.c1,g=e.r2,v=e.c2,w=t.r1<f;if(t.c1==p&&t.c2==v){for(l=p;v>=l;l++){if(r=c[l],i=r.dataType,"date"!=i&&"integer"!=i&&"float"!=i)return;if(n=r.dataIndx,o=[],w)for(a=g;a>=f;a--)o.push(h[a][n]);else for(a=f;g>=a;a++)o.push(h[a][n]);if(!(s=this.pattern(o,i,w)))return;u.push(s)}return this.autofillVal(e,t,u)}},i.onStop=function(){var e=this,t=e.that,r=t.options.autofill,i=e.sel,o=t.selection().address()[0];e.locked=!1,r&&e.autofill(i,o)||t.range(i).copy({dest:o})},i.onStart=function(){this.locked=!0,this.sel=this.that.selection().address()[0]},i.onDrag=function(t){var r=this,i=r.that,o=i.options.fillHandle,n="all"==o,a=n||"horizontal"==o,l=n||"vertical"==o,s=t.clientX-10,d=t.clientY,c=document.elementFromPoint(s,d),h=e(c).closest(".pq-grid-cell");
if(h.length){var u=i.getCellIndices({$td:h}),f=r.sel,p=f.r1,g=f.c1,v=f.r2,w=f.c2,m={r1:p,c1:g,r2:v,c2:w},x=function(e,t){m[e]=t,i.range(m).select()},_=u.rowIndx,I=u.colIndx;n&&v>=_&&_>=p||a&&!l?I>w?x("c2",I):g>I&&x("c1",I):l&&(_>v?x("r2",_):p>_&&x("r1",_))}},i.onDblClick=function(e,t){return function(){var r=e.options,i=r.fillHandle;if("all"==i||"vertical"==i){for(var o,n=e.selection().address()[0],a=n.c2,l=n.r2+1,s=r.dataModel.data,d=e.getColModel()[a].dataIndx;o=s[l];){if(null!=o[d]&&""!==o[d]){l--;break}l++}t.onStart(),e.range({r1:n.r1,c1:n.c1,r2:l,c2:a}).select(),t.onStop()}}}}(jQuery);