text: /**
   * This file is part of the Grido (http://grido.bugyik.cz)
   *
   * Copyright (c) 2011 Petr Bugyík (http://petr.bugyik.cz)
   *
   * For the full copyright and license information, please view
   * the file LICENSE.md that was distributed with this source code.
   */
  !function(t,e,i){"use strict";var n=n||{};n.Grid=function(e,i){this.$element=e,this.$table=t("table",e),this.name=this.$table.attr("id"),this.options=t.extend(t.fn.grido.defaults,i,this.$table.data("grido-options")||{})},n.Grid.prototype={operation:null,onInit:[],init:function(){this.ajax=new n.Ajax(this).init(),this.operation=new n.Operation(this).init(),this.initFilters(),this.initItemsPerPage(),this.initActions(),this.initPagePrompt(),this.initCheckNumeric(),this.initEditable();for(var t in this.onInit)this.onInit[t](this);return this},initFilters:function(){t(".filter select, .filter [type=checkbox]",this.$element).off("change.grido").on("change.grido",this.sendFilterForm);var e=this;t(".filter input, .filter textarea",this.$element).off("focus.grido").on("focus.grido",function(){var e=t(this);e.data("current-value",e.val())}).off("blur.grido").on("blur.grido",function(){var i=t(this);i.data("current-value")!==i.val()&&e.sendFilterForm()})},initItemsPerPage:function(){t("[name=count]",this.$table).off("change.grido").on("change.grido",function(){t(this).next().trigger("click")})},initActions:function(){var e=this;t(".actions a",this.$table).off("click.nette").off("click.grido").on("click.grido",function(i){var n=t(this).hasClass("ajax")&&e.ajax,o=t(this).data("grido-confirm"),r=function(t){t.preventDefault(),t.stopImmediatePropagation()};o&&confirm(o)?n&&(e.ajax.doRequest(this.href,this,i)||r(i)):o?r(i):n&&(e.ajax.doRequest(this.href,this,i)||r(i))})},initPagePrompt:function(){var i=this;t(".paginator .prompt",this.$table).off("click.grido").on("click.grido",function(){var n=parseInt(prompt(t(this).data("grido-prompt")),10);if(n&&n>0&&n<=parseInt(t(".paginator a.btn:last",i.element).prev().text(),10)){var o=t(this).data("grido-link").replace("page=0","page="+n);e.location=o}else n&&e.alert("Page is out of range.")})},initCheckNumeric:function(){t(".filter input.number",this.$element).off("keyup.grido").on("keyup.grido",function(){var e=t(this).val(),i=new RegExp(/[^<>=\\.\\,\-0-9]+/g);i.test(e)&&t(this).val(e.replace(i,""))})},initEditable:function(){var e=this;t('td[class*="grid-cell-"]',this.$element).off("dblclick.grido").on("dblclick.grido",function(i){o.isCtrl(i)&&!t(this).hasClass("edit")&&(this.editable=new n.Editable(e).init(t(this)))})},sendFilterForm:function(){t('[name="buttons[search]"]',this.$element).click()}},n.Operation=function(t){this.grido=t},n.Operation.prototype={selector:"td.checker [type=checkbox]",$last:null,init:function(){return t("th.checker",this.grido.$table).length?(this.initSelectState(),this.initActiveRows(),this.bindClickOnCheckbox(),this.bindClickOnRow(),this.bindClickOnInvertor(),this.bindChangeOnCheckbox(),this.bindChangeOnSelect(),this.bindClickOnButton(),this):null},initSelectState:function(){0===t(this.selector+":checked",this.grido.$table).length&&this.controlState("disabled")},initActiveRows:function(){t(this.selector+":checked",this.grido.$table).closest("tr").addClass("active")},bindClickOnCheckbox:function(){var e=this;t(this.selector,this.grido.$table).off("click.grido").on("click.grido",function(i,n){if(i.shiftKey||n&&n.shiftKey){var o=t(e.selector,e.grido.$table),r=o.index(this),a=o.index(e.$last);o.slice(Math.min(r,a),Math.max(r,a)).attr("checked",e.$last.checked).trigger("change")}e.$last=this})},bindClickOnRow:function(){var e=this;t("tbody td:not(.checker,.actions a)",this.grido.$table).off("click.grido").on("click.grido",function(i){t(this).hasClass("edit")||(i.shiftKey&&e.disableSelection.call(e),t(e.selector,t(this).closest("tr")).click(),i.shiftKey&&e.enableSelection.call(e))})},bindClickOnInvertor:function(){var e=this;t("th.checker [type=checkbox]",this.grido.$table).off("click.grido").on("click.grido",function(){return t(e.selector,e.grido.$table).each(function(){var i=t(this).prop("checked");t(this).prop("checked",!i),e.changeRow(t(this).closest("tr"),!i)}),!0})},bindChangeOnCheckbox:function(){var e=this;t(this.selector,this.grido.$table).off("change.grido").on("change.grido",function(){t.proxy(e.changeRow,e)(t(this).closest("tr"),t(this).prop("checked"))})},bindChangeOnSelect:function(){var e=this;t('.operations [name="operations[operations]"]',this.grido.$table).off("change.grido").on("change.grido",function(){t(this).val()&&t(".operations [type=submit]",e.grido.$table).click()})},bindClickOnButton:function(){t(".operations [type=submit]",this.grido.$table).off("click.grido").on("click.grido",t.proxy(this.onSubmit,this))},disableSelection:function(){this.grido.$table.attr("unselectable","on").css("user-select","none")},enableSelection:function(){if(e.getSelection){var t=e.getSelection();t.removeAllRanges&&t.removeAllRanges()}else i.selection&&i.selection.empty();this.grido.$table.attr("unselectable","off").attr("style",null)},getSelect:function(){return t('.operations [name="operations[operations]"]',this.grido.$table)},changeRow:function(e,i){i?e.addClass("active"):e.removeClass("active"),0===t(this.selector+":checked",this.grido.$table).length?this.controlState("disabled"):this.controlState("enabled")},onSubmit:function(){var e=this.getSelect().attr("data-grido-confirm-"+this.getSelect().val());return e?confirm(e.replace(/%i/g,t(this.selector+":checked",this.grido.$table).length))?!0:(this.getSelect().val(""),!1):!0},controlState:function(e){var i=t('[name="buttons[operations]"]',this.grido.$table);"disabled"===e?(this.getSelect().attr("disabled","disabled").addClass("disabled"),i.addClass("disabled")):(this.getSelect().removeAttr("disabled").removeClass("disabled"),i.removeClass("disabled"))}},n.Ajax=function(t){this.grido=t},n.Ajax.prototype={init:function(){return this.grido.options.ajax?(this.registerSuccessEvent(),this.registerPopState(),this):null},registerSuccessEvent:function(){var e=this;this.grido.$element.off("success.ajax.grido").on("success.ajax.grido",function(i,n){t.proxy(e.handleSuccessEvent,e)(n),i.stopImmediatePropagation()})},registerPopState:function(){var i=this;t(e).off("popstate.ajax.grido").on("popstate.ajax.grido",function(e){t.proxy(i.onPopState,i)(e),e.stopImmediatePropagation()})},handleSuccessEvent:function(e){var n=this,o={},r="snippet-"+this.grido.name+"-grid";if(e&&e.snippets&&e.snippets[r]&&e.state){t.each(e.state,function(t,e){(e||0===e)&&t.indexOf(""+n.grido.name+"-")>=0&&(o[t]=e)});var a=this.getQueryString(o);t.data(i,this.grido.name+"-query",a),this.onSuccessEvent(o,a)}},getQueryString:function(i){var n;if(t.isEmptyObject(i)){var o={},r=this.getQueryParams();for(var a in r)0!==a.indexOf(this.grido.name)&&(o[a]=r[a]);n=t.isEmptyObject(o)?e.location.pathname:"?"+t.param(o)}else n="?"+t.param(t.extend(this.getQueryParams(),i));return this.coolUri(n)},onSuccessEvent:function(t,n){e.history.pushState(t,i.title,n)},onPopState:function(n){var o=t.data(i,this.grido.name+"-query")||"",r=e.location.search;if(o!==r){var a=this.getRefreshGridHandlerUrl(this.grido.$element);this.doRequest(a+r.replace("?","&"))}},doRequest:function(e){t.get(e)},coolUri:function(e){var i=e,n={"%5B":"[","%5D":"]","%E2%86%91":"↑","%E2%86%93":"↓"};return t.each(n,function(t,e){i=i.replace(new RegExp(t,"g"),e)}),i},getRefreshGridHandlerUrl:function(t){return t.data("grido-refresh-handler")},getQueryParams:function(){for(var t,i=function(t){return decodeURIComponent(t).replace(/\+/g," ")},n=e.location.search.substring(1),o=/([^&=]+)=?([^&]*)/g,r={};t=o.exec(n);)if(-1===t[1].indexOf("["))r[i(t[1])]=i(t[2]);else{var a=t[1].indexOf("["),s=t[1].slice(a+1,t[1].indexOf("]",a)),c=i(t[1].slice(0,a));"object"!=typeof r[c]&&(r[i(c)]={}),s?r[i(c)][i(s)]=i(t[2]):Array.prototype.push.call(r[i(c)],i(t[2]))}return r}},n.Editable=function(t){this.grido=t},n.Editable.prototype={init:function(t){return this.grido.options.ajax!==!0||this.grido.options.editable!==!0?null:(this.td=t.addClass("edit"),this.th=this.getColumnHeader(this.td),this.getEditHandlerUrl(this.th)&&(this.value=this.getValue(this.td),this.oldValue=this.getOldValue(this.td),this.primaryKey=this.getPrimaryKeyValue(this.td.parent()),this.componentName=this.getComponentName(this.th),this.editControlHtml=this.getEditControl(this.componentName,this.getEditControlHandlerUrl(this.th)),this.renderEditControl(this.td,this.editControlHtml),this.editControlObject=this.getEditControlObject(this.td),this.setFocus(this.editControlObject),this.initBindings(this.editControlObject)),this)},getColumnHeader:function(e){for(var i,n=e.attr("class").replace("cell","header").split(/\s+/),o=0;o<n.length;o++)-1!==n[o].indexOf("-header-")&&(i=n[o]);return t('th[class~="'+i+'"]')},getPrimaryKeyValue:function(t){return t.attr("class").match(/[grid\-row\-]([0-9]+)/)[1]},getComponentName:function(t){var e=this.getEditControlHandlerUrl(t).replace("/[.d]*/g","");return e=e.match(/[\??\&?](do=)+(.*)/)[2],e.match(/(.*)\-edit/)[1]},getEditHandlerUrl:function(t){return t.data("grido-editable-handler")},getEditControlHandlerUrl:function(t){return t.data("grido-editablecontrol-handler")},getValue:function(t){return t.data("grido-editable-value")},getOldValue:function(t){return t.children().length>0?t.children():t.text().trim()},getEditControl:function(e,i){var n,o={};return o[e+"-value"]=this.value,t.ajax({type:"GET",url:i,data:o,async:!1}).success(function(t){n=t}),n},renderEditControl:function(t,e){t.html(e)},getEditControlObject:function(t){return t.children()},setFocus:function(t){"text"===t[0].type&&t.focus()},saveData:function(e,i,n,o,r,a){var s={},c=this,l=t("[type=checkbox]",this.editControlObject).length?~~+t("[type=checkbox]",this.editControlObject).is(":checked"):this.editControlObject.val();return l===e?void r.html(a):(s[i+"-id"]=n,s[i+"-newValue"]=l,s[i+"-oldValue"]=e,void t.ajax({type:"POST",url:this.getEditHandlerUrl(o),data:s,async:!0}).success(function(t){t.updated===!0?(t.html?r.html(t.html):r.html(l),r.data("grido-editable-value",l),c.oldValue=l,c.flashSuccess(r)):(c.flashError(r),c.revertChanges(r))}))},revertChanges:function(t){t.html(this.oldValue)},flashSuccess:function(t){var e=0,i=1,n=setInterval(function(){e+=.01*i,t.css("background","rgba(196,234,195,"+e+")"),e>=1&&(i=-1),0>=e&&(clearInterval(n),t.css("background",""))},1)},flashError:function(t){var e=0,i=1,n=setInterval(function(){e+=.01*i,t.css("background","rgba(240,54,69,"+e+")"),e>=1&&(i=-1),0>=e&&(clearInterval(n),t.css("background",""))},1)},initBindings:function(t){var i=this,n=function(t){if(13===t.keyCode){if("TEXTAREA"===this.tagName)return;return a(this),t.preventDefault(),!1}},r=function(t){return 27===t.keyCode?(i.revertChanges(i.td),i.td.removeClass("edit"),t.preventDefault(),!1):o.isCtrl(t)&&13===t.keyCode?(a(this),t.preventDefault(),!1):void 0},a=function(t){return"object"!=typeof e.Nette||e.Nette.validateControl(t)?(i.saveData(i.value,i.componentName,i.primaryKey,i.th,i.td,i.oldValue),void i.td.removeClass("edit")):!1};t.off("keypress.grido").on("keypress.grido",n).off("keydown.grido").on("keydown.grido",r)}};var o={isCtrl:function(t){return(t.ctrlKey||t.metaKey)&&!t.altKey}},r=t.fn.grido;return t.fn.grido=function(e){return this.each(function(){var i=t(this);i.data("grido")||i.data("grido",new n.Grid(i,e).init())})},t.fn.grido.noConflict=function(){return t.fn.grido=r,this},t.fn.grido.defaults={ajax:!0,datepicker:{format:"DD.MM.YYYY",options:{}},daterangepicker:{format:"DD.MM.YYYY",separator:" - ",options:{}}},e.Grido=n,n}(jQuery,window,document),function(t,e){"use strict";e.Grido.Grid.prototype.onInit.push(function(e){if(e.$element.hasClass("bootstrap")!==!1){var i,n=".paginator input";e.$element.on("keyup",n,function(i){var n=i.keyCode||i.which;if(13===n){var o=t(this);return e.ajax.doRequest(o.data("grido-link").replace(0,o.val())),!1}var r=parseInt(this.value),a=parseInt(t(this).attr("min")),s=parseInt(t(this).attr("max"));return isNaN(this.value)||a>r||r>s?(t(this).val(this.value.length>1?this.value.substr(0,this.value.length-1):t(this).data("grido-current")),!1):void 0}).on("focus",n,function(){t(this).val(t(this).data("grido-current")).select()}).on("blur",n,function(){t(this).val(""),t(this).attr("placeholder",i)})}})}(jQuery,window),function(t,e,i,n){"use strict";e.Grido.Grid.prototype.onInit.push(function(e){if(e.$element.hasClass("bootstrap")!==!1){if(t.fn.selectpicker===n)return void console.error('Plugin "bootstrap-select.js" is missing! Run `bower install bootstrap-select` and load it.');var o=function(){t(".filter select").selectpicker({noneSelectedText:"",style:"btn-default",liveSearch:!0})};o(),t(i).ajaxSuccess(o)}})}(jQuery,window,document),function(t,e,i){"use strict";e.Grido.DatePicker={isLoaded:function(){return t.fn.daterangepicker===i?(console.error('Plugin "bootstrap-daterangepicker.js" is missing! Run `bower install bootstrap-daterangepicker` and load it.'),!1):!0},init:function(e){var i,n=e.options.datepicker,o=t.extend({autoApply:!1,showDropdowns:!0,autoUpdateInput:!1,singleDatePicker:!0,locale:{format:n.format}},n.options);return e.$element.on("focus","input.date",function(){i=t(this),i.daterangepicker(o),i.on("apply.daterangepicker",function(t,o){i.val(o.startDate.format(n.format)),e.sendFilterForm()})}),this}},e.Grido.Grid.prototype.onInit.push(function(t){var i=e.Grido.DatePicker;i.isLoaded()&&i.init(t)})}(jQuery,window),function(t,e,i){"use strict";e.Grido.DateRangePicker={isLoaded:function(){return t.fn.daterangepicker===i?(console.error('Plugin "bootstrap-daterangepicker.js" is missing! Run `bower install bootstrap-daterangepicker` and load it.'),!1):e.moment===i?(console.error('Plugin "moment.js" required by "bootstrap-daterangepicker.js" is missing!'),!1):!0},init:function(e){var i,n=e.options.daterangepicker,o=t.extend({autoApply:!0,showDropdowns:!0,autoUpdateInput:!1,ranges:this.getRanges(),locale:{format:n.format,separator:n.separator}},n.options);return e.$element.on("focus","input.daterange",function(){i=t(this),i.daterangepicker(o),i.on("apply.daterangepicker",function(t,o){i.val(o.startDate.format(n.format)+n.separator+o.endDate.format(n.format)),e.sendFilterForm()})}),this},getRanges:function(){return{Today:[e.moment(),e.moment()],Yesterday:[e.moment().subtract(1,"days"),e.moment().subtract(1,"days")],"Last 7 Days":[e.moment().subtract(6,"days"),e.moment()],"Last 30 Days":[e.moment().subtract(29,"days"),e.moment()],"This Month":[e.moment().startOf("month"),e.moment().endOf("month")],"Last Month":[e.moment().subtract(1,"month").startOf("month"),e.moment().subtract(1,"month").endOf("month")]}}},e.Grido.Grid.prototype.onInit.push(function(t){var i=e.Grido.DateRangePicker;i.isLoaded()&&i.init(t)})}(jQuery,window),function(t,e,i,n){"use strict";e.Grido.Ajax.prototype.onSuccessEvent=function(t,o){return e.History===n?void console.error('Plugin "history.js" is missing! Run `bower install history.js` and load it.'):void e.History.pushState(t,i.title,o)}}(jQuery,window,document),function(t,e,i){"use strict";e.Grido.Ajax.prototype.doRequest=function(e,n,o){return t.fn.netteAjax===i?void console.error('Plugin "nette.ajax.js" is missing! Run `bower install nette.ajax.js` and load it.'):void t.nette.ajax({url:e},n,o)}}(jQuery,window),function(t){"use strict";t.nette.ext("grido",{load:function(){this.selector=t(".grido"),this.selector.grido()},success:function(e){if(e.grido){this.selector.trigger("success.ajax.grido",e);var i=0;for(var n in e.snippets){var o=t("#"+n);o.length&&(i=parseInt(o.offset().top));break}t("html, body").animate({scrollTop:i},400)}}})}(jQuery),function(t,e,i){"use strict";e.Grido.Grid.prototype.onInit.push(function(n){if(t.fn.typeahead===i)return void console.error('Plugin "typeahead.js" is missing! Run `bower install typeahead.js` and load bundled version.');if(e.Bloodhound===i)return void console.error('Plugin "Bloodhound" required by "typeahead.js" is missing!');var o=n;n.$element.find("input.suggest").each(function(){var n=t(this).data("grido-suggest-handler"),r=t(this).data("grido-suggest-replacement"),a={limit:t(this).data("grido-suggest-limit"),datumTokenizer:e.Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:e.Bloodhound.tokenizers.whitespace,remote:{url:n.replace(r,"%QUERY"),wildcard:"%QUERY"}};e.NProgress!==i&&(a.remote.ajax={beforeSend:t.proxy(e.NProgress.start),complete:t.proxy(e.NProgress.done)});var s=new e.Bloodhound(a);s.initialize(),t(this).typeahead(null,{displayKey:function(t){return t},source:s.ttAdapter()}),t(this).on("typeahead:selected",function(){o.sendFilterForm()})})})}(jQuery,window);