@lmjs/core 2.8.5 → 2.9.0
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.
- package/cdn/integrity.json +1 -1
- package/dist/lumenjs-core.js +1 -1
- package/package.json +1 -1
- package/src/lstnrs.js +98 -0
package/cdn/integrity.json
CHANGED
package/dist/lumenjs-core.js
CHANGED
|
@@ -111,7 +111,7 @@ var LM_BUILD=0;var LM_VERSION="dev";var _lmBuildCache=0;function _lmVersionOf(bu
|
|
|
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||typeof _lmStatic!=="undefined"?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 if(typeof _lmStatic==="undefined"){syncViewFiles()}});Nuke.on("files-changed",function(){if(!_beaTn&&typeof _lmStatic==="undefined")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){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(`
|
|
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)}fireClickToggled(e2,$(this));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}}var _scrollEndT=new WeakMap;var _scrollLast=new WeakMap;var _SCROLL_ATTRS=["@scroll","@scroll-start","@scroll-end","@scroll-top","@scroll-bottom","@scroll-left","@scroll-right"];function _hasScrollAttrs(n){for(var i=0;i<_SCROLL_ATTRS.length;i++){if(n.getAttribute(_SCROLL_ATTRS[i])!=null)return true}return false}function _scrollNodes(ev2){var t=ev2.target;if(t&&t.nodeType===9){return[document.scrollingElement||document.documentElement,document.body]}return t&&t.nodeType===1?[t]:[]}function _scrollEdges(n){var top=n.scrollTop,left=n.scrollLeft;return{atTop:top<=0,atBottom:n.scrollHeight-top-n.clientHeight<=1,atLeft:left<=0,atRight:n.scrollWidth-left-n.clientWidth<=1}}function _onAnyScroll(ev2){var nodes=_scrollNodes(ev2);for(var i=0;i<nodes.length;i++){(function(n){if(!n||!_hasScrollAttrs(n))return;var now=Date.now();if(now-(_scrollLast.get(n)||0)>150)processEv(ev2,$(n),"scroll-start");_scrollLast.set(n,now);processEv(ev2,$(n),"scroll");clearTimeout(_scrollEndT.get(n));_scrollEndT.set(n,setTimeout(function(){var e2=_scrollEdges(n);processEv(ev2,$(n),"scroll-end");if(e2.atTop)processEv(ev2,$(n),"scroll-top");if(e2.atBottom)processEv(ev2,$(n),"scroll-bottom");if(e2.atLeft)processEv(ev2,$(n),"scroll-left");if(e2.atRight)processEv(ev2,$(n),"scroll-right")},150))})(nodes[i])}}try{document.addEventListener("scroll",_onAnyScroll,{capture:true,passive:true})}catch(e2){document.addEventListener("scroll",_onAnyScroll,true)}function fireClickToggled(ev2,el2){if(el2&&el2[0]&&el2[0].getAttribute("@click-toggled")!=null){processEv(ev2,el2,"click-toggled")}}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");fireClickToggled(e,el);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");fireClickToggled(e,el);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");fireClickToggled(e2,el2);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");fireClickToggled(e2,el2);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}">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmjs/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "LumenJS reactive core runtime — the reactive engine, HTML/JS AST compiler, realtime socket client, and delegated event listeners powering LumenJS applications.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/",
|
package/src/lstnrs.js
CHANGED
|
@@ -37,6 +37,7 @@ $("body").on("click touch", ".navTgl", function (e) {
|
|
|
37
37
|
_nav = true;
|
|
38
38
|
}, 20);
|
|
39
39
|
}
|
|
40
|
+
fireClickToggled(e, $(this));
|
|
40
41
|
e.stopPropagation();
|
|
41
42
|
});
|
|
42
43
|
|
|
@@ -574,6 +575,99 @@ function evalEvAttr(_v, ev, el, n, arg1, arg2, arg3) {
|
|
|
574
575
|
}
|
|
575
576
|
}
|
|
576
577
|
|
|
578
|
+
/****** @scroll family — ONE capture-phase listener for the whole page ******
|
|
579
|
+
* 2026-12-01: V1 attached these per element in applyTriggers(), re-run on every
|
|
580
|
+
* globalWatch() pass; V2 never ported that pass, so @scroll and its siblings
|
|
581
|
+
* silently did nothing here. They cannot use the body delegation every other
|
|
582
|
+
* @ event uses: a `scroll` event does not bubble. One listener in the CAPTURE
|
|
583
|
+
* phase sees every scroll on the page — elements, the document and the window —
|
|
584
|
+
* whether the element was there at load or was rendered a second ago, with no
|
|
585
|
+
* listeners left behind by a re-render and nothing to remember to call.
|
|
586
|
+
*
|
|
587
|
+
* @scroll every scroll event, as it happens
|
|
588
|
+
* @scroll-start the first scroll of a burst (150ms of quiet before it)
|
|
589
|
+
* @scroll-end 150ms after the last scroll of a burst
|
|
590
|
+
* @scroll-top the top was reached (checked at scroll-end)
|
|
591
|
+
* @scroll-bottom the bottom was reached
|
|
592
|
+
* @scroll-left the left edge was reached
|
|
593
|
+
* @scroll-right the right edge was reached
|
|
594
|
+
*
|
|
595
|
+
* Signature is the usual (ev, el); `el` is the element that scrolled. When the
|
|
596
|
+
* page itself scrolls, el is <html> (document.scrollingElement) and the same
|
|
597
|
+
* attributes on <body> are honoured as well, because that is where V1 sites
|
|
598
|
+
* put them.
|
|
599
|
+
*/
|
|
600
|
+
var _scrollEndT = new WeakMap();
|
|
601
|
+
var _scrollLast = new WeakMap();
|
|
602
|
+
var _SCROLL_ATTRS = ["@scroll", "@scroll-start", "@scroll-end", "@scroll-top", "@scroll-bottom", "@scroll-left", "@scroll-right"];
|
|
603
|
+
|
|
604
|
+
function _hasScrollAttrs(n) {
|
|
605
|
+
for (var i = 0; i < _SCROLL_ATTRS.length; i++) {
|
|
606
|
+
if (n.getAttribute(_SCROLL_ATTRS[i]) != null) return true;
|
|
607
|
+
}
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
function _scrollNodes(ev) {
|
|
612
|
+
var t = ev.target;
|
|
613
|
+
if (t && t.nodeType === 9) {
|
|
614
|
+
return [document.scrollingElement || document.documentElement, document.body];
|
|
615
|
+
}
|
|
616
|
+
return t && t.nodeType === 1 ? [t] : [];
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
function _scrollEdges(n) {
|
|
620
|
+
var top = n.scrollTop, left = n.scrollLeft;
|
|
621
|
+
return {
|
|
622
|
+
atTop: top <= 0,
|
|
623
|
+
atBottom: n.scrollHeight - top - n.clientHeight <= 1,
|
|
624
|
+
atLeft: left <= 0,
|
|
625
|
+
atRight: n.scrollWidth - left - n.clientWidth <= 1
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function _onAnyScroll(ev) {
|
|
630
|
+
var nodes = _scrollNodes(ev);
|
|
631
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
632
|
+
(function (n) {
|
|
633
|
+
if (!n || !_hasScrollAttrs(n)) return;
|
|
634
|
+
var now = Date.now();
|
|
635
|
+
if (now - (_scrollLast.get(n) || 0) > 150) processEv(ev, $(n), "scroll-start");
|
|
636
|
+
_scrollLast.set(n, now);
|
|
637
|
+
processEv(ev, $(n), "scroll");
|
|
638
|
+
clearTimeout(_scrollEndT.get(n));
|
|
639
|
+
_scrollEndT.set(n, setTimeout(function () {
|
|
640
|
+
var e = _scrollEdges(n);
|
|
641
|
+
processEv(ev, $(n), "scroll-end");
|
|
642
|
+
if (e.atTop) processEv(ev, $(n), "scroll-top");
|
|
643
|
+
if (e.atBottom) processEv(ev, $(n), "scroll-bottom");
|
|
644
|
+
if (e.atLeft) processEv(ev, $(n), "scroll-left");
|
|
645
|
+
if (e.atRight) processEv(ev, $(n), "scroll-right");
|
|
646
|
+
}, 150));
|
|
647
|
+
})(nodes[i]);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
try {
|
|
652
|
+
document.addEventListener("scroll", _onAnyScroll, { capture: true, passive: true });
|
|
653
|
+
} catch (e) {
|
|
654
|
+
document.addEventListener("scroll", _onAnyScroll, true);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/****** @click-toggled — after a toggle attribute on the same element ran ******
|
|
658
|
+
* 2026-12-01: `tgl`, `t`, `actv`, `actvt` and the nav drawer (`.navTgl`) only
|
|
659
|
+
* ever changed a class; a view had no way to react to the NEW state except
|
|
660
|
+
* polling it. `@click-toggled="fn"` fires once the toggle has been applied —
|
|
661
|
+
* inside the handler `el.hasClass(...)` already reads the new state — with the
|
|
662
|
+
* usual (ev, el) signature, and `@before-click-toggled` works through
|
|
663
|
+
* processEv's existing before-guard as every other event does.
|
|
664
|
+
*/
|
|
665
|
+
function fireClickToggled(ev, el) {
|
|
666
|
+
if (el && el[0] && el[0].getAttribute("@click-toggled") != null) {
|
|
667
|
+
processEv(ev, el, "click-toggled");
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
577
671
|
function processEv(ev, el, n, arg1, arg2, arg3) {
|
|
578
672
|
if (el.hasAttr("stop")) ev.stopPropagation();
|
|
579
673
|
if (n == "focusin") n = "focus";
|
|
@@ -1272,6 +1366,7 @@ $("body").on("click touch", "[tgl]", function (e) {
|
|
|
1272
1366
|
if (el.hasAttr("econfirm")) eval(el.attr("econfirm"));
|
|
1273
1367
|
el.toggleClass(el.attr("tgl"));
|
|
1274
1368
|
el.toggleClass("toggled");
|
|
1369
|
+
fireClickToggled(e, el);
|
|
1275
1370
|
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1276
1371
|
});
|
|
1277
1372
|
|
|
@@ -1282,6 +1377,7 @@ $("body").on("click touch", "[t]", function (e) {
|
|
|
1282
1377
|
if (el.hasAttr("econfirm")) eval(el.attr("econfirm"));
|
|
1283
1378
|
$(el.attr("t")).toggleClass(tcn);
|
|
1284
1379
|
el.toggleClass("toggled");
|
|
1380
|
+
fireClickToggled(e, el);
|
|
1285
1381
|
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1286
1382
|
});
|
|
1287
1383
|
|
|
@@ -1289,6 +1385,7 @@ $("body").on("click touch", "[actv]", function (e) {
|
|
|
1289
1385
|
let el = $(this);
|
|
1290
1386
|
if (el.attr("actv") != "") $(el.attr("actv")).removeClass("active");
|
|
1291
1387
|
el.addClass("active");
|
|
1388
|
+
fireClickToggled(e, el);
|
|
1292
1389
|
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1293
1390
|
});
|
|
1294
1391
|
|
|
@@ -1297,6 +1394,7 @@ $("body").on("click touch", "[actvt]", function (e) {
|
|
|
1297
1394
|
if (el.attr("actvt") != "") $(el.attr("actvt")).removeClass("active");
|
|
1298
1395
|
if (el.hasClass("active")) el.removeClass("active");
|
|
1299
1396
|
else el.addClass("active");
|
|
1397
|
+
fireClickToggled(e, el);
|
|
1300
1398
|
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1301
1399
|
});
|
|
1302
1400
|
|