/*! StateRestore 1.3.0 * © SpryMedia Ltd - datatables.net/license */ !function(s){var o,a;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return s(e,window,document)}):"object"==typeof exports?(o=require("jquery"),a=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||o(e),a(e,t),s(t,0,e.document)}:(a(window,o),module.exports=s(o,window,window.document))):s(jQuery,window,document)}(function(R,e,g,k){"use strict";var u,m,f,i,p,s,t,c=R.fn.dataTable;function n(e,t,s,o,a,i){if(void 0===o&&(o=k),void 0===a&&(a=!1),void 0===i&&(i=function(){return null}),!m||!m.versionCheck||!m.versionCheck("1.10.0"))throw new Error("StateRestore requires DataTables 1.10 or newer");if(!m.Buttons)throw new Error("StateRestore requires Buttons");e=new m.Api(e);this.classes=u.extend(!0,{},n.classes),this.c=u.extend(!0,{},n.defaults,t),this.s={dt:e,identifier:s,isPreDefined:a,savedState:null,tableId:o&&o.stateRestore?o.stateRestore.tableId:k},this.dom={background:u('
'),closeButton:u('
×
'),confirmation:u('
'),confirmationButton:u('
"),creation:f('
'),creationForm:f('
'),creationTitle:f('

'+this.s.dt.i18n("stateRestore.creationModal.title",this.c.i18n.creationModal.title)+"

"),dtContainer:f(this.s.dt.table().container()),duplicateError:f(''+this.s.dt.i18n("stateRestore.duplicateError",this.c.i18n.duplicateError)+""),emptyError:f(''+this.s.dt.i18n("stateRestore.emptyError",this.c.i18n.emptyError)+""),lengthToggle:f('
"),nameInputRow:f('
'),orderToggle:f('
"),pagingToggle:f('
"),removeContents:f('
'),removeTitle:f('

'+this.s.dt.i18n("stateRestore.removeTitle",this.c.i18n.removeTitle)+"

"),scrollerToggle:f('
"),searchBuilderToggle:f('
"),searchPanesToggle:f('
"),searchToggle:f('
"),selectToggle:f('
"),toggleLabel:f('")},(e.settings()[0]._stateRestore=this)._searchForStates(),this._addPreDefined(this.c.preDefined),a={action:"load"},"function"==typeof this.c.ajax?s=function(){"function"==typeof o.c.ajax&&o.c.ajax.call(o.s.dt,a,function(e){return o._addPreDefined(e)})}:"string"==typeof this.c.ajax&&(s=function(){f.ajax({data:a,success:function(e){o._addPreDefined(e)},type:"POST",url:o.c.ajax})}),"function"==typeof s&&(this.s.dt.settings()[0]._bInitComplete?s():this.s.dt.one("preInit.dtsr",function(){s()})),this.s.dt.on("destroy.dtsr",function(){o.destroy()}),this.s.dt.on("draw.dtsr buttons-action.dtsr",function(){return o.findActive()}),this}function o(e,t){l(e,new c.StateRestoreCollection(e,t.config))}function l(e,t){var s=e.stateRestore.states(),o=e.button("SaveStateRestore:name"),a=[];if(o[0])for(var i=o.index().split("-"),a=o[0].inst.c.buttons,n=0;n'+e.i18n("stateRestore.emptyStates",t.c.i18n.emptyStates)+"");else for(var c=0,l=s;c"+d.s.identifier+"")&&h.unshift("

"+d.s.identifier+"

"),a.push({_stateRestore:d,attr:{title:d.s.identifier},config:{split:h},extend:"stateRestore",text:d.s.identifier})}e.button("SaveStateRestore:name").collectionRebuild(a);for(var u=0,m=e.buttons();u'+a.s.dt.i18n("stateRestore.removeConfirm",a.c.i18n.removeConfirm).replace(/%s/g,a.s.identifier)+"
"),a.dom.confirmation.trigger("dtsr-rename"),a.dom.background.click(),a.dom.confirmation.remove(),u(g).unbind("keyup",function(e){return a._keyupFunction(e)}),a.dom.confirmationButton.off("click")}e={action:"rename",stateRestore:((e={})[a.s.identifier]=s,e)};if(a.c.ajax)"string"==typeof a.c.ajax&&a.s.dt.settings()[0]._bInitComplete?u.ajax({data:e,success:t,type:"POST",url:a.c.ajax}):"function"==typeof a.c.ajax&&a.c.ajax.call(a.s.dt,e,t);else try{localStorage.removeItem("DataTables_stateRestore_"+a.s.identifier+"_"+location.pathname+(a.s.tableId?"_"+a.s.tableId:"")),t()}catch(e){return a.dom.confirmation.children("."+a.classes.modalError).remove(),a.dom.confirmation.append(a.dom.removeError),!1}return!0};if(null!==s){if(o.includes(s))throw new Error(this.s.dt.i18n("stateRestore.duplicateError",this.c.i18n.duplicateError));if(0===s.length)throw new Error(this.s.dt.i18n("stateRestore.emptyError",this.c.i18n.emptyError));this.dom.confirmation.appendTo(this.dom.dtContainer),u(this.s.dt.table().node()).trigger("dtsr-modal-inserted"),e(),this.dom.confirmation.remove()}else this.dom.renameInput.val(this.s.identifier),this.dom.renameContents.append(this.dom.renameInput),this._newModal(this.dom.renameTitle,this.s.dt.i18n("stateRestore.renameButton",this.c.i18n.renameButton),e,this.dom.renameContents)}},n.prototype.save=function(e,t,s){var o,a,i,n=this;if(void 0===s&&(s=!0),this.c.save){if(this.s.dt.state.save(),e===k)o=this.s.dt.state();else{if("object"!=typeof e)return;o=e}if(o.stateRestore?(o.stateRestore.isPreDefined=this.s.isPreDefined,o.stateRestore.state=this.s.identifier,o.stateRestore.tableId=this.s.tableId):o.stateRestore={isPreDefined:this.s.isPreDefined,state:this.s.identifier,tableId:this.s.tableId},this.s.savedState=o,this.c.saveState.order||(this.s.savedState.order=k),this.c.saveState.search||(this.s.savedState.search=k),this.c.saveState.columns&&this.s.savedState.columns)for(var r=0,c=this.s.savedState.columns.length;r
').append(this.dom.confirmationButton)).appendTo(this.dom.dtContainer),u(this.s.dt.table().node()).trigger("dtsr-modal-inserted"),o.children("input")),i=((0'+this.s.dt.i18n("stateRestore.emptyStates",this.c.i18n.emptyStates)+"";if(0===this.s.states.length)t.includes(a)||t.push(a);else{for(;t.includes(a);)t.splice(t.indexOf(a),1);this.s.states=this.s.states.sort(function(e,t){e=e.s.identifier,t=t.s.identifier;return t"+r.s.identifier+"")&&c.unshift("

"+r.s.identifier+"

"),t.push({_stateRestore:r,attr:{title:r.s.identifier},config:{split:c},extend:"stateRestore",text:r.s.identifier})}}e.collectionRebuild(t);for(var l=0,d=this.s.dt.buttons();l'+t+"")),e=(this.dom.confirmation.empty().append(this.dom.confirmationTitleRow).append(o).append(f('
').append(n)).appendTo(this.dom.dtContainer),f(this.s.dt.table().node()).trigger("dtsr-modal-inserted"),o.children("input")),r=((0"+p.s.identifier+"")&&l.unshift("

"+p.s.identifier+"

"),u.push({_stateRestore:p,attr:{title:p.s.identifier},config:{split:l},extend:"stateRestore",text:p.s.identifier})}t.button("SaveStateRestore:name").collectionRebuild(u),s.blur();for(var v=0,b=t.buttons();v