'use strict';10<=document.documentMode&&(document.documentElement.className+=" ie ie"+document.documentMode);String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{enumerable:!1,configurable:!1,writable:!1,value:function(a,b){b=b||0;return this.indexOf(a,b)===b}});String.prototype.padStart||(String.prototype.padStart=function(a,b){a>>=0;b=String(b||" ");if(this.length>a)return String(this);a-=this.length;a>b.length&&(b+=b.repeat(a/b.length));return b.slice(0,a)+String(this)});
String.prototype.includes||(String.prototype.includes=function(a,b){"number"!==typeof b&&(b=0);return b+a.length>this.length?!1:-1!==this.indexOf(a,b)});Object.entries||(Object.entries=function(a){for(var b=Object.keys(a),c=b.length,d=Array(c);c--;)d[c]=[b[c],a[b[c]]];return d});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});Date.prototype.addDays||(Date.prototype.addDays=function(a){var b=new Date(this.valueOf());b.setDate(b.getDate()+a);return b});
!window.crypto&&window.msCrypto&&(window.crypto={subtle:{promise:function(a){return{then:function(b){a.oncomplete=function(a){b(a.target.result)};return this},catch:function(b){a.onerror=function(a){b(a.target.result)};return this}}},generateKey:function(a,b,c){a=window.msCrypto.subtle.generateKey(a,b,c);return this.promise(a)},exportKey:function(a,b){a=window.msCrypto.subtle.exportKey(a,b);return this.promise(a)},decrypt:function(a,b,c){a=window.msCrypto.subtle.decrypt(a,b,c);return this.promise(a)}}});
var confero={page:{getElem:function(a){a=a.replace(/:/g,"\\:").replace("#","\\#").replace(/\|/g,"\\|");var b=a.indexOf("*");return 0<=b?$("*[id^\x3d"+a.substring(0,b)+"]").filter("*[id$\x3d"+a.substring(b+1)+"]"):$("#"+a)},getElemByName:function(a){return $("*[name\x3d"+a.replace(/:/g,"\\:").replace("#","\\#").replace(/\|/g,"\\|")+"]")},init:function(a){a||(a=$(document.body));a.hasClass("no-session-check")||window.sessionStorage.A||confero.post.action({mode:"exit"});setTimeout(function(a){confero.error.init(a)},
1,a);setTimeout(function(a){confero.repeater.init(a)},1,a);setTimeout(function(a){confero.textarea.init(a)},1,a);setTimeout(function(a){confero.select2.init(a)},1,a);setTimeout(function(a){confero.calendar.init(a)},1,a);setTimeout(function(a){confero.linked.init(a)},1,a);setTimeout(function(a){confero.table.init(a)},1,a);setTimeout(function(a){confero.qrcode.init(a)},1,a);setTimeout(function(a){confero.peity.init(a)},1,a);setTimeout(function(a){confero.chart.init(a)},1,a);setTimeout(function(a){confero.schedules.init(a)},
1,a);setTimeout(function(a){confero.events.radio.init(a)},1,a);setTimeout(function(a){confero.file.init(a)},1,a);setTimeout(function(a){confero.formatedText.init(a)},1,a);setTimeout(function(a){confero.inputDisabling.init(a)},1,a);setTimeout(function(a){a.addClass("ready")},1,a)},finalize:function(a){a||(a=$(document.body));a.data("closePopup")&&confero.post.action.call(a,a.data("closePopup"));confero.table.finalize(a)},clipboardCopy:function(a){var b=confero.page.getElem(a);a=b[0];var b=b.parents("fieldset")[0],
c=a.disabled,d=b.disabled;a.disabled=!1;b.disabled=!1;a.focus();a.setSelectionRange(0,a.value.length);document.execCommand("copy");a.setSelectionRange(0,0);a.disabled=c;b.disabled=d},theme:{init:function(){var a=$(document.body);a.hasClass("no-session-check")||window.sessionStorage.A||confero.post.action({mode:"exit"});"1"==a.data("config").themeSwitch&&a.data("config").themeList&&localStorage.theme&&0<=a.data("config").themeList.indexOf(localStorage.theme)&&($.each(a.data("config").themeList,function(b,
c){a.removeClass(c)}),a.addClass(localStorage.theme),confero.page.theme.favicon(localStorage.theme));a.data("config").environment&&a.data("config").environment.watermark&&a.attr("data-watermark",a.data("config").environment.watermark)},change:function(a){if(a.ctrlKey){var b=$(document.body);if("1"==b.data("config").themeSwitch&&b.data("config").themeList){var c=b.data("config").themeList;$.each(document.body.classList,function(a,e){a=c.indexOf(e);if(0<=a)return++a,a>=c.length&&(a=0),b.removeClass(e),
b.addClass(c[a]),localStorage.theme=c[a],confero.page.theme.favicon(localStorage.theme),!1})}}else a.shiftKey&&(b=$(document.body),b.trigger("theme:swithch:shift",{}))},favicon:function(a){$("#favicon").attr("href","style/"+a+"/img/favicon.png")}},transition:{removing:function(){this.parentNode.removeChild(this)}},required:function(a,b){b?(a.attr("required",b),a.prop("required",b)):(a.removeAttr("required"),a.removeProp("required"));a=a.parents("dd");0<a.find("*[required]").length?a.prev("dt").addClass("required"):
a.prev("dt").removeClass("required")}},schedules:{schedule:function(a,b,c){if(a&&a.delay){var d=new Date;a.seconds&&d.setSeconds(d.getSeconds()+parseInt(a.seconds));a.infinity&&(d=null);var e=null,f=this,g=function(){var a=new Date;return!1===b.call(f,{interval:e,shift:d-a})||d&&d<a?(e&&window.clearInterval(e),c&&c(),!1):!0};if(0==a.immediate||g.call())e=window.setInterval(g,a.delay);return e}},init:function(a){confero.schedules.messageNotification(a);confero.schedules.sessionTimeOut(a);confero.schedules.cookieBanner(a)},
messageNotification:function(a){a.find("section header div.message").each(function(){var a=this;confero.post.action.call(this,{mode:"schedule",action:{mode:"callback",pageaction:{form:"message-notification"},action:function(b,d,e){b["message-count"]&&$(a).addClass("notice")}},schedule:{delay:50,immediate:!1}},{})})},sessionTillTime:{init:function(a,b,c){"nocontent"==b&&c&&c.getResponseHeader("Confero-Redirect")&&window.location.assign(c.getResponseHeader("Confero-Redirect"));a=new Date;b=$(document.body);
c=900;b.data("config")&&b.data("config").sessionTimeOut&&(c=b.data("config").sessionTimeOut);a.setSeconds(a.getSeconds()+c);confero.schedules.sessionTillTime.till=a},getShift:function(){return confero.schedules.sessionTillTime.till-new Date}},sessionTimeOut:function(a){a.is("body")&&!a.hasClass("no-session-timeout")&&(confero.schedules.sessionTillTime.init(),confero.post.action.call(this,{mode:"schedule",action:{mode:"call",action:function(b,c,d){b=confero.schedules.sessionTillTime.getShift();c=a.find("div.session-timeout");
if(a.is("body")&&!a.hasClass("no-session-warning")){d=3E4;var e=$(document.body);e.data("config").sessionWarning&&(d=1E3*e.data("config").sessionWarning);b<d?0==c.length?(c="\x3cp\x3e"+confero.translations.get("sessiontimeout_notification")+"\x26#160;\x3cb\x3e",c+=Math.round(b/1E3),c+="\x3c/b\x3e\x26#160;\x3ci\x3e"+confero.translations.get("sessiontimeout_seconds_5")+"\x3c/i\x3e\x3c/p\x3e",c+="\x3cp\x3e"+confero.translations.get("sessiontimeout_description")+"\x3c/p\x3e",confero.post.action.call(this,
{mode:"popup-modal",config:{cssClass:"session-timeout",title:confero.translations.get("notificatio_header"),message:c,buttons:[{label:confero.translations.get("b_proceed"),classes:"primary",action:{mode:"callback",action:function(a,b,c){},pageaction:{form:"dummy"}}},{label:confero.translations.get("b_cancel"),action:{mode:"exit"}}],closePopup:{mode:"callback",action:function(a,b,c){},pageaction:{form:"dummy"}}}},{})):(d=Math.round(b/1E3),0>d&&(d=0),c.find("b").html(d),1==d%10&&11!=d%100?c.find("i").html(confero.translations.get("sessiontimeout_seconds_1")):
2!=d%10&&3!=d%10&&4!=d%10||12==d%100||13==d%100||14==d%100?c.find("i").html(confero.translations.get("sessiontimeout_seconds_5")):c.find("i").html(confero.translations.get("sessiontimeout_seconds_2"))):0<c.length&&confero.popup.close()}500>b&&confero.post.action({mode:"exitTimeout"})}},schedule:{delay:1E3,immediate:!1,infinity:!0}},{}))},cookieBanner:function(a){a.is("body")&&!a.hasClass("error-404")&&!1!==a.data("config").cookie&&confero.post.action.call(this,{mode:"schedule",action:{action:function(){if(!localStorage.cookie){var b=
$('\x3cp class\x3d"cookie"\x3e\x3c/p\x3e'),c=$("\x3cdiv\x3e\x3c/div\x3e");c.append($("\x3cspan\x3e\x3c/span\x3e").html(confero.translations.get("cookie_disclaimer")));confero.popup.renderButtons(c,[{label:confero.translations.get("b_cookie_agree"),classes:"white",action:{action:function(){localStorage.cookie=!0;b.remove()}}}]);b.append(c);a.append(b)}}},schedule:{delay:1,immediate:!1}},{})}},spinner:{show:function(a,b){a=confero.spinner.getElement(a);var c="loading";b&&(c=c.concat(b.hideContent?" hide-content":
"").concat(b.centerVertical?" center-vertical":"").concat(b.whiteBackground?" white-background":""));a.addClass(c)},hide:function(a){confero.spinner.getElement(a).removeClass("loading hide-content center-vertical white-background")},getElement:function(a){return a.is("select")?a.siblings("span.select2"):a.is("input")?a.parent():a}},translations:{get:function(a){var b;$("div.translates").each(function(){var c=$(this);if(c.data("translates")[c.data("language")][a])return b=c.data("translates")[c.data("language")][a],
!1});return b}},menu:{toggleMenu:function(){$(this).toggleClass("selected").siblings("[data-mode\x3d'menu-collapse']").removeClass("selected")}},post:{xhr:{v:[],push:function(a){this.v.push(a)},remove:function(a){for(var b=0;b<this.v.length;b++)this.v[b]===a&&this.v.splice(b,1)},ready:function(){return 0==this.v.length}},validate:function(a,b){var c=a.pageaction?a.pageaction.validate:!0,d=a.pageaction?a.pageaction["validate-type"]:null,e=$(this).parents("form").first(),f=!0;0!=c&&"skip"!==c&&("non-strict"===
c?$(this).parents("fieldset"==d?"fieldset":"form").find(confero.error.elems).each(function(){var a=this.checkValidity();a||this.validity.tooShort||this.validity.tooLong||this.validity.patternMismatch||!this.validity.valueMissing||(a=!0);f&=a}):"fieldset"==d?$(this).parents("fieldset.auto-disable").first().find(confero.error.elems).each(function(){f&=this.checkValidity()}):"customform"==d?(e.find(confero.error.elems).each(function(){f&=this.checkValidity()}),e.find("div.formated-text.input").each(function(){f&=
!$(this).data("checkValidity").call(this)})):f=e[0].checkValidity());if(f)return b(e,a,c);"fieldset"==d&&$(this).hasClass("auto-disabled")||(confero.error.validate(c),a=e.find("dl.error").first(),1==a.length&&(confero.spinner.hide(a.closest(".article")),b=a.siblings("dl").first(),1===b.length&&b.attr("id")&&(b=b.attr("id").substring(0,b.attr("id").indexOf(":")),b.includes("step")&&confero.wizard.openStepWithoutAjax(b)),a.prev()[0].scrollIntoView({block:"start",behavior:"smooth"})))},sync:function(a){confero.schedules.schedule.call(this,
{delay:300,immediate:!0,infinity:!0},function(b){return confero.post.xhr.ready()?(confero.post.validate.call(this,a,function(a,b,e){a.find("#__Action").val(confero.post.pageaction(b));document.documentElement.className+=" unloading";1!=e&&(a.find(":input").filter(function(){return"skip"===e?!0:$(this).is(":invalid")}).prop("disabled",!0),a.find("#__Action").prop("disabled",!1),a.find("#__Metadata").prop("disabled",!1),a.find("#__CSRF").prop("disabled",!1));a.find("#__Metadata").val(confero.post.metadata());
a[0].submit()}),!1):!0})},async:function(a){var b=this;return confero.post.validate.call(this,a,function(a,d,e){d.pageaction&&d.pageaction["clear-errors"]&&confero.error.clean();e=new FormData(a[0]);e.set("__Action",confero.post.pageaction(d));e.set("__Metadata",confero.post.metadata());d.spinner&&confero.spinner.show($(b).closest(".article"),{centerVertical:!0});e=$.ajax({type:"POST",url:a[0].action,headers:{"Confero-Callback":"true"},data:e,processData:!1,contentType:!1,timeout:9E4}).done(function(c,
e,k){confero.post.processresponse.call(b,!0,d,c,e,k);(!1!==d.hideSpinnerAfterLoad||confero.error.hasError(c))&&confero.spinner.hide($(b).closest(".article"));c=a.find("dl.error").first();1==c.length&&c.prev()[0].scrollIntoView({block:"start",behavior:"smooth"})}).fail(function(a,b,c){confero.error.ajax(a,b,c,d)}).always(function(a,b,c){confero.schedules.sessionTillTime.init(a,b,c);"success"==b?confero.post.xhr.remove(c):confero.post.xhr.remove(a)});confero.post.xhr.push(e);return e})},callback:function(a){var b=
this,c=$(this).parents("form")[0];c||(c=$(this).find("form")[0]);a.pageaction&&a.pageaction["clear-errors"]&&confero.error.clean();var d=new FormData;d.set("__Action",confero.post.pageaction(a));d.set("__Metadata",confero.post.metadata());d.set("__CSRF",$("#__CSRF").val());c=$.ajax({type:"POST",url:c.action,headers:{"Confero-Callback":"true"},data:d,processData:!1,contentType:!1,timeout:9E4}).done(function(c,d,g){confero.post.processresponse.call(b,!1,a,c,d,g)}).fail(function(a,b,c){confero.error.ajax(a,
b,c)}).always(function(a,b,c){confero.schedules.sessionTillTime.init(a,b,c);"success"==b?confero.post.xhr.remove(c):confero.post.xhr.remove(a)});confero.post.xhr.push(c);return c},pageaction:function(a){var b=a.pageaction;return b?(b.dynamic&&(b.data||(b.data={}),$.each(b.dynamic,function(a,d){a=confero.page.getElemByName(d);a.length?(a=a.map(function(){return $(this).is("input[type\x3dcheckbox]")||$(this).is("input[type\x3dradio]")?$(this).is("input:checked")?$(this).val():null:$(this).val()}).get(),
1==a.length&&(a=a[0]),0<=d.indexOf(":")?(d=d.split(":",2),b.data[d[0]]||(b.data[d[0]]={}),b.data[d[0]][d[1]]=a):(b.data[""]||(b.data[""]={}),b.data[""][d]=a)):window[d]&&(a=window[d],b.data[""]||(b.data[""]={}),"function"===typeof a?b.data[""][d]=a():"string"===typeof a&&(b.data[""][d]=window[d]))})),JSON.stringify(b)):""},metadata:function(){var a=$("fieldset:enabled\x3edl").not($("div.repeater\x3einput[type\x3dhidden]:disabled+fieldset:enabled fieldset:enabled\x3edl"));return a.find(":input:disabled").not("input[type\x3dradio], input[type\x3dcheckbox]").filter(function(){return!this.value}).map(function(){return this.name}).toArray().concat(Object.entries(a.find("input[type\x3dradio], input[type\x3dcheckbox]").toArray().reduce(function(a,
c){a[c.name]|=!c.disabled&&c.checked;return a},{})).filter(function(a){return!a[1]}).map(function(a){return a[0]}),a.find("div.file-upload").filter(function(){var a=$(this);return 0<a.find("input[type\x3dfile]").length&&0==a.find('input[type\x3dhidden][name\x3d"'+a.data("name").replace(":","\\:").replace(/\|/g,"\\|")+'"]').length?!0:!1}).map(function(){return $(this).data("name")}).toArray(),a.find("select[multiple]").filter(function(){return 0==$(this).val().length}).map(function(){return this.name}).toArray())},
processresponse:function(a,b,c,d,e){if(confero.error.process(c)||b.forceAction)if(c&&c.values)if(b.action)if(b=b.action,"string"===typeof b&&(b=window[b]),"function"===typeof b)a?b.call(this,c,d,e):b.call(this,c.values);else{if(b.mode){b.pageaction||(b.pageaction={});var f=b.pageaction;f.data||(f.data={});$.each(c.values,function(a,b){f.data[a]=b});confero.post.action.call(this,b,null)}}else confero.linked.update([c.values]);else window.location.reload()},action:function(a,b,c){switch(a.mode){case "multiple":var d=
this;$.each(a.action,function(a,c){confero.post.action.call(d,c,b)});break;case "async":return confero.post.async.call(this,a);case "sync":confero.post.sync.call(this,a);break;case "callback":confero.post.callback.call(this,a);break;case "popup":confero.popup.window.call(this,a);break;case "popup-modal":confero.popup.modal.call(this,a);break;case "popup-reload":confero.popup.reload.call(this,a);break;case "page-include":confero.pageInclude.getAndInsert.call(this,a);break;case "helper":confero.helper.open.call(this);
break;case "helper-close":confero.helper.close.call(this);break;case "popup-close":confero.popup.close.call(this,b,null,a);break;case "selector":confero.table.selector.call(this,a);break;case "multiple-selector":confero.table.multipleSelector.call(this,a);break;case "text-preview":confero.textPreview.previewText(this);break;case "toggle":case "class-add":case "class-remove":var e=a.action,f=$(this);e&&e.split(";").forEach(function(b){for(var c=f;-1!=b.indexOf("/");)if(b.startsWith("../"))b=b.substring(3),
c=c.parent();else if(b.startsWith("*/"))b=b.substring(2),c=c.siblings().addBack();else if(b.startsWith("+")){b=b.substring(1);var d="";-1!=b.indexOf("/")&&(""!=b.substring(0,b.indexOf("/"))&&(d="."+b.substring(0,b.indexOf("/"))),b=b.substring(b.indexOf("/")+1));c=c.nextUntil(d)}else if(b.startsWith("."))b=b.substring(1),d="",-1!=b.indexOf("/")&&(d="."+b.substring(0,b.indexOf("/")),b=b.substring(b.indexOf("/")+1)),c=c.find(d);else break;"toggle"==a.mode?c.toggleClass(b):"class-add"==a.mode?c.addClass(b):
"class-remove"==a.mode&&c.removeClass(b)});break;case "set":$.each(a.action,function(a,b){confero.page.getElem(a).val(b)});break;case "search":confero.table.search.call(this,b);break;case "menu":a.pageaction={form:"navigation",validate:"skip",id:a.code,data:function(a){var b=a.data?a.data:{};b["doc-action"]=a.docAction;b.shallow=a.shallow;return b}(a),dynamic:a.pageaction?a.pageaction.dynamic:null};confero.post.sync.call(this,a);break;case "menu-collapse":confero.menu.toggleMenu.call(this);break;
case "client":a.pageaction={form:"client-switcher",validate:!1,id:a.code};confero.post.sync.call(this,a);break;case "user":a.pageaction={form:"user-switcher",validate:!1,id:$(this).val()};confero.post.sync.call(this,a);break;case "schedule":return confero.schedules.schedule.call(this,a.schedule,function(c){return confero.post.action.call(this,a.action,b,c)},function(c){if(a.cancel)return confero.post.action.call(this,a.cancel,b,c)});case "repeater-remove":confero.repeater.remove.call(this);break;
case "repeater-add":confero.repeater.add.call(this,a);break;case "reload":window.location.reload();break;case "exit":window.location.assign("logout");break;case "exitTimeout":window.location.assign("logout?type\x3dClosedByTimeout");break;case "link":window.open(a.action.link,"_blank");break;case "redirect":window.location.replace(a.action);break;case "redirect-raw":confero.post.redirect(a);break;case "print":window.print();break;case "clipboard-copy":confero.page.clipboardCopy(a.action);break;case "wizard":confero.wizard.buttonClick.call(this,
a);break;case "wizard-callback":confero.wizard.wizardCallback.call(this,a);break;case "copy-values":confero.copyPaste.copyValues.call(this);break;case "paste-values":confero.copyPaste.pasteValues.call(this);break;case "none":break;case "call":a.action&&(e=a.action,"function"!==typeof e&&(e=window[e]),"function"===typeof e&&e.call(this,a,b,c));break;default:return a.action.call(this,a,b,c)}},redirect:function(a){a=$(a.data);$("body").append(a)}},events:{init:function(){var a=$(document.documentElement);
a.on("click","*[data-mode]:not(:input)",confero.events.button.click);a.on("click","div.tabs[data-linked] span",confero.linked.process);a.on("change","select",confero.select2.change);a.on("select2:close","select",confero.select2.close);a.on("select2:open","select",confero.select2.open);a.on("touchend","span.select2-container",confero.select2.touchend);a.on("change","*[data-linked]",confero.linked.process);a.on("change","*[data-pageaction]",confero.events.input.change);a.on("change","input[type\x3d'file']",
confero.file.select);a.on("change",":input.trigger[data-mode]",confero.events.button.click);a.on("input",confero.error.elems,confero.error.input);a.on("input","textarea",confero.textarea.autoHeight);a.on("click","div.table div.head div span[data-sort]",confero.table.sort);a.on("click","div.table div.head div input[type\x3d'checkbox']",confero.events.table.head.click);a.on("click","div.table div.row",confero.events.table.row.click);a.on("click","div.table div.row a, body h1 span.buttons\x3espan\x3espan.items\x3ea",
confero.events.a.click);a.on("click","div.table div.row input[type\x3d'checkbox']+label",confero.events.table.row.check.click);a.on("change","div.table div.row input[type\x3d'checkbox']",confero.events.table.row.check.change);a.on("click","div.table div.row input[type\x3d'radio']+label",confero.events.table.row.radio.click);a.on("change","div.table div.row input[type\x3d'radio']",confero.events.table.row.radio.change);a.on("click","div.table div.paging span[data-page]",confero.table.paging);a.on("click",
"div.table div.psize span[data-size]",confero.table.psize);a.on("click","div.header div.search span.buttons span.close",confero.events.header.search.click);a.on("click","a.fetch",confero.file.download.fetch);a.on("click","a[href^\x3d'blob:']",confero.file.download.blob);a.on("click","div.file-upload div.file-list div span:first-of-type a+span",confero.file.remove);a.on("click","div.file-upload div.file-list div progress+span",confero.file.cancel);a.on("click focus mousedown touchend","input[type\x3d'text'].calendar:enabled+span",
confero.calendar.spanclick);a.on("click focus mousedown touchend","input[type\x3d'text'].calendar:enabled+span+i",confero.calendar.iclick);a.on("click focus mousedown touchend","input[type\x3d'text'].search:enabled+span+i",confero.popup.iclick);a.on("input keydown paste","input[type\x3d'text'].calendar",confero.calendar.input);a.on("click","input[type\x3d'text'].calendar+span+i+div.ranges",confero.calendar.rangesclick);a.on("click","fieldset.input-disabling+span",confero.inputDisabling.click);a.on("click",
"div.input-add-remove div.row\x3espan:last-of-type",confero.events.input.addremoveclick);a.on("click","div.popup div.modal div.header span, div.popup div.data div.header h3:not([class]) span, div.popup div.data div.header h3.buttons span.exit",confero.popup.close);a.on("click","div.wizard.form\x3espan",confero.wizard.titleClick);a.on("click","div.nace-selector.repeater input[id*\x3d'nace_is_main']",confero.naceFields.toggleIsMainNace);a.on("keypress","div.search",confero.table.search);a.on("change",
"div.search",confero.table.search);a.on("change","div.optgroup:has(fieldset)",confero.events.radio.change);a.on("transitionend",".removing",confero.page.transition.removing);a.on("click","header div.logo-small, header div.logo",confero.page.theme.change);a.on("select2:selecting","select[multiple]",confero.select2.handleSelectingMultiple);a.on("select2:select","select[multiple]",confero.select2.handleSelectMultiple);a.on("keyup",confero.events.body.keyup);a.on("keydown",confero.events.body.keydown);
a.on("click",confero.events.body.click)},button:{click:function(a){var b=$(this),c=b.data();c.buble||(a.stopPropagation(),a.preventDefault(),a.stopImmediatePropagation());(!b.is(".disabled")||b.is(".soft-disable")&&a.isTrigger)&&confero.post.action.call(this,c,a)}},a:{click:function(a){a.stopPropagation()}},radio:{init:function(a){a.find("div.optgroup:has(fieldset)").each(function(){confero.events.radio.change.call(this,{type:"load"})})},change:function(a,b){var c=$(this);if(c.data("name")){var d=
c.find("div:has(input[name\x3d"+c.data("name").replace(":","\\:").replace(/\|/g,"\\|")+"]:not(:checked))+fieldset").attr("disabled",!0).addClass("option-hide");"load"!=a.type&&d.find("input[type\x3d'text'], textarea").val("").trigger("input",b);d=c.find("div:has(input[name\x3d"+c.data("name").replace(":","\\:").replace(/\|/g,"\\|")+"]:checked)+fieldset").attr("disabled",!1).removeClass("option-hide");"load"!=a.type&&d.find("input[type\x3d'text'], textarea").trigger("input",b)}"load"==a.type?c.find("div.level-1").each(function(){var a=
$(this).find("input[type\x3d'checkbox']");confero.events.radio.levels(a)}):(a=$(a.target),confero.events.radio.levels(a))},levels:function(a){var b=a.parents("div.option");a.is(":checked")?("radio"===a.attr("type")&&b.siblings(".option.selected").removeClass("selected"),b.addClass("selected")):(b.removeClass("selected"),b.is(".level-1")&&b.siblings(".level-2").removeClass("selected").find("input[type\x3d'checkbox']").prop("checked",!1));b.is(".level-1")&&b.siblings(".level-2").find("input[type\x3d'checkbox']").prop("disabled",
!a.is(":checked"))}},table:{row:{click:function(a){a=$(this);if(a.data().mode)return!1;a.find("input[type\x3d'checkbox'], input[type\x3d'radio']").each(function(a){this.checked=!this.checked;$(this).trigger("change")})},check:{click:function(a){a=$(this).prev("input[type\x3d'checkbox']");a[0].checked=!a[0].checked;a.trigger("change");return!1},change:function(a){a=$(this).closest("div.table");a.children("div.buttons").attr("data-row-count",a.find("div.row input[type\x3d'checkbox']:checked").length)}},
radio:{click:function(a){a=$(this).prev("input[type\x3d'radio']");a[0].checked=!a[0].checked;a.trigger("change");return!1},change:function(a){a=$(this).closest("div.table");a.children("div.buttons").attr("data-row-count",a.find("div.row input[type\x3d'radio']:checked").length)}}},head:{click:function(a){a=$(this);var b=a.closest("div.table"),c=this.checked;b.find("input[type\x3d'checkbox'][name\x3d'"+a.data("name")+"']").each(function(a){this.checked=c}).first().trigger("change")}}},body:{keydown:function(a){var b=
a.key||a.keyCode;if(("Enter"===b||13===b)&&!$(a.target).is("textarea"))if(a.preventDefault(),b=$(a.target).parents("div.search"),1==b.length)confero.table.search.call(b[0],a);else{a=$("div.popup.ready");var c;0<a.length&&(c=a.last().find("span.button.primary:not(.hidden)"));if(void 0===c||0===c.length)c=$("article.edit\x3ediv:not(.hidden):not(.error) span.button.primary:not(.hidden), article.edit\x3efieldset span.button.primary:not(.hidden)");0<c.length&&(document.activeElement.blur(),c.first().trigger("click"))}},
keyup:function(a){var b=a.key||a.keyCode;if("Escape"===b||"Esc"===b||27===b)a.preventDefault(),confero.popup.close()},click:function(a){$("body").removeClass("client-active");$("#pb_contacts").removeClass("active");$("body div.header span.buttons\x3espan.show").removeClass("show");$("body .auto-hide.show").removeClass("show");$("body .auto-hide.active").removeClass("active")}},header:{search:{click:function(a){0<$(this).parents("div.popup").length?confero.popup.close():confero.post.sync.call(this,
{pageaction:{validate:!1,id:"b_close",data:{}}})}}},input:{change:function(a){var b=$(this).data();b.mode||(b.mode="callback");confero.post.action.call(this,b,a)},addremoveclick:function(a){a=$(this);var b=a.closest(".input-add-remove");if(!a.siblings().attr("disabled")&&(b.toggleClass("expand"),!b.hasClass("expand")&&(b=a.closest(".row"),b.find(":input").val("").trigger("input").filter("select").trigger("change"),b.is(":first-of-type")&&(a=b.find(":input"),b=b.next().find(":input"),b.length==a.length)))){for(var c=
0;c<b.length;++c)$(a[c]).val($(b[c]).val()).trigger("input").filter("select").trigger("change");b.val("").trigger("input").filter("select").trigger("change")}}}},error:{elems:"input[type\x3dtext], input[type\x3dpassword], input[type\x3dsearch], input[type\x3dhidden], input[type\x3dradio], input[type\x3dcheckbox], textarea, select",init:function(a){a.find("*[data-error-text]").each(function(){$.extend(confero.classifiers.cl_error,$(this).data("errorText"))});a.find("div.error[data-error]").each(function(){confero.error.process({errors:$(this).data("error")})})},
render:function(a,b){if(b){this.addClass&&this.addClass("er");setTimeout(function(a){a.addClass("invalid")},1,a);var c=a.next("dl.error");c.length||(c=$('\x3cdl class\x3d"error"\x3e\x3cdd\x3e\x3cspan\x3e\x3c/span\x3e\x3c/dd\x3e\x3c/dl\x3e'),a.after(c));a=c.find("dd span");a.text(confero.classifiers.text("cl_error",b.code,b.params));b.type&&"error"!=b.type&&a.addClass(b.type)}},remove:function(a){a.removeClass("invalid");a=a.next("dl.error");a.length&&a.addClass("removing")},clean:function(a){a||(a=
$("div.error"));a.children("div").addClass("removing")},process:function(a){if(a&&a.errors){a.errors.text&&$.each(a.errors.text,function(a,b){confero.classifiers.cl_error[a]=b});var b=confero.page.getElem(a.errors.id?a.errors.id:"error");a.errors.value&&a.errors.value.length&&(confero.error.clean(b),$.each(a.errors.value,function(a,d){a=d.field?confero.page.getElem(d.field):null;var c=d.type?d.type:"error";a&&a.length?(c=a.closest("dl"),c.length?confero.error.render.call(a,c,d):a.text(confero.classifiers.text("cl_error",
d.code,d.params))):(0==b.find("div."+c+":not([class*\x3d'removing'])").length&&b.append($("\x3cdiv\x3e\x3c/div\x3e").addClass(c)),b.find("div."+c+":not([class*\x3d'removing'])").addClass("adding").append($("\x3cdiv\x3e\x3c/div\x3e").text(confero.classifiers.text("cl_error",d.code,d.params))))}),setTimeout(function(a){a.find("div.adding").removeClass("adding")},1,b))}return!confero.error.hasError(a)},input:function(a,b){if(!b||"linked-load"!=b.type)if(a=$(this),b=a.closest("dl"),a.is(".number")&&this.validity.patternMismatch&&
(this.value=this.value.replace(/,/g,".")),this.validity&&this.validity.patternMismatch){var c={code:"1006"};a.data("patternErrorCode")&&(c.code=a.data("patternErrorCode"));confero.error.render.call(a,b,c)}else a.data("checkValidity")&&a.data("checkValidity").call(this)?confero.error.render.call(a,b,{code:a.data("checkValidity").call(this)}):(a.removeClass("er"),confero.error.remove(b))},validate:function(a){$("fieldset\x3edl").each(function(){var b=$(this);b.find(":input, div.formated-text.input").filter(function(){return $(this).closest("dl").is(b)&&
($(this).is(":invalid")||$(this).data("checkValidity")&&$(this).data("checkValidity").call(this))}).each(function(){var c=$(this),d={code:"1006"};c.data("checkValidity")&&c.data("checkValidity").call(this)?d.code=c.data("checkValidity").call(this):this.validity.tooShort||this.validity.tooLong?(d.code=this.minLength==this.maxLength?"1005":0==this.minLength?"1019":"1004",d.params=[this.minLength,this.maxLength]):this.validity.valueMissing?"non-strict"==a?d=null:d.code="1003":this.validity.patternMismatch&&
c.data("patternErrorCode")&&(d.code=c.data("patternErrorCode"));confero.error.render.call(c,b,d)})})},ajax:function(a,b,c,d){b={};a.readyState&&(b={errors:{id:$("div.error").attr("id"),value:[{code:2E3+a.status}]}},"timeout"==c&&(b.errors.value[0].code=2408));confero.error.process(b);d&&d.error&&d.error(b)},hasError:function(a){if(a&&a.errors&&a.errors.value&&a.errors.value.length)for(var b=0;b<a.errors.value.length;++b){var c=a.errors.value[b],c=c.type?c.type:"error";if("error"===c||"fatalerror"===
c)return!0}return!1}},textarea:{init:function(a){a.find("textarea").each(function(){confero.textarea.autoHeight.call(this);$(this).hasClass("code-mirror")&&confero.textarea.codeMirror(this)})},autoHeight:function(){var a=$(this);a.is(":disabled")||a.css({height:"auto"});a.css({height:this.scrollHeight+"px"})},codeMirror:function(a){try{CodeMirror.fromTextArea(a,{lineNumbers:!0,mode:"javascript",extraKeys:{"Shift-Ctrl-F":function(a){a.autoFormatRange({line:0,ch:0},{line:a.lastLine()})}}}).on("change",
function(b){a.value=b.getValue()})}catch(b){}}},select2:{init:function(a){a.find("select").each(function(){var a=$(this),c=a.data("locale"),d={minimumResultsForSearch:5,theme:"confero",width:"style",matcher:confero.select2.matcher,language:{noResults:function(){return c.noResults}}};a.hasClass("dropdown-no-close")&&(d.closeOnSelect=!1);a.hasClass("select-all-option")&&(d.sorter=confero.select2.addSelectAll);a.hasClass("account")&&(d.templateResult=confero.select2.accountFormatter,d.templateSelection=
confero.select2.accountFormatter);a.hasClass("auth-types")&&(d.templateResult=confero.select2.authTypesFormatter,d.templateSelection=confero.select2.authTypesFormatter);a.hasClass("wallet")&&(d.templateResult=confero.select2.walletFormatter,d.templateSelection=confero.select2.walletFormatter);a.hasClass("client-account")&&(d.templateResult=confero.select2.accountFormatter,d.templateSelection=confero.select2.clientAccountFormatter);a.data("templateResult")&&a.data("templateResult",confero.select2[a.data("templateResult")]);
a.data("templateSelection")&&a.data("templateSelection",confero.select2[a.data("templateSelection")]);a.data("listData")&&(d.ajax={data:function(){return confero.select2.data[a.data("listData")]},transport:function(a,b){b(a.data)},processResults:function(a,b){var c=[],d=this;$.each(a,function(){var a=d.matches(b,{$select:d.$element,optdata:this});null!==a&&c.push(a.optdata)});return{results:c}}});a.data("matcher")&&a.data("matcher",window[a.data("matcher")]);a.attr("placeholder")&&(d.placeholder=
a.attr("placeholder"));d=a.select2(d);a.attr("value")&&(d=d.val(a.attr("value")));d.trigger("change.select2")})},destroy:function(a){a.find("select").select2("destroy")},data:{},getClassifierValue:function(a,b){var c;$.each(confero.select2.data[a],function(a,e){if(e.id==b)return c=e.text,!1});return c},addSelectAll:function(a){var b=$(a[0].element).parent().data("select-all-label");a.unshift({id:"selectAll",text:b,matchIds:a.map(function(a){return a.id})});return a},handleSelectMultiple:function(a){"selectAll"===
a.params.data.id&&$(a.currentTarget).val(a.params.data.matchIds).trigger("change").select2("close");$(".select2-results__options").scrollTop($(a.currentTarget).data("scrolltop"))},handleSelectingMultiple:function(a){$(a.currentTarget).data("scrolltop",$(".select2-results__options").scrollTop())},accountFormatter:function(a){if(!a.id)return a.text;var b=$(a.element),c=b.parents("select"),d=b.data();return d.linked?(a='\x3cspan class\x3d"account"\x3e',a=c.hasClass("mono-cur")?a+("\x3cb\x3e"+b.val().substring(0,
b.val().length-3)+"\x3c/b\x3e"):a+("\x3cb\x3e"+b.val()+"\x3c/b\x3e"),d.linked&&(a=d.linked.type?a+("\x3cu\x3e\x26#x"+d.linked.type+";\x3c/u\x3e"):a+"\x3cu\x3e\x26#xf0d6;\x3c/u\x3e",(b=b.parent().data("currency"))&&d.linked.currencies&&d.linked.currencies[b]?a+="\x3ci\x3e"+d.linked.currencies[b]+" "+b+"\x3c/i\x3e":d.linked.balance&&(a+="\x3ci\x3e"+d.linked.balance+"\x3c/i\x3e",c.hasClass("balance-cur")&&d.linked.cur&&(a+="\x3ci\x3e\x26#160;"+d.linked.cur+"\x3c/i\x3e")),d.linked.desc&&(a+="\x3cp\x3e"+
d.linked.desc+"\x3c/p\x3e"),a+="\x3c/span\x3e"),$(a)):a.text},walletFormatter:function(a){if(!a.id)return a.text;var b=$(a.element),c=b.data(),d=b.parent().data("currency");return c.linked?(a='\x3cspan class\x3d"account"\x3e\x3cb\x3e'+b.val()+"\x3c/b\x3e",a=c.linked&&c.linked.type?a+("\x3cu\x3e\x26#x"+c.linked.type+";\x3c/u\x3e"):a+"\x3cu\x3e\x26#xf0d6;\x3c/u\x3e",d&&c.linked&&c.linked.currencies&&c.linked.currencies[d]&&(a+="\x3ci\x3e"+c.linked.currencies[d]+" "+d+"\x3c/i\x3e"),c.linked&&c.linked.desc&&
(a+="\x3cp\x3e"+c.linked.desc+"\x3c/p\x3e"),$(a+"\x3c/span\x3e")):a.text},clientAccountFormatter:function(a){if(!a.id)return $('\x3cspan class\x3d"client"\x3e'+a.text+"\x3c/span\x3e");var b=$(a.element),c=b.parents("select"),d='\x3cspan class\x3d"client"\x3e',e=b.data(),f=c.data("currency");return e.linked?(d=c.hasClass("mono-cur")?d+("\x3cb\x3e"+b.val().substring(0,b.val().length-3)+"\x3c/b\x3e"):d+("\x3cb\x3e"+b.val()+"\x3c/b\x3e"),d=e.linked.type?d+("\x3cu\x3e\x26#x"+e.linked.type+";\x3c/u\x3e"):
d+"\x3cu\x3e\x26#xf0d6;\x3c/u\x3e",f&&e.linked.currencies&&e.linked.currencies[f]?d+="\x3ci\x3e"+e.linked.currencies[f]+" "+f+"\x3c/i\x3e":e.linked.balance&&(d+="\x3ci\x3e"+e.linked.balance+"\x3c/i\x3e",e.linked.cur&&(d+="\x3ci\x3e"+e.linked.cur+"\x3c/i\x3e")),$(d+"\x3c/span\x3e")):a.text},portfolioFormatter:function(a){return a.id?$(a.element).data().linked?a.text:$('\x3cspan class\x3d"portfolio"\x3e\x3cb\x3e'+a.text+"\x3c/b\x3e\x3c/span\x3e"):a.text},authTypesFormatter:function(a){if(!a.id)return a.text;
a=$(a.element);var b=a.data(),c;c='\x3cspan class\x3d"auth-types"\x3e'+("\x3cb\x3e"+a.text()+"\x3c/b\x3e");b.linked&&(c="A"===b.linked.type?c+("\x3ci\x3e"+a.val()+"\x3c/i\x3e"):c+"\x3ci\x3e\x3c/i\x3e",b.linked.type_text&&(c+="\x3cp\x3e"+b.linked.type_text+"\x3c/p\x3e"));return $(c+"\x3c/span\x3e")},phoneNumberFormatter:function(a){return a.id?a.id.substring(a.id.indexOf("$")+1):a.text},matcher:function(a,b){if(b.children){var c=[];$.each(b.children,function(b,d){confero.select2.matcher(a,d)&&c.push(d)});
return c.length?(b=$.extend({},b,!0),b.children=c,b):null}if(b.element){var d=$(b.element),e=d.closest("select"),f=e.data().filter;(f=d.data("linked"))||(f={});f.value||(f.value=d.val());f.text||(f.text=d.text());return confero.select2.matcher(a,{$select:e,optdata:f})?b:null}f=b.$select.data("filter");(d=b.$select.data("searchFields"))||(d=["text"]);if(a&&a.term){for(var e=!1,g=0;g<d.length;++g){var k=d[g],l=null;"text"==k?l=b.optdata.text:0==k.indexOf("linked")&&(l=b.optdata[k.substring(7)]);l||
(l="");l=String(l).toLocaleLowerCase();if(0==l.indexOf(a.term.toLowerCase())){e=!0;break}}if(!e)return null}return confero.select2.match(f,b.optdata)?b:null},match:function(a,b){if(a){if(a.k){var c=b[a.k],d=a.v;if(void 0===c||null===c||void 0===d||null===d)return!0;c=Array.isArray(c)?c:[c];d=Array.isArray(d)?d:[d];return 0<c.filter(function(a){return-1!==d.indexOf(a)}).length}if(a.v1)switch(c=confero.select2.match(a.v1,b),d=confero.select2.match(a.v2,b),a.o){case "\x26":return c&&d;case "|":return c||
d;case "!":return!c}}else return!0},change:function(a){$(this).trigger("input")},close:function(a){a=window.event.key||window.event.keyCode;if("Enter"===a||13===a)window.event.stopPropagation(),window.event.preventDefault(),window.event.stopImmediatePropagation()},open:function(a){a=window.event.key||window.event.keyCode;if("Enter"===a||13===a)window.event.stopPropagation(),window.event.preventDefault(),window.event.stopImmediatePropagation()},touchend:function(a){a.stopPropagation()}},calendar:{config:{options:{showDropdowns:!0,
autoApply:!0,autoUpdateInput:!1,showCustomRangeLabel:!1,alwaysShowCalendars:!0,linkedCalendars:!1,parentEl:"form",template:'\x3cdiv class\x3d"daterangepicker"\x3e\x3cdiv class\x3d"flow"\x3e\x3cdiv class\x3d"head"\x3e\x3cspan\x3e\x3c/span\x3e\x3c/div\x3e\x3cdiv class\x3d"body"\x3e\x3cdiv class\x3d"drp-calendar left"\x3e\x3cdiv class\x3d"calendar-table"\x3e\x3c/div\x3e\x3cdiv class\x3d"calendar-time"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"drp-calendar right"\x3e\x3cdiv class\x3d"calendar-table"\x3e\x3c/div\x3e\x3cdiv class\x3d"calendar-time"\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"ranges"\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e'},
locale:{format:"DD.MM.YYYY",separator:" - ",firstDay:1},ranges:function(){if(!confero.calendar.config._ranges){var a=$(document.body);a.data("config")&&a.data("config").calendarRanges?(confero.calendar.config._ranges=[],$.each(a.data("config").calendarRanges,function(a,c){confero.calendar.config._ranges[a]=[moment().relativeTime(c[0]),moment().relativeTime(c[1])]})):confero.calendar.config._ranges=[[moment(),moment()],[moment().startOf("isoWeek"),moment()],[moment().startOf("month"),moment()],[moment().subtract(1,
"days"),moment().subtract(1,"days")],[moment().subtract(1,"week").startOf("isoWeek"),moment().subtract(1,"week").endOf("isoWeek")],[moment().subtract(1,"month").startOf("month"),moment()]]}return confero.calendar.config._ranges},_ranges:null},configTime:{options:{template:'\x3cdiv class\x3d"daterangepicker"\x3e\x3cdiv class\x3d"flow"\x3e\x3cdiv class\x3d"head"\x3e\x3cspan\x3e\x3c/span\x3e\x3c/div\x3e\x3cdiv class\x3d"body"\x3e\x3cdiv class\x3d"drp-calendar left"\x3e\x3cdiv class\x3d"calendar-table"\x3e\x3c/div\x3e\x3cdiv class\x3d"calendar-time"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"drp-calendar right"\x3e\x3cdiv class\x3d"calendar-table"\x3e\x3c/div\x3e\x3cdiv class\x3d"calendar-time"\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"ranges"\x3e\x3c/div\x3e\x3cdiv class\x3d"drp-buttons"\x3e\x3cbutton class\x3d"button cancelBtn" type\x3d"button"\x3e\x3c/button\x3e\x3cbutton class\x3d"button primary applyBtn" disabled\x3d"disabled" type\x3d"button"\x3e\x3c/button\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e'},
locale:{format:"DD.MM.YYYY HH:mm"}},init:function(a){a.find("input.calendar").each(function(){var a=$(this),c=a.data("locale"),d={},e=a.data("time-picker");$.each(c.rangesNames,function(a,b){d[b]=confero.calendar.config.ranges()[a]});$.extend(!0,c,e?confero.calendar.configTime.locale:confero.calendar.config.locale);a.data("locale",c);a.data("ranges",d);(c=a.data("minDate"))&&(moment().isRelativeTimeFormat(c)?a.data("minDate",moment().relativeTime(c)):a.data("minDate",moment(c)));(c=a.data("maxDate"))&&
(moment().isRelativeTimeFormat(c)?a.data("maxDate",moment().relativeTime(c)):a.data("maxDate",moment(c)));e=e?$.extend(confero.calendar.config.options,confero.calendar.configTime.options):confero.calendar.config.options;a.daterangepicker(e,confero.calendar.updateElement).each(function(){var a=$(this).data("daterangepicker");a.container.find(".head").on("click.daterangepicker","span",$.proxy(a.clickCancel,a))})}).filter("[data-render-spans]").each(function(){var a=$(this).data("daterangepicker");a.element.next("span").next("i").after(a.container.find(".ranges"))})},
updateElement:function(a,b,c){a=this.startDate.format(this.locale.format);this.singleDatePicker||(a+=this.locale.separator+this.endDate.format(this.locale.format));a!==this.element.val()&&this.element.val(a).trigger("change");confero.error.remove(this.element.closest("dl"))},spanclick:function(a){a.stopPropagation();a.preventDefault();a.stopImmediatePropagation();$(this).prev("input[type\x3d'text'].calendar").trigger("click")},iclick:function(a){a.stopPropagation();a.preventDefault();a.stopImmediatePropagation();
$(this).prev("span").prev("input[type\x3d'text'].calendar").val("").trigger("change")},rangesclick:function(a){confero.calendar.updateElement.apply($(this).prev("i").prev("span").prev("input.calendar").data("daterangepicker"))},input:function(a){a.stopPropagation();a.preventDefault();a.stopImmediatePropagation()}},linked:{init:function(a){a.find("select[data-linked], div.optgroup[data-linked], div.tabs[data-linked] span.selected, input[data-linked]").each(function(){confero.linked.process.call(this,
{type:"load"})})},process:function(a,b){var c=$(this),d=c.val();c.is("div")&&c.hasClass("optgroup")&&(d=$("input[name\x3d"+c.data("name").replace(":","\\:").replace(/\|/g,"\\|")+"]:checked").map(function(){return this.value}).toArray());c.is("span")&&(d=c.data("value"),c=c.parent());c.is("input[type\x3dcheckbox]:not(:checked)")&&(d="0");d||(d="");c=c.data("linked");d=confero.linked.getValue(c,d);d=confero.linked.getAction(d,a.type);confero.linked.update(d,a,b)},getValue:function(a,b){if(!a)return null;
var c=[];b=Array.isArray(b)?b:[b];if(Array.isArray(a)){0==b.length&&(b=[""]);var d=null;$.each(a,function(a,f){f["default"]&&(d=f.value);(f.id||""===f.id)&&confero.linked.findOne(b,"string"==typeof f.id?[f.id]:f.id)&&c.push(f.value);if(f.nid||""===f.nid)confero.linked.findOne(b,"string"==typeof f.nid?[f.nid]:f.nid)||c.push(f.value);f.range&&f.range[0]<=b[0]&&b[0]<=f.range[1]&&c.push(f.value)});0==c.length&&(c=[d])}else 0==b.length&&(b=[""]),$.each(b,function(b,d){c.push(a[d])});return c},findOne:function(a,
b){return b.some(function(b){return 0<=a.indexOf(b)})},getAction:function(a,b){if(!a)return null;var c=[];$.each(a,function(a,e){Array.isArray(e)?$.each(e,function(a,d){d.type&&0<=("string"==typeof d.type?[d.type]:d.type).indexOf(b)&&c.push(d.value)}):e&&c.push(e[b])});return c},update:function(a,b,c){var d=b&&"load"==b.type||c&&"linked-load"==c.type?{type:"linked-load"}:{type:"linked"};$.each(a,function(a,b){$.each(b,function(a,b){var c=null,e=null,f=null,g=null,k=null,r=null,t=null,m=!0,p=null,
u=null;Array.isArray(b)&&(b={value:b});b&&"string"!=typeof b&&"number"!=typeof b&&(c=b.attributes,e=b.data,f=b["deep-data"],g=b.addclass,k=b.delclass,r=b.disabled,t=b.checked,m=!1===b.events?!1:!0,p=b.actions,u=b.required,b=b.value,"string"==typeof g&&(g=[g]),"string"==typeof k&&(k=[k]),"string"==typeof p&&(p=[p]));var h=confero.page.getElem(a);$.each(c,function(a,b){h.attr(a,b);h.prop(a,b)});$.each(e,function(a,b){h.data(a,b)});$.each(f,function(a,b){var c=h.data(a);c||(c={});b=$.extend(!1,c,b);
h.data(a,b)});$.each(g,function(a,b){h.addClass(b)});$.each(k,function(a,b){h.removeClass(b)});$.each(p,function(a,b){"close-popup"==b?confero.popup.close(null,h):"refresh-list"==b?confero.table.load(h):"call"==b?confero.post.action.call(h,e):"helper"==b?confero.helper.open.call(h):"helper-close"==b?confero.helper.close.call(h):"empty-files-list"==b&&confero.file.clear(h.find(".file-upload"))});void 0!==u&&confero.page.required(h,u);!0===r&&(h.is("div, fieldset, dd, dl ")?(h.find(confero.error.elems).not("input[type\x3dradio], input[type\x3dcheckbox]").each(function(){var a=
$(this),b=a.val();a.prop("disabled",!0);h.hasClass("disabled-no-clean")||a.val("");a.is("select")&&""!==b&&!h.hasClass("disabled-no-clean")&&a.trigger("change",d)}),h.hasClass("disabled-no-clean")?h.find("input[type\x3dradio], input[type\x3dcheckbox]").prop({disabled:!0}).trigger("change",d):(h.find("input[type\x3dradio], input[type\x3dcheckbox]").prop({checked:!1,disabled:!0}).trigger("change",d),confero.repeater.clear(h)),confero.error.remove(h.find(confero.error.elems).closest("dl"))):h.is("input[type\x3dfile]")?
(h=h.parents("div.file-upload"),h.attr("data-disabled",!0),confero.file.clear(h)):(h.prop("disabled",!0).val(""),confero.error.remove(h.closest("dl"))));!1===r&&(h.is("div, fieldset, dd, dl")?(h.find(confero.error.elems).not("input[type\x3dradio], input[type\x3dcheckbox]").prop("disabled",!1),h.find("input[type\x3dradio], input[type\x3dcheckbox]").prop("disabled",!1),!1!==m&&h.find("input[type\x3dradio], input[type\x3dcheckbox]").trigger("change",d),"linked-load"!=d.type&&confero.error.remove(h.find(confero.error.elems).closest("dl"))):
(h.is("input[type\x3dfile]")?(h=h.parents("div.file-upload"),h.attr("data-disabled",null)):h.prop("disabled",!1),"linked-load"!=d.type&&confero.error.remove(h.closest("dl"))));!0===t&&(h.is("div, fieldset, dd, dl")?h.find("input[type\x3dradio], input[type\x3dcheckbox]").prop("checked",!0).trigger("change",d):h.prop("checked",!0));!1===t&&(h.is("div, fieldset, dd, dl")?h.find("input[type\x3dradio], input[type\x3dcheckbox]").prop("checked",!1).trigger("change",d):h.prop("checked",!1));if(h.data("filter")){var x=
h.data("filter");h.filter("div.optgroup").each(function(){var b=$(this),c='div.option input[name\x3d"'+a.replace(":","\\:").replace(/\|/g,"\\|")+'"]';b.find(c+"[type\x3dradio], "+c+"[type\x3dcheckbox]").each(function(a){a=$(this).data("linked");confero.select2.match(x,a)?($(this).prop("disabled",!1),$(this).parents("div.option").removeClass("hidden")):($(this).prop("disabled",!0),$(this).parents("div.option").addClass("hidden"))})}).end()}void 0!==b&&(c=h.filter("div, span, label").not("div.optgroup").html(b).end().end().filter("progress").attr("value",
b).end().not("div, span, label"),null!=b?c.val(b):c.filter("select").each(function(){var a=null,b=$(this);b.data("select2")&&b.data("select2").dataAdapter.query({},function(b){a=[];$.each(b,function(b,c){c.children?a=a.concat(c.children):a.push(c)})});if(a&&a.results){var c=b.val();if(1==a.results.length)b.val(a.results[0].id);else{for(var d=!1,e=0;e<a.results.length;++e)if(a.results[e].id==c){d=!0;break}d||b.val("")}}}).end(),m&&c.trigger("input",d),m&&c.filter("input[data-linked]").trigger("change",
d).end(),m?c.filter("select").trigger("change",d).end():c.filter("select").trigger("change.select2",d).end(),h.filter("div.optgroup").each(function(){var c=$(this),e='div.option input[name\x3d"'+a.replace(":","\\:").replace(/\|/g,"\\|")+'"]',f=c.find(e+"[type\x3dradio], "+e+"[type\x3dcheckbox]").prop("checked",!1);m&&f.trigger("change",d);"string"==typeof b&&(b=[b]);$.each(b,function(a,b){a=c.find(e+'[value\x3d"'+b+'"]').prop("checked",!0);m&&a.trigger("change",d)})}).end())})})}},popup:{window:function(a){var b=
$('\x3cdiv class\x3d"popup a"\x3e\x3c/div\x3e');b.data("retValueMatrix",a.retValueMatrix);b.attr("id","popup:"+a.action);$("body").addClass("popup").append(b);setTimeout(function(a){a.removeClass("a")},10,b);$.ajax({type:"POST",url:"popup",data:{__pageName:a.action,__CSRF:$("#__CSRF").val(),__Action:confero.post.pageaction(a)},xhrFields:{responseType:"document"},headers:{"Confero-Callback":"popup"},dataType:"document",converters:{"* document":!0},timeout:9E4}).done(function(a,d,e){a&&a.body&&(a=$(document.importNode(a.body,
!0)),confero.spinner.hide(b),b.html($("\x3cdiv\x3e\x3c/div\x3e").append(a.children()).addClass("data")),a=$("form").first(),b.find("form").first().prepend($('\x3cinput type\x3d"hidden" name\x3d"__Action" id\x3d"__Action"\x3e\x3cinput type\x3d"hidden" name\x3d"__Metadata" id\x3d"__Metadata"\x3e\x3cinput type\x3d"hidden" name\x3d"__CSRF" id\x3d"__CSRF"\x3e')),b.find("#__CSRF").val(a.find("#__CSRF").val()),b.find("#__Action").val(a.find("#__Action").val()),confero.page.init(b))}).fail(function(a,b,e){confero.error.ajax(a,
b,e)}).always(function(a,b,e){confero.schedules.sessionTillTime.init(a,b,e)})},close:function(a,b,c){a=b?b:$(".popup");2>=$(".popup").length&&$("body").removeClass("popup");a=a.last();a.addClass("a");confero.page.finalize(a);c&&c.data&&c.data.force?a.remove():setTimeout(function(a){a.remove()},500,a)},reload:function(a){confero.popup.close();confero.popup.window(a)},modal:function(a){var b=$("form").last(),c=$('\x3cdiv class\x3d"popup a"\x3e\x3cdiv class\x3d"modal"\x3e\x3cform method\x3d"post"\x3e\x3cinput type\x3d"hidden" name\x3d"__Action" id\x3d"__Action"\x3e\x3cinput type\x3d"hidden" name\x3d"__Metadata" id\x3d"__Metadata"\x3e\x3cinput type\x3d"hidden" name\x3d"__CSRF" id\x3d"__CSRF"\x3e\x3cdiv class\x3d"header"\x3e\x3cspan\x3e\x3c/span\x3e\x3ch3\x3e\x3c/h3\x3e\x3c/div\x3e\x3cdiv class\x3d"body article"\x3e\x3c/div\x3e\x3c/form\x3e\x3c/div\x3e\x3c/div\x3e');
c.attr("id","popup:modal");c.find("form")[0].action=b[0].action;c.find("#__CSRF").val(b.find("#__CSRF").val());a.config&&(c.find("h3").html(a.config.title),a.config.errorsId&&c.find("div.header").append($('\x3cdiv class\x3d"error" data-error\x3d"{}"\x3e\x3c/div\x3e').attr("id",a.config.errorsId)),a.config.message&&c.find("div.body").html(a.config.message),confero.popup.renderEdit(c.find("div.body"),a.config.edit),confero.popup.renderButtons(c.find("div.body"),a.config.buttons),a.config.id&&c.attr("id",
a.config.id),a.config.cssClass&&c.addClass(a.config.cssClass),a.config.closePopup&&c.data("closePopup",a.config.closePopup));$("body").addClass("popup").append(c);setTimeout(function(a){a.removeClass("a")},10,c)},renderButtons:function(a,b){if(b){for(var c=$('\x3carticle class\x3d"list"\x3e\x3cdl\x3e\x3cdd\x3e\x3c/dd\x3e\x3c/dl\x3e\x3c/article\x3e'),d=0;d<b.length;++d){var e=b[d],f=$('\x3cspan class\x3d"button" data-mode\x3e\x3cspan\x3e\x3c/span\x3e\x3c/span\x3e');f.find("span").html(e.label);e.classes&&
f.addClass(e.classes);f.data(e.action);c.find("dd").append(f)}a.append(c)}},renderEdit:function(a,b){if(b){var c=$('\x3carticle class\x3d"edit"\x3e\x3c/article\x3e');if(b.fields)for(var d=0;d<b.fields.length;++d){var e=b.fields[d],f=b.form+":"+e.id,g=$('\x3cfieldset\x3e\x3cdl id\x3d"'+f+'"\x3e\x3c/dl\x3e\x3c/fieldset\x3e');!1!==e.label&&g.find("dl").append('\x3cdt\x3e\x3clabel for\x3d"'+f+'"\x3e\x3c/label\x3e\x3c/dt\x3e');g.find("dl").append("\x3cdd\x3e\x3c/dd\x3e");var k=b.values?b.values[e.id]:
null;if(e.value)try{k="function"===typeof e.value?e.value(b.values):e.value}catch(l){}"label"==e.type?(g.find("dd").append('\x3cspan id\x3d"'+f+'" /\x3e'),g.find("span").text(k)):"description"==e.type?g.find("dd").append('\x3clabel id\x3d"'+f+'" /\x3e'):"recaptcha"==e.type?(k||(k="dummy"),g.find("dd").append($('\x3cdiv class\x3d"g-recaptcha"\x3e\x3c/div\x3e').attr("data-sitekey",k))):(g.find("dd").append('\x3cinput id\x3d"'+f+'" name\x3d"'+f+'" type\x3d"text" inputmode\x3d"text"/\x3e'),g.find("input").val(k));
g.find("label").text(confero.translations.get(e.id));e.classes&&g.addClass(e.classes);c.append(g)}a.append(c)}},iclick:function(a){a.stopPropagation();a.preventDefault();a.stopImmediatePropagation();a=$(this);a.prev("span").prev("input[type\x3d'text'].search").val("").prev("input[type\x3d'hidden']").val("").trigger("change");a.parent().is("div.row")&&(a.parent().nextAll("div.hint").html(""),a.parent().nextAll("input[type\x3d'hidden']").val(""),a=a.siblings("input[type\x3d'hidden']").attr("id"),a=
a.substring(a.indexOf(":")+1,a.length),a=$(".clear_"+a),0<a.length&&a.val("").trigger("change"))}},pageInclude:{getAndInsert:function(a){a.includeinto&&$.ajax({type:"POST",url:"popup",data:{__pageName:a.action,__CSRF:$("#__CSRF").val(),__Action:confero.post.pageaction(a)},xhrFields:{responseType:"document"},headers:{"Confero-Callback":"popup"},dataType:"document",converters:{"* document":!0},timeout:9E4}).done(function(b,c,d){b=$(document.importNode(b.body,!0));c=confero.page.getElem(a.includeinto);
$.extend(c.closest("form").data("hidden"),b.children("form").data("hidden"));c.append(b.children("form").html());confero.page.init(c)}).fail(function(a,c,d){confero.error.ajax(a,c,d)}).always(function(a,c,d){confero.schedules.sessionTillTime.init(a,c,d)})}},helper:{open:function(){var a=$(this).find(".helper-content");a.addClass("animate");setTimeout(function(a){a.removeClass("hidden").closest(".helper-wrapper").addClass("open")},0,a)},close:function(){var a=$(this),b=a.closest(".helper-content");
b||(b=a.children(".helper-content"));b.addClass("hidden");setTimeout(function(a){a.removeClass("animate").closest(".helper-wrapper").removeClass("open")},300,b)}},textPreview:{previewText:function(a){a=$(a);var b=a.siblings("textarea");a=a.siblings(".formated-text");a.data("unformatted-text",b.val());b.hasClass("hidden")||a.html(confero.formatedText.getFormattedText(a.data("unformatted-text").toString()));b.toggleClass("hidden");a.toggleClass("hidden")},closePreviewText:function(a){a=$(a);var b=a.siblings("textarea");
a=a.siblings(".formated-text");b.removeClass("hidden");a.addClass("hidden")}},table:{init:function(a){a.find("div.table").add(a).filter("div.table").each(function(){var a=$(this),c=a.data("state");if("on-load"==c.autofill)confero.table.load(a);else if("pre-fill"==c.autofill){var d=a.data("prefilldata");confero.table.fill(a,{values:{list:d,state:c}})}else"empty"==c.autofill?a.addClass("empty"):"schedule"==c.autofill&&confero.table.load(a)})},finalize:function(a){},load:function(a){if(1==a.length){a.removeClass("empty");
var b=a.data("state");if("async"==b.loadmode)a.hasClass("no-animation")||(a.children("div.body").html(""),confero.spinner.show(a.children("div.body"),{hideContent:!0})),$.ajax({type:"POST",url:"get_table_data",headers:{"Confero-Callback":"true"},data:JSON.stringify({__CSRF:$("#__CSRF").val(),state:b,id:a[0].id}),contentType:"application/json; charset\x3dutf-8",timeout:9E4}).done(function(b,c,d){confero.error.process(b);confero.table.fill(a,b)}).fail(function(b,c,d){confero.table.error(a);confero.error.ajax(b,
c,d)}).always(function(a,b,c){confero.schedules.sessionTillTime.init(a,b,c)});else if("sync"==b.loadmode){var c=$('\x3cform method\x3d"POST"\x3e'),d=a.closest("form").find("div.search");d.data("spintarget")?confero.spinner.show(confero.page.getElem(d.data("spintarget"))):confero.spinner.show(d);confero.spinner.show(a.children("div.body"),{hideContent:!0});c.attr("action",document.forms[0].action);c.append($("\x3cinput type\x3d'hidden' name\x3d'__CSRF'\x3e").val($("#__CSRF").val()));c.append($("\x3cinput type\x3d'hidden' name\x3d'__Action'\x3e").val(JSON.stringify({id:a[0].id,
data:{state:b}})));$(document.body).append(c);c.submit();c.remove()}}},error:function(a){a.children("div.body").addClass("loading-error")},fill:function(a,b){a.children("div.buttons").attr("data-row-count",0);var c=a.children("div.body");c.html("");if(b&&b.values&&b.values.state){var d=b.values.state;a.data("state",d);var e=a.find("div.paging");e.html("");var f=Math.ceil(d.paging.total/d.paging.size);if(1<f){var g=d.paging.number;1>=g&&(g=2);g>=f&&(g=f-1);var k={1:null};k[f]=null;k[g]=null;k[g-1]=
null;k[g+1]=null;var k=Object.keys(k),k=k.filter(function(a){return 0>=a||a>f?!1:!0}).sort(function(a,b){return parseInt(a)-parseInt(b)}),l=null,g=d.paging.number,l=$("\x3cspan\x3e\x3c/span\x3e");1<g&&l.attr("data-page",g-1);e.append(l);var v=0;k.forEach(function(a){1<a-v&&e.append($("\x3cspan\x3e\x3c/span\x3e").html("\x26#8230;"));l=$("\x3cspan\x3e\x3c/span\x3e").html(a);a==g?l.addClass("active"):l.attr("data-page",a);e.append(l);v=a});l=$("\x3cspan\x3e\x3c/span\x3e");g<f&&l.attr("data-page",g+1);
e.append(l)}var k=[15,50,100,500],w=a.find("div.psize");w.html("");if(d.paging.total>k[0])for(var n=0;n<k.length;++n)l=$("\x3cspan\x3e\x3c/span\x3e"),l.html(k[n]),d.paging.size==k[n]?l.addClass("active"):l.attr("data-size",k[n]),w.append(l)}b&&b.values&&b.values.list&&(k=b.values.list,d=confero.table.data.list(k,"row"),b.values.state&&b.values.state.params&&b.values.state.params["odded-last-in-group"]?d.filter(".group-by").each(function(){var a=$(this).prevUntil(".group-by");$(a[Math.floor(a.length/
2)]).addClass("last");a.length&1||a.first().addClass("last")}):d.filter(".group-by").prev().addClass("last"),b.values.state&&b.values.state.params&&b.values.state.params.reorder&&d.sort(function(a,b){return a.style.order-b.style.order}),c.append(d),setTimeout(function(a){confero.spinner.hide(a)},1,c));b&&b.values&&b.values.params&&confero.linked.update([b.values.params]);b&&b.values&&b.values.state&&(d=b.values.state,"schedule"==d.autofill&&confero.post.action.call(this,{mode:"schedule",action:{action:function(b,
c,d){if("schedule"==a.data("state").autofill)confero.table.load(a);else return!1}},schedule:{delay:1E3,immediate:!1,infinity:!1}},{}))},sort:function(a){a.stopPropagation();a.preventDefault();a.stopImmediatePropagation();var b=$(this);a=b.closest("div.table");var c=a.data("state"),d=c.order.split(" ",2);d[0]==b.data("sort")?(d[1]=d[1]?d[1]:"asc",d[1]="asc"==d[1].toLowerCase()?"desc":"asc"):d=[b.data("sort"),"asc"];c.order=d[0]+" "+d[1];c.paging.number=1;b=a.find("div.head div span[data-sort]").removeClass("sort desc").filter("[data-sort\x3d'"+
d[0]+"']").addClass("sort");"desc"==d[1]&&b.addClass("desc");confero.table.load(a)},paging:function(a){a=$(this);var b=a.closest("div.table");b.data("state").paging.number=a.data("page");confero.table.load(b);b.children("div.buttons").attr("data-row-count",b.find("div.row input[type\x3d'checkbox']:checked").length)},psize:function(a){a=$(this);var b=a.closest("div.table"),c=b.data("state");c.paging.size=a.data("size");c.paging.number=1;confero.table.load(b);b.children("div.buttons").attr("data-row-count",
b.find("div.row input[type\x3d'checkbox']:checked").length)},search:function(a){var b=a.key||a.keyCode,c=$(this).closest("div.search");if(0<c.length&&("click"==a.type||!("keypress"!=a.type&&"keydown"!=a.type||"Enter"!==b&&13!==b)||"change"==a.type&&c.data("auto-date-select"))){a.stopPropagation();a.preventDefault();a.stopImmediatePropagation();c=$(this).closest("div.search");c.parent().hasClass("header")&&!c.parent().hasClass("show-shadow")&&c.find(confero.error.elems).not("input[type\x3dradio], input[type\x3dcheckbox]").each(function(){$(this).parents("dl").hasClass("static")||
"search"==$(this).attr("type")||($(this).val(""),$(this).trigger("input"))}).end().filter("input[type\x3dradio], input[type\x3dcheckbox]").each(function(){$(this).parents("dl").hasClass("static")||"search"==$(this).attr("type")||(this.checked=!1,$(this).trigger("input"))});a=confero.page.getElem(c.data("target"));var d=a.data("state");d.search||(d.search={});d.paging&&(d.paging.number=1);c.find(confero.error.elems).not("input[type\x3dradio], input[type\x3dcheckbox]").each(function(){d.search[this.name.split(":")[1]]=
$(this).val()}).end().filter("input[type\x3dradio], input[type\x3dcheckbox]").each(function(){this.checked?d.search[this.name.split(":")[1]]=$(this).val():delete d.search[this.name.split(":")[1]]});confero.error.clean();confero.table.load(a)}},selector:function(a){var b=$(this).closest("div.popup").data("retValueMatrix"),c=a.data;$.each(b,function(a,b){var d=!1;"string"!=typeof b&&(d=b.event,b=b.value);b=b.replace(/{(.*?)}/g,function(a,b){return c[b]?c[b]:""});a=confero.page.getElem(a);a.filter("div").html(b).end().not("div").val(b);
d&&a.trigger("change");a.trigger("input")});confero.popup.close()},multipleSelector:function(a){var b=$(this).closest("div.popup").data("retValueMatrix"),c=a.tableid;c&&$.each(b,function(a,b){var d=confero.page.getElem(a);a=$("#"+c).find("input[type\x3dcheckbox]:checked");if(d.is("select"))a.each(function(){var a=$(this).closest("[data-name\x3d"+$(this).attr("name")+"]").data("data"),c=b.text.replace(/{(.*?)}/g,function(b,c){return a[c]?a[c]:""}),e=b.value.replace(/{(.*?)}/g,function(b,c){return a[c]?
a[c]:""});d.find("option[value\x3d'"+e+"']").length?(c=d.val(),c.push(e),d.val(c).trigger("change")):d.append(new Option(c,e,!0,!0))}),confero.select2.change(d);else{var e=[];a.each(function(){var a=$(this).closest("[data-name\x3d"+$(this).attr("name")+"]").data("data"),c=b.replace(/{(.*?)}/g,function(b,c){return a[c]?a[c]:""});e.push(c)});e=JSON.stringify(e);d.filter("div").html(e).end().not("div").val(e);d.trigger("input")}});confero.popup.close()},data:{list:function(a,b){var c=$();$.each(a,function(a,
e){a=confero.table.data.row(e,b);c=c.add(a)});return c},row:function(a,b){var c=$("\x3cdiv\x3e\x3c/div\x3e");b&&c.addClass(b);a.css&&c.addClass(a.css);a.order&&c.css("order",a.order);a.mode&&c.attr("data-mode",a.mode);$.each(a.data,function(a,b){"string"!=typeof b&&(b=JSON.stringify(b));c.attr("data-"+a,b)});$.each(a.v,function(a,b){a=confero.table.data.cell(a,b);c.append(a)});return c},cell:function(a,b){var c=$("\x3cdiv\x3e\x3c/div\x3e"),d=c;"string"==typeof b&&(b={value:b});if(b.type)if("html"==
b.type)b.value&&c.html(b.value);else if("check"==b.type||"radio"==b.type){if(b.value){var e=a+"#"+b.value,f="";b.checked&&(f=" checked");c.html('\x3cdiv class\x3d"option"\x3e\x3cinput id\x3d"'+e+'" name\x3d"'+a+'" value\x3d"'+b.value+'" type\x3d"'+("check"==b.type?"checkbox":"radio")+'"'+f+'\x3e\x3clabel for\x3d"'+e+'"\x3e\x3c/label\x3e\x3c/div\x3e')}}else"progress"==b.type?b.value&&c.append($("\x3cprogress\x3e\x3c/progress\x3e").attr({max:b.total,value:b.value})):"file"==b.type?(e=$("\x3ca\x3e\x3c/a\x3e"),
e.attr("href",document.forms[0].action+"/file/"+b.value),e.attr("download",b.filename),e.text(b.filedesc),c.append(e)):"list"==b.type?(e=confero.table.data.list(b.value),c.append(e)):"row"==b.type&&(e=confero.table.data.row(b.value),c.append(e));else b.value&&(d=$("\x3cspan\x3e\x3c/span\x3e").text(b.value),c.append(d));a&&c.attr("data-name",a);b.css&&c.addClass(b.css);b.code&&c.attr("data-code",b.code);b.mode&&d.attr("data-mode",b.mode);b.pageaction&&d.attr("data-pageaction",JSON.stringify(b.pageaction));
$.each(b.data,function(a,b){"string"!=typeof b&&(b=JSON.stringify(b));d.attr("data-"+a,b)});return c}}},media:{defs:{"extra-small":{max:580},small:{max:850},medium:{min:851,max:1200},large:{min:1201},"extra-large":{min:1461},touch:{touch:!0}},parsed:[],init:function(){var a=confero.media.defs,b;for(b in a)if(a.hasOwnProperty(b)){var c="screen";a[b].min&&(c+=" and (min-width: "+a[b].min+"px)");a[b].max&&(c+=" and (max-width: "+a[b].max+"px)");a[b].touch&&(c+=" and (pointer:coarse)");var d=function f(a){confero.media.change(a,
f.css)};d.css=b;c=window.matchMedia(c);c.addListener(d);d(c);d.m=c;confero.media.parsed.push(d)}window.matchMedia("print").addListener(function(a){a.matches?confero.media.beforeprint():confero.media.afterprint()});$(window).on("beforeprint",confero.media.beforeprint);$(window).on("afterprint",confero.media.afterprint)},match:function(){$.each(confero.media.parsed,function(){this(this.m)})},beforeprint:function(){var a=$("html");$.each(confero.media.parsed,function(){a.removeClass(this.css)});a.addClass("large print")},
afterprint:function(){$("html").removeClass("large print");confero.media.match()},change:function(a,b){var c=$("html");a.matches?c.addClass(b):c.removeClass(b)}},classifiers:{text:function(a,b,c){c||(c={});a=confero.classifiers[a];var d="";a&&(d=a[b]);d||(d="");return d=d.replace(/{(.*?)}/g,function(a,b){return c[b]?c[b]:""})},cl_error:{}},qrcode:{init:function(a){a.find('div[data-qrcode]:not([data-qrcode\x3d""])').each(function(a){var b=$(this);QRCode.toString([{data:confero.Base64.decode(b.data("qrcode")),
mode:"byte"}],{type:"svg",width:172,margin:2},function(a,c){b.html(c)})})}},peity:{init:function(a){a.find("div.peity").peity("donut",{fill:"rgba(107,153,142, 0.7);rgba(180, 133, 145, 0.7);rgba(91, 155, 213, 0.7);rgba(237, 125, 49, 0.7);rgba(165, 165, 165, 0.7);rgba(255, 192, 0, 0.7);rgba(99,162,144, 0.7);rgba(94,169,153, 0.7);rgba(107,153,142);rgba(98,134,141);rgba(100,158,162);rgba(100,134,128);rgba(104,160,146);rgba(89,139,125);rgba(99,162,144);rgba(94,169,153)".split(";"),radius:100,delimiter:","})}},
chart:{init:function(a){a.find("canvas.chart").each(function(a,c){a=$(this);c=window.getComputedStyle(this,"::after");c=[c.getPropertyValue("background-color"),c.getPropertyValue("border-top-color"),c.getPropertyValue("border-right-color"),c.getPropertyValue("border-bottom-color"),c.getPropertyValue("border-left-color"),c.getPropertyValue("outline-color")];new Chart(this,{type:"pie",data:{labels:a.data("labels"),datasets:[{data:a.data("values"),backgroundColor:c}]},options:{responsive:!0,aspectRatio:1,
tooltips:{callbacks:{label:function(a,b){var c=b.labels[a.index]||"";c&&(c+=": ");c+=parseFloat(b.datasets[0].data[a.index]).toFixed(2);return c+"%"}}}}})})}},file:{queue:[],init:function(a){a.find("div.file-upload").each(function(a,c){$(c).find("a").each(function(a,b){confero.file.initLeaf($(b))})})},initLeaf:function(a){a.append($("\x3ci\x3e\x3c/i\x3e").html(confero.file.bytesToSize(a.data("size"))))},select:function(a){var b=$(this).closest("div.file-upload"),c=b.children("div.file-list");$.each(this.files,
function(a,e){a=$("\x3ca\x3e\x3c/a\x3e").html(e.name).attr({href:window.URL.createObjectURL(e),download:e.name,"data-size":e.size});confero.file.initLeaf(a);a=$("\x3cdiv\x3e\x3c/div\x3e").addClass("progress").append($("\x3cspan\x3e\x3c/span\x3e").append(a).append($("\x3cspan\x3e\x3c/span\x3e")).append($("\x3cinput\x3e\x3c/input\x3e").attr({type:"hidden",name:b.data("name")}))).append($("\x3cprogress\x3e\x3c/progress\x3e").attr({max:e.size,value:0})).append("\x3cspan\x3e\x3c/span\x3e").data("file",
e);c.append(a);confero.file.queue.push({div:a,file:e});confero.file.upload(a,e)});$(this).attr("type","").val("").attr("type","file")},download:{blob:function(a){if(window.navigator&&window.navigator.msSaveOrOpenBlob){var b=$(this).attr("download");a=new XMLHttpRequest;a.open("GET",this.href,!1);a.responseType="blob";a.onload=function(a){200==this.status&&window.navigator.msSaveOrOpenBlob(this.response,b)};a.send();return!1}},fetch:function(a){var b=$(this);b.closest("div.link-buttons.auto-hide").removeClass("active");
confero.spinner.show(b.closest("div.search"));fetch(b.attr("href")).then(function(a){var c="",c=a.headers.get("Content-Disposition").split(/;(.+)/)[1].split(/=(.+)/)[1],c=c.toLowerCase().startsWith("utf-8''")?decodeURIComponent(c.replace(/utf-8''/ig,"")):c.replace(/['"]/g,"");a.blob().then(function(a){if(window.navigator&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(a,c);else{var d=document.createElement("a");d.href=URL.createObjectURL(a);d.download=c;document.body.append(d);
d.click();d.remove();setTimeout(function(){URL.revokeObjectURL(d.href)},7E3)}confero.spinner.hide(b.closest("div.search"))})});return!1}},upload:function(a,b){var c=a.parents("form")[0],d=a.find("progress"),e=a.find("input[type\x3d'hidden']"),f=new FormData;f.set("__CSRF",$("#__CSRF").val());f.set("__File",b);f.set("__FileName",e.attr("name"));b=$.ajax({type:"POST",xhr:function(){var a=new jQuery.ajaxSettings.xhr;a.upload.addEventListener("progress",function(a){a.lengthComputable&&d.attr({max:a.total,
value:a.loaded})},!1);return a},url:c.action+"/file/upload",headers:{"Confero-Callback":"file-upload"},data:f,processData:!1,contentType:!1}).done(function(b,c,d){confero.error.process(b);b.values&&b.values.file_id&&e.val(b.values.file_id);a.removeClass("progress");b.errors&&b.errors.value&&0==b.errors.value.length?confero.error.remove(a.closest("dl")):confero.file.remove.call(e,{})}).fail(function(a,b,c){confero.error.ajax(a,b,c)}).always(function(a,b,c){confero.schedules.sessionTillTime.init(a,
b,c);"success"==b?confero.post.xhr.remove(c):confero.post.xhr.remove(a)});a.data("xhr",b);confero.post.xhr.push(b)},remove:function(a){a=$(this).closest("div");var b=a.find("a");window.URL.revokeObjectURL(b.attr("href"));a.remove()},cancel:function(a){var b=$(this).closest("div").data("xhr");b&&b.abort();confero.file.remove.call(this,a)},clear:function(a){a.children("div.file-list").html("")},bytesToSize:function(a){if(0==a)return"0 Byte";var b=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return Math.round(a/
Math.pow(1024,b),2)+" "+["Bytes","KB","MB","GB","TB"][b]}},repeater:{init:function(a){a.find("div.repeater:has(fieldset)").each(function(){var a=$(this),c=a.children("fieldset");a.attr("data-repeater-items-count",c.length);a.data("repeaterItemsLimit")&&(c.length>=a.data("repeaterItemsLimit")?a.addClass("repeater-limit"):a.removeClass("repeater-limit"));confero.repeater.recalculateIds.call(a[0],a.hasClass("static"));a.find("[data-linked]").removeData("linked")})},remove:function(){var a=$(this).closest("div.repeater\x3efieldset"),
b=a.closest("div.repeater");a.remove();confero.repeater.recalculateIds.call(b[0])},add:function(a){if(a.repeater&&(a=$("div.repeater#"+a.repeater.replaceAll(":","\\:").replaceAll("|","\\|")),1==a.length)){var b=a.children("fieldset").first();confero.select2.destroy(b);b.find("select").each(function(){$(this).attr("value",$(this).val())});b=b.clone();b.find(confero.error.elems).filter(":not(input[type\x3dcheckbox])").filter(":not(input[type\x3dradio])").val("");b.find(confero.error.elems).filter("input[type\x3dcheckbox],input[type\x3dradio]").prop("checked",
!1);b.find("div.repeater").each(function(){$(this).children("fieldset").slice(1).each(function(){confero.repeater.remove.call(this)})});confero.file.clear(b.find(".file-upload"));b.find("select").attr("value","");b.appendTo(a);confero.calendar.init(b);confero.repeater.recalculateIds.call(a[0]);confero.linked.init(b)}},clear:function(a){a=a.find("div.repeater:not(div.static)");a.each(function(){$(this).children("fieldset:not(:first)").remove()});confero.file.clear(a.find(".file-upload"));a.find("select").attr("value",
"")},recalculateIds:function(a){var b=$(this).closest("div.repeater"),c=b.prop("id"),d=c.replace(":","\\:").replaceAll("|","\\|"),e=b.children("fieldset");e.each(function(b,e){$(e).find("*[id^\x3d'"+d+"'],*[name^\x3d'"+d+"'],*[for^\x3d'"+d+"'],span[data-ret-value-matrix],span[data-repeater],div[data-name]").addBack().each(function(d,e){if(!a){this.id&&this.id.startsWith(c)&&(this.id=c+this.id.substring(c.length).replace(/\|\d+\|/,"|"+b+"|"));this.name&&this.name.startsWith(c)&&(this.name=c+this.name.substring(c.length).replace(/\|\d+\|/,
"|"+b+"|"));this.attributes["for"]&&this.attributes["for"].value&&this.attributes["for"].value.startsWith(c)&&(this.attributes["for"].value=c+this.attributes["for"].value.substring(c.length).replace(/\|\d+\|/,"|"+b+"|"));if(this.attributes["data-ret-value-matrix"]&&this.attributes["data-ret-value-matrix"].value)try{var f=JSON.parse(this.attributes["data-ret-value-matrix"].value);d={};for(var g in f)g.startsWith(c)?d[c+g.substring(c.length).replace(/\|\d+\|/,"|"+b+"|")]=f[g]:d[g]=f[g];this.attributes["data-ret-value-matrix"].value=
JSON.stringify(d)}catch(q){}if(this.attributes["data-repeater"]&&this.attributes["data-repeater"].value)try{g=this.attributes["data-repeater"].value,g.startsWith(c)&&(g=c+g.substring(c.length).replace(/\|\d+\|/,"|"+b+"|")),this.attributes["data-repeater"].value=g}catch(q){}if(this.attributes["data-pageaction"]&&this.attributes["data-pageaction"].value)try{this.attributes["data-pageaction"].value=this.attributes["data-pageaction"].value.replace(/\|\d+\|/,"|"+b+"|")}catch(q){}this.attributes["data-name"]&&
this.attributes["data-name"].value&&(this.attributes["data-name"].value=c+this.attributes["data-name"].value.substring(c.length).replace(/\|\d+\|/,"|"+b+"|"))}if(this.attributes["data-linked"]&&this.attributes["data-linked"].value)try{var k=function(a){if("object"!==typeof a||null==a)return a;if(Array.isArray(a)){for(var d=0;d<a.length;++d)a[d]=k(a[d]);return a}var d={},e;for(e in a){var f=k(a[e]);e.startsWith(c)?d[c+e.substring(c.length).replace(/\|\d+\|/,"|"+b+"|")]=f:d[e]=f}return d},f=JSON.parse(this.attributes["data-linked"].value),
f=k(f);this.attributes["data-linked"].value=JSON.stringify(f)}catch(q){}})});a||(b.attr("data-repeater-items-count",e.length),b.data("repeaterItemsLimit")&&(e.length>=b.data("repeaterItemsLimit")?b.addClass("repeater-limit"):b.removeClass("repeater-limit")),confero.select2.init(b))}},formatedText:{converter:new showdown.Converter,init:function(a){a.find('div[data-unformatted-text]:not([data-unformatted-text\x3d""])').each(function(){var a=$(this);a.html(confero.formatedText.getFormattedText(a.data("unformatted-text").toString()))})},
getFormattedText:function(a){var b="";a.match(/[^\r\n]+/g).forEach(function(a){b+=confero.formatedText.converter.makeHtml($("\x3cdiv\x3e\x3c/div\x3e").text(a).html())});return b}},naceFields:{toggleIsMainNace:function(){$("div.nace-selector.repeater input[id*\x3d'nace_is_main']").not(this).prop("checked",!1)}},inputDisabling:{init:function(a){a.find("fieldset.input-disabling").each(function(){var a=$(this),c=!1;a.find(":input").each(function(){var a=$(this);a.is("input[type\x3dcheckbox]")||a.is("input[type\x3dradio]")?
a.is("input:checked")&&(c=!0):a.val()&&(c=!0)});a.prop("disabled",!c)})},click:function(a){$(this).prevAll("fieldset.input-disabling").prop("disabled",function(a,c){return!c}).filter(":disabled").each(function(){$(this).find(":input").each(function(){var a=$(this);a.attr("disabled")||(a.is("input[type\x3dcheckbox]")||a.is("input[type\x3dradio]")?a.prop("checked",!1):a.val("").trigger("change"))})}).end().not(":disabled").each(function(){$(this).find(":input").each(function(){var a=$(this);a.is("input[type\x3dcheckbox]")||
a.is("input[type\x3dradio]")?a.prop("checked",!0):this.value=this.placeholder})}).end().trigger("input")}},wizard:{titleClick:function(a){var b=$(this);a=confero.page.getElem(b.data("name"));var c=$.extend(!0,{},a.data());c.action=function(a){1>a.errors.value.length&&(b.siblings().removeClass("active"),b.addClass("active"),confero.wizard.showHideSections(b.parent()))};c.pageaction=a.siblings(".expand").data("pageaction");var d=a.siblings(".expand").next("div").find("#b_next");0===d.length&&(d=a.siblings(".expand").next("div").find("#b_previous"));
confero.post.async.call(d,c)},buttonClick:function(a,b){var c=$(this);confero.spinner.show(c.closest(".article"));if("set"==a.action){var d=$.extend(!0,{},a),e;0<c.siblings(".expand").length?e=c.siblings(".expand"):c.hasClass("expand")&&(e=c);void 0===e||!0===b?c.hasClass("expand")?confero.spinner.hide(c.closest(".article")):confero.wizard.wizardCallback.call(c,a.action)():(d.action=confero.wizard.wizardCallback.call(c,a.action),d.pageaction=e.data("pageaction"),a=e.next("div").find("#b_next"),0===
a.length&&(a=e.next("div").find("#b_previous")),confero.post.async.call(a,d))}else e=confero.page.getElem(c.data("wizardid")),b=e.children("span.active"),"next"==a.action&&(d=$.extend(!0,{},a),d.action=confero.wizard.wizardCallback.call(c,a.action),confero.post.async.call(c,d)),"previous"==a.action&&(b.prevAll().first().addClass("active"),0!=b.prevAll().length&&b.removeClass("active"),confero.wizard.showHideSections(e),confero.spinner.hide(c.closest(".article")))},wizardCallback:function(a){var b=
$(this);if("set"===a)return function(a){if(void 0===a||1>a.errors.value.length){b.toggleClass("expand");if(b.hasClass("expand")){var c=$("span[data-name\x3d"+b.attr("id").replace(/:/g,"\\:")+"]");c.siblings().removeClass("active");c.addClass("active");confero.wizard.showHideSections(c.parent())}void 0===a&&confero.spinner.hide(b.closest(".article"))}};if("next"===a)return function(a){var c=confero.page.getElem(b.data("wizardid")),e=c.children("span.active");1>a.errors.value.length&&(e.nextAll().first().addClass("active"),
0!=e.nextAll().length&&e.removeClass("active"));confero.wizard.showHideSections(c)}},sectionClick:function(){},showHideSections:function(a){a.children("span").each(function(){var a=$(this),c=confero.page.getElem(a.data("name"));a.hasClass("active")?(c.addClass("expand"),setTimeout(function(a){a[0].scrollIntoView({block:"start",behavior:"smooth"})},800,c)):c.removeClass("expand")})},openStepWithoutAjax:function(a){a=$("[id*\x3d'"+a+"'][data-action*\x3d'set'][data-mode*\x3d'wizard']");1===a.length&&
confero.wizard.buttonClick.call(a,a.data(),!0)}},copyPaste:{copyValues:function(){$("form").find(":input").each(function(){var a=$(this).attr("name"),b=$(this).val();void 0!==a&&-1===a.indexOf("sys")&&-1===a.indexOf("__")&&($(this).is(":checkbox")?localStorage.setItem(a,$(this).is(":checked")):localStorage.setItem(a,b))})},pasteValues:function(){$("form").find(":input").each(function(){var a=$(this).attr("name");void 0!==a&&-1===a.indexOf("sys")&&-1===a.indexOf("__")&&($(this).is(":checkbox")?$(this).prop("checked",
"true"===localStorage.getItem(a)):$(this).val(localStorage.getItem(a)),$(this).is("select")&&$(this).trigger("change"))})}},crypto:{generateKey:function(a){window.crypto.subtle.generateKey({name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"},!0,["encrypt","decrypt"]).then(function(b){crypto.subtle.exportKey("spki",b.publicKey).then(function(c){c=new Uint8Array(c);c=confero.Base64.encode(c);a({keyPair:b,pkcs:c})}).catch(function(a){console.log(a)})})},decrypt:function(a,
b,c){c=confero.Base64.decode(c);c=new Uint8Array(c);return window.crypto.subtle.decrypt(a,b,c)}},pinBlock:{decrypt:function(a,b,c){confero.crypto.decrypt({name:"RSA-OAEP",hash:{name:"SHA-256"}},a,b.pin_block).then(function(a){var d=new Uint8Array(a),f=b.pan,f="0000"+f.substring(3,15);a="";for(var g=0;8>g;++g)a+=(d[g]^parseInt(f.substr(2*g,2),16)).toString(16).padStart(2,"0");"0"==a[0]&&(d=parseInt(a[1],16),a=a.substr(2,d));c(a)}).catch(function(a){console.log(a)})}},Base64:{_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d",
encode:function(a){for(var b="",c,d,e,f,g,k,l=0;l<a.length;)c=a[l++],d=a[l++],e=a[l++],f=c>>2,c=(c&3)<<4|d>>4,g=(d&15)<<2|e>>6,k=e&63,isNaN(d)?g=k=64:isNaN(e)&&(k=64),b=b+this._keyStr.charAt(f)+this._keyStr.charAt(c)+this._keyStr.charAt(g)+this._keyStr.charAt(k);return b},decode:function(a){var b={},c,d=0,e,f=0,g,k=[],l=a.length;for(c=0;64>c;c++)b[this._keyStr.charAt(c)]=c;for(e=0;e<l;e++)for(c=b[a.charAt(e)],d=(d<<6)+c,f+=6;8<=f;)((g=d>>>(f-=8)&255)||e<l-2)&&k.push(g);return k}}};$(document).ready(function(){confero.page.init()});
confero.events.init();confero.media.init();
//# sourceMappingURL=confero.min.js.map