Registry.require(["crcrc","helper","layout/default/layout_helper"],function(){var l=Registry.get("crcrc").cr,k=Registry.get("crcrc").crc,p=Registry.get("helper"),q=Registry.get("layout/default/layout_helper").images,m=function(b,a,c,d,f,e){b=k("i","far fa-"+b,a,c,d,!0);b.alt=f?b.title=f:a||d||c;b.key=c;b.name=a;e&&(a=b.getAttribute("class")||"",b.setAttribute("class",a+" clickable"),b.addEventListener("click",e),b.href="#");return b},r=function(b,a,c){var d=(a.uuid?a.uuid:"")+a.id,f=l("div",a.name,
d,"input");f.key=a.id;var e=l("input",a.name,d,"input",!0);b=b.split("##");e.name=a.name;e.uuid=a.uuid;e.key=a.id;e.oldvalue=a.value;e.value=void 0!=a.value?a.value:"";e.type=a.password?"password":"text";e.setAttribute("spellcheck","false");a.placeholder&&e.setAttribute("placeholder",a.placeholder);c&&!e.inserted&&e.addEventListener("change",c);c=k("span","optiondesc",a.name,d,"s1");d=l("span",a.name,d,"s2");c.textContent=b[0]+":";1<b.length&&(d.textContent=b[1]);f.appendChild(c);f.appendChild(e);
f.appendChild(d);a.enabledBy&&f.setAttribute("name","enabled_by_"+a.enabledBy);return{elem:f,input:e}},u=function(b,a,c){b=null;b=k("input","button",a.name,(a.uuid?a.uuid:"")+a.id,"bu",!0);b.name=a.name;b.uuid=a.uuid;b.key=a.id;b.type="button";b.value=a.name;b.data=a.data;b.reload=a.reload;b.ignore=a.ignore||a.reload;b.warning=a.warning;a.enabledBy&&b.setAttribute("name","enabled_by_"+a.enabledBy);!b.inserted&&c&&b.addEventListener("click",c);return b},v=function(b,a,c,d){var f=null,f=k("input","button",
b,a,"bu",!0);f.name=b;f.key=a;f.type="button";f.value=c;!f.inserted&&d&&f.addEventListener("click",d);return f},t=function(b,a){var c=(b.uuid?b.uuid:"")+b.id,d,f;if(f=b.after||b.validation){d=b.validation?"validation":"help";a&&(d+=" clickable");d=k("span",d,b.name,c,d,!0);if(f.image){var c=m(q.get(f.image),c,"after_icon"),e=[];f.opacity&&e.push("opacity: "+f.opacity);c.setAttribute("style",e.join(";"));d.appendChild(c)}d&&(a&&d.addEventListener("click",a),f.msg&&d.setAttribute("title",f.msg))}return d},
w=function(b){return{"&":"&amp;","<":"&lt;",">":"&gt;"}[b]||b},n=function(b,a,c,d){var f=(d.uuid?d.uuid:"")+d.id;a.title=b;(b=t({after:{image:"help"},name:d.name,id:f}))&&c.appendChild(b)};Registry.register("layout/default/htmlutil","6095",{getInfoFromUrl:function(b){if(-1!=b.search(/\/\^?(http(s|s\?|\.\+)?|\.\*):\/\/(\.\*)*\$?\/?$/)||-1!=b.search(/htt(ps|p):\/\/(\*\/\*|\*)*$/)||-1!=b.search(/\*:\/\/(\*\/\*|\*)*$/)||"*"==b)return{dom:"*",tld:"*"};0==b.search(/\//)&&(b=b.replace(/\([^\)]*\)[\?|\+|\*|\{[^\}]*]*/g,
""),b=b.replace(/\[[^\]]*\][\?|\+|\*|\{[^\}]*]*/g,""),b=b.replace(/^\/|\/$|\^|\$|\\\?.*|#.*|\?|\(|\)|\+|\\|\.\*|/g,""));b=b.replace(/^\*:\/\//,"http://");0!=b.search("http")&&(b="http://"+b);b=b.split("/");if(3>b.length)return null;b=b[2].split(".");if(2>b.length)return null;var a=b[b.length-1],c=b[b.length-2];"*"!==c&&(c=c.replace(/\*/g,""));for(var d=[],f=b.length-3;0<=f&&-1==b[f].search("\\*");f--)d.push(b[f]);return{tld:a,dom:c,subdom:d.reverse()}},getValue:function(b){var a=b.value;if("native"===
b.valtype)if("undefined"===a)a=void 0;else if("null"===a)a=null;else try{a=JSON.parse(a)}catch(c){}return a},safeTagsReplace:function(b){return b.replace(/[&<>]/g,w)},addClass:function(b,a){var c=b.getAttribute("class")||"";-1==c.search(new RegExp("[ \t]*"+a+"[ \t]*"))&&(c=(c?c+" ":"")+a);b.setAttribute("class",c)},toggleClass:function(b,a){var c=b.getAttribute("class")||"",d=new RegExp("[ \t]*"+a+"[ \t]*"),c=-1!=c.search(d)?c.replace(d,""):(c?c+" ":"")+a;b.setAttribute("class",c)},setHelp:n,createAfterIcon:t,
createEnabler:function(b,a,c,d,f){var e=d.disabled,h=d.title,g=k("div","enabler "+b,a,c+"_enabler",d.append,"wrap",!0);b=k("i","far fa-toggle-on on green",a,c+"toggle-on");d=k("i","far fa-toggle-on fa-flip-horizontal off greyed",a,c+"toggle-off");g.appendChild([b,d]);h&&(g.title=h);g.key=c;g.uuid=a;e||g.addEventListener("click",function(){$(g).hasClass("enabler_enabled")?$(g).removeClass("enabler_enabled"):$(g).addClass("enabler_enabled");f&&window.setTimeout(function(){f.call(g)},100)});return g},
createImage:function(b,a,c,d,f,e){var h=k("img","icon16",a,c,d,!0);h.setAttribute("src",b);e&&(b=h.getAttribute("class")||"",h.setAttribute("class",b+" clickable"));h.alt=f?h.title=f:a||d||c;h.key=c;h.name=a;e&&(h.addEventListener("click",e),h.href="#");return h},createIcon:m,createFavicon:function(b,a,c,d){var f=k("img","icon16",a,c,p.filter(d,/[a-zA-Z0-9]/g));if(f.inserted)return f;"Array"!==p.toType(b)&&(b=[b]);var e=function(){if(0!=b.length){var e=b.shift();"function"==typeof e?window.setTimeout(function(){f.parentNode&&
(f.parentNode.insertBefore(m(e(),a+"_ico",c,d),f),f.parentNode.removeChild(f))},1):(f.setAttribute("src",e),f.setAttribute("async","true"))}};f.addEventListener("error",e);e();f.alt=d?f.title=d:a;return f},createFileInput:function(b,a,c){b=k("input","import","file",null,null,!0);b.inserted||(b.type="file",c&&b.addEventListener("change",c));return b},createNamedSettings:function(b,a,c){var d=(a.uuid?a.uuid:"")+a.id,f=k("div","settingsta",a.name,d,"named_wrapper"),e=k("div","named",a.name,d,"named_settings"),
h=[],g=l("span",a.name,d,"s1");b&&(g.textContent=b+":");a.desc&&n(a.desc,g,g,a);f.appendChild(g);f.appendChild(e);f.key=a.id;a.value.forEach(function(b){var f=k("div","",a.name+b.name,d,"named",!0),g=k("div","",a.name+b.name,d,"named_label",!0);g.textContent=b.name;f.appendChild(g);g=l("textarea",a.name+b.name,d,"textarea",!0);g.setAttribute("spellcheck","false");g.name=a.name;g.key=a.id;g.named_name=b.name;g.uuid=a.uuid;g.named=!0;g.oldvalue=b.value||"";g.value=b.value||"";c&&!g.inserted&&g.addEventListener("change",
c);f.appendChild(g);e.appendChild(f);h.push(g)});return{elem:f,textareas:h,label:g}},createTextarea:function(b,a,c){var d=(a.uuid?a.uuid:"")+a.id,f=l("div",a.name,d,"textarea");f.key=a.id;var e=k("textarea","settingsta",a.name,d,"textarea",!0);e.setAttribute("spellcheck","false");e.name=a.name;e.key=a.id;e.uuid=a.uuid;e.json=a.json;e.array=a.array;e.oldvalue=a.value;e.value=void 0===a.value||null===a.value?"":a.array?a.value.join("\n"):a.json?JSON.stringify(a.value,null,4):a.value;c&&!e.inserted&&
e.addEventListener("change",c);c=l("span",a.name,d,"s1");b&&(c.textContent=b+":");a.desc&&n(a.desc,c,c,a);f.appendChild(c);f.appendChild(e);return{elem:f,textarea:e,label:c}},createFileSelect:function(b,a,c){var d=(a.uuid?a.uuid:"")+a.id,f=l("input",a.name,d,"file"),e=function(a){c(a.target.files)};f.inserted||(f.type="file",f.addEventListener("change",e,!1));return b?(e=l("div",a.name,d,"input"),a=l("span",a.name,d,"s1"),a.textContent=b+":",e.appendChild(a),e.appendChild(f),{elem:e,input:f}):{elem:f}},
createInput:r,createColorChooser:function(b,a,c){var d=(a.uuid?a.uuid:"")+a.id;b=r(b,a,c);var f=function(){c&&c.apply(this,arguments);var a=(this.value.match(/[a-fA-F0-9]+/)||"")[0];a&&-1!=[3,6].indexOf(a.length)&&e.setAttribute("style","background-color: #"+a+";")};b.input.inserted||b.input.addEventListener("keyup",f);var e=k("span","color_choosed",a.name,d,"col");b.col=e;b.elem.appendChild(b.col);f.call(b.input);return b},createPassword:function(b,a,c){b=r(b,a,c);b.input.setAttribute("type","password");
return b},createCheckbox:function(b,a,c){var d=(a.uuid?a.uuid:"")+a.id,f=k("div","checkbox",a.name,d,"cb1");f.key=a.id;var e=l("input",a.name,d,"cb",!0);e.title=a.desc?a.desc:"";e.name=a.name;e.uuid=a.uuid;e.key=a.id;e.reload=a.reload;e.warning=a.warning;e.oldvalue=a.enabled;e.checked=a.enabled;e.type="checkbox";e.valtype="boolean";c&&!e.inserted&&e.addEventListener("click",c);c=k("span","checkbox_desc",a.name,d,"cb2");c.textContent=b;a.desc&&n(a.desc,f,c,a);f.appendChild(e);f.appendChild(c);return{elem:f,
input:e}},createDropDown:function(b,a,c,d,f){var e=(a.uuid?a.uuid:"")+a.id,h=l("div",a.name,e,"outer_dd");h.key=a.id;var g=l("select",a.name,e,"dd",!0),m=!1;c&&Object.keys(c).forEach(function(b){var d=l("option",a.name,c[b].name,"dd"+e,!0);d.textContent=p.decodeHtml(c[b].name);d.value=c[b].value;d.warning=c[b].warning;m|=!!c[b].warning;c[b].enabledBy&&d.setAttribute("name","enabled_by_"+c[b].enabledBy);a.enabler&&c[b].enable&&d.setAttribute("enables",JSON.stringify(c[b].enable));c[b].value==a.value&&
(d.selected=!0);g.appendChild(d)});g.key=a.id;g.name=a.name;g.uuid=a.uuid;g.reload=a.reload;g.warning=a.warning;g.oldvalue=a.value;g.valtype="native";g.inserted||(d&&g.addEventListener("change",d),m&&f&&g.addEventListener("change",f));null!==b&&(d=k("span","optiondesc",a.name,e,"inner_dd"),d.textContent=b+": ",h.appendChild(d));h.appendChild(g);a.desc&&n(a.desc,h,h,a);a.enabledBy&&h.setAttribute("name","enabled_by_"+a.enabledBy);return{elem:h,select:g}},createImageButton:function(b,a,c,d,f){var e=
null,h=null,g=null,e=k("button","imgbutton button",b,a,"bu",!0),h=k("div","imgbutton_container",b,a,"bu_container");h.appendChild(e);e.uuid=b;e.key=a;g=k("i","imgbutton_image far fa-"+d,b,a,"bu_img",!0);e.appendChild(g);e.title=g.title=g.alt=c;!e.inserted&&f&&e.addEventListener("click",f);return h},createImageTextButton:function(b,a,c,d,f){var e=k("button","button imgtextbutton",b,a+c,"itb",!0);e.key=a;e.uuid=b;d&&(d=m(q.get(d),b,a+c+"itb",d),e.appendChild(d));b=l("span",b,a+c,"itb");b.textContent=
c;e.appendChild(b);f&&e.addEventListener("click",f);return e},createButton:function(b,a,c,d){return"Object"===p.toType(a)?u.apply(this,arguments):v.apply(this,arguments)},createPosition:function(b,a,c){for(var d=(a.uuid?a.uuid:"")+a.id,f=l("div",a.name,d,"pos1"),e=l("select",a.name,d,"pos",!0),h=1;h<=a.posof;h++){var g=l("option",a.name,d,"opt"+h);g.textContent=h;h==a.pos&&(g.selected=!0);e.appendChild(g)}e.key=a.id;e.uuid=a.uuid;e.name=a.name;c&&!e.inserted&&e.addEventListener("change",c);a=k("span",
"optiondesc",a.name,d,"pos2");a.textContent=b;f.appendChild(a);f.appendChild(e);return f},createSearchBox:function(b){var a=k("div","searchbox","search_inner"),c=k("div","searchbox_mv","search_inner_mv"),d=k("input","searchbox_input","search_input"),f=k("input","searchbox_button","search_button");d.type="text";d.setAttribute("spellcheck","false");d.value=b;f.type="button";f.value="Go";var e=function(){window.location=window.location.origin+window.location.pathname+"?url="+encodeURIComponent(d.value)};
f.addEventListener("click",e);d.addEventListener("keyup",function(a){a&&13==a.keyCode&&e()});c.appendChild(d);c.appendChild(f);a.appendChild(c);return a},createGobalHint:function(b,a){var c="global_hint_"+(b.class?b.class:"warning"),d=Date.now(),f=k("span",["global_hint",c].join(" "),"globalhint",d),c=l("span","globalhint_c",d),e=l("span","globalhint_t",d);b.title&&(e.title=b.title);b.image&&c.appendChild(m(q.get(b.image),"globalhint_"+d,"icon"+d));e.textContent=b.text;b.onclick&&!e.inserted&&e.addEventListener("click",
b.onclick);c.appendChild(e);f.appendChild(c);var h=$(f);b.instant||(h.hide(),window.setTimeout(function(){h.slideDown()},b.delay?b.delay:1));b.timeout&&window.setTimeout(function(){b.instant?(h.hide(),h.remove()):h.slideUp(function(){h.remove()});b.done&&b.done(f)},b.timeout);h.appendTo(a||document.body);return h},isScrolledIntoView:function(b,a){var c=$(b),d=$(window),f=a&&a.padding||0,e=d.scrollTop(),d=e+d.height(),h=c.offset().top;return h+c.height()<=d-f&&h>=e+f}})});
