UNPKG

@runeya/runeya

Version:

Monitor processes as a stack

2 lines (1 loc) 11.3 kB
import{C as Z}from"./router-CdfdQZKk.js";import{r as N,k as z,w as R}from"./index-CXxIspfv.js";import{i as _,d as q,b as U,a as j,c as v,e as O,f as rr,g as V,h as er,j as tr,k as J,l as ar,m as or,n as nr,o as sr,p as K,q as ir,r as lr,s as G,t as ur,u as cr,v as fr,S as dr,w as mr}from"./_baseFor-DiPelG4M.js";function yr(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function hr(t,e){var r=-1,s=t.length;for(e||(e=Array(s));++r<s;)e[r]=t[r];return e}var gr=800,pr=16,br=Date.now;function Cr(t){var e=0,r=0;return function(){var s=br(),a=pr-(s-r);if(r=s,a>0){if(++e>=gr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function vr(t){return function(){return t}}var kr=q?function(t,e){return q(t,"toString",{configurable:!0,enumerable:!1,value:vr(e),writable:!0})}:_,Tr=Cr(kr);function Or(t,e,r,s){var a=!r;r||(r={});for(var i=-1,l=e.length;++i<l;){var o=e[i],n=void 0;n===void 0&&(n=t[o]),a?U(r,o,n):j(r,o,n)}return r}var H=Math.max;function $r(t,e,r){return e=H(e===void 0?t.length-1:e,0),function(){for(var s=arguments,a=-1,i=H(s.length-e,0),l=Array(i);++a<i;)l[a]=s[e+a];a=-1;for(var o=Array(e+1);++a<e;)o[a]=s[a];return o[e]=r(l),yr(t,this,o)}}function wr(t,e){return Tr($r(t,e,_),t+"")}function Pr(t,e,r){if(!v(r))return!1;var s=typeof e;return(s=="number"?O(r)&&rr(e,r.length):s=="string"&&e in r)?V(r[e],t):!1}function Sr(t){return wr(function(e,r){var s=-1,a=r.length,i=a>1?r[a-1]:void 0,l=a>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(a--,i):void 0,l&&Pr(r[0],r[1],l)&&(i=a<3?void 0:i,a=1),e=Object(e);++s<a;){var o=r[s];o&&t(e,o,s,i)}return e})}function xr(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ir=Object.prototype,Ar=Ir.hasOwnProperty;function Er(t){if(!v(t))return xr(t);var e=er(t),r=[];for(var s in t)s=="constructor"&&(e||!Ar.call(t,s))||r.push(s);return r}function Q(t){return O(t)?tr(t,!0):Er(t)}var Lr="[object Object]",Mr=Function.prototype,Br=Object.prototype,X=Mr.toString,Dr=Br.hasOwnProperty,Fr=X.call(Object);function Nr(t){if(!J(t)||ar(t)!=Lr)return!1;var e=or(t);if(e===null)return!0;var r=Dr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&X.call(r)==Fr}function k(t,e,r){(r!==void 0&&!V(t[e],r)||r===void 0&&!(e in t))&&U(t,e,r)}function Rr(t){return J(t)&&O(t)}function T(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function qr(t){return Or(t,Q(t))}function Kr(t,e,r,s,a,i,l){var o=T(t,r),n=T(e,r),d=l.get(n);if(d){k(t,r,d);return}var f=i?i(o,n,r+"",t,e,l):void 0,p=f===void 0;if(p){var y=K(n),m=!y&&nr(n),c=!y&&!m&&sr(n);f=n,y||m||c?K(o)?f=o:Rr(o)?f=hr(o):m?(p=!1,f=ir(n,!0)):c?(p=!1,f=lr(n,!0)):f=[]:Nr(n)||G(n)?(f=o,G(o)?f=qr(o):(!v(o)||ur(o))&&(f=cr(n))):p=!1}p&&(l.set(n,f),a(f,n,s,i,l),l.delete(n)),k(t,r,f)}function Y(t,e,r,s,a){t!==e&&fr(e,function(i,l){if(a||(a=new dr),v(i))Kr(t,e,l,r,Y,s,a);else{var o=s?s(T(t,l),i,l+"",t,e,a):void 0;o===void 0&&(o=i),k(t,l,o)}},Q)}var Gr=Sr(function(t,e,r){Y(t,e,r)});const Hr={rules:{system:{backgroundColor0:"#fff",backgroundColor50:"#f8f8f8",backgroundColor100:"#eee",backgroundColor200:"#ddd",backgroundColor300:"#ccc",backgroundColor400:"#888",backgroundColor500:"#777",backgroundColor600:"#555",backgroundColor700:"#333",backgroundColor800:"#222",backgroundColor900:"#111",backgroundColor950:"#000",color0:"#000",color50:"#111",color100:"#222",color200:"#333",color300:"#444",color400:"#555",color500:"#666",color600:"#888",color700:"#aaa",color800:"#ccc",color900:"#ddd",color950:"#fff",primary50:"#faecfb",primary100:"#f0c5f3",primary200:"#e69fec",primary300:"#db78e4",primary400:"#d151dc",primary500:"#c72bd4",primary600:"#a323ae",primary700:"#7f1b87",primary800:"#5a1360",primary900:"#360c3a",primary950:"#120413",secondary50:"#faecfb",secondary100:"#f0c5f3",secondary200:"#e69fec",secondary300:"#db78e4",secondary400:"#d151dc",secondary500:"#c72bd4",secondary600:"#a323ae",secondary700:"#7f1b87",secondary800:"#5a1360",secondary900:"#360c3a",secondary950:"#120413",tertiary50:"#faecfb",tertiary100:"#f0c5f3",tertiary200:"#e69fec",tertiary300:"#db78e4",tertiary400:"#d151dc",tertiary500:"#c72bd4",tertiary600:"#a323ae",tertiary700:"#7f1b87",tertiary800:"#5a1360",tertiary900:"#360c3a",tertiary950:"#120413",terminalContrastRatio:7},background:{color:"var(--system-color0)",backgroundColor:"var(--system-backgroundColor100)"},sidebarMain:{color:"var(--system-color600)",backgroundColor:"var(--system-backgroundColor0)"},sidebar:{color:"var(--system-color0)",backgroundColor:"var(--system-backgroundColor50)"}}},Wr={rules:{system:{backgroundColor0:"#000",backgroundColor50:"#0a0a0a",backgroundColor100:"#222",backgroundColor200:"#333",backgroundColor300:"#444",backgroundColor400:"#555",backgroundColor500:"#777",backgroundColor600:"#888",backgroundColor700:"#aaa",backgroundColor800:"#ccc",backgroundColor900:"#ddd",backgroundColor950:"#fff",color0:"#fff",color50:"#ddd",color100:"#ccc",color200:"#bbb",color300:"#aaa",color400:"#888",color500:"#666",color600:"#555",color700:"#333",color800:"#222",color900:"#111",color950:"#000",primary50:"#120413",primary100:"#360c3a",primary200:"#5a1360",primary300:"#7f1b87",primary400:"#a323ae",primary500:"#c72bd4",primary600:"#db78e4",primary700:"#e69fec",primary800:"#f0c5f3",primary900:"#faecfb",primary950:"#fff",secondary50:"#120413",secondary100:"#360c3a",secondary200:"#5a1360",secondary300:"#7f1b87",secondary400:"#a323ae",secondary500:"#c72bd4",secondary600:"#db78e4",secondary700:"#e69fec",secondary800:"#f0c5f3",secondary900:"#faecfb",secondary950:"#fff",tertiary50:"#120413",tertiary100:"#360c3a",tertiary200:"#5a1360",tertiary300:"#7f1b87",tertiary400:"#a323ae",tertiary500:"#c72bd4",tertiary600:"#db78e4",tertiary700:"#e69fec",tertiary800:"#f0c5f3",tertiary900:"#faecfb",tertiary950:"#fff",terminalContrastRatio:7},background:{color:"var(--system-color300)",backgroundColor:"var(--system-backgroundColor100)"},sidebarMain:{color:"var(--system-color300)",backgroundColor:"var(--system-backgroundColor300)"},sidebar:{color:"var(--system-color200)",backgroundColor:"var(--system-backgroundColor200)"}}};class _r{constructor(){this.themes=N({light:Hr,dark:Wr}),this.currentTheme=N("light"),this.buildedTheme=this.themes.value.light,this.observableCurrentTheme=new Z,z.get("/api/plugins/themes").then(e=>{this.themes.value={...this.themes.value,...e.data}}),R(()=>this.currentTheme.value,e=>{this.apply(e)}),R(()=>this.themes.value[this.currentTheme.value],e=>{this.loadCurrentTheme()},{deep:!0})}load(e={}){Object.assign(this.themes.value,e),this.loadCurrentTheme(),this.apply(this.currentTheme.value)}get(e){var a,i,l;const[r,s]=e.split("/");return(l=(i=(a=this.buildedTheme)==null?void 0:a.rules)==null?void 0:i[r])==null?void 0:l[s]}loadCurrentTheme(){let e=localStorage.getItem("currentTheme");e||(localStorage.setItem("currentTheme","lightPurple"),e="lightPurple"),e==="light"&&(localStorage.setItem("currentTheme","lightPurple"),e="lightPurple"),e==="dark"&&(localStorage.setItem("currentTheme","darkPurple"),e="darkPurple"),this.themes.value[e]||(e="light"),this.currentTheme.value=e}lighter(e,r){return W.lighter(e,r)}buildTheme(e){let r=mr(this.themes.value[e]);if(!r)throw new Error(`${e} theme not exists`);if(r.base){if(!this.themes.value[r.base])return r;r=Gr(this.buildTheme(r.base),r)}return r}apply(e){var s,a,i,l,o,n,d,f,p,y,m,c,g,h,$,w,P,S,x,I,A,E,L,M;localStorage.setItem("currentTheme",e);const r=this.buildTheme(e);this.currentTheme.value=e,this.buildedTheme=r,this.currentTheme.value.startsWith("dark")?(document.documentElement.classList.add("theme-dark"),document.documentElement.classList.remove("theme-light")):(document.documentElement.classList.add("theme-light"),document.documentElement.classList.remove("theme-dark")),this.observableCurrentTheme.next("apply",e),Object.keys(r.rules).forEach(B=>{const D=r.rules[B];Object.keys(D).forEach(F=>{const b=`--${B.replaceAll(".","-")}-${F}`,C=D[F];u(b,C),u(`${b}-darker`,this.lighter(-.3,C)),u(`${b}-darkest`,this.lighter(-.5,C)),u(`${b}-lighter`,this.lighter(.3,C)),u(`${b}-lightest`,this.lighter(.5,C))})}),u("--p-surface-0",(s=r.rules.system)==null?void 0:s.backgroundColor0),u("--p-surface-50",(a=r.rules.system)==null?void 0:a.backgroundColor50),u("--p-surface-100",(i=r.rules.system)==null?void 0:i.backgroundColor100),u("--p-surface-200",(l=r.rules.system)==null?void 0:l.backgroundColor200),u("--p-surface-300",(o=r.rules.system)==null?void 0:o.backgroundColor300),u("--p-surface-400",(n=r.rules.system)==null?void 0:n.backgroundColor400),u("--p-surface-500",(d=r.rules.system)==null?void 0:d.backgroundColor500),u("--p-surface-600",(f=r.rules.system)==null?void 0:f.backgroundColor600),u("--p-surface-700",(p=r.rules.system)==null?void 0:p.backgroundColor700),u("--p-surface-800",(y=r.rules.system)==null?void 0:y.backgroundColor800),u("--p-surface-900",(m=r.rules.system)==null?void 0:m.backgroundColor900),u("--p-surface-950",(c=r.rules.system)==null?void 0:c.backgroundColor950),u("--p-primary-50",(g=r.rules.system)==null?void 0:g.primary950),u("--p-primary-100",(h=r.rules.system)==null?void 0:h.primary900),u("--p-primary-200",($=r.rules.system)==null?void 0:$.primary800),u("--p-primary-300",(w=r.rules.system)==null?void 0:w.primary700),u("--p-primary-400",(P=r.rules.system)==null?void 0:P.primary600),u("--p-primary-500",(S=r.rules.system)==null?void 0:S.primary500),u("--p-primary-600",(x=r.rules.system)==null?void 0:x.primary400),u("--p-primary-700",(I=r.rules.system)==null?void 0:I.primary300),u("--p-primary-800",(A=r.rules.system)==null?void 0:A.primary200),u("--p-primary-900",(E=r.rules.system)==null?void 0:E.primary100),u("--p-primary-950",(L=r.rules.system)==null?void 0:L.primary50),u("--p-tabs-nav-button-shadow",`0px 0px 10px 50px ${W.lighter(0,(M=r.rules.system)==null?void 0:M.backgroundColor300)}55`),console.log(r.rules)}}function u(t,e){const r=document.querySelector(":root");if(r){if(!t.startsWith("--"))throw new Error("Css variable should starts with --");r.style.setProperty(t,e)}}const Qr=new _r,W={lighter(t,e,r,s){let a,i,l,o,n,d,f;const p=parseInt,y=Math.round;let m=typeof r=="string";return typeof t!="number"||t<-1||t>1||typeof e!="string"||e[0]!="r"&&e[0]!="#"||r&&!m||(this.pSBCr||(this.pSBCr=c=>{let g=c.length;const h={};if(g>9){if([a,i,l,m]=c=c.split(","),g=c.length,g<3||g>4)return null;h.r=p(a[3]=="a"?a.slice(5):a.slice(4)),h.g=p(i),h.b=p(l),h.a=m?parseFloat(m):-1}else{if(g==8||g==6||g<4)return null;g<6&&(c=`#${c[1]}${c[1]}${c[2]}${c[2]}${c[3]}${c[3]}${g>4?c[4]+c[4]:""}`),c=p(c.slice(1),16),g==9||g==5?(h.r=c>>24&255,h.g=c>>16&255,h.b=c>>8&255,h.a=y((c&255)/.255)/1e3):(h.r=c>>16,h.g=c>>8&255,h.b=c&255,h.a=-1)}return h}),f=e.length>9,f=m?r.length>9?!0:r=="c"?!f:!1:f,n=this.pSBCr(e),o=t<0,d=r&&r!="c"?this.pSBCr(r):o?{r:0,g:0,b:0,a:-1}:{r:255,g:255,b:255,a:-1},t=o?t*-1:t,o=1-t,!n||!d)?null:(s?(a=y(o*n.r+t*d.r),i=y(o*n.g+t*d.g),l=y(o*n.b+t*d.b)):(a=y((o*n.r**2+t*d.r**2)**.5),i=y((o*n.g**2+t*d.g**2)**.5),l=y((o*n.b**2+t*d.b**2)**.5)),m=n.a,d=d.a,n=m>=0||d>=0,m=n?m<0?d:d<0?m:m*o+d*t:0,f?`rgb${n?"a(":"("}${a},${i},${l}${n?`,${y(m*1e3)/1e3}`:""})`:`#${(4294967296+a*16777216+i*65536+l*256+(n?y(m*255):0)).toString(16).slice(1,n?void 0:-2)}`)}};export{Qr as T};