!function(t){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?module.exports=function(e,n){return e||(e=window),n&&n.fn.dataTable||(n=require("datatables.net")(e,n).$),t(n,e,e.document)}:t(jQuery,window,document)}(function(t,e,n,r){"use strict";var i,o=t.fn.dataTable,a=0,s=0,l=o.ext.buttons,d=function(e,n){if(!(this instanceof d))return function(t){return new d(t,e).container()};void 0===n&&(n={}),!0===n&&(n={}),t.isArray(n)&&(n={buttons:n}),this.c=t.extend(!0,{},d.defaults,n),n.buttons&&(this.c.buttons=n.buttons),this.s={dt:new o.Api(e),buttons:[],listenKeys:"",namespace:"dtb"+a++},this.dom={container:t("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)},this._constructor()};t.extend(d.prototype,{action:function(t,e){var n=this._nodeToButton(t);return e===r?n.conf.action:(n.conf.action=e,this)},active:function(e,n){var i=this._nodeToButton(e),o=this.c.dom.button.active,a=t(i.node);return n===r?a.hasClass(o):(a.toggleClass(o,n===r||n),this)},add:function(t,e){var n=this.s.buttons;if("string"==typeof e){for(var i=e.split("-"),o=this.s,a=0,s=i.length-1;a=0;o--)this.remove(n.buttons[o].node);n.conf.destroy&&n.conf.destroy.call(i.button(e),i,t(e),n.conf),this._removeKey(n.conf),t(n.node).remove();var a=t.inArray(n,r);return r.splice(a,1),this},text:function(e,n){var i=this._nodeToButton(e),o=this.c.dom.collection.buttonLiner,a=i.inCollection&&o&&o.tag?o.tag:this.c.dom.buttonLiner.tag,s=this.s.dt,l=t(i.node),d=function(t){return"function"==typeof t?t(s,l,i.conf):t};return n===r?d(i.conf.text):(i.conf.text=n,a?l.children(a).html(d(n)):l.html(d(n)),this)},_constructor:function(){var e=this,r=this.s.dt,i=r.settings()[0],o=this.c.buttons;i._buttons||(i._buttons=[]),i._buttons.push({inst:this,name:this.c.name});for(var a=0,s=o.length;a"),f.conf._collection=f.collection,this._expandButton(f.buttons,f.conf.buttons,!0,o)),u.init&&u.init.call(a.button(f.node),a,t(f.node),u),0)}}},_buildButton:function(e,n){var i=this.c.dom.button,o=this.c.dom.buttonLiner,a=this.c.dom.collection,l=this.s.dt,d=function(t){return"function"==typeof t?t(l,h,e):t};if(n&&a.button&&(i=a.button),n&&a.buttonLiner&&(o=a.buttonLiner),e.available&&!e.available(l,e))return!1;var u=function(e,n,r,i){i.action.call(n.button(r),e,n,r,i),t(n.table().node()).triggerHandler("buttons-action.dt",[n.button(r),n,r,i])},f=e.tag||i.tag,c=e.clickBlurs===r||e.clickBlurs,h=t("<"+f+"/>").addClass(i.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(t){t.preventDefault(),!h.hasClass(i.disabled)&&e.action&&u(t,l,h,e),c&&h.blur()}).on("keyup.dtb",function(t){13===t.keyCode&&!h.hasClass(i.disabled)&&e.action&&u(t,l,h,e)});if("a"===f.toLowerCase()&&h.attr("href","#"),"button"===f.toLowerCase()&&h.attr("type","button"),o.tag){var p=t("<"+o.tag+"/>").html(d(e.text)).addClass(o.className);"a"===o.tag.toLowerCase()&&p.attr("href","#"),h.append(p)}else h.html(d(e.text));!1===e.enabled&&h.addClass(i.disabled),e.className&&h.addClass(e.className),e.titleAttr&&h.attr("title",d(e.titleAttr)),e.attr&&h.attr(e.attr),e.namespace||(e.namespace=".dt-button-"+s++);var m,y=this.c.dom.buttonContainer;return m=y&&y.tag?t("<"+y.tag+"/>").addClass(y.className).append(h):h,this._addKey(e),this.c.buttonCreated&&(m=this.c.buttonCreated(e,m)),{conf:e,node:h.get(0),inserter:m,buttons:[],inCollection:n,collection:null}},_nodeToButton:function(t,e){e||(e=this.s.buttons);for(var n=0,r=e.length;n30)throw"Buttons: Too many iterations"}return t.isArray(n)?n:t.extend({},n)};for(e=a(e);e&&e.extend;){if(!l[e.extend])throw"Cannot extend unknown button type: "+e.extend;var s=a(l[e.extend]);if(t.isArray(s))return s;if(!s)return!1;var d=s.className;e=t.extend({},s,e),d&&e.className!==d&&(e.className=d+" "+e.className);var u=e.postfixButtons;if(u){for(e.buttons||(e.buttons=[]),n=0,i=u.length;n").addClass("dt-button-collection").addClass(l.collectionLayout).css("display","none");r=t(r).addClass(l.contentClassName).attr("role","menu").appendTo(h),u.attr("aria-expanded","true"),u.parents("body")[0]!==n.body&&(u=n.body.lastChild),l.collectionTitle&&h.prepend('
'+l.collectionTitle+"
"),h.insertAfter(u).fadeIn(l.fade);var p=t(i.table().container()),m=h.css("position");if("dt-container"===l.align&&(u=u.parent(),h.css("width",p.width())),"absolute"===m){var y=u.position();h.css({top:y.top+u.outerHeight(),left:y.left});var b=h.outerHeight(),g=h.outerWidth(),v=p.offset().top+p.height(),_=y.top+u.outerHeight()+b-v,x=y.top-b,w=p.offset().top,I=w-x,F=y.top-b-5;(_>I||l.dropup)&&-FC&&h.css("left",y.left-(k-C));var B=u.offset().left+g;B>t(e).width()&&h.css("left",y.left-(B-t(e).width()))}else{var S=h.height()/2;S>t(e).height()/2&&(S=t(e).height()/2),h.css("marginTop",-1*S)}l.background&&d.background(!0,l.backgroundClassName,l.fade,u),t("div.dt-button-background").on("click.dtb-collection",function(){}),t("body").on("click.dtb-collection",function(e){var n=t.fn.addBack?"addBack":"andSelf";t(e.target).parents()[n]().filter(r).length||f()}).on("keyup.dtb-collection",function(t){27===t.keyCode&&f()}),l.autoClose&&setTimeout(function(){a.on("buttons-action.b-internal",function(t,e,n,r){r[0]!==u[0]&&f()})},0)}}),d.background=function(e,i,o,a){o===r&&(o=400),a||(a=n.body),e?t("
").addClass(i).css("display","none").insertAfter(a).stop().fadeIn(o):t("div."+i).stop().fadeOut(o,function(){t(this).removeClass(i).remove()})},d.instanceSelector=function(e,n){if(e===r||null===e)return t.map(n,function(t){return t.inst});var i=[],o=t.map(n,function(t){return t.name}),a=function(e){if(t.isArray(e))for(var r=0,s=e.length;r1&&n.splice(1,n.length),n}),o.Api.registerPlural("buttons().active()","button().active()",function(t){return t===r?this.map(function(t){return t.inst.active(t.node)}):this.each(function(e){e.inst.active(e.node,t)})}),o.Api.registerPlural("buttons().action()","button().action()",function(t){return t===r?this.map(function(t){return t.inst.action(t.node)}):this.each(function(e){e.inst.action(e.node,t)})}),o.Api.register(["buttons().enable()","button().enable()"],function(t){return this.each(function(e){e.inst.enable(e.node,t)})}),o.Api.register(["buttons().disable()","button().disable()"],function(){return this.each(function(t){t.inst.disable(t.node)})}),o.Api.registerPlural("buttons().nodes()","button().node()",function(){var e=t();return t(this.each(function(t){e=e.add(t.inst.node(t.node))})),e}),o.Api.registerPlural("buttons().processing()","button().processing()",function(t){return t===r?this.map(function(t){return t.inst.processing(t.node)}):this.each(function(e){e.inst.processing(e.node,t)})}),o.Api.registerPlural("buttons().text()","button().text()",function(t){return t===r?this.map(function(t){return t.inst.text(t.node)}):this.each(function(e){e.inst.text(e.node,t)})}),o.Api.registerPlural("buttons().trigger()","button().trigger()",function(){return this.each(function(t){t.inst.node(t.node).trigger("click")})}),o.Api.register("button().popover()",function(t,e){return this.map(function(n){return n.inst._popover(t,this.button(this[0].node),e)})}),o.Api.register("buttons().containers()",function(){var e=t(),n=this._groupSelector;return this.iterator(!0,"table",function(t){if(t._buttons)for(var r=d.instanceSelector(n,t._buttons),i=0,o=r.length;i"+e+"":"",t('
').html(e).append(t("
")["string"==typeof n?"html":"append"](n)).css("display","none").appendTo("body").fadeIn(),o!==r&&0!==o&&(i=setTimeout(function(){a.buttons.info(!1)},o)),this.on("destroy.btn-info",function(){a.buttons.info(!1)}),this)}),o.Api.register("buttons.exportData()",function(t){if(this.context.length)return m(new o.Api(this.context[0]),t)}),o.Api.register("buttons.exportInfo()",function(t){return t||(t={}),{filename:u(t),title:c(t),messageTop:h(this,t.message||t.messageTop,"top"),messageBottom:h(this,t.messageBottom,"bottom")}});var u=function(e){var n="*"===e.filename&&"*"!==e.title&&e.title!==r&&null!==e.title&&""!==e.title?e.title:e.filename;if("function"==typeof n&&(n=n()),n===r||null===n)return null;-1!==n.indexOf("*")&&(n=t.trim(n.replace("*",t("head > title").text()))),n=n.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,"");var i=f(e.extension);return i||(i=""),n+i},f=function(t){return null===t||t===r?null:"function"==typeof t?t():t},c=function(e){var n=f(e.title);return null===n?null:-1!==n.indexOf("*")?n.replace("*",t("head > title").text()||"Exported data"):n},h=function(e,n,r){var i=f(n);if(null===i)return null;var o=t("caption",e.table().container()).eq(0);return"*"===i?o.css("caption-side")!==r?null:o.length?o.text():"":i},p=t("