text: /*
   2015-2021 (c) Sahana Software Foundation
   @license MIT
  
   requires jQuery 1.9.1+
   requires jQuery UI 1.10 widget factory
  */
  var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,k,g){c instanceof String&&(c=String(c));for(var a=c.length,b=0;b<a;b++){var d=c[b];if(k.call(g,d,b,c))return{i:b,v:d}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;
  $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,k,g){if(c==Array.prototype||c==Object.prototype)return c;c[k]=g.value;return c};$jscomp.getGlobal=function(c){c=["object"==typeof globalThis&&globalThis,c,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var k=0;k<c.length;++k){var g=c[k];if(g&&g.Math==Math)return g}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
  $jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(c,k){var g=$jscomp.propertyToPolyfillSymbol[k];if(null==g)return c[k];g=c[g];return void 0!==g?g:c[k]};
  $jscomp.polyfill=function(c,k,g,a){k&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(c,k,g,a):$jscomp.polyfillUnisolated(c,k,g,a))};$jscomp.polyfillUnisolated=function(c,k,g,a){g=$jscomp.global;c=c.split(".");for(a=0;a<c.length-1;a++){var b=c[a];if(!(b in g))return;g=g[b]}c=c[c.length-1];a=g[c];k=k(a);k!=a&&null!=k&&$jscomp.defineProperty(g,c,{configurable:!0,writable:!0,value:k})};
  $jscomp.polyfillIsolated=function(c,k,g,a){var b=c.split(".");c=1===b.length;a=b[0];a=!c&&a in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var d=0;d<b.length-1;d++){var e=b[d];if(!(e in a))return;a=a[e]}b=b[b.length-1];g=$jscomp.IS_SYMBOL_NATIVE&&"es6"===g?a[b]:null;k=k(g);null!=k&&(c?$jscomp.defineProperty($jscomp.polyfills,b,{configurable:!0,writable:!0,value:k}):k!==g&&(void 0===$jscomp.propertyToPolyfillSymbol[b]&&($jscomp.propertyToPolyfillSymbol[b]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(b):
  $jscomp.POLYFILL_PREFIX+b),$jscomp.defineProperty(a,$jscomp.propertyToPolyfillSymbol[b],{configurable:!0,writable:!0,value:k})))};$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(k,g){return $jscomp.findInternal(this,k,g).v}},"es6","es3");
  (function(c,k){var g=0;c.widget("s3.groupedItems",{options:{ajaxURL:null,renderGroupHeaders:!1,totalsLabel:"TOTAL"},_create:function(){c(this.element);this.id=g;g+=1;this.eventNamespace=".groupeditems"},_init:function(){var a=c(this.element);this.widget_id=a.attr("id");this.items=a.find(".gi-data").first();this.refresh()},_destroy:function(){c.Widget.prototype.destroy.call(this)},refresh:function(){var a=c(this.element);a.find(".gi-throbber").show();this._unbindEvents();this.data||this._deserialize();
  var b=this.data,d=a.find(".gi-table");b.e?(d.hide(),d.empty(),a.find(".gi-empty").show()):(a.find(".gi-empty").hide(),d.empty(),b=this._renderTable(b),d.append(b).show());this._bindEvents();a.find(".gi-throbber").css("visibility","hidden")},_renderTable:function(a){var b=c('<table class="groupeditems">');this._renderTableHeader(a).appendTo(b);this._renderGroup(b,a);this._renderTableFooter(a).appendTo(b);return b},_renderTableHeader:function(a){var b=c("<thead>"),d=c('<tr class="gi-column-headers">').appendTo(b),
  e=a.c;a=a.l;for(var h,l=0,m=e.length;l<m;l++)h=a[e[l]],c("<th>").html(h).appendTo(d);return b},_renderTableFooter:function(a){var b=this.options,d=c("<tfoot>"),e=c('<tr class="gi-column-totals">'),h=a.t,l=!1;for(n in h){l=!0;break}if(l){a=a.c;for(var m=null,f=0,r=0,q=a.length;r<q;r++){if(!m){if(!h.hasOwnProperty(a[r])){f++;continue}1<f&&(m=c('<td class="gi-column-totals-label" colspan="'+f+'">'),c("<span> "+b.totalsLabel+"</span>").appendTo(m),m.appendTo(e))}var n=c("<td>").appendTo(e);(l=h[a[r]])&&
  n.html(l)}e.appendTo(d)}return d},_renderGroup:function(a,b,d,e){"undefined"==typeof d&&(d=b);"undefined"==typeof e&&(e=0);this.options.renderGroupHeaders&&0<e&&this._renderGroupHeader(a,b,d,e);var h=d.d,l=d.i,m;if(h){var f=0;for(m=h.length;f<m;f++)this._renderGroup(a,b,h[f],e+1)}else if(l)for(f=0,m=l.length;f<m;f++)this._renderItem(a,b,l[f],e);0<e&&this._renderGroupFooter(a,b,d,e)},_renderGroupHeader:function(a,b,d,e){b=b.c;d=d.v;e=c('<tr class="gi-group-header gi-level-'+e+'">');c('<td colspan="'+
  b.length+'">').html(d).appendTo(e);e.appendTo(a)},_renderGroupFooter:function(a,b,d,e){var h=this.options,l=d.t,m=!1;for(f in l){m=!0;break}b=b.c;d=d.v;e=c('<tr class="gi-group-footer gi-level-'+e+'">');if(!m&&!h.renderGroupHeaders)c('<td colspan="'+b.length+'">').html(d).appendTo(e),e.appendTo(a);else if(m){m=0;var f=null;for(var r,q,n=0,p=b.length;n<p;n++){if(!f){if(!l.hasOwnProperty(b[n])){m++;continue}1<m&&(f=c('<td class="gi-group-footer-label" colspan="'+m+'">'),h.renderGroupHeaders||f.html(d),
  c('<span class="gi-group-footer-inline-label"> '+h.totalsLabel+"</span>").appendTo(f),f.appendTo(e))}q=c("<td>").appendTo(e);(r=l[b[n]])&&q.html(r)}e.appendTo(a)}},_renderItem:function(a,b,d,e){e=c('<tr class="gi-item gi-level-'+e+'">');b=b.c;for(var h,l,m=0,f=b.length;m<f;m++)l=c("<td>"),(h=d[b[m]])&&l.html(h),l.appendTo(e);e.appendTo(a)},reload:function(a,b,d){d="undefined"!=typeof d?d:!0;"undefined"==typeof b&&(b=this._getFilters());var e=this,h=!1;c(this.element).find(".gi-throbber").css("visibility",
  "visible");if(a||b)h=this._updateAjaxURL(a,b);h||d?c.ajax({url:this.options.ajaxURL,dataType:"json"}).done(function(l){e.items.val(JSON.stringify(l));e.data=null;e.refresh()}).fail(function(l,m,f){msg="UNAUTHORIZED"==f?i18n.gis_requires_login:l.responseText;console.log(msg)}):e.refresh()},_getFilters:function(){var a=c("#"+this.widget_id+"-filter-form");try{return a.length?S3.search.getCurrentFilters(a.first()):null}catch(b){return null}},_updateAjaxURL:function(a,b){var d=this.options.ajaxURL;if(!d)return!1;
  var e=d.split("?");if(1<e.length){var h=e[1];var l=h.split("&")}else l=[];var m=[];d=!1;if(a)for(var f in a)h=a[f],h=f+"="+h,d||-1!=c.inArray(h,l)||(d=!0),m.push(h);f={};h={};var r;if(b){var q=0;for(r=b.length;q<r;q++){var n=b[q];var p=n[0];n=n[1];null===n?f[p]||(h[p]=!0):(h[p]&&(h[p]=!1),n=p+"="+encodeURIComponent(n),f[p]?f[p].push(n):f[p]=[n])}}q=0;for(r=l.length;q<r;q++)n=l[q].split("="),1<n.length&&(p=decodeURIComponent(n[0]),n=decodeURIComponent(n[1]),h[p]?d=!0:f[p]?d||-1!=c.inArray(p+"="+n,
  f[p])||(d=!0):a&&a.hasOwnProperty(p)||m.push(l[q]));for(p in f)for(q=0,r=f[p].length;q<r;q++)d||-1!=c.inArray(f[p][q],l)||(d=!0),m.push(f[p][q]);a=m.join("&");b=e[0];a&&(b=b+"?"+a);this.options.ajaxURL=b;return d},_serialize:function(){var a=this.items;if(a){var b="";this.data&&(b=JSON.stringify(this.data));a.val(b)}return b},_deserialize:function(){this.data={};var a=this.items;a&&(a=a.val())&&(this.data=JSON.parse(a));return this.data},_bindEvents:function(){var a=this;c(this.element).delegate(".gi-export",
  "click"+this.eventNamespace,function(){var b=c(this).data("url"),d=a._getFilters();d&&(b=S3.search.filterURL(b,d));window.open(b)})},_unbindEvents:function(){c(this.element).undelegate(this.eventNamespace)}})})(jQuery);
  