!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(t,e){return void 0===e&&(e="undefined"!=typeof window?require("jquery"):require("jquery")(t)),a(e),e}:a(jQuery)}(function(d){"use strict";var t,i,n,a,r,s,o,h="undefined"!=typeof window?window:this,c={i18n:{modes:["Stack","Swipe","Toggle"],columns:'Columns',columnBtnText:"Columns",columnsDialogError:"No eligible columns.",sort:"Sort"},mustard:"head"in document&&(!window.blackberry||window.WebKitPoint)&&!window.operamini};c.mustard&&d(document.documentElement).addClass("tablesaw-enhanced"),function(){var e="tablesaw",a="tablesaw-bar",i={create:"tablesawcreate",destroy:"tablesawdestroy",refresh:"tablesawrefresh",resize:"tablesawresize"},r={};c.events=i;var t=function(t){if(!t)throw new Error("Tablesaw requires an element.");this.table=t,this.$table=d(t),this.$thead=this.$table.children().filter("thead").eq(0),this.$tbody=this.$table.children().filter("tbody"),this.mode=this.$table.attr("data-tablesaw-mode")||"stack",this.init()};t.prototype.init=function(){this.$table.attr("id")||this.$table.attr("id",e+"-"+Math.round(1e4*Math.random())),this.createToolbar(),this._initCells(),this.$table.data(e,this),this.$table.trigger(i.create,[this])},t.prototype.getConfig=function(t){var e=d.extend(r,t||{});return d.extend(e,"undefined"!=typeof TablesawConfig?TablesawConfig:{})},t.prototype._getPrimaryHeaderRow=function(){return this.$thead.children().filter("tr").filter(function(){return!d(this).is("[data-tablesaw-ignorerow]")}).eq(0)},t.prototype._getPrimaryHeaderRowIndex=function(t){return(t||this._getPrimaryHeaderRow()).prevAll().length},t.prototype._getPrimaryHeaderCells=function(t){return(t||this._getPrimaryHeaderRow()).find("th")},t.prototype._findPrimaryHeadersForCell=function(t){for(var e=this._getPrimaryHeaderRow(),a=this._getPrimaryHeaderCells(e),i=this._getPrimaryHeaderRowIndex(e),r=[],n=0;n").addClass(a).insertBefore(this.$table)),this.$toolbar=t,this.mode&&this.$toolbar.addClass("tablesaw-mode-"+this.mode)},t.prototype.destroy=function(){this.$table.prev().filter("."+a).each(function(){this.className=this.className.replace(/\btablesaw-mode\-\w*\b/gi,"")});var t=this.$table.attr("id");d(document).off("."+t),d(window).off("."+t),this.$table.trigger(i.destroy,[this]),this.$table.removeData(e)},d.fn[e]=function(){return this.each(function(){d(this).data(e)||new t(this)})};var n=d(h.document);n.on("enhance.tablesaw",function(t){c.mustard&&d(t.target).find("table").filter("[data-tablesaw],[data-tablesaw-mode],[data-tablesaw-sortable]")[e]()});var s,o,l=!1;n.on("scroll.tablesaw",function(){l=!0,h.clearTimeout(s),s=h.setTimeout(function(){l=!1},300)}),d(h).on("resize",function(){l||(h.clearTimeout(o),o=h.setTimeout(function(){n.trigger(i.resize)},150))})}(),i="tablesaw-cell-label",n="tablesaw-cell-content",a=t="tablesaw-stack",r="data-tablesaw-no-labels",s="data-tablesaw-hide-empty",(o=function(t,e){this.tablesaw=e,this.$table=d(t),this.labelless=this.$table.is("["+r+"]"),this.hideempty=this.$table.is("["+s+"]"),this.$table.data(a,this)}).prototype.init=function(){if(this.$table.addClass(t),!this.labelless){var a=this;this.$table.find("th, td").filter(function(){return!d(this).closest("thead").length}).filter(function(){return!(d(this).closest("tr").is("["+r+"]")||a.hideempty&&!d(this).html())}).each(function(){var r=d(document.createElement("b")).addClass(i),t=d(this);d(a.tablesaw._findPrimaryHeadersForCell(this)).each(function(t){var e=d(this.cloneNode(!0)),a=e.find(".tablesaw-sortable-btn");e.find(".tablesaw-sortable-arrow").remove();var i=e.find("[data-tablesaw-checkall]");i.closest("label").remove(),i.length?r=d([]):(0");var e=t.find("."+i);e.length?e.replaceWith(r):t.prepend(r)})}},o.prototype.destroy=function(){this.$table.removeClass(t),this.$table.find("."+i).remove(),this.$table.find("."+n).each(function(){d(this).replaceWith(this.childNodes)})},d(document).on(c.events.create,function(t,e){"stack"===e.mode&&new o(e.table,e).init()}).on(c.events.refresh,function(t,e){"stack"===e.mode&&d(e.table).data(a).init()}).on(c.events.destroy,function(t,e){"stack"===e.mode&&d(e.table).data(a).destroy()})});