MCPcopy
hub / github.com/olton/metroui / off

Method off

lib/metro.js:60–60  ·  view source on GitHub ↗
(e,r)

Source from the content-addressed store, hash-verified

58 `}draw(){return this.template(this.children.map(Bo).join(""))}},pt=class extends Ke{constructor(e={}){super(e),this.options=e}template(){return`
59 <${this.options.tag?this.options.tag:this.tag} ${this.attributes} ${this.events}/>
60 `}},Va=(e=[],r=document.body,l={})=>{let t,o,{clear:a=!0,where:i="beforeend"}=l;o=typeof r=="string"?document.querySelector(r):r,o instanceof HTMLElement||(o=document.body),a&&(o.innerHTML=""),Array.isArray(e)||(e=[e]),t=e.map(Bo).join(""),o.insertAdjacentHTML(i,t)},Po=(e="",r)=>{let l=document.createElement("style");return r!==void 0&&l.setAttribute("media",r),l.appendChild(document.createTextNode(e)),document.head.appendChild(l),l},Ha=e=>Po(e).sheet,Ya=(e,r,l)=>{e.insertRule(r+"{"+l+"}")},cc=(e,r)=>{if(typeof e=="string"){Po(e,r);return}let l=Ha(r);for(let t in e)Ya(l,t,Ra(e[t]))},Ua=async(e,r)=>{let l=await fetch(e,r),t,o;if(!l.ok)throw new Error("HTTP error: "+l.status);t=await l.text(),o=document.createElement("style"),o.appendChild(document.createTextNode(t)),document.body.appendChild(o)},qa=async(e,r)=>{let l=await fetch(e,r),t,o;if(!l.ok)throw new Error("HTTP error: "+l.status);t=await l.text(),o=document.createElement("script"),o.appendChild(document.createTextNode(t)),document.body.appendChild(o)},Qe={};rc(Qe,{Abbr:()=>ri,Address:()=>ci,Anchor:()=>Oo,Area:()=>di,Article:()=>ai,Aside:()=>ni,AudioTag:()=>mi,Base:()=>Xa,Bdi:()=>ui,Bdo:()=>fi,Blockquote:()=>gi,Body:()=>Ja,Bold:()=>hi,Br:()=>$a,Button:()=>bi,Canvas:()=>xi,Caption:()=>ki,Cite:()=>Ci,Code:()=>zi,Col:()=>wi,Colgroup:()=>yi,Data:()=>_n,Dd:()=>Ti,Details:()=>Ei,Dfn:()=>Di,Dialog:()=>zn,Div:()=>Ii,Dl:()=>Si,Dt:()=>Ai,Em:()=>Bi,Embed:()=>Oi,Fieldset:()=>Ni,FigCaption:()=>Vi,Figure:()=>Ri,Footer:()=>si,Form:()=>Hi,Frame:()=>Ui,Frameset:()=>Yi,Head:()=>Ga,Header:()=>li,Heading:()=>ei,Hr:()=>ti,Html:()=>Wa,IFrame:()=>Wi,Img:()=>Qa,Input:()=>Ma,Ins:()=>Gi,Ital:()=>No,Kbd:()=>Xi,Label:()=>Zi,Legend:()=>Fi,Link:()=>Za,List:()=>Fo,ListItem:()=>Ji,Main:()=>gn,Map:()=>pi,Mark:()=>Ki,Meta:()=>bn,Nav:()=>ii,NoEmbed:()=>Li,NoFrames:()=>qi,NoScript:()=>Qi,Option:()=>tn,OptionGroup:()=>$i,Output:()=>en,Paragraph:()=>on,Picture:()=>Cn,Pre:()=>rn,Quoted:()=>Ro,Rp:()=>yn,Rt:()=>wn,Ruby:()=>kn,Script:()=>an,Section:()=>oi,Select:()=>Mi,Slot:()=>Sn,Small:()=>nn,Source:()=>ln,Span:()=>Ka,Strike:()=>Vo,Strong:()=>Pi,Sub:()=>sn,Summary:()=>ji,Sup:()=>cn,Table:()=>vi,TableCell:()=>Lo,TableRow:()=>_i,TableSection:()=>Me,Template:()=>vn,Textarea:()=>pn,Time:()=>dn,Title:()=>xn,Track:()=>mn,Var:()=>hn,VideoTag:()=>un,Wbr:()=>fn,a:()=>Tc,abbr:()=>Ec,address:()=>Oc,anchor:()=>Ac,area:()=>Nc,article:()=>jc,aside:()=>Ic,audio:()=>Fc,b:()=>Rc,base:()=>mc,bdi:()=>Vc,bdo:()=>Hc,blockquote:()=>Yc,body:()=>uc,br:()=>xc,button:()=>Uc,canvas:()=>qc,caption:()=>Gc,cite:()=>ep,code:()=>op,col:()=>Xc,colgroup:()=>Zc,data:()=>ld,dd:()=>ip,details:()=>np,dfn:()=>sp,dialog:()=>cd,div:()=>cp,dl:()=>rp,dt:()=>ap,em:()=>pp,embed:()=>up,fieldset:()=>gp,figcaption:()=>vp,figure:()=>xp,footer:()=>Pc,form:()=>kp,frame:()=>yp,frameset:()=>wp,h1:()=>kc,h2:()=>wc,h3:()=>yc,h4:()=>_c,h5:()=>Cc,h6:()=>zc,head:()=>dc,header:()=>Bc,hr:()=>vc,html:()=>pc,i:()=>mp,iframe:()=>Cp,img:()=>gc,input:()=>bc,ins:()=>zp,ital:()=>dp,kbd:()=>Sp,label:()=>Ap,legend:()=>bp,li:()=>jp,link:()=>hc,main:()=>td,map:()=>Lc,mark:()=>Dp,meta:()=>ed,nav:()=>Dc,noembed:()=>fp,noframes:()=>_p,noscript:()=>Ip,ol:()=>Ep,optgroup:()=>Pp,option:()=>Op,output:()=>Lp,p:()=>Np,picture:()=>sd,pre:()=>Fp,q:()=>Rp,quoted:()=>Vp,rp:()=>nd,rt:()=>id,ruby:()=>ad,s:()=>Yp,script:()=>Up,section:()=>Sc,select:()=>Bp,slot:()=>pd,small:()=>qp,source:()=>Wp,span:()=>fc,strike:()=>Hp,strong:()=>hp,sub:()=>Gp,summary:()=>lp,sup:()=>Xp,table:()=>Wc,tbody:()=>Jc,td:()=>tp,template:()=>rd,textarea:()=>Zp,tfoot:()=>Qc,th:()=>$c,thead:()=>Kc,time:()=>Jp,title:()=>od,tr:()=>Mc,track:()=>Kp,ul:()=>Tp,variable:()=>Qp,video:()=>Mp,wbr:()=>$p});var Wa=class extends T{tag="html";selfAttributes(){return["lang"]}},pc=(...e)=>new Wa(...e),Ga=class extends T{tag="head"},dc=(...e)=>new Ga(...e),Xa=class extends pt{tag="base";selfAttributes(){return["href","target"]}},mc=e=>new Xa(e),Za=class extends pt{tag="link";selfAttributes(){return["href","crossorigin","rel","media","integrity","hreflang","type","referrerpolicy","sizes","imagesrcset","imagesizes","as","blocking","color","disabled","fetchpriority"]}},hc=e=>new Za(e),Ja=class extends T{tag="body"},uc=(...e)=>new Ja(...e),Ka=class extends T{tag="span"},fc=(...e)=>new Ka(...e),Qa=class extends pt{tag="img";selfAttributes(){return["align","alt","border","height","hspace","ismap","longdesc","lowsrc","src","vspace","width","usemap"]}},gc=(e="",r="",l={})=>new Qa({...l,src:e,alt:r}),Ma=class extends pt{tag="input";selfAttributes(){return["accept","align","alt","autocomplete","autofocus","border","checked","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","list","max","maxlength","min","multiple","name","pattern","placeholder","size","src","step","type","value"]}},bc=(e={})=>new Ma(e),$a=class extends pt{tag="br";selfAttributes(){return["clear"]}},xc=e=>new $a(e),ti=class extends pt{tag="hr"},vc=e=>new ti(e),ei=class extends T{constructor(e="h1",...r){super(...r),this.tag=e}},xe=(e="h1",...r)=>new ei(e,...r),kc=(...e)=>xe("h1",...e),wc=(...e)=>xe("h2",...e),yc=(...e)=>xe("h3",...e),_c=(...e)=>xe("h4",...e),Cc=(...e)=>xe("h5",...e),zc=(...e)=>xe("h6",...e),oi=class extends T{tag="section"},Sc=(...e)=>new oi(...e),Oo=class extends T{tag="a";selfAttributes(){return["coords","download","hreflang","name","rel","rev","shape","target","type","href"]}},Ac=(...e)=>new Oo(...e),Tc=(...e)=>new Oo(...e),ri=class extends T{tag="abbr"},Ec=(...e)=>new ri(...e),ai=class extends T{tag="article"},jc=(...e)=>new ai(...e),ii=class extends T{tag="nav"},Dc=(...e)=>new ii(...e),ni=class extends T{tag="aside"},Ic=(...e)=>new ni(...e),li=class extends T{tag="header"},Bc=(...e)=>new li(...e),si=class extends T{tag="footer"},Pc=(...e)=>new si(...e),ci=class extends T{tag="address"},Oc=(...e)=>new ci(...e),pi=class extends T{tag="map";selfAttributes(){return["name"]}},Lc=(...e)=>new pi(...e),di=class extends pt{tag="area";selfAttributes(){return["alt","coords","hreflang","nohref","shape","target","type","href"]}},Nc=(e={})=>new di(e),mi=class extends T{tag="audio";selfAttributes(){return["autoplay","controls","loop","preload","src"]}},Fc=(...e)=>new mi(...e),hi=class extends T{tag="b"},Rc=(...e)=>new hi(...e),ui=class extends T{tag="bdi"},Vc=(...e)=>new ui(...e),fi=class extends T{tag="bdo"},Hc=(...e)=>new fi(...e),gi=class extends T{tag="blockquote";selfAttributes(){return["cite"]}},Yc=(...e)=>new gi(...e),bi=class extends T{tag="button";selfAttributes(){return["autofocus","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","type","value"]}},Uc=(...e)=>new bi(...e),xi=class extends T{tag="canvas";selfAttributes(){return["width","height"]}},qc=(...e)=>new xi(...e),vi=class extends T{tag="table";selfAttributes(){return["align","background","bgcolor","border","bordercolor","cellpadding","cellspacing","cols","frame","height","rules","summary","width"]}},Wc=(...e)=>new vi(...e),ki=class extends T{tag="caption";selfAttributes(){return["align","valign"]}},Gc=(...e)=>new ki(...e),wi=class extends pt{tag="col";selfAttributes(){return["align","valign","char","charoff","span","width"]}},Xc=e=>new wi(e),yi=class extends pt{tag="colgroup";selfAttributes(){return["align","valign","char","charoff","span","width"]}},Zc=e=>new yi(e),Me=class extends T{constructor(e="tbody",...r){super(...r),this.tag=e}selfAttributes(){return["align","valign","char","charoff","bgcolor"]}},Jc=(...e)=>new Me("tbody",...e),Kc=(...e)=>new Me("thead",...e),Qc=(...e)=>new Me("tfoot",...e),_i=class extends T{tag="tr";selfAttributes(){return["align","bgcolor","bordercolor","char","charoff","valign"]}},Mc=(...e)=>new _i(...e),Lo=class extends T{constructor(e="td",...r){super(...r),this.tag=e}selfAttributes(){return["abbr","align","axis","background","bgcolor","bordercolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"]}},$c=(...e)=>new Lo("th",...e),tp=(...e)=>new Lo("td",...e),Ci=class extends T{tag="cite"},ep=(...e)=>new Ci(...e),zi=class extends T{tag="code"},op=(...e)=>new zi(...e),Si=class extends T{tag="dl"},Ai=class extends T{tag="dt"},Ti=class extends T{tag="dd"},rp=(...e)=>new Si(...e),ap=(...e)=>new Ai(...e),ip=(...e)=>new Ti(...e),Ei=class extends T{tag="details"},np=(...e)=>new Ei(...e),ji=class extends T{tag="summary"},lp=(...e)=>new ji(...e),Di=class extends T{tag="dfn"},sp=(...e)=>new Di(...e),Ii=class extends T{tag="div";selfAttributes(){return["align","title"]}},cp=(...e)=>new Ii(...e),Bi=class extends T{tag="em"},pp=(...e)=>new Bi(...e),No=class extends T{tag="i"},dp=(...e)=>new No(...e),mp=(...e)=>new No(...e),Pi=class extends T{tag="strong"},hp=(...e)=>new Pi(...e),Oi=class extends T{tag="embed";selfAttributes(){return["align","height","hspace","pluginspace","src","type","vspace","width"]}},up=(...e)=>new Oi(...e),Li=class extends T{tag="noembed"},fp=(...e)=>new Li(...e),Ni=class extends T{tag="fieldset";selfAttributes(){return["form","title"]}},gp=(...e)=>new Ni(...e),Fi=class extends T{tag="legend";selfAttributes(){return["align","title"]}},bp=(...e)=>new Fi(...e),Ri=class extends T{tag="figure"},xp=(...e)=>new Ri(...e),Vi=class extends T{tag="figcaption"},vp=(...e)=>new Vi(...e),Hi=class extends T{tag="form";selfAttributes(){return["accept-charset","action","autocomplete","enctype","method","name","novalidate","target"]}},kp=(...e)=>new Hi(...e),Yi=class extends T{tag="frameset";selfAttributes(){return["border","bordercolor","cols","frameborder","framespacing","rows"]}},wp=(...e)=>new Yi(...e),Ui=class extends pt{tag="frame";selfAttributes(){return["bordercolor","frameborder","noresize","name","src","scrolling"]}},yp=(e={})=>new Ui(e),qi=class extends T{tag="noframes"},_p=(...e)=>new qi(...e),Wi=class extends T{tag="iframe";selfAttributes(){return["align","allowtransparency","frameborder","height","hspace","marginheight","marginwidth","name","sandbox","scrolling","seamless","src","srcdoc","vspace","width"]}},Cp=(...e)=>new Wi(...e),Gi=class extends T{tag="ins";selfAttributes(){return["cite","datetime"]}},zp=(...e)=>new Gi(...e),Xi=class extends T{tag="kbd"},Sp=(...e)=>new Xi(...e),Zi=class extends T{tag="label";selfAttributes(){return["for"]}},Ap=(...e)=>new Zi(...e),Fo=class extends T{constructor(e="ul",...r){super(...r),this.tag=e}selfAttributes(){return this.tag==="ul"?["type"]:["type","reserved","start"]}},Ji=class extends T{tag="li";selfAttributes(){return["type","value"]}},Tp=(...e)=>new Fo("ul",...e),Ep=(...e)=>new Fo("ol",...e),jp=(...e)=>new Ji(...e),Ki=class extends T{tag="mark"},Dp=(...e)=>new Ki(...e),Qi=class extends T{tag="noscript"},Ip=(...e)=>new Qi(...e),Mi=class extends T{tag="select";selfAttributes(){return["autofocus","form","name","size"]}},Bp=(...e)=>new Mi(...e),$i=class extends T{tag="optgroup";selfAttributes(){return["label"]}},Pp=(...e)=>new $i(...e),tn=class extends T{tag="option";selfAttributes(){return["label","value"]}},Op=(...e)=>new tn(...e),en=class extends T{tag="output";selfAttributes(){return["for","form","name"]}},Lp=(...e)=>new en(...e),on=class extends T{tag="p";selfAttributes(){return["align"]}},Np=(...e)=>new on(...e),rn=class extends T{tag="pre"},Fp=(...e)=>new rn(...e),Ro=class extends T{tag="q";selfAttributes(){return["cite"]}},Rp=(...e)=>new Ro(...e),Vp=(...e)=>new Ro(...e),Vo=class extends T{tag="strike"},Hp=(...e)=>new Vo(...e),Yp=(...e)=>new Vo(...e),an=class extends T{tag="script";selfAttributes(){return["async","defer","language","src","type"]}},Up=(...e)=>new an(...e),nn=class extends T{tag="small"},qp=(...e)=>new nn(...e),ln=class extends pt{tag="source";selfAttributes(){return["media","src","type"]}},Wp=(e={})=>new ln(e),sn=class extends T{tag="sub"},Gp=(...e)=>new sn(...e),cn=class extends T{tag="sup"},Xp=(...e)=>new cn(...e),pn=class extends T{tag="textarea";selfAttributes(){return["autofocus","cols","form","maxlength","name","placeholder","rows","wrap"]}},Zp=(...e)=>new pn(...e),dn=class extends T{tag="time";selfAttributes(){return["datetime","pubdate"]}},Jp=(...e)=>new dn(...e),mn=class extends pt{tag="track";selfAttributes(){return["kind","src","srclang","label"]}},Kp=(e={})=>new mn(e),hn=class extends T{tag="var"},Qp=(...e)=>new hn(...e),un=class extends T{tag="video";selfAttributes(){return["autoplay","controls","height","loop","loop","poster","preload","src","width"]}},Mp=(...e)=>new un(...e),fn=class extends pt{tag="wbr"},$p=e=>new fn(e),gn=class extends T{tag="main"},td=(...e)=>new gn(...e),bn=class extends pt{tag="meta";selfAttributes(){return["content","name","http-equiv","charset"]}},ed=e=>new bn(e),xn=class extends T{tag="title"},od=e=>new xn(e),vn=class extends T{tag="template";selfAttributes(){return["shadowrootmode","shadowrootdelegatesfocus","shadowrootclonable","shadowrootserializable"]}},rd=(...e)=>new vn(...e),kn=class extends T{tag="ruby"},wn=class extends pt{tag="rt"},yn=class extends pt{tag="rp"},ad=(...e)=>new kn(...e),id=e=>new wn(e),nd=e=>new yn(e),_n=class extends T{tag="data"},ld=(...e)=>new _n(...e),Cn=class extends T{tag="picture"},sd=(...e)=>new Cn(...e),zn=class extends T{tag="dialog";selfAttributes(){return["open"]}},cd=(...e)=>new zn(...e),Sn=class extends T{tag="slot";selfAttributes(){return["name"]}},pd=(...e)=>new Sn(...e),Io={},dd="0.15.1",md="18.05.2025, 14:41:46",An=()=>{console.info(`%c Html.js %c v${dd} %c ${md} `,"color: #ffffff; font-weight: bold; background: #708238","color: white; background: darkgreen","color: white; background: #0080fe;")},hd=(e=globalThis)=>{for(let r in Qe)globalThis[r]&&(Io[r]=globalThis[r]),e[r]=Qe[r]},ud=(e=globalThis)=>{for(let r in Io)e[r]=Io[r]},Tn={BaseElement:Ke,Tag:T,SingleTag:pt,...Qe,extract:hd,restore:ud},En={addStyle:cc,addCssRule:Ya,createStyleSheet:Ha,createStyleElement:Po};globalThis.HTML={cssLoader:Ua,jsLoader:qa,render:Va,...Tn,...En,info:An};var qo={};Zo(qo,{americanExpress:()=>Qm,array:()=>pm,base64:()=>im,between:()=>em,bigint:()=>Bd,boolean:()=>cm,bytes:()=>rh,color:()=>Nm,compose:()=>_d,contains:()=>hh,creditCard:()=>Zm,date:()=>Od,digits:()=>ch,diners:()=>$m,discover:()=>Mm,domain:()=>zm,email:()=>Xd,endsWith:()=>Td,equal:()=>xh,finite:()=>rm,float:()=>dh,func:()=>Nd,great:()=>yh,greatOrEqual:()=>Sh,hexColor:()=>Fm,hslColor:()=>Vm,imei:()=>hm,info:()=>Dh,integer:()=>Rd,ip:()=>km,ipv4:()=>wm,ipv6:()=>ym,jcb:()=>th,length:()=>um,less:()=>Ch,lessOrEqual:()=>Th,mastercard:()=>Km,max:()=>Wd,maxLength:()=>gm,min:()=>Ud,minLength:()=>fm,notNull:()=>ih,notNumber:()=>lm,number:()=>Qd,object:()=>$d,parse:()=>Yo,pattern:()=>lh,pipe:()=>wd,required:()=>Jd,rgbColor:()=>Rm,safeInteger:()=>Hd,safeParse:()=>vd,similar:()=>kh,startsWith:()=>Sd,string:()=>Ho,symbol:()=>Dd,type:()=>gh,unionPay:()=>eh,unknown:()=>Ed,url:()=>Tm,visa:()=>Jm});var fd=Object.defineProperty,jn=Object.getOwnPropertySymbols,gd=Object.prototype.hasOwnProperty,bd=Object.prototype.propertyIsEnumerable,Dn=(e,r,l)=>r in e?fd(e,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[r]=l,xd=(e,r)=>{for(var l in r||(r={}))gd.call(r,l)&&Dn(e,l,r[l]);if(jn)for(var l of jn(r))bd.call(r,l)&&Dn(e,l,r[l]);return e},P=class extends Error{constructor(e="",r=null,l){super(e),this.message=e,this.name=r,this.value=l}},Yo=(e,r)=>{let l;if(!e)throw new Error("Schema object required for parse data!");if(typeof e=="function"){if(l=e.apply(null,[r]),l instanceof P)throw l}else for(let t in e){let o=r[t],a=e[t];if(!a)throw new P(`Guard not defined for field ${t} in input data!`,"general",r);if(!r.hasOwnProperty(t))throw new P(`Field ${t} doesn't exists in input data!`,"general",r);if(typeof a=="function"){if(console.log(a.name),l=a.apply(null,[o]),l instanceof P)throw l}else Yo(a,o)}return r},vd=(e,r)=>{let l;if(!e)throw new Error("Schema object required for parse data!");if(typeof e=="function"){if(l=e.apply(null,[r]),l instanceof P)return{ok:!1,error:l}}else for(let t in e){let o=r[t],a=e[t];if(a)if(typeof a=="function"){if(l=a.apply(null,[r]),l instanceof P)return{ok:!1,error:l}}else Yo(a,o)}return{ok:!0,output:r}},kd=(...e)=>r=>e.reduce((l,t)=>t(l),r),wd=kd,yd=(...e)=>r=>e.reduceRight((l,t)=>t(l),r),_d=yd,Cd="VAL must be a string",Ho=(e=Cd)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"?r:new P(l,"string",r)},re=e=>typeof e<"u"&&e!==null,zd="VAL must starts with START_VAL",Sd=(e,r=zd)=>{if(!re(e))throw new Error("START_VALUE not defined!");return function(l){let t=r.replace(/VAL/g,l).replace(/START_VAL/g,e);return typeof l=="string"&&l.startsWith(e)?l:new P(t,"startsWith",l)}},Ad="VAL must end with END_VAL",Td=(e,r=Ad)=>{if(!re(e))throw new Error("END_VALUE not defined!");return function(l){let t=r.replace(/VAL/g,l).replace(/END_VAL/g,e);return typeof l=="string"&&l.endsWith(e)?l:new P(t,"endsWith",l)}},Ed=()=>function(e){return e},jd="A symbol is required",Dd=(e=jd)=>function(r){return typeof r=="symbol"?r:new P(e,"symbol",r)},Id="VAL must be a bigint",Bd=(e=Id)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="bigint"?r:new P(l,"bigint",r)},Pd="VAL must be valid date object or date string",Od=(e=Pd)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="object"&&r.getTime||typeof r=="string"&&!isNaN(Date.parse(r))?r:new P(l,"date",r)},Ld="The value must be a function",Nd=(e=Ld)=>function(r){return typeof r=="function"?r:new P(e,"function",r)},Fd="VAL must be an integer",Rd=(e=Fd)=>function(r){let l=e.replace(/VAL/g,r);return Number.isInteger(r)?r:new P(l,"integer",r)},Vd="VAL must be an safe integer",Hd=(e=Vd)=>function(r){let l=e.replace(/VAL/g,r);return Number.isSafeInteger(r)?r:new P(l,"safeInteger",r)},Yd="VAL must be a great then MIN_VALUE",Ud=(e,r=Yd)=>{if(!re(e))throw new Error("MIN_VALUE not defined!");return function(l){let t=r.replace(/VAL/g,l).replace(/MIN_VALUE/g,e),o=+l;return!isNaN(o)&&o>=+e?l:new P(t,"minValue",l)}},qd="VAL must be a less then MAX_VALUE",Wd=(e,r=qd)=>{if(!re(e))throw new Error("MAX_VALUE not defined!");return function(l){let t=r.replace(/VAL/g,l).replace(/MAX_VALUE/g,e),o=+l;return!isNaN(o)&&o<=+e?l:new P(t,"maxValue",l)}},Gd="VAL must be a string in valid email format",Xd=(e=Gd)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)?r:new P(l,"email",r)},Zd="Any value required",Jd=(e=Zd)=>function(r){let l=e.replace(/VAL/g,r);return typeof r<"u"&&r!==null&&r!==""?r:new P(l,"required",r)},Kd="VAL must be a number",Qd=(e=Kd)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="number"&&!isNaN(+r)?r:new P(l,"number",r)},Md="VAL must be an object",$d=(e,r=Md)=>{if(typeof e!="object")throw new P(r.replace(/VAL/g,e),"object",e);return xd({},e)},tm="VAL must be between MIN_VAL and MAX_VAL",em=(e,r,l=tm)=>{if(!re(e))throw new Error("MIN_VALUE not defined!");if(!re(r))throw new Error("MAX_VALUE not defined!");return function(t){let o=l.replace(/VAL/g,t).replace(/MIN_VAL/g,e).replace(/MAX_VAL/g,r),a=+t;return!isNaN(a)&&t>=+e&&t<=+r?t:new P(o,"between",t)}},om="VAL must be a finite number",rm=(e=om)=>function(r){let l=e.replace(/VAL/g,r);return Number.isFinite(r)?r:new P(l,"finite",r)},am="VAL must be a string in valid base 64 format",im=(e=am)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(r)?r:new P(l,"base64",r)},nm="VAL can`t be a number",lm=(e=nm)=>function(r){let l=e.replace(/VAL/g,r);return isNaN(r)?r:new P(l,"notNumber",r)},sm="VAL must be a boolean",cm=(e=sm)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="boolean"?r:new P(l,"boolean",r)},In="VAL must be an array of TYPE",pm=(e,r=In)=>(!e&&!r&&(e=Ho(),r=In),typeof e=="string"&&(r=e,e=Ho()),function(l){let t=r.replace(/VAL/g,l).replace(/TYPE/g,e.name);if(!Array.isArray(l))return new P(t,"array",l);for(let o of l)if(e(o)instanceof P)return new P(t,"array",l);return l}),dm="VAL must be a valid EMEI",mm=e=>{let r=o=>{let a=0;for(;o>0;)a=a+o%10,o=parseInt(""+o/10,10);return a},l=(""+e).length;if(l!==15)return!1;let t=0;for(let o=l;o>=1;o--){let a=e%10;o%2===0&&(a=2*a),t+=r(a),e=parseInt(""+e/10,10)}return t%10===0},hm=(e=dm)=>function(r){let l=e.replace(/VAL/g,r);return mm(r)?r:new P(l,"emei",r)},Uo="VAL must be a string or array with length N",um=(e,r=Uo)=>function(l){let t=r.replace(/VAL/g,l).replace(/N/g,e);return(typeof l=="string"||Array.isArray(l))&&l.length===+e?l:new P(t,"length",l)},fm=(e,r=Uo)=>function(l){let t=r.replace(/VAL/g,l).replace(/N/g,e);return(typeof l=="string"||Array.isArray(l))&&l.length>=+e?l:new P(t,"minLength",l)},gm=(e,r=Uo)=>function(l){let t=r.replace(/VAL/g,l).replace(/N/g,e);return(typeof l=="string"||Array.isArray(l))&&l.length<=+e?l:new P(t,"maxLength",l)},bm="VAL must be a valid ip address ipv4 or ipv6",xm="VAL must be a valid ipv4 address",vm="VAL must be a valid ipv6 address",Bn=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,Pn=/^[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}$/,km=(e=bm)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&(Bn.test(r)||Pn.test(r))?r:new P(l,"ip",r)},wm=(e=xm)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&Bn.test(r)?r:new P(l,"ipv4",r)},ym=(e=vm)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&Pn.test(r)?r:new P(l,"ipv6",r)},_m="VAL must be a valid domain name, xn--* for internationalized names",Cm=/^((xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/,zm=(e=_m)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&Cm.test(r)?r:new P(l,"domain",r)},Sm="VAL must be a valid url",Am=/^(?:(?:(?:https?|ftp|wss?):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i,Tm=(e=Sm)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&Am.test(r)?r:new P(l,"url",r)},Em="VAL must be a valid color in HEX, RGB(A), or HSL(A) format",jm="VAL must be a valid HEX color",Dm="VAL must be a valid RGB(a) color",Im="VAL must be a valid HSL(A) color",Bm=/^#(?:[\da-f]{3}){1,2}$|^#(?:[\da-f]{4}){1,2}$|^(rgb|hsl)a?\((\s*-?\d+%?\s*,){2}(\s*-?\d+%?\s*)\)$|^(rgb|hsl)a?\((\s*-?\d+%?\s*,){3}\s*(0|(0?\.\d+)|1)\)$/gmi,Pm=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,Om=/^rgba?\((\s*-?\d+%?\s*,){2}(\s*-?\d+%?\s*)\)$|^rgba?\((\s*-?\d+%?\s*,){3}\s*(0|(0?\.\d+)|1)\)$/gmi,Lm=/^hsla?\((\s*-?\d+%?\s*,){2}(\s*-?\d+%?\s*)\)$|^hsla?\((\s*-?\d+%?\s*,){3}\s*(0|(0?\.\d+)|1)\)$/gmi,Nm=(e=Em)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&Bm.test(r)?r:new P(l,"color",r)},Fm=(e=jm)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&Pm.test(r)?r:new P(l,"hexColor",r)},Rm=(e=Dm)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&Om.test(r)?r:new P(l,"rgbColor",r)},Vm=(e=Im)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&Lm.test(r)?r:new P(l,"hslColor",r)},On=/^4\d{12}(?:\d{3,6})?$/u,Ln=/^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,Nn=/^3[47]\d{13}$/u,Fn=/^6(?:011|5\d{2})\d{12,15}$/u,Rn=/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,Vn=/^(?:2131|1800|35\d{3})\d{11}$/u,Hn=/^(?:6[27]\d{14,17}|81\d{14,17})$/u,Yn="VAL must be a valid CC number (visa, mastercard, american express, discover, diners club, jcb, or union pay)",Hm="VAL must be a valid Visa card number",Ym="VAL must be a valid Mastercard card number",Um="VAL must be a valid American Express card number",qm="VAL must be a valid DISCOVER card number",Wm="VAL must be a valid DINERS CLUB card number",Gm="VAL must be a valid JCB card number",Xm="VAL must be a valid Union Pay card number",Zm=(e=Yn)=>function(r){let l=e.replace(/VAL/g,r);return typeof r=="string"&&(On.test(r)||Ln.test(r)||Nn.test(r)||Fn.test(r)||Rn.test(r)||Vn.test(r)||Hn.test(r))?r:new P(l,"creditCard",r)},ae=(e,r,l=Yn)=>function(t){let o=l.replace(/VAL/g,t);return typeof t=="string"&&r.test(t)?t:new P(o,e,t)},Jm=(e=Hm)=>ae("visa",On,e),Km=(e=Ym)=>ae("mastercard",Ln,e),Qm=(e=Um)=>ae("american express",Nn,e),Mm=(e=qm)=>ae("discover",Fn,e),$m=(e=Wm)=>ae("diners club",Rn,e),th=(e=Gm)=>ae("jcb card",Vn,e),eh=(e=Xm)=>ae("union pay",Hn,e),oh="The length of string must be VAL bytes",rh=(e,r=oh)=>function(l){let t=r.replace(/VAL/g,l);return typeof l=="string"&&new TextEncoder().encode(l).length===e?l:new P(t,"bytes",l)},ah="VAL can`t be null or undefined.",ih=(e=ah)=>function(r){let l=e.replace(/VAL/g,r);return re(r)?r:new P(l,"notNull",r)},nh="The value must match the pattern",lh=(e,r=nh)=>function(l){let t=r.replace(/VAL/g,l);return(typeof e=="string"?new RegExp(e,"g"):e).test(""+l)?l:new P(t,"pattern",l)},sh="VAL must contains only digits",ch=(e=sh)=>function(r){let l=e.replace(/VAL/g,r);return/^\d+$/g.test(""+r)?r:new P(l,"digits",r)},ph="VAL must be a float",dh=(e=ph)=>function(r){let l=e.replace(/VAL/g,r);return!isNaN(r)&&+n%1!==0||/^\d*\.\d+$/.test(r)?r:new P(l,"float",r)},mh="VAL must must contains OBJ",hh=(e,r=mh)=>function(l){let t=r.replace(/VAL/g,l).replace(/OBJ/g,e);return l.includes(e)?l:new P(t,"contains",l)},uh="A VAL must have type TYPE";function fh(e){return Object.prototype.toString.call(e).replace(/^\[object (.+)]$/,"$1").toLowerCase()}var gh=(e="string",r=uh)=>function(l){let t=r.replace(/VAL/g,l).replace(/TYPE/g,e);return e===fh(l)?l:new P(t,"type",l)},bh="VAL must be an equal to VALUE",xh=(e,r=bh)=>function(l){let t=r.replace(/VAL/g,l).replace(/VALUE/g,e);return l===e?l:new P(t,"equal",l)},vh="VAL must be a similar to VALUE",kh=(e,r=vh)=>function(l){let t=r.replace(/VAL/g,l).replace(/VALUE/g,e);return l==e?l:new P(t,"similar",l)},wh="VAL must be a great then VALUE",yh=(e,r=wh)=>function(l){let t=r.replace(/VAL/g,l).replace(/VALUE/g,e);return l>e?l:new P(t,"great",l)},_h="VAL must be a less then VALUE",Ch=(e,r=_h)=>function(l){let t=r.replace(/VAL/g,l).replace(/VALUE/g,e);return l<e?l:new P(t,"less",l)},zh="VAL must be a great or equal to VALUE",Sh=(e,r=zh)=>function(l){let t=r.replace(/VAL/g,l).replace(/VALUE/g,e);return l>=e?l:new P(t,"greatOrEqual",l)},Ah="VAL must be a less or equal to VALUE",Th=(e,r=Ah)=>function(l){let t=r.replace(/VAL/g,l).replace(/VALUE/g,e);return l<=e?l:new P(t,"lessOrEqual",l)},Eh="0.7.3",jh="18.05.2025, 14:43:24",Dh=()=>{console.info(`%c Guardian %c v${Eh} %c ${jh} `,"color: pink; font-weight: bold; background: #2b1700","color: white; background: darkgreen","color: white; background: #0080fe;")};globalThis.G=qo;var E=class at{static DEBUG_LEVELS={NONE:0,ERROR:1,WARN:2,INFO:3,DEBUG:4,TRACE:5};static DEBUG_LEVEL=at.DEBUG_LEVELS.NONE;static log(r,l,t){if(r>at.DEBUG_LEVEL)return;let o={error:"color: #ff5555; font-weight: bold",warn:"color: #ffaa00; font-weight: bold",info:"color: #0080fe; font-weight: bold",debug:"color: #00aa00; font-weight: bold",trace:"color: #888888",data:"color: #555; font-style: italic"},a,i;switch(r){case at.DEBUG_LEVELS.ERROR:a="error",i=console.error;break;case at.DEBUG_LEVELS.WARN:a="warn",i=console.warn;break;case at.DEBUG_LEVELS.INFO:a="info",i=console.info;break;case at.DEBUG_LEVELS.DEBUG:a="debug",i=console.debug;break;case at.DEBUG_LEVELS.TRACE:a="trace",i=console.log;break;default:return}console.group(`%c Model: ${l}`,o[a]),t!==void 0&&console.log("%c Data:",o.data,t),console.groupEnd()}static error(r,l){at.log(at.DEBUG_LEVELS.ERROR,r,l)}static warn(r,l){at.log(at.DEBUG_LEVELS.WARN,r,l)}static info(r,l){at.log(at.DEBUG_LEVELS.INFO,r,l)}static debug(r,l){at.log(at.DEBUG_LEVELS.DEBUG,r,l)}static trace(r,l){at.log(at.DEBUG_LEVELS.TRACE,r,l)}},Ih="0.4.1",Bh="18.05.2025, 14:39:57",Un=class{constructor(e={}){if(E.DEBUG_LEVEL=e.debug?4:0,E.debug("[Router] Init Router"),this.routes={},this.fallbackRoute=e.fallback||"/",this.maxRedirects=e.maxRedirects||5,this.redirectCount=0,this.basePath=e.base||"",this.middleware=[],this.beforeEachHooks=[],this.afterEachHooks=[],this.cache=new Map,this.cacheLimit=e.cacheLimit??50,this.touchStartX=0,this.enableSwipeNavigation=e.enableSwipeNavigation||!1,this.current=null,this.redirects={},this.useHash=e.useHash||!1,this.events={beforeNavigate:[],afterNavigate:[],routeNotFound:[],error:[]},this.plugins=[],this.enableSwipeNavigation&&this.initSwipeNavigation(),e.routes){E.debug("[Router] Registering routes");for(let[r,l]of Object.entries(e.routes))this.addRoute(r,l)}e.plugins&&Array.isArray(e.plugins)&&(E.debug("[Router] Registering plugins"),e.plugins.forEach(r=>{Array.isArray(r)?this.usePlugin(r[0],r[1]||{}):this.usePlugin(r)})),E.debug("[Router] Subscribing to unhandledrejection event"),window.addEventListener("unhandledrejection",this.handleError.bind(this)),E.debug("[Router] Router Initialized")}on(e,r){return E.debug(`[Router] Subscribing to event ${e}`),this.events[e]&&this.events[e].push(r),this}emit(e,...r){if(E.debug(`[Router] Emitting event ${e}`),this.events[e])for(let l of this.events[e]){let t=l(...r);if(e==="beforeNavigate"&&t===!1)return!1}return!0}initSwipeNavigation(){E.debug("[Router] Initializing swipe navigation"),E.debug("[Router] Adding touchstart event listener"),document.addEventListener("touchstart",e=>{this.touchStartX=e.touches[0].clientX},{passive:!0}),E.debug("[Router] Adding touchend event listener"),document.addEventListener("touchend",e=>{let r=e.changedTouches[0].clientX,l=this.touchStartX-r;Math.abs(l)>100&&(l>0?(E.debug("[Router] Swiping right (forward)"),window.history.forward()):(E.debug("[Router] Swiping left (backward)"),window.history.back()))},{passive:!0})}handleError(e){E.error("[Router] Error during navigation:",e),this.emit("error",e),this.routes["/error"]?this.navigateTo("/error",!0):this.navigateTo(this.fallbackRoute,!0)}sanitizePath(e){E.debug("[Router] Sanitizing path:",e);try{if(!e)return"/";let r=new URL(e,window.location.origin),l=decodeURIComponent(r.pathname);return l=l.replace(/[<>'"`;(){}]/g,"").replace(/[\u0000-\u001F\u007F-\u009F]/g,"").replace(/([^/])\/{2,}/g,"$1/").replace(/\/+/g,"/").replace(/(.+)\/$/,"$1").replace(/\.+/g,".").split("/").filter(t=>t!==".."&&t!==".").join("/"),l.startsWith("/")||(l="/"+l),this.isBlockedPath(l)?"/":(E.debug("[Router] Sanitized path:",l),l)}catch(r){return E.error("[Router] Error sanitizing path:",r),"/"}}isBlockedPath(e){return E.debug("[Router] Checking if path is blocked:",e),[/^\/(api|admin|wp-admin|wp-content|wp-includes)/i,/\.(php|asp|aspx|jsp|cgi|config|env|git|sql|htaccess)$/i,/\/(.+\/)*\.{2,}\//,/javascript:/i,/data:/i,/vbscript:/i,/file:/i].some(r=>r.test(e))}test(e){E.debug("[Router] Testing path:",e);let r=e,l=this.sanitizePath(e),t={original:r,sanitized:l,isBlocked:this.isBlockedPath(l),isModified:r!==l};return E.debug(`[Router] test result for path ${e}:`,t),t}beforeEach(e){return E.debug("[Router] Adding beforeEach hook"),this.beforeEachHooks.push(e),this}afterEach(e){return E.debug("[Router] Adding afterEach hook"),this.afterEachHooks.push(e),this}use(e){return E.debug("[Router] Adding middleware"),this.middleware.push(e),this}addRedirect(e,r){return E.debug("[Router] Adding redirect from",e,"to",r),this.redirects[e]?!1:(this.redirects[e]=r,this)}addRoute(e,r){return E.debug("[Router] Adding route",e),this.routes[e]=r,this}addNestedRoute(e,r,l){E.debug(`[Router] Adding nested route ${r} to ${e}`);let t=`${e}${r}`.replace(/\/\//g,"/");return this.addRoute(t,l),this}addLazyRoute(e,r){return E.debug("[Router] Adding lazy-loaded route",e),this.addRoute(e,async l=>{try{let t=await r();return(t.default||t)(l)}catch(t){throw t}}),this}addLazyNestedRoute(e,r,l){E.debug("[Router] Adding lazy-loaded nested route",r,"to",e);let t=`${e}${r}`.replace(/\/\//g,"/");return this.addLazyRoute(t,l),this}addFallbackRoute(e){return E.debug("[Router] Adding fallback route",e),this.fallbackRoute=e,this}add404Route(e){return E.debug("[Router] Adding 404 route",e),this.routes["/404"]=e,this}addErrorRoute(e){return E.debug("[Router] Adding error route",e),this.routes["/error"]=e,this}addProtectedRoute(e,r,l,t="/login"){return E.debug("[Router] Adding protected route",e),this.addRoute(e,async o=>{if(await l(o))return E.debug("[Router] Guard function passed, executing callback"),r(o);E.debug("[Router] Guard function failed, redirecting to",t),await this.navigateTo(t,!0)}),this}removeRoute(e){return E.debug("[Router] Removing route",e),this.routes[e]&&delete this.routes[e],this}updateRoute(e,r){return E.debug("[Router] Updating route",e),this.routes[e]&&(this.routes[e]=r),this}getRoutes(){return E.debug("[Router] Getting registered routes"),this.routes}async navigate(e){if(E.debug("[Router] Navigating to",e),this.redirectCount>this.maxRedirects){E.error("[Router] Maximum redirect limit reached, redirecting to",this.fallbackRoute),console.error("Maximum redirect limit reached"),this.redirectCount=0,this.emit("error",new Error("Maximum redirect limit reached")),await this.navigateTo("/error",!0);return}this.redirectCount++;let r=this.matchRoute(this.sanitizePath(e));if(r)try{if(E.debug("[Router] Route matched:",r),this.emit("beforeNavigate",r)===!1){E.debug("[Router] Navigation cancelled by beforeNavigate hook");return}if(this.redirects[r.path]){E.debug("[Router] Redirecting to",this.redirects[r.path]),await this.navigateTo(this.redirects[r.path],!0);return}this.redirectCount++;for(let l of this.middleware)E.debug("[Router] Executing middleware"),await l(r);for(let l of this.beforeEachHooks)E.debug("[Router] Executing beforeEach hook"),await l(r);E.debug("[Router] Executing route callback"),await r.callback(r.params);for(let l of this.afterEachHooks)E.debug("[Router] Executing afterEach hook"),await l(r);this.current=r,this.emit("afterNavigate",r),E.debug("[Router] Navigation completed")}catch(l){E.error("[Router] Error during navigation:",l),console.error("Navigation error:",l),this.emit("error",l),this.routes["/error"]&&this.routes["/error"](l)}else E.warn("[Router] Route not found:",e),this.redirectCount=0,this.emit("routeNotFound",e),this.routes["/404"]&&this.routes["/404"]()}async navigateTo(e,r=!1){E.debug(`[Router] Navigating to ${e} ${r?"with replace state":""}`),this.redirectCount=0;let l=new URL(e,window.location.origin);r?(E.debug("[Router] Replacing state with",l),window.history.replaceState({},"",l)):(E.debug("[Router] Pushing state with",l),window.history.pushState({},"",l)),E.debug("[Router] Navigating to",l),await this.navigate(l.pathname)}matchRoute(e){if(E.debug("[Router] Matching route for",e),this.cache.has(e))return this.cache.get(e);E.debug("[Router] Route not found in cache, performing match");let r=this._performMatch(e);if(this.cache.size>=this.cacheLimit){E.debug("[Router] Cache limit reached, removing oldest entry");let l=this.cache.keys().next().value;this.cache.delete(l)}return E.debug("[Router] Caching result for",e),this.cache.set(e,r),r}_performMatch(e){let[r,l]=e.split("?"),t=new URLSearchParams(l),o=Object.fromEntries(t);for(let a in this.routes){let i=[],s=a.replace(/:([^\/]+)/g,(p,d)=>(i.push(d),"([^/]+)")),c=e.match(new RegExp(`^${s}$`));if(c){let p=c.slice(1).reduce((d,m,h)=>(d[i[h]]=m,d),{});return{path:e,pattern:s,callback:this.routes[a],params:p,query:o}}}return null}clearCache(){E.debug("[Router] Clearing cache"),this.cache.clear()}resetRedirectCount(){E.debug("[Router] Resetting redirect count"),this.redirectCount=0}getFullPath(e){return E.debug("[Router] Getting full path for",e),this.useHash?`#${e}`:e}getPathFromLocation(){return E.debug("[Router] Getting path from location"),this.useHash?window.location.hash.slice(1)||"/":window.location.pathname}listen(){return E.debug("[Router] Starting to listen for navigation events"),this._handleNavigation=()=>{this.redirectCount=0,this.navigate(this.getPathFromLocation()).then(e=>{})},this._handleLinkClick=e=>{if(e.target.tagName==="A"){let r=e.target.getAttribute("href");if(r&&(this.useHash&&r.startsWith("#")||!this.useHash&&e.target.href.startsWith(window.location.origin))){e.preventDefault();let l=this.useHash?r.slice(1):e.target.pathname;this.redirectCount=0,this.navigateTo(l).then(t=>{})}}},E.debug("[Router] Listening for navigation events"),window.addEventListener(this.useHash?"hashchange":"popstate",this._handleNavigation),E.debug("[Router] Listening for link clicks"),document.addEventListener("click",this._handleLinkClick),this._initPlugins(),this.redirectCount=0,this.navigate(this.getPathFromLocation()).then(e=>{}),this}_initPlugins(){E.debug("[Router] Init plugins"),this.plugins.forEach(({plugin:e,options:r})=>{typeof e.onInit=="function"&&e.onInit(this,r)})}usePlugin(e,r={}){if(!e)return this;if(E.debug("[Router] Using plugin",e),typeof e=="object"&&typeof e.install=="function")E.debug("[Router] Installing plugin",e),e.install(this,r);else if(typeof e=="function")E.debug("[Router] Executing plugin",e),e(this,r);else return E.warn("Invalid plugin format. Plugin must be an object with install method or a function."),this;return E.debug("[Router] Add plugin to store",e),this.plugins.push({plugin:e,options:r}),E.debug("[Router] Plugin initialized"),this}destroy(){E.debug("[Router] Destroying router"),this.plugins.forEach(({plugin:e,options:r})=>{E.debug("[Router] Destroying plugin",e),typeof e.onDestroy=="function"&&e.onDestroy(this,r)}),E.debug("[Router] Removing event listeners"),window.removeEventListener(this.useHash?"hashchange":"popstate",this._handleNavigation),document.removeEventListener("click",this._handleLinkClick),window.removeEventListener("unhandledrejection",this.handleError),this._handleNavigation=null,this._handleLinkClick=null,this.routes={},this.plugins=[],this.cache.clear(),E.debug("[Router] Router destroyed")}};Un.info=()=>{console.info(`%c Router %c v${Ih} %c ${Bh} `,"color: #ffffff; font-weight: bold; background: #ed1cab","color: white; background: darkgreen","color: white; background: #0080fe;")};var Ph=Un,qn=Ph;globalThis.Router=qn;var Oh=class{constructor(){this.events=new Map}on(e,r){return this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(r),()=>this.off(e,r)}off(e,r){this.events.has(e)&&this.events.get(e).delete(r)}emit(e,r){this.events.has(e)&&this.events.get(e).forEach(l=>{try{l(r)}catch(t){console.error(`Error when performing an event handler ${e}:`,t)}})}},Wo=Oh,Lh=`
61 <style>
62 #model-devtools-panel {
63 position: fixed;

Callers 15

onMethod · 0.45
metro.jsFile · 0.45
iFunction · 0.45
splitter.jsFile · 0.45
drag-items.jsFile · 0.45
changeCanDragFunction · 0.45
ribbon-menu.jsFile · 0.45
resizable.jsFile · 0.45
canResizeFunction · 0.45
listview.jsFile · 0.45
treeview.jsFile · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected