"use strict";function sortTable(e,t){var s=$(e).closest("td,th"),a=s.closest("tr"),o=a.closest("table"),r=o.children("tbody"),n=s.index()+1,i=o.data("sort-data"),l=[],d=o.children("thead,tbody,tfoot").children("tr");if(!i){i={reversed:[],last_col:t.col||-1};for(var c=a.children().length;c>0;c--)i.reversed.push(!1);void 0!==t.col&&(i.reversed[t.col]=t.reverse),i.bgs=0,d.each((function(){var e=$(this).attr("class").match(/(foswikiTableRowdataBg(\d+))/);if(e){var t=Number.parseInt(e[2])+1;t>i.bgs&&(i.bgs=t),$(this).removeClass(e[1])}}))}n===i.last_col&&(i.reversed[n]=!i.reversed[n]);var h=i.reversed[n];i.last_col=n,o.data("sort-data",i).find(".tableSortIcon").remove(),r.children().each((function(){l.push($(this))})),l.sort((function(e,t){return compareValues(e.children().eq(n-1).text(),t.children().eq(n-1).text())*(h?-1:1)})),d.children("td,th").removeClass("foswikiSortedCol foswikiSortedAscendingCol foswikiSortedDescendingCol foswikiTableEven foswikiTableOdd"),d.each((function(){var e=$(this).attr("class").match(/(foswikiTableRowdataBg\d+)/);e&&$(this).removeClass(e[1]),(e=$(this).attr("class").match(/(foswikiTableRowdataBgSorted\d+)/))&&$(this).removeClass(e[1])})),r.empty(),$.each(l,(function(e,t){r.append(t)})),(d=o.children("thead,tbody,tfoot").children("tr")).removeClass("foswikiTableEven foswikiTableOdd");var m=0;d.each((function(){$(this).children("th,td").eq(n-1).addClass("foswikiSortedCol foswikiSorted"+(h?"Descending":"Ascending")+"Col"),i.bgs>0&&$(this).addClass("foswikiTableRowdataBg"+m%i.bgs+" foswikiTableRowdataBgSorted"+m%i.bgs),$(this).addClass("foswikiTable"+(0==(1&m)?"Even":"Odd")),m++})),$("<div></div>").addClass("tableSortIcon ui-icon erp-button ui-icon-circle-triangle-"+(h?"s":"n")).attr("title","Sorted "+(h?"descending":"ascending")).appendTo(s)}var months=new Array;months.jan=0,months.feb=1,months.mar=2,months.apr=3,months.may=4,months.jun=5,months.jul=6,months.aug=7,months.sep=8,months.oct=9,months.nov=10,months.dec=11;var WIKIDATE=new RegExp("^\\s*([0-3]?[0-9])[-\\s/]*(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[-\\s/]*([0-9]{2}([0-9]{2})?)(\\s*(-\\s*)?([0-9]{2}):([0-9]{2}))?","i"),RFC8601=new RegExp("([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?");function s2d(e){var t=e.match(WIKIDATE);if(null!=t){var s=new Date;if(s.setDate(Number(t[1])),s.setMonth(months[t[2].toLowerCase()]),2===t[3].length){var a=t[3];a+=a>59?1900:2e3,s.setYear(a)}else s.setYear(t[3]);return null!=t[6]&&t[6].length&&s.setHours(t[6]),null!=t[7]&&t[7].length&&s.setMinutes(t[7]),s.getTime()}if(null==(t=e.match(RFC8601)))return 0;var o=0,r=new Date(t[1],0,1);return t[3]&&r.setMonth(t[3]-1),t[5]&&r.setDate(t[5]),t[7]&&r.setHours(t[7]),t[8]&&r.setMinutes(t[8]),t[10]&&r.setSeconds(t[10]),t[12]&&r.setMilliseconds(1e3*Number("0."+t[12])),t[14]&&(o=60*Number(t[16])+Number(t[17]),o*="-"===t[15]?1:-1),o-=r.getTimezoneOffset(),Number(r)+60*o*1e3}function compareValues(e,t){var s=s2d(e);if(s){var a=s2d(t);a&&(e=s,t=a)}else{var o=parseFloat(e);if(!isNaN(o)){var r=parseFloat(t);isNaN(r)||(e=o,t=r)}}return"string"==typeof e&&(e=e.normalize("NFKD")),"string"==typeof t&&(t=t.normalize("NFKD")),e===t?0:e>t?1:-1}
