@lmjs/core 2.5.4 → 2.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /* LumenJS V2 core — generated by packages/core/build/bundle.js, do not edit directly */
2
- (function(global){function toArray(x){if(x==null)return[];if(typeof NodeList!=="undefined"&&x instanceof NodeList)return Array.prototype.slice.call(x);if(typeof HTMLCollection!=="undefined"&&x instanceof HTMLCollection)return Array.prototype.slice.call(x);if(Array.isArray(x))return x;if(x instanceof $)return Array.prototype.slice.call(x);return[x]}var JQ_POSITIONAL=/:(first|last|even|odd|eq\((-?\d+)\)|gt\((-?\d+)\)|lt\((-?\d+)\))(?![-\w])/;var JQ_REWRITES=[[/:checkbox(?![-\w])/g,'[type="checkbox"]'],[/:radio(?![-\w])/g,'[type="radio"]'],[/:selected(?![-\w])/g,":checked"],[/:password(?![-\w])/g,'[type="password"]'],[/:text(?![-\w])/g,'[type="text"]'],[/:submit(?![-\w])/g,'[type="submit"]'],[/:file(?![-\w])/g,'[type="file"]'],[/:button(?![-\w])/g,"button"]];function _splitTopLevel(sel,ch){var out=[],depth=0,quote=null,cur="";for(var i=0;i<sel.length;i++){var c=sel[i];if(quote){if(c===quote)quote=null;cur+=c;continue}if(c==='"'||c==="'"){quote=c;cur+=c;continue}if(c==="("||c==="[")depth++;else if(c===")"||c==="]")depth--;if(c===ch&&depth===0){out.push(cur);cur="";continue}cur+=c}out.push(cur);return out}function _applyPositional(els,m){var n=els.length;if(m[1]==="first")return els.slice(0,1);if(m[1]==="last")return n?els.slice(n-1):[];if(m[1]==="even")return els.filter(function(_,i2){return i2%2===0});if(m[1]==="odd")return els.filter(function(_,i2){return i2%2===1});if(m[2]!==void 0){var i=+m[2];if(i<0)i+=n;return els[i]?[els[i]]:[]}if(m[3]!==void 0){var g=+m[3];if(g<0)g+=n;return els.slice(g+1)}var l=+m[4];if(l<0)l+=n;return els.slice(0,Math.max(0,l))}function _jqSelect(root,selector){var sel=selector;for(var r=0;r<JQ_REWRITES.length;r++)sel=sel.replace(JQ_REWRITES[r][0],JQ_REWRITES[r][1]);if(!JQ_POSITIONAL.test(sel))return toArray(root.querySelectorAll(sel));var out=[];_splitTopLevel(sel,",").forEach(function(part){var rest=part.trim(),current=null;while(rest.length){var m=JQ_POSITIONAL.exec(rest);var css=m?rest.slice(0,m.index):rest;if(css.trim()){if(current===null)current=toArray(root.querySelectorAll(css));else{var next=[];var scoped=/^\s*[>+~]/.test(css)?":scope"+css:":scope "+css.replace(/^\s+/,"");current.forEach(function(el){toArray(el.querySelectorAll(scoped)).forEach(function(x){if(next.indexOf(x)===-1)next.push(x)})});current=next}}else if(current===null)current=toArray(root.querySelectorAll("*"));if(!m)break;current=_applyPositional(current,m);rest=rest.slice(m.index+m[0].length)}(current||[]).forEach(function(x){if(out.indexOf(x)===-1)out.push(x)})});return out}function $(selector,context){if(!(this instanceof $))return new $(selector,context);if(typeof selector==="function")return $(document).ready(selector);var els=[];var sel=void 0;if(!selector){els=[]}else if(typeof selector==="string"){var trimmed=selector.trim();if(trimmed[0]==="<"){var tpl=document.createElement("template");tpl.innerHTML=trimmed;els=toArray(tpl.content.childNodes).filter(function(n){return n.nodeType===1})}else{sel=selector;var root=context?context instanceof $?context[0]:context:document;var atParts=selector.split(",").map(function(s){return s.trim()});var isAllAtAttrs=atParts.length>0&&atParts.every(function(p){return/^\[\\@[\w-]+\]$/.test(p)});if(isAllAtAttrs){var names=atParts.map(function(p){return"@"+/^\[\\@([\w-]+)\]$/.exec(p)[1]});var all=root?toArray(root.querySelectorAll("*")):[];els=all.filter(function(el){return names.some(function(n){return el.getAttribute(n)!=null})})}else{els=root?_jqSelect(root,selector):[]}}}else{els=toArray(selector)}for(var i=0;i<els.length;i++)this[i]=els[i];this.length=els.length;this.selector=sel;return this}$.fn=$.prototype;$.fn.jquery="lumenjs-shim";$.fn.extend=function(methods){for(var k in methods)if(Object.prototype.hasOwnProperty.call(methods,k))$.fn[k]=methods[k];return $};$.extend=function(target){for(var i=1;i<arguments.length;i++){var src=arguments[i];for(var k in src)if(Object.prototype.hasOwnProperty.call(src,k))target[k]=src[k]}return target};$.Event=function(type,props){var e=typeof type==="string"?new Event(type,{bubbles:true,cancelable:true}):type;if(props)for(var k in props)e[k]=props[k];return e};$.proxy=function(fn,context){return fn.bind(context)};$.trim=function(s){return(s==null?"":String(s)).trim()};$.inArray=function(val,arr){return Array.prototype.indexOf.call(arr,val)};function isArrayLike(obj){if(Array.isArray(obj)||obj instanceof $)return true;var length=obj&&typeof obj==="object"&&obj.length;return typeof length==="number"&&(length===0||length-1 in obj)}$.each=function(arr,fn){if(isArrayLike(arr)){for(var i=0;i<arr.length;i++)if(fn.call(arr[i],i,arr[i])===false)break}else{for(var k in arr)if(fn.call(arr[k],k,arr[k])===false)break}return arr};$.map=function(arr,fn){var out=[];var src=Array.isArray(arr)||arr instanceof $?arr:Object.keys(arr||{}).map(function(k){return arr[k]});for(var i=0;i<src.length;i++){var r=fn(src[i],i);if(r===null||r===void 0)continue;if(Array.isArray(r))out.push.apply(out,r);else out.push(r)}return out};var _ajaxActive=0;$.param=function(obj){var parts=[];function add(k2,v){if(v&&typeof v==="object"){for(var kk in v)if(Object.prototype.hasOwnProperty.call(v,kk))add(k2+"["+(Array.isArray(v)?"":kk)+"]",v[kk])}else parts.push(encodeURIComponent(k2)+"="+encodeURIComponent(v==null?"":v))}for(var k in obj)if(Object.prototype.hasOwnProperty.call(obj,k))add(k,obj[k]);return parts.join("&")};$.ajax=function(url,opts){if(typeof url==="object"){opts=url;url=opts.url}opts=opts||{};var method=(opts.method||opts.type||"GET").toUpperCase();var headers=Object.assign({},opts.headers||{});var init={method,headers};var data=opts.data;var isJson=/json/i.test(opts.contentType||"");if(data!=null&&method==="GET"){var qs=typeof data==="string"?data:$.param(data);if(qs)url+=(url.indexOf("?")===-1?"?":"&")+qs}else if(data!=null){if(typeof data==="string"||typeof FormData!=="undefined"&&data instanceof FormData)init.body=data;else if(isJson)init.body=JSON.stringify(data);else{init.body=$.param(data);if(!headers["Content-Type"])headers["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8"}if(isJson&&!headers["Content-Type"])headers["Content-Type"]=opts.contentType}if(_ajaxActive===0)$(document).trigger("ajaxStart");_ajaxActive++;$(document).trigger("ajaxSend");var p=fetch(url,init).then(function(res){var ct=res.headers.get("content-type")||"";return ct.indexOf("json")>-1?res.json():res.text()}).then(function(data2){opts.success&&opts.success(data2);$(document).trigger("ajaxSuccess");return data2}).catch(function(err){opts.error&&opts.error(err);$(document).trigger("ajaxError");throw err}).finally(function(){_ajaxActive--;$(document).trigger("ajaxComplete");if(_ajaxActive===0)$(document).trigger("ajaxStop")});p.done=function(fn){p.then(fn,function(){});return p};p.fail=function(fn){p.catch(fn);return p};p.always=function(fn){p.then(fn,fn);return p};return p};function _shorthand(method){return function(url,data,success,dataType){if(typeof data==="function"){dataType=success;success=data;data=void 0}return $.ajax({url,method,data,success,dataType})}}$.get=_shorthand("GET");$.post=_shorthand("POST");$.getJSON=function(url,data,success){return $.get(url,data,success,"json")};$.parseJSON=function(s){return JSON.parse(s)};$.isArray=Array.isArray;$.isFunction=function(f){return typeof f==="function"};$.noop=function(){};$.fn.each=function(fn){for(var i=0;i<this.length;i++)if(fn.call(this[i],i,this[i])===false)break;return this};$.fn.get=function(i){return i===void 0?toArray(this):this[i]};$.fn.not=function(exclude){var excludeArr=exclude instanceof $?toArray(exclude):Array.isArray(exclude)?exclude:[exclude];var out=[];this.each(function(){if(excludeArr.indexOf(this)===-1)out.push(this)});return $(out)};$.fn.attr=function(name,value){if(value===void 0)return this[0]?this[0].getAttribute(name):void 0;return this.each(function(){this.setAttribute(name,value)})};$.fn.prop=function(name,value){if(value===void 0)return this[0]?this[0][name]:void 0;return this.each(function(){this[name]=value})};$.fn.removeAttr=function(name){return this.each(function(){this.removeAttribute(name)})};$.fn.hasAttr=function(name){return!!(this[0]&&this[0].getAttribute(name)!=null)};var _dataCache=typeof WeakMap!=="undefined"?new WeakMap:null;function _dataStore(el,create){if(!_dataCache||!el||typeof el!=="object")return null;var s=_dataCache.get(el);if(!s&&create){s={};_dataCache.set(el,s)}return s}function _camel(k){return String(k).replace(/-([a-z])/g,function(_,c){return c.toUpperCase()})}function _parseDataAttr(v){if(v===void 0)return void 0;if(v==="true")return true;if(v==="false")return false;if(v==="null")return null;if(v!==""&&!isNaN(v)&&String(+v)===v)return+v;if(/^[\[{]/.test(v)){try{return JSON.parse(v)}catch(e){}}return v}$.fn.data=function(key,value){if(key&&typeof key==="object"){var obj=key;return this.each(function(){for(var k in obj)$(this).data(k,obj[k])})}if(value===void 0){var el=this[0];if(!el)return void 0;var store=_dataStore(el,false);var ds=el.dataset||{};if(key===void 0){var all={};for(var dk in ds)all[dk]=_parseDataAttr(ds[dk]);return Object.assign(all,store||{})}if(store&&Object.prototype.hasOwnProperty.call(store,key))return store[key];var ck=_camel(key);if(store&&Object.prototype.hasOwnProperty.call(store,ck))return store[ck];return _parseDataAttr(ds[ck])}return this.each(function(){var s=_dataStore(this,true);if(s)s[key]=value;if(this.dataset&&(value===null||typeof value!=="object")&&typeof value!=="function"){try{this.dataset[_camel(key)]=String(value)}catch(e){}}})};$.fn.removeData=function(key){return this.each(function(){var s=_dataStore(this,false);var keys=key===void 0?s?Object.keys(s):[]:String(key).split(/\s+/);for(var i=0;i<keys.length;i++){if(s){delete s[keys[i]];delete s[_camel(keys[i])]}if(this.dataset){try{delete this.dataset[_camel(keys[i])]}catch(e){}}}})};$.fn.val=function(value){if(value===void 0)return this[0]?this[0].value:void 0;return this.each(function(){this.value=value})};$.fn.html=function(value){if(value===void 0)return this[0]?this[0].innerHTML:void 0;if(typeof value!=="string"){var nodes=_normalizeAppendable([value]);return this.each(function(){this.innerHTML="";var self=this;nodes.forEach(function(n){self.appendChild(n)})})}return this.each(function(){this.innerHTML=value})};$.fn.text=function(value){if(value===void 0)return this[0]?this[0].textContent:"";return this.each(function(){this.textContent=value})};$.fn.css=function(name,value){if(typeof name==="object"){return this.each(function(){var el=this;for(var k in name)el.style[k]=name[k]})}if(value===void 0)return this[0]?getComputedStyle(this[0])[name]:void 0;return this.each(function(){this.style[name]=value})};$.fn.addClass=function(cls){var list=cls.split(/\s+/).filter(Boolean);return this.each(function(){this.classList.add.apply(this.classList,list)})};$.fn.removeClass=function(cls){var list=cls.split(/\s+/).filter(Boolean);return this.each(function(){this.classList.remove.apply(this.classList,list)})};$.fn.hasClass=function(cls){return!!(this[0]&&this[0].classList.contains(cls))};$.fn.toggleClass=function(cls,force){var list=cls.split(/\s+/).filter(Boolean);return this.each(function(){var el=this;list.forEach(function(c){el.classList.toggle(c,force)})})};$.fn.remove=function(){return this.each(function(){this.parentNode&&this.parentNode.removeChild(this)})};function _normalizeAppendable(args){var out=[];function add(item){if(item==null)return;if(Array.isArray(item)){item.forEach(add);return}if(item instanceof $){for(var i2=0;i2<item.length;i2++)add(item[i2]);return}if(typeof item==="string"){var tpl=document.createElement("template");tpl.innerHTML=item;while(tpl.content.firstChild)out.push(tpl.content.removeChild(tpl.content.firstChild));return}if(item instanceof Node){out.push(item);return}}for(var i=0;i<args.length;i++)add(args[i]);return out}$.fn.append=function(){if(arguments.length===1&&typeof arguments[0]==="string"){var html=arguments[0];return this.each(function(){this.insertAdjacentHTML("beforeend",html)})}var nodes=_normalizeAppendable(arguments);return this.each(function(){var self=this;nodes.forEach(function(n){self.appendChild(n)})})};$.fn.prepend=function(){if(arguments.length===1&&typeof arguments[0]==="string"){var html=arguments[0];return this.each(function(){this.insertAdjacentHTML("afterbegin",html)})}var nodes=_normalizeAppendable(arguments);return this.each(function(){var self=this;var ref=self.firstChild;nodes.forEach(function(n){self.insertBefore(n,ref)})})};$.fn.after=function(content){return this.each(function(){if(typeof content==="string")this.insertAdjacentHTML("afterend",content);else this.parentNode.insertBefore(content instanceof $?content[0]:content,this.nextSibling)})};$.fn.appendTo=function(target){$(target).append(this);return this};$.fn.width=function(){return this[0]?this[0].offsetWidth:0};$.fn.height=function(){return this[0]?this[0].offsetHeight:0};$.fn.innerHeight=function(){return this[0]?this[0].clientHeight:0};$.fn.innerWidth=function(){return this[0]?this[0].clientWidth:0};$.fn.scrollLeft=function(value){if(!this[0])return value===void 0?0:this;if(value===void 0)return this[0]===window?window.scrollX:this[0].scrollLeft;return this.each(function(){if(this===window)window.scrollTo(value,window.scrollY);else this.scrollLeft=value})};$.fn.scrollTop=function(value){if(!this[0])return value===void 0?0:this;if(value===void 0)return this[0]===window?window.scrollY:this[0].scrollTop;return this.each(function(){if(this===window)window.scrollTo(window.scrollX,value);else this.scrollTop=value})};$.fn.outerWidth=function(includeMargin){if(!this[0])return 0;var w=this[0].offsetWidth;if(includeMargin){var s=getComputedStyle(this[0]);w+=parseFloat(s.marginLeft||0)+parseFloat(s.marginRight||0)}return w};$.fn.outerHeight=function(includeMargin){if(!this[0])return 0;var h=this[0].offsetHeight;if(includeMargin){var s=getComputedStyle(this[0]);h+=parseFloat(s.marginTop||0)+parseFloat(s.marginBottom||0)}return h};$.fn.offset=function(){if(!this[0])return null;var rect=this[0].getBoundingClientRect();var docEl=document.documentElement;return{top:rect.top+(window.pageYOffset||docEl.scrollTop)-(docEl.clientTop||0),left:rect.left+(window.pageXOffset||docEl.scrollLeft)-(docEl.clientLeft||0)}};$.fn.parent=function(){return $(this[0]?this[0].parentElement:null)};$.fn.next=function(){return $(this[0]?this[0].nextElementSibling:null)};$.fn.closest=function(sel){return $(this[0]?this[0].closest(sel):null)};$.fn.find=function(sel){var out=[];if(sel&&typeof sel==="object"){var cands=toArray(sel instanceof $?sel:[sel]);var self=toArray(this);return $(cands.filter(function(c){return self.some(function(p){return p!==c&&p.contains(c)})}))}this.each(function(){var found=_jqSelect(this,sel);for(var i=0;i<found.length;i++)if(out.indexOf(found[i])===-1)out.push(found[i])});return $(out)};var JQUERY_PSEUDOS={":checkbox":function(el){return el.tagName==="INPUT"&&el.type==="checkbox"},":radio":function(el){return el.tagName==="INPUT"&&el.type==="radio"},":checked":function(el){return!!el.checked}};JQUERY_PSEUDOS[":selected"]=function(el){return!!el.selected};JQUERY_PSEUDOS[":visible"]=function(el){return!!(el.offsetWidth||el.offsetHeight||el.getClientRects().length)};JQUERY_PSEUDOS[":hidden"]=function(el){return!JQUERY_PSEUDOS[":visible"](el)};$.fn.is=function(sel){if(!this[0])return false;if(typeof sel==="function"){var s=this;return toArray(this).some(function(el,i){return sel.call(el,i,el)})}if(sel&&typeof sel==="object"){var set=toArray(sel instanceof $?sel:[sel]);return toArray(this).some(function(el){return set.indexOf(el)!==-1})}if(JQUERY_PSEUDOS[sel])return JQUERY_PSEUDOS[sel](this[0]);var rewritten=sel;for(var r=0;r<JQ_REWRITES.length;r++)rewritten=rewritten.replace(JQ_REWRITES[r][0],JQ_REWRITES[r][1]);try{return this[0].matches(rewritten)}catch(e){return false}};$.fn.ready=function(fn){if(document.readyState!=="loading")fn($);else document.addEventListener("DOMContentLoaded",function(){fn($)});return this};function _filterBySel(els,sel){if(!sel)return els;return els.filter(function(el){return $(el).is(sel)})}$.fn.eq=function(i){i=+i;if(i<0)i+=this.length;return $(this[i]?[this[i]]:[])};$.fn.first=function(){return this.eq(0)};$.fn.last=function(){return this.eq(-1)};$.fn.index=function(target){if(target===void 0){var el=this[0];if(!el||!el.parentElement)return-1;return toArray(el.parentElement.children).indexOf(el)}var node=target instanceof $?target[0]:typeof target==="string"?null:target;if(typeof target==="string")return toArray($(target)).indexOf(this[0]);return toArray(this).indexOf(node)};$.fn.add=function(sel,ctx){var out=toArray(this);toArray(typeof sel==="string"&&sel.trim()[0]!=="<"?$(sel,ctx):$(sel)).forEach(function(x){if(out.indexOf(x)===-1)out.push(x)});return $(out)};$.fn.children=function(sel){var out=[];this.each(function(){out.push.apply(out,toArray(this.children||[]))});return $(_filterBySel(out,sel))};$.fn.contents=function(){var out=[];this.each(function(){out.push.apply(out,toArray(this.childNodes||[]))});return $(out)};$.fn.siblings=function(sel){var out=[];this.each(function(){var me=this;if(!me.parentElement)return;toArray(me.parentElement.children).forEach(function(c){if(c!==me&&out.indexOf(c)===-1)out.push(c)})});return $(_filterBySel(out,sel))};$.fn.prev=function(sel){var out=[];this.each(function(){var p=this.previousElementSibling;if(p)out.push(p)});return $(_filterBySel(out,sel))};$.fn.prevAll=function(sel){var out=[];this.each(function(){var p=this.previousElementSibling;while(p){if(out.indexOf(p)===-1)out.push(p);p=p.previousElementSibling}});return $(_filterBySel(out,sel))};$.fn.nextAll=function(sel){var out=[];this.each(function(){var n=this.nextElementSibling;while(n){if(out.indexOf(n)===-1)out.push(n);n=n.nextElementSibling}});return $(_filterBySel(out,sel))};$.fn.parents=function(sel){var out=[];this.each(function(){var p=this.parentElement;while(p){if(out.indexOf(p)===-1)out.push(p);p=p.parentElement}});return $(_filterBySel(out,sel))};$.fn.filter=function(sel){var els=toArray(this);if(typeof sel==="function")return $(els.filter(function(el,i){return sel.call(el,i,el)}));return $(_filterBySel(els,sel))};$.fn.has=function(sel){return $(toArray(this).filter(function(el){return $(el).find(sel).length>0}))};$.fn.map=function(fn){var out=[];this.each(function(i,el){var r=fn.call(el,i,el);if(r!=null)Array.isArray(r)?out.push.apply(out,r):out.push(r)});return $(out)};$.fn.toArray=function(){return toArray(this)};function _isHidden(el){return el.style.display==="none"||window.getComputedStyle&&getComputedStyle(el).display==="none"}function _show(el){if(el.style.display==="none")el.style.display=el._lmOldDisplay||"";if(window.getComputedStyle&&getComputedStyle(el).display==="none")el.style.display=el._lmOldDisplay||"block"}function _hide(el){if(el.style.display&&el.style.display!=="none")el._lmOldDisplay=el.style.display;el.style.display="none"}function _timedArgs(a,b,c){var cb=[a,b,c].filter(function(x){return typeof x==="function"})[0];var ms=typeof a==="number"?a:a==="slow"?600:a==="fast"?200:a&&typeof a==="object"&&a.duration||0;return{ms,cb}}function _visibilityMethod(apply){return function(a,b,c){var t=_timedArgs(a,b,c),self=this;this.each(function(){apply(this)});if(t.cb)setTimeout(function(){self.each(function(){t.cb.call(this)})},t.ms);return this}}$.fn.show=_visibilityMethod(_show);$.fn.hide=_visibilityMethod(_hide);$.fn.fadeIn=$.fn.show;$.fn.fadeOut=$.fn.hide;$.fn.slideDown=$.fn.show;$.fn.slideUp=$.fn.hide;$.fn.toggle=function(state){if(typeof state==="boolean")return state?this.show():this.hide();var t=_timedArgs.apply(null,arguments),self=this;this.each(function(){_isHidden(this)?_show(this):_hide(this)});if(t.cb)setTimeout(function(){self.each(function(){t.cb.call(this)})},t.ms);return this};$.fn.fadeToggle=$.fn.toggle;$.fn.slideToggle=$.fn.toggle;$.fn.empty=function(){return this.each(function(){while(this.firstChild)this.removeChild(this.firstChild)})};$.fn.before=function(content){return this.each(function(){var t=this;_normalizeAppendable([content]).forEach(function(n){t.parentNode&&t.parentNode.insertBefore(n,t)})})};$.fn.wrap=function(wrapper){return this.each(function(){var w=_normalizeAppendable([wrapper]).filter(function(n){return n.nodeType===1})[0];if(!w||!this.parentNode)return;w=w.cloneNode(true);this.parentNode.insertBefore(w,this);var inner=w;while(inner.firstElementChild)inner=inner.firstElementChild;inner.appendChild(this)})};$.fn.unwrap=function(){var parents=[];this.each(function(){var p=this.parentElement;if(p&&p!==document.body&&parents.indexOf(p)===-1)parents.push(p)});parents.forEach(function(p){while(p.firstChild)p.parentNode.insertBefore(p.firstChild,p);p.parentNode.removeChild(p)});return this};$.fn.clone=function(){return $(toArray(this).map(function(el){return el.cloneNode(true)}))};$.fn.position=function(){var el=this[0];if(!el)return void 0;return{top:el.offsetTop,left:el.offsetLeft}};["ajaxStart","ajaxStop","ajaxSend","ajaxSuccess","ajaxError","ajaxComplete"].forEach(function(name){$.fn[name]=function(fn){return this.on(name,fn)}});var EVENT_NAME_MAP={touch:"touchstart",focus:"focusin",blur:"focusout"};var _eventBuses=typeof WeakMap!=="undefined"?new WeakMap:null;function _isNode(x){return x===window||x===document||typeof Node!=="undefined"&&x instanceof Node}function _isRealEventTarget(x){return x!=null&&typeof x.addEventListener==="function"&&typeof x.dispatchEvent==="function"}function _eventTargetFor(x){if(_isNode(x)||_isRealEventTarget(x))return x;if(!_eventBuses.has(x))_eventBuses.set(x,new EventTarget);return _eventBuses.get(x)}var AT_ATTR_SELECTOR=/^\[\\@([\w-]+)\]$/;function _callHandler(handler,ctx,e){var extra=e.__lmArgs;if(extra===void 0)return handler.call(ctx,e);return handler.apply(ctx,[e].concat(Array.isArray(extra)?extra:[extra]))}$.fn.on=function(events,selector,data,handler){if(typeof selector==="function"){handler=selector;selector=null}else if(typeof data==="function"&&handler===void 0){handler=data}else if(typeof handler!=="function"&&typeof data==="function"){handler=data}if(typeof selector!=="string")selector=null;if(typeof handler!=="function")return this;var evts=String(events).split(/\s+/).filter(Boolean);var atParts=selector?selector.split(",").map(function(p){return p.trim()}):[];var atAttrs=atParts.length&&atParts.every(function(p){return AT_ATTR_SELECTOR.test(p)})?atParts.map(function(p){return"@"+AT_ATTR_SELECTOR.exec(p)[1]}):null;var atAttr=!!atAttrs;function _hasAnyAt(el){for(var i=0;i<atAttrs.length;i++)if(el.getAttribute(atAttrs[i])!=null)return true;return false}return this.each(function(){var node=this;var bus=_eventTargetFor(node);evts.forEach(function(evtFull){var dot=evtFull.indexOf(".");var evt=dot===-1?evtFull:evtFull.slice(0,dot);var ns=dot===-1?"":evtFull.slice(dot+1);if(!evt)return;function listen(realName,wrapper){bus.addEventListener(realName,wrapper);_recordListener(bus,{type:evt,ns,selector,handler,real:realName,wrapper})}if(evt==="mouseenter"||evt==="mouseleave"){var realType=evt==="mouseenter"?"mouseover":"mouseout";listen(realType,function(e){var related=e.relatedTarget;if(atAttr){var el=e.target;var match=null;while(el&&el.nodeType===1){if(_hasAnyAt(el)){match=el;break}el=el.parentElement}if(match&&node.contains(match)&&!(related&&match.contains(related))){_callHandler(handler,match,e)}}else if(selector&&_isNode(node)){var match2=e.target.closest(selector);if(match2&&node.contains(match2)&&!(related&&match2.contains(related))){_callHandler(handler,match2,e)}}else if(!(related&&node.contains(related))){_callHandler(handler,node,e)}});return}var real=EVENT_NAME_MAP[evt]||evt;listen(real,function(e){if(atAttr||selector&&_isNode(node)){for(var el=e.target;el&&el.nodeType===1&&node.contains(el);el=el.parentElement){var hit=atAttr?_hasAnyAt(el):el.matches&&el.matches(selector);if(!hit)continue;var ret=_callHandler(handler,el,e);if(ret===false){e.preventDefault();e.stopPropagation()}if(e.cancelBubble)break}}else{_callHandler(handler,node,e)}})})})};$.fn.live=function(events,data,handler){if(this.selector&&typeof this.selector==="string")$(document).on(events,this.selector,data,handler);else this.on(events,data,handler);return this};$.fn.click=function(handler){return handler?this.on("click",handler):this.trigger("click")};$.fn.keydown=function(handler){return handler?this.on("keydown",handler):this.trigger("keydown")};$.fn.trigger=function(type,data){return this.each(function(){var bus=_eventTargetFor(this);var ev;if(type instanceof Event){ev=type}else if(type&&typeof type==="object"&&typeof type.type==="string"){ev=new Event(type.type,{bubbles:_isNode(this)});for(var k in type){if(k!=="type"&&Object.prototype.hasOwnProperty.call(type,k)){try{ev[k]=type[k]}catch(e){}}}}else{ev=new Event(type,{bubbles:_isNode(this)})}if(data!==void 0){ev.__lmArgs=data;try{if(ev.detail===void 0||ev.detail===null)ev.detail=data}catch(e){}}bus.dispatchEvent(ev)})};var _listenerRegistry=typeof WeakMap!=="undefined"?new WeakMap:null;function _recordListener(bus,rec){if(!_listenerRegistry)return;var list=_listenerRegistry.get(bus);if(!list){list=[];_listenerRegistry.set(bus,list)}list.push(rec)}$.fn.off=function(events,selector,handler){if(typeof selector==="function"){handler=selector;selector=void 0}var specs=events===void 0?[{type:"",ns:""}]:String(events).split(/\s+/).filter(Boolean).map(function(e){var d=e.indexOf(".");return{type:d===-1?e:e.slice(0,d),ns:d===-1?"":e.slice(d+1)}});return this.each(function(){if(!_listenerRegistry)return;var bus=_eventTargetFor(this);var list=_listenerRegistry.get(bus);if(!list)return;for(var i=list.length-1;i>=0;i--){var r=list[i];var hit=specs.some(function(sp){return(!sp.type||sp.type===r.type)&&(!sp.ns||sp.ns===r.ns)});if(!hit)continue;if(selector!==void 0&&selector!=="**"&&r.selector!==selector)continue;if(handler&&r.handler!==handler)continue;bus.removeEventListener(r.real,r.wrapper);list.splice(i,1)}})};$.fn.unbind=function(events,handler){return this.off(events,handler)};$.fn.bind=function(events,data,handler){return this.on(events,null,data,handler)};$.fn.one=function(events,selector,data,handler){var args=[].slice.call(arguments),fn=null,idx=-1;for(var i=args.length-1;i>=0;i--)if(typeof args[i]==="function"){fn=args[i];idx=i;break}if(!fn)return this;var self=this;args[idx]=function once(e){self.off(events,once);return fn.apply(this,arguments)};return this.on.apply(this,args)};$.fn.die=function(events,handler){if(this.selector&&typeof this.selector==="string")$(document).off(events,this.selector,handler);return this};["click","dblclick","keyup","keydown","keypress","focus","blur","change","submit","focusin","focusout","mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove","resize","scroll","load","select"].forEach(function(name){$.fn[name]=function(handler){return handler?this.on(name,handler):this.trigger(name)}});$.fn.hover=function(enter,leave){this.on("mouseenter",enter);this.on("mouseleave",leave||enter);return this};var _animTimers=new WeakMap;function _animGetScroll(el,prop){if(el===window)return prop==="scrollLeft"?window.pageXOffset:window.pageYOffset;return el[prop]}function _animSetScroll(el,prop,val){if(el===window){if(prop==="scrollLeft")window.scrollTo(val,window.pageYOffset);else window.scrollTo(window.pageXOffset,val)}else{el[prop]=val}}var _cssNumberProps={opacity:1,zIndex:1,zoom:1,fontWeight:1,lineHeight:1,columnCount:1,flexGrow:1,flexShrink:1,order:1,widows:1,orphans:1};function _animSetStyle(el,prop,val){el.style[prop]=_cssNumberProps[prop]?val:val+"px"}$.fn.animate=function(props,options){var opts=typeof options==="number"?{duration:options}:options||{};var duration=opts.duration==null?400:opts.duration;this.each(function(){var el=this;var isWindowScroll=el===document.documentElement||el===document.body;var target=isWindowScroll?window:el;var start={};var isScrollProp={};for(var prop in props){if(!Object.prototype.hasOwnProperty.call(props,prop))continue;isScrollProp[prop]=prop==="scrollTop"||prop==="scrollLeft";if(isScrollProp[prop]){start[prop]=_animGetScroll(isWindowScroll?window:el,prop)}else{start[prop]=parseFloat(getComputedStyle(el)[prop])||0}}var existing=_animTimers.get(el);if(existing)cancelAnimationFrame(existing);if(duration===0){for(var p in props){var v=parseFloat(props[p]);if(isScrollProp[p])_animSetScroll(isWindowScroll?window:el,p,v);else _animSetStyle(el,p,v)}if(opts.complete)opts.complete.call(el);return}var startTime=null;function step(ts){if(startTime===null)startTime=ts;var elapsed=ts-startTime;var t=Math.min(1,elapsed/duration);for(var p2 in props){if(!Object.prototype.hasOwnProperty.call(props,p2))continue;var end=parseFloat(props[p2]);var val=start[p2]+(end-start[p2])*t;if(isScrollProp[p2])_animSetScroll(isWindowScroll?window:el,p2,val);else _animSetStyle(el,p2,val)}if(t<1){_animTimers.set(el,requestAnimationFrame(step))}else{_animTimers.delete(el);if(opts.complete)opts.complete.call(el)}}_animTimers.set(el,requestAnimationFrame(step))});return this};$.fn.stop=function(){this.each(function(){var id=_animTimers.get(this);if(id){cancelAnimationFrame(id);_animTimers.delete(this)}});return this};var _queues=new WeakMap;function _getQueue(el,name){var byName=_queues.get(el);if(!byName){byName={};_queues.set(el,byName)}if(!byName[name])byName[name]={items:[],running:false};return byName[name]}function _dequeue(el,name){var q=_getQueue(el,name);if(q.running)return;var next=q.items.shift();if(!next)return;q.running=true;next.call(el,function(){q.running=false;_dequeue(el,name)})}$.fn.queue=function(name,fn){if(typeof name==="function"){fn=name;name="fx"}name=name||"fx";if(fn===void 0)return _getQueue(this[0],name).items;return this.each(function(){_getQueue(this,name).items.push(fn);_dequeue(this,name)})};$.fn.dequeue=function(name){return this.each(function(){_dequeue(this,name||"fx")})};$.fn.delay=function(ms,name){name=name||"fx";return this.each(function(){_getQueue(this,name).items.push(function(next){setTimeout(next,ms)});_dequeue(this,name)})};$.fn.serializeArray=function(){var result=[];this.each(function(){if(this.tagName!=="FORM")return;var elements=this.elements?Array.prototype.slice.call(this.elements):[];elements.forEach(function(field){if(!field.name||field.disabled)return;var tag=field.tagName.toLowerCase();var type=(field.type||tag).toLowerCase();if(type==="submit"||type==="button"||type==="reset"||type==="fieldset")return;if((type==="checkbox"||type==="radio")&&!field.checked)return;if(type==="file"){var files=field.files?Array.prototype.map.call(field.files,function(f){return f.name}):[];result.push({name:field.name,value:files,type});return}if(tag==="select"&&field.multiple){Array.prototype.forEach.call(field.selectedOptions||[],function(opt){result.push({name:field.name,value:opt.value,type})});return}result.push({name:field.name,value:field.value,type})})});return result};$.fn.ajaxForm=function(options){options=options||{};return this.each(function(){var formEl=this;var $form=$(formEl);formEl.addEventListener("submit",function(ev){ev.preventDefault();var formData=$form.serializeArray();if(typeof options.beforeSubmit==="function"){options.beforeSubmit(formData,$form,options)}})})};if(!global.jQuery||!global.jQuery.fn||global.jQuery.fn.jquery==="lumenjs-shim"){global.$=$;global.jQuery=$}})(typeof window!=="undefined"?window:globalThis);
2
+ (function(global){function toArray(x){if(x==null)return[];if(typeof NodeList!=="undefined"&&x instanceof NodeList)return Array.prototype.slice.call(x);if(typeof HTMLCollection!=="undefined"&&x instanceof HTMLCollection)return Array.prototype.slice.call(x);if(Array.isArray(x))return x;if(x instanceof $)return Array.prototype.slice.call(x);return[x]}var JQ_POSITIONAL=/:(first|last|even|odd|eq\((-?\d+)\)|gt\((-?\d+)\)|lt\((-?\d+)\))(?![-\w])/;var JQ_REWRITES=[[/:checkbox(?![-\w])/g,'[type="checkbox"]'],[/:radio(?![-\w])/g,'[type="radio"]'],[/:selected(?![-\w])/g,":checked"],[/:password(?![-\w])/g,'[type="password"]'],[/:text(?![-\w])/g,'[type="text"]'],[/:submit(?![-\w])/g,'[type="submit"]'],[/:file(?![-\w])/g,'[type="file"]'],[/:button(?![-\w])/g,"button"]];function _splitTopLevel(sel,ch){var out=[],depth=0,quote=null,cur="";for(var i=0;i<sel.length;i++){var c=sel[i];if(quote){if(c===quote)quote=null;cur+=c;continue}if(c==='"'||c==="'"){quote=c;cur+=c;continue}if(c==="("||c==="[")depth++;else if(c===")"||c==="]")depth--;if(c===ch&&depth===0){out.push(cur);cur="";continue}cur+=c}out.push(cur);return out}function _applyPositional(els,m){var n=els.length;if(m[1]==="first")return els.slice(0,1);if(m[1]==="last")return n?els.slice(n-1):[];if(m[1]==="even")return els.filter(function(_,i2){return i2%2===0});if(m[1]==="odd")return els.filter(function(_,i2){return i2%2===1});if(m[2]!==void 0){var i=+m[2];if(i<0)i+=n;return els[i]?[els[i]]:[]}if(m[3]!==void 0){var g=+m[3];if(g<0)g+=n;return els.slice(g+1)}var l=+m[4];if(l<0)l+=n;return els.slice(0,Math.max(0,l))}function _jqSelect(root,selector){var sel=selector;for(var r=0;r<JQ_REWRITES.length;r++)sel=sel.replace(JQ_REWRITES[r][0],JQ_REWRITES[r][1]);if(!JQ_POSITIONAL.test(sel))return toArray(root.querySelectorAll(sel));var out=[];_splitTopLevel(sel,",").forEach(function(part){var rest=part.trim(),current=null;while(rest.length){var m=JQ_POSITIONAL.exec(rest);var css=m?rest.slice(0,m.index):rest;if(css.trim()){if(current===null)current=toArray(root.querySelectorAll(css));else{var next=[];var scoped=/^\s*[>+~]/.test(css)?":scope"+css:":scope "+css.replace(/^\s+/,"");current.forEach(function(el){toArray(el.querySelectorAll(scoped)).forEach(function(x){if(next.indexOf(x)===-1)next.push(x)})});current=next}}else if(current===null)current=toArray(root.querySelectorAll("*"));if(!m)break;current=_applyPositional(current,m);rest=rest.slice(m.index+m[0].length)}(current||[]).forEach(function(x){if(out.indexOf(x)===-1)out.push(x)})});return out}function $(selector,context){if(!(this instanceof $))return new $(selector,context);if(typeof selector==="function")return $(document).ready(selector);var els=[];var sel=void 0;if(!selector){els=[]}else if(typeof selector==="string"){var trimmed=selector.trim();if(trimmed[0]==="<"){var tpl=document.createElement("template");tpl.innerHTML=trimmed;els=toArray(tpl.content.childNodes).filter(function(n){return n.nodeType===1})}else{sel=selector;var root=context?context instanceof $?context[0]:context:document;var atParts=selector.split(",").map(function(s){return s.trim()});var isAllAtAttrs=atParts.length>0&&atParts.every(function(p){return/^\[\\@[\w-]+\]$/.test(p)});if(isAllAtAttrs){var names=atParts.map(function(p){return"@"+/^\[\\@([\w-]+)\]$/.exec(p)[1]});var all=root?toArray(root.querySelectorAll("*")):[];els=all.filter(function(el){return names.some(function(n){return el.getAttribute(n)!=null})})}else{els=root?_jqSelect(root,selector):[]}}}else{els=toArray(selector)}for(var i=0;i<els.length;i++)this[i]=els[i];this.length=els.length;this.selector=sel;return this}$.fn=$.prototype;$.fn.jquery="lumenjs-shim";$.fn.extend=function(methods){for(var k in methods)if(Object.prototype.hasOwnProperty.call(methods,k))$.fn[k]=methods[k];return $};$.extend=function(target){for(var i=1;i<arguments.length;i++){var src=arguments[i];for(var k in src)if(Object.prototype.hasOwnProperty.call(src,k))target[k]=src[k]}return target};$.Event=function(type,props){var e=typeof type==="string"?new Event(type,{bubbles:true,cancelable:true}):type;if(props)for(var k in props)e[k]=props[k];return e};$.proxy=function(fn,context){return fn.bind(context)};$.trim=function(s){return(s==null?"":String(s)).trim()};$.inArray=function(val,arr){return Array.prototype.indexOf.call(arr,val)};function isArrayLike(obj){if(Array.isArray(obj)||obj instanceof $)return true;var length=obj&&typeof obj==="object"&&obj.length;return typeof length==="number"&&(length===0||length-1 in obj)}$.each=function(arr,fn){if(isArrayLike(arr)){for(var i=0;i<arr.length;i++)if(fn.call(arr[i],i,arr[i])===false)break}else{for(var k in arr)if(fn.call(arr[k],k,arr[k])===false)break}return arr};$.map=function(arr,fn){var out=[];var src=Array.isArray(arr)||arr instanceof $?arr:Object.keys(arr||{}).map(function(k){return arr[k]});for(var i=0;i<src.length;i++){var r=fn(src[i],i);if(r===null||r===void 0)continue;if(Array.isArray(r))out.push.apply(out,r);else out.push(r)}return out};var _ajaxActive=0;$.param=function(obj){var parts=[];function add(k2,v){if(v&&typeof v==="object"){for(var kk in v)if(Object.prototype.hasOwnProperty.call(v,kk))add(k2+"["+(Array.isArray(v)?"":kk)+"]",v[kk])}else parts.push(encodeURIComponent(k2)+"="+encodeURIComponent(v==null?"":v))}for(var k in obj)if(Object.prototype.hasOwnProperty.call(obj,k))add(k,obj[k]);return parts.join("&")};$.ajax=function(url,opts){if(typeof url==="object"){opts=url;url=opts.url}opts=opts||{};var method=(opts.method||opts.type||"GET").toUpperCase();var headers=Object.assign({},opts.headers||{});var init={method,headers};var data=opts.data;var isJson=/json/i.test(opts.contentType||"");if(data!=null&&method==="GET"){var qs=typeof data==="string"?data:$.param(data);if(qs)url+=(url.indexOf("?")===-1?"?":"&")+qs}else if(data!=null){if(typeof data==="string"||typeof FormData!=="undefined"&&data instanceof FormData)init.body=data;else if(isJson)init.body=JSON.stringify(data);else{init.body=$.param(data);if(!headers["Content-Type"])headers["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8"}if(isJson&&!headers["Content-Type"])headers["Content-Type"]=opts.contentType}if(_ajaxActive===0)$(document).trigger("ajaxStart");_ajaxActive++;$(document).trigger("ajaxSend");var p=fetch(url,init).then(function(res){var ct=res.headers.get("content-type")||"";return ct.indexOf("json")>-1?res.json():res.text()}).then(function(data2){opts.success&&opts.success(data2);$(document).trigger("ajaxSuccess");return data2}).catch(function(err){opts.error&&opts.error(err);$(document).trigger("ajaxError");throw err}).finally(function(){_ajaxActive--;$(document).trigger("ajaxComplete");if(_ajaxActive===0)$(document).trigger("ajaxStop")});p.done=function(fn){p.then(fn,function(){});return p};p.fail=function(fn){p.catch(fn);return p};p.always=function(fn){p.then(fn,fn);return p};return p};function _shorthand(method){return function(url,data,success,dataType){if(typeof data==="function"){dataType=success;success=data;data=void 0}return $.ajax({url,method,data,success,dataType})}}$.get=_shorthand("GET");$.post=_shorthand("POST");$.getJSON=function(url,data,success){return $.get(url,data,success,"json")};$.parseJSON=function(s){return JSON.parse(s)};$.isArray=Array.isArray;$.isFunction=function(f){return typeof f==="function"};$.noop=function(){};$.fn.each=function(fn){for(var i=0;i<this.length;i++)if(fn.call(this[i],i,this[i])===false)break;return this};$.fn.get=function(i){return i===void 0?toArray(this):this[i]};$.fn.not=function(exclude){var excludeArr=exclude instanceof $?toArray(exclude):Array.isArray(exclude)?exclude:[exclude];var out=[];this.each(function(){if(excludeArr.indexOf(this)===-1)out.push(this)});return $(out)};$.fn.attr=function(name,value){if(value===void 0)return this[0]?this[0].getAttribute(name):void 0;return this.each(function(){this.setAttribute(name,value)})};$.fn.prop=function(name,value){if(value===void 0)return this[0]?this[0][name]:void 0;return this.each(function(){this[name]=value})};$.fn.removeAttr=function(name){return this.each(function(){this.removeAttribute(name)})};$.fn.hasAttr=function(name){return!!(this[0]&&this[0].getAttribute(name)!=null)};var _dataCache=typeof WeakMap!=="undefined"?new WeakMap:null;function _dataStore(el,create){if(!_dataCache||!el||typeof el!=="object")return null;var s=_dataCache.get(el);if(!s&&create){s={};_dataCache.set(el,s)}return s}function _camel(k){return String(k).replace(/-([a-z])/g,function(_,c){return c.toUpperCase()})}function _parseDataAttr(v){if(v===void 0)return void 0;if(v==="true")return true;if(v==="false")return false;if(v==="null")return null;if(v!==""&&!isNaN(v)&&String(+v)===v)return+v;if(/^[\[{]/.test(v)){try{return JSON.parse(v)}catch(e){}}return v}$.fn.data=function(key,value){if(key&&typeof key==="object"){var obj=key;return this.each(function(){for(var k in obj)$(this).data(k,obj[k])})}if(value===void 0){var el=this[0];if(!el)return void 0;var store=_dataStore(el,false);var ds=el.dataset||{};if(key===void 0){var all={};for(var dk in ds)all[dk]=_parseDataAttr(ds[dk]);return Object.assign(all,store||{})}if(store&&Object.prototype.hasOwnProperty.call(store,key))return store[key];var ck=_camel(key);if(store&&Object.prototype.hasOwnProperty.call(store,ck))return store[ck];return _parseDataAttr(ds[ck])}return this.each(function(){var s=_dataStore(this,true);if(s)s[key]=value;if(this.dataset&&(value===null||typeof value!=="object")&&typeof value!=="function"){try{this.dataset[_camel(key)]=String(value)}catch(e){}}})};$.fn.removeData=function(key){return this.each(function(){var s=_dataStore(this,false);var keys=key===void 0?s?Object.keys(s):[]:String(key).split(/\s+/);for(var i=0;i<keys.length;i++){if(s){delete s[keys[i]];delete s[_camel(keys[i])]}if(this.dataset){try{delete this.dataset[_camel(keys[i])]}catch(e){}}}})};$.fn.val=function(value){if(value===void 0)return this[0]?this[0].value:void 0;return this.each(function(){this.value=value})};$.fn.html=function(value){if(value===void 0)return this[0]?this[0].innerHTML:void 0;if(typeof value!=="string"){var nodes=_normalizeAppendable([value]);return this.each(function(){this.innerHTML="";var self=this;nodes.forEach(function(n){self.appendChild(n)})})}return this.each(function(){this.innerHTML=value})};$.fn.text=function(value){if(value===void 0)return this[0]?this[0].textContent:"";return this.each(function(){this.textContent=value})};$.fn.css=function(name,value){if(typeof name==="object"){return this.each(function(){var el=this;for(var k in name)el.style[k]=name[k]})}if(value===void 0)return this[0]?getComputedStyle(this[0])[name]:void 0;return this.each(function(){this.style[name]=value})};$.fn.addClass=function(cls){var list=cls.split(/\s+/).filter(Boolean);return this.each(function(){this.classList.add.apply(this.classList,list)})};$.fn.removeClass=function(cls){var list=cls.split(/\s+/).filter(Boolean);return this.each(function(){this.classList.remove.apply(this.classList,list)})};$.fn.hasClass=function(cls){return!!(this[0]&&this[0].classList.contains(cls))};$.fn.toggleClass=function(cls,force){var list=cls.split(/\s+/).filter(Boolean);return this.each(function(){var el=this;list.forEach(function(c){el.classList.toggle(c,force)})})};$.fn.remove=function(){return this.each(function(){this.parentNode&&this.parentNode.removeChild(this)})};function _normalizeAppendable(args){var out=[];function add(item){if(item==null)return;if(Array.isArray(item)){item.forEach(add);return}if(item instanceof $){for(var i2=0;i2<item.length;i2++)add(item[i2]);return}if(typeof item==="string"){var tpl=document.createElement("template");tpl.innerHTML=item;while(tpl.content.firstChild)out.push(tpl.content.removeChild(tpl.content.firstChild));return}if(item instanceof Node){out.push(item);return}}for(var i=0;i<args.length;i++)add(args[i]);return out}$.fn.append=function(){if(arguments.length===1&&typeof arguments[0]==="string"){var html=arguments[0];return this.each(function(){this.insertAdjacentHTML("beforeend",html)})}var nodes=_normalizeAppendable(arguments);return this.each(function(){var self=this;nodes.forEach(function(n){self.appendChild(n)})})};$.fn.prepend=function(){if(arguments.length===1&&typeof arguments[0]==="string"){var html=arguments[0];return this.each(function(){this.insertAdjacentHTML("afterbegin",html)})}var nodes=_normalizeAppendable(arguments);return this.each(function(){var self=this;var ref=self.firstChild;nodes.forEach(function(n){self.insertBefore(n,ref)})})};$.fn.after=function(content){return this.each(function(){if(typeof content==="string")this.insertAdjacentHTML("afterend",content);else this.parentNode.insertBefore(content instanceof $?content[0]:content,this.nextSibling)})};$.fn.appendTo=function(target){$(target).append(this);return this};$.fn.width=function(){return this[0]?this[0].offsetWidth:0};$.fn.height=function(){return this[0]?this[0].offsetHeight:0};$.fn.innerHeight=function(){return this[0]?this[0].clientHeight:0};$.fn.innerWidth=function(){return this[0]?this[0].clientWidth:0};$.fn.scrollLeft=function(value){if(!this[0])return value===void 0?0:this;if(value===void 0)return this[0]===window?window.scrollX:this[0].scrollLeft;return this.each(function(){if(this===window)window.scrollTo(value,window.scrollY);else this.scrollLeft=value})};$.fn.scrollTop=function(value){if(!this[0])return value===void 0?0:this;if(value===void 0)return this[0]===window?window.scrollY:this[0].scrollTop;return this.each(function(){if(this===window)window.scrollTo(window.scrollX,value);else this.scrollTop=value})};$.fn.outerWidth=function(includeMargin){if(!this[0])return 0;var w=this[0].offsetWidth;if(includeMargin){var s=getComputedStyle(this[0]);w+=parseFloat(s.marginLeft||0)+parseFloat(s.marginRight||0)}return w};$.fn.outerHeight=function(includeMargin){if(!this[0])return 0;var h=this[0].offsetHeight;if(includeMargin){var s=getComputedStyle(this[0]);h+=parseFloat(s.marginTop||0)+parseFloat(s.marginBottom||0)}return h};$.fn.offset=function(){if(!this[0])return null;var rect=this[0].getBoundingClientRect();var docEl=document.documentElement;return{top:rect.top+(window.pageYOffset||docEl.scrollTop)-(docEl.clientTop||0),left:rect.left+(window.pageXOffset||docEl.scrollLeft)-(docEl.clientLeft||0)}};$.fn.parent=function(){return $(this[0]?this[0].parentElement:null)};$.fn.next=function(){return $(this[0]?this[0].nextElementSibling:null)};$.fn.closest=function(sel){return $(this[0]?this[0].closest(sel):null)};$.fn.find=function(sel){var out=[];if(sel&&typeof sel==="object"){var cands=toArray(sel instanceof $?sel:[sel]);var self=toArray(this);return $(cands.filter(function(c){return self.some(function(p){return p!==c&&p.contains(c)})}))}this.each(function(){var found=_jqSelect(this,sel);for(var i=0;i<found.length;i++)if(out.indexOf(found[i])===-1)out.push(found[i])});return $(out)};var JQUERY_PSEUDOS={":checkbox":function(el){return el.tagName==="INPUT"&&el.type==="checkbox"},":radio":function(el){return el.tagName==="INPUT"&&el.type==="radio"},":checked":function(el){return!!el.checked}};JQUERY_PSEUDOS[":selected"]=function(el){return!!el.selected};JQUERY_PSEUDOS[":visible"]=function(el){return!!(el.offsetWidth||el.offsetHeight||el.getClientRects().length)};JQUERY_PSEUDOS[":hidden"]=function(el){return!JQUERY_PSEUDOS[":visible"](el)};$.fn.is=function(sel){if(!this[0])return false;if(typeof sel==="function"){var s=this;return toArray(this).some(function(el,i){return sel.call(el,i,el)})}if(sel&&typeof sel==="object"){var set=toArray(sel instanceof $?sel:[sel]);return toArray(this).some(function(el){return set.indexOf(el)!==-1})}if(JQUERY_PSEUDOS[sel])return JQUERY_PSEUDOS[sel](this[0]);var rewritten=sel;for(var r=0;r<JQ_REWRITES.length;r++)rewritten=rewritten.replace(JQ_REWRITES[r][0],JQ_REWRITES[r][1]);try{return this[0].matches(rewritten)}catch(e){return false}};$.fn.ready=function(fn){if(document.readyState!=="loading")fn($);else document.addEventListener("DOMContentLoaded",function(){fn($)});return this};function _filterBySel(els,sel){if(!sel)return els;return els.filter(function(el){return $(el).is(sel)})}$.fn.eq=function(i){i=+i;if(i<0)i+=this.length;return $(this[i]?[this[i]]:[])};$.fn.first=function(){return this.eq(0)};$.fn.last=function(){return this.eq(-1)};$.fn.index=function(target){if(target===void 0){var el=this[0];if(!el||!el.parentElement)return-1;return toArray(el.parentElement.children).indexOf(el)}var node=target instanceof $?target[0]:typeof target==="string"?null:target;if(typeof target==="string")return toArray($(target)).indexOf(this[0]);return toArray(this).indexOf(node)};$.fn.add=function(sel,ctx){var out=toArray(this);toArray(typeof sel==="string"&&sel.trim()[0]!=="<"?$(sel,ctx):$(sel)).forEach(function(x){if(out.indexOf(x)===-1)out.push(x)});return $(out)};$.fn.children=function(sel){var out=[];this.each(function(){out.push.apply(out,toArray(this.children||[]))});return $(_filterBySel(out,sel))};$.fn.contents=function(){var out=[];this.each(function(){out.push.apply(out,toArray(this.childNodes||[]))});return $(out)};$.fn.siblings=function(sel){var out=[];this.each(function(){var me=this;if(!me.parentElement)return;toArray(me.parentElement.children).forEach(function(c){if(c!==me&&out.indexOf(c)===-1)out.push(c)})});return $(_filterBySel(out,sel))};$.fn.prev=function(sel){var out=[];this.each(function(){var p=this.previousElementSibling;if(p)out.push(p)});return $(_filterBySel(out,sel))};$.fn.prevAll=function(sel){var out=[];this.each(function(){var p=this.previousElementSibling;while(p){if(out.indexOf(p)===-1)out.push(p);p=p.previousElementSibling}});return $(_filterBySel(out,sel))};$.fn.nextAll=function(sel){var out=[];this.each(function(){var n=this.nextElementSibling;while(n){if(out.indexOf(n)===-1)out.push(n);n=n.nextElementSibling}});return $(_filterBySel(out,sel))};$.fn.parents=function(sel){var out=[];this.each(function(){var p=this.parentElement;while(p){if(out.indexOf(p)===-1)out.push(p);p=p.parentElement}});return $(_filterBySel(out,sel))};$.fn.filter=function(sel){var els=toArray(this);if(typeof sel==="function")return $(els.filter(function(el,i){return sel.call(el,i,el)}));return $(_filterBySel(els,sel))};$.fn.has=function(sel){return $(toArray(this).filter(function(el){return $(el).find(sel).length>0}))};$.fn.map=function(fn){var out=[];this.each(function(i,el){var r=fn.call(el,i,el);if(r!=null)Array.isArray(r)?out.push.apply(out,r):out.push(r)});return $(out)};$.fn.toArray=function(){return toArray(this)};function _isHidden(el){return el.style.display==="none"||window.getComputedStyle&&getComputedStyle(el).display==="none"}function _show(el){if(el.style.display==="none")el.style.display=el._lmOldDisplay||"";if(window.getComputedStyle&&getComputedStyle(el).display==="none")el.style.display=el._lmOldDisplay||"block"}function _hide(el){if(el.style.display&&el.style.display!=="none")el._lmOldDisplay=el.style.display;el.style.display="none"}function _timedArgs(a,b,c){var cb=[a,b,c].filter(function(x){return typeof x==="function"})[0];var ms=typeof a==="number"?a:a==="slow"?600:a==="fast"?200:a&&typeof a==="object"&&a.duration||0;return{ms,cb}}function _visibilityMethod(apply){return function(a,b,c){var t=_timedArgs(a,b,c),self=this;this.each(function(){apply(this)});if(t.cb)setTimeout(function(){self.each(function(){t.cb.call(this)})},t.ms);return this}}$.fn.show=_visibilityMethod(_show);$.fn.hide=_visibilityMethod(_hide);$.fn.fadeIn=$.fn.show;$.fn.fadeOut=$.fn.hide;$.fn.slideDown=$.fn.show;$.fn.slideUp=$.fn.hide;$.fn.toggle=function(state){if(typeof state==="boolean")return state?this.show():this.hide();var t=_timedArgs.apply(null,arguments),self=this;this.each(function(){_isHidden(this)?_show(this):_hide(this)});if(t.cb)setTimeout(function(){self.each(function(){t.cb.call(this)})},t.ms);return this};$.fn.fadeToggle=$.fn.toggle;$.fn.slideToggle=$.fn.toggle;$.fn.empty=function(){return this.each(function(){while(this.firstChild)this.removeChild(this.firstChild)})};$.fn.before=function(content){return this.each(function(){var t=this;_normalizeAppendable([content]).forEach(function(n){t.parentNode&&t.parentNode.insertBefore(n,t)})})};$.fn.wrap=function(wrapper){return this.each(function(){var w=_normalizeAppendable([wrapper]).filter(function(n){return n.nodeType===1})[0];if(!w||!this.parentNode)return;w=w.cloneNode(true);this.parentNode.insertBefore(w,this);var inner=w;while(inner.firstElementChild)inner=inner.firstElementChild;inner.appendChild(this)})};$.fn.unwrap=function(){var parents=[];this.each(function(){var p=this.parentElement;if(p&&p!==document.body&&parents.indexOf(p)===-1)parents.push(p)});parents.forEach(function(p){while(p.firstChild)p.parentNode.insertBefore(p.firstChild,p);p.parentNode.removeChild(p)});return this};$.fn.clone=function(){return $(toArray(this).map(function(el){return el.cloneNode(true)}))};$.fn.position=function(){var el=this[0];if(!el)return void 0;return{top:el.offsetTop,left:el.offsetLeft}};["ajaxStart","ajaxStop","ajaxSend","ajaxSuccess","ajaxError","ajaxComplete"].forEach(function(name){$.fn[name]=function(fn){return this.on(name,fn)}});var EVENT_NAME_MAP={focus:"focusin",blur:"focusout"};var _eventBuses=typeof WeakMap!=="undefined"?new WeakMap:null;function _isNode(x){return x===window||x===document||typeof Node!=="undefined"&&x instanceof Node}function _isRealEventTarget(x){return x!=null&&typeof x.addEventListener==="function"&&typeof x.dispatchEvent==="function"}function _eventTargetFor(x){if(_isNode(x)||_isRealEventTarget(x))return x;if(!_eventBuses.has(x))_eventBuses.set(x,new EventTarget);return _eventBuses.get(x)}var AT_ATTR_SELECTOR=/^\[\\@([\w-]+)\]$/;function _callHandler(handler,ctx,e){var extra=e.__lmArgs;if(extra===void 0)return handler.call(ctx,e);return handler.apply(ctx,[e].concat(Array.isArray(extra)?extra:[extra]))}$.fn.on=function(events,selector,data,handler){if(typeof selector==="function"){handler=selector;selector=null}else if(typeof data==="function"&&handler===void 0){handler=data}else if(typeof handler!=="function"&&typeof data==="function"){handler=data}if(typeof selector!=="string")selector=null;if(typeof handler!=="function")return this;var evts=String(events).split(/\s+/).filter(Boolean);var atParts=selector?selector.split(",").map(function(p){return p.trim()}):[];var atAttrs=atParts.length&&atParts.every(function(p){return AT_ATTR_SELECTOR.test(p)})?atParts.map(function(p){return"@"+AT_ATTR_SELECTOR.exec(p)[1]}):null;var atAttr=!!atAttrs;function _hasAnyAt(el){for(var i=0;i<atAttrs.length;i++)if(el.getAttribute(atAttrs[i])!=null)return true;return false}return this.each(function(){var node=this;var bus=_eventTargetFor(node);evts.forEach(function(evtFull){var dot=evtFull.indexOf(".");var evt=dot===-1?evtFull:evtFull.slice(0,dot);var ns=dot===-1?"":evtFull.slice(dot+1);if(!evt)return;function listen(realName,wrapper){bus.addEventListener(realName,wrapper);_recordListener(bus,{type:evt,ns,selector,handler,real:realName,wrapper})}if(evt==="mouseenter"||evt==="mouseleave"){var realType=evt==="mouseenter"?"mouseover":"mouseout";listen(realType,function(e){var related=e.relatedTarget;if(atAttr){var el=e.target;var match=null;while(el&&el.nodeType===1){if(_hasAnyAt(el)){match=el;break}el=el.parentElement}if(match&&node.contains(match)&&!(related&&match.contains(related))){_callHandler(handler,match,e)}}else if(selector&&_isNode(node)){var match2=e.target.closest(selector);if(match2&&node.contains(match2)&&!(related&&match2.contains(related))){_callHandler(handler,match2,e)}}else if(!(related&&node.contains(related))){_callHandler(handler,node,e)}});return}var real=EVENT_NAME_MAP[evt]||evt;listen(real,function(e){if(atAttr||selector&&_isNode(node)){for(var el=e.target;el&&el.nodeType===1&&node.contains(el);el=el.parentElement){var hit=atAttr?_hasAnyAt(el):el.matches&&el.matches(selector);if(!hit)continue;var ret=_callHandler(handler,el,e);if(ret===false){e.preventDefault();e.stopPropagation()}if(e.cancelBubble)break}}else{_callHandler(handler,node,e)}})})})};$.fn.live=function(events,data,handler){if(this.selector&&typeof this.selector==="string")$(document).on(events,this.selector,data,handler);else this.on(events,data,handler);return this};$.fn.click=function(handler){return handler?this.on("click",handler):this.trigger("click")};$.fn.keydown=function(handler){return handler?this.on("keydown",handler):this.trigger("keydown")};$.fn.trigger=function(type,data){return this.each(function(){var bus=_eventTargetFor(this);var ev;if(type instanceof Event){ev=type}else if(type&&typeof type==="object"&&typeof type.type==="string"){ev=new Event(type.type,{bubbles:_isNode(this)});for(var k in type){if(k!=="type"&&Object.prototype.hasOwnProperty.call(type,k)){try{ev[k]=type[k]}catch(e){}}}}else{ev=new Event(type,{bubbles:_isNode(this)})}if(data!==void 0){ev.__lmArgs=data;try{if(ev.detail===void 0||ev.detail===null)ev.detail=data}catch(e){}}bus.dispatchEvent(ev)})};var _listenerRegistry=typeof WeakMap!=="undefined"?new WeakMap:null;function _recordListener(bus,rec){if(!_listenerRegistry)return;var list=_listenerRegistry.get(bus);if(!list){list=[];_listenerRegistry.set(bus,list)}list.push(rec)}$.fn.off=function(events,selector,handler){if(typeof selector==="function"){handler=selector;selector=void 0}var specs=events===void 0?[{type:"",ns:""}]:String(events).split(/\s+/).filter(Boolean).map(function(e){var d=e.indexOf(".");return{type:d===-1?e:e.slice(0,d),ns:d===-1?"":e.slice(d+1)}});return this.each(function(){if(!_listenerRegistry)return;var bus=_eventTargetFor(this);var list=_listenerRegistry.get(bus);if(!list)return;for(var i=list.length-1;i>=0;i--){var r=list[i];var hit=specs.some(function(sp){return(!sp.type||sp.type===r.type)&&(!sp.ns||sp.ns===r.ns)});if(!hit)continue;if(selector!==void 0&&selector!=="**"&&r.selector!==selector)continue;if(handler&&r.handler!==handler)continue;bus.removeEventListener(r.real,r.wrapper);list.splice(i,1)}})};$.fn.unbind=function(events,handler){return this.off(events,handler)};$.fn.bind=function(events,data,handler){return this.on(events,null,data,handler)};$.fn.one=function(events,selector,data,handler){var args=[].slice.call(arguments),fn=null,idx=-1;for(var i=args.length-1;i>=0;i--)if(typeof args[i]==="function"){fn=args[i];idx=i;break}if(!fn)return this;var self=this;args[idx]=function once(e){self.off(events,once);return fn.apply(this,arguments)};return this.on.apply(this,args)};$.fn.die=function(events,handler){if(this.selector&&typeof this.selector==="string")$(document).off(events,this.selector,handler);return this};["click","dblclick","keyup","keydown","keypress","focus","blur","change","submit","focusin","focusout","mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove","resize","scroll","load","select"].forEach(function(name){$.fn[name]=function(handler){return handler?this.on(name,handler):this.trigger(name)}});$.fn.hover=function(enter,leave){this.on("mouseenter",enter);this.on("mouseleave",leave||enter);return this};var _animTimers=new WeakMap;function _animGetScroll(el,prop){if(el===window)return prop==="scrollLeft"?window.pageXOffset:window.pageYOffset;return el[prop]}function _animSetScroll(el,prop,val){if(el===window){if(prop==="scrollLeft")window.scrollTo(val,window.pageYOffset);else window.scrollTo(window.pageXOffset,val)}else{el[prop]=val}}var _cssNumberProps={opacity:1,zIndex:1,zoom:1,fontWeight:1,lineHeight:1,columnCount:1,flexGrow:1,flexShrink:1,order:1,widows:1,orphans:1};function _animSetStyle(el,prop,val){el.style[prop]=_cssNumberProps[prop]?val:val+"px"}$.fn.animate=function(props,options){var opts=typeof options==="number"?{duration:options}:options||{};var duration=opts.duration==null?400:opts.duration;this.each(function(){var el=this;var isWindowScroll=el===document.documentElement||el===document.body;var target=isWindowScroll?window:el;var start={};var isScrollProp={};for(var prop in props){if(!Object.prototype.hasOwnProperty.call(props,prop))continue;isScrollProp[prop]=prop==="scrollTop"||prop==="scrollLeft";if(isScrollProp[prop]){start[prop]=_animGetScroll(isWindowScroll?window:el,prop)}else{start[prop]=parseFloat(getComputedStyle(el)[prop])||0}}var existing=_animTimers.get(el);if(existing)cancelAnimationFrame(existing);if(duration===0){for(var p in props){var v=parseFloat(props[p]);if(isScrollProp[p])_animSetScroll(isWindowScroll?window:el,p,v);else _animSetStyle(el,p,v)}if(opts.complete)opts.complete.call(el);return}var startTime=null;function step(ts){if(startTime===null)startTime=ts;var elapsed=ts-startTime;var t=Math.min(1,elapsed/duration);for(var p2 in props){if(!Object.prototype.hasOwnProperty.call(props,p2))continue;var end=parseFloat(props[p2]);var val=start[p2]+(end-start[p2])*t;if(isScrollProp[p2])_animSetScroll(isWindowScroll?window:el,p2,val);else _animSetStyle(el,p2,val)}if(t<1){_animTimers.set(el,requestAnimationFrame(step))}else{_animTimers.delete(el);if(opts.complete)opts.complete.call(el)}}_animTimers.set(el,requestAnimationFrame(step))});return this};$.fn.stop=function(){this.each(function(){var id=_animTimers.get(this);if(id){cancelAnimationFrame(id);_animTimers.delete(this)}});return this};var _queues=new WeakMap;function _getQueue(el,name){var byName=_queues.get(el);if(!byName){byName={};_queues.set(el,byName)}if(!byName[name])byName[name]={items:[],running:false};return byName[name]}function _dequeue(el,name){var q=_getQueue(el,name);if(q.running)return;var next=q.items.shift();if(!next)return;q.running=true;next.call(el,function(){q.running=false;_dequeue(el,name)})}$.fn.queue=function(name,fn){if(typeof name==="function"){fn=name;name="fx"}name=name||"fx";if(fn===void 0)return _getQueue(this[0],name).items;return this.each(function(){_getQueue(this,name).items.push(fn);_dequeue(this,name)})};$.fn.dequeue=function(name){return this.each(function(){_dequeue(this,name||"fx")})};$.fn.delay=function(ms,name){name=name||"fx";return this.each(function(){_getQueue(this,name).items.push(function(next){setTimeout(next,ms)});_dequeue(this,name)})};$.fn.serializeArray=function(){var result=[];this.each(function(){if(this.tagName!=="FORM")return;var elements=this.elements?Array.prototype.slice.call(this.elements):[];elements.forEach(function(field){if(!field.name||field.disabled)return;var tag=field.tagName.toLowerCase();var type=(field.type||tag).toLowerCase();if(type==="submit"||type==="button"||type==="reset"||type==="fieldset")return;if((type==="checkbox"||type==="radio")&&!field.checked)return;if(type==="file"){var files=field.files?Array.prototype.map.call(field.files,function(f){return f.name}):[];result.push({name:field.name,value:files,type});return}if(tag==="select"&&field.multiple){Array.prototype.forEach.call(field.selectedOptions||[],function(opt){result.push({name:field.name,value:opt.value,type})});return}result.push({name:field.name,value:field.value,type})})});return result};$.fn.ajaxForm=function(options){options=options||{};return this.each(function(){var formEl=this;var $form=$(formEl);formEl.addEventListener("submit",function(ev){ev.preventDefault();var formData=$form.serializeArray();if(typeof options.beforeSubmit==="function"){options.beforeSubmit(formData,$form,options)}})})};if(!global.jQuery||!global.jQuery.fn||global.jQuery.fn.jquery==="lumenjs-shim"){global.$=$;global.jQuery=$}})(typeof window!=="undefined"?window:globalThis);
3
3
 
4
4
  !function(t){"use strict";var e=null,r=null,n=null,i=null,l=null,o=window,s="WebWorker",a=null,u=null,f=null,p=null,g=null,c=null,h=null;function _(t){return function(e){var r=this._callbackStack[t];return"function"==typeof e&&r.push(e),this}}for(h in null!==(e=(i=i||o)[l=l||s]||null)&&(r=e),c=Array.prototype.slice,n=window.Worker,e=function(){this._constructor.apply(this,arguments)},e.prototype._$=null,e.prototype._callbackStack=null,e.prototype._lastError=null,e.prototype._log=null,e.prototype._nativeWorker=null,e.prototype._state=null,e.prototype._workerBlobUrl=null,e.prototype._workerScript=null,e.prototype._workerUrl=null,e.prototype._constructor=function(e){var r=null,n=null,i=null;if(Object.defineProperty(this,"_$",{configurable:!1,enumerable:!0,value:t(this),writable:!1}),null===(e=e||null)&&this.throwError(g.INVALID_ARGUMENTS,null,!0),"string"==typeof e){let l="";e=t.trim(e);try{window.hasOwnProperty(e)&&"string"==typeof window[e]?(l=window[e],this._workerScript=l):r=t(e)}catch(t){}null!==r&&r.length>0?(n=r.text(),this._workerScript=n):""==l&&(i=e)}this._workerUrl=i,this._callbackStack={error:[],loading:[],loaded:[],starting:[],started:[],terminating:[],terminated:[]},this._assignEventHandlers(),this._state=a.INITIALIZED,this.trigger(f.INITIALIZED)},e.prototype._initLog=function(){return this._log=[],this._log},e.prototype.getUrl=function(){return this._workerUrl},e.prototype.getBlobUrl=function(){return this._workerBlobUrl},e.prototype.getLog=function(){return this._log||this._initLog()},e.prototype.getNativeWorker=function(){return this._nativeWorker},e.prototype.getState=function(){return this._state},e.prototype.isLoading=function(){return this.getState()===a.LOADING},e.prototype.isLoaded=function(){return this.getState()>=a.LOADED&&!this.isTerminated()},e.prototype.isStarting=function(){return this.getState()===a.STARTING},e.prototype.isStarted=function(){return this.getState()>=a.STARTED&&!this.isTerminated()},e.prototype.isTerminating=function(){return this.getState()===a.TERMINATING},e.prototype.isTerminated=function(){return this.getState()===a.TERMINATED},e.prototype.load=function(){var r,n,i=this;return i.isLoading()||i.isLoaded()||(i.trigger(f.WORKER_LOADING),r=i.getUrl()||null,n=function(){var t,r=null;r=i._workerScript,r=e._workerScriptWrapper.replace(/\{\{main-function\}\}/g,r),t=new window.Blob([r],{type:"text/javascript"}),i._workerBlobUrl=window.URL.createObjectURL(t),i._createWorker()},null===r?n():t.ajax({async:!0,url:r,dataType:"text",crossDomain:!0,success:function(t){i._workerScript=t,n()},error:function(){i.throwError(g.WORKER_DID_NOT_LOAD,arguments)}})),i},e.prototype.log=function(t){return(this._log||this._initLog()).push(t),this},e.prototype._createWorker=function(){return this._nativeWorker=new n(this.getBlobUrl()),this._attachMessageParser(),this},e.prototype._assignEventHandlers=function(){function t(t){return function(){var e,r,n=this._callbackStack[t];(e=t.toUpperCase())in a&&(this._state=a[e]);for(;r=n.pop();)r.apply(this,arguments)}}return this.on(f.ERROR,t("error")),this.on(f.WORKER_LOADING,t("loading")),this.on(f.WORKER_LOADED,t("loaded")),this.on(f.WORKER_STARTING,t("starting")),this.on(f.WORKER_STARTED,t("started")),this.on(f.WORKER_TERMINATING,t("terminating")),this.on(f.WORKER_TERMINATED,t("terminated")),this},e.prototype.error=_("error"),e.prototype.loading=_("loading"),e.prototype.loaded=_("loaded"),e.prototype.starting=_("starting"),e.prototype.started=_("started"),e.prototype.terminating=_("terminating"),e.prototype.terminated=_("terminated"),e.prototype.start=function(){var t;return this.isStarting()||this.isStarted()?this:(t=c.call(arguments),this.isLoaded()?(this.trigger(f.WORKER_STARTING),this.sendMessage(u.START,t),this):(this.on(f.WORKER_LOADED,(function(){this.start.apply(this,t)})),this.load(),this))},e.prototype.sendMessage=function(t,e){var r=null,n=null;return e=e||null,null===(t=t||null)||((n={__isWebWorkerMsg:!0}).action=t,n.args=e,(r=this.getNativeWorker())&&r.postMessage(n)),this},e.prototype._attachMessageParser=function(){var e=null;return(e=t(this.getNativeWorker())).on("message",t.proxy((function(t){var e=(t.originalEvent||t).data,r=null,n=null;"object"==typeof e&&"__isWebWorkerMsg"in e&&e.__isWebWorkerMsg&&(r=e.action,n=e.args,this[r].apply(this,n))}),this)),e.on("error",t.proxy(this.throwError,this)),this},e.prototype.terminate=function(){return(this.getNativeWorker()||null)&&(this.trigger(f.WORKER_TERMINATING),this.sendMessage(u.TERMINATE,c.call(arguments))),this},e.prototype.terminateNow=function(){var t=null;return this.isTerminating()||this.trigger(f.WORKER_TERMINATING),(t=this.getNativeWorker()||null)&&(t.terminate(),this._nativeWorker=null,this.trigger(f.WORKER_TERMINATED)),this},e.prototype.on=function(){var t=this._$;return t.on.apply(t,arguments),this},e.prototype.one=function(){var t=this._$;return t.one.apply(t,arguments),this},e.prototype.off=function(){var t=this._$;return t.off.apply(t,arguments),this._assignEventHandlers(),this},e.prototype.trigger=function(e){var r=!1,n=null,i=null;return"object"==typeof e&&(n=e.type||null),"string"==typeof e&&(n=e||null,r=!0),null===n?this:n in p?(r&&(e=new t.Event(n)),e.worker=this,i=[e],arguments.length>1&&(i=i.concat(c.call(arguments,1))),this._triggerSelf.apply(this,i),this):(r&&(e={type:n,data:arguments[1]?arguments[1]:{}}),i=[e],this.sendMessage(u.TRIGGER_SELF,i),this)},e.prototype.triggerSelf=function(e){var r=null,n=null;return null===(e=e||null)||("string"==typeof e&&(r=e,e=new t.Event(r)),e.originalEvent=e.originalEvent||e,e.worker=this,n=[e],arguments.length>1&&(n=n.concat(c.call(arguments,1))),this._triggerSelf.apply(this,n)),this},e.prototype._triggerSelf=function(){var t=null;return(t=this._$).trigger.apply(t,arguments),this},e.prototype.throwError=function(t,r,n){var i=null;if("object"==typeof(t=t||g.UNKNOWN)&&(i=(t=t.originalEvent||t).data||null),i=void 0===r?i:r,n=n||!1,this._lastError=t,e._lastError=t,"_triggerError"in this&&this._triggerError(t,r,n),n)throw new window.Error(t);return this},e.prototype._triggerError=function(e,r,n){var i=null;return(i=new t.Event(f.ERROR)).message=this.getLastError(),i.errorData=r,i.throwsException=!!n,this.trigger(i),this},e.prototype.getLastError=function(){return this._lastError},e._lastError=null,a={INITIALIZED:0,LOADING:1,LOADED:2,STARTING:3,STARTED:4,TERMINATING:5,TERMINATED:6},e.State=a,u={LOG:"log",START:"start",TERMINATE:"terminate",TERMINATE_NOW:"terminateNow",TRIGGER:"trigger",TRIGGER_SELF:"triggerSelf"},e.Action=u,f={INITIALIZED:"initialized",ERROR:"error",WORKER_LOADING:"worker-loading",WORKER_LOADED:"worker-loaded",WORKER_STARTING:"worker-starting",WORKER_STARTED:"worker-started",WORKER_TERMINATING:"worker-terminating",WORKER_TERMINATED:"worker-terminated"},e.Event=f,p={},e.EventMap=p,f)f[h]="webworker:"+f[h],p[f[h]]=h;g={UNKNOWN:"An unknown error occured.",INVALID_ARGUMENTS:"Invalid arguments were supplied to this method.",WORKER_DID_NOT_LOAD:"Unable to load worker."},e.Error=g,e._workerScriptWrapper='var e=null,t=null,n=null,r={};e={{state-data}};t={{action-data}};n={{event-data}};self._callbackStack=null;self._listeners=r;self._isTerminating=false;self._state=null;self.State=e;self.Action=t;self.Event=n;self._assignEventHandlers=function(){function t(t){return function(){var n=self._callbackStack[t],r,i;r=t.toUpperCase();if(r in e){self._state=e[r]}while(i=n.pop()){i.apply(self,arguments)}}}self.on(n.WORKER_TERMINATING,t("terminating"));return self};self.getState=function(){return this._state};self.isInitialized=function(){var e=self.getState();return e!==null&&e>=0};self.isTerminating=function(){return self.getState()===e.TERMINATING};self._main=function(){var startArgs=arguments;{{main-function}};return self};self._init=function(){self._callbackStack={terminating:[]};self._assignEventHandlers();self._state=e.INITIALIZED;self.trigger(n.WORKER_LOADED);return self};self.start=function(){if(!self.isInitialized()){return self}self.triggerSelf(n.WORKER_STARTING);self._main.apply(self,arguments);self.triggerSelf(n.WORKER_STARTED);self.trigger(n.WORKER_STARTED);return self};self.log=function(e){self.sendMessage(t.LOG,[e]);return self};self.on=function(e,t){e+="";t=t||null;if(typeof t!=="function"){return self}if(!(e in r)){r[e]=[]}r[e].push(t);return self};self.one=function(e,t){var n=null;n=function(){t.apply(this,arguments);self.off(e,n);return};self.on(e,n);return};self.off=function(e,t){var n=null;e=e||null;t=t||null;if(e===null&&t===null){for(n in r){delete r[n]}self._assignEventHandlers();return self}self._removeListenerFromEventType(e,t);return self};self._removeListenerFromEventType=function(e,t){var n=r[e],i=0;t=t||null;if(t===null){r[e]=[];return self}for(;i<n.length;i++){if(n[i]===t){n.splice(i,1);i--}}return self};self.terminating=function(e){var t=self._callbackStack.terminating;if(typeof e==="function"){t.push(e)}return self};self.trigger=function(e,n){var r=null;e=e||null;if(e===null){return self}if(typeof e==="string"){r=e||null;e={type:r}}else if(typeof e==="object"){r=e.type||null;n=e.data}if(r===null){return self}e.data=n;self.sendMessage(t.TRIGGER_SELF,[e]);return self};self.triggerSelf=function(e,t){var n=null,i=null,s=null,o=null,u=0;e=e||null;if(e===null){return this}if(typeof e==="string"){n=e||null;e={type:e}}else if(typeof e==="object"){n=e.type||null;t=e.data}if(n===null){return this}e.data=t;i=r[n]||null;if(i===null){return this}s=i.length;for(u=0;u<s;u++){o=i[u];o.apply(this,[e]);if(s!==i.length){u--;s=i.length}}return this};self.sendMessage=function(e,t){var n=null;e=e||null;t=t||[];if(e===null){return self}n={__isWebWorkerMsg:true};n.action=e;n.args=t;self.postMessage(n);return self};self.terminate=function(e){e=!!e;if(!self.isTerminating()){self._setTerminatingStatus();self.triggerSelf(n.WORKER_TERMINATING);self.trigger(n.WORKER_TERMINATING)}self.sendMessage(t.TERMINATE_NOW,[]);if(e){self._nativeClose()}return self};self.terminateNow=function(){return self.terminate(true)};self._setTerminatingStatus=function(){self._state=e.TERMINATING;return self};self._nativeClose=self.close;self.close=self.terminate;self.addEventListener("message",function(e){var t=e.originalEvent||e,n=t.data,r=null,i=null;if(typeof n==="object"&&"__isWebWorkerMsg"in n&&n.__isWebWorkerMsg){r=n.action;i=n.args;self[r].apply(self,i)}},false);self._init()',e._workerScriptWrapper=e._workerScriptWrapper.replace(/\{\{state-data\}\}/g,JSON.stringify(a)).replace(/\{\{action-data\}\}/g,JSON.stringify(u)).replace(/\{\{event-data\}\}/g,JSON.stringify(f)),e.getLastError=e.prototype.getLastError,e.noConflict=function(t,n){return t=t||null,n=n||null,o[s]===e&&(delete o[s],r&&(o[s]=r)),t&&n&&(t[n]=e),e},i[l]=e}(jQuery);
5
5
  !function(n){"use strict";function d(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function f(n,t,r,e,o,u){return d((u=d(d(t,n),d(e,u)))<<o|u>>>32-o,r)}function l(n,t,r,e,o,u,c){return f(t&r|~t&e,n,t,o,u,c)}function g(n,t,r,e,o,u,c){return f(t&e|r&~e,n,t,o,u,c)}function v(n,t,r,e,o,u,c){return f(t^r^e,n,t,o,u,c)}function m(n,t,r,e,o,u,c){return f(r^(t|~e),n,t,o,u,c)}function c(n,t){var r,e,o,u;n[t>>5]|=128<<t%32,n[14+(t+64>>>9<<4)]=t;for(var c=1732584193,f=-271733879,i=-1732584194,a=271733878,h=0;h<n.length;h+=16)c=l(r=c,e=f,o=i,u=a,n[h],7,-680876936),a=l(a,c,f,i,n[h+1],12,-389564586),i=l(i,a,c,f,n[h+2],17,606105819),f=l(f,i,a,c,n[h+3],22,-1044525330),c=l(c,f,i,a,n[h+4],7,-176418897),a=l(a,c,f,i,n[h+5],12,1200080426),i=l(i,a,c,f,n[h+6],17,-1473231341),f=l(f,i,a,c,n[h+7],22,-45705983),c=l(c,f,i,a,n[h+8],7,1770035416),a=l(a,c,f,i,n[h+9],12,-1958414417),i=l(i,a,c,f,n[h+10],17,-42063),f=l(f,i,a,c,n[h+11],22,-1990404162),c=l(c,f,i,a,n[h+12],7,1804603682),a=l(a,c,f,i,n[h+13],12,-40341101),i=l(i,a,c,f,n[h+14],17,-1502002290),c=g(c,f=l(f,i,a,c,n[h+15],22,1236535329),i,a,n[h+1],5,-165796510),a=g(a,c,f,i,n[h+6],9,-1069501632),i=g(i,a,c,f,n[h+11],14,643717713),f=g(f,i,a,c,n[h],20,-373897302),c=g(c,f,i,a,n[h+5],5,-701558691),a=g(a,c,f,i,n[h+10],9,38016083),i=g(i,a,c,f,n[h+15],14,-660478335),f=g(f,i,a,c,n[h+4],20,-405537848),c=g(c,f,i,a,n[h+9],5,568446438),a=g(a,c,f,i,n[h+14],9,-1019803690),i=g(i,a,c,f,n[h+3],14,-187363961),f=g(f,i,a,c,n[h+8],20,1163531501),c=g(c,f,i,a,n[h+13],5,-1444681467),a=g(a,c,f,i,n[h+2],9,-51403784),i=g(i,a,c,f,n[h+7],14,1735328473),c=v(c,f=g(f,i,a,c,n[h+12],20,-1926607734),i,a,n[h+5],4,-378558),a=v(a,c,f,i,n[h+8],11,-2022574463),i=v(i,a,c,f,n[h+11],16,1839030562),f=v(f,i,a,c,n[h+14],23,-35309556),c=v(c,f,i,a,n[h+1],4,-1530992060),a=v(a,c,f,i,n[h+4],11,1272893353),i=v(i,a,c,f,n[h+7],16,-155497632),f=v(f,i,a,c,n[h+10],23,-1094730640),c=v(c,f,i,a,n[h+13],4,681279174),a=v(a,c,f,i,n[h],11,-358537222),i=v(i,a,c,f,n[h+3],16,-722521979),f=v(f,i,a,c,n[h+6],23,76029189),c=v(c,f,i,a,n[h+9],4,-640364487),a=v(a,c,f,i,n[h+12],11,-421815835),i=v(i,a,c,f,n[h+15],16,530742520),c=m(c,f=v(f,i,a,c,n[h+2],23,-995338651),i,a,n[h],6,-198630844),a=m(a,c,f,i,n[h+7],10,1126891415),i=m(i,a,c,f,n[h+14],15,-1416354905),f=m(f,i,a,c,n[h+5],21,-57434055),c=m(c,f,i,a,n[h+12],6,1700485571),a=m(a,c,f,i,n[h+3],10,-1894986606),i=m(i,a,c,f,n[h+10],15,-1051523),f=m(f,i,a,c,n[h+1],21,-2054922799),c=m(c,f,i,a,n[h+8],6,1873313359),a=m(a,c,f,i,n[h+15],10,-30611744),i=m(i,a,c,f,n[h+6],15,-1560198380),f=m(f,i,a,c,n[h+13],21,1309151649),c=m(c,f,i,a,n[h+4],6,-145523070),a=m(a,c,f,i,n[h+11],10,-1120210379),i=m(i,a,c,f,n[h+2],15,718787259),f=m(f,i,a,c,n[h+9],21,-343485551),c=d(c,r),f=d(f,e),i=d(i,o),a=d(a,u);return[c,f,i,a]}function i(n){for(var t="",r=32*n.length,e=0;e<r;e+=8)t+=String.fromCharCode(n[e>>5]>>>e%32&255);return t}function a(n){var t=[];for(t[(n.length>>2)-1]=void 0,e=0;e<t.length;e+=1)t[e]=0;for(var r=8*n.length,e=0;e<r;e+=8)t[e>>5]|=(255&n.charCodeAt(e/8))<<e%32;return t}function e(n){for(var t,r="0123456789abcdef",e="",o=0;o<n.length;o+=1)t=n.charCodeAt(o),e+=r.charAt(t>>>4&15)+r.charAt(15&t);return e}function r(n){return unescape(encodeURIComponent(n))}function o(n){return i(c(a(n=r(n)),8*n.length))}function u(n,t){return function(n,t){var r,e=a(n),o=[],u=[];for(o[15]=u[15]=void 0,16<e.length&&(e=c(e,8*n.length)),r=0;r<16;r+=1)o[r]=909522486^e[r],u[r]=1549556828^e[r];return t=c(o.concat(a(t)),512+8*t.length),i(c(u.concat(t),640))}(r(n),r(t))}function t(n,t,r){return t?r?u(t,n):e(u(t,n)):r?o(n):e(o(n))}"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:n.md5=t}(this);
@@ -23,8 +23,8 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
23
23
  class WalkerBase{constructor(){this.should_skip=false;this.should_remove=false;this.replacement=null;this.context={skip:()=>this.should_skip=true,remove:()=>this.should_remove=true,replace:node=>this.replacement=node}}replace(parent,prop,index,node){if(parent&&prop){if(index!=null){parent[prop][index]=node}else{parent[prop]=node}}}remove(parent,prop,index){if(parent&&prop){if(index!==null&&index!==void 0){parent[prop].splice(index,1)}else{delete parent[prop]}}}}class SyncWalker extends WalkerBase{constructor(enter,leave){super();this.should_skip=false;this.should_remove=false;this.replacement=null;this.context={skip:()=>this.should_skip=true,remove:()=>this.should_remove=true,replace:node=>this.replacement=node};this.enter=enter;this.leave=leave}visit(node,parent,prop,index){if(node){if(this.enter){const _should_skip=this.should_skip;const _should_remove=this.should_remove;const _replacement=this.replacement;this.should_skip=false;this.should_remove=false;this.replacement=null;this.enter.call(this.context,node,parent,prop,index);if(this.replacement){if(Array.isArray(this.replacement)){var expressions=[];for(let rp=0;rp<this.replacement.length;rp++){expressions.push(this.replacement[rp])}if(this.replacement.length>1){node={"type":"VariableDeclaration","start":node.start,"kind":"let","declarations":expressions,"level":node.level,"scope":node.scope}}else{node={"type":"ExpressionStatement","expression":{"type":"SequenceExpression","expressions":expressions,"level":node.level,"scope":node.scope},"level":node.level,"scope":node.scope}}this.replace(parent,prop,index,node)}else{node=this.replacement;this.replace(parent,prop,index,node)}}if(this.should_remove){this.remove(parent,prop,index)}const skipped=this.should_skip;const removed=this.should_remove;this.should_skip=_should_skip;this.should_remove=_should_remove;this.replacement=_replacement;if(skipped)return node;if(removed)return null}let key;for(key in node){const value=node[key];if(value&&typeof value==="object"){if(Array.isArray(value)){const nodes=value;for(let i=0;i<nodes.length;i+=1){const item=nodes[i];if(isNode(item)){if(!this.visit(item,node,key,i)){i--}}}}else if(isNode(value)){this.visit(value,node,key,null)}}}if(this.leave){const _replacement=this.replacement;const _should_remove=this.should_remove;this.replacement=null;this.should_remove=false;this.leave.call(this.context,node,parent,prop,index);if(this.replacement){if(Array.isArray(this.replacement)){for(let rp=0;rp<this.replacement.length;rp++){node=this.replacement[rp];this.replace(parent,prop,index,node)}}else{node=this.replacement;this.replace(parent,prop,index,node)}}if(this.should_remove){this.remove(parent,prop,index)}const removed=this.should_remove;this.replacement=_replacement;this.should_remove=_should_remove;if(removed)return null}}return node}}function isNode(value){return value!==null&&typeof value==="object"&&"type"in value&&typeof value.type==="string"}function walk(ast,{enter,leave}){const instance=new SyncWalker(enter,leave);return instance.visit(ast,null)}function getProgramBody(node){if(node.type=="Program"){return node.body}return node}function parseNode(node){}function checkNodeL1(node,varz,vazzz){try{if(node&&typeof node==="object"){if(Array.isArray(node)){for(let i=0;i<node.length;i++){const nd=node[i];if(isNode(nd)){if(nd.type==="VariableDeclaration"){let declarators=nd.declarations;for(let x=0;x<declarators.length;x++){let dec=declarators[x].id;if(vazzz.includes(dec.name)){varz.push({name:dec.name,node:dec});dec.marked=true}}}else if(nd.type=="Identifier"){}parseNode(nd)}}}else if(isNode(node)){}}}catch(e){}}function getL1Vs(AST,view,vazzz){var level=0,block=[{start:0}];var varz=view?.varz??[];let nodes=getProgramBody(AST);checkNodeL1(nodes,varz,vazzz);return{"varz":varz,"AST":AST}}function getWatcher(AST,view,vazzz,targetKey="View"){AST=JSON.parse(JSON.stringify(AST));let Vars=getL1Vs(AST,view,vazzz);AST=Vars["AST"];let varz=Vars["varz"];validateBeforeRewrite(AST,view);AST=changeReactiveVarsOccurences(AST,vazzz,targetKey);AST=transformTopLevelDeclarations(AST,vazzz,targetKey);return{"code":astring.generate(AST),"varz":varz}}function validateBeforeRewrite(AST,view){try{new Function(astring.generate(AST))}catch(e){if(typeof reportLumenError==="function"){reportLumenError({stage:"validate",view:view?.name,error:e,hint:"This is a real JavaScript error in your <script> block (for example, a variable declared twice with let/const) \u2014 fix it in the .view file; it will not surface again once rewritten."})}}}function buildTargetRootExpr(targetKey){const segments=Array.isArray(targetKey)?targetKey:[targetKey];let expr={type:"Identifier",name:"_vt"};for(const seg of segments){if(typeof seg==="number"){expr={type:"MemberExpression",object:expr,property:{type:"Literal",value:seg,raw:String(seg)},computed:true}}else{expr={type:"MemberExpression",object:expr,property:{type:"Identifier",name:seg},computed:false}}}return expr}function changeReactiveVarsOccurences(AST,reactiveVariables,targetKey="View"){const reactive=new Set(reactiveVariables||[]);const scopeStack=[];const bindingIdNodes=new WeakSet;const pushScope=isFunction=>scopeStack.push({isFunction:!!isFunction,names:new Set});const popScope=()=>scopeStack.pop();const currentScope=()=>scopeStack[scopeStack.length-1];function declare(name,kind){if(!name)return;if(kind==="var"||kind==="function"){for(let i=scopeStack.length-1;i>=0;i--){if(scopeStack[i].isFunction||i===0){scopeStack[i].names.add(name);return}}}else{currentScope().names.add(name)}}function rootHas(name){return scopeStack.length>0&&scopeStack[0].names.has(name)}function isShadowedFromRoot(name){for(let i=scopeStack.length-1;i>=1;i--){if(scopeStack[i].names.has(name))return true}return false}function visitPattern(node,onId){if(!node)return;switch(node.type){case"Identifier":onId(node);break;case"RestElement":visitPattern(node.argument,onId);break;case"AssignmentPattern":visitPattern(node.left,onId);break;case"ArrayPattern":for(const el of node.elements)if(el)visitPattern(el,onId);break;case"ObjectPattern":for(const p of node.properties){if(p.type==="Property")visitPattern(p.value,onId);else if(p.type==="RestElement")visitPattern(p.argument,onId)}break;default:break}}function markPatternBindings(pattern,kind="var"){if(!pattern)return;visitPattern(pattern,idNode=>{bindingIdNodes.add(idNode);declare(idNode.name,kind)})}function predeclareProgram(programNode){if(!programNode||!Array.isArray(programNode.body))return;for(const stmt of programNode.body){if(stmt.type==="VariableDeclaration"){for(const d of stmt.declarations){visitPattern(d.id,id=>{bindingIdNodes.add(id);declare(id.name,stmt.kind)})}}else if(stmt.type==="FunctionDeclaration"&&stmt.id){bindingIdNodes.add(stmt.id);declare(stmt.id.name,"function")}else if(stmt.type==="ClassDeclaration"&&stmt.id){bindingIdNodes.add(stmt.id);declare(stmt.id.name,"let")}else if(stmt.type==="ImportDeclaration"){for(const spec of stmt.specifiers||[]){if(spec.local){bindingIdNodes.add(spec.local);declare(spec.local.name,"const")}}}}}function predeclareBlockLexicals(blockNode){if(!blockNode||!Array.isArray(blockNode.body))return;for(const stmt of blockNode.body){if(stmt.type==="VariableDeclaration"&&stmt.kind!=="var"){for(const d of stmt.declarations){visitPattern(d.id,id=>{bindingIdNodes.add(id);currentScope().names.add(id.name)})}}else if(stmt.type==="FunctionDeclaration"&&stmt.id){bindingIdNodes.add(stmt.id);currentScope().names.add(stmt.id.name)}else if(stmt.type==="ClassDeclaration"&&stmt.id){bindingIdNodes.add(stmt.id);currentScope().names.add(stmt.id.name)}}}function predeclareForHeader(node){const header=node.type==="ForStatement"?node.init:node.left;if(header&&header.type==="VariableDeclaration"&&header.kind!=="var"){for(const d of header.declarations){visitPattern(d.id,id=>{bindingIdNodes.add(id);currentScope().names.add(id.name)})}}}function shouldSkipIdentifier(node,parent,prop){if(!parent)return false;if(parent.type==="LabeledStatement"&&prop==="label"||(parent.type==="BreakStatement"||parent.type==="ContinueStatement")&&prop==="label")return true;if(parent.type==="MemberExpression"){if(prop==="property"&&parent.computed===false)return true}if(parent.type==="Property"){if(prop==="key"&&parent.computed===false)return true}if((parent.type==="MethodDefinition"||parent.type==="ClassProperty"||parent.type==="PropertyDefinition")&&prop==="key"&&parent.computed===false)return true;if(parent.type==="ImportSpecifier"||parent.type==="ImportDefaultSpecifier"||parent.type==="ImportNamespaceSpecifier"||parent.type==="ExportSpecifier")return true;return false}function walk2(node,parent,prop,index){if(!node||typeof node!=="object")return;switch(node.type){case"Program":pushScope(true);predeclareProgram(node);break;case"BlockStatement":case"StaticBlock":pushScope(false);predeclareBlockLexicals(node);break;case"FunctionDeclaration":if(node.id){bindingIdNodes.add(node.id);declare(node.id.name,"function")}pushScope(true);for(const p of node.params)markPatternBindings(p,"param");break;case"FunctionExpression":pushScope(true);if(node.id){bindingIdNodes.add(node.id);declare(node.id.name,"let")}for(const p of node.params)markPatternBindings(p,"param");break;case"ArrowFunctionExpression":pushScope(true);for(const p of node.params)markPatternBindings(p,"param");break;case"CatchClause":pushScope(false);if(node.param)markPatternBindings(node.param,"let");break;case"ForStatement":case"ForInStatement":case"ForOfStatement":pushScope(false);predeclareForHeader(node);break;case"VariableDeclaration":for(const decl of node.declarations){markPatternBindings(decl.id,node.kind||"var")}break;case"ClassDeclaration":if(node.id){bindingIdNodes.add(node.id);declare(node.id.name,"let")}break;case"ImportDeclaration":for(const spec of node.specifiers||[]){if(spec.local){bindingIdNodes.add(spec.local);declare(spec.local.name,"const")}}break}for(const key in node){if(key==="parent")continue;const child=node[key];if(Array.isArray(child)){for(let i=0;i<child.length;i++){if(child[i]&&typeof child[i]==="object"){walk2(child[i],node,key,i)}}}else if(child&&typeof child==="object"){walk2(child,node,key,null)}}if(node.type==="Identifier"){const name=node.name;if(!reactive.has(name)||bindingIdNodes.has(node)){}else if(!rootHas(name)){}else if(isShadowedFromRoot(name)){}else if(shouldSkipIdentifier(node,parent,prop)){}else{if(parent&&parent.type==="Property"&&parent.shorthand&&prop==="value"){parent.shorthand=false}const replacement={type:"MemberExpression",object:{type:"MemberExpression",object:buildTargetRootExpr(targetKey),property:{type:"Identifier",name:"vars"},computed:false},property:{type:"Literal",value:name,raw:JSON.stringify(name)},computed:true};if(parent){if(index!==null&&Array.isArray(parent[prop])){parent[prop][index]=replacement}else{parent[prop]=replacement}}else{Object.keys(node).forEach(k=>delete node[k]);Object.assign(node,replacement)}}}switch(node.type){case"Program":case"BlockStatement":case"StaticBlock":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"ForStatement":case"ForInStatement":case"ForOfStatement":popScope();break;default:break}}walk2(AST,null,null,null);return AST}function _reactiveAssignStatement(name,init,targetKey="View"){return{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",computed:true,object:{type:"MemberExpression",computed:false,object:buildTargetRootExpr(targetKey),property:{type:"Identifier",name:"vars"}},property:{type:"Literal",value:name}},right:init||{type:"Identifier",name:"undefined"}}}}function _fnRegisterStatement(name,targetKey){return{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",computed:true,object:{type:"MemberExpression",computed:false,object:buildTargetRootExpr(targetKey),property:{type:"Identifier",name:"fns"}},property:{type:"Literal",value:name}},right:{type:"Identifier",name}}}}function _windowExportStatement(name){return{type:"IfStatement",test:{type:"BinaryExpression",operator:"!==",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"window"}},right:{type:"Literal",value:"undefined"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",computed:true,object:{type:"Identifier",name:"window"},property:{type:"Literal",value:name}},right:{type:"Identifier",name}}},alternate:null}}function transformTopLevelDeclarations(AST,reactiveVariables,targetKey="View"){const reactive=new Set(reactiveVariables||[]);const newBody=[];for(const stmt of AST.body){if(stmt.type==="FunctionDeclaration"&&stmt.id){newBody.push(stmt);newBody.push(_fnRegisterStatement(stmt.id.name,targetKey));if(stmt.async||stmt.generator)newBody.push(_windowExportStatement(stmt.id.name));continue}if(stmt.type!=="VariableDeclaration"){newBody.push(stmt);continue}const reactiveDecls=stmt.declarations.filter(d=>reactive.has(d.id.name));const nonReactiveDecls=stmt.declarations.filter(d=>!reactive.has(d.id.name));if(reactiveDecls.length===0){newBody.push(stmt);continue}for(const decl of reactiveDecls){newBody.push(_reactiveAssignStatement(decl.id.name,decl.init,targetKey))}if(nonReactiveDecls.length>0){newBody.push({type:"VariableDeclaration",kind:stmt.kind,declarations:nonReactiveDecls})}}AST.body=newBody;return AST}if(typeof module!=="undefined"&&module.exports){module.exports={getWatcher,changeReactiveVarsOccurences,transformTopLevelDeclarations,validateBeforeRewrite}}
24
24
 
25
25
  var __lmDevOnlyEnd__ = 1;
26
- var cl=console.log;var LumenJS_HTML_SNIFF_RE=/([&][a-zA-Z]*[;]+)|<\/?[a-z][\s\S]*>/im;class _v{static name;static type;static vars;static fns;static rvs;static _pv;static mx;static views;static hst;static settings;constructor(obj){this.name=obj.name??"home";this.type=obj.type??"main";this.hst=obj.hst??[];this.views=obj.views??[];this.vars=obj.vars??{};this.fns=obj.fns??{};this.rvs=obj.rvs??{};this._pv=obj._pv??null;this.mx=obj.mx??[];this.settings=obj.settings??{layout:"default",requireAuth:false}}}const consoleLogOriginal=console.log;console.log=function(){for(let i=0;i<arguments.length;i++){const arg=arguments[i];if(arg&&arg.hasOwnProperty("__isProxy")||arg?.target){arguments[i]=arguments[i].target}}consoleLogOriginal.apply(console,arguments)};var _lumenDevMode=true;var _lumenErrorLog=[];var _lumenLoggedExprs={};var _mountedSubviewEngines=[];var EXPECTED_HST_FORMAT_VERSION=3;var _HST_FORMATS_ACCEPTED=[1,2,3];function _numericPathToBrackets(expr2){if(typeof expr2!=="string"||!/\.\d/.test(expr2)||!/^\s*[A-Za-z_$][\w$]*(?:\.[\w$]+)+\s*$/.test(expr2))return expr2;return expr2.replace(/\.(\d[\w$]*)/g,"['$1']")}var _entityDecodeEl;function decodeHtmlEntities(str){if(!str||str.indexOf("&")===-1)return str;if(!_entityDecodeEl)_entityDecodeEl=document.createElement("textarea");_entityDecodeEl.innerHTML=str;return _entityDecodeEl.value}function _translateLumenError(message){if(!message)return message;return message.replace(/_vt\.View\.vars\[["'`]([^"'`\]]+)["'`]\]/g,"$1")}function reportLumenError(info){info=info||{};var rawMessage=info.message||info.error&&info.error.message||"Unknown error";var entry={time:new Date().toISOString(),stage:info.stage||"runtime",view:info.view||(typeof _vt!=="undefined"&&_vt.View?_vt.View.name:void 0),expr:info.expr,message:_translateLumenError(rawMessage),hint:info.hint};_lumenErrorLog.push(entry);if(_lumenDevMode&&entry.stage==="expression"){var dedupeKey=(entry.view||"")+"|"+(entry.expr||"")+"|"+rawMessage;if(_lumenLoggedExprs[dedupeKey])return entry;_lumenLoggedExprs[dedupeKey]=true;if(/ is not defined$/.test(rawMessage)){console.warn('[LumenJS] "'+(entry.view||"unknown")+'" \u2014 {{'+entry.expr+"}}: "+entry.message+" anywhere in scope, so it is shown as literal text.");return entry}if(/Cannot read propert(y|ies) of (undefined|null)/.test(rawMessage)){console.warn('[LumenJS] "'+(entry.view||"unknown")+'" \u2014 '+entry.expr+" is empty for now ("+entry.message+"). Fine if its data is still loading.");return entry}}if(_lumenDevMode){console.error("[LumenJS] "+entry.stage+' error in "'+(entry.view||"unknown")+'"'+(entry.expr?" \u2014 "+entry.expr:"")+": "+entry.message+(entry.hint?"\n "+entry.hint:""))}return entry}function _x(_x2){const _ARRAY_MUTATORS={push:1,pop:1,shift:1,unshift:1,splice:1,sort:1,reverse:1,fill:1,copyWithin:1};function _dispatchVarsUpdate(key,currPath){let varsIdx=currPath.indexOf("vars");if(varsIdx===-1)return;let varName=varsIdx<currPath.length-1?currPath[varsIdx+1]:key;let rootPath=currPath.slice(0,varsIdx);try{if(typeof watch!=="undefined"&&watch&&Object.prototype.hasOwnProperty.call(watch,varName)&&typeof watch[varName]==="function"){watch[varName]()}}catch(e){cl(e)}if(rootPath[0]==="Global"){try{if(typeof window!=="undefined")window[varName]=_x2.Global.vars[varName]}catch(e){}if(_vt.View._re)_vt.View._re.update(varName);for(const regionName in _vt.Widgets){if(_vt.Widgets[regionName]&&_vt.Widgets[regionName]._re){_vt.Widgets[regionName]._re.update(varName)}}for(let msi=_mountedSubviewEngines.length-1;msi>=0;msi--){let sve=_mountedSubviewEngines[msi];let sveNode=sve._RealDOM&&sve._RealDOM[0];if(sveNode&&!sveNode.isConnected){_mountedSubviewEngines.splice(msi,1);continue}sve.update(varName)}_updateReactiveEngines(varName);return}let owner=_x2;for(let i=0;i<rootPath.length&&owner;i++){owner=owner[rootPath[i]]}if(owner&&owner._re)owner._re.update(varName);for(let msi=_mountedSubviewEngines.length-1;msi>=0;msi--){const sve=_mountedSubviewEngines[msi];if(!sve||sve===(owner&&owner._re))continue;const sveNode=sve._RealDOM&&sve._RealDOM[0];if(sveNode&&!sveNode.isConnected){_mountedSubviewEngines.splice(msi,1);continue}const sp=sve.view&&sve.view.scopePath;if(!sp||sp.length<=rootPath.length)continue;let under=true;for(let i=0;i<rootPath.length;i++)if(String(sp[i])!==String(rootPath[i])){under=false;break}if(under)sve.update(varName)}_updateReactiveEngines(varName)}function _isWrappable(v){if(Array.isArray(v))return true;try{for(let p=Object.getPrototypeOf(v);p&&p!==Object.prototype;p=Object.getPrototypeOf(p)){const c=Object.prototype.hasOwnProperty.call(p,"constructor")?p.constructor:null;if(typeof c!=="function")continue;if(c.name==="Object")return true;if(/\[native code\]/.test(Function.prototype.toString.call(c)))return false}}catch(e){return false}return true}let _batch=0;function makeHandler(path){const childProxies=new WeakMap;return{get(target,key,receiver){if(key=="__isProxy")return true;if(typeof key==="symbol")return target[key];if(_ARRAY_MUTATORS[key]===1&&Array.isArray(target)&&typeof target[key]==="function"){return function(){let res;_batch++;try{res=Array.prototype[key].apply(target,arguments)}finally{_batch--}if(!_batch){try{_dispatchVarsUpdate(key,path)}catch(e){cl(e)}}return res===target?receiver:res}}const v=target[key];if(typeof v==="object"&&v!==null&&key!="_re"){const hit=childProxies.get(v);if(hit&&hit.key===key)return hit.proxy;if(!_isWrappable(v)&&v.isSub!==true)return v;const proxy=new Proxy(v,makeHandler(path.concat(key)));childProxies.set(v,{key,proxy});return proxy}return v??(key=="target"?target:void 0)??void 0},set(target,key,value){target[key]=value;if(!_batch){try{_dispatchVarsUpdate(key,path)}catch(e){cl(e)}}return true},deleteProperty(target,key){if(!(key in target)){return false}delete target[key];if(!_batch){try{_dispatchVarsUpdate(key,path)}catch(e){cl(e)}}return true},ownKeys(target){return Reflect.ownKeys(target)},has(target,key){return key in target},defineProperty(target,key,descriptor){if(descriptor&&"value"in descriptor){target[key]=descriptor.value}return target},getOwnPropertyDescriptor(target,key){const real=Reflect.getOwnPropertyDescriptor(target,key);if(real&&!real.configurable)return real;const value=target[key];return key in target?{value,enumerable:true,configurable:true}:void 0}}}const handler=makeHandler([]);var x=new Proxy(_x2,handler);return x}let _vt=_x({"View":new _v({}),"Global":{"vars":{},"fns":{}},"Widgets":{}});function touch(name){if(_vt.Global.vars.hasOwnProperty(name)){_vt.Global.vars[name]=_vt.Global.vars[name]}}var _deepReactiveCache=typeof WeakMap!=="undefined"?new WeakMap:null;function _deepReactive(obj,onChange){if(obj===null||typeof obj!=="object")return obj;if(_deepReactiveCache&&_deepReactiveCache.has(obj))return _deepReactiveCache.get(obj);var proxy=new Proxy(obj,{get(target,key){var v=target[key];if(v!==null&&typeof v==="object"&&typeof key!=="symbol"){return _deepReactive(v,onChange)}return v},set(target,key,value){target[key]=value;onChange();return true},deleteProperty(target,key){if(key in target)delete target[key];onChange();return true}});if(_deepReactiveCache)_deepReactiveCache.set(obj,proxy);return proxy}function _lookupInWidgets(name){for(const wname in _vt.Widgets){if(_vt.Widgets[wname].vars.hasOwnProperty(name))return _vt.Widgets[wname].vars[name]}return void 0}function _resolveScopePathTarget(scopePath){let target=_vt;for(let i=0;i<scopePath.length;i++)target=target[scopePath[i]];return target}function _evalEventScopedExpr(ownerRe,expr,locals){locals=locals||{};let hasOwner=!!(ownerRe&&ownerRe.view);let levels=[];for(let e=hasOwner?ownerRe:null,n=0;e&&e.view&&n<50;e=e.view._pv,n++){let live=null;if(e.view.scopePath){try{let _sv=_resolveScopePathTarget(e.view.scopePath);if(_sv&&_sv._re===e)live=_sv.vars}catch(err){live=null}}levels.push({re:e,vars:e.view.vars||{},live})}function levelOf(key){for(let i=0;i<levels.length;i++)if(Object.prototype.hasOwnProperty.call(levels[i].vars,key))return levels[i];return null}let widgetsVars=hasOwner?_mergedWidgetsVars():{};function ownFn(key){for(let i=0;i<levels.length;i++){const fns=levels[i].re.view.fns;if(fns&&Object.prototype.hasOwnProperty.call(fns,key)&&typeof fns[key]==="function")return fns[key]}return void 0}let scopeProxy=new Proxy({},{has(target,key){if(typeof key==="symbol")return false;if(locals.hasOwnProperty(key))return true;if(!hasOwner)return false;if(ownFn(key))return true;return!!levelOf(key)||widgetsVars.hasOwnProperty(key)||_vt.Global.vars.hasOwnProperty(key)},get(target,key){if(locals.hasOwnProperty(key))return locals[key];const f=ownFn(key);if(f)return f;const lv=levelOf(key);if(lv)return lv.live?lv.live[key]:lv.vars[key];if(widgetsVars.hasOwnProperty(key)){for(const wname in _vt.Widgets)if(_vt.Widgets[wname].vars.hasOwnProperty(key))return _vt.Widgets[wname].vars[key]}return _vt.Global.vars[key]},set(target,key,value){if(locals.hasOwnProperty(key)){locals[key]=value;return true}try{const lv=levelOf(key);if(lv){if(lv.live)lv.live[key]=value;else{lv.vars[key]=value;try{lv.re.update(key)}catch(e2){cl(e2)}}}else if(widgetsVars.hasOwnProperty(key)){for(const wname in _vt.Widgets){if(_vt.Widgets[wname].vars.hasOwnProperty(key)){_vt.Widgets[wname].vars[key]=value;break}}}else{_vt.Global.vars[key]=value}}catch(e){cl(e)}return true}});function _runWithScope(expr){with(scopeProxy){return eval(expr)}}return _runWithScope(expr)}var _scopedEvalFns=new Map;var _SVG_NS="http://www.w3.org/2000/svg";function _lmSetAttr(el2,name,val){if(el2&&el2.namespaceURI===_SVG_NS){if(name.indexOf("xlink:")===0)return el2.setAttributeNS("http://www.w3.org/1999/xlink",name,val);if(name==="xmlns"||name.indexOf("xmlns:")===0)return el2.setAttributeNS("http://www.w3.org/2000/xmlns/",name,val)}el2.setAttribute(name,val)}var _CONST_EFFECT="\0const";function _mergedWidgetsVars(){let out={};let widgets=_vt.Widgets;let names=Object.keys(widgets);for(let i=names.length-1;i>=0;i--){Object.assign(out,widgets[names[i]].vars)}return out}class _lm{_RealDOM=[];_effects={};_cc={};_jj={};_ready=false;view=void 0;sbscrbs=[];reactiveVariables=[];vrs={};_CXR=[];_LXR=[];constructor(view){this.view=view;this.view._re=this;this.reactiveVariables=view?.rvs??{};this.init();if(this.view.type=="main")_vt.View=this.view;if(this.view._pv){this.view._pv.subscribe(this.view)}return this}init(){var par2=this;this.view.hst.forEach(function(doc2){par2.walk(doc2,null)})}subscribe(view){this.sbscrbs.push(view)}scopedEval(context,expr2,kk){let ctx=this.concatVarsAtLevel(context,this);expr2=_numericPathToBrackets(expr2);if(kk){if(!ctx.hasOwnProperty(kk))return void 0;delete ctx[kk]}try{const ctxKeys=Object.keys(ctx);const evalKey=ctxKeys.join("");let evaluator=_scopedEvalFns.get(evalKey);if(!evaluator){evaluator=Function.apply(null,[...ctxKeys,"expr","return eval(expr)"]);if(_scopedEvalFns.size>=500)_scopedEvalFns.clear();_scopedEvalFns.set(evalKey,evaluator)}return evaluator.apply(null,[...Object.values(ctx),expr2])}catch(e){if(e instanceof TypeError&&!kk){let hadUndefined=false;let strippedCtx={};for(const k2 in ctx){if(ctx[k2]===void 0||ctx[k2]===null){hadUndefined=true;continue}strippedCtx[k2]=ctx[k2]}if(hadUndefined){try{const evaluator2=Function.apply(null,[...Object.keys(strippedCtx),"expr","return eval(expr)"]);return evaluator2.apply(null,[...Object.values(strippedCtx),expr2])}catch(e2){const m2=e2 instanceof ReferenceError&&/^([\w$]+) is not defined$/.exec(e2.message);if(m2&&Object.prototype.hasOwnProperty.call(ctx,m2[1])){reportLumenError({stage:"expression",expr:expr2,error:e});return void 0}if(e2 instanceof ReferenceError)this._lastUnresolved=true;reportLumenError({stage:"expression",expr:expr2,error:e2});return void 0}}}if(e instanceof ReferenceError)this._lastUnresolved=true;reportLumenError({stage:"expression",expr:expr2,error:e});return void 0}}_inForRow(){for(let r=this,n=0;r&&n<50;r=r.view&&r.view._pv,n++){if(r._blankUnresolved)return true;if(r.vrs&&Object.keys(r.vrs).length)return true;let v=r.view;if(v&&v.type==="section"&&v.vars&&Object.keys(v.vars).length)return true}return false}_textMustache(content){this._lastUnresolved=false;let v=this.getVal(content);let unresolved=this._lastUnresolved&&(v===void 0||v===null||v==="");this._lastUnresolved=false;if(!unresolved)return v;if(this._inForRow())return v;let raw=String(content);return/^\s*\{\{[\s\S]*\}\}\s*$/.test(raw)?raw:"{{"+raw+"}}"}getVals(effect){let val="";if(effect.type=="text"){if(!effect.isSplit){for(let i=0;i<effect.splits.length;i++){let split=effect.splits[i];if(split.type=="mustache"){val+=this._textMustache(split.content)}else{val+=split.content}}}else{val=this._textMustache(effect.content)}}else if(effect.type=="attr"||effect.type=="event"){for(let i=0;i<effect.splits.length;i++){let split=effect.splits[i];if(split.type=="mustache"){val+=this.getVal(split.content)}else{val+=split.content}}}return val}renderAll(){if(this._ready)return;this._ready=true;for(const rv in this._effects){if(Object.prototype.hasOwnProperty.call(this._effects,rv)){const effects=this._effects[rv];for(let ei=0;ei<effects.length;ei++){const effect=effects[ei];if(!effect.nd)continue;try{if(effect.type=="text"){this.applyTextEffect(effect)}else if(effect.type=="attr"){if(effect.name=="value"){effect.nd.value=this.render(effect)}else{_lmSetAttr(effect.nd,effect.name,this.render(effect));if(effect.name=="view"){effect.nd.subPath=this.render(effect);renderView(this.render(effect),true,{})}}}else if(effect.type=="event"){effect.nd.events[effect.name]=this.render(effect)}}catch(e){cl("Eeeeee",e)}}}}this.updateCXRs();this.updateLXRs();this.updateVXRs();if(typeof appSettings!=="undefined"&&appSettings&&typeof appSettings.tick==="function"){try{appSettings.tick()}catch(e){cl(e)}}}chainConnected(cx){for(let i=cx.chain.length-1;i>=0;i--){const cxs=cx.chain[i];if(cxs.ref.isPreConnected){return true}}return false}async updateVXRs(k){let subsNames=[];for(let i=0;i<this.view.views.length;i++){const _view=this.view.views[i];if(!subsNames.includes(_view.subPath))subsNames.push(_view.subPath)}if(!subsNames.length)return;if(this._RealDOM&&this._RealDOM.length&&!this._RealDOM.some(function(nd){return nd&&nd.isConnected})){this._vxrWaits=(this._vxrWaits||0)+1;if(this._vxrWaits<=200)setTimeout(()=>this.updateVXRs(k),10);return}this._vxrWaits=0;for(let i=0;i<subsNames.length;i++){const n=subsNames[i];renderView(n,true,{},"views",this.view.views,this.view.scopePath||["View"])}}_evalCondition(expr2){if(typeof expr2==="string"&&expr2.charAt(0)==="!"){return!this.evalExp(expr2.substring(1),this.reactiveVariables)}return this.evalExp(expr2,this.reactiveVariables)}async updateCXRs(k){for(let i=0;i<this._CXR.length;i++){const cx=this._CXR[i];if(cx.name=="if"){let isTrue=this._evalCondition(cx.content);if(isTrue){await this.showSectionCX(cx,k)}else{await this.hideSectionCX(cx)}}else if(cx.name=="else-if"){if(!this.chainConnected(cx)){let isTrue=this._evalCondition(cx.content);if(isTrue){await this.showSectionCX(cx,k)}else{await this.hideSectionCX(cx)}}else{await this.hideSectionCX(cx)}}else if(cx.name=="else"){if(!this.chainConnected(cx)){await this.showSectionCX(cx,k)}else{await this.hideSectionCX(cx)}}}}async showSectionCX(cx,k){let wasConnected=cx.ref.node.isConnected;cx.ref.isPreConnected=true;await renderSection(cx.ref,cx.doc,this,k);if(!wasConnected)await fireRenderHook(cx,"after-render",cx.ref.node,{visible:true})}async hideSectionCX(cx){if(cx.ref.node.isConnected)await fireRenderHook(cx,"before-render",cx.ref.node,{visible:false});cx.ref.isPreConnected=false;cx.ref.node.replaceWith(cx.ref)}render(effect){let x="";try{if(effect.type=="text"||effect.type=="attr"||effect.type=="event"){x=this.getVals(effect)}}catch(e){cl(e)}return x}applyTextEffect(effect){let val=this.render(effect);let nd=effect.nd;let clone2=effect._htmlClone||nd._lmHtmlClone||null;if(LumenJS_HTML_SNIFF_RE.test(val)){nd.textContent="";if(!clone2){clone2=document.createElement("span");nd.before(clone2)}effect._htmlClone=nd._lmHtmlClone=clone2;clone2.innerHTML=val}else{if(clone2){clone2.remove();effect._htmlClone=nd._lmHtmlClone=null}nd.textContent=val}}update(k){if(!this._ready)return;if(this._effects.hasOwnProperty(k)){const effects=this._effects[k];for(let ei=0;ei<effects.length;ei++){const effect=effects[ei];if(!effect.nd)continue;try{if(effect.type=="text"){this.applyTextEffect(effect)}else if(effect.type=="attr"){if(effect.name=="value"){effect.nd.value=this.render(effect)}else{_lmSetAttr(effect.nd,effect.name,this.render(effect));if(effect.name=="view"){effect.nd.subPath=this.render(effect);renderView(this.render(effect),true,{})}}}else if(effect.type=="event"){effect.nd.events[effect.name]=this.render(effect)}}catch(e){cl("Eeeeee",e)}}}this.updateCXRs(k);this.updateLXRs(k);for(let sbscsi=0;sbscsi<this.sbscrbs.length;sbscsi++){const sbscr=this.sbscrbs[sbscsi];sbscr._re.update(k)}if(typeof appSettings!=="undefined"&&appSettings&&typeof appSettings.tick==="function"){try{appSettings.tick()}catch(e){cl(e)}}}_forReads(cx,k){const js=cx.forX["js"];if(js===k)return true;const cache=cx._reads||(cx._reads={});if(k in cache)return cache[k];let hit=false;if(typeof k==="string"&&k!==""){const src=[js,cx.limit,cx.offset,cx.cond].filter(s=>typeof s==="string").join("\n");hit=new RegExp("(^|[^\\w$.])"+k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"(?![\\w$])").test(src)}return cache[k]=hit}_forNum(raw){if(typeof raw!=="string"||raw.indexOf("{")===-1)return raw;const self=this;return raw.replace(/\{\s*\{\s*([\s\S]*?)\s*\}\s*\}/g,function(_,expr2){let v;try{v=self.getVal(expr2,"")}catch(e){v=""}return v===void 0||v===null?"":String(v)}).trim()}async updateLXRs(k){for(let i=0;i<this._LXR.length;i++){var cx=this._LXR[i];var forX=cx.forX;if(k&&!this._forReads(cx,k))continue;if(cx._updating){cx._dirty=true;continue}cx._updating=true;try{var val=this.getVal(forX["js"],"");var tempVal=[];if(this.typeStr(val)=="number"){for(let i2=0;i2<val;i2++){tempVal.push(i2)}val=tempVal}let vals=[];let isObj=false;if(this.typeStr(val)=="object"){isObj=true;for(const oKey in val){if(Object.hasOwnProperty.call(val,oKey)){const item=val[oKey];let objj={key:oKey,value:item};vals.push(objj)}}}else vals=clone(val);if(this.typeStr(vals)!="array")vals=[];{let forIf=cx.cond;let limit=vals.length;let offset=0;const cxLimit=this._forNum(cx.limit);const cxOffset=this._forNum(cx.offset);if(cxLimit)limit=(isNaN(cxLimit)?cxLimit:limit)>vals.length?vals.length:cxLimit*1;if(cxOffset)offset=(isNaN(cxOffset)?cxOffset:offset)<0?0:cxOffset*1;let marray=[];if(forIf){marray=vals.slice(offset*1,vals.length)}else{marray=vals.slice(offset*1,limit*1+offset*1)}let myLimit=0;let arrayToRender=[];let arrayToRenderVXs=[];for(var index=0;index<marray.length;index++){if(myLimit==limit*1)break;try{let vx={};vx["index"]=offset*1+index*1;if(forX["dx"]!="")vx[forX["dx"]]=offset*1+index*1;if(isObj){if(forX["as"]["v"]!=""){if(forX["as"]["k"])vx[forX["as"]["k"]]=marray[index]["key"];if(forX["as"]["v"])vx[forX["as"]["v"]]=marray[index]["value"]}else{if(forX["as"]["k"])vx[forX["as"]["k"]]=marray[index]}vx["key"]=marray[index]["key"];vx["value"]=marray[index]["value"]}else{if(forX["as"]["k"])vx[forX["as"]["k"]]=marray[index];if(marray[index]&&typeof marray[index]==="object"&&!Array.isArray(marray[index])){for(const k2 in marray[index]){if(Object.prototype.hasOwnProperty.call(marray[index],k2)){vx[k2]=marray[index][k2]}}}}if(forIf){let _prevVrs=this.vrs;this.vrs=vx;let isTrue;try{isTrue=this.evalExp(forIf,[])}finally{this.vrs=_prevVrs}if(!isTrue)continue}let miIndexx=offset*1+index*1;arrayToRender.push(marray[index]);arrayToRenderVXs.push(vx);myLimit++}catch(e){cl(e)}}let oldATR=cx.atr;cx.atr=clone(arrayToRender);const actions=this.compareArrays(oldATR,arrayToRender);if(actions.length)await fireRenderHook(cx,"before-render",cx.ref.parentElement,{items:arrayToRender,actions});let addActions=[];let otherActions=[];for(let ai=0;ai<actions.length;ai++){(actions[ai].action=="add"?addActions:otherActions).push(actions[ai])}if(addActions.length){let createdSections=await Promise.all(addActions.map(actn=>{let vx=arrayToRenderVXs[actn.index];return this.createSection(cx,vx,isObj,forX,actn.index)}));for(let ci=0;ci<createdSections.length;ci++){let cln=createdSections[ci];cx.ref.before(cln);cln.replaceWith(cln.node)}}for(let ai=0;ai<otherActions.length;ai++){const actn=otherActions[ai];if(actn.action=="remove"){var keyed=cx.key+"_"+actn.index;let tx2=cx.ref?.nodes[keyed];if(tx2){tx2.remove();tx2.node.remove();delete cx.ref.nodes[keyed]}}else{var keyed=cx.key+"_"+actn.index;let tx2=cx.ref?.nodes[keyed];let vx=arrayToRenderVXs[actn.index];if(tx2){tx2._re.vrs=vx;let _rowVars=tx2._re.view&&tx2._re.view.vars;if(_rowVars&&_rowVars!==vx){for(const _rk in _rowVars)if(!(_rk in vx))delete _rowVars[_rk];Object.assign(_rowVars,vx)}if(tx2.isObj){if(tx2.forX.as["k"]!="")tx2._re.update(tx2.forX.as["k"]);else tx2._re.update(tx2.forX.js);if(tx2.forX.as["v"]!="")tx2._re.update(tx2.forX.as["v"]);for(let actnsi=0;actnsi<actn.updates.length;actnsi++){const actnu=actn.updates[actnsi];tx2._re.update(actnu.property)}}else{if(tx2.forX.as["k"]!="")tx2._re.update(tx2.forX.as["k"]);else tx2._re.update(tx2.forX.js);for(const ik in vx){if(Object.prototype.hasOwnProperty.call(vx,ik)&&ik!==tx2.forX.js&&ik!==tx2.forX.as["k"])tx2._re.update(ik)}}}}}if(actions.length)await fireRenderHook(cx,"after-render",cx.ref.parentElement,{items:arrayToRender,actions})}}finally{cx._updating=false;if(cx._dirty){cx._dirty=false;Promise.resolve().then(()=>this.updateLXRs(k))}}}}compareLogic(array1,array2){if(array1.length===array2.length){return 1}else{if(array1.length>array2.length){return 2}else{return 3}}}compareArrays(array1,array2){const actions=[];const maxLength=Math.max(array1.length,array2.length);for(let i=0;i<maxLength;i++){const element1=array1[i];const element2=array2[i];if(element2===void 0){actions.push({action:"remove",index:i})}else if(element1===void 0){actions.push({action:"add",index:i,element:element2})}else if(!this.deepCompare(element1,element2)){actions.push({action:"update",index:i,updates:this.getUpdates(element1,element2)})}}return actions}findDeletedIndexes(array1,array2){const deletedIndexes=[];let par2=this;array1.forEach((item,index)=>{const foundIndex=array2.findIndex(el2=>par2.deepCompare(el2,item));if(foundIndex===-1){deletedIndexes.push(index)}});return deletedIndexes}findAddedIndexes(array1,array2){const addedIndexes=[];let par2=this;array2.forEach((item,index)=>{const foundIndex=array1.findIndex(el2=>par2.deepCompare(el2,item));if(foundIndex===-1){addedIndexes.push(index)}});return addedIndexes}deepCompare(obj1,obj2){return JSON.stringify(obj1)===JSON.stringify(obj2)}getUpdates(oldObj,newObj){const updates=[];for(const key in newObj){if(newObj.hasOwnProperty(key)&&newObj[key]!==oldObj[key]){updates.push({property:key,value:newObj[key]})}}return updates}getVal(mo,indexName){let vars={};try{for(let i=0;i<this.reactiveVariables.length;i++){let __name=this.reactiveVariables[i];if(_vt.View.vars.hasOwnProperty(__name)){vars[__name]=_vt.View.vars[__name]}else{let _wv=_lookupInWidgets(__name);let _gv=_wv!==void 0?_wv:_vt.Global.vars[__name];if(_gv!==void 0)vars[__name]=_gv}}for(const ky in this.vrs){if(Object.prototype.hasOwnProperty.call(this.vrs,ky)){vars[ky]=this.vrs[ky]}}if(this.view&&this.view.vars){for(const ky in this.view.vars){if(Object.prototype.hasOwnProperty.call(this.view.vars,ky)){vars[ky]=this.view.vars[ky]}}}}catch(e){cl(e)}mo=mo.trim();if(mo.slice(0,2)=="{{"){mo=mo.slice(2,-2)}let value="";let _mo=mo;if(mo.indexOf("`")>-1){var matchesVal=_mo.match(/\.`[\s\S]*?`/g);if(matchesVal)for(var y=0;y<matchesVal.length;y++){_mo=_mo.split(matchesVal[y]).join("."+this.getVal(matchesVal[y].substr(1).slice(1,-1),indexName))}var matchesVal=_mo.match(/`[\s\S]*?`/g);if(matchesVal)for(var y=0;y<matchesVal.length;y++){_mo=_mo.split(matchesVal[y]).join("'"+this.getVal(matchesVal[y].slice(1,-1),indexName)+"'")}return this.getVal(_mo,indexName)}if(mo.indexOf(";")>-1){let zxx=mo.split(";");mo=$.trim(zxx[0])}if(mo.indexOf(" as ")>-1){mo=mo.split(" as ");return this.getVal(mo[0],indexName)}if(indexName){indexName=indexName.toString();if(mo.indexOf(indexName)>-1&&mo!=indexName&&vars.hasOwnProperty(indexName)&&mo!="index"){mo=mo.split(indexName).join(vars[indexName]);return this.getVal(mo,indexName)}}var Ondex=mo.match(/\bindex\b/g);if(Ondex&&mo!="index"&&vars.hasOwnProperty("index")){_mo=mo.replace(/\bindex\b/g,vars["index"]);return this.getVal(_mo,indexName)}value=this.lookup(mo,vars);return value??""}concatVarsAtLevel(levelVars,parent2){if(!parent2.view._pv){var concatenatedVars={...levelVars};if(parent2.view.vars){concatenatedVars={..._vt.Global.vars,..._mergedWidgetsVars(),...parent2.view.vars,...concatenatedVars}}return concatenatedVars}var concatenatedVars={...levelVars};if(parent2.view.vars){concatenatedVars={...parent2.view.vars,...concatenatedVars}}return this.concatVarsAtLevel(concatenatedVars,parent2.view._pv)}lookup(name,vaz){let vars=this.concatVarsAtLevel(vaz,this);try{var value;var names,index,lookupHit=false;if(this.hasProperty(vars,name)){value=vars[name]}else if(name.indexOf(".")>-1&&name.indexOf("[")==-1){var value=this.scopedEval(vars,name);if(!(value||value==0)){value=vars;names=name.split(".");index=0;while(value!=null&&index<names.length){if(index===names.length-1)lookupHit=this.hasProperty(value,names[index]);value=value[names[index++]]}}}else{var value=this.scopedEval(vars,name);if(!(value||value==0)){if(name.indexOf(".")==-1&&name.indexOf("[")>-1){let _name=name;var matchesVal=_name.match(/\[[\s\S]*?\]/g);for(var y=0;y<matchesVal.length;y++){if(matchesVal[y].indexOf("'")==-1&&matchesVal[y].indexOf('"')==-1)_name=_name.split(matchesVal[y]).join("['"+matchesVal[y].slice(1,-1)+"']")}var value=this.scopedEval(vars,_name)}}}if(this.isFunction(value))value=value.call(value)}catch(e){reportLumenError({stage:"lookup",expr:name,error:e});return""}return value}objectToString=Object.prototype.toString;isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)==="[object Array]"};isFunction(object){return typeof object==="function"}typeStr(obj){return this.isArray(obj)?"array":typeof obj}hasProperty(obj,propName){return obj!=null&&typeof obj==="object"&&propName in obj}createEl(tag,attrs,children,events,doc2){const _el2=doc2&&doc2.svg?document.createElementNS(_SVG_NS,tag):document.createElement(tag);Object.defineProperty(_el2,"_ownerRe",{value:this,enumerable:false,configurable:true,writable:true});_el2.isSub=false;if(attrs.hasOwnProperty("view")){_el2.isSub=true;_el2.subPath=attrs["view"];_el2.vars={};_el2.views=[];_el2.fns={};if(doc2&&doc2.evs&&doc2.evs.hasOwnProperty("@init")){let _initAttr=doc2.evs["@init"];if(_initAttr){let _rowScope=Object.assign({},this.view&&this.view.type==="section"&&this.view.vars||{},this.vrs||{});let _initResult=evalEvAttr(_initAttr,{cType:"init"},$(_el2),"init",_rowScope);if(_initResult&&typeof _initResult==="object"&&typeof _initResult.then!=="function"){Object.assign(_el2.vars,_initResult)}}}this.view.views.push(_el2)}_el2.events={};for(const prop in attrs){if(prop=="view"||prop==":data"||prop==":if"||prop==":else-if"||prop==":else"||prop==":for"||prop==":for-limit"||prop==":for-offset"||prop==":for-if")continue;try{let val=doc2&&doc2.ax.hasOwnProperty(prop)?"":attrs[prop];if(prop=="value"&&!(doc2&&doc2.svg)){_el2.value=val}else _lmSetAttr(_el2,prop,val)}catch(e){cl(e)}}for(const prop in events){try{_el2.events[prop]=events[prop];if(typeof _lmIndexAtEl==="function")_lmIndexAtEl(_el2,prop)}catch(e){cl(e)}}if(children.length)_el2.append(...children);if(events&&events["@after-render"]&&!(attrs&&(attrs.hasOwnProperty(":for")||attrs.hasOwnProperty(":if")||attrs.hasOwnProperty(":else-if")||attrs.hasOwnProperty(":else")))){fireRenderHook({doc:doc2},"after-render",_el2,{})}autoInitPlugins(_el2,attrs);return _el2}evalExp(expr2,vars){let rvars={};try{for(let i=0;i<vars.length;i++){let __name=vars[i];if(_vt.View.vars.hasOwnProperty(__name)){rvars[__name]=_vt.View.vars[__name]}else{let _wv=_lookupInWidgets(__name);rvars[__name]=_wv!==void 0?_wv:_vt.Global.vars[__name]}}for(const ky in this.vrs){if(Object.prototype.hasOwnProperty.call(this.vrs,ky)){rvars[ky]=this.vrs[ky]}}if(this.view&&this.view.vars){for(const ky in this.view.vars){if(Object.prototype.hasOwnProperty.call(this.view.vars,ky)){rvars[ky]=this.view.vars[ky]}}}}catch(e){cl(e)}try{var value=this.scopedEval(rvars,expr2);if(value&&value!=0)return true}catch(e){reportLumenError({stage:"condition",expr:expr2,error:e});return false}return false}splitTextWithMustaches(text,mustaches){mustaches.sort((a,b)=>a.start-b.start);const elements=[];let currentIndex=0;for(const mustache of mustaches){if(currentIndex<mustache.start){elements.push({type:"static",content:text.substring(currentIndex,mustache.start)})}elements.push({type:"mustache",jst:mustache.jst,rvs:mustache.rvs,content:text.substring(mustache.start,mustache.end)});currentIndex=mustache.end}if(currentIndex<text.length){elements.push({type:"static",content:text.substring(currentIndex)})}return elements}walk(doc,parent){var par=this;var tx,el;switch(doc.type){case"text":if(doc.mss.length){let splitIt=true;if(doc.tag=="textarea"){splitIt=false}if(splitIt){let splits=this.splitTextWithMustaches(doc.content,doc.mss);for(let si=0;si<splits.length;si++){const split=splits[si];if(split.type=="static"){let txnd=document.createTextNode(decodeHtmlEntities(split.content));if(!parent)par._RealDOM.push(txnd);(tx??(tx=[])).push(txnd)}else{let txnd=document.createTextNode("");const _keys=split.rvs.length?split.rvs:[_CONST_EFFECT];for(let ri=0;ri<_keys.length;ri++){const element=_keys[ri];(this._effects[element]??(this._effects[element]=[])).push({"type":"text","content":split.content,"jst":split.jst,"rvs":split.rvs,"isSplit":true,"nd":txnd,"tag":doc.tag})}if(!parent)par._RealDOM.push(txnd);(tx??(tx=[])).push(txnd)}}return tx}else{tx=document.createTextNode("");const _anyRv=doc.mss.some(m=>m.rvs.length);for(let mui=0;mui<doc.mss.length;mui++){const mus=doc.mss[mui];const _keys=mus.rvs.length?mus.rvs:!_anyRv&&mui===0?[_CONST_EFFECT]:[];for(let ri=0;ri<_keys.length;ri++){const element=_keys[ri];(this._effects[element]??(this._effects[element]=[])).push({"type":"text","content":doc.content,"splits":this.splitTextWithMustaches(doc.content,doc.mss),"jst":mus.jst,"rvs":mus.rvs,"isSplit":false,"nd":tx,"tag":doc.tag})}}if(!parent)par._RealDOM.push(tx);return tx}}else{tx=document.createTextNode(decodeHtmlEntities(doc.content));if(!parent)par._RealDOM.push(tx);return tx}break;case"sections":case"section":var _dd=md5(new Date().getTime()/1e3+"::"+Math.random());tx=document.createTextNode("");var typeN=null;if(doc.attrs.hasOwnProperty(":else"))typeN="else";else if(doc.attrs.hasOwnProperty(":else-if"))typeN="else-if";else if(doc.attrs.hasOwnProperty(":if"))typeN="if";else typeN="for";if(doc.type=="section"){var chain=[];if(typeN=="else-if"||typeN=="else"){try{let lastInChain=this._CXR.at(-1);if(lastInChain){_dd=lastInChain.key;chain.push(...lastInChain.chain,lastInChain)}}catch(e){}}el=par.createEl(doc.name,doc.attrs,[],doc.evs,doc);tx.node=el;this._CXR.push({"type":"section","name":typeN,"content":doc.cond,"doc":doc,"key":_dd,"chain":chain,"ref":tx});this.setEffects(doc,el)}else if(doc.type=="sections"){tx.key=_dd;tx.node=null;tx.nodes={};let docRaw=doc;this._LXR.push({"type":"sections","name":typeN,"cond":doc.attrs.hasOwnProperty(":for-if")?doc.attrs[":for-if"]:null,"limit":doc.attrs.hasOwnProperty(":for-limit")?doc.attrs[":for-limit"]:0,"offset":doc.attrs.hasOwnProperty(":for-offset")?doc.attrs[":for-offset"]:0,"content":doc.content,"forX":doc.forX,"doc":docRaw,"key":_dd,"atr":[],"ref":tx})}if(!parent)par._RealDOM.push(tx);return tx;break;case"tag":var _dd=md5(new Date().getTime()/1e3+"::"+Math.random());if(doc.name.toLowerCase()=="settings"){if(par.view.type=="main"){var defaultSettings={layout:"default",requireAuth:false};try{let settingsC=doc.children[0].content;let settings={};eval("settings = "+settingsC+";");if(settings){if(settings.layout==null)settings.layout="default";if(settings.requireAuth==null)settings.requireAuth=false;par.view.settings=settings}else{par.view.settings=defaultSettings}}catch(e){setError(e,"Error in your settings tag inside the '"+par.view.name.toLowerCase()+"' main view!");par.view.settings=defaultSettings}}}else if(doc.name.toLowerCase()=="script"||doc.name.toLowerCase()=="js"){let child=doc.children[0]||{};let js=child.content;let jst=child.jst;let isScoped=false;if(doc.attrs.hasOwnProperty("scoped")){delete doc.attrs["scoped"];isScoped=true}el=par.createEl("script",doc.attrs,[],doc.evs,doc);el._sc=isScoped;el._dd=_dd;el._jst=jst;el._js=js;el._pre=child.pre;(par._jj[_dd]??(par._jj[_dd]=[])).push({"nd":el})}else if(doc.name.toLowerCase()=="style"){let css=doc.children[0].content;let isScoped=false;el=par.createEl("style",{},[],doc.evs,doc);if(doc.attrs.hasOwnProperty("scoped")){if(!parent){if(par.view._dd)_dd=par.view._dd;else{par.view._dd=_dd;if(par.view.type=="main")$("[body]")[0].setAttribute("vuid",_dd)}}else{if(parent._dd)_dd=parent._dd;else{parent._dd=_dd;parent.setAttribute("vuid",_dd)}}delete doc.attrs["scoped"];isScoped=true;el._sc=isScoped;el._dd=_dd;el._css=css;(par._cc[_dd]??(par._cc[_dd]=[])).push({"nd":el,"_css":css})}else{el._sc=isScoped;el._dd=_dd;el.textContent=css}for(const prop in doc.attrs){try{_el.setAttribute(prop,doc.attrs[prop])}catch(e){cl(e)}}}else if(doc.name.toLowerCase()=="icon"){let child=par.createEl("span",{"class":"iconify","data-icon":doc?.icon??"mdi:home"},[],{},null);el=par.createEl("span",doc.attrs,[child],doc.evs,doc)}else if(doc.name.toLowerCase()=="slot"){let slotName=doc.attrs&&doc.attrs.name;if(slotName){let tempWrapper=document.createElement("div");let childs=[];for(let i=0;i<doc.children.length;i++){const dc=doc.children[i];let chils=par.walk(dc,tempWrapper);if(chils){if(Array.isArray(chils)){if(chils.length)childs=[...childs,...chils]}else{childs.push(chils)}}}(par.view._slots??(par.view._slots={}))[slotName]=childs}}else if(doc.attrs&&(doc.attrs.hasOwnProperty("tpl")||doc.attrs.hasOwnProperty("comp"))){let _elAttrs=Object.assign({},doc.attrs);delete _elAttrs["tpl"];delete _elAttrs["comp"];delete _elAttrs[":data"];el=par.createEl(doc.name,_elAttrs,[],doc.evs,doc);_reportTplMisuse(doc,par)}else{el=par.createEl(doc.name,doc.attrs,[],doc.evs,doc);if(!doc.isV&&!el.isSub){let childs=[];for(let i=0;i<doc.children.length;i++){const dc=doc.children[i];let chils=par.walk(dc,el);if(chils){if(Array.isArray(chils)){if(chils.length)childs=[...childs,...chils]}else{childs.push(chils)}}}childs.length?el.append(...childs):null}}this.setEffects(doc,el);if(el){if(!parent)par._RealDOM.push(el)}return el;break;case"comment":break;default:break}}setEffects(doc2,el2){let rvs=[];if(Object.keys(doc2.ax).length){for(const attrName in doc2.ax){if(Object.hasOwnProperty.call(doc2.ax,attrName)){const attrMustaches=doc2.ax[attrName];const _anyRv=attrMustaches.some(m=>m.rvs.length);for(let i=0;i<attrMustaches.length;i++){const mus=attrMustaches[i];const _keys=mus.rvs.length?mus.rvs:!_anyRv&&i===0?[_CONST_EFFECT]:[];for(let ri=0;ri<_keys.length;ri++){const element=_keys[ri];if(element!==_CONST_EFFECT)rvs.push(element);(this._effects[element]??(this._effects[element]=[])).push({"type":"attr","name":attrName,"content":doc2.attrs[attrName],"splits":this.splitTextWithMustaches(doc2.attrs[attrName],doc2.ax[attrName]),"jst":mus.jst,"rvs":mus.rvs,"nd":el2})}}}}}if(Object.keys(doc2.ex).length){for(const ky in doc2.ex){if(Object.hasOwnProperty.call(doc2.ex,ky)){const mss=doc2.ex[ky];for(let i=0;i<mss.length;i++){const mus=mss[i];for(let ri=0;ri<mus.rvs.length;ri++){const element=mus.rvs[ri];rvs.push(element);(this._effects[element]??(this._effects[element]=[])).push({"type":"event","name":ky,"content":doc2.evs[ky],"splits":this.splitTextWithMustaches(doc2.evs[ky],doc2.ex[ky]),"jst":mus.jst,"rvs":mus.rvs,"nd":el2})}}}}}return rvs.filter((value,index,self)=>{return self.indexOf(value)===index})}async createSection(cx,vx,isObj,forX,pos){var keyed=cx.key+"_"+(pos!==void 0?pos:vx.index);var tx2=document.createTextNode("");var typeN2=null;if(cx.doc.attrs.hasOwnProperty(":else"))typeN2="else";else if(cx.doc.attrs.hasOwnProperty(":else-if"))typeN2="else-if";else if(cx.doc.attrs.hasOwnProperty(":if"))typeN2="if";else typeN2="for";let _ownerVrs=this.vrs;this.vrs=Object.assign({},_ownerVrs||{},vx||{});let el2;try{el2=this.createEl(cx.doc.name,cx.doc.attrs,[],cx.doc.evs,cx.doc)}finally{this.vrs=_ownerVrs}tx2.node=el2;tx2.key=cx.key;tx2.keyed=keyed;tx2.isObj=isObj;tx2.forX=forX;tx2.vx=vx;let scsc=await renderSection(tx2,cx.doc,this,cx.key);if(el2&&scsc)Object.defineProperty(el2,"_ownerRe",{value:scsc,enumerable:false,configurable:true,writable:true});scsc._re=scsc;cx.ref.nodes[keyed]=tx2;return tx2}attrString(attrs){var buff=[];for(var key in attrs){buff.push(key+'="'+attrs[key]+'"')}if(!buff.length)return"";return" "+buff.join(" ")}_stringify(buff,doc2){var par2=this;switch(doc2.type){case"text":return buff+doc2.content;case"tag":buff+="<"+doc2.name+(doc2.attrs?par2.attrString(doc2.attrs):"")+(doc2.isV?"/>":">");if(doc2.isV)return buff;for(let i=0;i<doc2.children.length;i++){const dc=doc2.children[i];buff=buff+par2._stringify("",dc)}return buff+"</"+doc2.name+">";case"comment":return buff;default:return""}}stringify(doc2){var par2=this;return doc2.reduce(function(token,rootEl){return token+par2._stringify("",rootEl)},"")}}async function renderHST(hst,n,type="main",tx2,_pv=null,scopePath=["View"],ownVars,ownFns,ownViews){var reactiveVariables=hst.reactiveVars;hst=hst.hst;let _re=new _lm(new _v({"name":n,"type":type,"hst":hst,"vars":ownVars??tx2?.vx,"fns":ownFns,"views":ownViews,"rvs":reactiveVariables,"_pv":_pv}));_re.view.scopePath=scopePath;if(Object.keys(_re._cc).length){for(const ky in _re._cc){if(Object.hasOwnProperty.call(_re._cc,ky)){const csses=_re._cc[ky];for(let inde=0;inde<csses.length;inde++){let prom=new defer;const css=csses[inde];_csswrk.trigger("css-ready",{"csses":[css._css],"pre":"[vuid='"+ky+"']","key":ky});_vuid[ky]=prom;let _csses=await prom;css.nd.textContent=_csses[0]}}}}if(Object.keys(_re._jj).length){for(const ky in _re._jj){if(Object.hasOwnProperty.call(_re._jj,ky)){const jses=_re._jj[ky];for(let inde=0;inde<jses.length;inde++){const nd=jses[inde].nd;let code=_lmScriptCode(nd,_re.view,reactiveVariables,scopePath);if(code===null)continue;code=`try { _lmSetViewVar(document.currentScript); `+code+` } catch (e) { reportLumenError({ stage: 'script', error: e }); }`;code=code+`
27
- //# sourceURL=`+(_re.view?.name||"view")+`.view.generated.js`;nd.textContent=code}}}}return _re}async function fireRenderHook(cx,n,containerEl,extra){if(!containerEl)return;let attrKey="@"+n;if(!cx.doc||!cx.doc.evs||!cx.doc.evs.hasOwnProperty(attrKey))return;let attrVal=cx.doc.evs[attrKey];if(!attrVal)return;let ev=Object.assign({cType:n},extra||{});let result=evalEvAttr(attrVal,ev,$(containerEl),n);if(result&&typeof result.then==="function"){try{return await result}catch(e){return void 0}}return result}var _pendingPluginEls=[];var _pluginFlushTimer=null;function _flushPendingPlugins(tries){_pluginFlushTimer=null;var waiting=[];for(var i=0;i<_pendingPluginEls.length;i++){var p=_pendingPluginEls[i];if(p[0].isConnected)autoInitPlugins(p[0],p[1]);else waiting.push(p)}_pendingPluginEls=waiting;if(waiting.length&&tries<40){_pluginFlushTimer=setTimeout(function(){_flushPendingPlugins(tries+1)},50)}else{_pendingPluginEls=[]}}function _queuePluginInit(el2,attrs){_pendingPluginEls.push([el2,attrs]);if(_pluginFlushTimer===null){_pluginFlushTimer=setTimeout(function(){_flushPendingPlugins(0)},0)}}function autoInitPlugins(el2,attrs){if(!attrs)return;if(el2&&el2.isConnected===false&&(attrs.hasOwnProperty("sl")||attrs.hasOwnProperty("color")||attrs.hasOwnProperty("time")||attrs.hasOwnProperty("date")||attrs.hasOwnProperty("datetime"))){_queuePluginInit(el2,attrs);return}try{if(attrs.hasOwnProperty("sl")&&typeof $.fn.select2==="function"){initSl($(el2))}if(attrs.hasOwnProperty("color")&&typeof $.fn.colorpicker==="function"){$(el2).removeAttr("color").colorpicker({format:"rgba"})}if(typeof $.fn.datetimepicker==="function"){if(attrs.hasOwnProperty("time"))dtp($(el2),"time");if(attrs.hasOwnProperty("date"))dtp($(el2),"date");if(attrs.hasOwnProperty("datetime"))dtp($(el2),"datetime")}}catch(e){cl(e)}}function initSl(t){if(t.hasClass("select2-hidden-accessible"))return;try{var plchldr=t.attr("placeholder")?t.attr("placeholder"):"";var dir=$("body").hasClass("rtl")?"rtl":"ltr";var nr=t.attr("sl-nrmsg")?t.attr("sl-nrmsg"):"No results found";var minResultsForSearch=t.attr("sl-mins")?t.attr("sl-mins"):10;var allowNewTags=t.attr("sl-ntgs")?true:false;var dropdownParent=t.attr("sl-prt")?t.attr("sl-prt"):"body";if(dropdownParent=="self")dropdownParent=t.parent();else dropdownParent=$(dropdownParent);var query=t.attr("sl-query")?t.attr("sl-query"):null;var uniquer=Date.now();if(typeof window[query]==="function"){t.select2.amd.define("adapt_"+uniquer,["select2/data/array","select2/utils"],function(ArrayAdapter,Utils){function CustomDataAdapter($element,options){CustomDataAdapter.__super__.constructor.call(this,$element,options)}Utils.Extend(CustomDataAdapter,ArrayAdapter);CustomDataAdapter.prototype.query=function(params,callback){clearTimeout(_dbcrs[uniquer]);let _t=t;_dbcrs[uniquer]=setTimeout(function(){window[query](params,callback,_t)},!_dbcrs.hasOwnProperty(uniquer)?0:_dbcrsTime)};return CustomDataAdapter});t.select2({dropdownParent,minimumResultsForSearch:minResultsForSearch,placeholder:plchldr,dir,tags:allowNewTags,allowClear:true,language:{noResults:function(){return nr}},...t.select2.amd.require("adapt_"+uniquer)?{ajax:{},dataAdapter:t.select2.amd.require("adapt_"+uniquer)}:{}})}else{t.select2({dropdownParent,minimumResultsForSearch:minResultsForSearch,placeholder:plchldr,dir,tags:allowNewTags,allowClear:true,language:{noResults:function(){return nr}}})}if(t.attr("sl-nosrch"))t.on("select2:opening select2:closing",function(event){$(this).parent().find(".select2-search__field").prop("disabled",true)});if(t.attr("sl-class")){t.on("select2:opening",function(event){dropdownParent.addClass(t.attr("sl-class"))});t.on("select2:closing",function(event){dropdownParent.removeClass(t.attr("sl-class"))})}if(t.attr("sl-id")||t.attr("sl-text")){let text=t.attr("sl-text");let id=t.attr("sl-id");if(!text)text=id;if(!id)id=text;let newOption=new Option(text,id,true,true);t.append(newOption).trigger("select")}else{t.select2("val","")}if(t.attr("sl-value"))t.val(t.attr("sl-value")).trigger("change")}catch(e){cl(e)}}var _dbcrs={};var _dbcrsTime=250;function dtp(el2,t){el2.removeAttr(t);let opts={format:t=="date"?"yyyy-mm-dd":t=="time"?"hh:ii":"yyyy-mm-dd hh:ii",weekStart:el2.attr("date-week-start")??1,startView:t=="time"?1:el2.attr("startview")?el2.attr("startview"):2,minView:el2.attr("minview")?el2.attr("minview"):t=="time"?0:t=="datetime"?0:2,maxView:el2.attr("maxview")?el2.attr("maxview"):t=="time"?1:4,todayBtn:t=="time"?0:el2.attr("date-today")=="false"?0:1,todayHighlight:t=="time"?0:el2.attr("date-today")=="false"?0:1,language:el2.attr("date-lang")??"en",minuteStep:el2.attr("date-minute-step")??5,pickerPosition:el2.attr("date-position")??"top-right",autoclose:1,showMeridian:false};if(el2.attr("date-start"))opts["startDate"]=el2.attr("date-start");if(el2.attr("date-end"))opts["endDate"]=el2.attr("date-end");if(el2.attr("date-value"))opts["date"]=el2.attr("date-value");el2.datetimepicker(opts);if(t=="time"){el2.on("show",function(ev){$(".table-condensed > thead, .table-condensed > thead > tr > th, .table-condensed > thead > tr > th > i").attr("style","visibility: hidden; font-size:0px !important; overflow: hidden; height: 0px;")}).on("hide",function(ev){$(".table-condensed > thead, .table-condensed > thead > tr > th, .table-condensed > thead > tr > th > i").attr("style","visibility: visible;")})}if(el2.attr("date-link-start")){el2.on("change",function(e){let dp1=el2.data("datetimepicker");let dp2=$(el2.attr("date-link-start")).data("datetimepicker");dp2.setStartDate(dp1.getFormattedDate());if(dp2.getFormattedDate()<dp1.getFormattedDate()||dp2.getFormattedDate()=="")$(el2.attr("date-link-start")).val(dp1.getFormattedDate())})}else if(el2.attr("date-link-end")){el2.on("change",function(e){let dp1=$(el2.attr("date-link-end")).data("datetimepicker");let dp2=el2.data("datetimepicker");dp1.setEndDate(dp2.getFormattedDate())});opts["useCurrent"]=false}}const _V1_DEFAULT_LAYOUT={hst:["nav","header","body","footer"].map(function(r){let attrs={};attrs[r]="";return{type:"tag",name:"div",isV:false,attrs,ax:{},evs:{},ex:{},children:[]}}),reactiveVars:[],regions:["nav","header","footer"]};function _resolveTemplateEntry(attrs){let _payload=typeof _vcD!=="undefined"&&_vcD||(typeof _vcData!=="undefined"?_vcData:void 0);let name=String(attrs["tpl"]).replace(/^\/+/,"");let bucket=_payload&&_payload.tpls;for(const f of["tpls","comps"]){let entry=bucket&&bucket[btoa("src/"+f+"/"+name+".tpl")];if(entry)return entry}reportLumenError({stage:"tpl",error:new Error('tpl="'+name+'" \u2014 no such file at src/tpls/'+name+".tpl")});return null}function _reportTplMisuse(doc2,par2){if(doc2._tplReported)return;try{Object.defineProperty(doc2,"_tplReported",{value:true,enumerable:false})}catch(e){}let view=par2&&par2.view&&par2.view.name?' in "'+par2.view.name+'"':"";let msg;if(doc2.attrs.hasOwnProperty("comp")){msg='comp="'+doc2.attrs["comp"]+'"'+view+" is no longer supported. Put the :for on the element and use tpl=, e.g. <"+doc2.name+' :for="items as item" tpl="'+String(doc2.attrs["comp"]).replace(/^\/+/,"")+`">, and move the template's own :for out of the .tpl file.`}else{msg='tpl="'+doc2.attrs["tpl"]+'"'+view+" only works on a :for loop element, e.g. <"+doc2.name+' :for="items as item" tpl="'+String(doc2.attrs["tpl"]).replace(/^\/+/,"")+'">. It was ignored on this <'+doc2.name+">; move the template's :for onto this element."}reportLumenError({stage:"tpl",error:new Error(msg)})}async function renderSection(tx2,doc2,par2,k,sectionsData){if(tx2.node.isConnected){if(k){tx2._re.update(k)}return tx2._re}var hst=doc2.children;if(doc2.attrs&&(doc2.attrs.hasOwnProperty("tpl")||doc2.attrs.hasOwnProperty("comp"))){if(doc2.type==="sections"&&doc2.attrs.hasOwnProperty("tpl")&&!doc2.attrs.hasOwnProperty("comp")){let _tplEntry=_resolveTemplateEntry(doc2.attrs);if(_tplEntry)hst=_tplEntry.hst}else{_reportTplMisuse(doc2,par2)}}let _re=await renderHST({hst,mxes:[]},tx2.key,"section",tx2,par2,par2?.view?.scopePath||["View"],void 0,void 0,par2?.view?.views);tx2._re=_re;if(tx2.node){tx2.replaceWith(tx2.node);tx2.node.innerHTML="";tx2.node.append(..._re._RealDOM);_re.setEffects(doc2,tx2.node);_re.renderAll("section")}return _re}function _lmHstDefaults(payload){function fix(n){if(!n||typeof n!=="object")return;if(Array.isArray(n)){for(let i=0;i<n.length;i++)fix(n[i]);return}if(n.type==="text"){if(!n.mss)n.mss=[];return}if(n.type==="tag"||n.type==="section"||n.type==="sections"){if(!n.attrs)n.attrs={};if(!n.ax)n.ax={};if(!n.evs)n.evs={};if(!n.ex)n.ex={};if(n.isV===void 0)n.isV=false;if(!n.children)n.children=[];fix(n.children)}}for(const sec of["views","layouts","tpls"]){const group=payload[sec];if(!group)continue;for(const k in group)if(group[k]&&group[k].hst)fix(group[k].hst)}}var _lmScriptCodeBySrc=new Map;var _lmScriptCodeByAst=new WeakMap;function _lmScopeExpr(scopePath){let segs=Array.isArray(scopePath)?scopePath:[scopePath];let e="_vt";for(let i=0;i<segs.length;i++)e+=typeof segs[i]==="number"?"["+segs[i]+"]":"."+segs[i];return e}function _lmScriptCode(nd,view,reactiveVariables,scopePath){if(typeof nd._pre==="string")return nd._pre.split("_vt.__LMROOT__").join(_lmScopeExpr(scopePath));if(typeof getWatcher!=="function"||typeof acorn==="undefined"){reportLumenError({stage:"script",error:new Error("this view script was not precompiled by lm build and this production runtime cannot compile scripts \u2014 rebuild with a matching @lmjs/cli")});return null}let rv=Array.isArray(reactiveVariables)?reactiveVariables.join(","):Object.keys(reactiveVariables||{}).join(",");let subKey=rv+""+(Array.isArray(scopePath)?scopePath.join(""):String(scopePath));let bucket;if(nd._jst!==void 0){if(!nd._jst||typeof nd._jst!=="object")return null;bucket=_lmScriptCodeByAst.get(nd._jst);if(!bucket){bucket=new Map;_lmScriptCodeByAst.set(nd._jst,bucket)}if(bucket.has(subKey))return bucket.get(subKey);let code2=getWatcher(nd._jst,view,reactiveVariables,scopePath).code;bucket.set(subKey,code2);return code2}if(!nd._js||!String(nd._js).trim())return null;let key=nd._js+"\0"+subKey;if(_lmScriptCodeBySrc.has(key))return _lmScriptCodeBySrc.get(key);let ast;try{ast=acorn.parse(nd._js,{ecmaVersion:"latest",sourceType:"script"})}catch(e){reportLumenError({stage:"script",error:e});return null}let code=getWatcher(ast,view,reactiveVariables,scopePath).code;if(_lmScriptCodeBySrc.size>=1e3)_lmScriptCodeBySrc.clear();_lmScriptCodeBySrc.set(key,code);return code}function _lmSetViewVar(script){for(let n=script&&script.parentNode;n;n=n.parentNode){if(n.isSub===true){window.view=$(n);return}}}function mountModalView(el2,name){if(!el2||!name)return Promise.resolve();el2.isSub=true;el2.subPath=prepareNode(name).split("?")[0];el2.vars={};el2.views=[];el2.fns={};_vt.View.views.push(el2);return renderView(name,true,{})}async function renderView(n,isSub,d,type="views",viewsArr,scopeBase=["View"],force=false){let filePath="src/views/"+n+".view";if(type=="layouts")filePath="src/layouts/"+n+".layout";let fileKey=btoa(filePath);if(!isSub){View.props=d??{};var _queryParams=window.location.href.split("?");var nn=_queryParams.shift();View.params=paraToObj(_queryParams)??{}}n=prepareNode(n);var _queryParams=n.split("?");n=_queryParams.shift();let _payload=_vcD||(typeof _vcData!=="undefined"?_vcData:void 0);if(_payload&&!_payload.__hstVersionChecked){_payload.__hstVersionChecked=true;_lmHstDefaults(_payload);if(_payload.hstFormatVersion!==void 0&&_HST_FORMATS_ACCEPTED.indexOf(_payload.hstFormatVersion)===-1){reportLumenError({stage:"hst-version-mismatch",error:new Error("This project was compiled for HST format v"+_payload.hstFormatVersion+", but this LumenJS runtime expects v"+EXPECTED_HST_FORMAT_VERSION+". @lmjs/cli and @lmjs/core are out of sync \u2014 reinstall/upgrade both together.")});return}}if(_payload&&_payload[type].hasOwnProperty(fileKey)&&_csswrk.isStarted()){if(isSub)cl("Rendering",n,fileKey);var hst=_payload[type][fileKey];if(isSub){let searchArr=viewsArr||_vt.View.views;let els=[];for(let i=0;i<searchArr.length;i++){let _el2=searchArr[i];if(_el2.__isProxy)_el2=_el2.target;if(_el2.subPath==n)els.push({el:_el2,viewsIndex:i})}if(els.length){for(let i=0;i<els.length;i++){const{el:el2,viewsIndex}=els[i];if(!force&&el2._mountedSubPath===n&&el2._re&&el2._re._RealDOM&&el2._re._RealDOM.some(nd=>nd.isConnected)){continue}if(!force&&el2._mountedSubPath!==void 0&&!el2.isConnected){continue}el2.vars=el2.vars||{};el2.views=el2.views||[];el2.fns=el2.fns||{};let _re=await renderHST(hst,n,"sub",void 0,null,scopeBase.concat(["views",viewsIndex]),el2.vars,el2.fns,el2.views);el2._re=_re;el2._mountedSubPath=n;_mountedSubviewEngines.push(_re);el2.innerHTML="";el2.append(..._re._RealDOM);_re.renderAll();if(typeof globalWatch==="function"){try{globalWatch()}catch(e){cl(e)}}}}}else{if(type=="layouts"){let appSelector=appSettings.App??"[app]";var appContainer=$(appSelector);if(appContainer.length){let _rel=await renderHST(hst,n,"layout");appContainer.data("layout",n).html(_rel._RealDOM);_rel.renderAll();goToNode()}}else{let _re=await renderHST(hst,n,"main");if(_re.view.settings&&_re.view.settings.requireAuth){let authFunc=appSettings.auth&&typeof appSettings.auth==="function"?appSettings.auth:typeof Auth==="function"?Auth:null;if(typeof authFunc!=="function"){setError(null,"No Reactor.auth() function detected! Please add one");return}if(!authFunc()){let fallback=(appSettings.authView||appSettings.defaultView||"home").toLowerCase();if(fallback==n.toLowerCase()){setError(null,"The auth view '"+n+"' itself has requireAuth: true \u2014 it can never render");return}return renderView(fallback,null,{redirect:n.toLowerCase(),data:clone(View.props)})}}let layout=_re.view.settings.layout;let filePathL="src/layouts/"+layout+".layout";let fileKeyL=btoa(filePathL);let hstL=_payload["layouts"]&&_payload["layouts"][fileKeyL];if(!hstL){if(layout&&layout!=="default"){reportLumenError({stage:"layout",error:new Error('layout "'+layout+'" not found at '+filePathL+" \u2014 using the built-in default layout")})}hstL=JSON.parse(JSON.stringify(_V1_DEFAULT_LAYOUT))}let appSelector=appSettings.App??"[app]";var appContainer=$(appSelector);let layoutJustSwapped=false;if(appContainer.length){let currentLayout=$(appSelector).data("layout");if(currentLayout!=layout){let _rel=await renderHST(hstL,layout,"layout");appContainer.data("layout",layout).html(_rel._RealDOM);_rel.renderAll();layoutJustSwapped=true}else{}}else{$("body").prepend("<div "+appSelector+"></div>");let _rel=await renderHST(hstL,layout,"layout");appContainer=$(appSelector);appContainer.data("layout",layout).html(_rel._RealDOM);_rel.renderAll();layoutJustSwapped=true}let declaredRegions=hstL&&hstL.regions||[];for(const regionName of declaredRegions){let settingsKey="has"+regionName[0].toUpperCase()+regionName.slice(1);let want=_re.view.settings.hasOwnProperty(settingsKey)?_re.view.settings[settingsKey]:true;let resolvedFile=want===false?null:want===true?regionName:want;let w=_vt.Widgets[regionName]||(_vt.Widgets[regionName]={vars:{},fns:{},views:[],_re:null,_resolvedFile:void 0});if(resolvedFile!==w._resolvedFile){if(resolvedFile===null){$("["+regionName+"]").html("");w._re=null;w._resolvedFile=resolvedFile}else{let wFilePath="src/views/widgets/"+resolvedFile+".view";let wHst=_payload["views"][btoa(wFilePath)];if(wHst){let _rew=await renderHST(wHst,resolvedFile,"widget",void 0,null,["Widgets",regionName],w.vars,w.fns,w.views);w._re=_rew;$("["+regionName+"]").html(_rew._RealDOM);_rew.renderAll();w._resolvedFile=resolvedFile}}}else if(layoutJustSwapped&&w._re){$("["+regionName+"]").html(w._re._RealDOM)}}$("[body]").html(_re._RealDOM);if(_re.view._slots){for(const slotName in _re.view._slots){if(Object.prototype.hasOwnProperty.call(_re.view._slots,slotName)){$('[slot="'+slotName+'"]').html(_re.view._slots[slotName])}}}_re.renderAll();if(typeof globalWatch==="function"){try{globalWatch()}catch(e){cl(e)}}if(typeof View!=="undefined"&&View&&typeof View.onAfterMount==="function"){try{View.onAfterMount()}catch(e){cl(e)}}}}}else{setTimeout(()=>{renderView(n,isSub,d)},10)}}
26
+ var cl=console.log;var LumenJS_HTML_SNIFF_RE=/([&][a-zA-Z]*[;]+)|<\/?[a-z][\s\S]*>/im;class _v{static name;static type;static vars;static fns;static rvs;static _pv;static mx;static views;static hst;static settings;constructor(obj){this.name=obj.name??"home";this.type=obj.type??"main";this.hst=obj.hst??[];this.views=obj.views??[];this.vars=obj.vars??{};this.fns=obj.fns??{};this.rvs=obj.rvs??{};this._pv=obj._pv??null;this.mx=obj.mx??[];this.settings=obj.settings??{layout:"default",requireAuth:false}}}const consoleLogOriginal=console.log;console.log=function(){for(let i=0;i<arguments.length;i++){const arg=arguments[i];if(arg&&arg.hasOwnProperty("__isProxy")||arg?.target){arguments[i]=arguments[i].target}}consoleLogOriginal.apply(console,arguments)};var _lumenDevMode=true;var _lumenErrorLog=[];var _lumenLoggedExprs={};var _mountedSubviewEngines=[];var EXPECTED_HST_FORMAT_VERSION=3;var _HST_FORMATS_ACCEPTED=[1,2,3];function _numericPathToBrackets(expr2){if(typeof expr2!=="string"||!/\.\d/.test(expr2)||!/^\s*[A-Za-z_$][\w$]*(?:\.[\w$]+)+\s*$/.test(expr2))return expr2;return expr2.replace(/\.(\d[\w$]*)/g,"['$1']")}var _entityDecodeEl;function decodeHtmlEntities(str){if(!str||str.indexOf("&")===-1)return str;if(!_entityDecodeEl)_entityDecodeEl=document.createElement("textarea");_entityDecodeEl.innerHTML=str;return _entityDecodeEl.value}function _translateLumenError(message){if(!message)return message;return message.replace(/_vt\.View\.vars\[["'`]([^"'`\]]+)["'`]\]/g,"$1")}function reportLumenError(info){info=info||{};var rawMessage=info.message||info.error&&info.error.message||"Unknown error";var entry={time:new Date().toISOString(),stage:info.stage||"runtime",view:info.view||(typeof _vt!=="undefined"&&_vt.View?_vt.View.name:void 0),expr:info.expr,message:_translateLumenError(rawMessage),hint:info.hint};_lumenErrorLog.push(entry);if(_lumenDevMode&&entry.stage==="expression"){var dedupeKey=(entry.view||"")+"|"+(entry.expr||"")+"|"+rawMessage;if(_lumenLoggedExprs[dedupeKey])return entry;_lumenLoggedExprs[dedupeKey]=true;if(/ is not defined$/.test(rawMessage)){console.warn('[LumenJS] "'+(entry.view||"unknown")+'" \u2014 {{'+entry.expr+"}}: "+entry.message+" anywhere in scope, so it is shown as literal text.");return entry}if(/Cannot read propert(y|ies) of (undefined|null)/.test(rawMessage)){console.warn('[LumenJS] "'+(entry.view||"unknown")+'" \u2014 '+entry.expr+" is empty for now ("+entry.message+"). Fine if its data is still loading.");return entry}}if(_lumenDevMode){console.error("[LumenJS] "+entry.stage+' error in "'+(entry.view||"unknown")+'"'+(entry.expr?" \u2014 "+entry.expr:"")+": "+entry.message+(entry.hint?"\n "+entry.hint:""))}return entry}function _x(_x2){const _ARRAY_MUTATORS={push:1,pop:1,shift:1,unshift:1,splice:1,sort:1,reverse:1,fill:1,copyWithin:1};function _dispatchVarsUpdate(key,currPath){let varsIdx=currPath.indexOf("vars");if(varsIdx===-1)return;let varName=varsIdx<currPath.length-1?currPath[varsIdx+1]:key;let rootPath=currPath.slice(0,varsIdx);try{if(typeof watch!=="undefined"&&watch&&Object.prototype.hasOwnProperty.call(watch,varName)&&typeof watch[varName]==="function"){watch[varName]()}}catch(e){cl(e)}if(rootPath[0]==="Global"){try{if(typeof window!=="undefined")window[varName]=_x2.Global.vars[varName]}catch(e){}if(_vt.View._re)_vt.View._re.update(varName);for(const regionName in _vt.Widgets){if(_vt.Widgets[regionName]&&_vt.Widgets[regionName]._re){_vt.Widgets[regionName]._re.update(varName)}}for(let msi=_mountedSubviewEngines.length-1;msi>=0;msi--){let sve=_mountedSubviewEngines[msi];let sveNode=sve._RealDOM&&sve._RealDOM[0];if(sveNode&&!sveNode.isConnected){_mountedSubviewEngines.splice(msi,1);continue}sve.update(varName)}_updateReactiveEngines(varName);return}let owner=_x2;for(let i=0;i<rootPath.length&&owner;i++){owner=owner[rootPath[i]]}if(owner&&owner._re)owner._re.update(varName);for(let msi=_mountedSubviewEngines.length-1;msi>=0;msi--){const sve=_mountedSubviewEngines[msi];if(!sve||sve===(owner&&owner._re))continue;const sveNode=sve._RealDOM&&sve._RealDOM[0];if(sveNode&&!sveNode.isConnected){_mountedSubviewEngines.splice(msi,1);continue}const sp=sve.view&&sve.view.scopePath;if(!sp||sp.length<=rootPath.length)continue;let under=true;for(let i=0;i<rootPath.length;i++)if(String(sp[i])!==String(rootPath[i])){under=false;break}if(under)sve.update(varName)}_updateReactiveEngines(varName)}function _isWrappable(v){if(Array.isArray(v))return true;try{for(let p=Object.getPrototypeOf(v);p&&p!==Object.prototype;p=Object.getPrototypeOf(p)){const c=Object.prototype.hasOwnProperty.call(p,"constructor")?p.constructor:null;if(typeof c!=="function")continue;if(c.name==="Object")return true;if(/\[native code\]/.test(Function.prototype.toString.call(c)))return false}}catch(e){return false}return true}let _batch=0;function makeHandler(path){const childProxies=new WeakMap;return{get(target,key,receiver){if(key=="__isProxy")return true;if(typeof key==="symbol")return target[key];if(_ARRAY_MUTATORS[key]===1&&Array.isArray(target)&&typeof target[key]==="function"){return function(){let res;_batch++;try{res=Array.prototype[key].apply(target,arguments)}finally{_batch--}if(!_batch){try{_dispatchVarsUpdate(key,path)}catch(e){cl(e)}}return res===target?receiver:res}}const v=target[key];if(typeof v==="object"&&v!==null&&key!="_re"){const hit=childProxies.get(v);if(hit&&hit.key===key)return hit.proxy;if(!_isWrappable(v)&&v.isSub!==true)return v;const proxy=new Proxy(v,makeHandler(path.concat(key)));childProxies.set(v,{key,proxy});return proxy}return v??(key=="target"?target:void 0)??void 0},set(target,key,value){target[key]=value;if(!_batch){try{_dispatchVarsUpdate(key,path)}catch(e){cl(e)}}return true},deleteProperty(target,key){if(!(key in target)){return false}delete target[key];if(!_batch){try{_dispatchVarsUpdate(key,path)}catch(e){cl(e)}}return true},ownKeys(target){return Reflect.ownKeys(target)},has(target,key){return key in target},defineProperty(target,key,descriptor){if(descriptor&&"value"in descriptor){target[key]=descriptor.value}return target},getOwnPropertyDescriptor(target,key){const real=Reflect.getOwnPropertyDescriptor(target,key);if(real&&!real.configurable)return real;const value=target[key];return key in target?{value,enumerable:true,configurable:true}:void 0}}}const handler=makeHandler([]);var x=new Proxy(_x2,handler);return x}let _vt=_x({"View":new _v({}),"Global":{"vars":{},"fns":{}},"Widgets":{}});function touch(name){if(_vt.Global.vars.hasOwnProperty(name)){_vt.Global.vars[name]=_vt.Global.vars[name]}}var _deepReactiveCache=typeof WeakMap!=="undefined"?new WeakMap:null;function _deepReactive(obj,onChange){if(obj===null||typeof obj!=="object")return obj;if(_deepReactiveCache&&_deepReactiveCache.has(obj))return _deepReactiveCache.get(obj);var proxy=new Proxy(obj,{get(target,key){var v=target[key];if(v!==null&&typeof v==="object"&&typeof key!=="symbol"){return _deepReactive(v,onChange)}return v},set(target,key,value){target[key]=value;onChange();return true},deleteProperty(target,key){if(key in target)delete target[key];onChange();return true}});if(_deepReactiveCache)_deepReactiveCache.set(obj,proxy);return proxy}function _lookupInWidgets(name){for(const wname in _vt.Widgets){if(_vt.Widgets[wname].vars.hasOwnProperty(name))return _vt.Widgets[wname].vars[name]}return void 0}function _resolveScopePathTarget(scopePath){let target=_vt;for(let i=0;i<scopePath.length;i++)target=target[scopePath[i]];return target}function _evalEventScopedExpr(ownerRe,expr,locals){locals=locals||{};let hasOwner=!!(ownerRe&&ownerRe.view);let levels=[];for(let e=hasOwner?ownerRe:null,n=0;e&&e.view&&n<50;e=e.view._pv,n++){let live=null;if(e.view.scopePath){try{let _sv=_resolveScopePathTarget(e.view.scopePath);if(_sv&&_sv._re===e)live=_sv.vars}catch(err){live=null}}levels.push({re:e,vars:e.view.vars||{},live})}function levelOf(key){for(let i=0;i<levels.length;i++)if(Object.prototype.hasOwnProperty.call(levels[i].vars,key))return levels[i];return null}let widgetsVars=hasOwner?_mergedWidgetsVars():{};function ownFn(key){for(let i=0;i<levels.length;i++){const fns=levels[i].re.view.fns;if(fns&&Object.prototype.hasOwnProperty.call(fns,key)&&typeof fns[key]==="function")return fns[key]}return void 0}function isLocal(key){if(!locals.hasOwnProperty(key))return false;if(key==="ev"||key==="el"||key.indexOf("__lm")===0||!hasOwner)return true;return!(levelOf(key)||ownFn(key))}let scopeProxy=new Proxy({},{has(target,key){if(typeof key==="symbol")return false;if(locals.hasOwnProperty(key))return true;if(!hasOwner)return false;if(ownFn(key))return true;return!!levelOf(key)||widgetsVars.hasOwnProperty(key)||_vt.Global.vars.hasOwnProperty(key)},get(target,key){if(isLocal(key))return locals[key];const f=ownFn(key);if(f)return f;const lv=levelOf(key);if(lv)return lv.live?lv.live[key]:lv.vars[key];if(widgetsVars.hasOwnProperty(key)){for(const wname in _vt.Widgets)if(_vt.Widgets[wname].vars.hasOwnProperty(key))return _vt.Widgets[wname].vars[key]}return _vt.Global.vars[key]},set(target,key,value){if(isLocal(key)){locals[key]=value;return true}try{const lv=levelOf(key);if(lv){if(lv.live)lv.live[key]=value;else{lv.vars[key]=value;try{lv.re.update(key)}catch(e2){cl(e2)}}}else if(widgetsVars.hasOwnProperty(key)){for(const wname in _vt.Widgets){if(_vt.Widgets[wname].vars.hasOwnProperty(key)){_vt.Widgets[wname].vars[key]=value;break}}}else{_vt.Global.vars[key]=value}}catch(e){cl(e)}return true}});function _runWithScope(expr){with(scopeProxy){return eval(expr)}}if(locals.__lmNoWriteBack)return _runWithScope(expr);let rows=_lmRowSnapshots(levels);let result=_runWithScope(expr);if(rows.length){_lmRowWriteBack(rows);if(result&&typeof result.then==="function")result.then(function(){_lmRowWriteBack(rows)},function(){_lmRowWriteBack(rows)})}return result}var _lmRowPathRe=/^\s*[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*|\[\s*\d+\s*\])*\s*$/;var _lmRowWarned={};function _lmRowJson(v){try{return JSON.stringify(v===void 0?null:v)}catch(e){return null}}function _lmRowSnapshots(levels2){let rows2=[];for(let i=0;i<levels2.length;i++){let re=levels2[i].re,info=re&&re._lmRow;if(!info)continue;let vars=levels2[i].vars,forX=info.forX||{},as=forX.as||{};let names=[];if(info.isObj){let vName=as.v?as.v:as.k?"":"value";if(vName)names.push({name:vName,whole:true})}else{if(as.k)names.push({name:as.k,whole:true});let item=as.k?vars[as.k]:null;let src=item&&typeof item==="object"&&!Array.isArray(item)?item:null;for(let k in vars){if(!Object.prototype.hasOwnProperty.call(vars,k)||k===as.k||k===forX.dx||k==="index"||k==="key"||k==="value")continue;if(src?Object.prototype.hasOwnProperty.call(src,k):!as.k)names.push({name:k,whole:false})}}let snap={};for(let n=0;n<names.length;n++)snap[names[n].name]=_lmRowJson(vars[names[n].name]);rows2.push({re,vars,info,names,snap})}return rows2}function _lmRowWriteBack(rows2){for(let r=0;r<rows2.length;r++){let row=rows2[r],vars=row.vars,info=row.info,js=info.forX&&info.forX.js;let owner=row.re.view&&row.re.view._pv;let pos=info.isObj?vars.key:vars.index;for(let n=0;n<row.names.length;n++){let name=row.names[n].name,now=_lmRowJson(vars[name]);if(now===row.snap[name])continue;let before=row.snap[name];row.snap[name]=now;if(!owner||typeof js!=="string"||!_lmRowPathRe.test(js)||pos===void 0){if(_lumenDevMode&&!_lmRowWarned[js]){_lmRowWarned[js]=true;console.warn('[LumenJS] A change to a row of :for="'+js+'" was not saved: the list is not a variable. Loop over a variable, or change the item in the list itself (list[i].prop = value).')}continue}let value=vars[name];try{if(!row.names[n].whole){_evalEventScopedExpr(owner,"("+js+")[__lmPos][__lmProp] = __lmVal",{__lmPos:pos,__lmProp:name,__lmVal:clone(value),__lmNoWriteBack:true})}else if(value&&typeof value==="object"&&!Array.isArray(value)){let old=null;try{old=JSON.parse(before)}catch(e){old=null}if(!old||typeof old!=="object"||Array.isArray(old)){_evalEventScopedExpr(owner,"("+js+")[__lmPos] = __lmVal",{__lmPos:pos,__lmVal:clone(value),__lmNoWriteBack:true});continue}for(let k in value){if(!Object.prototype.hasOwnProperty.call(value,k))continue;if(_lmRowJson(value[k])===_lmRowJson(old[k]))continue;_evalEventScopedExpr(owner,"("+js+")[__lmPos][__lmProp] = __lmVal",{__lmPos:pos,__lmProp:k,__lmVal:clone(value[k]),__lmNoWriteBack:true})}for(let k in old){if(Object.prototype.hasOwnProperty.call(old,k)&&!Object.prototype.hasOwnProperty.call(value,k))_evalEventScopedExpr(owner,"delete ("+js+")[__lmPos][__lmProp]",{__lmPos:pos,__lmProp:k,__lmNoWriteBack:true})}}else{_evalEventScopedExpr(owner,"("+js+")[__lmPos] = __lmVal",{__lmPos:pos,__lmVal:clone(value),__lmNoWriteBack:true})}_lmRowTouch(owner,js)}catch(e){cl(e)}}}}function _lmRowTouch(owner,js){let root=/^\s*([A-Za-z_$][\w$]*)/.exec(js);if(!root)return;root=root[1];for(let e=owner,n=0;e&&e.view&&n<50;e=e.view._pv,n++){if(!e.view.vars||!Object.prototype.hasOwnProperty.call(e.view.vars,root))continue;if(e._lmRow){try{e.update(root)}catch(err){cl(err)}}return}}var _scopedEvalFns=new Map;var _SVG_NS="http://www.w3.org/2000/svg";function _lmSetAttr(el2,name,val){if(el2&&el2.namespaceURI===_SVG_NS){if(name.indexOf("xlink:")===0)return el2.setAttributeNS("http://www.w3.org/1999/xlink",name,val);if(name==="xmlns"||name.indexOf("xmlns:")===0)return el2.setAttributeNS("http://www.w3.org/2000/xmlns/",name,val)}el2.setAttribute(name,val)}var _CONST_EFFECT="\0const";function _mergedWidgetsVars(){let out={};let widgets=_vt.Widgets;let names=Object.keys(widgets);for(let i=names.length-1;i>=0;i--){Object.assign(out,widgets[names[i]].vars)}return out}class _lm{_RealDOM=[];_effects={};_cc={};_jj={};_ready=false;view=void 0;sbscrbs=[];reactiveVariables=[];vrs={};_CXR=[];_LXR=[];constructor(view){this.view=view;this.view._re=this;this.reactiveVariables=view?.rvs??{};this.init();if(this.view.type=="main")_vt.View=this.view;if(this.view._pv){this.view._pv.subscribe(this.view)}return this}init(){var par2=this;this.view.hst.forEach(function(doc2){par2.walk(doc2,null)})}subscribe(view){this.sbscrbs.push(view)}scopedEval(context,expr2,kk){let ctx=this.concatVarsAtLevel(context,this);expr2=_numericPathToBrackets(expr2);if(kk){if(!ctx.hasOwnProperty(kk))return void 0;delete ctx[kk]}try{const ctxKeys=Object.keys(ctx);const evalKey=ctxKeys.join("");let evaluator=_scopedEvalFns.get(evalKey);if(!evaluator){evaluator=Function.apply(null,[...ctxKeys,"expr","return eval(expr)"]);if(_scopedEvalFns.size>=500)_scopedEvalFns.clear();_scopedEvalFns.set(evalKey,evaluator)}return evaluator.apply(null,[...Object.values(ctx),expr2])}catch(e){if(e instanceof TypeError&&!kk){let hadUndefined=false;let strippedCtx={};for(const k2 in ctx){if(ctx[k2]===void 0||ctx[k2]===null){hadUndefined=true;continue}strippedCtx[k2]=ctx[k2]}if(hadUndefined){try{const evaluator2=Function.apply(null,[...Object.keys(strippedCtx),"expr","return eval(expr)"]);return evaluator2.apply(null,[...Object.values(strippedCtx),expr2])}catch(e2){const m2=e2 instanceof ReferenceError&&/^([\w$]+) is not defined$/.exec(e2.message);if(m2&&Object.prototype.hasOwnProperty.call(ctx,m2[1])){reportLumenError({stage:"expression",expr:expr2,error:e});return void 0}if(e2 instanceof ReferenceError)this._lastUnresolved=true;reportLumenError({stage:"expression",expr:expr2,error:e2});return void 0}}}if(e instanceof ReferenceError)this._lastUnresolved=true;reportLumenError({stage:"expression",expr:expr2,error:e});return void 0}}_inForRow(){for(let r=this,n=0;r&&n<50;r=r.view&&r.view._pv,n++){if(r._blankUnresolved)return true;if(r.vrs&&Object.keys(r.vrs).length)return true;let v=r.view;if(v&&v.type==="section"&&v.vars&&Object.keys(v.vars).length)return true}return false}_textMustache(content){this._lastUnresolved=false;let v=this.getVal(content);let unresolved=this._lastUnresolved&&(v===void 0||v===null||v==="");this._lastUnresolved=false;if(!unresolved)return v;if(this._inForRow())return v;let raw=String(content);return/^\s*\{\{[\s\S]*\}\}\s*$/.test(raw)?raw:"{{"+raw+"}}"}getVals(effect){let val="";if(effect.type=="text"){if(!effect.isSplit){for(let i=0;i<effect.splits.length;i++){let split=effect.splits[i];if(split.type=="mustache"){val+=this._textMustache(split.content)}else{val+=split.content}}}else{val=this._textMustache(effect.content)}}else if(effect.type=="attr"||effect.type=="event"){for(let i=0;i<effect.splits.length;i++){let split=effect.splits[i];if(split.type=="mustache"){val+=this.getVal(split.content)}else{val+=split.content}}}return val}renderAll(){if(this._ready)return;this._ready=true;for(const rv in this._effects){if(Object.prototype.hasOwnProperty.call(this._effects,rv)){const effects=this._effects[rv];for(let ei=0;ei<effects.length;ei++){const effect=effects[ei];if(!effect.nd)continue;try{if(effect.type=="text"){this.applyTextEffect(effect)}else if(effect.type=="attr"){if(effect.name=="value"){effect.nd.value=this.render(effect)}else{_lmSetAttr(effect.nd,effect.name,this.render(effect));if(effect.name=="view"){effect.nd.subPath=this.render(effect);renderView(this.render(effect),true,{})}}}else if(effect.type=="event"){effect.nd.events[effect.name]=this.render(effect)}}catch(e){cl("Eeeeee",e)}}}}this.updateCXRs();this.updateLXRs();this.updateVXRs();if(typeof appSettings!=="undefined"&&appSettings&&typeof appSettings.tick==="function"){try{appSettings.tick()}catch(e){cl(e)}}}chainConnected(cx){for(let i=cx.chain.length-1;i>=0;i--){const cxs=cx.chain[i];if(cxs.ref.isPreConnected){return true}}return false}async updateVXRs(k){let subsNames=[];for(let i=0;i<this.view.views.length;i++){const _view=this.view.views[i];if(!subsNames.includes(_view.subPath))subsNames.push(_view.subPath)}if(!subsNames.length)return;if(this._RealDOM&&this._RealDOM.length&&!this._RealDOM.some(function(nd){return nd&&nd.isConnected})){this._vxrWaits=(this._vxrWaits||0)+1;if(this._vxrWaits<=200)setTimeout(()=>this.updateVXRs(k),10);return}this._vxrWaits=0;for(let i=0;i<subsNames.length;i++){const n=subsNames[i];renderView(n,true,{},"views",this.view.views,this.view.scopePath||["View"])}}_evalCondition(expr2){if(typeof expr2==="string"&&expr2.charAt(0)==="!"){return!this.evalExp(expr2.substring(1),this.reactiveVariables)}return this.evalExp(expr2,this.reactiveVariables)}async updateCXRs(k){for(let i=0;i<this._CXR.length;i++){const cx=this._CXR[i];if(cx.name=="if"){let isTrue=this._evalCondition(cx.content);if(isTrue){await this.showSectionCX(cx,k)}else{await this.hideSectionCX(cx)}}else if(cx.name=="else-if"){if(!this.chainConnected(cx)){let isTrue=this._evalCondition(cx.content);if(isTrue){await this.showSectionCX(cx,k)}else{await this.hideSectionCX(cx)}}else{await this.hideSectionCX(cx)}}else if(cx.name=="else"){if(!this.chainConnected(cx)){await this.showSectionCX(cx,k)}else{await this.hideSectionCX(cx)}}}}async showSectionCX(cx,k){let wasConnected=cx.ref.node.isConnected;cx.ref.isPreConnected=true;await renderSection(cx.ref,cx.doc,this,k);if(!wasConnected)await fireRenderHook(cx,"after-render",cx.ref.node,{visible:true})}async hideSectionCX(cx){if(cx.ref.node.isConnected)await fireRenderHook(cx,"before-render",cx.ref.node,{visible:false});cx.ref.isPreConnected=false;cx.ref.node.replaceWith(cx.ref)}render(effect){let x="";try{if(effect.type=="text"||effect.type=="attr"||effect.type=="event"){x=this.getVals(effect)}}catch(e){cl(e)}return x}applyTextEffect(effect){let val=this.render(effect);let nd=effect.nd;let clone2=effect._htmlClone||nd._lmHtmlClone||null;if(LumenJS_HTML_SNIFF_RE.test(val)){nd.textContent="";if(!clone2){clone2=document.createElement("span");nd.before(clone2)}effect._htmlClone=nd._lmHtmlClone=clone2;clone2.innerHTML=val}else{if(clone2){clone2.remove();effect._htmlClone=nd._lmHtmlClone=null}nd.textContent=val}}update(k){if(!this._ready)return;if(this._effects.hasOwnProperty(k)){const effects=this._effects[k];for(let ei=0;ei<effects.length;ei++){const effect=effects[ei];if(!effect.nd)continue;try{if(effect.type=="text"){this.applyTextEffect(effect)}else if(effect.type=="attr"){if(effect.name=="value"){effect.nd.value=this.render(effect)}else{_lmSetAttr(effect.nd,effect.name,this.render(effect));if(effect.name=="view"){effect.nd.subPath=this.render(effect);renderView(this.render(effect),true,{})}}}else if(effect.type=="event"){effect.nd.events[effect.name]=this.render(effect)}}catch(e){cl("Eeeeee",e)}}}this.updateCXRs(k);this.updateLXRs(k);for(let sbscsi=0;sbscsi<this.sbscrbs.length;sbscsi++){const sbscr=this.sbscrbs[sbscsi];sbscr._re.update(k)}if(typeof appSettings!=="undefined"&&appSettings&&typeof appSettings.tick==="function"){try{appSettings.tick()}catch(e){cl(e)}}}_forReads(cx,k){const js=cx.forX["js"];if(js===k)return true;const cache=cx._reads||(cx._reads={});if(k in cache)return cache[k];let hit=false;if(typeof k==="string"&&k!==""){const src=[js,cx.limit,cx.offset,cx.cond].filter(s=>typeof s==="string").join("\n");hit=new RegExp("(^|[^\\w$.])"+k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"(?![\\w$])").test(src)}return cache[k]=hit}_forNum(raw){if(typeof raw!=="string"||raw.indexOf("{")===-1)return raw;const self=this;return raw.replace(/\{\s*\{\s*([\s\S]*?)\s*\}\s*\}/g,function(_,expr2){let v;try{v=self.getVal(expr2,"")}catch(e){v=""}return v===void 0||v===null?"":String(v)}).trim()}async updateLXRs(k){for(let i=0;i<this._LXR.length;i++){var cx=this._LXR[i];var forX=cx.forX;if(k&&!this._forReads(cx,k))continue;if(cx._updating){cx._dirty=true;continue}cx._updating=true;try{var val=this.getVal(forX["js"],"");var tempVal=[];if(this.typeStr(val)=="number"){for(let i2=0;i2<val;i2++){tempVal.push(i2)}val=tempVal}let vals=[];let isObj=false;if(this.typeStr(val)=="object"){isObj=true;for(const oKey in val){if(Object.hasOwnProperty.call(val,oKey)){const item=val[oKey];let objj={key:oKey,value:item};vals.push(objj)}}}else vals=clone(val);if(this.typeStr(vals)!="array")vals=[];{let forIf=cx.cond;let limit=vals.length;let offset=0;const cxLimit=this._forNum(cx.limit);const cxOffset=this._forNum(cx.offset);if(cxLimit)limit=(isNaN(cxLimit)?cxLimit:limit)>vals.length?vals.length:cxLimit*1;if(cxOffset)offset=(isNaN(cxOffset)?cxOffset:offset)<0?0:cxOffset*1;let marray=[];if(forIf){marray=vals.slice(offset*1,vals.length)}else{marray=vals.slice(offset*1,limit*1+offset*1)}let myLimit=0;let arrayToRender=[];let arrayToRenderVXs=[];for(var index=0;index<marray.length;index++){if(myLimit==limit*1)break;try{let vx={};vx["index"]=offset*1+index*1;if(forX["dx"]!="")vx[forX["dx"]]=offset*1+index*1;if(isObj){if(forX["as"]["v"]!=""){if(forX["as"]["k"])vx[forX["as"]["k"]]=marray[index]["key"];if(forX["as"]["v"])vx[forX["as"]["v"]]=marray[index]["value"]}else{if(forX["as"]["k"])vx[forX["as"]["k"]]=marray[index]}vx["key"]=marray[index]["key"];vx["value"]=marray[index]["value"]}else{if(forX["as"]["k"])vx[forX["as"]["k"]]=marray[index];if(marray[index]&&typeof marray[index]==="object"&&!Array.isArray(marray[index])){for(const k2 in marray[index]){if(Object.prototype.hasOwnProperty.call(marray[index],k2)){vx[k2]=marray[index][k2]}}}}if(forIf){let _prevVrs=this.vrs;this.vrs=vx;let isTrue;try{isTrue=this.evalExp(forIf,[])}finally{this.vrs=_prevVrs}if(!isTrue)continue}let miIndexx=offset*1+index*1;arrayToRender.push(marray[index]);arrayToRenderVXs.push(vx);myLimit++}catch(e){cl(e)}}let oldATR=cx.atr;cx.atr=clone(arrayToRender);const actions=this.compareArrays(oldATR,arrayToRender);if(actions.length)await fireRenderHook(cx,"before-render",cx.ref.parentElement,{items:arrayToRender,actions});let addActions=[];let otherActions=[];for(let ai=0;ai<actions.length;ai++){(actions[ai].action=="add"?addActions:otherActions).push(actions[ai])}if(addActions.length){let createdSections=await Promise.all(addActions.map(actn=>{let vx=arrayToRenderVXs[actn.index];return this.createSection(cx,vx,isObj,forX,actn.index)}));for(let ci=0;ci<createdSections.length;ci++){let cln=createdSections[ci];cx.ref.before(cln);cln.replaceWith(cln.node)}}for(let ai=0;ai<otherActions.length;ai++){const actn=otherActions[ai];if(actn.action=="remove"){var keyed=cx.key+"_"+actn.index;let tx2=cx.ref?.nodes[keyed];if(tx2){tx2.remove();tx2.node.remove();delete cx.ref.nodes[keyed]}}else{var keyed=cx.key+"_"+actn.index;let tx2=cx.ref?.nodes[keyed];let vx=arrayToRenderVXs[actn.index];if(tx2){tx2._re.vrs=vx;let _rowVars=tx2._re.view&&tx2._re.view.vars;if(_rowVars&&_rowVars!==vx){for(const _rk in _rowVars)if(!(_rk in vx))delete _rowVars[_rk];Object.assign(_rowVars,vx)}if(tx2.isObj){if(tx2.forX.as["k"]!="")tx2._re.update(tx2.forX.as["k"]);else tx2._re.update(tx2.forX.js);if(tx2.forX.as["v"]!="")tx2._re.update(tx2.forX.as["v"]);for(let actnsi=0;actnsi<actn.updates.length;actnsi++){const actnu=actn.updates[actnsi];tx2._re.update(actnu.property)}}else{if(tx2.forX.as["k"]!="")tx2._re.update(tx2.forX.as["k"]);else tx2._re.update(tx2.forX.js);for(const ik in vx){if(Object.prototype.hasOwnProperty.call(vx,ik)&&ik!==tx2.forX.js&&ik!==tx2.forX.as["k"])tx2._re.update(ik)}}}}}if(actions.length)await fireRenderHook(cx,"after-render",cx.ref.parentElement,{items:arrayToRender,actions})}}finally{cx._updating=false;if(cx._dirty){cx._dirty=false;Promise.resolve().then(()=>this.updateLXRs(k))}}}}compareLogic(array1,array2){if(array1.length===array2.length){return 1}else{if(array1.length>array2.length){return 2}else{return 3}}}compareArrays(array1,array2){const actions=[];const maxLength=Math.max(array1.length,array2.length);for(let i=0;i<maxLength;i++){const element1=array1[i];const element2=array2[i];if(element2===void 0){actions.push({action:"remove",index:i})}else if(element1===void 0){actions.push({action:"add",index:i,element:element2})}else if(!this.deepCompare(element1,element2)){actions.push({action:"update",index:i,updates:this.getUpdates(element1,element2)})}}return actions}findDeletedIndexes(array1,array2){const deletedIndexes=[];let par2=this;array1.forEach((item,index)=>{const foundIndex=array2.findIndex(el2=>par2.deepCompare(el2,item));if(foundIndex===-1){deletedIndexes.push(index)}});return deletedIndexes}findAddedIndexes(array1,array2){const addedIndexes=[];let par2=this;array2.forEach((item,index)=>{const foundIndex=array1.findIndex(el2=>par2.deepCompare(el2,item));if(foundIndex===-1){addedIndexes.push(index)}});return addedIndexes}deepCompare(obj1,obj2){return JSON.stringify(obj1)===JSON.stringify(obj2)}getUpdates(oldObj,newObj){const updates=[];for(const key in newObj){if(newObj.hasOwnProperty(key)&&newObj[key]!==oldObj[key]){updates.push({property:key,value:newObj[key]})}}return updates}getVal(mo,indexName){let vars={};try{for(let i=0;i<this.reactiveVariables.length;i++){let __name=this.reactiveVariables[i];if(_vt.View.vars.hasOwnProperty(__name)){vars[__name]=_vt.View.vars[__name]}else{let _wv=_lookupInWidgets(__name);let _gv=_wv!==void 0?_wv:_vt.Global.vars[__name];if(_gv!==void 0)vars[__name]=_gv}}for(const ky in this.vrs){if(Object.prototype.hasOwnProperty.call(this.vrs,ky)){vars[ky]=this.vrs[ky]}}if(this.view&&this.view.vars){for(const ky in this.view.vars){if(Object.prototype.hasOwnProperty.call(this.view.vars,ky)){vars[ky]=this.view.vars[ky]}}}}catch(e){cl(e)}mo=mo.trim();if(mo.slice(0,2)=="{{"){mo=mo.slice(2,-2)}let value="";let _mo=mo;if(mo.indexOf("`")>-1){var matchesVal=_mo.match(/\.`[\s\S]*?`/g);if(matchesVal)for(var y=0;y<matchesVal.length;y++){_mo=_mo.split(matchesVal[y]).join("."+this.getVal(matchesVal[y].substr(1).slice(1,-1),indexName))}var matchesVal=_mo.match(/`[\s\S]*?`/g);if(matchesVal)for(var y=0;y<matchesVal.length;y++){_mo=_mo.split(matchesVal[y]).join("'"+this.getVal(matchesVal[y].slice(1,-1),indexName)+"'")}return this.getVal(_mo,indexName)}if(mo.indexOf(";")>-1){let zxx=mo.split(";");mo=$.trim(zxx[0])}if(mo.indexOf(" as ")>-1){mo=mo.split(" as ");return this.getVal(mo[0],indexName)}if(indexName){indexName=indexName.toString();if(mo.indexOf(indexName)>-1&&mo!=indexName&&vars.hasOwnProperty(indexName)&&mo!="index"){mo=mo.split(indexName).join(vars[indexName]);return this.getVal(mo,indexName)}}var Ondex=mo.match(/\bindex\b/g);if(Ondex&&mo!="index"&&vars.hasOwnProperty("index")){_mo=mo.replace(/\bindex\b/g,vars["index"]);return this.getVal(_mo,indexName)}value=this.lookup(mo,vars);return value??""}concatVarsAtLevel(levelVars,parent2){if(!parent2.view._pv){var concatenatedVars={...levelVars};if(parent2.view.vars){concatenatedVars={..._vt.Global.vars,..._mergedWidgetsVars(),...parent2.view.vars,...concatenatedVars}}return concatenatedVars}var concatenatedVars={...levelVars};if(parent2.view.vars){concatenatedVars={...parent2.view.vars,...concatenatedVars}}return this.concatVarsAtLevel(concatenatedVars,parent2.view._pv)}lookup(name,vaz){let vars=this.concatVarsAtLevel(vaz,this);try{var value;var names,index,lookupHit=false;if(this.hasProperty(vars,name)){value=vars[name]}else if(name.indexOf(".")>-1&&name.indexOf("[")==-1){var value=this.scopedEval(vars,name);if(!(value||value==0)){value=vars;names=name.split(".");index=0;while(value!=null&&index<names.length){if(index===names.length-1)lookupHit=this.hasProperty(value,names[index]);value=value[names[index++]]}}}else{var value=this.scopedEval(vars,name);if(!(value||value==0)){if(name.indexOf(".")==-1&&name.indexOf("[")>-1){let _name=name;var matchesVal=_name.match(/\[[\s\S]*?\]/g);for(var y=0;y<matchesVal.length;y++){if(matchesVal[y].indexOf("'")==-1&&matchesVal[y].indexOf('"')==-1)_name=_name.split(matchesVal[y]).join("['"+matchesVal[y].slice(1,-1)+"']")}var value=this.scopedEval(vars,_name)}}}if(this.isFunction(value))value=value.call(value)}catch(e){reportLumenError({stage:"lookup",expr:name,error:e});return""}return value}objectToString=Object.prototype.toString;isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)==="[object Array]"};isFunction(object){return typeof object==="function"}typeStr(obj){return this.isArray(obj)?"array":typeof obj}hasProperty(obj,propName){return obj!=null&&typeof obj==="object"&&propName in obj}createEl(tag,attrs,children,events,doc2){const _el2=doc2&&doc2.svg?document.createElementNS(_SVG_NS,tag):document.createElement(tag);Object.defineProperty(_el2,"_ownerRe",{value:this,enumerable:false,configurable:true,writable:true});_el2.isSub=false;if(attrs.hasOwnProperty("view")){_el2.isSub=true;_el2.subPath=attrs["view"];_el2.vars={};_el2.views=[];_el2.fns={};if(doc2&&doc2.evs&&doc2.evs.hasOwnProperty("@init")){let _initAttr=doc2.evs["@init"];if(_initAttr){let _rowScope=Object.assign({},this.view&&this.view.type==="section"&&this.view.vars||{},this.vrs||{});let _initResult=evalEvAttr(_initAttr,{cType:"init"},$(_el2),"init",_rowScope);if(_initResult&&typeof _initResult==="object"&&typeof _initResult.then!=="function"){Object.assign(_el2.vars,_initResult)}}}this.view.views.push(_el2)}_el2.events={};for(const prop in attrs){if(prop=="view"||prop==":data"||prop==":if"||prop==":else-if"||prop==":else"||prop==":for"||prop==":for-limit"||prop==":for-offset"||prop==":for-if")continue;try{let val=doc2&&doc2.ax.hasOwnProperty(prop)?"":attrs[prop];if(prop=="value"&&!(doc2&&doc2.svg)){_el2.value=val}else _lmSetAttr(_el2,prop,val)}catch(e){cl(e)}}for(const prop in events){try{_el2.events[prop]=events[prop];if(typeof _lmIndexAtEl==="function")_lmIndexAtEl(_el2,prop)}catch(e){cl(e)}}if(children.length)_el2.append(...children);if(events&&events["@after-render"]&&!(attrs&&(attrs.hasOwnProperty(":for")||attrs.hasOwnProperty(":if")||attrs.hasOwnProperty(":else-if")||attrs.hasOwnProperty(":else")))){_queueMountHook(doc2,_el2)}autoInitPlugins(_el2,attrs);return _el2}evalExp(expr2,vars){let rvars={};try{for(let i=0;i<vars.length;i++){let __name=vars[i];if(_vt.View.vars.hasOwnProperty(__name)){rvars[__name]=_vt.View.vars[__name]}else{let _wv=_lookupInWidgets(__name);rvars[__name]=_wv!==void 0?_wv:_vt.Global.vars[__name]}}for(const ky in this.vrs){if(Object.prototype.hasOwnProperty.call(this.vrs,ky)){rvars[ky]=this.vrs[ky]}}if(this.view&&this.view.vars){for(const ky in this.view.vars){if(Object.prototype.hasOwnProperty.call(this.view.vars,ky)){rvars[ky]=this.view.vars[ky]}}}}catch(e){cl(e)}try{var value=this.scopedEval(rvars,expr2);if(value&&value!=0)return true}catch(e){reportLumenError({stage:"condition",expr:expr2,error:e});return false}return false}splitTextWithMustaches(text,mustaches){mustaches.sort((a,b)=>a.start-b.start);const elements=[];let currentIndex=0;for(const mustache of mustaches){if(currentIndex<mustache.start){elements.push({type:"static",content:text.substring(currentIndex,mustache.start)})}elements.push({type:"mustache",jst:mustache.jst,rvs:mustache.rvs,content:text.substring(mustache.start,mustache.end)});currentIndex=mustache.end}if(currentIndex<text.length){elements.push({type:"static",content:text.substring(currentIndex)})}return elements}walk(doc,parent){var par=this;var tx,el;switch(doc.type){case"text":if(doc.mss.length){let splitIt=true;if(doc.tag=="textarea"){splitIt=false}if(splitIt){let splits=this.splitTextWithMustaches(doc.content,doc.mss);for(let si=0;si<splits.length;si++){const split=splits[si];if(split.type=="static"){let txnd=document.createTextNode(decodeHtmlEntities(split.content));if(!parent)par._RealDOM.push(txnd);(tx??(tx=[])).push(txnd)}else{let txnd=document.createTextNode("");const _keys=split.rvs.length?split.rvs:[_CONST_EFFECT];for(let ri=0;ri<_keys.length;ri++){const element=_keys[ri];(this._effects[element]??(this._effects[element]=[])).push({"type":"text","content":split.content,"jst":split.jst,"rvs":split.rvs,"isSplit":true,"nd":txnd,"tag":doc.tag})}if(!parent)par._RealDOM.push(txnd);(tx??(tx=[])).push(txnd)}}return tx}else{tx=document.createTextNode("");const _anyRv=doc.mss.some(m=>m.rvs.length);for(let mui=0;mui<doc.mss.length;mui++){const mus=doc.mss[mui];const _keys=mus.rvs.length?mus.rvs:!_anyRv&&mui===0?[_CONST_EFFECT]:[];for(let ri=0;ri<_keys.length;ri++){const element=_keys[ri];(this._effects[element]??(this._effects[element]=[])).push({"type":"text","content":doc.content,"splits":this.splitTextWithMustaches(doc.content,doc.mss),"jst":mus.jst,"rvs":mus.rvs,"isSplit":false,"nd":tx,"tag":doc.tag})}}if(!parent)par._RealDOM.push(tx);return tx}}else{tx=document.createTextNode(decodeHtmlEntities(doc.content));if(!parent)par._RealDOM.push(tx);return tx}break;case"sections":case"section":var _dd=md5(new Date().getTime()/1e3+"::"+Math.random());tx=document.createTextNode("");var typeN=null;if(doc.attrs.hasOwnProperty(":else"))typeN="else";else if(doc.attrs.hasOwnProperty(":else-if"))typeN="else-if";else if(doc.attrs.hasOwnProperty(":if"))typeN="if";else typeN="for";if(doc.type=="section"){var chain=[];if(typeN=="else-if"||typeN=="else"){try{let lastInChain=this._CXR.at(-1);if(lastInChain){_dd=lastInChain.key;chain.push(...lastInChain.chain,lastInChain)}}catch(e){}}el=par.createEl(doc.name,doc.attrs,[],doc.evs,doc);tx.node=el;this._CXR.push({"type":"section","name":typeN,"content":doc.cond,"doc":doc,"key":_dd,"chain":chain,"ref":tx});this.setEffects(doc,el)}else if(doc.type=="sections"){tx.key=_dd;tx.node=null;tx.nodes={};let docRaw=doc;this._LXR.push({"type":"sections","name":typeN,"cond":doc.attrs.hasOwnProperty(":for-if")?doc.attrs[":for-if"]:null,"limit":doc.attrs.hasOwnProperty(":for-limit")?doc.attrs[":for-limit"]:0,"offset":doc.attrs.hasOwnProperty(":for-offset")?doc.attrs[":for-offset"]:0,"content":doc.content,"forX":doc.forX,"doc":docRaw,"key":_dd,"atr":[],"ref":tx})}if(!parent)par._RealDOM.push(tx);return tx;break;case"tag":var _dd=md5(new Date().getTime()/1e3+"::"+Math.random());if(doc.name.toLowerCase()=="settings"){if(par.view.type=="main"){var defaultSettings={layout:"default",requireAuth:false};try{let settingsC=doc.children[0].content;let settings={};eval("settings = "+settingsC+";");if(settings){if(settings.layout==null)settings.layout="default";if(settings.requireAuth==null)settings.requireAuth=false;par.view.settings=settings}else{par.view.settings=defaultSettings}}catch(e){setError(e,"Error in your settings tag inside the '"+par.view.name.toLowerCase()+"' main view!");par.view.settings=defaultSettings}}}else if(doc.name.toLowerCase()=="script"||doc.name.toLowerCase()=="js"){let child=doc.children[0]||{};let js=child.content;let jst=child.jst;let isScoped=false;if(doc.attrs.hasOwnProperty("scoped")){delete doc.attrs["scoped"];isScoped=true}el=par.createEl("script",doc.attrs,[],doc.evs,doc);el._sc=isScoped;el._dd=_dd;el._jst=jst;el._js=js;el._pre=child.pre;(par._jj[_dd]??(par._jj[_dd]=[])).push({"nd":el})}else if(doc.name.toLowerCase()=="style"){let css=doc.children[0].content;let isScoped=false;el=par.createEl("style",{},[],doc.evs,doc);if(doc.attrs.hasOwnProperty("scoped")){if(!parent){if(par.view._dd)_dd=par.view._dd;else{par.view._dd=_dd;if(par.view.type=="main")$("[body]")[0].setAttribute("vuid",_dd)}}else{if(parent._dd)_dd=parent._dd;else{parent._dd=_dd;parent.setAttribute("vuid",_dd)}}delete doc.attrs["scoped"];isScoped=true;el._sc=isScoped;el._dd=_dd;el._css=css;(par._cc[_dd]??(par._cc[_dd]=[])).push({"nd":el,"_css":css})}else{el._sc=isScoped;el._dd=_dd;el.textContent=css}for(const prop in doc.attrs){try{_el.setAttribute(prop,doc.attrs[prop])}catch(e){cl(e)}}}else if(doc.name.toLowerCase()=="icon"){let child=par.createEl("span",{"class":"iconify","data-icon":doc?.icon??"mdi:home"},[],{},null);el=par.createEl("span",doc.attrs,[child],doc.evs,doc)}else if(doc.name.toLowerCase()=="slot"){let slotName=doc.attrs&&doc.attrs.name;if(slotName){let tempWrapper=document.createElement("div");let childs=[];for(let i=0;i<doc.children.length;i++){const dc=doc.children[i];let chils=par.walk(dc,tempWrapper);if(chils){if(Array.isArray(chils)){if(chils.length)childs=[...childs,...chils]}else{childs.push(chils)}}}(par.view._slots??(par.view._slots={}))[slotName]=childs}}else if(doc.attrs&&(doc.attrs.hasOwnProperty("tpl")||doc.attrs.hasOwnProperty("comp"))){let _elAttrs=Object.assign({},doc.attrs);delete _elAttrs["tpl"];delete _elAttrs["comp"];delete _elAttrs[":data"];el=par.createEl(doc.name,_elAttrs,[],doc.evs,doc);_reportTplMisuse(doc,par)}else{el=par.createEl(doc.name,doc.attrs,[],doc.evs,doc);if(!doc.isV&&!el.isSub){let childs=[];for(let i=0;i<doc.children.length;i++){const dc=doc.children[i];let chils=par.walk(dc,el);if(chils){if(Array.isArray(chils)){if(chils.length)childs=[...childs,...chils]}else{childs.push(chils)}}}childs.length?el.append(...childs):null}}this.setEffects(doc,el);if(el){if(!parent)par._RealDOM.push(el)}return el;break;case"comment":break;default:break}}setEffects(doc2,el2){let rvs=[];if(Object.keys(doc2.ax).length){for(const attrName in doc2.ax){if(Object.hasOwnProperty.call(doc2.ax,attrName)){const attrMustaches=doc2.ax[attrName];const _anyRv=attrMustaches.some(m=>m.rvs.length);for(let i=0;i<attrMustaches.length;i++){const mus=attrMustaches[i];const _keys=mus.rvs.length?mus.rvs:!_anyRv&&i===0?[_CONST_EFFECT]:[];for(let ri=0;ri<_keys.length;ri++){const element=_keys[ri];if(element!==_CONST_EFFECT)rvs.push(element);(this._effects[element]??(this._effects[element]=[])).push({"type":"attr","name":attrName,"content":doc2.attrs[attrName],"splits":this.splitTextWithMustaches(doc2.attrs[attrName],doc2.ax[attrName]),"jst":mus.jst,"rvs":mus.rvs,"nd":el2})}}}}}if(Object.keys(doc2.ex).length){for(const ky in doc2.ex){if(Object.hasOwnProperty.call(doc2.ex,ky)){const mss=doc2.ex[ky];for(let i=0;i<mss.length;i++){const mus=mss[i];for(let ri=0;ri<mus.rvs.length;ri++){const element=mus.rvs[ri];rvs.push(element);(this._effects[element]??(this._effects[element]=[])).push({"type":"event","name":ky,"content":doc2.evs[ky],"splits":this.splitTextWithMustaches(doc2.evs[ky],doc2.ex[ky]),"jst":mus.jst,"rvs":mus.rvs,"nd":el2})}}}}}return rvs.filter((value,index,self)=>{return self.indexOf(value)===index})}async createSection(cx,vx,isObj,forX,pos){var keyed=cx.key+"_"+(pos!==void 0?pos:vx.index);var tx2=document.createTextNode("");var typeN2=null;if(cx.doc.attrs.hasOwnProperty(":else"))typeN2="else";else if(cx.doc.attrs.hasOwnProperty(":else-if"))typeN2="else-if";else if(cx.doc.attrs.hasOwnProperty(":if"))typeN2="if";else typeN2="for";let _ownerVrs=this.vrs;this.vrs=Object.assign({},_ownerVrs||{},vx||{});let el2;try{el2=this.createEl(cx.doc.name,cx.doc.attrs,[],cx.doc.evs,cx.doc)}finally{this.vrs=_ownerVrs}tx2.node=el2;tx2.key=cx.key;tx2.keyed=keyed;tx2.isObj=isObj;tx2.forX=forX;tx2.vx=vx;let scsc=await renderSection(tx2,cx.doc,this,cx.key);if(el2&&scsc)Object.defineProperty(el2,"_ownerRe",{value:scsc,enumerable:false,configurable:true,writable:true});if(scsc&&typeN2==="for"&&forX)scsc._lmRow={forX,isObj};scsc._re=scsc;cx.ref.nodes[keyed]=tx2;return tx2}attrString(attrs){var buff=[];for(var key in attrs){buff.push(key+'="'+attrs[key]+'"')}if(!buff.length)return"";return" "+buff.join(" ")}_stringify(buff,doc2){var par2=this;switch(doc2.type){case"text":return buff+doc2.content;case"tag":buff+="<"+doc2.name+(doc2.attrs?par2.attrString(doc2.attrs):"")+(doc2.isV?"/>":">");if(doc2.isV)return buff;for(let i=0;i<doc2.children.length;i++){const dc=doc2.children[i];buff=buff+par2._stringify("",dc)}return buff+"</"+doc2.name+">";case"comment":return buff;default:return""}}stringify(doc2){var par2=this;return doc2.reduce(function(token,rootEl){return token+par2._stringify("",rootEl)},"")}}async function renderHST(hst,n,type="main",tx2,_pv=null,scopePath=["View"],ownVars,ownFns,ownViews){var reactiveVariables=hst.reactiveVars;hst=hst.hst;let _re=new _lm(new _v({"name":n,"type":type,"hst":hst,"vars":ownVars??tx2?.vx,"fns":ownFns,"views":ownViews,"rvs":reactiveVariables,"_pv":_pv}));_re.view.scopePath=scopePath;if(Object.keys(_re._cc).length){for(const ky in _re._cc){if(Object.hasOwnProperty.call(_re._cc,ky)){const csses=_re._cc[ky];for(let inde=0;inde<csses.length;inde++){let prom=new defer;const css=csses[inde];_csswrk.trigger("css-ready",{"csses":[css._css],"pre":"[vuid='"+ky+"']","key":ky});_vuid[ky]=prom;let _csses=await prom;css.nd.textContent=_csses[0]}}}}if(Object.keys(_re._jj).length){for(const ky in _re._jj){if(Object.hasOwnProperty.call(_re._jj,ky)){const jses=_re._jj[ky];for(let inde=0;inde<jses.length;inde++){const nd=jses[inde].nd;let code=_lmScriptCode(nd,_re.view,reactiveVariables,scopePath);if(code===null)continue;code=`try { _lmSetViewVar(document.currentScript); `+code+` } catch (e) { reportLumenError({ stage: 'script', error: e }); }`;code=code+`
27
+ //# sourceURL=`+(_re.view?.name||"view")+`.view.generated.js`;nd.textContent=code}}}}return _re}async function fireRenderHook(cx,n,containerEl,extra){if(!containerEl)return;let attrKey="@"+n;if(!cx.doc||!cx.doc.evs||!cx.doc.evs.hasOwnProperty(attrKey))return;let attrVal=cx.doc.evs[attrKey];if(!attrVal)return;let ev=Object.assign({cType:n},extra||{});let result2=evalEvAttr(attrVal,ev,$(containerEl),n);if(result2&&typeof result2.then==="function"){try{return await result2}catch(e){return void 0}}return result2}var _pendingMountHooks=[];var _mountHookTimer=null;function _mountHookReady(doc2,el2){if(!el2.isConnected)return false;let v=doc2&&doc2.evs&&doc2.evs["@after-render"];if(typeof v!=="string"||!/^\s*[A-Za-z_$][\w$]*\s*$/.test(v))return true;v=v.trim();if(typeof window[v]==="function")return true;for(let e=el2._ownerRe,n=0;e&&e.view&&n<50;e=e.view._pv,n++){if(e.view.fns&&typeof e.view.fns[v]==="function")return true}return false}function _queueMountHook(doc2,el2){_pendingMountHooks.push([doc2,el2,0]);if(!_mountHookTimer)_mountHookTimer=setTimeout(_flushMountHooks,0)}function _flushMountHooks(){_mountHookTimer=null;let waiting=[];let due=_pendingMountHooks;_pendingMountHooks=[];for(let i=0;i<due.length;i++){let doc2=due[i][0],el2=due[i][1],tries=due[i][2];if(_mountHookReady(doc2,el2))fireRenderHook({doc:doc2},"after-render",el2,{});else if(tries<40)waiting.push([doc2,el2,tries+1]);else if(el2.isConnected)fireRenderHook({doc:doc2},"after-render",el2,{})}for(let i=0;i<waiting.length;i++)_pendingMountHooks.push(waiting[i]);if(_pendingMountHooks.length&&!_mountHookTimer)_mountHookTimer=setTimeout(_flushMountHooks,waiting.length===_pendingMountHooks.length?50:0)}var _pendingPluginEls=[];var _pluginFlushTimer=null;function _flushPendingPlugins(tries){_pluginFlushTimer=null;var waiting=[];for(var i=0;i<_pendingPluginEls.length;i++){var p=_pendingPluginEls[i];if(p[0].isConnected)autoInitPlugins(p[0],p[1]);else waiting.push(p)}_pendingPluginEls=waiting;if(waiting.length&&tries<40){_pluginFlushTimer=setTimeout(function(){_flushPendingPlugins(tries+1)},50)}else{_pendingPluginEls=[]}}function _queuePluginInit(el2,attrs){_pendingPluginEls.push([el2,attrs]);if(_pluginFlushTimer===null){_pluginFlushTimer=setTimeout(function(){_flushPendingPlugins(0)},0)}}function autoInitPlugins(el2,attrs){if(!attrs)return;if(el2&&el2.isConnected===false&&(attrs.hasOwnProperty("sl")||attrs.hasOwnProperty("color")||attrs.hasOwnProperty("time")||attrs.hasOwnProperty("date")||attrs.hasOwnProperty("datetime"))){_queuePluginInit(el2,attrs);return}try{if(attrs.hasOwnProperty("sl")&&typeof $.fn.select2==="function"){initSl($(el2))}if(attrs.hasOwnProperty("color")&&typeof $.fn.colorpicker==="function"){$(el2).removeAttr("color").colorpicker({format:"rgba"})}if(typeof $.fn.datetimepicker==="function"){if(attrs.hasOwnProperty("time"))dtp($(el2),"time");if(attrs.hasOwnProperty("date"))dtp($(el2),"date");if(attrs.hasOwnProperty("datetime"))dtp($(el2),"datetime")}}catch(e){cl(e)}}function initSl(t){if(t.hasClass("select2-hidden-accessible"))return;try{var plchldr=t.attr("placeholder")?t.attr("placeholder"):"";var dir=$("body").hasClass("rtl")?"rtl":"ltr";var nr=t.attr("sl-nrmsg")?t.attr("sl-nrmsg"):"No results found";var minResultsForSearch=t.attr("sl-mins")?t.attr("sl-mins"):10;var allowNewTags=t.attr("sl-ntgs")?true:false;var dropdownParent=t.attr("sl-prt")?t.attr("sl-prt"):"body";if(dropdownParent=="self")dropdownParent=t.parent();else dropdownParent=$(dropdownParent);var query=t.attr("sl-query")?t.attr("sl-query"):null;var uniquer=Date.now();if(typeof window[query]==="function"){t.select2.amd.define("adapt_"+uniquer,["select2/data/array","select2/utils"],function(ArrayAdapter,Utils){function CustomDataAdapter($element,options){CustomDataAdapter.__super__.constructor.call(this,$element,options)}Utils.Extend(CustomDataAdapter,ArrayAdapter);CustomDataAdapter.prototype.query=function(params,callback){clearTimeout(_dbcrs[uniquer]);let _t=t;_dbcrs[uniquer]=setTimeout(function(){window[query](params,callback,_t)},!_dbcrs.hasOwnProperty(uniquer)?0:_dbcrsTime)};return CustomDataAdapter});t.select2({dropdownParent,minimumResultsForSearch:minResultsForSearch,placeholder:plchldr,dir,tags:allowNewTags,allowClear:true,language:{noResults:function(){return nr}},...t.select2.amd.require("adapt_"+uniquer)?{ajax:{},dataAdapter:t.select2.amd.require("adapt_"+uniquer)}:{}})}else{t.select2({dropdownParent,minimumResultsForSearch:minResultsForSearch,placeholder:plchldr,dir,tags:allowNewTags,allowClear:true,language:{noResults:function(){return nr}}})}if(t.attr("sl-nosrch"))t.on("select2:opening select2:closing",function(event){$(this).parent().find(".select2-search__field").prop("disabled",true)});if(t.attr("sl-class")){t.on("select2:opening",function(event){dropdownParent.addClass(t.attr("sl-class"))});t.on("select2:closing",function(event){dropdownParent.removeClass(t.attr("sl-class"))})}if(t.attr("sl-id")||t.attr("sl-text")){let text=t.attr("sl-text");let id=t.attr("sl-id");if(!text)text=id;if(!id)id=text;let newOption=new Option(text,id,true,true);t.append(newOption).trigger("select")}else{t.select2("val","")}if(t.attr("sl-value"))t.val(t.attr("sl-value")).trigger("change")}catch(e){cl(e)}}var _dbcrs={};var _dbcrsTime=250;function dtp(el2,t){el2.removeAttr(t);let opts={format:t=="date"?"yyyy-mm-dd":t=="time"?"hh:ii":"yyyy-mm-dd hh:ii",weekStart:el2.attr("date-week-start")??1,startView:t=="time"?1:el2.attr("startview")?el2.attr("startview"):2,minView:el2.attr("minview")?el2.attr("minview"):t=="time"?0:t=="datetime"?0:2,maxView:el2.attr("maxview")?el2.attr("maxview"):t=="time"?1:4,todayBtn:t=="time"?0:el2.attr("date-today")=="false"?0:1,todayHighlight:t=="time"?0:el2.attr("date-today")=="false"?0:1,language:el2.attr("date-lang")??"en",minuteStep:el2.attr("date-minute-step")??5,pickerPosition:el2.attr("date-position")??"top-right",autoclose:1,showMeridian:false};if(el2.attr("date-start"))opts["startDate"]=el2.attr("date-start");if(el2.attr("date-end"))opts["endDate"]=el2.attr("date-end");if(el2.attr("date-value"))opts["date"]=el2.attr("date-value");el2.datetimepicker(opts);if(t=="time"){el2.on("show",function(ev){$(".table-condensed > thead, .table-condensed > thead > tr > th, .table-condensed > thead > tr > th > i").attr("style","visibility: hidden; font-size:0px !important; overflow: hidden; height: 0px;")}).on("hide",function(ev){$(".table-condensed > thead, .table-condensed > thead > tr > th, .table-condensed > thead > tr > th > i").attr("style","visibility: visible;")})}if(el2.attr("date-link-start")){el2.on("change",function(e){let dp1=el2.data("datetimepicker");let dp2=$(el2.attr("date-link-start")).data("datetimepicker");dp2.setStartDate(dp1.getFormattedDate());if(dp2.getFormattedDate()<dp1.getFormattedDate()||dp2.getFormattedDate()=="")$(el2.attr("date-link-start")).val(dp1.getFormattedDate())})}else if(el2.attr("date-link-end")){el2.on("change",function(e){let dp1=$(el2.attr("date-link-end")).data("datetimepicker");let dp2=el2.data("datetimepicker");dp1.setEndDate(dp2.getFormattedDate())});opts["useCurrent"]=false}}const _V1_DEFAULT_LAYOUT={hst:["nav","header","body","footer"].map(function(r){let attrs={};attrs[r]="";return{type:"tag",name:"div",isV:false,attrs,ax:{},evs:{},ex:{},children:[]}}),reactiveVars:[],regions:["nav","header","footer"]};function _resolveTemplateEntry(attrs){let _payload=typeof _vcD!=="undefined"&&_vcD||(typeof _vcData!=="undefined"?_vcData:void 0);let name=String(attrs["tpl"]).replace(/^\/+/,"");let bucket=_payload&&_payload.tpls;for(const f of["tpls","comps"]){let entry=bucket&&bucket[btoa("src/"+f+"/"+name+".tpl")];if(entry)return entry}reportLumenError({stage:"tpl",error:new Error('tpl="'+name+'" \u2014 no such file at src/tpls/'+name+".tpl")});return null}function _reportTplMisuse(doc2,par2){if(doc2._tplReported)return;try{Object.defineProperty(doc2,"_tplReported",{value:true,enumerable:false})}catch(e){}let view=par2&&par2.view&&par2.view.name?' in "'+par2.view.name+'"':"";let msg;if(doc2.attrs.hasOwnProperty("comp")){msg='comp="'+doc2.attrs["comp"]+'"'+view+" is no longer supported. Put the :for on the element and use tpl=, e.g. <"+doc2.name+' :for="items as item" tpl="'+String(doc2.attrs["comp"]).replace(/^\/+/,"")+`">, and move the template's own :for out of the .tpl file.`}else{msg='tpl="'+doc2.attrs["tpl"]+'"'+view+" only works on a :for loop element, e.g. <"+doc2.name+' :for="items as item" tpl="'+String(doc2.attrs["tpl"]).replace(/^\/+/,"")+'">. It was ignored on this <'+doc2.name+">; move the template's :for onto this element."}reportLumenError({stage:"tpl",error:new Error(msg)})}async function renderSection(tx2,doc2,par2,k,sectionsData){if(tx2.node.isConnected){if(k){tx2._re.update(k)}return tx2._re}var hst=doc2.children;if(doc2.attrs&&(doc2.attrs.hasOwnProperty("tpl")||doc2.attrs.hasOwnProperty("comp"))){if(doc2.type==="sections"&&doc2.attrs.hasOwnProperty("tpl")&&!doc2.attrs.hasOwnProperty("comp")){let _tplEntry=_resolveTemplateEntry(doc2.attrs);if(_tplEntry)hst=_tplEntry.hst}else{_reportTplMisuse(doc2,par2)}}let _re=await renderHST({hst,mxes:[]},tx2.key,"section",tx2,par2,par2?.view?.scopePath||["View"],void 0,void 0,par2?.view?.views);tx2._re=_re;if(tx2.node){tx2.replaceWith(tx2.node);tx2.node.innerHTML="";tx2.node.append(..._re._RealDOM);_re.setEffects(doc2,tx2.node);_re.renderAll("section")}return _re}function _lmHstDefaults(payload){function fix(n){if(!n||typeof n!=="object")return;if(Array.isArray(n)){for(let i=0;i<n.length;i++)fix(n[i]);return}if(n.type==="text"){if(!n.mss)n.mss=[];return}if(n.type==="tag"||n.type==="section"||n.type==="sections"){if(!n.attrs)n.attrs={};if(!n.ax)n.ax={};if(!n.evs)n.evs={};if(!n.ex)n.ex={};if(n.isV===void 0)n.isV=false;if(!n.children)n.children=[];fix(n.children)}}for(const sec of["views","layouts","tpls"]){const group=payload[sec];if(!group)continue;for(const k in group)if(group[k]&&group[k].hst)fix(group[k].hst)}}var _lmScriptCodeBySrc=new Map;var _lmScriptCodeByAst=new WeakMap;function _lmScopeExpr(scopePath){let segs=Array.isArray(scopePath)?scopePath:[scopePath];let e="_vt";for(let i=0;i<segs.length;i++)e+=typeof segs[i]==="number"?"["+segs[i]+"]":"."+segs[i];return e}function _lmScriptCode(nd,view,reactiveVariables,scopePath){if(typeof nd._pre==="string")return nd._pre.split("_vt.__LMROOT__").join(_lmScopeExpr(scopePath));if(typeof getWatcher!=="function"||typeof acorn==="undefined"){reportLumenError({stage:"script",error:new Error("this view script was not precompiled by lm build and this production runtime cannot compile scripts \u2014 rebuild with a matching @lmjs/cli")});return null}let rv=Array.isArray(reactiveVariables)?reactiveVariables.join(","):Object.keys(reactiveVariables||{}).join(",");let subKey=rv+""+(Array.isArray(scopePath)?scopePath.join(""):String(scopePath));let bucket;if(nd._jst!==void 0){if(!nd._jst||typeof nd._jst!=="object")return null;bucket=_lmScriptCodeByAst.get(nd._jst);if(!bucket){bucket=new Map;_lmScriptCodeByAst.set(nd._jst,bucket)}if(bucket.has(subKey))return bucket.get(subKey);let code2=getWatcher(nd._jst,view,reactiveVariables,scopePath).code;bucket.set(subKey,code2);return code2}if(!nd._js||!String(nd._js).trim())return null;let key=nd._js+"\0"+subKey;if(_lmScriptCodeBySrc.has(key))return _lmScriptCodeBySrc.get(key);let ast;try{ast=acorn.parse(nd._js,{ecmaVersion:"latest",sourceType:"script"})}catch(e){reportLumenError({stage:"script",error:e});return null}let code=getWatcher(ast,view,reactiveVariables,scopePath).code;if(_lmScriptCodeBySrc.size>=1e3)_lmScriptCodeBySrc.clear();_lmScriptCodeBySrc.set(key,code);return code}function _lmSetViewVar(script){for(let n=script&&script.parentNode;n;n=n.parentNode){if(n.isSub===true){window.view=$(n);return}}}function mountModalView(el2,name){if(!el2||!name)return Promise.resolve();el2.isSub=true;el2.subPath=prepareNode(name).split("?")[0];el2.vars={};el2.views=[];el2.fns={};_vt.View.views.push(el2);return renderView(name,true,{})}async function renderView(n,isSub,d,type="views",viewsArr,scopeBase=["View"],force=false){let filePath="src/views/"+n+".view";if(type=="layouts")filePath="src/layouts/"+n+".layout";let fileKey=btoa(filePath);if(!isSub){View.props=d??{};var _queryParams=window.location.href.split("#")[0].split("?");var nn=_queryParams.shift();View.params=paraToObj(_queryParams)??{}}n=prepareNode(n);var _queryParams=n.split("?");n=_queryParams.shift();let _payload=_vcD||(typeof _vcData!=="undefined"?_vcData:void 0);if(_payload&&!_payload.__hstVersionChecked){_payload.__hstVersionChecked=true;_lmHstDefaults(_payload);if(_payload.hstFormatVersion!==void 0&&_HST_FORMATS_ACCEPTED.indexOf(_payload.hstFormatVersion)===-1){reportLumenError({stage:"hst-version-mismatch",error:new Error("This project was compiled for HST format v"+_payload.hstFormatVersion+", but this LumenJS runtime expects v"+EXPECTED_HST_FORMAT_VERSION+". @lmjs/cli and @lmjs/core are out of sync \u2014 reinstall/upgrade both together.")});return}}if(_payload&&_payload[type].hasOwnProperty(fileKey)&&_csswrk.isStarted()){if(isSub)cl("Rendering",n,fileKey);var hst=_payload[type][fileKey];if(isSub){let searchArr=viewsArr||_vt.View.views;let els=[];for(let i=0;i<searchArr.length;i++){let _el2=searchArr[i];if(_el2.__isProxy)_el2=_el2.target;if(_el2.subPath==n)els.push({el:_el2,viewsIndex:i})}if(els.length){for(let i=0;i<els.length;i++){const{el:el2,viewsIndex}=els[i];if(!force&&el2._mountedSubPath===n&&el2._re&&el2._re._RealDOM&&el2._re._RealDOM.some(nd=>nd.isConnected)){continue}if(!force&&el2._mountedSubPath!==void 0&&!el2.isConnected){continue}el2.vars=el2.vars||{};el2.views=el2.views||[];el2.fns=el2.fns||{};let _re=await renderHST(hst,n,"sub",void 0,null,scopeBase.concat(["views",viewsIndex]),el2.vars,el2.fns,el2.views);el2._re=_re;el2._mountedSubPath=n;_mountedSubviewEngines.push(_re);el2.innerHTML="";el2.append(..._re._RealDOM);_re.renderAll();if(typeof globalWatch==="function"){try{globalWatch()}catch(e){cl(e)}}}}}else{if(type=="layouts"){let appSelector=appSettings.App??"[app]";var appContainer=$(appSelector);if(appContainer.length){let _rel=await renderHST(hst,n,"layout");appContainer.data("layout",n).html(_rel._RealDOM);_rel.renderAll();goToNode()}}else{let _re=await renderHST(hst,n,"main");if(_re.view.settings&&_re.view.settings.requireAuth){let authFunc=appSettings.auth&&typeof appSettings.auth==="function"?appSettings.auth:typeof Auth==="function"?Auth:null;if(typeof authFunc!=="function"){setError(null,"No Reactor.auth() function detected! Please add one");return}if(!authFunc()){let fallback=(appSettings.authView||appSettings.defaultView||"home").toLowerCase();if(fallback==n.toLowerCase()){setError(null,"The auth view '"+n+"' itself has requireAuth: true \u2014 it can never render");return}return renderView(fallback,null,{redirect:n.toLowerCase(),data:clone(View.props)})}}let layout=_re.view.settings.layout;let filePathL="src/layouts/"+layout+".layout";let fileKeyL=btoa(filePathL);let hstL=_payload["layouts"]&&_payload["layouts"][fileKeyL];if(!hstL){if(layout&&layout!=="default"){reportLumenError({stage:"layout",error:new Error('layout "'+layout+'" not found at '+filePathL+" \u2014 using the built-in default layout")})}hstL=JSON.parse(JSON.stringify(_V1_DEFAULT_LAYOUT))}let appSelector=appSettings.App??"[app]";var appContainer=$(appSelector);let layoutJustSwapped=false;if(appContainer.length){let currentLayout=$(appSelector).data("layout");if(currentLayout!=layout){let _rel=await renderHST(hstL,layout,"layout");appContainer.data("layout",layout).html(_rel._RealDOM);_rel.renderAll();layoutJustSwapped=true}else{}}else{$("body").prepend("<div "+appSelector+"></div>");let _rel=await renderHST(hstL,layout,"layout");appContainer=$(appSelector);appContainer.data("layout",layout).html(_rel._RealDOM);_rel.renderAll();layoutJustSwapped=true}let declaredRegions=hstL&&hstL.regions||[];for(const regionName of declaredRegions){let settingsKey="has"+regionName[0].toUpperCase()+regionName.slice(1);let want=_re.view.settings.hasOwnProperty(settingsKey)?_re.view.settings[settingsKey]:true;let resolvedFile=want===false?null:want===true?regionName:want;let w=_vt.Widgets[regionName]||(_vt.Widgets[regionName]={vars:{},fns:{},views:[],_re:null,_resolvedFile:void 0});if(resolvedFile!==w._resolvedFile){if(resolvedFile===null){$("["+regionName+"]").html("");w._re=null;w._resolvedFile=resolvedFile}else{let wFilePath="src/views/widgets/"+resolvedFile+".view";let wHst=_payload["views"][btoa(wFilePath)];if(wHst){let _rew=await renderHST(wHst,resolvedFile,"widget",void 0,null,["Widgets",regionName],w.vars,w.fns,w.views);w._re=_rew;$("["+regionName+"]").html(_rew._RealDOM);_rew.renderAll();w._resolvedFile=resolvedFile}}}else if(layoutJustSwapped&&w._re){$("["+regionName+"]").html(w._re._RealDOM)}}$("[body]").html(_re._RealDOM);if(_re.view._slots){for(const slotName in _re.view._slots){if(Object.prototype.hasOwnProperty.call(_re.view._slots,slotName)){$('[slot="'+slotName+'"]').html(_re.view._slots[slotName])}}}_re.renderAll();if(typeof globalWatch==="function"){try{globalWatch()}catch(e){cl(e)}}if(typeof View!=="undefined"&&View&&typeof View.onAfterMount==="function"){try{View.onAfterMount()}catch(e){cl(e)}}}}}else{setTimeout(()=>{renderView(n,isSub,d)},10)}}
28
28
 
29
29
  var _reactiveEngines=[];var _rxMoustache=/\{\s*\{\s*([\s\S]*?)\s*\}\s*\}/g;var _rxVoid={area:1,base:1,basefont:1,bgsound:1,br:1,col:1,command:1,embed:1,frame:1,hr:1,image:1,img:1,input:1,isindex:1,keygen:1,link:1,menuitem:1,meta:1,nextid:1,param:1,source:1,track:1,wbr:1};var _rxSkip={};"break case catch class const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield await async of static get set null true false undefined NaN Infinity Object Function Boolean Symbol Error Number BigInt Math Date String RegExp Array Map Set WeakMap WeakSet Promise Reflect Proxy Intl JSON console window document navigator location localStorage sessionStorage fetch setTimeout clearTimeout setInterval clearInterval parseInt parseFloat isFinite isNaN encodeURI decodeURI encodeURIComponent decodeURIComponent escape unescape globalThis".split(" ").forEach(function(w){_rxSkip[w]=1});var _rxExprCache=new Map;function _rxKeepOneSpace(t){t=t.replace(/\s\s/gm," ");if(/\s\s/gm.test(t))return _rxKeepOneSpace(t);return t}function _rxClean(t){t=t.replace(/(\r?\n|\r)/gm,"");t=t.replace(/(\t)/gm,"");t=_rxKeepOneSpace(t);return t.replace(/^(?:\s*\t*\r*\n*\{*)+|(?:\s*\t*\r*\n*\})+$/g,"").trim()}function _rxIdents(src,out){var i=0,n=src.length,prev="";function skipTemplate(){i++;while(i<n){var c=src[i];if(c==="\\"){i+=2;continue}if(c==="`"){i++;return}if(c==="$"&&src[i+1]==="{"){i+=2;var depth=1,start=i;while(i<n&&depth){var d=src[i];if(d==="`"){var s=i;skipTemplate();continue}if(d==="{")depth++;else if(d==="}"){depth--;if(!depth)break}else if(d==="'"||d==='"'){var q=d;i++;while(i<n&&src[i]!==q){if(src[i]==="\\")i++;i++}}i++}_rxIdents(src.slice(start,i),out);i++;continue}i++}}while(i<n){var ch=src[i];if(ch==="'"||ch==='"'){i++;while(i<n&&src[i]!==ch){if(src[i]==="\\")i++;i++}i++;prev="s";continue}if(ch==="`"){skipTemplate();prev="s";continue}if(ch==="/"&&src[i+1]==="/"){while(i<n&&src[i]!=="\n")i++;continue}if(ch==="/"&&src[i+1]==="*"){var e=src.indexOf("*/",i+2);i=e<0?n:e+2;continue}if(/\s/.test(ch)){i++;continue}if(/[0-9]/.test(ch)){while(i<n&&/[\w.]/.test(src[i]))i++;prev="n";continue}if(/[A-Za-z_$]/.test(ch)){var st=i;while(i<n&&/[\w$]/.test(src[i]))i++;var id=src.slice(st,i);var j=i;while(j<n&&/\s/.test(src[j]))j++;var isKey=src[j]===":"&&(prev==="{"||prev===",");if(prev!=="."&&!isKey&&!_rxSkip[id]&&out.indexOf(id)===-1)out.push(id);prev="i";continue}prev=ch;i++}return out}function _rxExpr(mux){var hit=_rxExprCache.get(mux);if(hit)return hit;var rv=null;try{new Function(mux);rv=_rxIdents(mux,[])}catch(e){rv=null}if(_rxExprCache.size>2e3)_rxExprCache.clear();_rxExprCache.set(mux,rv);return rv}function _rxEscape(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _rxMustaches(text,escapeStatic,rvSet){var found=[],m,last=0;_rxMoustache.lastIndex=0;while((m=_rxMoustache.exec(text))!=null){var mux=_rxClean(m[0]);var rvs=_rxExpr(mux);if(rvs)found.push({index:m.index,len:m[0].length,mux,rvs})}if(!found.length)return{content:escapeStatic?_rxEscape(text):text,mss:[]};var esc=escapeStatic?_rxEscape:function(s){return s};var content="",mss=[];for(var k=0;k<found.length;k++){var f=found[k];content+=esc(text.substring(last,f.index));var start=content.length;content+="{{"+f.mux+"}}";mss.push({mus:f.mux,jst:null,rvs:f.rvs.slice(),start,end:content.length});for(var r=0;r<f.rvs.length;r++)rvSet[f.rvs[r]]=1;last=f.index+f.len}content+=esc(text.substring(last));return{content,mss}}function _rxForX(val){var forX={js:"",as:{k:"",v:""},dx:""};val=val.trim();if(val.indexOf(";")>-1){var zxx=val.split(";");forX.dx=zxx[1].trim();val=zxx[0].trim()}if(val.indexOf(" as ")>-1){var arr2=val.split(" as ");var arr3=arr2[1].split(" ").join("").split(",");forX.as.k=arr3[0].trim();if(arr3.length>1)forX.as.v=arr3[1].trim();val=arr2[0].trim()}forX.js=val.trim();return forX}function _rxCompileNode(n,ptag,rvSet){if(n.nodeType===3){var t=n.nodeValue;var mm=_rxMustaches(t,ptag!=="style",rvSet);if(ptag==="textarea"&&mm.mss.length)mm=_rxMustaches(t,false,rvSet);return{type:"text",content:mm.content,mss:mm.mss,tag:ptag}}if(n.nodeType!==1)return null;var name=n.localName;if(name==="script")return null;var res={type:"tag",name,isV:!!_rxVoid[name],attrs:{},ax:{},evs:{},ex:{},children:[]};if(n.namespaceURI==="http://www.w3.org/2000/svg")res.svg=true;var attrs=n.attributes;for(var a=0;a<attrs.length;a++){var an=attrs[a].name,av=attrs[a].value;if(an===":else"){res.type="section";res.cond=""}else if(an===":if"||an===":else-if"){res.type="section";res.cond=av;_rxIdents(av,[]).forEach(function(id){rvSet[id]=1})}else if(an===":for"){res.type="sections";res.content=av;res.forX=_rxForX(av);if(res.forX.js)_rxIdents(res.forX.js,[]).forEach(function(id){rvSet[id]=1})}var ms=_rxMustaches(an.charAt(0)==="@"?av:av.replace(/`(\{\s*\{[\s\S]*?\}\s*\})`/g,"$1"),false,rvSet);if(an.charAt(0)==="@"){res.evs[an]=ms.content;if(ms.mss.length)res.ex[an]=ms.mss}else{res.attrs[an]=ms.content;if(ms.mss.length)res.ax[an]=ms.mss}}_rxOrderIfFor(res);if(!res.isV){var kids=n.childNodes;for(var c=0;c<kids.length;c++){var ch=_rxCompileNode(kids[c],name,rvSet);if(ch)res.children.push(ch)}if(name==="style"&&!res.children.length)res.children.push({type:"text",content:"",mss:[],tag:"style"})}return res}function _rxOrderIfFor(res){if(!res||!res.attrs||!res.forX||!Object.prototype.hasOwnProperty.call(res.attrs,":if"))return;var keys=Object.keys(res.attrs);var cond=String(res.attrs[":if"]);if(keys.indexOf(":if")<keys.indexOf(":for"))res.forX.js="("+cond+") ? ("+res.forX.js+") : []";else res.attrs[":for-if"]=res.attrs[":for-if"]?"("+res.attrs[":for-if"]+") && ("+cond+")":cond;res.type="sections";delete res.cond;delete res.attrs[":if"];if(res.ax)delete res.ax[":if"]}function _rxCompileHost(host){var rvSet={},hst=[],kids=host.childNodes;for(var i=0;i<kids.length;i++){var c=_rxCompileNode(kids[i],host.localName,rvSet);if(c)hst.push(c)}return{hst,reactiveVars:Object.keys(rvSet)}}async function _rxRender(host){host.classList.add("binded");var compiled=_rxCompileHost(host);var sub=null;for(var p=host.parentNode;p;p=p.parentNode){if(p.isSub===true){sub=p;break}}var _re=await renderHST(compiled,"reactive","section",void 0,null,["View"],sub?sub.vars:void 0,sub?sub.fns:void 0);_re._blankUnresolved=true;var bindEl=host.closest("[bind]");if(bindEl){String(bindEl.getAttribute("bind")||"").split(",").forEach(function(v){var parts=v.trim().split(" as ");if(parts.length===2&&parts[0].trim()&&parts[1].trim()){try{_re.vrs[parts[1].trim()]=_re.scopedEval(_re.reactiveVariables,parts[0].trim())}catch(e){}}})}host.textContent="";host.append.apply(host,_re._RealDOM);_re._rxHost=host;_reactiveEngines.push(_re);_re.renderAll("section")}function _updateReactiveEngines(varName){for(var i=_reactiveEngines.length-1;i>=0;i--){var re=_reactiveEngines[i];if(!re._rxHost||!re._rxHost.isConnected){_reactiveEngines.splice(i,1);continue}try{re.update(varName)}catch(e){cl(e)}}}(function(){if(typeof MutationObserver==="undefined"||typeof document==="undefined"||!document.documentElement)return;var pending=[],running=false;function consider(node){if(!node||node.nodeType!==1||node._ownerRe)return;if(node.hasAttribute("reactive"))pending.push(node);if(node.firstElementChild){var found=node.querySelectorAll("[reactive]");for(var i=0;i<found.length;i++)pending.push(found[i])}}async function drain(){if(running)return;running=true;var rendered=0;try{while(pending.length){var h=pending.shift();if(!h.isConnected||h._ownerRe||h.classList.contains("binded"))continue;try{await _rxRender(h);rendered++}catch(e){reportLumenError({stage:"reactive",error:e})}}}finally{running=false}if(rendered&&typeof globalWatch==="function"){try{globalWatch()}catch(e){reportLumenError({stage:"reactive",error:e})}}}new MutationObserver(function(records){for(var r=0;r<records.length;r++){var added=records[r].addedNodes;for(var k=0;k<added.length;k++)consider(added[k])}if(pending.length)drain()}).observe(document.documentElement,{childList:true,subtree:true});function scan(){consider(document.documentElement);if(pending.length)drain()}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",scan);else setTimeout(scan,0)})();
30
30
 
@@ -33,7 +33,7 @@ var LM_BUILD=(function(){try{var m=/\/js\/app\.(\d+)\.js/.exec(document.currentS
33
33
  !(function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.ReconnectingWebSocket=b()})(this,function(){function a(b,c,d){function l(a2,b2){var c2=document.createEvent("CustomEvent");return c2.initCustomEvent(a2,false,false,b2),c2}var e={debug:false,automaticOpen:true,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1,timeoutInterval:3e3};d||(d={});for(var f in e)this[f]="undefined"!=typeof d[f]?d[f]:e[f];this.url=b,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var h,g=this,i2=false,j=false,k=document.createElement("div");k.addEventListener("open",function(a2){g.onopen(a2)}),k.addEventListener("close",function(a2){g.onclose(a2)}),k.addEventListener("connecting",function(a2){g.onconnecting(a2)}),k.addEventListener("message",function(a2){g.onmessage(a2)}),k.addEventListener("error",function(a2){g.onerror(a2)}),this.addEventListener=k.addEventListener.bind(k),this.removeEventListener=k.removeEventListener.bind(k),this.dispatchEvent=k.dispatchEvent.bind(k),this.open=function(b2){try{h=new WebSocket(g.url,c||[]),b2||k.dispatchEvent(l("connecting")),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",g.url);var d2=h,e2=setTimeout(function(){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",g.url),j=true,j=false;if(d2.readyState==1)d2.close()},g.timeoutInterval);h.onopen=function(){clearTimeout(e2),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onopen",g.url),g.protocol=h.protocol,g.readyState=WebSocket.OPEN,g.reconnectAttempts=0;var d3=l("open");d3.isReconnect=b2,b2=false,k.dispatchEvent(d3)},h.onclose=function(c2){if(clearTimeout(e3),h=null,i2)g.readyState=WebSocket.CLOSED,k.dispatchEvent(l("close"));else{g.readyState=WebSocket.CONNECTING;var d3=l("connecting");d3.code=c2.code,d3.reason=c2.reason,d3.wasClean=c2.wasClean,k.dispatchEvent(d3),b2||j||((g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onclose",g.url),k.dispatchEvent(l("close")));var e3=g.reconnectInterval*Math.pow(g.reconnectDecay,g.reconnectAttempts);setTimeout(function(){g.reconnectAttempts++,g.open(true)},e3>g.maxReconnectInterval?g.maxReconnectInterval:e3)}},h.onmessage=function(b3){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",g.url,b3.data);var c2=l("message");c2.data=b3.data,k.dispatchEvent(c2)},h.onerror=function(b3){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onerror",g.url,b3),k.dispatchEvent(l("error"))}}catch(error){console.error("WebSocket connection error:",error)}},1==this.automaticOpen&&this.open(false),this.send=function(b2){if(h)return(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","send",g.url,b2),h.send(b2);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(a2,b2){"undefined"==typeof a2&&(a2=1e3),i2=true,h&&h.close(a2,b2)},this.refresh=function(){h&&h.readyState==1&&h.close()}}return a.prototype.onopen=function(){},a.prototype.onclose=function(){},a.prototype.onconnecting=function(){},a.prototype.onmessage=function(){},a.prototype.onerror=function(){},a.debugAll=false,a.CONNECTING=WebSocket.CONNECTING,a.OPEN=WebSocket.OPEN,a.CLOSING=WebSocket.CLOSING,a.CLOSED=WebSocket.CLOSED,a});let _isTipped=false;var _debugMode=false;var _initialized=null;var _dbcrs={};var _dbcrsTime=200;var _tickTime=20;var _scW=0;var cl=console.log;if(!_vcData)var _vcData=void 0;if(!_beaTn)var _beaTn=void 0;var beas;var appSettings;var execEl="";var currentlyValidTags=new Array;var _upwrk=new WebWorker("_upw");var _csswrk=new WebWorker("_cssw");_csswrk.start();var _ups=[];(function(e,t2){typeof module!="undefined"&&module.exports?module.exports=t2():typeof define=="function"&&define.amd?define(t2):this[e]=t2()})("bea",function(){function p(e2,t3){for(var n3=0,i3=e2.length;n3<i3;++n3)if(!t3(e2[n3]))return r2;return 1}function d(e2,t3){p(e2,function(e3){return t3(e3),1})}function v(e2,t3,n3){function g(e3){return e3.call?e3():u[e3]}function y(){if(!--h2){u[o2]=1,s2&&s2();for(var e3 in f)p(e3.split("|"),g)&&!d(f[e3],g)&&(f[e3]=[])}}e2=e2[i2]?e2:[e2];var r3=t3&&t3.call,s2=r3?t3:n3,o2=r3?e2.join(""):t3,h2=e2.length;return setTimeout(function(){d(e2,function t4(e3,n4){if(e3===null)return y();/*!n &&
34
34
  !/^https?:\/\//.test(e) &&
35
35
  c &&
36
- (e = e.indexOf(".js") === -1 ? c + e + ".js" : c + e);*/if(l[e3])return o2&&(a[o2]=1),l[e3]==2?y():setTimeout(function(){t4(e3,true)},0);l[e3]=1,o2&&(a[o2]=1),m(e3,y)})},0),v}function m(n3,r3){var i3=e.createElement("script"),u2;i3.onload=i3.onerror=i3[o]=function(){if(i3[s]&&!/^c|loade/.test(i3[s])||u2)return;i3.onload=i3[o]=null,u2=1,l[n3]=2,r3()},i3.async=1,i3.setAttribute("crossorigin","anonymous"),i3.setAttribute("data-permanent",1),i3.src=h?n3+(n3.indexOf("?")===-1?"?":"&")+h:n3,t2.insertBefore(i3,t2.lastChild)}var e=document,t2=e.getElementsByTagName("head")[0],n2="string",r2=false,i2="push",s="readyState",o="onreadystatechange",u={},a={},f={},l={},c,h;return v.get=m,v.order=function(e2,t3,n3){(function r3(i3){i3=e2.shift(),e2.length?v(i3,r3):v(i3,t3,n3)})()},v.path=function(e2){c=e2},v.urlArgs=function(e2){h=e2},v.ready=function(e2,t3,n3){e2=e2[i2]?e2:[e2];var r3=[];return!d(e2,function(e3){u[e3]||r3[i2](e3)})&&p(e2,function(e3){return u[e3]})?t3():!(function(e3){f[e3]=f[e3]||[],f[e3][i2](t3),n3&&n3(r3)})(e2.join("|")),v},v.done=function(e2){v([null],e2)},v});(function(n2,t2){this[n2]=t2()})("sbea",function(){return function(x2){beas=x2}});(function(n2,t2){this[n2]=t2()})("Reactor",function(){return function(o){appSettings=o;if(o.Base)beas=o.Base;else{var getUrl=window.location;var baseUrl=getUrl.protocol+"//"+getUrl.host+"/";if(o.subDirectory)baseUrl=baseUrl+o.subDirectory+"/";appSettings.Base=baseUrl}if(o.App)execEl=o.App;if(o.Additional){bea([o.Additional],"ready",function(){})}if(o.init&&typeof o.init==="function")o.init()}});var fullTB=[{items:["Source","-","searchCode","autoFormat","CommentSelectedRange","UncommentSelectedRange","AutoComplete","-","Save","NewPage","Preview","Print","-","Templates","-","Cut","Copy","Paste","PasteText","PasteFromWord","PasteCode","-","Undo","Redo","-","SelectAll","-","Find","-","Image","CodeSnippet","Flash","Table","HorizontalRule","Smiley","SpecialChar","PageBreak","Iframe","VideoDetector","-","Blockquote","CreateDiv","simplebutton","-","Link","Unlink","Anchor","-","TextColor","BGColor","-","Bold","Italic","Underline","Strike","Subscript","Superscript","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","-","BidiLtr","BidiRtl","-","NumberedList","BulletedList","-","Outdent","Indent","-","CopyFormatting","RemoveFormat","-","lineheight","letterspacing","Styles","Format","Font","FontSize","-","ShowBlocks"]}];var normalTB=[{name:"basicstyles",groups:["basicstyles","cleanup"],items:["Bold","Italic","Underline","Strike","Subscript","Superscript","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","-","BidiLtr","BidiRtl","Language","-","Undo","Redo","-","SelectAll","-","CopyFormatting","RemoveFormat"]},"/",{items:["Find","-","Image","Table","HorizontalRule","Smiley","SpecialChar","Iframe","VideoDetector","-","Link","Unlink","Anchor"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"],items:["TextColor","BGColor","-","NumberedList","BulletedList","-","Outdent","Indent"]},"/",{name:"styles",items:["lineheight","letterspacing","Styles","Format","Font","FontSize"]}];var miniTB=[{name:"basicstyles",groups:["basicstyles","cleanup"],items:["Bold","Italic","Underline","Strike","Subscript","Superscript","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","-","BidiLtr","BidiRtl","Language","-","Link","Unlink","Anchor","-","CopyFormatting","RemoveFormat"]},"/",{name:"paragraph",groups:["list","indent","blocks","align","bidi"],items:["TextColor","BGColor","-","NumberedList","BulletedList","-","Outdent","Indent"]},{name:"styles",items:["Styles","Format","Font","FontSize"]}];(function(submit){HTMLFormElement.prototype.submit=function(data2){$(this).submit();return false}})(HTMLFormElement.prototype.submit);[HTMLElement,typeof SVGElement!=="undefined"?SVGElement:null].forEach(function(Ctor){if(!Ctor)return;var P=Ctor.prototype;P.setAttributeNative=P.setAttribute;P.removeAttributeNative=P.removeAttribute;P.getAttributeNative=P.getAttribute;P.setAttribute=function(prop,val2){if(prop.substr(0,1)=="@"){(this.events||(this.events={}))[prop]=val2}else{this.setAttributeNative(prop,val2)}};P.removeAttribute=function(prop,val2){if(prop.substr(0,1)=="@"&&this.events)delete this.events[prop];this.removeAttributeNative(prop,val2)};P.getAttribute=function(prop,val2){if(prop.substr(0,1)=="@"&&this.events&&Object.prototype.hasOwnProperty.call(this.events,prop)){return this.events[prop]}return this.getAttributeNative(prop,val2)}});(function(replaceChild){Node.prototype.replaceChild=function(newChild,oldChild){if(oldChild&&oldChild.events&&typeof SVGElement!=="undefined"&&newChild instanceof SVGElement&&newChild.classList.contains("iconify")){newChild.events=Object.assign({},oldChild.events,newChild.events)}return replaceChild.call(this,newChild,oldChild)}})(Node.prototype.replaceChild);var XHRs=new Array;if(localStorage.getItem("globals")===null)localStorage.setItem("globals",JSON.stringify({}));if(localStorage.getItem("_rx")===null)localStorage.setItem("_rx",JSON.stringify({}));var _globalsBackingValue;Object.defineProperty(window,"globals",{configurable:true,enumerable:true,get:function(){return _globalsBackingValue},set:function(v){if(v===_globalsBackingValue)return;_globalsBackingValue=_deepReactive(v,_onGlobalsDeepChange);_onGlobalsDeepChange()}});function _onGlobalsDeepChange(){if(typeof _vt!=="undefined"&&_vt.Global&&_vt.Global.vars){_vt.Global.vars.globals=globals}_scheduleGlobalsSave()}var _globalsSaveQueued=false;function _scheduleGlobalsSave(){if(_globalsSaveQueued)return;_globalsSaveQueued=true;setTimeout(function(){_globalsSaveQueued=false;try{var json=JSON.stringify(_globalsBackingValue===void 0?{}:_globalsBackingValue);if(localStorage.getItem("globals")!==json)localStorage.setItem("globals",json)}catch(e){}},0)}globals=clone(JSON.parse(localStorage.getItem("globals")));let _rx=clone(JSON.parse(localStorage.getItem("_rx")));var watch={};var popups={"modals":[],"react-modals":[]};var cntrlon=0;var _gn=0,_worker;var nodes=[];var historyStack=[];var _jsuid={};function clone(item){if(!item){return item}var types2=[Number,String,Boolean],result;types2.forEach(function(type2){if(item instanceof type2){result=type2(item)}});if(typeof result=="undefined"){if(Object.prototype.toString.call(item)==="[object Array]"){result=[];item.forEach(function(child,index,array){result[index]=clone(child)})}else if(typeof item=="object"){if(item.nodeType&&typeof item.cloneNode=="function"){result=item.cloneNode(true)}else if(!item.prototype){if(item instanceof Date){result=new Date(item)}else{result={};for(var i2 in item){result[i2]=clone(item[i2])}}}else{if(false){result=new item.constructor}else{result=item}}}else{result=item}}return result}function isInput(o){if(o.is(":checkbox")||o.is("input")||o.is("textarea")||o.is(":radio")||o.is("select"))return true;return false}function getVal(o){if(isInput(o)){return $.trim(o.val())}return o.html()}function setVal(o,v){if(isInput(o)){o.val(v)}else o.html(v)}function iterateConditions(text){var results=[];var opts=text.split("##");var iff=opts.shift();opts=opts.join("##");if(opts.indexOf("#else#")>-1)var hasElse=true;if(opts.indexOf("#elseif#")>-1)var hasElseIfs=true;if(hasElse){opts=opts.split("#else#");var elsee=opts.pop();opts=opts.join("")}if(hasElseIfs){results["elseif"]=[];var elseifs=opts.split("#elseif#");var ifOpts=elseifs.shift();results["if"]={cond:iff,val:ifOpts};for(var index=0;index<elseifs.length;index++){var elf=elseifs[index].split("##");results["elseif"].push({cond:elf[0],val:elf[1]})}if(hasElse)results["else"]=elsee}else if(hasElse){results["if"]={cond:iff,val:opts};if(hasElse)results["else"]=elsee}else{results["if"]={cond:iff,val:opts}}return results}function wait(){_initialized=false}function resume(){_initialized=true}const pause=msec=>new Promise((resolve,_)=>{setTimeout(resolve,msec)});function _lumenReadyHandler(){if(typeof appSettings==="undefined"||!appSettings){setTimeout(_lumenReadyHandler,10);return}nodes=getURLNodes();if(_initialized==null)_initialized=true;$("html").removeClass("no_js");if(!$("[exec]").length)$("body").append({beajs:true,body:"<div exec class=h></div>"});$(document).keyup(function(e){cntrlon=0});$(document).keydown(function(e){if(e.ctrlKey||e.metaKey){cntrlon=1}});goToNode()}$(document).ready(_lumenReadyHandler);function updateLocalVariable(k){if(k=="_rx")_rx=clone(JSON.parse(localStorage.getItem("_rx")));else globals=clone(JSON.parse(localStorage.getItem("globals")))}function setGlobals(x2){localStorage.setItem("globals",JSON.stringify(x2));globals=clone(JSON.parse(localStorage.getItem("globals")))}function setRX(x2){localStorage.setItem("_rx",JSON.stringify(x2));_rx=clone(JSON.parse(localStorage.getItem("_rx")))}$(window).on("storage",function(e){if(e.originalEvent.key=="globals"){if(localStorage.getItem("globals")!=null)updateLocalVariable();else setGlobals(globals)}else if(e.originalEvent.key=="_rx"){if(localStorage.getItem("_rx")!=null)updateLocalVariable("_rx");else setRX(_rx)}});var _work=function(){if(!$(".prog").length)$("body").append('<div class="prog"><div class=bar role=bar></div><div class=spinner role=spinner><div class="spinner-icon"></div></div></div>');_worker=setTimeout(function(){_gn=incri(_gn);barSet(_gn,200);_work()},200)};$(document).ajaxStart(function(){_gn=0;_work();if(typeof heartbeat==="function")heartbeat()}).ajaxStop(function(){_gn=0;barSet(1,200);if(typeof heartbeat==="function")heartbeat();globalWatch()}).ajaxError(function(e,xhr,opt){if(xhr.statusText=="error"){if(xhr.status=="422")$("[exec]").html(xhr.responseText);else if(xhr.status=="0"){$("[dropzone].pending").removeClass("pending").addClass("error");$("body").addClass("no-internet-connection")}}if(typeof heartbeat==="function")heartbeat();globalWatch();_gn=0;barSet(1,200)});(function($2){$2.extend({inArrayIn:function(elem,arr,i2){if(typeof elem!=="string"){return $2.inArray.apply(this,arguments)}if(arr){var len=arr.length;i2=i2?i2<0?Math.max(0,len+i2):i2:0;elem=elem.toLowerCase();for(;i2<len;i2++){if(i2 in arr&&arr[i2].toLowerCase()==elem){return i2}}}return-1}})})(jQuery);$.fn.priorityOn=function(type2,selector2,data2,fn2){this.each(function(){var $this=$(this);var types2=type2.split(" ");for(var t2 in types2){$this.on(types2[t2],selector2,data2,fn2);if(typeof $._data!=="function")continue;var currentBindings=($._data(this,"events")||{})[types2[t2]];if($.isArray(currentBindings)){currentBindings.unshift(currentBindings.pop())}}});return this};$.fn.lock=function(){if($(this).is("form")){$(this).find('[type="submit"]').attr("disabled","disabled");$(this).find("button:not([type])").attr("disabled","disabled")}return this};$.fn.unlock=function(){if($(this).is("form")){$(this).find('[type="submit"]').removeAttr("disabled");$(this).find("button:not([type])").removeAttr("disabled")}return this};$.fn.onClose=function(selector2,data2,fn2){this.each(function(){var el2=$(this);var types2=["close"];for(var t2 in types2){el2.on(types2[t2],selector2,data2,fn2)}});return this};$.fn.attach=function(type,selector,data,fn){var el=$(this);var types=type.split(" ");for(var t in types){var lu="$.fn.on"+types[t]+' = function (selector, data, fn) { var el = $(this); var types = ["'+types[t]+'"]; for (var t in types) { el.live(types[t], selector, data, fn); } return this;};';try{eval(lu)}catch(e){}}return this};$.fn.hasAttr=function(k){return!!(this[0]&&this[0].getAttribute(k)!=null)};$.fn.hasKey=function(k){return typeof this.data(k)!=="undefined"};function dotsIntoObjs(keys,value){var tempObject={};var container=tempObject;keys.split(".").map((k,i2,values)=>{container=container[k]=i2==values.length-1?value:{}});return tempObject}$.fn.set=function(name,value){var splitter=name.split(".");if(splitter.length>1){var key=splitter.shift();return this.data(key,dotsIntoObjs(splitter.join("."),value))}return this.data(name,value)};$.fn.props=function(){return this.data("props")};$.fn.scope=function(_sview){var _scopedVariables=_sview(this,this.data("props")??{})??{};for(var x2=0;x2<Object.keys(_scopedVariables).length;x2++){var _key=Object.keys(_scopedVariables)[x2];var val2=_scopedVariables[_key];this.set(_key,val2)}};$.fn.isOverflown=function(){return $(this)[0].scrollHeight>$(this)[0].clientHeight||$(this)[0].scrollWidth>$(this)[0].clientWidth};function removeEmptyElement(arr){var filtered=arr.filter(function(el2){return el2});return filtered}function findInObject(object,property,value){for(var i2=0;i2<object.length;i2+=1){if(object[i2][property]===value){return i2}}}function compareUs(object1,object2){var areObjects=isObject(object1)&&isObject(object2);if(!areObjects){if(typeof object1=="number"&&typeof object2=="number"){if(isNaN(object1)&&isNaN(object2))return true}return object1==object2}const keys1=Object.keys(object1);const keys2=Object.keys(object2);if(keys1.length!==keys2.length){return false}for(const key of keys1){const val1=object1[key];const val2=object2[key];const areObjects2=isObject(val1)&&isObject(val2);if(areObjects2&&!compareUs(val1,val2)||!areObjects2&&val1!==val2){return false}}return true}function deepCompare(object1,object2,path=""){const areObjects=isObject(object1)&&isObject(object2);if(!areObjects){if(typeof object1==="number"&&typeof object2==="number"){if(isNaN(object1)&&isNaN(object2)){return true}}if(object1!==object2){return false}return true}const keys1=Object.keys(object1);const keys2=Object.keys(object2);if(keys1.length!==keys2.length){return false}for(const key of keys1){const newPath=path?`${path}.${key}`:key;const val1=object1[key];const val2=object2[key];const areNestedObjects=isObject(val1)&&isObject(val2);if(!deepCompare(val1,val2,newPath)){return false}}return true}function isObject(object){return object!=null&&typeof object==="object"}(function(old){$.fn.attr=function(){if(arguments.length===0){if(this.length===0){return null}var obj={};$.each(this[0].attributes,function(){if(this.specified){obj[this.name]=this.value}});return obj}return old.apply(this,arguments)}})($.fn.attr);function st(b){if(!isNaN(b))$("html,body").stop().animate({scrollTop:b+"px"},{duration:400});else $("html,body").stop().animate({scrollTop:$(b).offset().top+"px"},{duration:400})}function pushURL(url,d){if(url||url==""){if(history&&history.pushState){history.pushState({},"",appSettings.Base+"/"+url.replace(new RegExp("^[/]+"),""));goToNode(d)}else{parent.location.href=url}}else{alert(url)}}function formatBytes(bytes,decimals){if(bytes==0)return"0 Bytes";var k=1024,dm=decimals<=0?0:decimals||2,sizes=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],i2=Math.floor(Math.log(bytes)/Math.log(k));return parseFloat((bytes/Math.pow(k,i2)).toFixed(dm))+" "+sizes[i2]}function passwordContainsSymbol(value){var containsSymbol=false,symbols=`-!\xA7$%&/()=?.:,~;'#+*-/\\|{}[]_<>"`.split("");$.each(symbols,function(index,symbol){if(value.indexOf(symbol)>-1){containsSymbol=true;return false}});return containsSymbol}function passwordStrength(pass){var s=0,n2;if(pass.length>5)s+=10;if(/[a-z]/.test(pass))s+=1;if(/[A-Z]/.test(pass))s+=1;if(/[0-9]/.test(pass))s+=1;if(passwordContainsSymbol(pass))s+=1;if(s==14)n2="very-strong";else if(s==13)n2="strong";else if(s==12)n2="medium";else if(s==11)n2="weak";else n2="";if(/\s/g.test(pass))n2="has-spaces";return n2}function passwordValid(pass){var n2=passwordStrength(pass);if(n2=="strong"||n2=="very-strong")return true;return false}function incri(n2){var amount;if(n2>1){return .994}else{if(n2>=0&&n2<.2){amount=.1}else if(n2>=.2&&n2<.5){amount=.04}else if(n2>=.5&&n2<.8){amount=.02}else if(n2>=.8&&n2<.99){amount=.005}else{amount=5e-4}n2=n2+amount;if(n2<.08)n2=.08;else if(n2>.994)n2=.994;return n2}}function barSet(n2,speed){clearTimeout(_worker);if(n2<.08)n2=.08;else if(n2>1)n2=1;var bar=$('.bar[role="bar"]');bar.css({transition:"all "+speed+"ms linear","-webkit-transition":"all "+speed+"ms linear","-moz-transition":"all "+speed+"ms linear","-o-transition":"all "+speed+"ms linear"});if($("body").hasClass("rtl"))bar.css({"margin-right":-100+n2*100+"%"});else bar.css({"margin-left":-100+n2*100+"%"});if(n2==1){_worker=setTimeout(function(){$(".prog").animate({opacity:0},{duration:speed,complete:function(){$(".prog").remove()}})},speed)}}function getFormData(form){var unindexed_array=form.serializeArray();var indexed_array={};$.map(unindexed_array,function(n2,i2){if(n2["name"].includes("[]")){var key=n2["name"].split("[]")[0];if(!indexed_array.hasOwnProperty(key))indexed_array[key]=[];indexed_array[key].push(n2["value"])}else{indexed_array[n2["name"]]=n2["value"]}});return indexed_array}$(window).on("popstate",function(){if(history&&history.pushState)goToNode()});var getLocation=function(href){var l=document.createElement("a");l.href=href;return l};function getURLNodes(){appSettings.Base=appSettings.Base.replace(new RegExp("[/]+$"),"");var base=getLocation(appSettings.Base);if(base.origin!=window.location.origin){appSettings.Base=window.location.origin+base.pathname;var base=getLocation(appSettings.Base)}var _nodes=base.pathname!="/"?window.location.pathname.split(base.pathname).join("").replace(new RegExp("^[/]+"),"").split("/"):location.href.split(appSettings.Base).join("").replace(new RegExp("^[/]+"),"").split("?")[0].split("/");if(!_nodes[0])_nodes[0]=appSettings.defaultView??"home";if(historyStack[historyStack.length-1]?.url!=window.location.href)historyStack.push({"nodes":_nodes,"params":paramsToObj(window.location.href),"url":window.location.href});return _nodes}var prevNodes=[];function goToNode(d){if(_initialized){prevNodes=clone(nodes);nodes=getURLNodes();renderView(nodes[0],null,d)}else{setTimeout(function(){goToNode(d)},100)}}var View={};function setError(e,t2){if(!e){console.warn(t2);return}console.warn(t2,e.message)}function renderTpl(el2,n2,vars2){if(!el2.length)return;if(el2.data("_status")=="error")return;if(!el2.hasKey("_re")){if(el2.data("_status")=="pending"){getTpl(n2,el2,vars2)}setTimeout(function(){renderTpl(el2,n2,vars2)},_tickTime)}}function prepareNode(n2,rep){var _arr2=n2.split("/");if(_arr2.length>1){for(var i2=_arr2.length-1;i2>=_arr2.length-1;i2--)_arr2[i2]=_arr2[i2];n2=_arr2.join("/")}else n2=n2;return rep?n2.replace(new RegExp("^[/]+"),""):n2}var _esps={};var _Views={};function setAppFuncs(){let initFunc=appSettings.init&&typeof appSettings.init==="function"?appSettings.init:typeof init==="function"?init:null;if(typeof initFunc==="function")initFunc()}function getView(n2,el2,d){let filePath="src/views/"+n2+".view";let fileKey=btoa(filePath);if($("body").hasKey("view_"+fileKey)){renderView(n2,el2,d,true)}else{if(_vcData&&_vcData["views"].hasOwnProperty(fileKey)){$("body").data("view_"+fileKey,_vcData["views"][fileKey]);renderView(n2,el2,d,true);return}if(Nuke&&Nuke._ws&&Nuke._ws.readyState){Nuke.emit("getview",fileKey,function(e){var r2=e.data;$("body").data("view_"+fileKey,r2);renderView(n2,el2,d,true)})}else{setTimeout(()=>{getView(n2,el2,d)},_tickTime)}}}function fileToDataURL(file){var reader=new FileReader;return new Promise(function(resolve,reject){reader.onload=function(event){resolve(event.target.result)};reader.readAsDataURL(file)})}function readFilesAsDataURL(files){return Promise.all(files.map(fileToDataURL))}function defer(){var res,rej;var promise=new Promise((resolve,reject)=>{res=resolve;rej=reject});promise.resolve=res;promise.reject=rej;promise.success=res;promise.failed=rej;return promise}function getTpl(n2,el2,vaz2){let filePath="src/tpls/"+n2+".tpl";let fileKey=btoa(filePath);if(el2.data("_status")!="pending")return;el2.data("_status","getting");if($("body").hasKey("tpl_"+fileKey)){let r2=$("body").data("tpl_"+fileKey);el2.html(r2);if(!setRe(el2,vaz2))setError(null,"Error in rendering template "+n2)}else{if(_vcData&&_vcData["tpls"].hasOwnProperty(fileKey)){$("body").data("tpl_"+fileKey,_vcData["tpls"][fileKey]);el2.html(_vcData["tpls"][fileKey]);if(!setRe(el2,vaz2))setError(null,"Error in rendering template "+n2);return}if(Nuke&&Nuke._ws&&Nuke._ws.readyState){Nuke.emit("gettpl",fileKey,function(e){var r2=e.data;$("body").data("tpl_"+fileKey,r2);el2.html(r2);if(!setRe(el2,vaz2))setError(null,"Error in rendering template "+n2)})}else{setTimeout(()=>{getTpl(n2,el2,vaz2)},_tickTime)}}}function setRe(_el,vaz){try{if(!_el.hasKey("_vars")){if(_debugMode)cl("The Data Arrived",vaz);let data={};let vars=vaz.split(",");vars=vars.map(s=>s.trim());let binds=[];let dataNamesValues=[];var _subView=_el.closest("[view]");for(let x=0;x<vars.length;x++){if(vars[x]!=""){try{let varName=vars[x];let varValue=vars[x];let NameAs=null;if(varName.indexOf(" as ")!==-1){varName=varName.split(" as ");varValue=varName[0];varName=varName[1];NameAs=vars[x]}let val="";if(_subView.length){val=_subView.hasKey(varValue)?_subView.data(varValue):eval(varValue)}else val=eval(varValue);dataNamesValues.push({Name:varName,NameAs,Value:val})}catch(e){let varName2=vars[x];let varValue2=vars[x];let NameAs2=null;if(varName2.indexOf(" as ")!==-1){varName2=varName2.split(" as ");varValue2=varName2[0];varName2=varName2[1];NameAs2=vars[x]}dataNamesValues.push({Name:varName2,NameAs:NameAs2,Value:void 0});setError(e,"Error in bind variables for "+vars[x])}}}for(let x2=0;x2<dataNamesValues.length;x2++){let dn=dataNamesValues[x2];binds.push({dataName:dn["Name"],dataNameAs:dn["NameAs"],dataValue:clone(dn["Value"])});data[dn["Name"]]=dn["Value"]}if(_debugMode)cl(["The Data Set",data,binds]);if(appSettings.beforetick&&typeof appSettings.beforetick==="function")appSettings.beforetick();_el.data("_vars",binds).data("_re",new RenderEngine(_el,data));globalWatch()}_el.data("_status","complete");return true}catch(e){_el.data("_status","error");return false}return false}function parseFromString(html){return doc=new DOMParser().parseFromString(html,"text/html")}var _binds={};let _oldGlobals=clone(globals);let _oldRX=clone(_rx);let _watch=clone($("body").data("_watch"));$("body").data("_watch",{old:{},list:[]});function reloads(){$("[crslf].flickity-enabled.reload-on-bind").each(function(){var el2=$(this);el2.flickity("destroy");var opts=el2.attr("crslf-opts");if(!opts)opts={};else opts=JSON.parse(opts);el2.flickity(opts);var flkty=el2.data("flickity");flkty.on("dragStart",()=>flkty.slider.childNodes.forEach(slide=>slide.style.pointerEvents="none"));flkty.on("dragEnd",()=>flkty.slider.childNodes.forEach(slide=>slide.style.pointerEvents="all"))});$("[crsl].crsl-initialized").each(function(){$(this).crsl("refresh")});let tickFunc=appSettings.tick&&typeof appSettings.tick==="function"?appSettings.tick:typeof tick==="function"?tick:null;if(typeof tickFunc==="function")tickFunc();if(typeof scsc!=="undefined")scsc.reset();if(typeof dgsc!=="undefined")dgsc.reset();applyTriggers();setTimeout(()=>{if(typeof scsc!=="undefined")scsc.reset();if(typeof dgsc!=="undefined")dgsc.reset();applyTriggers()},_tickTime*2)}function renderViewsTpls(){$("[view]").each(function(i){var el=$(this);if(el.data("_status")!="pending"&&el.data("_status")!="error"&&el.data("_status")!="getting"&&el.data("_status")!="complete"){var modal=el.closest("popup");var n=el.attr("view");var _props=el.attr(":props")??null;var _binds=el.attr(":props-bind")??null;el.data("_status","pending");let nn=n;var _arr=nn.split("/");if(_arr.length>1){for(var i=_arr.length-1;i>=_arr.length-1;i--){_arr[i]=_arr[i].toLowerCase()}nn=_arr.join("/")}else{nn=nn.toLowerCase()}var _queryParams=nn.split("?");nn=_queryParams.shift();if(el.attr(":data")){let vaz=el.attr(":data");let data={};let vars=vaz.split(",");let dataNamesValues=[];let binds=[];vars=vars.map(s=>s.trim());for(let x=0;x<vars.length;x++){if(vars[x]!=""){try{let varName=vars[x];let varValue=vars[x];let NameAs=null;if(varName.indexOf(" as ")!==-1){varName=varName.split(" as ");varValue=varName[0];varName=varName[1];NameAs=vars[x]}let val="";val=eval(varValue);dataNamesValues.push({Name:varName,NameAs,Value:val})}catch(e){cl(e);let varName2=vars[x];let varValue2=vars[x];let NameAs2=null;if(varName2.indexOf(" as ")!==-1){varName2=varName2.split(" as ");varValue2=varName2[0];varName2=varName2[1];NameAs2=vars[x]}dataNamesValues.push({Name:varName2,NameAs:NameAs2,Value:void 0});setError(e,"Error in bind variables for "+vars[x])}}}for(let x2=0;x2<dataNamesValues.length;x2++){let dn=dataNamesValues[x2];binds.push({dataName:dn["Name"],dataNameAs:dn["NameAs"],dataValue:clone(dn["Value"])});data[dn["Name"]]=dn["Value"]}el.data("props",data)}else{var _d=paraToObj(getBind(_binds,_props));el.data("params",paraToObj(_queryParams));if(modal.length)_d["modal"]=modal.data("props");el.data("props",_d)}if(n==""||!n||n.split("/").slice(-1)==""){el.data("_status","error")}else{renderView(n,el,_d)}}})}function renderPlugins(){$("[crslf]:not(.flickity-enabled,[comp],[tpl],[view]),[crslf][comp]:not(.flickity-enabled),[crslf][tpl]:not(.flickity-enabled),[crslf][view]:not(.flickity-enabled)").each(function(){if(typeof $.fn.flickity!=="function")return;var el2=$(this);if(el2.hasAttr("[tpl]")||el2.hasAttr("[comp]")||el2.hasAttr("[view]")){if(el2.data("_status")!="complete")return}var opts=el2.attr("crslf-opts");if(!opts)opts={};else opts=JSON.parse(opts);el2.flickity(opts);var flkty=el2.data("flickity");flkty.on("dragStart",()=>flkty.slider.childNodes.forEach(slide=>slide.style.pointerEvents="none"));flkty.on("dragEnd",()=>flkty.slider.childNodes.forEach(slide=>slide.style.pointerEvents="all"));setTimeout(function(){globalWatch()},600)});$("[crsl]:not(.crsl-initialized,[comp],[tpl],[view]),[crsl][comp]:not(.crsl-initialized),[crsl][tpl]:not(.crsl-initialized),[crsl][view]:not(.crsl-initialized)").each(function(){if(typeof $.fn.crsl!=="function")return;var el2=$(this);if(el2.hasAttr("[tpl]")||el2.hasAttr("[comp]")||el2.hasAttr("[view]")){if(el2.data("_status")!="complete")return}el2.crsl();el2.on("setPosition beforeChange",function(event,slick,currentSlide,nextSlide){$(window).trigger("scroll.scsc");$(window).trigger("resize")})});$("[up]:not([upid])").each(function(){var u=_ups.length;var t2=$(this);var mxf=t2.attr("data-mxf")?t2.attr("data-mxf"):10;if(!t2.hasAttr("upid")){var sl="up_"+u;t2.attr("upid",sl);t2.prepend(`<input `+(mxf>1?"multiple":"")+` type="file" files style="display:none;" />`);_ups.push(t2);if(typeof _upwrkStarted==="function")_upwrkStarted()}});$("form:not(.binded,[norm])").each(function(){var el2=$(this);var reset=false;if(el2.hasAttr("reset"))reset=true;var actn=el2.attr("action")??"";var local=false;el2.addClass("binded");if(actn==""){actn=getURLNodes().join("/");local=true}else local=isPathLocal(actn);if(el2.hasAttr("o-sub")){el2.ajaxForm({beforeSubmit:function(formData,f,options){let formDataMapped={};let formDataMappedAdditionals={};formDataMapped=Object.assign({},...formData.map(x2=>{if(x2.type=="file"){if(!formDataMappedAdditionals.hasOwnProperty(x2.name))formDataMappedAdditionals[x2.name]=[];formDataMappedAdditionals[x2.name].push(x2["value"]);return void 0}if(x2["name"].includes("[]")){var key=x2["name"].split("[]").join("");if(!formDataMappedAdditionals.hasOwnProperty(key))formDataMappedAdditionals[key]=[];formDataMappedAdditionals[key].push(x2["value"]);return void 0}return{[x2.name]:x2.value}}));formDataMapped={...formDataMapped,...formDataMappedAdditionals};if(f.hasAttr("b-sub")){var bfs=f.attr("b-sub");if(typeof window[bfs]==="function"){checkFormInputs(f);if(window[bfs](f,formDataMapped)===false)return false}}if(!checkFormInputs(f))return false;if(f.hasAttr("o-sub")){var ofs=f.attr("o-sub");if(typeof window[ofs]==="function"){window[ofs](f,formDataMapped)}}return false},clearForm:reset,resetForm:reset,success:function(responseText,statusText,xhr,f){},timeout:3e5,error:function(xhr,textStatus,errorThrown){}})}else{if(local){el2.ajaxForm({beforeSubmit:function(formData,f,options){if(!checkFormInputs(f))return false;let formDataMapped={};let formDataMappedAdditionals={};formDataMapped=Object.assign({},...formData.map(x2=>{if(x2.type=="file"){if(!formDataMappedAdditionals.hasOwnProperty(x2.name))formDataMappedAdditionals[x2.name]=[];formDataMappedAdditionals[x2.name].push(x2["value"]);return void 0}if(x2["name"].includes("[]")){var key=x2["name"].split("[]").join("");if(!formDataMappedAdditionals.hasOwnProperty(key))formDataMappedAdditionals[key]=[];formDataMappedAdditionals[key].push(x2["value"]);return void 0}return{[x2.name]:x2.value}}));formDataMapped={...formDataMapped,...formDataMappedAdditionals};try{if(f.hasAttr("b-sub")){var bfs=f.attr("b-sub");if(typeof window[bfs]==="function"){if(window[bfs](f,formDataMapped)===false)return false}}var actn2=f.attr("action")??"";if(actn2==""){actn2=getURLNodes().join("/")}if(validateInputs(f)){var d=getFormData(f);if(f.attr("method")?.toLowerCase()=="get"){actn2=addOrChangeParameters(actn2,d)}pushURL(actn2,d)}}catch(e){cl(e)}return false},clearForm:reset,resetForm:reset,success:function(responseText,statusText,xhr,f){},timeout:3e5,error:function(xhr,textStatus,errorThrown){}})}}});$("[editor]").each(function(i2){var editor=$(this);editor.removeAttr("editor");var TB=normalTB;if(editor.is("[mini]"))TB=miniTB;else if(editor.is("[full]"))TB=fullTB;if(typeof CKEDITOR!=="undefined"){CKEDITOR.replace(this,{uiColor:"#ffffff",language:$("html").attr("lang"),allowedContent:true,enterMode:CKEDITOR.ENTER_BR,toolbar:TB,on:{instanceReady:function(evt){var itemTemplate='<li class="l" data-id="{id}"><div><strong class="item-title">{name}</strong></div><div><i>{description}</i></div></li>',outputTemplate="<span class=hash>{linked}</span>&nbsp;";var autocomplete=new CKEDITOR.plugins.autocomplete(evt.editor,{textTestCallback:function(range){if(!range.collapsed){return null}return CKEDITOR.plugins.textMatch.match(range,function(text,offset){var left=text.slice(0,offset);var matchHash=left.match(/#\d*$/);var matchAt=left.match(/(@)[A-Za-z]+(?!\.)(?!.*\.$)(?!.*?\.\.)[a-zA-Z0-9.]+[A-Za-z0-9]{6,30}$/);if((!matchHash||matchHash=="#")&&(!matchAt||matchAt=="@")){return null}var match=matchHash;if(!match)match=matchAt;return{start:match.index,end:offset}})},dataCallback:function(matchInfo,callback){var query=matchInfo.query;if(myR["[ck]"])myR["[ck]"].abort();clearTimeout(debounceTimeout["[ck]"]);debounceTimeout["[ck]"]=setTimeout(function(){myR["[ck]"]=$.post(beas+"a/hashes/get",{id:query},function(result){if(result){result=$.parseJSON(result);var suggestions=result.filter(function(item){return String(item.name).indexOf(query.substring(1))==0});callback(suggestions)}})},500)},itemTemplate,outputTemplate,throttle:100});autocomplete.getHtmlToInsert=function(item){return this.outputTemplate.output(item)}},change:function(ev){if($.trim(ev.editor.getData()).length==0)editor.closest(".fields").addClass("is-empty").removeClass("is-not-empty");else editor.closest(".fields").removeClass("is-empty error").addClass("is-not-empty");editor.val(ev.editor.getData()).trigger("change")},focus:function(ev){editor.closest(".fields").addClass("focused");if($.trim(ev.editor.getData()).length==0)editor.closest(".fields").addClass("is-empty").removeClass("is-not-empty");else editor.closest(".fields").removeClass("is-empty error").addClass("is-not-empty")},blur:function(ev){editor.closest(".fields").removeClass("focused");if($.trim(ev.editor.getData()).length==0)editor.closest(".fields").addClass("is-empty").removeClass("is-not-empty");else editor.closest(".fields").removeClass("is-empty error").addClass("is-not-empty")}}})}});$(".cke_autocomplete_panel").each(function(){if($(this).html()=="")$(this).remove()});$("[tags]:not(.tag-editor-hidden-src)").each(function(){if(typeof $.fn.tagEditor!=="function")return;var t2=$(this);var u=currentlyValidTags.length;t2.attr("data-u",u);var del=t2.attr("dl")?t2.attr("dl"):", ";var maxTags=t2.attr("mt")?t2.attr("mt"):50;var maxLength=t2.attr("ml")?t2.attr("ml"):100;var plchldr=t2.attr("placeholder")?t2.attr("placeholder"):"";var tagslower=t2.attr("tags-lower")?true:false;var autocomplete=t2.attr("acs")?{delay:250,autoFocus:true,position:{collision:"flip"},source:function(request,response){$.post(beas+"a"+t2.attr("acs"),request,response)},minLength:1,select:function(event,ui){if(ui.item==null){t2.val("")}},change:function(event,ui){if(ui.item==null){t2.val("")}}}:null;t2.tagEditor({autocomplete,delimiter:del,removeDuplicates:true,forceLowercase:tagslower,placeholder:plchldr,animateDelete:50,maxLength,maxTags,onChange:function(field,editor,tags){field.trigger("change")},beforeTagSave:function(field,editor,tags,tag,val2){if(!t2.attr("sts")){if($.inArrayIn(val2,tags)!==-1){return false}}else{if($.inArray(tag,currentlyValidTags[u][tags])==-1){return false}}if(t2.attr("tags-before")){var bfs=t2.attr("tags-before");if(typeof window[bfs]==="function"){if(window[bfs](t2,field,editor,tags,tag,val2)===false)return false}}}});currentlyValidTags.push(t2)});$("[slct]:not(.select2-hidden-accessible)").each(function(){if(typeof $.fn.select2!=="function")return;var t2=$(this);var plchldr=t2.attr("placeholder")?t2.attr("placeholder"):"";var dropdownParent=t2.attr("prnt")?t2.attr("prnt"):"body";var tpl=t2.attr("slct-tpl")?t2.attr("slct-tpl"):null;var dir=t2.attr("slct-dir")?t2.attr("slct-dir"):"ltr";var minResultsForSearch=t2.attr("mins")?t2.attr("mins"):"";if(dropdownParent=="self")dropdownParent=t2.parent();else dropdownParent=$(dropdownParent);var allowNewTags=t2.attr("ntgs")?true:false;var ax=t2.attr("axs")?{url:t2.attr("axs"),dataType:"json",delay:250}:null;t2.select2({dropdownParent,placeholder:plchldr,dir,allowClear:false,tags:allowNewTags,ajax:ax,minimumResultsForSearch:minResultsForSearch,templateSelection:function(data2,container){if(data2.newTag){if(allowNewTags&&t2.attr("ntgs")!="true"){var tag=data2.text;var id=data2.id;$.post(beas+"a"+t2.attr("ntgs"),{tag},function(r2){if(r2=="true"){var newOption=new Option(tag,id,true,true);t2.append(newOption).trigger("change")}else{alert("Error adding tag! Please Try again.");t2.val(null).trigger("change")}});return data2.text}else{return data2.text}}else{return data2.text}},templateResult:function(state){if(tpl){if(typeof window[tpl]==="function")return window[tpl](state)}if(state.newTag){if(allowNewTags&&t2.attr("ntgs")!="true"){var new_state=$("<span>+ Add <b>"+state.text+"</b></span>");return new_state}return state.text}else return state.text},tokenSeparators:[","],createTag:function(params){var term=$.trim(params.term);if(term===""){return null}return{id:term,text:term,newTag:true}},insertTag:function(data2,tag){data2.push(tag)}});if(t2.attr("nosearch"))t2.on("select2:opening select2:closing",function(event){var searchfield=$(this).parent().find(".select2-search__field");searchfield.prop("disabled",true)})});$("[sl]:not(.select2-hidden-accessible)").each(function(){if(typeof $.fn.select2!=="function")return;var t2=$(this);try{var plchldr=t2.attr("placeholder")?t2.attr("placeholder"):"";var dir=$("body").hasClass("rtl")?"rtl":"ltr";var nr=t2.attr("sl-nrmsg")?t2.attr("sl-nrmsg"):"No results found";var minResultsForSearch=t2.attr("sl-mins")?t2.attr("sl-mins"):10;var allowNewTags=t2.attr("sl-ntgs")?true:false;var dropdownParent=t2.attr("sl-prt")?t2.attr("sl-prt"):"body";if(dropdownParent=="self")dropdownParent=t2.parent();else dropdownParent=$(dropdownParent);var query=t2.attr("sl-query")?t2.attr("sl-query"):null;var uniquer=Date.now();if(typeof window[query]==="function"){let dbcrID="dbcr_"+(Object.keys(_dbcrs).length+1);t2.select2.amd.define("adapt_"+uniquer,["select2/data/array","select2/utils"],function(ArrayAdapter,Utils){function CustomDataAdapter($element,options){CustomDataAdapter.__super__.constructor.call(this,$element,options)}Utils.Extend(CustomDataAdapter,ArrayAdapter);CustomDataAdapter.prototype.query=function(params,callback){clearTimeout(_dbcrs[dbcrID]);let _t=t2;_dbcrs[dbcrID]=setTimeout(function(){window[query](params,callback,_t)},!_dbcrs.hasOwnProperty(dbcrID)?0:_dbcrsTime)};return CustomDataAdapter});t2.select2({dropdownParent,minimumResultsForSearch:minResultsForSearch,placeholder:plchldr,dir,tags:allowNewTags,allowClear:false,language:{noResults:function(){return nr}},...t2.select2.amd.require("adapt_"+uniquer)?{ajax:{},dataAdapter:t2.select2.amd.require("adapt_"+uniquer)}:{}})}else{t2.select2({dropdownParent,minimumResultsForSearch:minResultsForSearch,placeholder:plchldr,dir,tags:allowNewTags,allowClear:false,language:{noResults:function(){return nr}}})}if(t2.attr("sl-nosrch"))t2.on("select2:opening select2:closing",function(event){var searchfield=$(this).parent().find(".select2-search__field");searchfield.prop("disabled",true)});if(t2.attr("sl-class")){t2.on("select2:opening",function(event){dropdownParent.addClass(t2.attr("sl-class"))});t2.on("select2:closing",function(event){dropdownParent.removeClass(t2.attr("sl-class"))})}}catch(e){cl(e)}});$("[pinnable]:not(.pinnable)").each(function(){if(typeof Headroom==="undefined")return;var t2=$(this);var offsetU=t2.attr("pinnable-offset-up")??100;var offsetD=t2.attr("pinnable-offset-down")??50;var options={offset:0,offset:{up:offsetU,down:offsetD},tolerance:0,tolerance:{up:5,down:0},classes:{initial:"pinnable",pinned:"pinnable--pinned",unpinned:"pinnable--unpinned",top:"pinnable--top",notTop:"pinnable--not-top",bottom:"pinnable--bottom",notBottom:"pinnable--not-bottom",frozen:"pinnable--frozen",pinned:"pinnable--pinned"},onPin:function(){},onUnpin:function(){},onTop:function(){},onNotTop:function(){},onBottom:function(){},onNotBottom:function(){}};var pinnable=new Headroom(t2[0],options);pinnable.init()});$("[sort]").each(function(e){if(typeof $.fn.sortable!=="function")return;let t2=$(this);if(t2.hasClass("ui-sortable"))return;let opts={delay:50,placeholder:"g_rows_helper",scrollSpeed:40,opacity:1};opts=avc(t2,"sort-axis",opts);opts=avc(t2,"sort-handle",opts);opts=avc(t2,"sort-cancel",opts);opts=avc(t2,"sort-cursor",opts,"grabbing");opts=avc(t2,"sort-helper",opts,"clone");if(opts.hasOwnProperty("helper")&&opts["helper"]!="clone"){if(typeof window[opts["helper"]]==="function")opts["helper"]=window[opts["helper"]]}opts=avc(t2,"sort-placeholder",opts);opts=avc(t2,"sort-opacity",opts);opts=avc(t2,"sort-items",opts);opts=avc(t2,"sort-tolerance",opts,"pointer");opts=avc(t2,"sort-revert",opts,false);opts=avc(t2,"sort-forcePlaceholderSize",opts);opts=avc(t2,"sort-containment",opts,"parent");opts=avc(t2,"sort-connectWith",opts);if(opts.hasOwnProperty("forceplaceholdersize")){opts["forcePlaceholderSize"]=opts["forceplaceholdersize"];delete opts["forceplaceholdersize"]}t2.sortable(opts)});$("[drag]").each(function(e){if(typeof $.fn.draggable!=="function")return;let t2=$(this);let opts={};opts=avc(t2,"drag-connectToSortable",opts);opts=avc(t2,"drag-scroll",opts,true);opts=avc(t2,"drag-revert",opts,true);opts=avc(t2,"drag-helper",opts,"clone");opts=avc(t2,"drag-containment",opts,false);opts=avc(t2,"drag-cursor",opts,"auto");opts=avc(t2,"drag-appendTo",opts,"parent");opts=avc(t2,"drag-disabled",opts,false);if(opts.disabled=="false")delete opts.disabled;if(opts.hasOwnProperty("appendto")){opts.appendTo=opts["appendto"];delete opts["appendto"]}if(opts.hasOwnProperty("helper")&&opts["helper"]!="clone"){if(typeof window[opts["helper"]]==="function")opts["helper"]=window[opts["helper"]]}if(opts.hasOwnProperty("connecttosortable")){opts["connectToSortable"]=opts["connecttosortable"];delete opts["connecttosortable"]}t2.draggable(opts)});$("[drop]").each(function(e){if(typeof $.fn.droppable!=="function")return;let t2=$(this);let opts={};opts=avc(t2,"drop-accept",opts);opts=avc(t2,"drop-greedy",opts);opts=avc(t2,"drop-hoverClass",opts);opts=avc(t2,"drop-disabled",opts,false);if(opts.disabled=="false")delete opts.disabled;if(opts.hasOwnProperty("hoverclass")){opts.hoverClass=opts["hoverclass"];delete opts["hoverclass"]}t2.droppable(opts)});$("body").on("touchstart mouseover",function(e){let isTippedOe=true;if($(e.target).closest(".oe").length){let oe=$(e.target).closest(".oe");if((oe.find("[tip]").length||oe.hasAttr("tip"))&&oe.isOverflown()&&$(window).width()>480){isTippedOe=true}else isTippedOe=false}if($(e.target).closest("[tip]").length&&isTippedOe){var target=$(e.target).closest("[tip]");var tip=`<tip class="pa ${target.attr("tip-class")}"><div class="pa [[P]]"><span>[[T]]</span></div></tip>`;if(target.find("droplet").length==0){var t2=target.attr("tip");var p=target.attr("tip-pos");if(!p)p="";$("tip").remove();$("body").append(tip.replace("[[T]]",t2).replace("[[P]]",p));_isTipped=true;let _tipSc=target;while(true){if(_isScrollable(_tipSc)||_tipSc[0]==$("body")[0])break;_tipSc=_tipSc.parent()}var self=target;_setPos(self,p,_tipSc);_setPos(self,p,_tipSc);target.data("_tipSc",_tipSc);_tipSc.unbind("scroll.kuku").bind("scroll.kuku",function(){_setPos(self,p,_tipSc)})}else{$("tip").remove();_isTipped=false}}else{$("body").unbind("scroll.kuku");$("tip").remove();_isTipped=false}});$("[numeric]").each(function(){if(typeof $.fn.numeric!=="function")return;$(this).removeAttr("numeric").numeric()});$("[pattern]").each(function(){$(this).data("pattern",$(this).attr("pattern")).removeAttr("pattern")});$("[integer]:not([pve])").each(function(){if(typeof $.fn.numeric!=="function")return;$(this).removeAttr("integer").numeric({decimal:false})});$("[integer][pve]").each(function(){if(typeof $.fn.numeric!=="function")return;$(this).removeAttr("integer").numeric({decimal:false,negative:false})});$("[decimal]:not([pve])").each(function(){if(typeof $.fn.numeric!=="function")return;var places=-1;if($(this).is("[dp0]"))places=0;else if($(this).is("[dp1]"))places=1;else if($(this).is("[dp2]"))places=2;else if($(this).is("[dp3]"))places=3;else if($(this).is("[dp4]"))places=4;if(places>=0)$(this).removeAttr("decimal").numeric({decimalPlaces:places,decimal:places==0?false:"."});else $(this).removeAttr("decimal").numeric({})});$("[decimal][pve]").each(function(){if(typeof $.fn.numeric!=="function")return;var places=-1;if($(this).is("[dp0]"))places=0;else if($(this).is("[dp1]"))places=1;else if($(this).is("[dp2]"))places=2;else if($(this).is("[dp3]"))places=3;else if($(this).is("[dp4]"))places=4;if(places>=0)$(this).removeAttr("decimal").numeric({negative:false,decimalPlaces:places,decimal:places==0?false:"."});else $(this).removeAttr("decimal").numeric({negative:false})});$("[time]").each(function(){dtp($(this),"time")});$("[date]").each(function(){dtp($(this),"date")});$("[datetime]").each(function(){dtp($(this),"datetime")});$("[color]").each(function(){if(typeof $.fn.colorpicker!=="function")return;$(this).removeAttr("color").colorpicker({format:"rgba"})});$("lmlst:not(.binded)").each(function(){var el=$(this);el.addClass("binded");let _conf=el.attr(":config");let conf=null;if(_conf){try{conf=typeof _evalEventScopedExpr==="function"?_evalEventScopedExpr(el[0]._ownerRe,_conf):eval(_conf)}catch(x2){conf=null}}el[0].list=new __myList(el,conf||{})})}function dtp(el2,t2){el2.removeAttr(t2);let opts={format:t2=="date"?"yyyy-mm-dd":t2=="time"?"hh:ii":"yyyy-mm-dd hh:ii",weekStart:el2.attr("date-week-start")??1,startView:t2=="time"?1:2,minView:el2.attr("minview")?el2.attr("minview"):t2=="time"?0:t2=="datetime"?0:2,maxView:el2.attr("maxview")?el2.attr("maxview"):t2=="time"?1:4,todayBtn:t2=="time"?0:el2.attr("date-today")=="false"?0:1,todayHighlight:t2=="time"?0:el2.attr("date-today")=="false"?0:1,language:el2.attr("date-lang")??"en",minuteStep:el2.attr("date-minute-step")??5,pickerPosition:"top-right",autoclose:1,showMeridian:false};if(el2.attr("date-start"))opts["startDate"]=el2.attr("date-start");if(el2.attr("date-end"))opts["endDate"]=el2.attr("date-end");if(el2.attr("date-value"))opts["date"]=el2.attr("date-value");el2.datetimepicker(opts);if(t2=="time"){el2.on("show",function(ev){$(".table-condensed > thead, .table-condensed > thead > tr > th, .table-condensed > thead > tr > th > i").attr("style","visibility: hidden; font-size:0px !Important; overflow: hidden; height: 0px;")}).on("hide",function(ev){$(".table-condensed > thead, .table-condensed > thead > tr > th, .table-condensed > thead > tr > th > i").attr("style","visibility: visible;")})}if(el2.attr("date-link-start")){el2.on("change",function(e){let dp1=el2.data("datetimepicker");let dp2=$(el2.attr("date-link-start")).data("datetimepicker");dp2.setStartDate(dp1.getFormattedDate());if(dp2.getFormattedDate()<dp1.getFormattedDate()||dp2.getFormattedDate()=="")$(el2.attr("date-link-start")).val(dp1.getFormattedDate())})}else if(el2.attr("date-link-end")){el2.on("change",function(e){let dp1=$(el2.attr("date-link-end")).data("datetimepicker");let dp2=el2.data("datetimepicker");dp1.setEndDate(dp2.getFormattedDate())});opts["useCurrent"]=false}}function avc(t2,n2,o,d=null){if(t2.attr(n2.toLowerCase()))o[n2.toLowerCase().split("sort-").join("").split("drop-").join("").split("drag-").join("")]=t2.attr(n2.toLowerCase());else if(d!=null)o[n2.toLowerCase().split("sort-").join("").split("drop-").join("").split("drag-").join("")]=d;return o}var _lmAtIndex=new Map;function _lmIndexAtEl(el2,name){var set=_lmAtIndex.get(name);if(!set){set=new Set;_lmAtIndex.set(name,set)}set.add(el2);if(set.size>5e3)set.forEach(function(e){if(!e.isConnected)set.delete(e)})}function _findByAtAttrNames(names){var out=[];var seen=new Set;for(var j=0;j<names.length;j++){var set=_lmAtIndex.get(names[j]);if(!set)continue;set.forEach(function(el2){if(seen.has(el2)||!el2.isConnected)return;if(el2.events&&el2.events[names[j]]!=null){seen.add(el2);out.push(el2)}})}try{var sel=names.map(function(n2){return"[\\"+n2+"]"}).join(",");var raw=document.querySelectorAll(sel);for(var i2=0;i2<raw.length;i2++)if(!seen.has(raw[i2])){seen.add(raw[i2]);out.push(raw[i2])}}catch(e){}return out}function _installScrollStartEndSynthesis(el2){if(el2._lumenScrollSynthInstalled)return;el2._lumenScrollSynthInstalled=true;var scrolling=false;var settleTimer=null;el2.addEventListener("scroll",function(){if(!scrolling){scrolling=true;el2.dispatchEvent(new Event("scrollstart"))}clearTimeout(settleTimer);settleTimer=setTimeout(function(){scrolling=false;el2.dispatchEvent(new Event("scrollend"))},150)},{passive:true})}function applyTriggers(){$("[click]").each(function(){$(this).trigger("click").removeAttr("click")});$("[focus]").each(function(){$(this).trigger("focus").removeAttr("focus")});let _Ns=[];for(let x2=9;x2>=0;x2--){let _els=$("[n"+x2+"]");_els.each(function(){let _el2=$(this);let _d2={};for(let y=9;y>=0;y--){if(_el2.hasAttr("n"+y)){_d2["n"+y]=_el2.attr("n"+y).split(",")}}_el2.data("_Ns",_d2);_Ns.push(_el2)})}for(let i2=0;i2<_Ns.length;i2++){const _n=_Ns[i2];let _act=[];let attrs=_n.data("_Ns");for(const nK in attrs){if(Object.hasOwnProperty.call(attrs,nK)){const nV=attrs[nK];let index=nK.slice(1);if(nV.indexOf(nodes[index])!=-1){_act.push(true)}else{_act.push(false);break}}}setTimeout(()=>{if(_act.indexOf(false)!=-1)_n.removeClass("active");else _n.addClass("active")})}if(typeof viewLoaded==="function"&&!_viewLoaded){_viewLoaded=true;viewLoaded()}var _scrollAttrEls=_findByAtAttrNames(["@scroll","@scroll-start","@scroll-end","@scroll-left","@scroll-right","@scroll-top","@scroll-bottom"]);for(var _sei=0;_sei<_scrollAttrEls.length;_sei++){_installScrollStartEndSynthesis(_scrollAttrEls[_sei])}$(_scrollAttrEls).unbind("scroll touchmove scrollstart scrollend").on("scroll touchmove scrollstart scrollend",function(ev){let el2=$(this);if(ev.type=="scrollend"){var newScrollLeft=el2.scrollLeft(),newScrollTop=el2.scrollTop(),width=el2.width(),scrollWidth=el2.get(0).scrollWidth,scrollHeight=el2.get(0).scrollHeight;var hasScX=el2.prop("scrollWidth")>el2.width();var hasScY=el2.prop("scrollHeight")>el2.height();if(newScrollLeft==0){processEv(ev,el2,"scroll-left")}else if(Math.round(scrollWidth-newScrollLeft-width-(hasScY?-_scW:0))==0){processEv(ev,el2,"scroll-right")}if(newScrollTop==0){processEv(ev,el2,"scroll-top")}else if(newScrollTop+el2.innerHeight()>=scrollHeight-(hasScX?-_scW:0)){processEv(ev,el2,"scroll-bottom")}}processEv(ev,el2,ev.type.length==6?"scroll":ev.type.split("scroll").join("scroll-"))})}_viewLoaded=false;function globalWatch(){if(!_initialized)return;$('[beajs="1"]').remove();$('script[type="beajs"]').each(function(){var html=$(this).html();$(this).remove();var myScript=document.createElement("script");myScript.setAttribute("beajs","1");myScript.textContent=html;document.body.appendChild(myScript)});let bindsCount=0;let prom=defer();prom.then(function(val2){renderPlugins();loadPics();reloads();let tickFunc2=appSettings.tick&&typeof appSettings.tick==="function"?appSettings.tick:typeof tick==="function"?tick:null;if(typeof tickFunc2==="function")tickFunc2()}).catch(reason=>{renderPlugins();loadPics();reloads();let tickFunc2=appSettings.tick&&typeof appSettings.tick==="function"?appSettings.tick:typeof tick==="function"?tick:null;if(typeof tickFunc2==="function")tickFunc2()});if(bindsCount==0){prom.resolve()}reloads();let tickFunc=appSettings.tick&&typeof appSettings.tick==="function"?appSettings.tick:typeof tick==="function"?tick:null;if(typeof tickFunc==="function")tickFunc()}function loadPics(){$("[lazy]").each(function(){if(typeof $.fn.lazy!=="function")return;let _el2=$(this);_el2.lazy({effect:"show",bind:"event",threshold:200,visibleOnly:false,beforeLoad:function(element){_el2.removeAttr("lazy")},afterLoad:function(element){},onError:function(element){cl("error loading "+_el2.attr("data-src"))},onFinishedAll:function(){}})})}function paraToObj(para){if(para=="")return JSON.parse("{}");return JSON.parse('{"'+decodeURI(para).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')}function getBind(b,d){d=d?d.split("&"):new Array;if(b){var binder=b.split(",");for(var x2=0;x2<binder.length;x2++){var finder=binder[x2].split(" as ");if(finder[0].indexOf(" attr ")!==-1){var findz=finder[0].split(" attr ");d.push(finder[1]+"="+$.trim($(findz[0]).attr(findz[1])))}else if(finder[0].indexOf(" find ")!==-1){var findz=finder[0].split(" find ");var val2=getVal($(findz[0]).find(findz[1]));d.push(finder[1]+"="+$.trim(val2))}else if(finder[0].indexOf(" from ")!==-1){var findz=finder[0].split(" from ");if(findz[1].toLowerCase()=="ls"){d.push(finder[1]+"="+localStorage.getItem(findz[0]))}else{d.push(finder[1]+"="+findz[0])}}else d.push(finder[1]+"="+getVal($(finder[0])))}}d=d.join("&");return d}function isPathLocal(path){var local=false;var l=getLocation(path);var l2=getLocation(appSettings.Base);var url="home";local=l.hostname==l2.hostname;return local}function checkFormInputs(f,inp,classesOnly){var inputs=inp?[inp]:f.find("[\\:required]:not([disabled])");for(var i2=0;i2<inputs.length;i2++){let el2=$(inputs[i2]);let pat=el2.data("pattern");let req=el2.hasAttr(":required");let lbl=el2.closest("label");let fs=el2.closest("fieldset");let max=el2.attr("max");let max_num=el2.attr("max-num");let min_num=el2.attr("min-num");let v=el2.val();var or=el2.attr("or");if(or!=""){var or=f.find("[name='"+or+"']")}var into;let allCls="is-not-checked is-checked is-valid is-not-empty is-empty is-invalid error success not-4-chars not-on-pattern";el2.removeClass(allCls);el2.parent().removeClass(allCls);if(lbl.length)lbl.removeClass(allCls);if(fs.length)fs.removeClass(allCls);if(el2.is(":checkbox")||el2.is(":radio")){var isCheck="is-not-checked"+(req?" is-invalid":"");if(el2.is(":checked")){isCheck="is-checked"+(req?" is-valid":"")}else{if(or.length){if(or.is(":checked")){isCheck="is-checked"+(req?" is-valid":"")}}}if(el2.is(":radio")){f.find("[name='"+el2.attr("Name")+"']:radio").not(el2[0]).each(function(){let _el2=$(this);let _req=_el2.hasAttr(":required");var _isCheck="is-not-checked"+(_req?" is-invalid":"");var _or=_el2.attr("or");let _lbl=_el2.closest("label");_el2.removeClass(allCls);_el2.parent().removeClass(allCls);if(_lbl.length)_lbl.removeClass(allCls);if(_or!=""){var _or=f.find("[name='"+_or+"']")}if(_el2.is(":checked")){_isCheck="is-checked"+(_req?" is-valid":"")}else{if(_or.length){if(_or.is(":checked")){_isCheck="is-checked"+(_req?" is-valid":"")}}}if(_el2.parent().prop("nodeName")!="FORM")_el2.parent().addClass(_isCheck);if(_lbl.length)_lbl.addClass(_isCheck);_el2.addClass(_isCheck)})}if(el2.parent().prop("nodeName")!="FORM")el2.parent().addClass(isCheck);if(lbl.length)lbl.addClass(isCheck);el2.addClass(isCheck)}else{var isV="is-empty"+(req?" is-invalid":"");if(el2.is("[username]")){if(v.length&&v.length<4){isV="not-4-chars is-not-empty"+(req?" is-invalid":"")}else{let vld=true;var k=v.match(/[a-z]+(?!\.)(?!.*\.$)(?!.*?\_\_)[a-z0-9_]+[a-z0-9]/);if(!k){vld=false}else{if(k.input!=k[0]){vld=false}}if(vld)isV="is-not-empty"+(req?" is-valid":"");else isV="not-on-pattern is-not-empty"+(req?" is-invalid":"")}}else if(el2.is("[password]")){if(!passwordValid(v)){isV="is-not-empty"+(req?" is-invalid":"")}else{isV="is-not-empty"+(req?" is-valid":"")}}else if(el2.is("[rpassword]")){if($.trim(v)!=$.trim(f.find("[password]").val())){isV="is-not-empty"+(req?" is-invalid":"")}else{isV="is-not-empty"+(req?" is-valid":"")}}else{if($.trim(v).length!=0){if(max&&!isNaN(max)){if($.trim(v).length>max){el2.val($.trim($.trim(v).substr(0,max)))}}if(min_num&&!isNaN(min_num)){if(!isNaN($.trim(v))){if(parseFloat($.trim(v))<parseFloat(min_num))el2.val($.trim(min_num))}else{el2.val(min_num)}}if(max_num&&!isNaN(max_num)){if(!isNaN($.trim(v))){if(parseFloat($.trim(v))>parseFloat(max_num))el2.val($.trim(max_num))}else{if(min_num&&!isNaN(min_num))el2.val($.trim(min_num));else el2.val("0")}}isV="is-not-empty";if(pat){pat=new RegExp(pat);if(pat.test($.trim(v))){isV+=req?" is-valid":""}else{isV+=req?" is-invalid":"";el2.val("")}}else isV+=req?" is-valid":""}else{if(or.length){if($.trim(or.val()).length!=0){isV="is-not-empty"+(req?" is-valid":"")}}}}if(el2.parent().prop("nodeName")!="FORM")el2.parent().addClass(isV);if(lbl.length)lbl.addClass(isV);el2.addClass(isV)}var isRadioChecked=false;if(el2.is(":radio")){if(el2.hasClass("is-invalid")){f.find("[name='"+el2.attr("Name")+"']:radio").not(el2[0]).each(function(){if($(this).hasClass("is-valid")){isRadioChecked=true}})}else{isRadioChecked=true}}if(el2.hasClass("is-invalid")||el2.is(":radio")&&!isRadioChecked){if(el2.hasAttr("data-into")){let intoTxt=el2.data("into");if(lbl.length)into=lbl.find(intoTxt);if(!into){if(fs.length)into=fs.find(intoTxt)}if(!into)into=$(intoTxt);if(into.length){if(el2.is("[password]")){if($.trim(v).length==0)into.text(el2.attr("data-empty"));else if(el2.hasAttr("data-wpm"))into.text(el2.attr("data-wpm"));let rpass=f.find("[rpassword]");if(rpass.length){if($.trim(rpass.val()).length!=0)checkFormInputs(f,rpass,true)}}else if(el2.is("[rpassword]")){if($.trim(v).length==0)into.text(el2.attr("data-empty"));else if(el2.hasAttr("data-pnm"))into.text(el2.attr("data-pnm"))}else if(el2.is("[username]")){let txt=el2.hasAttr("data-empty")?el2.attr("data-empty"):el2.attr("placeholder");if($.trim(v).length==0)into.text(txt);else{if(el2.hasClass("not-4-chars")){if(el2.hasAttr("data-4-chars"))txt=el2.attr("data-4-chars")}else if(el2.hasClass("not-on-pattern")){if(el2.hasAttr("data-chars-not-allowed"))txt=el2.attr("data-chars-not-allowed")}into.text(txt)}}else if(el2.hasAttr("data-empty")){into.text(el2.attr("data-empty"))}else{if(el2.is(":checkbox")||el2.is(":radio")){into.text(el2.attr("placeholder"))}else{into.text(el2.attr("placeholder"))}}}}if(!classesOnly){if(el2.is(":radio")){if(!isRadioChecked){if(fs.length)fs.addClass(isCheck);el2.focus();return false}}else{if(fs.length)fs.addClass(isV);el2.focus();return false}}else{if(el2.is(":radio")){if(!isRadioChecked){if(fs.length)fs.addClass(isCheck)}}else{if(fs.length)fs.addClass(isV)}}}else if(el2.hasClass("is-valid")){if(el2.hasAttr("data-into")){let intoTxt=el2.data("into");if(lbl.length)into=lbl.find(intoTxt);if(fs.length)into=fs.find(intoTxt);if(!into)into=$(intoTxt);if(into.length){into.text("")}}}}return true}function validateInputs(f){if(f.hasAttr("ax-before")){var bfs=f.attr("ax-before");if(typeof window[bfs]==="function"){if(window[bfs](f)===false)return false}}var inps=[];f.find("input.required,select.required,textarea.required").each(function(){inps.push($(this).attr("name"))});for(var i2=0;i2<inps.length;i2++){var inp=f.find("input[name='"+inps[i2]+"']");var sel=f.find('select[name="'+inps[i2]+'"]');var txt=f.find('textarea[name="'+inps[i2]+'"]');var e=inp;if(!e.length)e=sel;if(!e.length)e=txt;var or=e.attr("or");if(or!=""){var inp2=f.find("input[name='"+or+"']");var sel2=f.find('select[name="'+or+'"]');var txt2=f.find('textarea[name="'+or+'"]');var or=inp2;if(!or.length)or=sel2;if(!or.length)or=txt2}if(e.is(":checkbox")||e.is(":radio")){if(!e.is(":checked")){if(or.length){if(!or.is(":checked")){alert(e.attr("placeholder")+" or "+or.attr("placeholder"));e.addClass("error");e.focus();return false}}else{alert(e.attr("placeholder"));e.addClass("error");e.focus();return false}}}else{if($.trim(e.val()).length==0){if(or.length){if($.trim(or.val()).length==0){alert(e.attr("placeholder")+" or "+or.attr("placeholder"));e.addClass("error");e.focus();return false}}else{alert(e.attr("placeholder"));e.addClass("error");e.focus();return false}}if(e.is("[password]")){if(!passwordValid(e.val())){alert(e.attr("data-wpm"));e.addClass("error");e.focus();return false}}if(e.is("[rpassword]")){if($.trim(e.val())!=$.trim(e.closest("form").find("[password]").val())){e.addClass("error");alert(e.attr("data-pnm"));e.focus();return false}e.removeClass("error");$(".passStrength").remove()}}}return true}let _cookies={getItem:function(sKey){if(!sKey){return null}return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(sKey).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},setItem:function(sKey,sValue,vEnd,sPath,sDomain,bSecure){if(!sKey||/^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)){return false}var sExpires="";if(vEnd){switch(vEnd.constructor){case Number:sExpires=vEnd===Infinity?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+vEnd;break;case String:sExpires="; expires="+vEnd;break;case Date:sExpires="; expires="+vEnd.toUTCString();break}}if(!sPath)sPath="/";document.cookie=encodeURIComponent(sKey)+"="+encodeURIComponent(sValue)+sExpires+(sDomain?"; domain="+sDomain:"")+(sPath?"; path="+sPath:"")+(bSecure?"; secure":"");return true},removeItem:function(sKey,sPath,sDomain){if(!this.hasItem(sKey)){return false}if(!sPath)sPath="/";document.cookie=encodeURIComponent(sKey)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(sDomain?"; domain="+sDomain:"")+"; path="+sPath;return true},hasItem:function(sKey){if(!sKey){return false}return new RegExp("(?:^|;\\s*)"+encodeURIComponent(sKey).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},keys:function(){var aKeys=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/);for(var nLen=aKeys.length,nIdx=0;nIdx<nLen;nIdx++){aKeys[nIdx]=decodeURIComponent(aKeys[nIdx])}return aKeys}};var cookies=new Proxy(_cookies,{get(target,key){return target[key]??target.getItem(key)??void 0},set(target,key,value){if(key in target){return false}return target.setItem(key,value)},deleteProperty(target,key){if(!(key in target)){return false}return target.removeItem(key)},ownKeys(target){return target.keys()},has(target,key){return key in target||target.hasItem(key)},defineProperty(target,key,descriptor){if(descriptor&&"value"in descriptor){target.setItem(key,descriptor.value)}return target},getOwnPropertyDescriptor(target,key){const value=target.getItem(key);return value?{value,enumerable:true,configurable:true}:void 0}});function getCookie(n2){return cookies[n2]}function setCookie(n2,v,d,p,e){var now=new Date;var time=now.getTime();if(!e)e=time+24*60*60*1e3*365;else e=time+e;if(!d)d=window.location.hostname;if(!p)p="/";now.setTime(e);return cookies.setItem(n2,v,now.toGMTString(),p,d,true)}function getComData(c,fromHTML){if(fromHTML){try{var el2=$("<div></div>");el2.html(c.html());var k={};var mtitle=$("modal-title",el2).html();if(!mtitle)mtitle="";var mbody=$("modal-body",el2).html();if(!mbody)mbody="";var mdesc=$("modal-description",el2).html();if(!mdesc)mdesc="";var mfoot=$("modal-footer",el2).html();if(!mfoot)mfoot="";k.Title=mtitle;k.Body=mbody;k.Description=mdesc;k.Footer=mfoot;c=k;return c}catch(e){return false}return false}try{c=c.contents().filter(function(){return this.nodeType===8}).get(0);if(c.nodeValue=="")return false;try{c=JSON.parse(c.nodeValue)}catch(e){try{c=JSON.parse(atob(c.nodeValue))}catch(e2){try{var el2=$("<div></div>");el2.html(c.nodeValue);var k={};var mtitle=$("modal-title",el2).html();if(!mtitle)mtitle="";var mbody=$("modal-body",el2).html();if(!mbody)mbody="";var mdesc=$("modal-description",el2).html();if(!mdesc)mdesc="";var mfoot=$("modal-footer",el2).html();if(!mfoot)mfoot="";k.Title=mtitle;k.Body=mbody;k.Description=mdesc;k.Footer=mfoot;c=k}catch(e3){return false}}}return c}catch(e){return false}}function addOrChangeParameters(url,params){let splitParams={};let splitPath=/(.*)[?](.*)/.exec(url);if(splitPath&&splitPath[2])splitPath[2].split("&").forEach(k=>{let d=k.split("=");splitParams[d[0]]=d[1]});let newParams=Object.assign(splitParams,params);let finalParams=Object.keys(newParams).map(a=>a+"="+newParams[a]).join("&");return splitPath?splitPath[1]+"?"+finalParams:url+"?"+finalParams}class BEA{Cart=null;Products=null;Authorize=null;Pay=null;localCache=true;_prom=null;proms=[];l="En";fields={Section:"Section,Title,Text",Product:"Name,Price,Quantity"};constructor(options){if(options===void 0)options={};if(!Object.keys(options).length==0){if(options.hasOwnProperty("fields")){for(var i2 in options["fields"]){this.fields[i2]=options["fields"][i2]}}if(options.hasOwnProperty("localisation"))this.l=options.localisation;if(options.hasOwnProperty("locale")&&options.locale===true){this.getLocale()}if(options.hasOwnProperty("sections")&&options.sections===true){this.getSections()}if(options.hasOwnProperty("localCache")&&options.localCache===false){this.localCache=false}}this.Cart=new Cart(this);this.Products=new Products(this);this.Authorize=new Authorize(this);this.Pay=new Pay(this);this._prom=Promise.all(this.proms)}request(className,data2,async,type2,a){var prom=defer();var x2;API.req(className,data2,null,type2,a??0).then(r2=>{if(async){prom.resolve(r2)}else{x2=r2.results}});if(async)return prom;return x2}getSections(){var sec=new Section(this);this.proms.push(sec._prom);return sec.get()}getLocale(){var loc=new Locale(this);this.proms.push(loc._prom);return loc.get()}order(){let prom=defer();var ids="";var productsInfo;var user;var orderData={User:"",productItems:[],Amount:0};user=this.Authorize.me();orderData.User=user.objectId;$.each(this.Cart.cartData,function(key,value){ids=ids+value.P+","});this.Products.get({fields:"Name,Price,Quantity",media:"images",crops:"ax200,ax600,ax700,200x200,ax300"},{ids},true).then(res=>{let productsInfo2=res.results;var productsDB=Object.assign({},...productsInfo2.map(x2=>({[x2.objectId]:x2})));$.each(this.Cart.cartData,function(key,value){orderData.productItems.push({Qty:value.Q,Product:value.P,productData:JSON.stringify(productsDB[value.P]),Price:productsDB[value.P].Price});orderData.Amount+=value.Q*productsDB[value.P].Price});this.request("/Order",{User:orderData.User,Amount:orderData.Amount},true,"POST").then(res2=>{let orderId=res2.results;for(var i2=0;i2<orderData.productItems.length;i2++){orderData.productItems[i2]["Order"]=orderId[0].objectId;this.request("/orderItems ",orderData.productItems[i2],true,"POST")}prom.resolve(orderId)})});return prom}sendEmail(data2){let prom=defer();this.request("/_Emails/send",data2,true,"POST").then(res=>{prom.resolve(r)})}batch(data2){return this.request("/batch",data2,true,"POST")}query(className,data2){return this.request(className,data2,true,"GET")}get(className,data2,options=true){return this.request(className,data2,options,"GET")}post(className,data2,options=true){return this.request(className,data2,options,"POST")}put(className,data2,options=true){return this.request(className,data2,options,"PUT")}delete(className,options=true){return this.request(className,"",options,"DELETE")}}class Pay{tsdk=null;object={};constructor(tsdk){this.tsdk=tsdk;let self=this;$(window).unbind("message").on("message",function(e){let dd=$("#gosell-gateway")[0].contentWindow;if(e.originalEvent.source===dd&&e.originalEvent.data=="close"){$(".gosell-gateway").remove();self.onClose()}})}create(data2){let prom=defer();API.post("https://pay.bea.com.lb/create",data2,{},666).then(d=>{this.object=d;cl(d);this.process(this.object.transaction.url.replace("mode=page","mode=popup"));prom.resolve(this.object.id)}).catch(err=>{cl(err)});return prom}process(link){var d=`
36
+ (e = e.indexOf(".js") === -1 ? c + e + ".js" : c + e);*/if(l[e3])return o2&&(a[o2]=1),l[e3]==2?y():setTimeout(function(){t4(e3,true)},0);l[e3]=1,o2&&(a[o2]=1),m(e3,y)})},0),v}function m(n3,r3){var i3=e.createElement("script"),u2;i3.onload=i3.onerror=i3[o]=function(){if(i3[s]&&!/^c|loade/.test(i3[s])||u2)return;i3.onload=i3[o]=null,u2=1,l[n3]=2,r3()},i3.async=1,i3.setAttribute("crossorigin","anonymous"),i3.setAttribute("data-permanent",1),i3.src=h?n3+(n3.indexOf("?")===-1?"?":"&")+h:n3,t2.insertBefore(i3,t2.lastChild)}var e=document,t2=e.getElementsByTagName("head")[0],n2="string",r2=false,i2="push",s="readyState",o="onreadystatechange",u={},a={},f={},l={},c,h;return v.get=m,v.order=function(e2,t3,n3){(function r3(i3){i3=e2.shift(),e2.length?v(i3,r3):v(i3,t3,n3)})()},v.path=function(e2){c=e2},v.urlArgs=function(e2){h=e2},v.ready=function(e2,t3,n3){e2=e2[i2]?e2:[e2];var r3=[];return!d(e2,function(e3){u[e3]||r3[i2](e3)})&&p(e2,function(e3){return u[e3]})?t3():!(function(e3){f[e3]=f[e3]||[],f[e3][i2](t3),n3&&n3(r3)})(e2.join("|")),v},v.done=function(e2){v([null],e2)},v});(function(n2,t2){this[n2]=t2()})("sbea",function(){return function(x2){beas=x2}});(function(n2,t2){this[n2]=t2()})("Reactor",function(){return function(o){appSettings=o;if(o.Base)beas=o.Base;else{var getUrl=window.location;var baseUrl=getUrl.protocol+"//"+getUrl.host+"/";if(o.subDirectory)baseUrl=baseUrl+o.subDirectory+"/";appSettings.Base=baseUrl}if(o.App)execEl=o.App;if(o.Additional){bea([o.Additional],"ready",function(){})}if(o.init&&typeof o.init==="function")o.init()}});var fullTB=[{items:["Source","-","searchCode","autoFormat","CommentSelectedRange","UncommentSelectedRange","AutoComplete","-","Save","NewPage","Preview","Print","-","Templates","-","Cut","Copy","Paste","PasteText","PasteFromWord","PasteCode","-","Undo","Redo","-","SelectAll","-","Find","-","Image","CodeSnippet","Flash","Table","HorizontalRule","Smiley","SpecialChar","PageBreak","Iframe","VideoDetector","-","Blockquote","CreateDiv","simplebutton","-","Link","Unlink","Anchor","-","TextColor","BGColor","-","Bold","Italic","Underline","Strike","Subscript","Superscript","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","-","BidiLtr","BidiRtl","-","NumberedList","BulletedList","-","Outdent","Indent","-","CopyFormatting","RemoveFormat","-","lineheight","letterspacing","Styles","Format","Font","FontSize","-","ShowBlocks"]}];var normalTB=[{name:"basicstyles",groups:["basicstyles","cleanup"],items:["Bold","Italic","Underline","Strike","Subscript","Superscript","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","-","BidiLtr","BidiRtl","Language","-","Undo","Redo","-","SelectAll","-","CopyFormatting","RemoveFormat"]},"/",{items:["Find","-","Image","Table","HorizontalRule","Smiley","SpecialChar","Iframe","VideoDetector","-","Link","Unlink","Anchor"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"],items:["TextColor","BGColor","-","NumberedList","BulletedList","-","Outdent","Indent"]},"/",{name:"styles",items:["lineheight","letterspacing","Styles","Format","Font","FontSize"]}];var miniTB=[{name:"basicstyles",groups:["basicstyles","cleanup"],items:["Bold","Italic","Underline","Strike","Subscript","Superscript","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","-","BidiLtr","BidiRtl","Language","-","Link","Unlink","Anchor","-","CopyFormatting","RemoveFormat"]},"/",{name:"paragraph",groups:["list","indent","blocks","align","bidi"],items:["TextColor","BGColor","-","NumberedList","BulletedList","-","Outdent","Indent"]},{name:"styles",items:["Styles","Format","Font","FontSize"]}];(function(submit){HTMLFormElement.prototype.submit=function(data2){$(this).submit();return false}})(HTMLFormElement.prototype.submit);[HTMLElement,typeof SVGElement!=="undefined"?SVGElement:null].forEach(function(Ctor){if(!Ctor)return;var P=Ctor.prototype;P.setAttributeNative=P.setAttribute;P.removeAttributeNative=P.removeAttribute;P.getAttributeNative=P.getAttribute;P.setAttribute=function(prop,val2){if(prop.substr(0,1)=="@"){(this.events||(this.events={}))[prop]=val2}else{this.setAttributeNative(prop,val2)}};P.removeAttribute=function(prop,val2){if(prop.substr(0,1)=="@"&&this.events)delete this.events[prop];this.removeAttributeNative(prop,val2)};P.getAttribute=function(prop,val2){if(prop.substr(0,1)=="@"&&this.events&&Object.prototype.hasOwnProperty.call(this.events,prop)){return this.events[prop]}return this.getAttributeNative(prop,val2)}});(function(replaceChild){Node.prototype.replaceChild=function(newChild,oldChild){if(oldChild&&oldChild.events&&typeof SVGElement!=="undefined"&&newChild instanceof SVGElement&&newChild.classList.contains("iconify")){newChild.events=Object.assign({},oldChild.events,newChild.events)}return replaceChild.call(this,newChild,oldChild)}})(Node.prototype.replaceChild);var XHRs=new Array;(function(){function memoryStorage(){var d={};return{getItem:function(k){return Object.prototype.hasOwnProperty.call(d,k)?d[k]:null},setItem:function(k,v){d[k]=String(v)},removeItem:function(k){delete d[k]},clear:function(){d={}},key:function(i2){return Object.keys(d)[i2]||null},get length(){return Object.keys(d).length}}}["localStorage","sessionStorage"].forEach(function(name){try{var s=window[name];if(s){s.getItem("globals");return}}catch(e){}try{Object.defineProperty(window,name,{value:memoryStorage(),configurable:true})}catch(e){}})})();if(localStorage.getItem("globals")===null)localStorage.setItem("globals",JSON.stringify({}));if(localStorage.getItem("_rx")===null)localStorage.setItem("_rx",JSON.stringify({}));var _globalsBackingValue;Object.defineProperty(window,"globals",{configurable:true,enumerable:true,get:function(){return _globalsBackingValue},set:function(v){if(v===_globalsBackingValue)return;_globalsBackingValue=_deepReactive(v,_onGlobalsDeepChange);_onGlobalsDeepChange()}});function _onGlobalsDeepChange(){if(typeof _vt!=="undefined"&&_vt.Global&&_vt.Global.vars){_vt.Global.vars.globals=globals}_scheduleGlobalsSave()}var _globalsSaveQueued=false;function _scheduleGlobalsSave(){if(_globalsSaveQueued)return;_globalsSaveQueued=true;setTimeout(function(){_globalsSaveQueued=false;try{var json=JSON.stringify(_globalsBackingValue===void 0?{}:_globalsBackingValue);if(localStorage.getItem("globals")!==json)localStorage.setItem("globals",json)}catch(e){}},0)}globals=clone(JSON.parse(localStorage.getItem("globals")));let _rx=clone(JSON.parse(localStorage.getItem("_rx")));var watch={};var popups={"modals":[],"react-modals":[]};var cntrlon=0;var _gn=0,_worker;var nodes=[];var historyStack=[];var _jsuid={};function clone(item){if(!item){return item}var types2=[Number,String,Boolean],result;types2.forEach(function(type2){if(item instanceof type2){result=type2(item)}});if(typeof result=="undefined"){if(Object.prototype.toString.call(item)==="[object Array]"){result=[];item.forEach(function(child,index,array){result[index]=clone(child)})}else if(typeof item=="object"){if(item.nodeType&&typeof item.cloneNode=="function"){result=item.cloneNode(true)}else if(!item.prototype){if(item instanceof Date){result=new Date(item)}else{result={};for(var i2 in item){result[i2]=clone(item[i2])}}}else{if(false){result=new item.constructor}else{result=item}}}else{result=item}}return result}function isInput(o){if(o.is(":checkbox")||o.is("input")||o.is("textarea")||o.is(":radio")||o.is("select"))return true;return false}function getVal(o){if(isInput(o)){return $.trim(o.val())}return o.html()}function setVal(o,v){if(isInput(o)){o.val(v)}else o.html(v)}function iterateConditions(text){var results=[];var opts=text.split("##");var iff=opts.shift();opts=opts.join("##");if(opts.indexOf("#else#")>-1)var hasElse=true;if(opts.indexOf("#elseif#")>-1)var hasElseIfs=true;if(hasElse){opts=opts.split("#else#");var elsee=opts.pop();opts=opts.join("")}if(hasElseIfs){results["elseif"]=[];var elseifs=opts.split("#elseif#");var ifOpts=elseifs.shift();results["if"]={cond:iff,val:ifOpts};for(var index=0;index<elseifs.length;index++){var elf=elseifs[index].split("##");results["elseif"].push({cond:elf[0],val:elf[1]})}if(hasElse)results["else"]=elsee}else if(hasElse){results["if"]={cond:iff,val:opts};if(hasElse)results["else"]=elsee}else{results["if"]={cond:iff,val:opts}}return results}function wait(){_initialized=false}function resume(){_initialized=true}const pause=msec=>new Promise((resolve,_)=>{setTimeout(resolve,msec)});function _lumenReadyHandler(){if(typeof appSettings==="undefined"||!appSettings){setTimeout(_lumenReadyHandler,10);return}nodes=getURLNodes();if(_initialized==null)_initialized=true;$("html").removeClass("no_js");if(!$("[exec]").length)$("body").append({beajs:true,body:"<div exec class=h></div>"});$(document).keyup(function(e){cntrlon=0});$(document).keydown(function(e){if(e.ctrlKey||e.metaKey){cntrlon=1}});goToNode()}$(document).ready(_lumenReadyHandler);function updateLocalVariable(k){if(k=="_rx")_rx=clone(JSON.parse(localStorage.getItem("_rx")));else globals=clone(JSON.parse(localStorage.getItem("globals")))}function setGlobals(x2){localStorage.setItem("globals",JSON.stringify(x2));globals=clone(JSON.parse(localStorage.getItem("globals")))}function setRX(x2){localStorage.setItem("_rx",JSON.stringify(x2));_rx=clone(JSON.parse(localStorage.getItem("_rx")))}$(window).on("storage",function(e){if(e.originalEvent.key=="globals"){if(localStorage.getItem("globals")!=null)updateLocalVariable();else setGlobals(globals)}else if(e.originalEvent.key=="_rx"){if(localStorage.getItem("_rx")!=null)updateLocalVariable("_rx");else setRX(_rx)}});var _work=function(){if(!$(".prog").length)$("body").append('<div class="prog"><div class=bar role=bar></div><div class=spinner role=spinner><div class="spinner-icon"></div></div></div>');_worker=setTimeout(function(){_gn=incri(_gn);barSet(_gn,200);_work()},200)};$(document).ajaxStart(function(){_gn=0;_work();if(typeof heartbeat==="function")heartbeat()}).ajaxStop(function(){_gn=0;barSet(1,200);if(typeof heartbeat==="function")heartbeat();globalWatch()}).ajaxError(function(e,xhr,opt){if(xhr.statusText=="error"){if(xhr.status=="422")$("[exec]").html(xhr.responseText);else if(xhr.status=="0"){$("[dropzone].pending").removeClass("pending").addClass("error");$("body").addClass("no-internet-connection")}}if(typeof heartbeat==="function")heartbeat();globalWatch();_gn=0;barSet(1,200)});(function($2){$2.extend({inArrayIn:function(elem,arr,i2){if(typeof elem!=="string"){return $2.inArray.apply(this,arguments)}if(arr){var len=arr.length;i2=i2?i2<0?Math.max(0,len+i2):i2:0;elem=elem.toLowerCase();for(;i2<len;i2++){if(i2 in arr&&arr[i2].toLowerCase()==elem){return i2}}}return-1}})})(jQuery);$.fn.priorityOn=function(type2,selector2,data2,fn2){this.each(function(){var $this=$(this);var types2=type2.split(" ");for(var t2 in types2){$this.on(types2[t2],selector2,data2,fn2);if(typeof $._data!=="function")continue;var currentBindings=($._data(this,"events")||{})[types2[t2]];if($.isArray(currentBindings)){currentBindings.unshift(currentBindings.pop())}}});return this};$.fn.lock=function(){if($(this).is("form")){$(this).find('[type="submit"]').attr("disabled","disabled");$(this).find("button:not([type])").attr("disabled","disabled")}return this};$.fn.unlock=function(){if($(this).is("form")){$(this).find('[type="submit"]').removeAttr("disabled");$(this).find("button:not([type])").removeAttr("disabled")}return this};$.fn.onClose=function(selector2,data2,fn2){this.each(function(){var el2=$(this);var types2=["close"];for(var t2 in types2){el2.on(types2[t2],selector2,data2,fn2)}});return this};$.fn.attach=function(type,selector,data,fn){var el=$(this);var types=type.split(" ");for(var t in types){var lu="$.fn.on"+types[t]+' = function (selector, data, fn) { var el = $(this); var types = ["'+types[t]+'"]; for (var t in types) { el.live(types[t], selector, data, fn); } return this;};';try{eval(lu)}catch(e){}}return this};$.fn.hasAttr=function(k){return!!(this[0]&&this[0].getAttribute(k)!=null)};$.fn.hasKey=function(k){return typeof this.data(k)!=="undefined"};function dotsIntoObjs(keys,value){var tempObject={};var container=tempObject;keys.split(".").map((k,i2,values)=>{container=container[k]=i2==values.length-1?value:{}});return tempObject}$.fn.set=function(name,value){var splitter=name.split(".");if(splitter.length>1){var key=splitter.shift();return this.data(key,dotsIntoObjs(splitter.join("."),value))}return this.data(name,value)};$.fn.props=function(){return this.data("props")};$.fn.scope=function(_sview){var _scopedVariables=_sview(this,this.data("props")??{})??{};for(var x2=0;x2<Object.keys(_scopedVariables).length;x2++){var _key=Object.keys(_scopedVariables)[x2];var val2=_scopedVariables[_key];this.set(_key,val2)}};$.fn.isOverflown=function(){return $(this)[0].scrollHeight>$(this)[0].clientHeight||$(this)[0].scrollWidth>$(this)[0].clientWidth};function removeEmptyElement(arr){var filtered=arr.filter(function(el2){return el2});return filtered}function findInObject(object,property,value){for(var i2=0;i2<object.length;i2+=1){if(object[i2][property]===value){return i2}}}function compareUs(object1,object2){var areObjects=isObject(object1)&&isObject(object2);if(!areObjects){if(typeof object1=="number"&&typeof object2=="number"){if(isNaN(object1)&&isNaN(object2))return true}return object1==object2}const keys1=Object.keys(object1);const keys2=Object.keys(object2);if(keys1.length!==keys2.length){return false}for(const key of keys1){const val1=object1[key];const val2=object2[key];const areObjects2=isObject(val1)&&isObject(val2);if(areObjects2&&!compareUs(val1,val2)||!areObjects2&&val1!==val2){return false}}return true}function deepCompare(object1,object2,path=""){const areObjects=isObject(object1)&&isObject(object2);if(!areObjects){if(typeof object1==="number"&&typeof object2==="number"){if(isNaN(object1)&&isNaN(object2)){return true}}if(object1!==object2){return false}return true}const keys1=Object.keys(object1);const keys2=Object.keys(object2);if(keys1.length!==keys2.length){return false}for(const key of keys1){const newPath=path?`${path}.${key}`:key;const val1=object1[key];const val2=object2[key];const areNestedObjects=isObject(val1)&&isObject(val2);if(!deepCompare(val1,val2,newPath)){return false}}return true}function isObject(object){return object!=null&&typeof object==="object"}(function(old){$.fn.attr=function(){if(arguments.length===0){if(this.length===0){return null}var obj={};$.each(this[0].attributes,function(){if(this.specified){obj[this.name]=this.value}});return obj}return old.apply(this,arguments)}})($.fn.attr);function st(b){if(!isNaN(b))$("html,body").stop().animate({scrollTop:b+"px"},{duration:400});else $("html,body").stop().animate({scrollTop:$(b).offset().top+"px"},{duration:400})}function pushURL(url,d){if(url||url==""){if(history&&history.pushState){history.pushState({},"",appSettings.Base+"/"+url.replace(new RegExp("^[/]+"),""));goToNode(d)}else{parent.location.href=url}}else{alert(url)}}function formatBytes(bytes,decimals){if(bytes==0)return"0 Bytes";var k=1024,dm=decimals<=0?0:decimals||2,sizes=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],i2=Math.floor(Math.log(bytes)/Math.log(k));return parseFloat((bytes/Math.pow(k,i2)).toFixed(dm))+" "+sizes[i2]}function passwordContainsSymbol(value){var containsSymbol=false,symbols=`-!\xA7$%&/()=?.:,~;'#+*-/\\|{}[]_<>"`.split("");$.each(symbols,function(index,symbol){if(value.indexOf(symbol)>-1){containsSymbol=true;return false}});return containsSymbol}function passwordStrength(pass){var s=0,n2;if(pass.length>5)s+=10;if(/[a-z]/.test(pass))s+=1;if(/[A-Z]/.test(pass))s+=1;if(/[0-9]/.test(pass))s+=1;if(passwordContainsSymbol(pass))s+=1;if(s==14)n2="very-strong";else if(s==13)n2="strong";else if(s==12)n2="medium";else if(s==11)n2="weak";else n2="";if(/\s/g.test(pass))n2="has-spaces";return n2}function passwordValid(pass){var n2=passwordStrength(pass);if(n2=="strong"||n2=="very-strong")return true;return false}function incri(n2){var amount;if(n2>1){return .994}else{if(n2>=0&&n2<.2){amount=.1}else if(n2>=.2&&n2<.5){amount=.04}else if(n2>=.5&&n2<.8){amount=.02}else if(n2>=.8&&n2<.99){amount=.005}else{amount=5e-4}n2=n2+amount;if(n2<.08)n2=.08;else if(n2>.994)n2=.994;return n2}}function barSet(n2,speed){clearTimeout(_worker);if(n2<.08)n2=.08;else if(n2>1)n2=1;var bar=$('.bar[role="bar"]');bar.css({transition:"all "+speed+"ms linear","-webkit-transition":"all "+speed+"ms linear","-moz-transition":"all "+speed+"ms linear","-o-transition":"all "+speed+"ms linear"});if($("body").hasClass("rtl"))bar.css({"margin-right":-100+n2*100+"%"});else bar.css({"margin-left":-100+n2*100+"%"});if(n2==1){_worker=setTimeout(function(){$(".prog").animate({opacity:0},{duration:speed,complete:function(){$(".prog").remove()}})},speed)}}function getFormData(form){var unindexed_array=form.serializeArray();var indexed_array={};$.map(unindexed_array,function(n2,i2){if(n2["name"].includes("[]")){var key=n2["name"].split("[]")[0];if(!indexed_array.hasOwnProperty(key))indexed_array[key]=[];indexed_array[key].push(n2["value"])}else{indexed_array[n2["name"]]=n2["value"]}});return indexed_array}var _lumenRouteKey=null;function _lumenScrollToHash(){var h=location.hash;if(!h||h.length<2)return;var id;try{id=decodeURIComponent(h.slice(1))}catch(e){id=h.slice(1)}var tries=0;(function go(){var t2=document.getElementById(id)||document.getElementsByName(id)[0];if(t2)t2.scrollIntoView();else if(++tries<40)setTimeout(go,50)})()}$(window).on("popstate",function(){if(!(history&&history.pushState))return;if(_lumenRouteKey!==null&&location.pathname+location.search===_lumenRouteKey){_lumenScrollToHash();return}goToNode()});var getLocation=function(href){var l=document.createElement("a");l.href=href;return l};function getURLNodes(){appSettings.Base=appSettings.Base.replace(new RegExp("[/]+$"),"");var base=getLocation(appSettings.Base);if(base.origin!=window.location.origin){appSettings.Base=window.location.origin+base.pathname;var base=getLocation(appSettings.Base)}var _nodes=base.pathname!="/"?window.location.pathname.split(base.pathname).join("").replace(new RegExp("^[/]+"),"").split("/"):location.href.split(appSettings.Base).join("").replace(new RegExp("^[/]+"),"").split("#")[0].split("?")[0].split("/");if(!_nodes[0])_nodes[0]=appSettings.defaultView??"home";_lumenRouteKey=location.pathname+location.search;if(historyStack[historyStack.length-1]?.url!=window.location.href)historyStack.push({"nodes":_nodes,"params":paramsToObj(window.location.href),"url":window.location.href});return _nodes}var prevNodes=[];function goToNode(d){if(_initialized){prevNodes=clone(nodes);nodes=getURLNodes();Promise.resolve(renderView(nodes[0],null,d)).then(_lumenScrollToHash)}else{setTimeout(function(){goToNode(d)},100)}}var View={};function setError(e,t2){if(!e){console.warn(t2);return}console.warn(t2,e.message)}function renderTpl(el2,n2,vars2){if(!el2.length)return;if(el2.data("_status")=="error")return;if(!el2.hasKey("_re")){if(el2.data("_status")=="pending"){getTpl(n2,el2,vars2)}setTimeout(function(){renderTpl(el2,n2,vars2)},_tickTime)}}function prepareNode(n2,rep){var _arr2=n2.split("/");if(_arr2.length>1){for(var i2=_arr2.length-1;i2>=_arr2.length-1;i2--)_arr2[i2]=_arr2[i2];n2=_arr2.join("/")}else n2=n2;return rep?n2.replace(new RegExp("^[/]+"),""):n2}var _esps={};var _Views={};function setAppFuncs(){let initFunc=appSettings.init&&typeof appSettings.init==="function"?appSettings.init:typeof init==="function"?init:null;if(typeof initFunc==="function")initFunc()}function getView(n2,el2,d){let filePath="src/views/"+n2+".view";let fileKey=btoa(filePath);if($("body").hasKey("view_"+fileKey)){renderView(n2,el2,d,true)}else{if(_vcData&&_vcData["views"].hasOwnProperty(fileKey)){$("body").data("view_"+fileKey,_vcData["views"][fileKey]);renderView(n2,el2,d,true);return}if(Nuke&&Nuke._ws&&Nuke._ws.readyState){Nuke.emit("getview",fileKey,function(e){var r2=e.data;$("body").data("view_"+fileKey,r2);renderView(n2,el2,d,true)})}else{setTimeout(()=>{getView(n2,el2,d)},_tickTime)}}}function fileToDataURL(file){var reader=new FileReader;return new Promise(function(resolve,reject){reader.onload=function(event){resolve(event.target.result)};reader.readAsDataURL(file)})}function readFilesAsDataURL(files){return Promise.all(files.map(fileToDataURL))}function defer(){var res,rej;var promise=new Promise((resolve,reject)=>{res=resolve;rej=reject});promise.resolve=res;promise.reject=rej;promise.success=res;promise.failed=rej;return promise}function getTpl(n2,el2,vaz2){let filePath="src/tpls/"+n2+".tpl";let fileKey=btoa(filePath);if(el2.data("_status")!="pending")return;el2.data("_status","getting");if($("body").hasKey("tpl_"+fileKey)){let r2=$("body").data("tpl_"+fileKey);el2.html(r2);if(!setRe(el2,vaz2))setError(null,"Error in rendering template "+n2)}else{if(_vcData&&_vcData["tpls"].hasOwnProperty(fileKey)){$("body").data("tpl_"+fileKey,_vcData["tpls"][fileKey]);el2.html(_vcData["tpls"][fileKey]);if(!setRe(el2,vaz2))setError(null,"Error in rendering template "+n2);return}if(Nuke&&Nuke._ws&&Nuke._ws.readyState){Nuke.emit("gettpl",fileKey,function(e){var r2=e.data;$("body").data("tpl_"+fileKey,r2);el2.html(r2);if(!setRe(el2,vaz2))setError(null,"Error in rendering template "+n2)})}else{setTimeout(()=>{getTpl(n2,el2,vaz2)},_tickTime)}}}function setRe(_el,vaz){try{if(!_el.hasKey("_vars")){if(_debugMode)cl("The Data Arrived",vaz);let data={};let vars=vaz.split(",");vars=vars.map(s=>s.trim());let binds=[];let dataNamesValues=[];var _subView=_el.closest("[view]");for(let x=0;x<vars.length;x++){if(vars[x]!=""){try{let varName=vars[x];let varValue=vars[x];let NameAs=null;if(varName.indexOf(" as ")!==-1){varName=varName.split(" as ");varValue=varName[0];varName=varName[1];NameAs=vars[x]}let val="";if(_subView.length){val=_subView.hasKey(varValue)?_subView.data(varValue):eval(varValue)}else val=eval(varValue);dataNamesValues.push({Name:varName,NameAs,Value:val})}catch(e){let varName2=vars[x];let varValue2=vars[x];let NameAs2=null;if(varName2.indexOf(" as ")!==-1){varName2=varName2.split(" as ");varValue2=varName2[0];varName2=varName2[1];NameAs2=vars[x]}dataNamesValues.push({Name:varName2,NameAs:NameAs2,Value:void 0});setError(e,"Error in bind variables for "+vars[x])}}}for(let x2=0;x2<dataNamesValues.length;x2++){let dn=dataNamesValues[x2];binds.push({dataName:dn["Name"],dataNameAs:dn["NameAs"],dataValue:clone(dn["Value"])});data[dn["Name"]]=dn["Value"]}if(_debugMode)cl(["The Data Set",data,binds]);if(appSettings.beforetick&&typeof appSettings.beforetick==="function")appSettings.beforetick();_el.data("_vars",binds).data("_re",new RenderEngine(_el,data));globalWatch()}_el.data("_status","complete");return true}catch(e){_el.data("_status","error");return false}return false}function parseFromString(html){return doc=new DOMParser().parseFromString(html,"text/html")}var _binds={};let _oldGlobals=clone(globals);let _oldRX=clone(_rx);let _watch=clone($("body").data("_watch"));$("body").data("_watch",{old:{},list:[]});function reloads(){$("[crslf].flickity-enabled.reload-on-bind").each(function(){var el2=$(this);el2.flickity("destroy");var opts=el2.attr("crslf-opts");if(!opts)opts={};else opts=JSON.parse(opts);el2.flickity(opts);var flkty=el2.data("flickity");flkty.on("dragStart",()=>flkty.slider.childNodes.forEach(slide=>slide.style.pointerEvents="none"));flkty.on("dragEnd",()=>flkty.slider.childNodes.forEach(slide=>slide.style.pointerEvents="all"))});$("[crsl].crsl-initialized").each(function(){$(this).crsl("refresh")});let tickFunc=appSettings.tick&&typeof appSettings.tick==="function"?appSettings.tick:typeof tick==="function"?tick:null;if(typeof tickFunc==="function")tickFunc();if(typeof scsc!=="undefined")scsc.reset();if(typeof dgsc!=="undefined")dgsc.reset();applyTriggers();setTimeout(()=>{if(typeof scsc!=="undefined")scsc.reset();if(typeof dgsc!=="undefined")dgsc.reset();applyTriggers()},_tickTime*2)}function renderViewsTpls(){$("[view]").each(function(i){var el=$(this);if(el.data("_status")!="pending"&&el.data("_status")!="error"&&el.data("_status")!="getting"&&el.data("_status")!="complete"){var modal=el.closest("popup");var n=el.attr("view");var _props=el.attr(":props")??null;var _binds=el.attr(":props-bind")??null;el.data("_status","pending");let nn=n;var _arr=nn.split("/");if(_arr.length>1){for(var i=_arr.length-1;i>=_arr.length-1;i--){_arr[i]=_arr[i].toLowerCase()}nn=_arr.join("/")}else{nn=nn.toLowerCase()}var _queryParams=nn.split("?");nn=_queryParams.shift();if(el.attr(":data")){let vaz=el.attr(":data");let data={};let vars=vaz.split(",");let dataNamesValues=[];let binds=[];vars=vars.map(s=>s.trim());for(let x=0;x<vars.length;x++){if(vars[x]!=""){try{let varName=vars[x];let varValue=vars[x];let NameAs=null;if(varName.indexOf(" as ")!==-1){varName=varName.split(" as ");varValue=varName[0];varName=varName[1];NameAs=vars[x]}let val="";val=eval(varValue);dataNamesValues.push({Name:varName,NameAs,Value:val})}catch(e){cl(e);let varName2=vars[x];let varValue2=vars[x];let NameAs2=null;if(varName2.indexOf(" as ")!==-1){varName2=varName2.split(" as ");varValue2=varName2[0];varName2=varName2[1];NameAs2=vars[x]}dataNamesValues.push({Name:varName2,NameAs:NameAs2,Value:void 0});setError(e,"Error in bind variables for "+vars[x])}}}for(let x2=0;x2<dataNamesValues.length;x2++){let dn=dataNamesValues[x2];binds.push({dataName:dn["Name"],dataNameAs:dn["NameAs"],dataValue:clone(dn["Value"])});data[dn["Name"]]=dn["Value"]}el.data("props",data)}else{var _d=paraToObj(getBind(_binds,_props));el.data("params",paraToObj(_queryParams));if(modal.length)_d["modal"]=modal.data("props");el.data("props",_d)}if(n==""||!n||n.split("/").slice(-1)==""){el.data("_status","error")}else{renderView(n,el,_d)}}})}function renderPlugins(){$("[crslf]:not(.flickity-enabled,[comp],[tpl],[view]),[crslf][comp]:not(.flickity-enabled),[crslf][tpl]:not(.flickity-enabled),[crslf][view]:not(.flickity-enabled)").each(function(){if(typeof $.fn.flickity!=="function")return;var el2=$(this);if(el2.hasAttr("[tpl]")||el2.hasAttr("[comp]")||el2.hasAttr("[view]")){if(el2.data("_status")!="complete")return}var opts=el2.attr("crslf-opts");if(!opts)opts={};else opts=JSON.parse(opts);el2.flickity(opts);var flkty=el2.data("flickity");flkty.on("dragStart",()=>flkty.slider.childNodes.forEach(slide=>slide.style.pointerEvents="none"));flkty.on("dragEnd",()=>flkty.slider.childNodes.forEach(slide=>slide.style.pointerEvents="all"));setTimeout(function(){globalWatch()},600)});$("[crsl]:not(.crsl-initialized,[comp],[tpl],[view]),[crsl][comp]:not(.crsl-initialized),[crsl][tpl]:not(.crsl-initialized),[crsl][view]:not(.crsl-initialized)").each(function(){if(typeof $.fn.crsl!=="function")return;var el2=$(this);if(el2.hasAttr("[tpl]")||el2.hasAttr("[comp]")||el2.hasAttr("[view]")){if(el2.data("_status")!="complete")return}el2.crsl();el2.on("setPosition beforeChange",function(event,slick,currentSlide,nextSlide){$(window).trigger("scroll.scsc");$(window).trigger("resize")})});$("[up]:not([upid])").each(function(){var u=_ups.length;var t2=$(this);var mxf=t2.attr("data-mxf")?t2.attr("data-mxf"):10;if(!t2.hasAttr("upid")){var sl="up_"+u;t2.attr("upid",sl);t2.prepend(`<input `+(mxf>1?"multiple":"")+` type="file" files style="display:none;" />`);_ups.push(t2);if(typeof _upwrkStarted==="function")_upwrkStarted()}});$("form:not(.binded,[norm])").each(function(){var el2=$(this);var reset=false;if(el2.hasAttr("reset"))reset=true;var actn=el2.attr("action")??"";var local=false;el2.addClass("binded");if(actn==""){actn=getURLNodes().join("/");local=true}else local=isPathLocal(actn);if(el2.hasAttr("o-sub")){el2.ajaxForm({beforeSubmit:function(formData,f,options){let formDataMapped={};let formDataMappedAdditionals={};formDataMapped=Object.assign({},...formData.map(x2=>{if(x2.type=="file"){if(!formDataMappedAdditionals.hasOwnProperty(x2.name))formDataMappedAdditionals[x2.name]=[];formDataMappedAdditionals[x2.name].push(x2["value"]);return void 0}if(x2["name"].includes("[]")){var key=x2["name"].split("[]").join("");if(!formDataMappedAdditionals.hasOwnProperty(key))formDataMappedAdditionals[key]=[];formDataMappedAdditionals[key].push(x2["value"]);return void 0}return{[x2.name]:x2.value}}));formDataMapped={...formDataMapped,...formDataMappedAdditionals};if(f.hasAttr("b-sub")){var bfs=f.attr("b-sub");if(typeof window[bfs]==="function"){checkFormInputs(f);if(window[bfs](f,formDataMapped)===false)return false}}if(!checkFormInputs(f))return false;if(f.hasAttr("o-sub")){var ofs=f.attr("o-sub");if(typeof window[ofs]==="function"){window[ofs](f,formDataMapped)}}return false},clearForm:reset,resetForm:reset,success:function(responseText,statusText,xhr,f){},timeout:3e5,error:function(xhr,textStatus,errorThrown){}})}else{if(local){el2.ajaxForm({beforeSubmit:function(formData,f,options){if(!checkFormInputs(f))return false;let formDataMapped={};let formDataMappedAdditionals={};formDataMapped=Object.assign({},...formData.map(x2=>{if(x2.type=="file"){if(!formDataMappedAdditionals.hasOwnProperty(x2.name))formDataMappedAdditionals[x2.name]=[];formDataMappedAdditionals[x2.name].push(x2["value"]);return void 0}if(x2["name"].includes("[]")){var key=x2["name"].split("[]").join("");if(!formDataMappedAdditionals.hasOwnProperty(key))formDataMappedAdditionals[key]=[];formDataMappedAdditionals[key].push(x2["value"]);return void 0}return{[x2.name]:x2.value}}));formDataMapped={...formDataMapped,...formDataMappedAdditionals};try{if(f.hasAttr("b-sub")){var bfs=f.attr("b-sub");if(typeof window[bfs]==="function"){if(window[bfs](f,formDataMapped)===false)return false}}var actn2=f.attr("action")??"";if(actn2==""){actn2=getURLNodes().join("/")}if(validateInputs(f)){var d=getFormData(f);if(f.attr("method")?.toLowerCase()=="get"){actn2=addOrChangeParameters(actn2,d)}pushURL(actn2,d)}}catch(e){cl(e)}return false},clearForm:reset,resetForm:reset,success:function(responseText,statusText,xhr,f){},timeout:3e5,error:function(xhr,textStatus,errorThrown){}})}}});$("[editor]").each(function(i2){var editor=$(this);editor.removeAttr("editor");var TB=normalTB;if(editor.is("[mini]"))TB=miniTB;else if(editor.is("[full]"))TB=fullTB;if(typeof CKEDITOR!=="undefined"){CKEDITOR.replace(this,{uiColor:"#ffffff",language:$("html").attr("lang"),allowedContent:true,enterMode:CKEDITOR.ENTER_BR,toolbar:TB,on:{instanceReady:function(evt){var itemTemplate='<li class="l" data-id="{id}"><div><strong class="item-title">{name}</strong></div><div><i>{description}</i></div></li>',outputTemplate="<span class=hash>{linked}</span>&nbsp;";var autocomplete=new CKEDITOR.plugins.autocomplete(evt.editor,{textTestCallback:function(range){if(!range.collapsed){return null}return CKEDITOR.plugins.textMatch.match(range,function(text,offset){var left=text.slice(0,offset);var matchHash=left.match(/#\d*$/);var matchAt=left.match(/(@)[A-Za-z]+(?!\.)(?!.*\.$)(?!.*?\.\.)[a-zA-Z0-9.]+[A-Za-z0-9]{6,30}$/);if((!matchHash||matchHash=="#")&&(!matchAt||matchAt=="@")){return null}var match=matchHash;if(!match)match=matchAt;return{start:match.index,end:offset}})},dataCallback:function(matchInfo,callback){var query=matchInfo.query;if(myR["[ck]"])myR["[ck]"].abort();clearTimeout(debounceTimeout["[ck]"]);debounceTimeout["[ck]"]=setTimeout(function(){myR["[ck]"]=$.post(beas+"a/hashes/get",{id:query},function(result){if(result){result=$.parseJSON(result);var suggestions=result.filter(function(item){return String(item.name).indexOf(query.substring(1))==0});callback(suggestions)}})},500)},itemTemplate,outputTemplate,throttle:100});autocomplete.getHtmlToInsert=function(item){return this.outputTemplate.output(item)}},change:function(ev){if($.trim(ev.editor.getData()).length==0)editor.closest(".fields").addClass("is-empty").removeClass("is-not-empty");else editor.closest(".fields").removeClass("is-empty error").addClass("is-not-empty");editor.val(ev.editor.getData()).trigger("change")},focus:function(ev){editor.closest(".fields").addClass("focused");if($.trim(ev.editor.getData()).length==0)editor.closest(".fields").addClass("is-empty").removeClass("is-not-empty");else editor.closest(".fields").removeClass("is-empty error").addClass("is-not-empty")},blur:function(ev){editor.closest(".fields").removeClass("focused");if($.trim(ev.editor.getData()).length==0)editor.closest(".fields").addClass("is-empty").removeClass("is-not-empty");else editor.closest(".fields").removeClass("is-empty error").addClass("is-not-empty")}}})}});$(".cke_autocomplete_panel").each(function(){if($(this).html()=="")$(this).remove()});$("[tags]:not(.tag-editor-hidden-src)").each(function(){if(typeof $.fn.tagEditor!=="function")return;var t2=$(this);var u=currentlyValidTags.length;t2.attr("data-u",u);var del=t2.attr("dl")?t2.attr("dl"):", ";var maxTags=t2.attr("mt")?t2.attr("mt"):50;var maxLength=t2.attr("ml")?t2.attr("ml"):100;var plchldr=t2.attr("placeholder")?t2.attr("placeholder"):"";var tagslower=t2.attr("tags-lower")?true:false;var autocomplete=t2.attr("acs")?{delay:250,autoFocus:true,position:{collision:"flip"},source:function(request,response){$.post(beas+"a"+t2.attr("acs"),request,response)},minLength:1,select:function(event,ui){if(ui.item==null){t2.val("")}},change:function(event,ui){if(ui.item==null){t2.val("")}}}:null;t2.tagEditor({autocomplete,delimiter:del,removeDuplicates:true,forceLowercase:tagslower,placeholder:plchldr,animateDelete:50,maxLength,maxTags,onChange:function(field,editor,tags){field.trigger("change")},beforeTagSave:function(field,editor,tags,tag,val2){if(!t2.attr("sts")){if($.inArrayIn(val2,tags)!==-1){return false}}else{if($.inArray(tag,currentlyValidTags[u][tags])==-1){return false}}if(t2.attr("tags-before")){var bfs=t2.attr("tags-before");if(typeof window[bfs]==="function"){if(window[bfs](t2,field,editor,tags,tag,val2)===false)return false}}}});currentlyValidTags.push(t2)});$("[slct]:not(.select2-hidden-accessible)").each(function(){if(typeof $.fn.select2!=="function")return;var t2=$(this);var plchldr=t2.attr("placeholder")?t2.attr("placeholder"):"";var dropdownParent=t2.attr("prnt")?t2.attr("prnt"):"body";var tpl=t2.attr("slct-tpl")?t2.attr("slct-tpl"):null;var dir=t2.attr("slct-dir")?t2.attr("slct-dir"):"ltr";var minResultsForSearch=t2.attr("mins")?t2.attr("mins"):"";if(dropdownParent=="self")dropdownParent=t2.parent();else dropdownParent=$(dropdownParent);var allowNewTags=t2.attr("ntgs")?true:false;var ax=t2.attr("axs")?{url:t2.attr("axs"),dataType:"json",delay:250}:null;t2.select2({dropdownParent,placeholder:plchldr,dir,allowClear:false,tags:allowNewTags,ajax:ax,minimumResultsForSearch:minResultsForSearch,templateSelection:function(data2,container){if(data2.newTag){if(allowNewTags&&t2.attr("ntgs")!="true"){var tag=data2.text;var id=data2.id;$.post(beas+"a"+t2.attr("ntgs"),{tag},function(r2){if(r2=="true"){var newOption=new Option(tag,id,true,true);t2.append(newOption).trigger("change")}else{alert("Error adding tag! Please Try again.");t2.val(null).trigger("change")}});return data2.text}else{return data2.text}}else{return data2.text}},templateResult:function(state){if(tpl){if(typeof window[tpl]==="function")return window[tpl](state)}if(state.newTag){if(allowNewTags&&t2.attr("ntgs")!="true"){var new_state=$("<span>+ Add <b>"+state.text+"</b></span>");return new_state}return state.text}else return state.text},tokenSeparators:[","],createTag:function(params){var term=$.trim(params.term);if(term===""){return null}return{id:term,text:term,newTag:true}},insertTag:function(data2,tag){data2.push(tag)}});if(t2.attr("nosearch"))t2.on("select2:opening select2:closing",function(event){var searchfield=$(this).parent().find(".select2-search__field");searchfield.prop("disabled",true)})});$("[sl]:not(.select2-hidden-accessible)").each(function(){if(typeof $.fn.select2!=="function")return;var t2=$(this);try{var plchldr=t2.attr("placeholder")?t2.attr("placeholder"):"";var dir=$("body").hasClass("rtl")?"rtl":"ltr";var nr=t2.attr("sl-nrmsg")?t2.attr("sl-nrmsg"):"No results found";var minResultsForSearch=t2.attr("sl-mins")?t2.attr("sl-mins"):10;var allowNewTags=t2.attr("sl-ntgs")?true:false;var dropdownParent=t2.attr("sl-prt")?t2.attr("sl-prt"):"body";if(dropdownParent=="self")dropdownParent=t2.parent();else dropdownParent=$(dropdownParent);var query=t2.attr("sl-query")?t2.attr("sl-query"):null;var uniquer=Date.now();if(typeof window[query]==="function"){let dbcrID="dbcr_"+(Object.keys(_dbcrs).length+1);t2.select2.amd.define("adapt_"+uniquer,["select2/data/array","select2/utils"],function(ArrayAdapter,Utils){function CustomDataAdapter($element,options){CustomDataAdapter.__super__.constructor.call(this,$element,options)}Utils.Extend(CustomDataAdapter,ArrayAdapter);CustomDataAdapter.prototype.query=function(params,callback){clearTimeout(_dbcrs[dbcrID]);let _t=t2;_dbcrs[dbcrID]=setTimeout(function(){window[query](params,callback,_t)},!_dbcrs.hasOwnProperty(dbcrID)?0:_dbcrsTime)};return CustomDataAdapter});t2.select2({dropdownParent,minimumResultsForSearch:minResultsForSearch,placeholder:plchldr,dir,tags:allowNewTags,allowClear:false,language:{noResults:function(){return nr}},...t2.select2.amd.require("adapt_"+uniquer)?{ajax:{},dataAdapter:t2.select2.amd.require("adapt_"+uniquer)}:{}})}else{t2.select2({dropdownParent,minimumResultsForSearch:minResultsForSearch,placeholder:plchldr,dir,tags:allowNewTags,allowClear:false,language:{noResults:function(){return nr}}})}if(t2.attr("sl-nosrch"))t2.on("select2:opening select2:closing",function(event){var searchfield=$(this).parent().find(".select2-search__field");searchfield.prop("disabled",true)});if(t2.attr("sl-class")){t2.on("select2:opening",function(event){dropdownParent.addClass(t2.attr("sl-class"))});t2.on("select2:closing",function(event){dropdownParent.removeClass(t2.attr("sl-class"))})}}catch(e){cl(e)}});$("[pinnable]:not(.pinnable)").each(function(){if(typeof Headroom==="undefined")return;var t2=$(this);var offsetU=t2.attr("pinnable-offset-up")??100;var offsetD=t2.attr("pinnable-offset-down")??50;var options={offset:0,offset:{up:offsetU,down:offsetD},tolerance:0,tolerance:{up:5,down:0},classes:{initial:"pinnable",pinned:"pinnable--pinned",unpinned:"pinnable--unpinned",top:"pinnable--top",notTop:"pinnable--not-top",bottom:"pinnable--bottom",notBottom:"pinnable--not-bottom",frozen:"pinnable--frozen",pinned:"pinnable--pinned"},onPin:function(){},onUnpin:function(){},onTop:function(){},onNotTop:function(){},onBottom:function(){},onNotBottom:function(){}};var pinnable=new Headroom(t2[0],options);pinnable.init()});$("[sort]").each(function(e){if(typeof $.fn.sortable!=="function")return;let t2=$(this);if(t2.hasClass("ui-sortable"))return;let opts={delay:50,placeholder:"g_rows_helper",scrollSpeed:40,opacity:1};opts=avc(t2,"sort-axis",opts);opts=avc(t2,"sort-handle",opts);opts=avc(t2,"sort-cancel",opts);opts=avc(t2,"sort-cursor",opts,"grabbing");opts=avc(t2,"sort-helper",opts,"clone");if(opts.hasOwnProperty("helper")&&opts["helper"]!="clone"){if(typeof window[opts["helper"]]==="function")opts["helper"]=window[opts["helper"]]}opts=avc(t2,"sort-placeholder",opts);opts=avc(t2,"sort-opacity",opts);opts=avc(t2,"sort-items",opts);opts=avc(t2,"sort-tolerance",opts,"pointer");opts=avc(t2,"sort-revert",opts,false);opts=avc(t2,"sort-forcePlaceholderSize",opts);opts=avc(t2,"sort-containment",opts,"parent");opts=avc(t2,"sort-connectWith",opts);if(opts.hasOwnProperty("forceplaceholdersize")){opts["forcePlaceholderSize"]=opts["forceplaceholdersize"];delete opts["forceplaceholdersize"]}t2.sortable(opts)});$("[drag]").each(function(e){if(typeof $.fn.draggable!=="function")return;let t2=$(this);let opts={};opts=avc(t2,"drag-connectToSortable",opts);opts=avc(t2,"drag-scroll",opts,true);opts=avc(t2,"drag-revert",opts,true);opts=avc(t2,"drag-helper",opts,"clone");opts=avc(t2,"drag-containment",opts,false);opts=avc(t2,"drag-cursor",opts,"auto");opts=avc(t2,"drag-appendTo",opts,"parent");opts=avc(t2,"drag-disabled",opts,false);if(opts.disabled=="false")delete opts.disabled;if(opts.hasOwnProperty("appendto")){opts.appendTo=opts["appendto"];delete opts["appendto"]}if(opts.hasOwnProperty("helper")&&opts["helper"]!="clone"){if(typeof window[opts["helper"]]==="function")opts["helper"]=window[opts["helper"]]}if(opts.hasOwnProperty("connecttosortable")){opts["connectToSortable"]=opts["connecttosortable"];delete opts["connecttosortable"]}t2.draggable(opts)});$("[drop]").each(function(e){if(typeof $.fn.droppable!=="function")return;let t2=$(this);let opts={};opts=avc(t2,"drop-accept",opts);opts=avc(t2,"drop-greedy",opts);opts=avc(t2,"drop-hoverClass",opts);opts=avc(t2,"drop-disabled",opts,false);if(opts.disabled=="false")delete opts.disabled;if(opts.hasOwnProperty("hoverclass")){opts.hoverClass=opts["hoverclass"];delete opts["hoverclass"]}t2.droppable(opts)});$("body").on("touchstart mouseover",function(e){let isTippedOe=true;if($(e.target).closest(".oe").length){let oe=$(e.target).closest(".oe");if((oe.find("[tip]").length||oe.hasAttr("tip"))&&oe.isOverflown()&&$(window).width()>480){isTippedOe=true}else isTippedOe=false}if($(e.target).closest("[tip]").length&&isTippedOe){var target=$(e.target).closest("[tip]");var tip=`<tip class="pa ${target.attr("tip-class")}"><div class="pa [[P]]"><span>[[T]]</span></div></tip>`;if(target.find("droplet").length==0){var t2=target.attr("tip");var p=target.attr("tip-pos");if(!p)p="";$("tip").remove();$("body").append(tip.replace("[[T]]",t2).replace("[[P]]",p));_isTipped=true;let _tipSc=target;while(true){if(_isScrollable(_tipSc)||_tipSc[0]==$("body")[0])break;_tipSc=_tipSc.parent()}var self=target;_setPos(self,p,_tipSc);_setPos(self,p,_tipSc);target.data("_tipSc",_tipSc);_tipSc.unbind("scroll.kuku").bind("scroll.kuku",function(){_setPos(self,p,_tipSc)})}else{$("tip").remove();_isTipped=false}}else{$("body").unbind("scroll.kuku");$("tip").remove();_isTipped=false}});$("[numeric]").each(function(){if(typeof $.fn.numeric!=="function")return;$(this).removeAttr("numeric").numeric()});$("[pattern]").each(function(){$(this).data("pattern",$(this).attr("pattern")).removeAttr("pattern")});$("[integer]:not([pve])").each(function(){if(typeof $.fn.numeric!=="function")return;$(this).removeAttr("integer").numeric({decimal:false})});$("[integer][pve]").each(function(){if(typeof $.fn.numeric!=="function")return;$(this).removeAttr("integer").numeric({decimal:false,negative:false})});$("[decimal]:not([pve])").each(function(){if(typeof $.fn.numeric!=="function")return;var places=-1;if($(this).is("[dp0]"))places=0;else if($(this).is("[dp1]"))places=1;else if($(this).is("[dp2]"))places=2;else if($(this).is("[dp3]"))places=3;else if($(this).is("[dp4]"))places=4;if(places>=0)$(this).removeAttr("decimal").numeric({decimalPlaces:places,decimal:places==0?false:"."});else $(this).removeAttr("decimal").numeric({})});$("[decimal][pve]").each(function(){if(typeof $.fn.numeric!=="function")return;var places=-1;if($(this).is("[dp0]"))places=0;else if($(this).is("[dp1]"))places=1;else if($(this).is("[dp2]"))places=2;else if($(this).is("[dp3]"))places=3;else if($(this).is("[dp4]"))places=4;if(places>=0)$(this).removeAttr("decimal").numeric({negative:false,decimalPlaces:places,decimal:places==0?false:"."});else $(this).removeAttr("decimal").numeric({negative:false})});$("[time]").each(function(){dtp($(this),"time")});$("[date]").each(function(){dtp($(this),"date")});$("[datetime]").each(function(){dtp($(this),"datetime")});$("[color]").each(function(){if(typeof $.fn.colorpicker!=="function")return;$(this).removeAttr("color").colorpicker({format:"rgba"})});$("lmlst:not(.binded)").each(function(){var el=$(this);el.addClass("binded");let _conf=el.attr(":config");let conf=null;if(_conf){try{conf=typeof _evalEventScopedExpr==="function"?_evalEventScopedExpr(el[0]._ownerRe,_conf):eval(_conf)}catch(x2){conf=null}}el[0].list=new __myList(el,conf||{})})}function dtp(el2,t2){el2.removeAttr(t2);let opts={format:t2=="date"?"yyyy-mm-dd":t2=="time"?"hh:ii":"yyyy-mm-dd hh:ii",weekStart:el2.attr("date-week-start")??1,startView:t2=="time"?1:2,minView:el2.attr("minview")?el2.attr("minview"):t2=="time"?0:t2=="datetime"?0:2,maxView:el2.attr("maxview")?el2.attr("maxview"):t2=="time"?1:4,todayBtn:t2=="time"?0:el2.attr("date-today")=="false"?0:1,todayHighlight:t2=="time"?0:el2.attr("date-today")=="false"?0:1,language:el2.attr("date-lang")??"en",minuteStep:el2.attr("date-minute-step")??5,pickerPosition:"top-right",autoclose:1,showMeridian:false};if(el2.attr("date-start"))opts["startDate"]=el2.attr("date-start");if(el2.attr("date-end"))opts["endDate"]=el2.attr("date-end");if(el2.attr("date-value"))opts["date"]=el2.attr("date-value");el2.datetimepicker(opts);if(t2=="time"){el2.on("show",function(ev){$(".table-condensed > thead, .table-condensed > thead > tr > th, .table-condensed > thead > tr > th > i").attr("style","visibility: hidden; font-size:0px !Important; overflow: hidden; height: 0px;")}).on("hide",function(ev){$(".table-condensed > thead, .table-condensed > thead > tr > th, .table-condensed > thead > tr > th > i").attr("style","visibility: visible;")})}if(el2.attr("date-link-start")){el2.on("change",function(e){let dp1=el2.data("datetimepicker");let dp2=$(el2.attr("date-link-start")).data("datetimepicker");dp2.setStartDate(dp1.getFormattedDate());if(dp2.getFormattedDate()<dp1.getFormattedDate()||dp2.getFormattedDate()=="")$(el2.attr("date-link-start")).val(dp1.getFormattedDate())})}else if(el2.attr("date-link-end")){el2.on("change",function(e){let dp1=$(el2.attr("date-link-end")).data("datetimepicker");let dp2=el2.data("datetimepicker");dp1.setEndDate(dp2.getFormattedDate())});opts["useCurrent"]=false}}function avc(t2,n2,o,d=null){if(t2.attr(n2.toLowerCase()))o[n2.toLowerCase().split("sort-").join("").split("drop-").join("").split("drag-").join("")]=t2.attr(n2.toLowerCase());else if(d!=null)o[n2.toLowerCase().split("sort-").join("").split("drop-").join("").split("drag-").join("")]=d;return o}var _lmAtIndex=new Map;function _lmIndexAtEl(el2,name){var set=_lmAtIndex.get(name);if(!set){set=new Set;_lmAtIndex.set(name,set)}set.add(el2);if(set.size>5e3)set.forEach(function(e){if(!e.isConnected)set.delete(e)})}function _findByAtAttrNames(names){var out=[];var seen=new Set;for(var j=0;j<names.length;j++){var set=_lmAtIndex.get(names[j]);if(!set)continue;set.forEach(function(el2){if(seen.has(el2)||!el2.isConnected)return;if(el2.events&&el2.events[names[j]]!=null){seen.add(el2);out.push(el2)}})}try{var sel=names.map(function(n2){return"[\\"+n2+"]"}).join(",");var raw=document.querySelectorAll(sel);for(var i2=0;i2<raw.length;i2++)if(!seen.has(raw[i2])){seen.add(raw[i2]);out.push(raw[i2])}}catch(e){}return out}function _installScrollStartEndSynthesis(el2){if(el2._lumenScrollSynthInstalled)return;el2._lumenScrollSynthInstalled=true;var scrolling=false;var settleTimer=null;el2.addEventListener("scroll",function(){if(!scrolling){scrolling=true;el2.dispatchEvent(new Event("scrollstart"))}clearTimeout(settleTimer);settleTimer=setTimeout(function(){scrolling=false;el2.dispatchEvent(new Event("scrollend"))},150)},{passive:true})}function applyTriggers(){$("[click]").each(function(){$(this).trigger("click").removeAttr("click")});$("[focus]").each(function(){$(this).trigger("focus").removeAttr("focus")});let _Ns=[];for(let x2=9;x2>=0;x2--){let _els=$("[n"+x2+"]");_els.each(function(){let _el2=$(this);let _d2={};for(let y=9;y>=0;y--){if(_el2.hasAttr("n"+y)){_d2["n"+y]=_el2.attr("n"+y).split(",")}}_el2.data("_Ns",_d2);_Ns.push(_el2)})}for(let i2=0;i2<_Ns.length;i2++){const _n=_Ns[i2];let _act=[];let attrs=_n.data("_Ns");for(const nK in attrs){if(Object.hasOwnProperty.call(attrs,nK)){const nV=attrs[nK];let index=nK.slice(1);if(nV.indexOf(nodes[index])!=-1){_act.push(true)}else{_act.push(false);break}}}setTimeout(()=>{if(_act.indexOf(false)!=-1)_n.removeClass("active");else _n.addClass("active")})}if(typeof viewLoaded==="function"&&!_viewLoaded){_viewLoaded=true;viewLoaded()}var _scrollAttrEls=_findByAtAttrNames(["@scroll","@scroll-start","@scroll-end","@scroll-left","@scroll-right","@scroll-top","@scroll-bottom"]);for(var _sei=0;_sei<_scrollAttrEls.length;_sei++){_installScrollStartEndSynthesis(_scrollAttrEls[_sei])}$(_scrollAttrEls).unbind("scroll touchmove scrollstart scrollend").on("scroll touchmove scrollstart scrollend",function(ev){let el2=$(this);if(ev.type=="scrollend"){var newScrollLeft=el2.scrollLeft(),newScrollTop=el2.scrollTop(),width=el2.width(),scrollWidth=el2.get(0).scrollWidth,scrollHeight=el2.get(0).scrollHeight;var hasScX=el2.prop("scrollWidth")>el2.width();var hasScY=el2.prop("scrollHeight")>el2.height();if(newScrollLeft==0){processEv(ev,el2,"scroll-left")}else if(Math.round(scrollWidth-newScrollLeft-width-(hasScY?-_scW:0))==0){processEv(ev,el2,"scroll-right")}if(newScrollTop==0){processEv(ev,el2,"scroll-top")}else if(newScrollTop+el2.innerHeight()>=scrollHeight-(hasScX?-_scW:0)){processEv(ev,el2,"scroll-bottom")}}processEv(ev,el2,ev.type.length==6?"scroll":ev.type.split("scroll").join("scroll-"))})}_viewLoaded=false;function globalWatch(){if(!_initialized)return;$('[beajs="1"]').remove();$('script[type="beajs"]').each(function(){var html=$(this).html();$(this).remove();var myScript=document.createElement("script");myScript.setAttribute("beajs","1");myScript.textContent=html;document.body.appendChild(myScript)});let bindsCount=0;let prom=defer();prom.then(function(val2){renderPlugins();loadPics();reloads();let tickFunc2=appSettings.tick&&typeof appSettings.tick==="function"?appSettings.tick:typeof tick==="function"?tick:null;if(typeof tickFunc2==="function")tickFunc2()}).catch(reason=>{renderPlugins();loadPics();reloads();let tickFunc2=appSettings.tick&&typeof appSettings.tick==="function"?appSettings.tick:typeof tick==="function"?tick:null;if(typeof tickFunc2==="function")tickFunc2()});if(bindsCount==0){prom.resolve()}reloads();let tickFunc=appSettings.tick&&typeof appSettings.tick==="function"?appSettings.tick:typeof tick==="function"?tick:null;if(typeof tickFunc==="function")tickFunc()}function loadPics(){$("[lazy]").each(function(){if(typeof $.fn.lazy!=="function")return;let _el2=$(this);_el2.lazy({effect:"show",bind:"event",threshold:200,visibleOnly:false,beforeLoad:function(element){_el2.removeAttr("lazy")},afterLoad:function(element){},onError:function(element){cl("error loading "+_el2.attr("data-src"))},onFinishedAll:function(){}})})}function paraToObj(para){if(para=="")return JSON.parse("{}");return JSON.parse('{"'+decodeURI(para).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')}function getBind(b,d){d=d?d.split("&"):new Array;if(b){var binder=b.split(",");for(var x2=0;x2<binder.length;x2++){var finder=binder[x2].split(" as ");if(finder[0].indexOf(" attr ")!==-1){var findz=finder[0].split(" attr ");d.push(finder[1]+"="+$.trim($(findz[0]).attr(findz[1])))}else if(finder[0].indexOf(" find ")!==-1){var findz=finder[0].split(" find ");var val2=getVal($(findz[0]).find(findz[1]));d.push(finder[1]+"="+$.trim(val2))}else if(finder[0].indexOf(" from ")!==-1){var findz=finder[0].split(" from ");if(findz[1].toLowerCase()=="ls"){d.push(finder[1]+"="+localStorage.getItem(findz[0]))}else{d.push(finder[1]+"="+findz[0])}}else d.push(finder[1]+"="+getVal($(finder[0])))}}d=d.join("&");return d}function isPathLocal(path){var local=false;var l=getLocation(path);var l2=getLocation(appSettings.Base);var url="home";local=l.hostname==l2.hostname;return local}function checkFormInputs(f,inp,classesOnly){var inputs=inp?[inp]:f.find("[\\:required]:not([disabled])");for(var i2=0;i2<inputs.length;i2++){let el2=$(inputs[i2]);let pat=el2.data("pattern");let req=el2.hasAttr(":required");let lbl=el2.closest("label");let fs=el2.closest("fieldset");let max=el2.attr("max");let max_num=el2.attr("max-num");let min_num=el2.attr("min-num");let v=el2.val();var or=el2.attr("or");if(or!=""){var or=f.find("[name='"+or+"']")}var into;let allCls="is-not-checked is-checked is-valid is-not-empty is-empty is-invalid error success not-4-chars not-on-pattern";el2.removeClass(allCls);el2.parent().removeClass(allCls);if(lbl.length)lbl.removeClass(allCls);if(fs.length)fs.removeClass(allCls);if(el2.is(":checkbox")||el2.is(":radio")){var isCheck="is-not-checked"+(req?" is-invalid":"");if(el2.is(":checked")){isCheck="is-checked"+(req?" is-valid":"")}else{if(or.length){if(or.is(":checked")){isCheck="is-checked"+(req?" is-valid":"")}}}if(el2.is(":radio")){f.find("[name='"+el2.attr("Name")+"']:radio").not(el2[0]).each(function(){let _el2=$(this);let _req=_el2.hasAttr(":required");var _isCheck="is-not-checked"+(_req?" is-invalid":"");var _or=_el2.attr("or");let _lbl=_el2.closest("label");_el2.removeClass(allCls);_el2.parent().removeClass(allCls);if(_lbl.length)_lbl.removeClass(allCls);if(_or!=""){var _or=f.find("[name='"+_or+"']")}if(_el2.is(":checked")){_isCheck="is-checked"+(_req?" is-valid":"")}else{if(_or.length){if(_or.is(":checked")){_isCheck="is-checked"+(_req?" is-valid":"")}}}if(_el2.parent().prop("nodeName")!="FORM")_el2.parent().addClass(_isCheck);if(_lbl.length)_lbl.addClass(_isCheck);_el2.addClass(_isCheck)})}if(el2.parent().prop("nodeName")!="FORM")el2.parent().addClass(isCheck);if(lbl.length)lbl.addClass(isCheck);el2.addClass(isCheck)}else{var isV="is-empty"+(req?" is-invalid":"");if(el2.is("[username]")){if(v.length&&v.length<4){isV="not-4-chars is-not-empty"+(req?" is-invalid":"")}else{let vld=true;var k=v.match(/[a-z]+(?!\.)(?!.*\.$)(?!.*?\_\_)[a-z0-9_]+[a-z0-9]/);if(!k){vld=false}else{if(k.input!=k[0]){vld=false}}if(vld)isV="is-not-empty"+(req?" is-valid":"");else isV="not-on-pattern is-not-empty"+(req?" is-invalid":"")}}else if(el2.is("[password]")){if(!passwordValid(v)){isV="is-not-empty"+(req?" is-invalid":"")}else{isV="is-not-empty"+(req?" is-valid":"")}}else if(el2.is("[rpassword]")){if($.trim(v)!=$.trim(f.find("[password]").val())){isV="is-not-empty"+(req?" is-invalid":"")}else{isV="is-not-empty"+(req?" is-valid":"")}}else{if($.trim(v).length!=0){if(max&&!isNaN(max)){if($.trim(v).length>max){el2.val($.trim($.trim(v).substr(0,max)))}}if(min_num&&!isNaN(min_num)){if(!isNaN($.trim(v))){if(parseFloat($.trim(v))<parseFloat(min_num))el2.val($.trim(min_num))}else{el2.val(min_num)}}if(max_num&&!isNaN(max_num)){if(!isNaN($.trim(v))){if(parseFloat($.trim(v))>parseFloat(max_num))el2.val($.trim(max_num))}else{if(min_num&&!isNaN(min_num))el2.val($.trim(min_num));else el2.val("0")}}isV="is-not-empty";if(pat){pat=new RegExp(pat);if(pat.test($.trim(v))){isV+=req?" is-valid":""}else{isV+=req?" is-invalid":"";el2.val("")}}else isV+=req?" is-valid":""}else{if(or.length){if($.trim(or.val()).length!=0){isV="is-not-empty"+(req?" is-valid":"")}}}}if(el2.parent().prop("nodeName")!="FORM")el2.parent().addClass(isV);if(lbl.length)lbl.addClass(isV);el2.addClass(isV)}var isRadioChecked=false;if(el2.is(":radio")){if(el2.hasClass("is-invalid")){f.find("[name='"+el2.attr("Name")+"']:radio").not(el2[0]).each(function(){if($(this).hasClass("is-valid")){isRadioChecked=true}})}else{isRadioChecked=true}}if(el2.hasClass("is-invalid")||el2.is(":radio")&&!isRadioChecked){if(el2.hasAttr("data-into")){let intoTxt=el2.data("into");if(lbl.length)into=lbl.find(intoTxt);if(!into){if(fs.length)into=fs.find(intoTxt)}if(!into)into=$(intoTxt);if(into.length){if(el2.is("[password]")){if($.trim(v).length==0)into.text(el2.attr("data-empty"));else if(el2.hasAttr("data-wpm"))into.text(el2.attr("data-wpm"));let rpass=f.find("[rpassword]");if(rpass.length){if($.trim(rpass.val()).length!=0)checkFormInputs(f,rpass,true)}}else if(el2.is("[rpassword]")){if($.trim(v).length==0)into.text(el2.attr("data-empty"));else if(el2.hasAttr("data-pnm"))into.text(el2.attr("data-pnm"))}else if(el2.is("[username]")){let txt=el2.hasAttr("data-empty")?el2.attr("data-empty"):el2.attr("placeholder");if($.trim(v).length==0)into.text(txt);else{if(el2.hasClass("not-4-chars")){if(el2.hasAttr("data-4-chars"))txt=el2.attr("data-4-chars")}else if(el2.hasClass("not-on-pattern")){if(el2.hasAttr("data-chars-not-allowed"))txt=el2.attr("data-chars-not-allowed")}into.text(txt)}}else if(el2.hasAttr("data-empty")){into.text(el2.attr("data-empty"))}else{if(el2.is(":checkbox")||el2.is(":radio")){into.text(el2.attr("placeholder"))}else{into.text(el2.attr("placeholder"))}}}}if(!classesOnly){if(el2.is(":radio")){if(!isRadioChecked){if(fs.length)fs.addClass(isCheck);el2.focus();return false}}else{if(fs.length)fs.addClass(isV);el2.focus();return false}}else{if(el2.is(":radio")){if(!isRadioChecked){if(fs.length)fs.addClass(isCheck)}}else{if(fs.length)fs.addClass(isV)}}}else if(el2.hasClass("is-valid")){if(el2.hasAttr("data-into")){let intoTxt=el2.data("into");if(lbl.length)into=lbl.find(intoTxt);if(fs.length)into=fs.find(intoTxt);if(!into)into=$(intoTxt);if(into.length){into.text("")}}}}return true}function validateInputs(f){if(f.hasAttr("ax-before")){var bfs=f.attr("ax-before");if(typeof window[bfs]==="function"){if(window[bfs](f)===false)return false}}var inps=[];f.find("input.required,select.required,textarea.required").each(function(){inps.push($(this).attr("name"))});for(var i2=0;i2<inps.length;i2++){var inp=f.find("input[name='"+inps[i2]+"']");var sel=f.find('select[name="'+inps[i2]+'"]');var txt=f.find('textarea[name="'+inps[i2]+'"]');var e=inp;if(!e.length)e=sel;if(!e.length)e=txt;var or=e.attr("or");if(or!=""){var inp2=f.find("input[name='"+or+"']");var sel2=f.find('select[name="'+or+'"]');var txt2=f.find('textarea[name="'+or+'"]');var or=inp2;if(!or.length)or=sel2;if(!or.length)or=txt2}if(e.is(":checkbox")||e.is(":radio")){if(!e.is(":checked")){if(or.length){if(!or.is(":checked")){alert(e.attr("placeholder")+" or "+or.attr("placeholder"));e.addClass("error");e.focus();return false}}else{alert(e.attr("placeholder"));e.addClass("error");e.focus();return false}}}else{if($.trim(e.val()).length==0){if(or.length){if($.trim(or.val()).length==0){alert(e.attr("placeholder")+" or "+or.attr("placeholder"));e.addClass("error");e.focus();return false}}else{alert(e.attr("placeholder"));e.addClass("error");e.focus();return false}}if(e.is("[password]")){if(!passwordValid(e.val())){alert(e.attr("data-wpm"));e.addClass("error");e.focus();return false}}if(e.is("[rpassword]")){if($.trim(e.val())!=$.trim(e.closest("form").find("[password]").val())){e.addClass("error");alert(e.attr("data-pnm"));e.focus();return false}e.removeClass("error");$(".passStrength").remove()}}}return true}let _cookies={getItem:function(sKey){if(!sKey){return null}return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(sKey).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},setItem:function(sKey,sValue,vEnd,sPath,sDomain,bSecure){if(!sKey||/^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)){return false}var sExpires="";if(vEnd){switch(vEnd.constructor){case Number:sExpires=vEnd===Infinity?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+vEnd;break;case String:sExpires="; expires="+vEnd;break;case Date:sExpires="; expires="+vEnd.toUTCString();break}}if(!sPath)sPath="/";document.cookie=encodeURIComponent(sKey)+"="+encodeURIComponent(sValue)+sExpires+(sDomain?"; domain="+sDomain:"")+(sPath?"; path="+sPath:"")+(bSecure?"; secure":"");return true},removeItem:function(sKey,sPath,sDomain){if(!this.hasItem(sKey)){return false}if(!sPath)sPath="/";document.cookie=encodeURIComponent(sKey)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(sDomain?"; domain="+sDomain:"")+"; path="+sPath;return true},hasItem:function(sKey){if(!sKey){return false}return new RegExp("(?:^|;\\s*)"+encodeURIComponent(sKey).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},keys:function(){var aKeys=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/);for(var nLen=aKeys.length,nIdx=0;nIdx<nLen;nIdx++){aKeys[nIdx]=decodeURIComponent(aKeys[nIdx])}return aKeys}};var cookies=new Proxy(_cookies,{get(target,key){return target[key]??target.getItem(key)??void 0},set(target,key,value){if(key in target){return false}return target.setItem(key,value)},deleteProperty(target,key){if(!(key in target)){return false}return target.removeItem(key)},ownKeys(target){return target.keys()},has(target,key){return key in target||target.hasItem(key)},defineProperty(target,key,descriptor){if(descriptor&&"value"in descriptor){target.setItem(key,descriptor.value)}return target},getOwnPropertyDescriptor(target,key){const value=target.getItem(key);return value?{value,enumerable:true,configurable:true}:void 0}});function getCookie(n2){return cookies[n2]}function setCookie(n2,v,d,p,e){var now=new Date;var time=now.getTime();if(!e)e=time+24*60*60*1e3*365;else e=time+e;if(!d)d=window.location.hostname;if(!p)p="/";now.setTime(e);return cookies.setItem(n2,v,now.toGMTString(),p,d,true)}function getComData(c,fromHTML){if(fromHTML){try{var el2=$("<div></div>");el2.html(c.html());var k={};var mtitle=$("modal-title",el2).html();if(!mtitle)mtitle="";var mbody=$("modal-body",el2).html();if(!mbody)mbody="";var mdesc=$("modal-description",el2).html();if(!mdesc)mdesc="";var mfoot=$("modal-footer",el2).html();if(!mfoot)mfoot="";k.Title=mtitle;k.Body=mbody;k.Description=mdesc;k.Footer=mfoot;c=k;return c}catch(e){return false}return false}try{c=c.contents().filter(function(){return this.nodeType===8}).get(0);if(c.nodeValue=="")return false;try{c=JSON.parse(c.nodeValue)}catch(e){try{c=JSON.parse(atob(c.nodeValue))}catch(e2){try{var el2=$("<div></div>");el2.html(c.nodeValue);var k={};var mtitle=$("modal-title",el2).html();if(!mtitle)mtitle="";var mbody=$("modal-body",el2).html();if(!mbody)mbody="";var mdesc=$("modal-description",el2).html();if(!mdesc)mdesc="";var mfoot=$("modal-footer",el2).html();if(!mfoot)mfoot="";k.Title=mtitle;k.Body=mbody;k.Description=mdesc;k.Footer=mfoot;c=k}catch(e3){return false}}}return c}catch(e){return false}}function addOrChangeParameters(url,params){let splitParams={};let splitPath=/(.*)[?](.*)/.exec(url);if(splitPath&&splitPath[2])splitPath[2].split("&").forEach(k=>{let d=k.split("=");splitParams[d[0]]=d[1]});let newParams=Object.assign(splitParams,params);let finalParams=Object.keys(newParams).map(a=>a+"="+newParams[a]).join("&");return splitPath?splitPath[1]+"?"+finalParams:url+"?"+finalParams}class BEA{Cart=null;Products=null;Authorize=null;Pay=null;localCache=true;_prom=null;proms=[];l="En";fields={Section:"Section,Title,Text",Product:"Name,Price,Quantity"};constructor(options){if(options===void 0)options={};if(!Object.keys(options).length==0){if(options.hasOwnProperty("fields")){for(var i2 in options["fields"]){this.fields[i2]=options["fields"][i2]}}if(options.hasOwnProperty("localisation"))this.l=options.localisation;if(options.hasOwnProperty("locale")&&options.locale===true){this.getLocale()}if(options.hasOwnProperty("sections")&&options.sections===true){this.getSections()}if(options.hasOwnProperty("localCache")&&options.localCache===false){this.localCache=false}}this.Cart=new Cart(this);this.Products=new Products(this);this.Authorize=new Authorize(this);this.Pay=new Pay(this);this._prom=Promise.all(this.proms)}request(className,data2,async,type2,a){var prom=defer();var x2;API.req(className,data2,null,type2,a??0).then(r2=>{if(async){prom.resolve(r2)}else{x2=r2.results}});if(async)return prom;return x2}getSections(){var sec=new Section(this);this.proms.push(sec._prom);return sec.get()}getLocale(){var loc=new Locale(this);this.proms.push(loc._prom);return loc.get()}order(){let prom=defer();var ids="";var productsInfo;var user;var orderData={User:"",productItems:[],Amount:0};user=this.Authorize.me();orderData.User=user.objectId;$.each(this.Cart.cartData,function(key,value){ids=ids+value.P+","});this.Products.get({fields:"Name,Price,Quantity",media:"images",crops:"ax200,ax600,ax700,200x200,ax300"},{ids},true).then(res=>{let productsInfo2=res.results;var productsDB=Object.assign({},...productsInfo2.map(x2=>({[x2.objectId]:x2})));$.each(this.Cart.cartData,function(key,value){orderData.productItems.push({Qty:value.Q,Product:value.P,productData:JSON.stringify(productsDB[value.P]),Price:productsDB[value.P].Price});orderData.Amount+=value.Q*productsDB[value.P].Price});this.request("/Order",{User:orderData.User,Amount:orderData.Amount},true,"POST").then(res2=>{let orderId=res2.results;for(var i2=0;i2<orderData.productItems.length;i2++){orderData.productItems[i2]["Order"]=orderId[0].objectId;this.request("/orderItems ",orderData.productItems[i2],true,"POST")}prom.resolve(orderId)})});return prom}sendEmail(data2){let prom=defer();this.request("/_Emails/send",data2,true,"POST").then(res=>{prom.resolve(r)})}batch(data2){return this.request("/batch",data2,true,"POST")}query(className,data2){return this.request(className,data2,true,"GET")}get(className,data2,options=true){return this.request(className,data2,options,"GET")}post(className,data2,options=true){return this.request(className,data2,options,"POST")}put(className,data2,options=true){return this.request(className,data2,options,"PUT")}delete(className,options=true){return this.request(className,"",options,"DELETE")}}class Pay{tsdk=null;object={};constructor(tsdk){this.tsdk=tsdk;let self=this;$(window).unbind("message").on("message",function(e){let dd=$("#gosell-gateway")[0].contentWindow;if(e.originalEvent.source===dd&&e.originalEvent.data=="close"){$(".gosell-gateway").remove();self.onClose()}})}create(data2){let prom=defer();API.post("https://pay.bea.com.lb/create",data2,{},666).then(d=>{this.object=d;cl(d);this.process(this.object.transaction.url.replace("mode=page","mode=popup"));prom.resolve(this.object.id)}).catch(err=>{cl(err)});return prom}process(link){var d=`
37
37
  <div class="gosell-gateway" reactive>
38
38
  <div style="position: fixed;left: 0;right: 0;top: 0;bottom: 0;z-index: 9999;background-color: rgb(0,0,0,0.2);">
39
39
  <iframe id="gosell-gateway"
@@ -111,7 +111,7 @@ var LM_BUILD=(function(){try{var m=/\/js\/app\.(\d+)\.js/.exec(document.currentS
111
111
 
112
112
  class AbstractWebSocket{constructor(url,connectionTimeout=5e3){this.url=url;this.socket=null;this.reconnectInterval=3e3;this.reconnectTimeout=null;this.connectionTimeout=connectionTimeout;this.connectionTimeoutId=null;this.connected=false;this.messageQueue=[]}connect(){this.socket=new WebSocket(this.url);this.connectionTimeoutId=setTimeout(()=>{this.handleConnectionTimeout()},this.connectionTimeout);this.socket.onopen=()=>{clearTimeout(this.connectionTimeoutId);this.connected=true;this.onOpen();this.processMessageQueue()};this.socket.onmessage=event=>{this.onMessage(event.data)};this.socket.onclose=event=>{clearTimeout(this.connectionTimeoutId);this.connected=false;this.onClose(event.code);this.reconnect()};this.socket.onerror=error=>{clearTimeout(this.connectionTimeoutId);this.onError(error)}}send(message){cl("Sending ",message);if(this.connected){this.socket.send(message)}else{this.messageQueue.push(message);console.error("WebSocket is not open. Unable to send message.")}}processMessageQueue(){while(this.messageQueue.length>0){const message=this.messageQueue.shift();cl("Sending From Queue ",message);this.socket.send(message)}}handleConnectionTimeout(){this.socket.close()}disconnect(){if(this.socket){this.socket.close()}clearTimeout(this.reconnectTimeout)}onOpen(){}onMessage(message){}onClose(code){}onError(error){}reconnect(){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=setTimeout(()=>{this.connect()},this.reconnectInterval)}}class MyWebSocket extends AbstractWebSocket{constructor(url){super(url)}onOpen(){super.onOpen()}onMessage(message){super.onMessage(message)}onClose(code){super.onClose(code)}onError(error){super.onError(error)}}class Nuclear{_iter=0;reconnectAttempts=0;timeoutInterval=4e3;cbs={};_cbs={};lstnrs={};_ws;srvr=void 0;constructor(srvr){this.srvr=srvr;this.init();return this}on(e,cb){if(!this.lstnrs.hasOwnProperty(e))this.lstnrs[e]=[];this.lstnrs[e].push(cb);if(e=="open"&&this._ws?.readyState==1){this.trigger("open",this._ws)}return this}off(e){if(e=="connect")return this;if(this.lstnrs.hasOwnProperty(e))delete this.lstnrs[e];return this}subscribe(e,cb){return this.on(e,cb)}unsubscribe(e,cb){return this.off(e,cb)}trigger(n,e){if(this.lstnrs.hasOwnProperty(n)){for(let x=0;x<this.lstnrs[n].length;x++){this.lstnrs[n][x](e)}}return this}emit(e,data,cb){try{this._iter++;if(cb)this.cbs["cb_"+this._iter]=cb;if(this.ready()){this._ws.send(JSON.stringify({e,payload:data,_iter:this._iter}))}else{this._send(JSON.stringify({e,payload:data,_iter:this._iter}))}}catch(error){if(_debugMode)cl(error)}return this}_emit(e,data){this._iter++;let prom=defer();this._cbs["cb_"+this._iter]=prom;if(this.ready()){this._ws.send(JSON.stringify({e,payload:data,_iter:this._iter}))}else{this._send(JSON.stringify({e,payload:data,_iter:this._iter}))}return prom}_send(m){let _s=this;setTimeout(function(){if(_s.ready())_s._ws.send(m);else _s._send(m)},500)}ready(){return this._ws!==void 0&&this._ws.readyState==WebSocket.OPEN}connecting(){return this._ws!==void 0&&this._ws.readyState==WebSocket.CONNECTING}init(){var _s=this;this._ws=new ReconnectingWebSocket(this.srvr?this.srvr:"wss://www.beaapis.com/");this._ws.addEventListener("error",event=>{return false});this._ws.onopen=function(e){_s.trigger("connect",e);_s.trigger("open",e)};this._ws.onclose=function(e){_s._iter=0;_s.cbs={};_gn=0;barSet(1,200);_s.reconnectAttempts++};this._ws.onmessage=function(e){try{let data=JSON.parse(e.data);if(data.hasOwnProperty("e")){let event=data["e"];let iter=data["_iter"];const customEvent=new CustomEvent(event,{detail:data["payload"]});customEvent.data=data["payload"];if(event!="rooms")_s.trigger(event,customEvent);if(_s.cbs["cb_"+iter])_s.cbs["cb_"+iter](customEvent);if(_s._cbs["cb_"+iter])_s._cbs["cb_"+iter].resolve(customEvent)}}catch(e2){if(_debugMode)cl(e2)}};this._ws.onerror=function(e){_gn=0;barSet(1,200)}}}class _Ticker{id="";tick=1e3;duration=1e4;data={};status="created";user=void 0;channel=void 0;_cbs={};constructor(obj,channel,user){this.id=obj.id;this.tick=obj?.tick??1e3;this.duration=obj?.duration??1e4;this.data=obj?.data??{};this.user=user;this.channel=channel;this.user.id=this.user.id;this.init();return this}init(opts,lstnrs){let t=this.tick;let d=this.duration;let data=this.data;if(opts){if(opts.hasOwnProperty("tick"))t=opts.tick;if(opts.hasOwnProperty("duration"))d=opts.duration;if(opts.hasOwnProperty("data"))data=opts.data}this.user.nuke.emit("subscribe",{type:"ticker",ticker:this.id,channel:this.channel.id,user:this.user.id,data:{tick:t,duration:d,data}});if(!this.user.nuke._tickers.hasOwnProperty(this.channel.id))this.user.nuke._tickers[this.channel.id]={};this.user.nuke._tickers[this.channel.id][this.id]=this;if(!lstnrs){var self=this;this.on("create.class",function(e){self.status="created"});this.on("start.class",function(e){self.status="started"});this.on("tick.class",function(e){self.status="started"});this.on("pause.class",function(e){self.status="paused"});this.on("finish.class",function(e){self.status="finished"})}}start(){if(this.status=="started"){setError(null,`This ticker is already started`);return this}if(this.status=="finished"){setError(null,`This ticker is finished`);return this}this.user.nuke.emit("ticker",{ticker:this.id,channel:this.channel.id,user:this.user.id,ev:"start"})}pause(){if(this.status=="paused"){setError(null,`This ticker is already paused`);return this}if(this.status!="started"){setError(null,`This ticker is not started yet!`);return this}this.user.nuke.emit("ticker",{ticker:this.id,channel:this.channel.id,user:this.user.id,ev:"pause"})}restart(opts){if(this.status!="finished"){setError(null,`This ticker is not finished yet!`);return this}this.init(opts,true)}delete(){this.user.nuke.emit("unsubscribe",{type:"ticker",ticker:this.id,channel:this.channel.id,user:this.user.id,ev:"delete"})}extend(t){this.user.nuke.emit("ticker",{ticker:this.id,channel:this.channel.id,user:this.user.id,ev:"extend",data:{time:t}})}on(e,cb){let myRef2=document.createElement("live");myRef2.dataset["cb"]=cb;document.body.append(myRef2);if(this._cbs.hasOwnProperty(e)){this._cbs[e].push(cb)}else this._cbs[e]=[cb];return this}off(e){if(this._cbs.hasOwnProperty(e))delete this._cbs[e];return this}trigger(e,customEvent){if(this._cbs.hasOwnProperty(e)){for(let i=0;i<this._cbs[e].length;i++){const cb=this._cbs[e][i];cb(customEvent)}}return this}}class _Channel{id="/";user=void 0;type="room";_cbs={};constructor(id,type,user){this.id=id;this.type=type;this.user=user;this.user.id=this.user.id??"Guest";return this}trigger(e,customEvent){if(this._cbs.hasOwnProperty(e)){for(let i=0;i<this._cbs[e].length;i++){const cb=this._cbs[e][i];cb(customEvent)}}return this}join(){this.user.nuke.emit("subscribe",{type:this.type,channel:this.id,user:this.user.id});if(!this.user.nuke._chnls.hasOwnProperty(this.user.id))this.user.nuke._chnls[this.user.id]={};this.user.nuke._chnls[this.user.id][this.id]=this}leave(){this.user.nuke.emit("unsubscribe",{type:this.type,channel:this.id,user:this.user.id,ev:"leave"});if(this.user.nuke._chnls.hasOwnProperty(this.user.id)){delete this.user.nuke._chnls[this.user.id][this.id]}}broadcast(ev,options){this.user.nuke.emit("broadcast",{type:"room",channel:this.id,user:this.user.id,ev,includeMe:options?.includeMe??true,data:options?.data??{}})}off(e){if(e=="connect")return this;if(this._cbs.hasOwnProperty(e))delete this._cbs[e];return this}on(e,cb){let myRef2=document.createElement("live");myRef2.dataset["cb"]=cb;document.body.append(myRef2);if(this._cbs.hasOwnProperty(e)){this._cbs[e].push(cb)}else this._cbs[e]=[cb];return this}createTicker(obj){if(!this.user.nuke._tickers.hasOwnProperty(this.id)){this.user.nuke._tickers[this.id]={}}let t=new _Ticker(obj,this,this.user);return t}getTicker(id){this.user.nuke.emit("get",{type:"ticker",channel:this.id,user:this.user.id,ticker:id})}}class _User{id="";nuke=void 0;_cbs={};constructor(id,nuke){this.id=id;this.nuke=nuke;this.init();return this}init(){this.nuke.emit("subscribe",{type:"user",channel:this.id,user:this.id});if(!this.nuke._users.hasOwnProperty("/"+this.id))this.nuke._users["/"+this.id]=this}on(e,cb){if(this.nuke._users["/"+this.id]._cbs.hasOwnProperty(e)){this.nuke._users["/"+this.id]._cbs[e].push(cb)}else this.nuke._users["/"+this.id]._cbs[e]=[cb];return this}off(e){if(this._cbs.hasOwnProperty(e))delete this._cbs[e];return this}broadcast(ev,options){this.nuke.emit("broadcast",{type:"user",channel:this.id,user:this.id,ev,includeMe:options?.includeMe??true,data:options?.data??{}})}trigger(e,customEvent){if(this._cbs.hasOwnProperty(e)){for(let i=0;i<this._cbs[e].length;i++){const cb=this._cbs[e][i];cb(customEvent)}}return this}_broadcastToAll(IDs,e,d,t){this.nuke.emit("broadcast",{type:t=="u"?"user":"room",user:this.id,ev:e,includeMe:d["includeMe"]??true,data:d["data"],...t=="u"?{users:IDs.join(",")}:{channels:IDs.join(",")}})}broadcastToUsers(uIDs,e,d){this._broadcastToAll(uIDs,e,d,"u")}broadcastToChannels(cIDs,e,d){this._broadcastToAll(cIDs,e,d,"c")}unsubscribe(c){if(this.nuke._chnls.hasOwnProperty(this.id)){if(this.nuke._chnls[this.id].hasOwnProperty(c))this.nuke._chnls[this.id][c].leave()}}subscribe(e,cb){if(!this.nuke._chnls.hasOwnProperty(this.id)){this.nuke._chnls[this.id]={}}let channel=new _Channel(e,"room",this);channel.join();return channel}destroy(){this._cbs={};if(this.nuke._chnls.hasOwnProperty(this.id)){let chnls=this.nuke._chnls[this.id];for(const chnl in chnls){this.unsubscribe(chnl)}}}}class _Live{_chnls={};_users={};_tickers={};_iter=0;reconnectAttempts=0;timeoutInterval=4e3;cbs={};_cbs={};lstnrs={};_ws;srvr=void 0;constructor(srvr){this.srvr=srvr;this.init();return this}on(e,cb){if(!this.lstnrs.hasOwnProperty(e))this.lstnrs[e]=[];this.lstnrs[e].push(cb);if(e=="open"&&this._ws?.readyState==1){this.trigger("open",this._ws)}return this}off(e){if(e=="connect")return this;if(this.lstnrs.hasOwnProperty(e))delete this.lstnrs[e];return this}createUser(id){let user=new _User(id,this);return user}subscribe(e,cb){return this.on(e,cb)}unsubscribe(e,cb){return this.off(e,cb)}trigger(n,e){if(this.lstnrs.hasOwnProperty(n)){for(let x=0;x<this.lstnrs[n].length;x++){this.lstnrs[n][x](e)}}return this}emit(e,data,cb){try{this._iter++;if(cb)this.cbs["cb_"+this._iter]=cb;if(this.ready()){this._ws.send(JSON.stringify({e,payload:data,_iter:this._iter}))}else{this._send(JSON.stringify({e,payload:data,_iter:this._iter}))}}catch(error){if(_debugMode)cl(error)}return this}_emit(e,data){this._iter++;let prom=defer();this._cbs["cb_"+this._iter]=prom;if(this.ready()){this._ws.send(JSON.stringify({e,payload:data,_iter:this._iter}))}else{this._send(JSON.stringify({e,payload:data,_iter:this._iter}))}return prom}_send(m){let _s=this;setTimeout(function(){if(_s.ready())_s._ws.send(m);else _s._send(m)},500)}ready(){return this._ws!==void 0&&this._ws.readyState==WebSocket.OPEN}connecting(){return this._ws!==void 0&&this._ws.readyState==WebSocket.CONNECTING}init(){var _s=this;if(_s.ready()||_s.connecting()){return}this._ws=new ReconnectingWebSocket(this.srvr?this.srvr:"wss://www.beaapis.com/");this._ws.addEventListener("error",event=>{});this._ws.onopen=function(e){_s.trigger("connect",e);_s.trigger("open",e)};this._ws.onclose=function(e){_s._iter=0;_s.cbs={};_gn=0;barSet(1,200);_s.reconnectAttempts++};this._ws.onmessage=function(e){try{let data=JSON.parse(e.data);if(data.hasOwnProperty("for")){let t=data["type"]??"room";let ev=data["ev"]??"message";const customEvent=new CustomEvent(ev,{detail:data["payload"]});customEvent.data=data["payload"];let payload=data["payload"];if(payload.hasOwnProperty("user")){if(t=="user"){_s._users[data["for"]].trigger(ev,customEvent)}else if(t=="room")_s._chnls[payload.user.id][data["for"]].trigger(ev,customEvent);else if(t=="ticker"){_s._tickers[data["for"]][payload?.ticker?.id].trigger(ev,customEvent);_s._tickers[data["for"]][payload?.ticker?.id].trigger(ev+".class",customEvent)}}}else if(data.hasOwnProperty("e")){let event=data["e"];let iter=data["_iter"];const customEvent=new CustomEvent(event,{detail:data["payload"]});customEvent.data=data["payload"];if(event!="rooms")_s.trigger(event,customEvent);if(_s.cbs["cb_"+iter])_s.cbs["cb_"+iter](customEvent);if(_s._cbs["cb_"+iter])_s._cbs["cb_"+iter].resolve(customEvent)}}catch(e2){if(_debugMode)cl(e2)}};this._ws.onerror=function(e){_gn=0;barSet(1,200)}}}let LIVE;let Nuke;LIVE=new _Live("wss://www.beaapis.com/");Nuke=new Nuclear(_beaTn?void 0:(window.location.protocol==="https:"?"wss://":"ws://")+window.location.hostname+(window.location.port?":"+window.location.port:""));let _ovcD,_vcD;function syncViewFiles(){Nuke.emit("getfiles",{},function(e){var _files=e.data;let views=_files["views"];let layouts=_files["layouts"];_vcD=_files;if(!_ovcD)_ovcD=clone(_vcD);else{for(var key in views){if(_ovcD["views"].hasOwnProperty(key)){if(!deepCompare(clone(_ovcD["views"][key]),clone(views[key]))){cl("Changed the view "+atob(key));let n=atob(key).split("src/views/").join("").split(".view").join("");let nodes=getURLNodes();_ovcD["views"][key]=views[key];cl("view",n,atob(key));if(n.indexOf("widgets/")===0){let changedWidgetName=n.split("widgets/").join("");for(let regionName in _vt.Widgets){if(_vt.Widgets[regionName]._resolvedFile===changedWidgetName){_vt.Widgets[regionName]._resolvedFile=void 0}}renderView(nodes[0],null,View.props??{})}else if(nodes[0]==n){renderView(nodes[0],null,View.props??{})}else{renderView(nodes[0],null,View.props??{})}}}}for(var key in layouts){if(_ovcD["layouts"].hasOwnProperty(key)){if(!deepCompare(clone(_ovcD["layouts"][key]),clone(layouts[key]))){cl("Changed the layout "+atob(key));let n=atob(key).split("src/layouts/").join("").split(".layout").join("");let nodes=getURLNodes();_ovcD["layouts"][key]=layouts[key];cl("layout",n,atob(key));renderView(n,false,{},"layouts")}}}let tpls=_files["tpls"]||{};let tplsChanged=!deepCompare(clone(_ovcD["tpls"]||{}),clone(tpls));if(tplsChanged){_ovcD["tpls"]=tpls;let nodes=getURLNodes();renderView(nodes[0],null,View.props??{})}}})}Nuke.on("connect",function(){if(_beaTn){Nuke.emit("get_uniquer",{beajsToken:_beaTn,uniquer:globals.uniquer},function(e){let d=e.data;let data=d.uniquer;globals.uniquer=data})}else{syncViewFiles()}});Nuke.on("files-changed",function(){if(!_beaTn)syncViewFiles()});var API={get:function(u,d,h,a,opts){return this.req(u,d,h,"GET",a,opts)},put:function(u,d,h,a,opts){return this.req(u,d,h,"PUT",a,opts)},post:function(u,d,h,a,opts){return this.req(u,d,h,"POST",a,opts)},delete:function(u,d,h,a,opts){return this.req(u,d,h,"DELETE",a,opts)},patch:function(u,d,h,a,opts){return this.req(u,d,h,"PATCH",a,opts)},req:function(u,d,h,m,a,opts,_prom){if(!opts)opts={full:false,progress:true};let prog=opts.hasOwnProperty("progress")?opts.progress:true;let full=opts.hasOwnProperty("full")?opts.full:false;let prom=_prom?_prom:defer();try{return prom}finally{if(Nuke&&Nuke._ws&&Nuke._ws.readyState==1&&(_beaTn?globals.uniquer>0:true)){if(prog){_gn=0;_work()}Nuke.emit("request",{body:{method:m,path:u,api:a??0,headers:h,full},uniquer:globals.uniquer??0,data:d},function(e){if(prog){_gn=0;barSet(1,200)}var r=e.data;prom.resolve(r)})}else{if(_beaTn&&_beaTn!=""){$.ajax({"url":"https://www.beaapis.com/req",headers:{},type:"POST",dataType:"json",data:{body:{method:m,path:u,api:a??0,headers:h,full},uniquer:globals.uniquer??0,_beaTn,data:d},cache:false,success:function(r,s){prom.resolve(r)},error:function(){prom.reject("error")}})}else{setTimeout(()=>{this.req(u,d,h,m,a,opts,prom)},_tickTime)}}}}};
113
113
 
114
- var _navT=0;var _nav=false;var _pbc;var _vuid={};$("body").on("click touch tap",function(e2){try{var _AC=typeof AudioContext!=="undefined"?AudioContext:typeof webkitAudioContext!=="undefined"?webkitAudioContext:null;if(!_AC)return;if(!_pbc)_pbc=new _AC;if(_pbc.state=="suspended"){_pbc.resume().then(()=>{})}}catch(err){}});$("body").on("click touch",".navTgl",function(e2){_nav=false;clearTimeout(_navT);if($("nav").hasClass("nav-opened")){$("nav").removeClass("nav-opened");$("body").removeClass("nav-opened")}else{$("nav").addClass("nav-opened");$("body").addClass("nav-opened");_navT=setTimeout(function(){_nav=true},20)}e2.stopPropagation()});$(document).keydown(function(e2){var keyCode=e2.keyCode||e2.which;if(keyCode==27){e2.preventDefault();e2.stopPropagation();if($("[loader]").length){if(_loader.options.Dismissible)_loader.hide()}else if(_nav){$("nav").removeClass("nav-opened");$("body").removeClass("nav-opened");_nav=false}else{if($("popup").length&&$("droplet").length){$("droplet").removeClass("is-visible").each(function(){var p=$(this);setTimeout(function(){p.remove()},150)})}else if($("popup").length){$("[close-modal]:last").click()}else{$("body").css({overflow:"visible"});$("droplet").removeClass("is-visible").each(function(){var p=$(this);setTimeout(function(){p.remove()},150)})}}}});_csswrk.on("css-ready",function(e2){let data=e2.originalEvent.data;_vuid[data.key].resolve(data.csses)});function _upwrkStarted(){if(!_upwrk.isStarted())_upwrk.start();return _upwrk}_upwrk.on("message",function(e2){let data=e2.originalEvent.data});_upwrk.on("files-added",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"files-added",data.files,data.newfiles)});_upwrk.on("queue-changed",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"queue-changed",data.files)});_upwrk.on("file-removed",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"file-removed",data.files,data.removedfile)});_upwrk.on("upload-start",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"upload-start",data.files)});_upwrk.on("file-uploaded",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"file-uploaded",data.files,data.file)});_upwrk.on("upload-progress",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"upload-progress",data.files)});_upwrk.on("upload-complete",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"upload-complete",data.files)});_upwrk.on("upload-stop",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"upload-stop",data.files)});_upwrk.on("queue-empty",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"queue-empty")});$.fn.extend({startUpload:function(){if(this.hasAttr("up")){_upwrkStarted().trigger("start-upload",{"upid":this.attr("upid")})}return this},stopUpload:function(){if(this.hasAttr("up")){_upwrkStarted().trigger("stop-upload",{"upid":this.attr("upid")})}return this},removeFile:function(id){if(this.hasAttr("up")){_upwrkStarted().trigger("remove-file",{"upid":this.attr("upid"),"id":id})}return this}});$("body").on("FilesAdded","[up]",function(e2,files){let t=$(this);var size=t.attr("data-mxs")?t.attr("data-mxs"):"10mb";_upwrkStarted().trigger("handle-files",{"upid":t.attr("upid"),"files":files});processEv(e2,t,"browse-files",files)});$("body").on("dragover","[up] [drpzn]",function(e2){e2.stopPropagation();e2.preventDefault();let t=$(this).closest("[up]");$(this).addClass("dragover");e2.originalEvent.dataTransfer.dropEffect="copy";return false});$("body").on("dragleave","[up] [drpzn]",function(e2){e2.stopPropagation();e2.preventDefault();$(this).removeClass("dragover")});$("body").on("drop","[up] [drpzn]",function(e2){e2.stopPropagation();e2.preventDefault();var files=e2.originalEvent.dataTransfer?.files||e2.target?.files;let t=$(this).closest("[up]");$(this).removeClass("dragover");t.trigger("FilesAdded",[files]);return false});$("body").on("click","[up] [browse]",function(e2){e2.stopPropagation();e2.preventDefault();let t=$(this).closest("[up]");t.find("[files]").click()});$("body").on("change","[up] [files]",function(e2){e2.stopPropagation();e2.preventDefault();var files=e2.originalEvent.dataTransfer?.files||e2.target?.files;let t=$(this).closest("[up]");t.trigger("FilesAdded",[files])});$("body").on("click touch","[ctc]",function(ev){var el=$(this);var ctc=el.attr("ctc");var selector=el;if(ctc.indexOf("el.")!==-1){selector=eval(ctc)}else if(ctc!="")selector=$(ctc);if(!navigator.clipboard){var temp=$("<textarea class='pf' style='left: -40%;' />");$("body").append(temp);temp.val(selector.text()).select();document.execCommand("copy");temp.remove()}else{navigator.clipboard.writeText(selector.text()).then(function(){},function(err){var temp2=$("<textarea class='pf' style='left: -40%;' />");$("body").append(temp2);temp2.val(selector.text()).select();document.execCommand("copy");temp2.remove()})}if(el.hasAttr("stop"))ev.stopPropagation()});$("body").on("click touch","[scroll-left]",function(ev2){var _el=$(this);var _wrap=_el.closest("[wrapper]");if(_wrap.length){var _p=_wrap.find("div").first();_p.stop().animate({scrollLeft:_p.scrollLeft()-100},{duration:200,easing:"easeOutCirc",complete:function(){}})}});$("body").on("click touch","[scroll-right]",function(ev2){var _el=$(this);var _wrap=_el.closest("[wrapper]");if(_wrap.length){var _p=_wrap.find("div").first();_p.stop().animate({scrollLeft:_p.scrollLeft()+100},{duration:200,easing:"easeOutCirc",complete:function(){}})}});$("body").on("click touch","[scroll-top]",function(ev2){var _el=$(this);var _wrap=_el.closest("[wrapper]");if(_wrap.length){var _p=_wrap.find("div").first();_p.stop().animate({scrollTop:_p.scrollTop()-100},{duration:200,easing:"easeOutCirc",complete:function(){}})}});$("body").on("click touch","[scroll-bottom]",function(ev2){var _el=$(this);var _wrap=_el.closest("[wrapper]");if(_wrap.length){var _p=_wrap.find("div").first();_p.stop().animate({scrollTop:_p.scrollTop()+100},{duration:200,easing:"easeOutCirc",complete:function(){}})}});function bs(t){$("body").css({overflow:t?"visible":"hidden"})}$("body").on("open-modal","[modal]",function(ev2){var el2=$(this);var n=popups.modals.length;var _view=el2.attr("modal");bs();var va=el2.attr("modal-align")??"center middle";var padding=el2.attr("modal-spacing")??"";var ov=el2.attr("modal-ov")??"bgb20";var icon=el2.attr("modal-icon")??"mdi:close";va=va.split(" ");if(va.length==2){va={h:["left","center","right"].indexOf(va[0])>=0?va[0]:"center",v:["top","center","middle","bottom"].indexOf(va[1])>=0?va[1]:"middle"}}else{va={h:"center",v:"middle"};setError(null,"Modal align should be modal-align='vertical horizontal'.")}if(!el2.hasAttr("data-modal")){var selector2="modals_"+n;var popup=`<popup class="ov df pf [c] z10000 oya [ov]"><div pop-c class="ma w100 [va] [ta] [p]"><flx pop-h class="ps t0 as z100"><flx class="f1 fc as"><div pop-t>[t]</div><div pop-d>[d]</div></flx><div pop-x close-modal data-dismiss="modal" aria-label="Close"><span aria-hidden="true" class="cc c iconify" data-icon="[i]"></span></div></flx><div pop-b>[b]</div><div pop-f class='ps b0 z100'>[f]</div></div></popup>`;var verticalAlign=va["v"]=="center"||va["v"]=="middle"?"vm":va["v"]=="top"?"vt":"vb";var textAlign=va["h"]=="center"?"c":va["h"]=="left"?"l":"r";popup=popup.split("[va]").join(verticalAlign).split("[p]").join(padding).split("[ta]").join(textAlign).split("[ov]").join(ov).split("[i]").join(icon);let attrsData={t:el2.attr("modal-title")??"New Modal",d:el2.attr("modal-description")??"",c:el2.attr("modal-class")??""};if(_view!=""){popup=popup.split("[t]").join(attrsData.t);popup=popup.split("[d]").join(attrsData.d);popup=popup.split("[b]").join('<div for-modal="'+selector2+`" view='`+_view+"'></div>");popup=popup.split("[f]").join("")}else{var c=getComData(el2);if(!c){if(el2.find("modal").length>0){var modalData=el2.find("modal:first");var c=getComData(modalData,true)}}if(c){if(c.Title)popup=popup.split("[t]").join(c.Title??attrsData.t);popup=popup.split("[d]").join(c.Description??attrsData.d);popup=popup.split("[b]").join(c.Body??"");popup=popup.split("[f]").join(c.Footer??"")}else{popup=popup.split("[t]").join(attrsData.t);popup=popup.split("[d]").join(attrsData.d);popup=popup.split("[b]").join("");popup=popup.split("[f]").join("")}}popup=popup.split("[c]").join(attrsData.c);var newModal=$(popup);newModal.attr("id",selector2).appendTo("body");let modal2=$("#"+selector2);el2.trigger("modal-open",[modal2]);modal2.data("props",el2.data("props"));if(_view!=""){let _host=newModal.find("[for-modal]");let _mp=modal2.data("props");_host.data("props",_mp!==void 0?{modal:_mp}:{});mountModalView(_host.get(0),_view)}modal2.addClass("modal-open").delay(10).queue(function(next){$(this).addClass("in");next()});$(this).attr("data-modal",selector2);popups["modals"].push(newModal.get(0));globalWatch()}if(el2.hasAttr("stop"))ev2.stopPropagation()});$("body").on("click touch","[modal]",function(ev2){let modalTriggered=false;var obj={};$.each($(this)[0].attributes,function(){if(this.value.toLowerCase()=="openmodal"){modalTriggered=true;return}obj[this.name]=this.value});if(!modalTriggered){$(this).trigger("open-modal")}});$("body").on("modal-close","[\\@modal-close]",function(ev,modal,cb){let el=$(this),_v=el.attr("@modal-close");let props=modal.data("props");let _fn=_v.split("(")[0];try{if(typeof window[_v]==="function")cb(window[_fn](ev,el,modal,props));else{let _eva=eval(_v);cb(_eva)}}catch(e2){cb()}});$("body").on("modal-open","[\\@modal-open]",function(ev,modal){let el=$(this),_v=el.attr("@modal-open");let _fn=_v.split("(")[0];try{if(typeof window[_v]==="function"){var _data=window[_fn](ev,el,modal);modal.data("props",_data)}else{let _eva=eval(_v);modal.data("props",_eva)}}catch(e2){}});function evalEvAttr(_v2,ev2,el2,n,arg1,arg2,arg3){let _fn2=_v2.split("(")[0];try{let _rawEl=el2[0];let _ownFn=null;if(_v2===_fn2){for(let _e=_rawEl&&_rawEl._ownerRe,_n=0;_e&&_e.view&&_n<50;_e=_e.view._pv,_n++){let _fns=_e.view.fns;if(_fns&&Object.prototype.hasOwnProperty.call(_fns,_fn2)&&typeof _fns[_fn2]==="function"){_ownFn=_fns[_fn2];break}}}if(_ownFn||typeof window[_v2]==="function"){ev2["cType"]=n;let _handler=_ownFn||window[_fn2];var _data2=arg3?_handler(ev2,el2,arg1,arg2,arg3):arg2?_handler(ev2,el2,arg1,arg2):arg1?_handler(ev2,el2,arg1):_handler(ev2,el2);return _data2}else{let _eva2=_evalEventScopedExpr(_rawEl&&_rawEl._ownerRe,_v2,{ev:ev2,el:el2,n,arg1,arg2,arg3});return _eva2}}catch(e2){return false}}function processEv(ev2,el2,n,arg1,arg2,arg3){if(el2.hasAttr("stop"))ev2.stopPropagation();if(n=="focusin")n="focus";else if(n=="focusout")n="blur";if(!el2.hasAttr("@"+n))return;if(el2.hasAttr("@before-"+n)){if(!evalEvAttr(el2.attr("@before-"+n),ev2,el2,n,arg1,arg2,arg3))return}let _v2=el2.attr("@"+n);if(_v2.toLowerCase()=="openmodal"){el2.trigger("open-modal");return}evalEvAttr(_v2,ev2,el2,n,arg1,arg2,arg3)}$("body").on("click touch","[ci]",function(ev2){var el2=$(this);var f=el2.closest("form");var inputs=$("");if(el2.attr("ci")!=""){let ci=el2.attr("ci").split(",");for(let index=0;index<ci.length;index++){const selector2=ci[index];inputs=inputs.add(f.find(selector2))}}else{inputs=f.find($("input[\\:required],select[\\:required],textarea[\\:required]"))}f.removeClass("validation-error");for(var i=0;i<inputs.length;i++){if(!checkFormInputs(f,inputs[i])){f.addClass("validation-error");break}}});$("body").on("doubletap","[\\@dblclick]",function(ev2){processEv(ev2,$(this),"dblclick")});$("body").on("doubletap","[\\@dbltap]",function(ev2){processEv(ev2,$(this),"dbltap")});$("body").on("singletap","[\\@singleclick]",function(ev2){processEv(ev2,$(this),"singleclick")});$("body").on("singletap","[\\@singletap]",function(ev2){processEv(ev2,$(this),"singletap")});$("body").on("taphold","[\\@taphold]",function(ev2){processEv(ev2,$(this),"taphold")});$("body").on("taphold","[\\@clickhold]",function(ev2){processEv(ev2,$(this),"clickhold")});$("body").on("click touch","[\\@click]",function(ev2){processEv(ev2,$(this),"click")});$("body").on("tap","[\\@tap]",function(ev2){processEv(ev2,$(this),"tap")});$("body").on("tap2","[\\@click2]",function(ev2){processEv(ev2,$(this),"click2")});$("body").on("tap2","[\\@tap2]",function(ev2){processEv(ev2,$(this),"tap2")});$("body").on("tap2hold","[\\@click2hold]",function(ev2){processEv(ev2,$(this),"click2hold")});$("body").on("tap2hold","[\\@tap2hold]",function(ev2){processEv(ev2,$(this),"tap2hold")});$("body").on("orientationchange","[\\@orientationchange]",function(ev2){processEv(ev2,$(this),"orientationchange")});$("body").on("swipe swipeleft swipedown swipeend swipeup swiperight","[\\@swipe],[\\@swipe-down],[\\@swipe-up],[\\@swipe-left],[\\@swipe-right],[\\@swipe-end]",function(ev2){let _v2=ev2.type.length==5?"swipe":ev2.type.split("swipe").join("swipe-");processEv(ev2,$(this),_v2)});$("body").on("mouseover","[\\@mouse-over]",function(ev2){processEv(ev2,$(this),"mouse-over")});$("body").on("mousedown touchstart","[\\@mouse-down]",function(ev2){processEv(ev2,$(this),"mouse-down")});$("body").on("tapstart","[\\@tap-start]",function(ev2){processEv(ev2,$(this),"tap-start")});$("body").on("tapend","[\\@tap-end]",function(ev2){processEv(ev2,$(this),"tap-end")});$("body").on("tapmove","[\\@tap-move]",function(ev2){processEv(ev2,$(this),"tap-move")});$("body").on("mouseup touchend","[\\@mouse-up]",function(ev2){processEv(ev2,$(this),"mouse-up")});$("body").on("mouseout","[\\@mouse-out]",function(ev2){processEv(ev2,$(this),"mouse-out")});$("body").on("mouseenter touchmove","[\\:hover]",function(ev2){let _s=$(this).attr(":hover");$(this).attr("style",($(this).hasAttr("style")?$(this).attr("style").rtrim(";")+";":"")+_s)});$("body").on("mouseleave touchend","[\\:hover]",function(ev2){let _s=$(this).attr(":hover");$(this).attr("style",$(this).attr("style").split(_s).join(""))});$("body").on("mouseenter","[\\@mouse-enter]",function(ev2){processEv(ev2,$(this),"mouse-enter")});$("body").on("mouseleave","[\\@mouse-leave]",function(ev2){processEv(ev2,$(this),"mouse-leave")});$("body").on("mousemove","[\\@mouse-move]",function(ev2){processEv(ev2,$(this),"mouse-move")});$("body").on("touchmove","[\\@mouse-move]",function(ev2){processEv(ev2,$(this),"mouse-move")});$("body").on("sort","[\\@sort]",function(ev2,ui){processEv(ev2,$(this),"sort",ui)});$("body").on("sortupdate","[\\@sort-update]",function(ev2,ui){processEv(ev2,$(this),"sort-update",ui)});$("body").on("sortchange","[\\@sort-change]",function(ev2,ui){processEv(ev2,$(this),"sort-change",ui)});$("body").on("sortstart","[\\@sort-start]",function(ev2,ui){processEv(ev2,$(this),"sort-start",ui)});$("body").on("sortstop","[\\@sort-stop]",function(ev2,ui){processEv(ev2,$(this),"sort-stop",ui)});$("body").on("sortbeforestop","[\\@sort-before-stop]",function(ev2,ui){processEv(ev2,$(this),"sort-before-stop",ui)});$("body").on("drag","[\\@drag]",function(ev2,ui){processEv(ev2,$(this),"drag",ui)});$("body").on("dragstart","[\\@drag-start]",function(ev2,ui){processEv(ev2,$(this),"drag-start",ui)});$("body").on("dragstop","[\\@drag-stop]",function(ev2,ui){processEv(ev2,$(this),"drag-stop",ui)});$("body").on("drop","[\\@drop]",function(ev2,ui){processEv(ev2,$(this),"drop",ui)});$("body").on("select2:select","[sl]",function(e2){$(this).trigger("sl-select",[e2.params&&e2.params.data,e2])});$("body").on("select2:unselect","[sl]",function(e2){$(this).trigger("sl-unselect",[e2.params&&e2.params.data,e2])});$("body").on("sl-select","[\\@sl-select]",function(ev2,data,e2){ev2.params=e2&&e2.params;processEv(ev2,$(this),"sl-select",data)});$("body").on("sl-unselect","[\\@sl-unselect]",function(ev2,data,e2){ev2.params=e2&&e2.params;processEv(ev2,$(this),"sl-unselect",data)});$("body").on("clear","[sl]",function(ev2,ui){let t=$(this);t.empty().change();try{let opts=t.data("select2")?.options?.options;opts.data=null;t.select2(opts)}catch(e2){cl(e2)}});$("body").on("change blur focus keyup keydown input","[\\@input],[\\@change],[\\@blur],[\\@focus],[\\@keyup],[\\@keydown]",function(ev2){var t=ev2.type==="focusin"?"focus":ev2.type==="focusout"?"blur":ev2.type;processEv(ev2,$(this),t)});$("body").on("click touch","[close-modal]",function(ev2){var el2=$(this);var modal2=el2.closest("popup");var id=modal2.attr("id");var element_to_remove=$("#"+id).get(0);var index=$.inArray(element_to_remove,popups.modals);var modalOwner=$("[modal][data-modal="+id+"]");if(el2.hasAttr("stop"))ev2.stopPropagation();ev2.preventDefault();if(modalOwner.hasAttr("@modal-beforeclose")){try{let _bv=modalOwner.attr("@modal-beforeclose");let _result=evalEvAttr(_bv,ev2,el2,"modal-beforeclose",modalOwner);if(_result===false)return}catch(e2){}}if(modalOwner.hasAttr("@modal-close")){modalOwner.trigger("modal-close",[modal2,function(res){if(res===false)return;$(".select2-container:not(.select2),.colorpicker.colorpicker-visible").remove();if(index>-1){$("[modal][data-modal="+id+"]").removeAttr("data-modal");modal2.removeClass("in").delay(150).queue(function(next){$(this).remove();if(popups.modals.length==0)bs(true);next()});popups.modals.splice(index,1)}}])}else{$(".select2-container:not(.select2),.colorpicker.colorpicker-visible").remove();if(index>-1){$("[modal][data-modal="+id+"]").removeAttr("data-modal");modal2.removeClass("in").delay(150).queue(function(next){$(this).remove();if(popups.modals.length==0)bs(true);next()});popups.modals.splice(index,1)}}});$("body").on("change keyup","[password]",function(e2){let el2=$(this);let lbl=el2.closest("label");let f=el2.closest("form");var v=$.trim($(this).val());let allCls="has-spaces weak strong very-strong medium";let cls=passwordStrength(v);el2.removeClass(allCls).addClass(cls);if(f.length)f.removeClass(allCls).addClass(cls);if(lbl.length)lbl.removeClass(allCls).addClass(cls);if(!$(this).next().hasClass("passStrength"))$(this).after("<span class='passStrength'></span>");$(this).parent().find(".passStrength").removeClass(allCls).addClass(cls)});$("body").on("change keyup","[username]",function(e2){var keyCode=e2.keyCode||e2.which;if(keyCode!=9&&keyCode!=16&&keyCode!=27&&keyCode!=93&&keyCode!=91&&keyCode!=17&&keyCode!=18){var el2=$(this);let f=el2.closest("form");checkFormInputs(f,el2,true)}});$("body").on("focus","input:not(.select2-search__field,.mobinit),textarea,select",function(ev2){var el2=$(this);var f=el2.closest("form");let lbl=el2.closest("label");if(f.length)f.addClass("focused");if(lbl.length)lbl.addClass("focused");el2.parent().addClass("focused");el2.addClass("focused")});$("body").on("blur","input:not(.select2-search__field,.mobinit),textarea,select",function(ev2){var el2=$(this);var f=el2.closest("form");if(f.length)f.removeClass("focused");el2.parent().removeClass("focused");el2.removeClass("focused")});$("body").on("change keyup","input:not(.select2-search__field,.mobinit),textarea,select",function(ev2){var el2=$(this);let f=el2.closest("form");checkFormInputs(f,el2,true)});var _lookups=0;var _debs={};var _proms={};$("body").on("change keyup","[\\:lookup]",function(e2){var keyCode=e2.keyCode||e2.which;if(keyCode!=9&&keyCode!=16&&keyCode!=27&&keyCode!=93&&keyCode!=91&&keyCode!=17&&keyCode!=18){var el2=$(this);if(!el2.attr("data-i")){el2.attr("data-i",_lookups);_lookups++}var key="lu_"+el2.attr("data-i");clearTimeout(_debs[key]);var v=$(this).val();var callback=el2.attr(":lookup-callback");if(!_proms.hasOwnProperty(key)){_proms[key]=defer();_proms[key].then(function(val){el2.addClass("finished").removeClass("pending")}).catch(reason=>{el2.addClass("pending").removeClass("finished")})}else{}el2.addClass("pending").removeClass("finished");_debs[key]=setTimeout(function(){_proms[key].reject();_proms[key]=defer();_proms[key].then(function(val){el2.addClass("finished").removeClass("pending")}).catch(reason=>{el2.addClass("pending").removeClass("finished")});window[callback](v,_proms[key])},200)}});$("body").on("click touch","a,area",function(e2){var el2=$(this);var link=el2.attr("href");if(link==""||$(this).closest(".cke").length==1||$(this).closest(".chosen-container").length==1||$(this).attr("target")=="_blank"||$(this).attr("target")=="_new"||$(this).hasClass("norm")||$(this).closest(".gm-style").length==1){}else{var local=false;var l=getLocation(link);var l2=getLocation(appSettings.Base);var url="home";local=l.hostname==l2.hostname;var url=l.pathname.split(l2.pathname);if(l.pathname=="/"||l.pathname=="/home"){url="home"}else{url=url.join("/")}if(local&&!cntrlon){e2.preventDefault();if(el2.hasAttr("stop"))e2.stopPropagation();pushURL(url+(l.search!=""?l.search:""))}else{}}});$("body").on("click touch","[h],[s]",function(e){var el=$(this);if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));var attrs=el.attr();var hI=Object.keys(attrs).indexOf("h");var sI=Object.keys(attrs).indexOf("s");if(sI<hI){$(el.attr("s")).show();$(el.attr("h")).hide()}else{$(el.attr("h")).hide();$(el.attr("s")).show()}if(el.hasAttr("stop"))e.stopPropagation()});$("body").on("click touch","[e]",function(e){var el=$(this);if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));if($($(this).attr("e")).is("input"))$($(this).attr("e")).val("");else $($(this).attr("e")).empty()});$("body").on("click touch","[f]",function(e2){var el2=$(this);$(el2.attr("f")).trigger("focus");if(el2.hasAttr("stop"))e2.stopPropagation()});$("body").on("click touch","[tgl]",function(e){var el=$(this);if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));el.toggleClass(el.attr("tgl"));el.toggleClass("toggled");if(el.hasAttr("stop"))e.stopPropagation()});$("body").on("click touch","[t]",function(e){var el=$(this);var tcn=el.attr("tcn")?el.attr("tcn"):"active";if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));$(el.attr("t")).toggleClass(tcn);el.toggleClass("toggled");if(el.hasAttr("stop"))e.stopPropagation()});$("body").on("click touch","[actv]",function(e2){let el2=$(this);if(el2.attr("actv")!="")$(el2.attr("actv")).removeClass("active");el2.addClass("active");if(el2.hasAttr("stop"))e2.stopPropagation()});$("body").on("click touch","[actvt]",function(e2){let el2=$(this);if(el2.attr("actvt")!="")$(el2.attr("actvt")).removeClass("active");if(el2.hasClass("active"))el2.removeClass("active");else el2.addClass("active");if(el2.hasAttr("stop"))e2.stopPropagation()});$("body").on("click touch","[close-notify]",function(e2){var tis=$(this).parent();tis.fadeOut(function(){tis.remove()});if($(this).hasAttr("stop"))e2.stopPropagation()});let _keyInt;$("body").on("change blur focus keyup keydown input","[icons_search]",function(ev2){var key=$.trim($(this).val());var outlet=$($(this).attr("icons_outlet"));var count_outlet=$($(this).attr("icons_count_outlet"));clearTimeout(_keyInt);if(key==""||key.length<=2){count_outlet.hide();outlet.html("")}else{_keyInt=setTimeout(function(){fetch("https://api.iconify.design/search?query="+key+"&limit=250",{method:"GET"}).then(function(response){return response.json()}).then(function(r){count_outlet.show();let icons=r.icons;outlet.html("");count_outlet.html((r.total>250?r.total+"+":r.total)+" icons found..");for(let i=0;i<icons.length;i++){outlet.append(`
114
+ var _navT=0;var _nav=false;var _pbc;var _vuid={};$("body").on("click touch tap",function(e2){try{var _AC=typeof AudioContext!=="undefined"?AudioContext:typeof webkitAudioContext!=="undefined"?webkitAudioContext:null;if(!_AC)return;if(!_pbc)_pbc=new _AC;if(_pbc.state=="suspended"){_pbc.resume().then(()=>{})}}catch(err){}});$("body").on("click touch",".navTgl",function(e2){_nav=false;clearTimeout(_navT);if($("nav").hasClass("nav-opened")){$("nav").removeClass("nav-opened");$("body").removeClass("nav-opened")}else{$("nav").addClass("nav-opened");$("body").addClass("nav-opened");_navT=setTimeout(function(){_nav=true},20)}e2.stopPropagation()});$(document).keydown(function(e2){var keyCode=e2.keyCode||e2.which;if(keyCode==27){e2.preventDefault();e2.stopPropagation();if($("[loader]").length){if(_loader.options.Dismissible)_loader.hide()}else if(_nav){$("nav").removeClass("nav-opened");$("body").removeClass("nav-opened");_nav=false}else{if($("popup").length&&$("droplet").length){$("droplet").removeClass("is-visible").each(function(){var p=$(this);setTimeout(function(){p.remove()},150)})}else if($("popup").length){$("[close-modal]:last").click()}else{$("body").css({overflow:"visible"});$("droplet").removeClass("is-visible").each(function(){var p=$(this);setTimeout(function(){p.remove()},150)})}}}});_csswrk.on("css-ready",function(e2){let data=e2.originalEvent.data;_vuid[data.key].resolve(data.csses)});function _upwrkStarted(){if(!_upwrk.isStarted())_upwrk.start();return _upwrk}_upwrk.on("message",function(e2){let data=e2.originalEvent.data});_upwrk.on("files-added",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"files-added",data.files,data.newfiles)});_upwrk.on("queue-changed",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"queue-changed",data.files)});_upwrk.on("file-removed",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"file-removed",data.files,data.removedfile)});_upwrk.on("upload-start",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"upload-start",data.files)});_upwrk.on("file-uploaded",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"file-uploaded",data.files,data.file)});_upwrk.on("upload-progress",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"upload-progress",data.files)});_upwrk.on("upload-complete",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"upload-complete",data.files)});_upwrk.on("upload-stop",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"upload-stop",data.files)});_upwrk.on("queue-empty",function(e2){let data=e2.originalEvent.data;processEv(e2,$('[upid="'+data.upid+'"]'),"queue-empty")});$.fn.extend({startUpload:function(){if(this.hasAttr("up")){_upwrkStarted().trigger("start-upload",{"upid":this.attr("upid")})}return this},stopUpload:function(){if(this.hasAttr("up")){_upwrkStarted().trigger("stop-upload",{"upid":this.attr("upid")})}return this},removeFile:function(id){if(this.hasAttr("up")){_upwrkStarted().trigger("remove-file",{"upid":this.attr("upid"),"id":id})}return this}});$("body").on("FilesAdded","[up]",function(e2,files){let t=$(this);var size=t.attr("data-mxs")?t.attr("data-mxs"):"10mb";_upwrkStarted().trigger("handle-files",{"upid":t.attr("upid"),"files":files});processEv(e2,t,"browse-files",files)});$("body").on("dragover","[up] [drpzn]",function(e2){e2.stopPropagation();e2.preventDefault();let t=$(this).closest("[up]");$(this).addClass("dragover");e2.originalEvent.dataTransfer.dropEffect="copy";return false});$("body").on("dragleave","[up] [drpzn]",function(e2){e2.stopPropagation();e2.preventDefault();$(this).removeClass("dragover")});$("body").on("drop","[up] [drpzn]",function(e2){e2.stopPropagation();e2.preventDefault();var files=e2.originalEvent.dataTransfer?.files||e2.target?.files;let t=$(this).closest("[up]");$(this).removeClass("dragover");t.trigger("FilesAdded",[files]);return false});$("body").on("click","[up] [browse]",function(e2){e2.stopPropagation();e2.preventDefault();let t=$(this).closest("[up]");t.find("[files]").click()});$("body").on("change","[up] [files]",function(e2){e2.stopPropagation();e2.preventDefault();var files=e2.originalEvent.dataTransfer?.files||e2.target?.files;let t=$(this).closest("[up]");t.trigger("FilesAdded",[files])});$("body").on("click touch","[ctc]",function(ev){var el=$(this);var ctc=el.attr("ctc");var selector=el;if(ctc.indexOf("el.")!==-1){selector=eval(ctc)}else if(ctc!="")selector=$(ctc);if(!navigator.clipboard){var temp=$("<textarea class='pf' style='left: -40%;' />");$("body").append(temp);temp.val(selector.text()).select();document.execCommand("copy");temp.remove()}else{navigator.clipboard.writeText(selector.text()).then(function(){},function(err){var temp2=$("<textarea class='pf' style='left: -40%;' />");$("body").append(temp2);temp2.val(selector.text()).select();document.execCommand("copy");temp2.remove()})}if(el.hasAttr("stop"))ev.stopPropagation()});$("body").on("click touch","[scroll-left]",function(ev2){var _el=$(this);var _wrap=_el.closest("[wrapper]");if(_wrap.length){var _p=_wrap.find("div").first();_p.stop().animate({scrollLeft:_p.scrollLeft()-100},{duration:200,easing:"easeOutCirc",complete:function(){}})}});$("body").on("click touch","[scroll-right]",function(ev2){var _el=$(this);var _wrap=_el.closest("[wrapper]");if(_wrap.length){var _p=_wrap.find("div").first();_p.stop().animate({scrollLeft:_p.scrollLeft()+100},{duration:200,easing:"easeOutCirc",complete:function(){}})}});$("body").on("click touch","[scroll-top]",function(ev2){var _el=$(this);var _wrap=_el.closest("[wrapper]");if(_wrap.length){var _p=_wrap.find("div").first();_p.stop().animate({scrollTop:_p.scrollTop()-100},{duration:200,easing:"easeOutCirc",complete:function(){}})}});$("body").on("click touch","[scroll-bottom]",function(ev2){var _el=$(this);var _wrap=_el.closest("[wrapper]");if(_wrap.length){var _p=_wrap.find("div").first();_p.stop().animate({scrollTop:_p.scrollTop()+100},{duration:200,easing:"easeOutCirc",complete:function(){}})}});function bs(t){$("body").css({overflow:t?"visible":"hidden"})}$("body").on("open-modal","[modal]",function(ev2){var el2=$(this);var n=popups.modals.length;var _view=el2.attr("modal");bs();var va=el2.attr("modal-align")??"center middle";var padding=el2.attr("modal-spacing")??"";var ov=el2.attr("modal-ov")??"bgb20";var icon=el2.attr("modal-icon")??"mdi:close";va=va.split(" ");if(va.length==2){va={h:["left","center","right"].indexOf(va[0])>=0?va[0]:"center",v:["top","center","middle","bottom"].indexOf(va[1])>=0?va[1]:"middle"}}else{va={h:"center",v:"middle"};setError(null,"Modal align should be modal-align='vertical horizontal'.")}if(!el2.hasAttr("data-modal")){var selector2="modals_"+n;var popup=`<popup class="ov df pf [c] z10000 oya [ov]"><div pop-c class="ma w100 [va] [ta] [p]"><flx pop-h class="ps t0 as z100"><flx class="f1 fc as"><div pop-t>[t]</div><div pop-d>[d]</div></flx><div pop-x close-modal data-dismiss="modal" aria-label="Close"><span aria-hidden="true" class="cc c iconify" data-icon="[i]"></span></div></flx><div pop-b>[b]</div><div pop-f class='ps b0 z100'>[f]</div></div></popup>`;var verticalAlign=va["v"]=="center"||va["v"]=="middle"?"vm":va["v"]=="top"?"vt":"vb";var textAlign=va["h"]=="center"?"c":va["h"]=="left"?"l":"r";popup=popup.split("[va]").join(verticalAlign).split("[p]").join(padding).split("[ta]").join(textAlign).split("[ov]").join(ov).split("[i]").join(icon);let attrsData={t:el2.attr("modal-title")??"New Modal",d:el2.attr("modal-description")??"",c:el2.attr("modal-class")??""};if(_view!=""){popup=popup.split("[t]").join(attrsData.t);popup=popup.split("[d]").join(attrsData.d);popup=popup.split("[b]").join('<div for-modal="'+selector2+`" view='`+_view+"'></div>");popup=popup.split("[f]").join("")}else{var c=getComData(el2);if(!c){if(el2.find("modal").length>0){var modalData=el2.find("modal:first");var c=getComData(modalData,true)}}if(c){if(c.Title)popup=popup.split("[t]").join(c.Title??attrsData.t);popup=popup.split("[d]").join(c.Description??attrsData.d);popup=popup.split("[b]").join(c.Body??"");popup=popup.split("[f]").join(c.Footer??"")}else{popup=popup.split("[t]").join(attrsData.t);popup=popup.split("[d]").join(attrsData.d);popup=popup.split("[b]").join("");popup=popup.split("[f]").join("")}}popup=popup.split("[c]").join(attrsData.c);var newModal=$(popup);newModal.attr("id",selector2).appendTo("body");let modal2=$("#"+selector2);el2.trigger("modal-open",[modal2]);modal2.data("props",el2.data("props"));if(_view!=""){let _host=newModal.find("[for-modal]");let _mp=modal2.data("props");_host.data("props",_mp!==void 0?{modal:_mp}:{});mountModalView(_host.get(0),_view)}modal2.addClass("modal-open").delay(10).queue(function(next){$(this).addClass("in");next()});$(this).attr("data-modal",selector2);popups["modals"].push(newModal.get(0));globalWatch()}if(el2.hasAttr("stop"))ev2.stopPropagation()});$("body").on("click touch","[modal]",function(ev2){let modalTriggered=false;var obj={};$.each($(this)[0].attributes,function(){if(this.value.toLowerCase()=="openmodal"){modalTriggered=true;return}obj[this.name]=this.value});if(!modalTriggered){$(this).trigger("open-modal")}});$("body").on("modal-close","[\\@modal-close]",function(ev,modal,cb){let el=$(this),_v=el.attr("@modal-close");let props=modal.data("props");let _fn=_v.split("(")[0];try{if(typeof window[_v]==="function")cb(window[_fn](ev,el,modal,props));else{let _eva=eval(_v);cb(_eva)}}catch(e2){cb()}});$("body").on("modal-open","[\\@modal-open]",function(ev,modal){let el=$(this),_v=el.attr("@modal-open");let _fn=_v.split("(")[0];try{if(typeof window[_v]==="function"){var _data=window[_fn](ev,el,modal);modal.data("props",_data)}else{let _eva=eval(_v);modal.data("props",_eva)}}catch(e2){}});function evalEvAttr(_v2,ev2,el2,n,arg1,arg2,arg3){let _fn2=_v2.split("(")[0];try{let _rawEl=el2[0];let _ownFn=null;if(_v2===_fn2){for(let _e=_rawEl&&_rawEl._ownerRe,_n=0;_e&&_e.view&&_n<50;_e=_e.view._pv,_n++){let _fns=_e.view.fns;if(_fns&&Object.prototype.hasOwnProperty.call(_fns,_fn2)&&typeof _fns[_fn2]==="function"){_ownFn=_fns[_fn2];break}}}if(_ownFn||typeof window[_v2]==="function"){ev2["cType"]=n;let _handler=_ownFn||window[_fn2];var _data2=arg3?_handler(ev2,el2,arg1,arg2,arg3):arg2?_handler(ev2,el2,arg1,arg2):arg1?_handler(ev2,el2,arg1):_handler(ev2,el2);return _data2}else{let _eva2=_evalEventScopedExpr(_rawEl&&_rawEl._ownerRe,_v2,{ev:ev2,el:el2,n,arg1,arg2,arg3});return _eva2}}catch(e2){return false}}function processEv(ev2,el2,n,arg1,arg2,arg3){if(el2.hasAttr("stop"))ev2.stopPropagation();if(n=="focusin")n="focus";else if(n=="focusout")n="blur";if(!el2.hasAttr("@"+n))return;if(el2.hasAttr("@before-"+n)){if(!evalEvAttr(el2.attr("@before-"+n),ev2,el2,n,arg1,arg2,arg3))return}let _v2=el2.attr("@"+n);if(_v2.toLowerCase()=="openmodal"){el2.trigger("open-modal");return}evalEvAttr(_v2,ev2,el2,n,arg1,arg2,arg3)}$("body").on("click touch","[ci]",function(ev2){var el2=$(this);var f=el2.closest("form");var inputs=$("");if(el2.attr("ci")!=""){let ci=el2.attr("ci").split(",");for(let index=0;index<ci.length;index++){const selector2=ci[index];inputs=inputs.add(f.find(selector2))}}else{inputs=f.find($("input[\\:required],select[\\:required],textarea[\\:required]"))}f.removeClass("validation-error");for(var i=0;i<inputs.length;i++){if(!checkFormInputs(f,inputs[i])){f.addClass("validation-error");break}}});$("body").on("doubletap","[\\@dblclick]",function(ev2){processEv(ev2,$(this),"dblclick")});$("body").on("doubletap","[\\@dbltap]",function(ev2){processEv(ev2,$(this),"dbltap")});$("body").on("singletap","[\\@singleclick]",function(ev2){processEv(ev2,$(this),"singleclick")});$("body").on("singletap","[\\@singletap]",function(ev2){processEv(ev2,$(this),"singletap")});$("body").on("taphold","[\\@taphold]",function(ev2){processEv(ev2,$(this),"taphold")});$("body").on("taphold","[\\@clickhold]",function(ev2){processEv(ev2,$(this),"clickhold")});$("body").on("click touch","[\\@click]",function(ev2){processEv(ev2,$(this),"click")});$("body").on("tap","[\\@tap]",function(ev2){processEv(ev2,$(this),"tap")});$("body").on("tap2","[\\@click2]",function(ev2){processEv(ev2,$(this),"click2")});$("body").on("tap2","[\\@tap2]",function(ev2){processEv(ev2,$(this),"tap2")});$("body").on("tap2hold","[\\@click2hold]",function(ev2){processEv(ev2,$(this),"click2hold")});$("body").on("tap2hold","[\\@tap2hold]",function(ev2){processEv(ev2,$(this),"tap2hold")});$("body").on("orientationchange","[\\@orientationchange]",function(ev2){processEv(ev2,$(this),"orientationchange")});$("body").on("swipe swipeleft swipedown swipeend swipeup swiperight","[\\@swipe],[\\@swipe-down],[\\@swipe-up],[\\@swipe-left],[\\@swipe-right],[\\@swipe-end]",function(ev2){let _v2=ev2.type.length==5?"swipe":ev2.type.split("swipe").join("swipe-");processEv(ev2,$(this),_v2)});$("body").on("mouseover","[\\@mouse-over]",function(ev2){processEv(ev2,$(this),"mouse-over")});$("body").on("mousedown touchstart","[\\@mouse-down]",function(ev2){processEv(ev2,$(this),"mouse-down")});$("body").on("tapstart","[\\@tap-start]",function(ev2){processEv(ev2,$(this),"tap-start")});$("body").on("tapend","[\\@tap-end]",function(ev2){processEv(ev2,$(this),"tap-end")});$("body").on("tapmove","[\\@tap-move]",function(ev2){processEv(ev2,$(this),"tap-move")});$("body").on("mouseup touchend","[\\@mouse-up]",function(ev2){processEv(ev2,$(this),"mouse-up")});$("body").on("mouseout","[\\@mouse-out]",function(ev2){processEv(ev2,$(this),"mouse-out")});$("body").on("mouseenter touchmove","[\\:hover]",function(ev2){let _s=$(this).attr(":hover");$(this).attr("style",($(this).hasAttr("style")?$(this).attr("style").rtrim(";")+";":"")+_s)});$("body").on("mouseleave touchend","[\\:hover]",function(ev2){let _s=$(this).attr(":hover");$(this).attr("style",$(this).attr("style").split(_s).join(""))});$("body").on("mouseenter","[\\@mouse-enter]",function(ev2){processEv(ev2,$(this),"mouse-enter")});$("body").on("mouseleave","[\\@mouse-leave]",function(ev2){processEv(ev2,$(this),"mouse-leave")});$("body").on("mousemove","[\\@mouse-move]",function(ev2){processEv(ev2,$(this),"mouse-move")});$("body").on("touchmove","[\\@mouse-move]",function(ev2){processEv(ev2,$(this),"mouse-move")});$("body").on("sort","[\\@sort]",function(ev2,ui){processEv(ev2,$(this),"sort",ui)});$("body").on("sortupdate","[\\@sort-update]",function(ev2,ui){processEv(ev2,$(this),"sort-update",ui)});$("body").on("sortchange","[\\@sort-change]",function(ev2,ui){processEv(ev2,$(this),"sort-change",ui)});$("body").on("sortstart","[\\@sort-start]",function(ev2,ui){processEv(ev2,$(this),"sort-start",ui)});$("body").on("sortstop","[\\@sort-stop]",function(ev2,ui){processEv(ev2,$(this),"sort-stop",ui)});$("body").on("sortbeforestop","[\\@sort-before-stop]",function(ev2,ui){processEv(ev2,$(this),"sort-before-stop",ui)});$("body").on("drag","[\\@drag]",function(ev2,ui){processEv(ev2,$(this),"drag",ui)});$("body").on("dragstart","[\\@drag-start]",function(ev2,ui){processEv(ev2,$(this),"drag-start",ui)});$("body").on("dragstop","[\\@drag-stop]",function(ev2,ui){processEv(ev2,$(this),"drag-stop",ui)});$("body").on("drop","[\\@drop]",function(ev2,ui){processEv(ev2,$(this),"drop",ui)});$("body").on("select2:select","[sl]",function(e2){$(this).trigger("sl-select",[e2.params&&e2.params.data,e2])});$("body").on("select2:unselect","[sl]",function(e2){$(this).trigger("sl-unselect",[e2.params&&e2.params.data,e2])});$("body").on("sl-select","[\\@sl-select]",function(ev2,data,e2){ev2.params=e2&&e2.params;processEv(ev2,$(this),"sl-select",data)});$("body").on("sl-unselect","[\\@sl-unselect]",function(ev2,data,e2){ev2.params=e2&&e2.params;processEv(ev2,$(this),"sl-unselect",data)});$("body").on("clear","[sl]",function(ev2,ui){let t=$(this);t.empty().change();try{let opts=t.data("select2")?.options?.options;opts.data=null;t.select2(opts)}catch(e2){cl(e2)}});$("body").on("change blur focus keyup keydown input","[\\@input],[\\@change],[\\@blur],[\\@focus],[\\@keyup],[\\@keydown]",function(ev2){var t=ev2.type==="focusin"?"focus":ev2.type==="focusout"?"blur":ev2.type;processEv(ev2,$(this),t)});$("body").on("click touch","[close-modal]",function(ev2){var el2=$(this);var modal2=el2.closest("popup");var id=modal2.attr("id");var element_to_remove=$("#"+id).get(0);var index=$.inArray(element_to_remove,popups.modals);var modalOwner=$("[modal][data-modal="+id+"]");if(el2.hasAttr("stop"))ev2.stopPropagation();ev2.preventDefault();if(modalOwner.hasAttr("@modal-beforeclose")){try{let _bv=modalOwner.attr("@modal-beforeclose");let _result=evalEvAttr(_bv,ev2,el2,"modal-beforeclose",modalOwner);if(_result===false)return}catch(e2){}}if(modalOwner.hasAttr("@modal-close")){modalOwner.trigger("modal-close",[modal2,function(res){if(res===false)return;$(".select2-container:not(.select2),.colorpicker.colorpicker-visible").remove();if(index>-1){$("[modal][data-modal="+id+"]").removeAttr("data-modal");modal2.removeClass("in").delay(150).queue(function(next){$(this).remove();if(popups.modals.length==0)bs(true);next()});popups.modals.splice(index,1)}}])}else{$(".select2-container:not(.select2),.colorpicker.colorpicker-visible").remove();if(index>-1){$("[modal][data-modal="+id+"]").removeAttr("data-modal");modal2.removeClass("in").delay(150).queue(function(next){$(this).remove();if(popups.modals.length==0)bs(true);next()});popups.modals.splice(index,1)}}});$("body").on("change keyup","[password]",function(e2){let el2=$(this);let lbl=el2.closest("label");let f=el2.closest("form");var v=$.trim($(this).val());let allCls="has-spaces weak strong very-strong medium";let cls=passwordStrength(v);el2.removeClass(allCls).addClass(cls);if(f.length)f.removeClass(allCls).addClass(cls);if(lbl.length)lbl.removeClass(allCls).addClass(cls);if(!$(this).next().hasClass("passStrength"))$(this).after("<span class='passStrength'></span>");$(this).parent().find(".passStrength").removeClass(allCls).addClass(cls)});$("body").on("change keyup","[username]",function(e2){var keyCode=e2.keyCode||e2.which;if(keyCode!=9&&keyCode!=16&&keyCode!=27&&keyCode!=93&&keyCode!=91&&keyCode!=17&&keyCode!=18){var el2=$(this);let f=el2.closest("form");checkFormInputs(f,el2,true)}});$("body").on("focus","input:not(.select2-search__field,.mobinit),textarea,select",function(ev2){var el2=$(this);var f=el2.closest("form");let lbl=el2.closest("label");if(f.length)f.addClass("focused");if(lbl.length)lbl.addClass("focused");el2.parent().addClass("focused");el2.addClass("focused")});$("body").on("blur","input:not(.select2-search__field,.mobinit),textarea,select",function(ev2){var el2=$(this);var f=el2.closest("form");if(f.length)f.removeClass("focused");el2.parent().removeClass("focused");el2.removeClass("focused")});$("body").on("change keyup","input:not(.select2-search__field,.mobinit),textarea,select",function(ev2){var el2=$(this);let f=el2.closest("form");checkFormInputs(f,el2,true)});var _lookups=0;var _debs={};var _proms={};$("body").on("change keyup","[\\:lookup]",function(e2){var keyCode=e2.keyCode||e2.which;if(keyCode!=9&&keyCode!=16&&keyCode!=27&&keyCode!=93&&keyCode!=91&&keyCode!=17&&keyCode!=18){var el2=$(this);if(!el2.attr("data-i")){el2.attr("data-i",_lookups);_lookups++}var key="lu_"+el2.attr("data-i");clearTimeout(_debs[key]);var v=$(this).val();var callback=el2.attr(":lookup-callback");if(!_proms.hasOwnProperty(key)){_proms[key]=defer();_proms[key].then(function(val){el2.addClass("finished").removeClass("pending")}).catch(reason=>{el2.addClass("pending").removeClass("finished")})}else{}el2.addClass("pending").removeClass("finished");_debs[key]=setTimeout(function(){_proms[key].reject();_proms[key]=defer();_proms[key].then(function(val){el2.addClass("finished").removeClass("pending")}).catch(reason=>{el2.addClass("pending").removeClass("finished")});window[callback](v,_proms[key])},200)}});$("body").on("click touch","a,area",function(e2){var el2=$(this);var link=el2.attr("href");if(link==""||$(this).closest(".cke").length==1||$(this).closest(".chosen-container").length==1||$(this).attr("target")=="_blank"||$(this).attr("target")=="_new"||$(this).hasClass("norm")||$(this).closest(".gm-style").length==1){}else{var local=false;var l=getLocation(link);var l2=getLocation(appSettings.Base);var url="home";local=l.hostname==l2.hostname;var url=l.pathname.split(l2.pathname);if(l.pathname=="/"||l.pathname=="/home"){url="home"}else{url=url.join("/")}if(local&&!cntrlon){if(l.hash&&l.pathname==location.pathname&&l.search==location.search)return;e2.preventDefault();if(el2.hasAttr("stop"))e2.stopPropagation();pushURL(url+(l.search!=""?l.search:"")+(l.hash||""))}else{}}});$("body").on("click touch","[h],[s]",function(e){var el=$(this);if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));var attrs=el.attr();var hI=Object.keys(attrs).indexOf("h");var sI=Object.keys(attrs).indexOf("s");if(sI<hI){$(el.attr("s")).show();$(el.attr("h")).hide()}else{$(el.attr("h")).hide();$(el.attr("s")).show()}if(el.hasAttr("stop"))e.stopPropagation()});$("body").on("click touch","[e]",function(e){var el=$(this);if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));if($($(this).attr("e")).is("input"))$($(this).attr("e")).val("");else $($(this).attr("e")).empty()});$("body").on("click touch","[f]",function(e2){var el2=$(this);$(el2.attr("f")).trigger("focus");if(el2.hasAttr("stop"))e2.stopPropagation()});$("body").on("click touch","[tgl]",function(e){var el=$(this);if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));el.toggleClass(el.attr("tgl"));el.toggleClass("toggled");if(el.hasAttr("stop"))e.stopPropagation()});$("body").on("click touch","[t]",function(e){var el=$(this);var tcn=el.attr("tcn")?el.attr("tcn"):"active";if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));$(el.attr("t")).toggleClass(tcn);el.toggleClass("toggled");if(el.hasAttr("stop"))e.stopPropagation()});$("body").on("click touch","[actv]",function(e2){let el2=$(this);if(el2.attr("actv")!="")$(el2.attr("actv")).removeClass("active");el2.addClass("active");if(el2.hasAttr("stop"))e2.stopPropagation()});$("body").on("click touch","[actvt]",function(e2){let el2=$(this);if(el2.attr("actvt")!="")$(el2.attr("actvt")).removeClass("active");if(el2.hasClass("active"))el2.removeClass("active");else el2.addClass("active");if(el2.hasAttr("stop"))e2.stopPropagation()});$("body").on("click touch","[close-notify]",function(e2){var tis=$(this).parent();tis.fadeOut(function(){tis.remove()});if($(this).hasAttr("stop"))e2.stopPropagation()});let _keyInt;$("body").on("change blur focus keyup keydown input","[icons_search]",function(ev2){var key=$.trim($(this).val());var outlet=$($(this).attr("icons_outlet"));var count_outlet=$($(this).attr("icons_count_outlet"));clearTimeout(_keyInt);if(key==""||key.length<=2){count_outlet.hide();outlet.html("")}else{_keyInt=setTimeout(function(){fetch("https://api.iconify.design/search?query="+key+"&limit=250",{method:"GET"}).then(function(response){return response.json()}).then(function(r){count_outlet.show();let icons=r.icons;outlet.html("");count_outlet.html((r.total>250?r.total+"+":r.total)+" icons found..");for(let i=0;i<icons.length;i++){outlet.append(`
115
115
  <li class="w20 md_w25 m_w33 m_m_w50 c icoLi" data-class="`+icons[i]+`"><div><span class="iconify fs24 mb5 lh40 g_nm" style="height: 40px;" data-icon="`+icons[i]+`" ></span><span class="name-class">`+icons[i]+`</span></div></li>
116
116
  `)}})},400)}});$("body").on("click touch","[alert]",function(e2){notify($(this).attr("alert-t"),$(this).attr("alert"),$(this).attr("alert-icon")?$(this).attr("alert-icon"):"alert-circle",$(this).attr("alert-type")?$(this).attr("alert-type"):"alert")});$("body").on("click touch","[rcl],[acl]",function(e){var el=$(this);if(el.hasAttr("confirm")){if(!confirm(el.attr("confirm")))return false}if(el.hasAttr("econfirm"))eval(el.attr("econfirm"));if(el.hasAttr("acl")&&el.hasAttr("rcl")){var attrs=el.attr();var rclcn=el.attr("rclcn")?el.attr("rclcn"):"active";var aclcn=el.attr("aclcn")?el.attr("aclcn"):"active";var rCl=Object.keys(attrs).indexOf("rcl");var aCl=Object.keys(attrs).indexOf("acl");if(aCl<rCl){$(el.attr("acl")).addClass(aclcn);el.addClass("added").removeClass("removed");if(el.hasAttr("stop"))e.stopPropagation();$(el.attr("rcl")).removeClass(rclcn);el.addClass("removed").removeClass("added");if(el.hasAttr("stop"))e.stopPropagation()}else{$(el.attr("rcl")).removeClass(rclcn);el.addClass("removed").removeClass("added");if(el.hasAttr("stop"))e.stopPropagation();$(el.attr("acl")).addClass(aclcn);el.addClass("added").removeClass("removed");if(el.hasAttr("stop"))e.stopPropagation()}}else{if(el.hasAttr("rcl")){var rclcn=el.attr("rclcn")?el.attr("rclcn"):"active";$(el.attr("rcl")).removeClass(rclcn);el.addClass("removed").removeClass("added");if(el.hasAttr("stop"))e.stopPropagation()}else{var aclcn=el.attr("aclcn")?el.attr("aclcn"):"active";$(el.attr("acl")).addClass(aclcn);el.addClass("added").removeClass("removed");if(el.hasAttr("stop"))e.stopPropagation()}}});$("body").on("click touch","[st]",function(e2){st($(this).attr("st"))});class Loader{options={Dismissible:true,Class:"loader",Message:"Please Wait..."};constructor(options){for(var k in options){this.options[k]=options[k]}}dismiss(){if(this.options.Dismissible){this.hide()}}init(){let l=`
117
117
  <div loader class="${this.options.Class}">