/*! Widget: Build Table - updated 2018-03-26 (v2.30.2) */ !function(e){"use strict";var t=e.tablesorter=e.tablesorter||{},l=t.buildTable=function(o,r){e.extend(!0,t.defaults.widgetOptions,l.defaults);var n="TABLE"===o.nodeName?e(o):e("").appendTo(o),i=n[0],d=r.widgetOptions=e.extend(!0,{},l.defaults,r.widgetOptions),s=d.build_processing,a=d.build_type,u=d.build_source||r.data,c=t.debug(r,"build"),b=function(t){var o=e.type(t),n=t instanceof e;if("function"==typeof s&&(t=s(t,d)),r.data=t,n||"string"===o){if(n||/<\s*\/tr\s*>/.test(t))return l.html(i,t,d);try{if(t=e.parseJSON(t||"null"))return l.object(i,t,d)}catch(e){}}return"array"===o||"string"===o||"array"===a||"csv"===a?l.csv(i,t,d):l.object(i,t,d)};if(i.config=r,!t.buildTable.hasOwnProperty(a)&&""!==a)return c&&console.error("Build >> ERROR: Aborting build table widget, incorrect build type"),!1;u instanceof e?b(e.trim(u.html())):u&&(u.hasOwnProperty("url")||"json"===a)?e.ajax(d.build_source).done(function(e){b(e)}).fail(function(e,t){c&&console.error("Build >> ERROR: Aborting build table widget, failed ajax load"),n.html('")}):b(u)};t.defaults.data="",l.defaults={build_type:"",build_source:"",build_processing:null,build_complete:"tablesorter-build-complete",build_headers:{rows:1,classes:[],text:[],widths:[]},build_footers:{rows:1,classes:[],text:[]},build_numbers:{addColumn:!1,sortable:!1},build_csvStartLine:0,build_csvSeparator:",",build_objectRowKey:"rows",build_objectCellKey:"cells",build_objectHeaderKey:"headers",build_objectFooterKey:"footers"},l.build={colgroup:function(t){var l="";return t&&t.length&&(l+="",e.each(t,function(e,t){l+=""}),l+=""),l},cell:function(t,l,o,r,n){var i,d,s=n?e(""):"",a=l.build_headers.classes,u=l.build_headers.widths;if(/string|number/.test(typeof t))d=e("<"+o+(a&&a[r]?' class="'+a[r]+'"':"")+">"+t+""),n&&u&&u[r]&&s.width(u[r]||"");else{d=e("<"+o+">");for(i in t)t.hasOwnProperty(i)&&("text"===i||"html"===i?d[i](t[i]):n&&"width"===i?s.width(t[i]||""):d.attr(i,t[i]))}return[d,s]},header:function(t,l){var o=l.build_headers.text,r=l.build_headers.classes,n=""+(l.build_numbers.addColumn?""+l.build_numbers.addColumn+"":"");return e.each(t,function(e,t){/<\s*\/t(d|h)\s*>/.test(t)?n+=t:n+=""+(o&&o[e]?o[e]:t)+""}),n+""},rows:function(t,l,o,r,n,i){var d=i?"th":"td",s=""+(r.build_numbers.addColumn?"<"+d+">"+(i?"":n)+"":"");return e.each(t,function(e,t){/<\s*\/t(d|h)\s*>/.test(t)?s+=t:s+="<"+(i?d+(o&&o[e]?' class="'+o[e]+'"':""):d)+">"+(i&&l&&l.length&&l[e]?l[e]:t)+""}),s+""}},l.buildComplete=function(l,o){e(l).triggerHandler(o.build_complete),l.config&&t.debug(l.config,"build")&&console.log("Build >> Table build complete"),t.setup(l,l.config)},l.array=function(e,t,o){return l.csv(e,t,o)},l.csv=function(t,o,r){var n,i,d,s="csv"===r.build_type||"string"==typeof o,a=e(t),u=s?o.replace("\r","").split("\n"):o,c=u.length,b=0,h=!1,p=r.build_headers.rows+(s?r.build_csvStartLine:0),f=r.build_footers.rows,g=0,y="",_=l.build.colgroup(r.build_headers.widths)+"";e.each(u,function(e,t){e>=c-f&&(h=!0),(!s||e>=r.build_csvStartLine)&&e=p&&(e===p&&(_+=""),d=s?l.splitCSV(t,r.build_csvSeparator):t,h&&f>0&&(_+=(e===c-f?"":"")+(e===c?"":"")),d.length>1&&(b++,d.length!==g&&(y+="error on line "+e+": Item count ("+d.length+") does not match header count ("+g+") \n"),n=h?r.build_footers.classes:"",_+=l.build.rows(d,r.build_footers.text,n,r,b,h)))}),_+=f>0?"":"",y?a.html(y):(a.html(_),l.buildComplete(t,r))},l.splitCSV=function(t,l){var o,r,n=e.trim(t).split(l=l||",");for(o=n.length-1;o>=0;o--)'"'===n[o].replace(/\"\s+$/,'"').charAt(n[o].length-1)?(r=n[o].replace(/^\s+\"/,'"')).length>1&&'"'===r.charAt(0)?n[o]=n[o].replace(/^\s*"|"\s*$/g,"").replace(/""/g,'"'):o?n.splice(o-1,2,[n[o-1],n[o]].join(l)):n=n.shift().split(l).concat(n):n[o].replace(/""/g,'"');return n},l.html=function(t,o,r){var n=e(t);o instanceof e?n.empty().append(o):n.html(o),l.buildComplete(t,r)},l.object=function(o,r,n){var i,d,s,a,u,c,b,h=o.config,p=n.build_objectHeaderKey,f=n.build_objectRowKey,g=r.hasOwnProperty(p)&&!e.isEmptyObject(r.kh)?r.kh:!!r.hasOwnProperty("headers")&&r.headers,y=r.hasOwnProperty(f)&&!e.isEmptyObject(r.kr)?r.kr:!!r.hasOwnProperty("rows")&&r.rows;if(!g||!y||0===g.length||0===y.length)return t.debug(h,"build")&&console.error("Build >> ERROR: Aborting build table widget, missing data for object build"),!1;a=e(""),u=e("
'+e.status+" "+t+"
"),e.each(g,function(t,o){for(b=e("").appendTo(u.find("thead")),d=o.length,i=0;i"),e.each(y,function(t,o){var r;if((s="object"===e.type(o))&&o.newTbody){c=e("").appendTo(u);for(r in o)o.hasOwnProperty(r)&&"newTbody"!==r&&c.attr(r,o[r])}else{if(0===t&&c.appendTo(u),b=e("").appendTo(c),s){for(r in o)o.hasOwnProperty(r)&&r!==n.build_objectCellKey&&b.attr(r,o[r]);o.hasOwnProperty(n.build_objectCellKey)&&(o=o.cells)}for(d=o.length,r=0;r"+a+"")):(a=e("").appendTo(u),e.each(s,function(t,o){for(b=e("").appendTo(a),d=o.length,i=0;i